21
21
#include "discodlg.h"
23
#include <qlistview.h>
24
#include <qcombobox.h>
25
#include <qcheckbox.h>
26
#include <qmessagebox.h>
28
#include <qstatusbar.h>
29
#include <qpopupmenu.h>
30
#include <qsignalmapper.h>
31
#include <qpushbutton.h>
32
#include <qdragobject.h>
34
#include <qtoolbutton.h>
23
#include <q3listview.h>
24
#include <q3popupmenu.h>
29
#include <QMessageBox>
31
#include <QSignalMapper>
32
#include <QPushButton>
33
#include <QToolButton>
37
#include <QActionGroup>
40
#include <QContextMenuEvent>
37
42
#include "xmpp_tasks.h"
39
#include "psitoolbar.h"
40
44
#include "tasklist.h"
41
45
#include "psiaccount.h"
42
46
#include "psicon.h"
43
47
#include "busywidget.h"
44
48
#include "common.h"
45
49
#include "iconaction.h"
50
#include "psiiconset.h"
51
#include "psitooltip.h"
52
#include "stretchwidget.h"
53
#include "psioptions.h"
54
#include "accountlabel.h"
56
//----------------------------------------------------------------------------
58
PsiIcon category2icon(const QString &category, const QString &type, int status=STATUS_ONLINE)
60
// TODO: update this to http://www.jabber.org/registrar/disco-categories.html#gateway
62
// still have to add more options...
63
if ( category == "service" || category == "gateway" ) {
68
else if (type == "icq")
70
else if (type == "msn")
72
else if (type == "yahoo")
74
else if (type == "gadu-gadu" || type == "x-gadugadu")
76
else if (type == "sms")
81
return PsiIconset::instance()->transportStatus(trans, status);
90
else if ( category == "conference" ) {
91
if (type == "public" || type == "private" || type == "text" || type == "irc")
92
return IconsetFactory::icon("psi/groupChat");
93
else if (type == "url")
94
return IconsetFactory::icon("psi/www");
99
else if ( category == "validate" ) {
101
return IconsetFactory::icon("psi/xml");
105
else if ( category == "user" || category == "client" ) {
111
return PsiIconset::instance()->status(STATUS_ONLINE);
47
139
//----------------------------------------------------------------------------
48
140
// DiscoData -- a shared data struct
81
173
//----------------------------------------------------------------------------
83
//----------------------------------------------------------------------------
85
class ProtocolAction : public QAction
89
ProtocolAction(QString text, QString toolTip, QObject *parent, QSignalMapper *sm, int parm);
91
bool addTo(QWidget *w);
99
ProtocolAction::ProtocolAction(QString text, QString toolTip, QObject *parent, QSignalMapper *sm, int parm)
100
: QAction(text, text, 0, parent)
103
setToggleAction(true);
105
connect(this, SIGNAL(activated()), sm, SLOT(map()));
106
sm->setMapping(this, parm);
110
bool ProtocolAction::addTo(QWidget *w)
112
if ( w->inherits("QToolBar") ) {
115
QCString bname = name() + QCString("_action_button");
116
btn = new QToolButton ( w, bname );
118
btn->setToggleButton ( isToggleAction() );
119
btn->setOn( isOn() );
120
btn->setTextLabel ( text() );
121
btn->setEnabled ( isEnabled() );
122
btn->setUsesTextLabel( true );
123
QToolTip::add(btn, toolTip());
125
connect(btn, SIGNAL(toggled(bool)), this, SLOT(setOn(bool)));
133
void ProtocolAction::setOn(bool b)
144
//----------------------------------------------------------------------------
146
175
//----------------------------------------------------------------------------
148
class DiscoListItem : public QObject, public QListViewItem
177
class DiscoListItem : public QObject, public Q3ListViewItem
152
DiscoListItem(DiscoItem it, DiscoData *d, QListView *parent);
153
DiscoListItem(DiscoItem it, DiscoData *d, QListViewItem *parent);
181
DiscoListItem(DiscoItem it, DiscoData *d, Q3ListView *parent);
182
DiscoListItem(DiscoItem it, DiscoData *d, Q3ListViewItem *parent);
154
183
~DiscoListItem();
156
185
QString text(int columns) const;
195
226
DiscoDlg *dlg() const;
198
DiscoListItem::DiscoListItem(DiscoItem it, DiscoData *_d, QListView *parent)
199
: QListViewItem (parent)
229
DiscoListItem::DiscoListItem(DiscoItem it, DiscoData *_d, Q3ListView *parent)
230
: Q3ListViewItem (parent)
206
DiscoListItem::DiscoListItem(DiscoItem it, DiscoData *_d, QListViewItem *parent)
207
: QListViewItem (parent)
237
DiscoListItem::DiscoListItem(DiscoItem it, DiscoData *_d, Q3ListViewItem *parent)
238
: Q3ListViewItem (parent)
244
273
di.setNode ( it.node() );
245
274
if ( !(!di.name().isEmpty() && it.name().isEmpty()) )
246
275
di.setName ( it.name() );
277
if ( di.name().isEmpty() && !di.jid().full().isEmpty() ) // use JID in the Name column
278
di.setName ( di.jid().full() );
248
280
di.setAction ( it.action() );
283
315
DiscoItem::Identity id = di.identities().first();
285
317
if ( !id.category.isEmpty() ) {
286
Icon ic = category2icon(id.category, id.type);
318
PsiIcon ic = category2icon(id.category, id.type);
288
320
if ( !ic.impix().isNull() ) {
289
setPixmap (0, ic.impix().pixmap());
321
setPixmap (0, ic.impix());
296
setPixmap (0, is->status(di.jid(), STATUS_ONLINE));
328
setPixmap(0, PsiIconset::instance()->status(di.jid(), STATUS_ONLINE).impix());
400
437
else if ( !autoItems ) {
401
438
QString error = jt->statusString();
402
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error getting items for <b>%1</b>.\nReason: %2").arg(di.jid().full()).arg(error));
439
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error getting items for <b>%1</b>.<br>Reason: %2").arg(di.jid().full()).arg(QString(error).replace('\n', "<br>")));
405
442
alreadyItems = true;
462
499
else if ( !autoItems ) {
463
500
QString error = jt->statusString();
464
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error browsing items for <b>%1</b>.\nReason: %2").arg(di.jid().full()).arg(error));
501
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error browsing items for <b>%1</b>.<br>Reason: %2").arg(di.jid().full()).arg(QString(error).replace('\n', "<br>")));
467
504
alreadyItems = true;
526
563
else if ( !autoItems ) {
527
564
QString error = jt->statusString();
528
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error getting agents for <b>%1</b>.\nReason: %2").arg(di.jid().full()).arg(error));
565
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error getting agents for <b>%1</b>.<br>Reason: %2").arg(di.jid().full()).arg(QString(error).replace('\n', "<br>")));
531
568
alreadyItems = true;
542
579
void DiscoListItem::updateItemsFinished(const DiscoList &list)
544
QDict<DiscoListItem> children;
581
Q3Dict<DiscoListItem> children;
545
582
DiscoListItem *child = (DiscoListItem *)firstChild();
546
583
while ( child ) {
547
584
children.insert( child->hash(), child );
614
651
if ( jt->success() ) {
615
652
updateInfo( jt->item() );
617
else if ( !autoInfo && d->protocol != DiscoData::Auto ) {
618
QString error = jt->statusString();
619
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error getting item's info for <b>%1</b>.\nReason: %2").arg(di.jid().full()).arg(error));
655
QString error_str = jt->statusString();
656
int error_code = jt->statusCode();
657
setExpandable(false);
659
// we change the icon for the items with disco#info returning type=="cancel" || type=="wait" error codes
660
// based on http://www.jabber.org/jeps/jep-0086.html
662
// FIXME: use another method for checking XMPP error-types when Iris will provide one
663
if ( error_code==400 || error_code==404 || error_code==405 || error_code==409 ||
664
error_code==500 || error_code==501 || error_code==503 || error_code==504 ) {
665
bool pixmapOk = false;
666
if ( !di.identities().isEmpty() ) {
667
DiscoItem::Identity id = di.identities().first();
668
if ( !id.category.isEmpty() ) {
669
PsiIcon ic = category2icon(id.category, id.type, STATUS_ERROR);
671
if ( !ic.impix().isNull() ) {
672
setPixmap (0, ic.impix());
678
setPixmap(0, PsiIconset::instance()->status(di.jid(), STATUS_ERROR).impix());
680
repaint(); //for setExpandable() called earlier
683
errorInfo=QString("%1").arg(QString(error_str).replace('\n', "<br>"));
685
if ( !autoInfo && d->protocol != DiscoData::Auto ) {
686
QMessageBox::critical(dlg(), tr("Error"), tr("There was an error getting item's info for <b>%1</b>.<br>Reason: %2").arg(di.jid().full()).arg(QString(error_str).replace('\n', "<br>")));
622
690
alreadyInfo = true;
636
704
//----------------------------------------------------------------------------
638
class DiscoListView : public QListView, public QToolTip
706
class DiscoListView : public Q3ListView
642
710
DiscoListView(QWidget *parent);
645
void maybeTip(const QPoint &);
646
QDragObject *dragObject();
713
bool maybeTip(const QPoint &);
716
bool eventFilter(QObject* o, QEvent* e);
717
void resizeEvent(QResizeEvent*);
649
720
DiscoListView::DiscoListView(QWidget *parent)
650
: QListView(parent), QToolTip(viewport())
652
723
addColumn( tr( "Name" ) );
653
724
addColumn( tr( "JID" ) );
654
725
addColumn( tr( "Node" ) );
657
void DiscoListView::maybeTip(const QPoint &pos)
659
DiscoListItem *i = (DiscoListItem *)itemAt(pos);
726
for (int i = 0; i < 3; i++)
727
setColumnWidthMode(i, Q3ListView::Manual);
728
header()->setStretchEnabled(true, 0);
731
void DiscoListView::resizeEvent(QResizeEvent* e)
733
Q3ListView::resizeEvent(e);
735
setColumnWidth(2, header()->fontMetrics().width(columnText(2)) * 2);
736
float remainingWidth = visibleWidth() - columnWidth(2);
737
setColumnWidth(1, int(remainingWidth * 0.3));
739
header()->adjustHeaderSize();
743
* \param pos should be in global coordinate system.
745
bool DiscoListView::maybeTip(const QPoint &pos)
747
DiscoListItem* i = (DiscoListItem*)itemAt(viewport()->mapFromGlobal(pos));
663
751
// NAME <JID> (Node "NODE")
674
762
QString text = "<qt><nobr>";
675
763
DiscoItem item = i->item();
677
if ( !item.name().isEmpty() )
765
if ( item.name()!=item.jid().full() )
678
766
text += item.name() + " ";
680
768
text += "<" + item.jid().full() + ">";
694
782
DiscoItem::Identities::ConstIterator it = item.identities().begin();
695
783
for ( ; it != item.identities().end(); ++it) {
697
Icon icon( category2icon((*it).category, (*it).type) );
785
PsiIcon icon( category2icon((*it).category, (*it).type) );
698
786
if ( !icon.name().isEmpty() )
699
787
text += "<icon name=\"" + icon.name() + "\"> ";
700
788
text += (*it).name;
813
QString errorInfo=i->getErrorInfo();
814
if ( !errorInfo.isEmpty() ) {
815
text += "<br>\n<br>\n<b>" + tr("Error:") + "</b>\n";
726
820
QRect r( itemRect(i) );
821
PsiToolTip::showText(pos, text, this);
730
QDragObject *DiscoListView::dragObject()
825
bool DiscoListView::eventFilter(QObject* o, QEvent* e)
732
DiscoListItem *i = (DiscoListItem *)selectedItem();
736
QDragObject *d = new QTextDrag(i->item().jid().full(), this);
737
d->setPixmap(IconsetFactory::icon("status/online"), QPoint(8,8));
827
if (e->type() == QEvent::ToolTip && o->isWidgetType()) {
828
QWidget* w = static_cast<QWidget*>(o);
829
QHelpEvent* he = static_cast<QHelpEvent*>(e);
830
maybeTip(w->mapToGlobal(he->pos()));
833
return Q3ListView::eventFilter(o, e);
741
836
//----------------------------------------------------------------------------
750
// helper class for use in toolbar
751
class StretchWidget : public QWidget
845
class ProtocolAction : public QAction
754
StretchWidget(QWidget *parent)
848
ProtocolAction(QString text, QString toolTip, QObject *parent, QSignalMapper *sm, int parm)
849
: QAction(text, parent)
757
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
856
connect(this, SIGNAL(activated()), sm, SLOT(map()));
857
sm->setMapping(this, parm);
761
861
// helper class to store browser history
864
Q3ListViewItem *item;
766
History(QListViewItem *it) {
866
History(Q3ListViewItem *it) {
790
890
IconAction *actBrowse, *actBack, *actForward, *actRefresh, *actStop;
792
892
// custom actions, that will be added to toolbar and context menu
793
IconAction *actRegister, *actSearch, *actJoin, *actVCard, *actAdd;
893
IconAction *actRegister, *actSearch, *actJoin, *actAHCommand, *actVCard, *actAdd;
795
typedef QPtrList<History> HistoryList;
895
typedef Q3PtrList<History> HistoryList;
796
896
HistoryList backHistory, forwardHistory;
798
898
BusyWidget *busy;
821
921
void disableButtons();
822
922
void enableButtons(const DiscoItem &);
824
void itemSelected (QListViewItem *);
825
void itemDoubleclicked (QListViewItem *);
924
void itemSelected (Q3ListViewItem *);
925
void itemDoubleclicked (Q3ListViewItem *);
826
926
bool eventFilter (QObject *, QEvent *);
828
928
void setProtocol(int);
844
944
connect(data.tasks, SIGNAL(started()), SLOT(itemUpdateStarted()));
845
945
connect(data.tasks, SIGNAL(finished()), SLOT(itemUpdateFinished()));
846
946
data.d = new DiscoConnector(this);
847
connect(data.d, SIGNAL(itemUpdated(QListViewItem *)), SLOT(itemSelected (QListViewItem *)));
947
connect(data.d, SIGNAL(itemUpdated(Q3ListViewItem *)), SLOT(itemSelected (Q3ListViewItem *)));
848
948
data.protocol = DiscoData::Auto;
850
950
backHistory.setAutoDelete(true);
854
954
busy = parent->busy;
855
955
connect(busy, SIGNAL(destroyed(QObject *)), SLOT(objectDestroyed(QObject *)));
857
QListView *lv_discoOld = dlg->lv_disco;
858
dlg->lv_disco = new DiscoListView(dlg->centralWidget());
957
Q3ListView *lv_discoOld = dlg->lv_disco;
958
dlg->lv_disco = new DiscoListView(dlg);
859
959
replaceWidget(lv_discoOld, dlg->lv_disco);
861
961
dlg->lv_disco->installEventFilter (this);
862
connect(dlg->lv_disco, SIGNAL(selectionChanged (QListViewItem *)), SLOT(itemSelected (QListViewItem *)));;
863
connect(dlg->lv_disco, SIGNAL(doubleClicked (QListViewItem *)), SLOT(itemDoubleclicked (QListViewItem *)));;
962
connect(dlg->lv_disco, SIGNAL(selectionChanged (Q3ListViewItem *)), SLOT(itemSelected (Q3ListViewItem *)));;
963
connect(dlg->lv_disco, SIGNAL(doubleClicked (Q3ListViewItem *)), SLOT(itemDoubleclicked (Q3ListViewItem *)));;
865
965
// protocol actions
866
966
QSignalMapper *pm = new QSignalMapper(this);
868
968
QActionGroup *protocolActions = new QActionGroup (this);
869
969
protocolActions->setExclusive(true);
871
ProtocolAction *autoProtocol = new ProtocolAction (tr("Auto"), tr("Automatically determine protocol"), protocolActions, pm, DiscoData::Auto);
872
ProtocolAction *discoProtocol = new ProtocolAction ("D", tr("Service Discovery"), protocolActions, pm, DiscoData::Disco);
873
ProtocolAction *browseProtocol = new ProtocolAction ("B", tr("Browse Services"), protocolActions, pm, DiscoData::Browse);
874
ProtocolAction *agentsProtocol = new ProtocolAction ("A", tr("Browse Agents"), protocolActions, pm, DiscoData::Agents);
875
autoProtocol->setOn(true);
971
ProtocolAction *autoProtocol = NULL, *discoProtocol = NULL, *browseProtocol = NULL, *agentsProtocol = NULL;
972
if (PsiOptions::instance()->getOption("options.ui.show-deprecated.service-discovery.protocol-selector").toBool()) {
973
autoProtocol = new ProtocolAction (tr("Auto"), tr("Automatically determine protocol"), protocolActions, pm, DiscoData::Auto);
974
discoProtocol = new ProtocolAction ("D", tr("Service Discovery"), protocolActions, pm, DiscoData::Disco);
975
browseProtocol = new ProtocolAction ("B", tr("Browse Services"), protocolActions, pm, DiscoData::Browse);
976
agentsProtocol = new ProtocolAction ("A", tr("Browse Agents"), protocolActions, pm, DiscoData::Agents);
977
autoProtocol->setChecked(true);
877
980
// create actions
878
981
actBrowse = new IconAction (tr("Browse"), "psi/jabber", tr("&Browse"), 0, dlg);
898
1001
actJoin = new IconAction (tr("Join"), "psi/groupChat", tr("&Join"), 0, dlg);
899
1002
connect (actJoin, SIGNAL(activated()), sm, SLOT(map()));
900
1003
sm->setMapping(actJoin, Features::FID_Groupchat);
1004
actAHCommand = new IconAction (tr("Execute command"), "psi/command", tr("&Execute command"), 0, dlg);
1005
connect (actAHCommand, SIGNAL(activated()), sm, SLOT(map()));
1006
sm->setMapping(actAHCommand, Features::FID_AHCommand);
901
1007
actVCard = new IconAction (tr("vCard"), "psi/vCard", tr("&vCard"), 0, dlg);
902
1008
connect (actVCard, SIGNAL(activated()), sm, SLOT(map()));
903
1009
sm->setMapping(actVCard, Features::FID_VCard);
906
1012
sm->setMapping(actAdd, Features::FID_Add);
908
1014
// create toolbar
909
toolBar = new PsiToolBar(dlg);
910
toolBar->setCustomizeable( false );
1015
toolBar = new QToolBar(tr("Service Discovery toolbar"), dlg);
1016
toolBar->setIconSize(QSize(16,16));
1017
toolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
1018
replaceWidget(dlg->toolBarPlaceholder, toolBar);
912
actBack->addTo(toolBar);
913
actBrowse->addTo(toolBar);
914
actForward->addTo(toolBar);
1020
toolBar->addAction(actBack);
1021
toolBar->addAction(actBrowse);
1022
toolBar->addAction(actForward);
916
1024
toolBar->addSeparator();
917
actRefresh->addTo(toolBar);
918
actStop->addTo(toolBar);
1025
toolBar->addAction(actRefresh);
1026
toolBar->addAction(actStop);
920
1028
// custom actions
921
1029
toolBar->addSeparator();
922
actRegister->addTo(toolBar);
923
actSearch->addTo(toolBar);
924
actJoin->addTo(toolBar);
1030
toolBar->addAction(actRegister);
1031
toolBar->addAction(actSearch);
1032
toolBar->addAction(actJoin);
1033
toolBar->addAction(actAHCommand);
926
1035
toolBar->addSeparator();
927
actAdd->addTo(toolBar);
928
actVCard->addTo(toolBar);
1036
toolBar->addAction(actAdd);
1037
toolBar->addAction(actVCard);
1038
toolBar->addAction(actAHCommand);
930
1040
// select protocol
931
toolBar->addSeparator();
932
autoProtocol->addTo(toolBar);
933
discoProtocol->addTo(toolBar);
934
browseProtocol->addTo(toolBar);
935
agentsProtocol->addTo(toolBar);
1041
if (PsiOptions::instance()->getOption("options.ui.show-deprecated.service-discovery.protocol-selector").toBool()) {
1042
toolBar->addSeparator();
1043
toolBar->addAction(autoProtocol);
1044
toolBar->addAction(discoProtocol);
1045
toolBar->addAction(browseProtocol);
1046
toolBar->addAction(agentsProtocol);
937
toolBar->setStretchableWidget(new StretchWidget(toolBar));
938
pa->accountLabel(toolBar, true);
1049
toolBar->addWidget(new StretchWidget(toolBar));
1050
AccountLabel* lb_ident = new AccountLabel(toolBar);
1051
lb_ident->setAccount(pa);
1052
lb_ident->setShowJid(false);
1053
toolBar->addWidget(lb_ident);
941
1056
disableButtons();
970
1085
// check, whether we need to update history
971
1086
if ( (jid.full() != j.full()) || (node != n) ) {
972
QListViewItem *item = dlg->lv_disco->firstChild(); // get the root item
1087
Q3ListViewItem *item = dlg->lv_disco->firstChild(); // get the root item
975
1090
dlg->lv_disco->takeItem( item );
1067
1182
// now, take info from forward history...
1068
QListViewItem *i = forwardHistory.last()->takeItem();
1183
Q3ListViewItem *i = forwardHistory.last()->takeItem();
1069
1184
forwardHistory.removeLast();
1071
1186
// and restore view
1072
1187
backForwardHelper(i);
1075
void DiscoDlg::Private::backForwardHelper(QListViewItem *root)
1190
void DiscoDlg::Private::backForwardHelper(Q3ListViewItem *root)
1077
1192
DiscoListItem *i = (DiscoListItem *)root;
1088
1203
dlg->lv_disco->insertItem( root );
1090
1205
// fixes multiple selection bug
1091
QListViewItemIterator it( dlg->lv_disco );
1206
Q3ListViewItemIterator it( dlg->lv_disco );
1092
1207
while ( it.current() ) {
1093
QListViewItem *item = it.current();
1208
Q3ListViewItem *item = it.current();
1096
1211
if ( item->isSelected() )
1138
1253
actJoin->setEnabled( f.canGroupchat() );
1139
1254
actAdd->setEnabled( itemSelected );
1140
1255
actVCard->setEnabled( f.haveVCard() );
1256
actAHCommand->setEnabled( f.canCommand() );
1143
void DiscoDlg::Private::itemSelected (QListViewItem *item)
1259
void DiscoDlg::Private::itemSelected (Q3ListViewItem *item)
1145
1261
DiscoListItem *it = (DiscoListItem *)item;
1166
1282
// set the prior state of item
1167
1283
// FIXME: causes minor flickering
1168
if ( f.canGroupchat() || f.canRegister() || f.canSearch() ) {
1169
if ( !it->isOpen() ) {
1170
if ( it->isExpandable() || it->childCount() )
1171
it->setOpen( true );
1174
it->setOpen( false );
1180
1286
// trigger default action
1181
if ( f.canGroupchat() ) {
1182
id = Features::FID_Groupchat;
1287
if (f.canCommand() ) {
1288
id = Features::FID_AHCommand;
1290
if (!d.identities().isEmpty()) {
1185
1291
// FIXME: check the category and type for JUD!
1186
1292
DiscoItem::Identity ident = d.identities().first();
1187
1293
bool searchFirst = ident.category == "service" && ident.type == "jud";
1189
1295
if ( searchFirst && f.canSearch() ) {
1190
1296
id = Features::FID_Search;
1193
if ( f.canRegister() )
1298
else if ( ident.category == "conference" && f.canGroupchat() ) {
1299
id = Features::FID_Groupchat;
1301
else if ( f.canRegister() ) {
1194
1302
id = Features::FID_Register;
1307
if ( !it->isOpen() ) {
1308
if ( it->isExpandable() || it->childCount() )
1309
it->setOpen( true );
1312
it->setOpen( false );
1199
1314
emit dlg->featureActivated( Features::feature(id), d.jid(), d.node() );
1202
1318
bool DiscoDlg::Private::eventFilter (QObject *object, QEvent *event)
1258
1374
p.insertSeparator();
1259
1375
actAdd->addTo(&p);
1260
1376
actVCard->addTo(&p);
1377
actAHCommand->addTo(&p);
1262
1379
// popup with all available features
1263
QPopupMenu *fm = new QPopupMenu(&p);
1380
Q3PopupMenu *fm = new Q3PopupMenu(&p);
1265
QValueList<long>::Iterator it = ids.begin();
1382
QList<long>::Iterator it = ids.begin();
1266
1383
for ( ; it != ids.end(); ++it)
1267
1384
fm->insertItem(Features::name(*it), *it + 10000); // TODO: add pixmap
1310
1427
//----------------------------------------------------------------------------
1312
1429
DiscoDlg::DiscoDlg(PsiAccount *pa, const Jid &jid, const QString &node)
1313
: DiscoUI (0, 0, WDestructiveClose)
1432
setAttribute(Qt::WA_DeleteOnClose);
1315
1434
// restore options
1316
1435
ck_autoItems->setChecked(option.discoItems);
1317
1436
ck_autoInfo->setChecked(option.discoInfo);
1322
1441
d->node = node;
1324
setCaption(CAP(caption()));
1325
setIcon(is->transportStatus("transport", STATUS_ONLINE));
1443
setWindowTitle(CAP(caption()));
1444
setWindowIcon(PsiIconset::instance()->transportStatus("transport", STATUS_ONLINE).icon());
1326
1445
X11WM_CLASS("disco");
1328
statusBar()->hide();
1330
pb_browse->setDefault(true);
1331
1447
connect (pb_browse, SIGNAL(clicked()), d, SLOT(doDisco()));
1334
cb_address->setInsertionPolicy(QComboBox::NoInsertion);
1448
pb_browse->setDefault(false);
1449
pb_browse->setAutoDefault(false);
1451
connect(pb_close, SIGNAL(clicked()), this, SLOT(close()));
1452
pb_close->setDefault(false);
1453
pb_close->setAutoDefault(false);
1335
1455
cb_address->insertStringList(pa->psi()->recentBrowseList()); // FIXME
1336
1456
cb_address->setFocus();
1337
1457
connect(cb_address, SIGNAL(activated(const QString &)), d, SLOT(doDisco()));
1338
1458
cb_address->setCurrentText(d->jid.full());
1340
cb_node->setInsertionPolicy(QComboBox::NoInsertion);
1341
1460
cb_node->insertStringList(pa->psi()->recentNodeList());
1342
1461
connect(cb_node, SIGNAL(activated(const QString &)), d, SLOT(doDisco()));
1343
1462
cb_node->setCurrentText(node);