1
/****************************************************************************
2
** servicesdlg.cpp - a dialog for browsing Jabber services/agents/transports
3
** Copyright (C) 2001, 2002 Justin Karneges
5
** This program is free software; you can redistribute it and/or
6
** modify it under the terms of the GNU General Public License
7
** as published by the Free Software Foundation; either version 2
8
** of the License, or (at your option) any later version.
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
15
** You should have received a copy of the GNU General Public License
16
** along with this program; if not, write to the Free Software
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
19
****************************************************************************/
2
* servicesdlg.cpp - a dialog for browsing Jabber services
3
* Copyright (C) 2001, 2002 Justin Karneges
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#include"servicesdlg.h"
23
#include<qpushbutton.h>
25
#include<qstringlist.h>
21
27
#include<qlayout.h>
22
#include<qpushbutton.h>
25
#include"servicesdlg.h"
31
#include<qguardedptr.h>
34
#include<qapplication.h>
35
#include<qdesktopwidget.h>
37
#include"psiaccount.h"
39
#include"xmpp_tasks.h"
29
static ServicesDlg *services_ptr = 0;
31
ServicesDlg::ServicesDlg(int _localStatus, QWidget *parent, const char *name)
32
:ServicesUI(parent, name, FALSE, WDestructiveClose)
41
#include"busywidget.h"
42
#include"iconwidget.h"
44
//----------------------------------------------------------------------------
46
//----------------------------------------------------------------------------
47
class ServicesDlg::Private
55
JT_GetServices *jt_gs;
59
ServicesDlg::ServicesDlg(const Jid &j, PsiAccount *pa)
60
:ServicesUI(0, 0, false, WDestructiveClose)
65
d->pa->dialogRegister(this);
34
68
setCaption(CAP(tr("Manage Services")));
35
setIcon(transport2icon("", STATUS_ONLINE));
40
localStatus = _localStatus;
42
busy = new BusyWidget(this);
43
vb_side->addWidget(busy);
45
pb_register->setEnabled(FALSE);
46
pb_search->setEnabled(FALSE);
47
pb_refresh->setEnabled(FALSE);
49
connect(pb_refresh, SIGNAL(clicked()), SLOT(doRefresh()));
69
setIcon(is->transportStatus("transport", STATUS_ONLINE));
71
d->busy = new BusyWidget(this);
72
replaceWidget(lb_busywidget, d->busy);
74
cb_browse->setInsertionPolicy(QComboBox::NoInsertion);
75
cb_browse->insertStringList(d->pa->psi()->recentBrowseList());
50
77
connect(pb_close, SIGNAL(clicked()), SLOT(close()));
78
connect(pb_browse, SIGNAL(clicked()), SLOT(doBrowse()));
79
connect(cb_browse, SIGNAL(activated(const QString &)), SLOT(doBrowse(const QString &)));
80
connect(li_services, SIGNAL(highlighted(int)), SLOT(serviceSelected(int)));
81
connect(li_services, SIGNAL(doubleClicked(QListBoxItem *)), SLOT(doubleClicked(QListBoxItem *)));
51
82
connect(pb_register, SIGNAL(clicked()), SLOT(serviceRegister()));
52
83
connect(pb_search, SIGNAL(clicked()), SLOT(serviceSearch()));
53
connect(li_services, SIGNAL(highlighted(int)), SLOT(serviceSelected(int)));
54
connect(li_services, SIGNAL(doubleClicked(QListBoxItem *)), SLOT(doubleClicked(QListBoxItem *)));
84
connect(pb_join, SIGNAL(clicked()), SLOT(serviceJoin()));
86
pb_browse->setDefault(true);
87
cb_browse->setCurrentText(d->jid.full());
89
pb_register->setEnabled(false);
90
pb_search->setEnabled(false);
91
pb_join->setEnabled(false);
94
cb_browse->setFocus();
59
100
ServicesDlg::~ServicesDlg()
64
/* static */ ServicesDlg *ServicesDlg::find()
69
void ServicesDlg::closeEvent(QCloseEvent *e)
71
// cancel active transaction (refresh or getform)
73
signalCancelTransaction(id);
76
// accept the close event
103
d->pa->dialogUnregister(this);
80
107
void ServicesDlg::restoreWidgets()
83
pb_refresh->setEnabled(TRUE);
84
li_services->setEnabled(TRUE);
86
serviceSelected(li_services->currentItem());
90
void ServicesDlg::doRefresh()
92
if(localStatus == STATUS_OFFLINE) {
93
QMessageBox::warning(this, tr("Warning"), tr("You must be connected to the server to manage services. Please login first."));
101
pb_refresh->setEnabled(FALSE);
102
pb_register->setEnabled(FALSE);
103
pb_search->setEnabled(FALSE);
108
void ServicesDlg::loadSuccess(JabRoster *list)
110
servicesList = *list;
111
li_services->clear();
113
QPtrListIterator<JabRosterEntry> it(servicesList.list);
114
JabRosterEntry *entry;
115
for(; (entry = it.current()); ++it) {
116
li_services->insertItem(transport2icon(entry->jid), entry->nick);
125
if(li_services->count() > 0)
126
li_services->setSelected(0, TRUE);
129
void ServicesDlg::loadFail()
136
QMessageBox::critical(this, tr("Error"), tr("There was an error retrieving the list of services."));
140
void ServicesDlg::loadFormSuccess()
149
void ServicesDlg::loadFormFail()
156
if(actionType == SERVICESDLG_ACT_REGISTER)
157
QMessageBox::critical(this, tr("Error"), tr("There was an error retrieving the registration form for the %1 service.").arg(regname));
159
QMessageBox::critical(this, tr("Error"), tr("There was an error retrieving the search form for the %1 service.").arg(regname));
163
void ServicesDlg::localUpdate(const JabRosterEntry &e)
165
int oldstate = localStatus;
166
localStatus = e.localStatus();
168
if(localStatus == STATUS_OFFLINE) {
174
pb_register->setEnabled(FALSE);
175
pb_search->setEnabled(FALSE);
176
pb_refresh->setEnabled(FALSE);
177
li_services->clear();
178
servicesList.clear();
109
pb_browse->setEnabled(true);
110
cb_browse->setEnabled(true);
111
li_services->setEnabled(true);
112
serviceSelected(li_services->currentItem());
115
void ServicesDlg::doBrowse(const QString &host)
117
if(!d->pa->checkConnected(this))
124
j = cb_browse->currentText();
129
d->pa->psi()->recentBrowseAdd(d->jid.full());
131
cb_browse->insertStringList(d->pa->psi()->recentBrowseList());
133
li_services->clear();
137
pb_browse->setEnabled(false);
138
cb_browse->setEnabled(false);
139
pb_register->setEnabled(false);
140
pb_search->setEnabled(false);
141
pb_join->setEnabled(false);
143
d->jt_gs = new JT_GetServices(d->pa->client()->rootTask());
144
connect(d->jt_gs, SIGNAL(finished()), SLOT(jt_gs_finished()));
145
d->jt_gs->get(d->jid);
149
void ServicesDlg::jt_gs_finished()
154
JT_GetServices *jt = d->jt_gs;
158
const AgentList & agents = jt->agents();
159
for(AgentList::ConstIterator it = agents.begin(); it != agents.end(); ++it)
160
li_services->insertItem(is->status((*it).jid(), STATUS_ONLINE), (*it).name());
162
if(li_services->count() > 0)
163
li_services->setSelected(0, true);
182
if(oldstate == STATUS_OFFLINE) {
183
doRefresh(); // this will also turn the refresh button on when finished
166
QMessageBox::critical(this, tr("Error"), tr("There was an error browsing the service list.\nReason: %1").arg(jt->statusString()));
188
170
void ServicesDlg::doubleClicked(QListBoxItem *)
172
int x = li_services->currentItem();
173
if(x < 0 || x >= (int)d->agents.count())
175
const Features &f = (*(d->agents.at(x))).features();
178
else if(f.canRegister())
180
else if(f.canSearch())
193
184
void ServicesDlg::serviceSelected(int x)
197
JabRosterEntry *entry = servicesList.list.at(x);
201
if(localStatus == STATUS_OFFLINE)
204
pb_register->setEnabled(entry->isRegisterable);
205
pb_search->setEnabled(entry->isSearchable);
186
if(x < 0 || x >= (int)d->agents.count())
189
const Features &f = (*(d->agents.at(x))).features();
191
pb_register->setEnabled(f.canRegister());
192
pb_search->setEnabled(f.canRegister());
193
pb_join->setEnabled(f.canGroupchat());
208
196
void ServicesDlg::serviceRegister()
210
if(!pb_register->isEnabled())
213
JabRosterEntry *entry = servicesList.list.at(li_services->currentItem());
217
//printf("ServicesDlg: getting registration form: %s\n", entry->nick.latin1());
218
regname = entry->jid;
219
actionType = SERVICESDLG_ACT_REGISTER;
222
li_services->setEnabled(FALSE);
223
pb_refresh->setEnabled(FALSE);
224
pb_register->setEnabled(FALSE);
225
pb_search->setEnabled(FALSE);
230
signalGetRegForm(entry->jid, &id);
198
int x = li_services->currentItem();
199
if(x < 0 || x >= (int)d->agents.count())
201
const AgentItem &a = *(d->agents.at(x));
202
signalRegister(a.jid());
233
205
void ServicesDlg::serviceSearch()
235
JabRosterEntry *entry = servicesList.list.at(li_services->currentItem());
239
//printf("ServicesDlg: getting search form: %s\n", entry->nick.latin1());
240
regname = entry->jid;
241
actionType = SERVICESDLG_ACT_SEARCH;
244
li_services->setEnabled(FALSE);
245
pb_refresh->setEnabled(FALSE);
246
pb_register->setEnabled(FALSE);
247
pb_search->setEnabled(FALSE);
252
signalSearch(entry->jid, &id);
256
RegistrationDlg::RegistrationDlg(const JabForm &_form, QWidget *parent, const char *name)
257
:QDialog(parent, name, FALSE, WDestructiveClose), UniqueWindow(TRUE, "RegistrationDlg", this, cleanJid(_form.jid.s()))
262
setCaption(CAP(tr("Service Registration")));
207
int x = li_services->currentItem();
208
if(x < 0 || x >= (int)d->agents.count())
210
const AgentItem &a = *(d->agents.at(x));
211
signalSearch(a.jid());
214
void ServicesDlg::serviceJoin()
216
int x = li_services->currentItem();
217
if(x < 0 || x >= (int)d->agents.count())
219
const AgentItem &a = *(d->agents.at(x));
224
//----------------------------------------------------------------------------
226
//----------------------------------------------------------------------------
227
class RegistrationDlg::Private
235
QPushButton *pb_close, *pb_reg;
236
QGuardedPtr<JT_Register> jt;
243
QPtrList<QLabel> lb_field;
244
QPtrList<QLineEdit> le_field;
247
RegistrationDlg::RegistrationDlg(const Jid &jid, PsiAccount *pa)
248
:QDialog(0, 0, false, WDestructiveClose)
253
d->pa->dialogRegister(this, d->jid);
256
d->lb_field.setAutoDelete(true);
257
d->le_field.setAutoDelete(true);
259
setCaption(tr("Registration: %1").arg(d->jid.full()));
265
261
QVBoxLayout *vb1 = new QVBoxLayout(this, 4);
267
l = new QLabel(QString(tr("Registration for \"%1\"")).arg(form.jid.s()), this);
268
l->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
270
l = new QLabel(QString("<qt>%1</qt>").arg(form.instructions), this);
271
l->setFrameStyle( QFrame::Panel | QFrame::Sunken );
274
QGridLayout *gr = new QGridLayout(vb1, 2);
276
lb_field.setAutoDelete(TRUE);
277
le_field.setAutoDelete(TRUE);
278
QPtrListIterator<JabFormField> it(form);
280
for(; (f = it.current()); ++it) {
281
QLabel *lb = new QLabel(f->fieldName(), this);
282
QLineEdit *le = new QLineEdit(this);
283
if(f->type() == JabFormField::password)
284
le->setEchoMode(QLineEdit::Password);
285
le->setText(f->value());
290
gr->addWidget(lb, at, 0);
291
gr->addWidget(le, at, 1);
295
QHBoxLayout *hb1 = new QHBoxLayout(vb1);
296
busy = new BusyWidget(this);
298
hb1->addWidget(busy);
262
d->lb_top = new QLabel(this);
263
d->lb_top->setFrameStyle( QFrame::Panel | QFrame::Sunken );
265
vb1->addWidget(d->lb_top);
267
d->gr_form = new QGrid(2, Horizontal, this);
268
d->gr_form->setSpacing(4);
269
vb1->addWidget(d->gr_form);
300
272
QFrame *line = new QFrame(this);
301
273
line->setFixedHeight(2);
302
274
line->setFrameStyle(QFrame::HLine | QFrame::Sunken);
303
275
vb1->addWidget(line);
305
QHBoxLayout *hb2 = new QHBoxLayout(vb1);
306
pb_register = new QPushButton(tr("&Register"), this);
307
connect(pb_register, SIGNAL(clicked()), SLOT(doRegSubmit()));
308
hb2->addWidget(pb_register);
310
pb_close = new QPushButton(tr("&Close"), this);
277
QHBoxLayout *hb1 = new QHBoxLayout(vb1);
278
d->busy = new BusyWidget(this);
279
hb1->addWidget(d->busy);
281
d->pb_reg = new QPushButton(tr("&Register"), this);
282
d->pb_reg->setDefault(true);
283
connect(d->pb_reg, SIGNAL(clicked()), SLOT(doRegSet()));
284
hb1->addWidget(d->pb_reg);
285
d->pb_close = new QPushButton(tr("&Close"), this);
286
connect(d->pb_close, SIGNAL(clicked()), SLOT(close()));
287
hb1->addWidget(d->pb_close);
294
RegistrationDlg::~RegistrationDlg()
297
d->pa->dialogUnregister(this);
301
/*void RegistrationDlg::closeEvent(QCloseEvent *e)
307
void RegistrationDlg::done(int r)
309
if(d->busy->isActive() && d->type == 1) {
310
int n = QMessageBox::information(this, tr("Busy"), tr("<qt>Registration has already been submitted, so closing this window will not prevent the registration from happening. Do you still wish to close?</qt>"), tr("&Yes"), tr("&No"));
317
void RegistrationDlg::doRegGet()
319
d->lb_top->setText(tr("Fetching registration form for %1 ...").arg(d->jid.full()));
324
d->jt = new JT_Register(d->pa->client()->rootTask());
325
connect(d->jt, SIGNAL(finished()), SLOT(jt_finished()));
326
d->jt->getForm(d->jid);
330
void RegistrationDlg::doRegSet()
332
if(!d->pa->checkConnected(this))
335
Form submitForm = d->form;
337
// import the changes back into the form.
338
// the QPtrList of QLineEdits should be in the same order
339
QPtrListIterator<QLineEdit> lit(d->le_field);
340
for(Form::Iterator it = submitForm.begin(); it != submitForm.end(); ++it) {
342
QLineEdit *le = lit.current();
343
f.setValue(le->text());
347
d->gr_form->setEnabled(false);
348
d->pb_reg->setEnabled(false);
352
d->jt = new JT_Register(d->pa->client()->rootTask());
353
connect(d->jt, SIGNAL(finished()), SLOT(jt_finished()));
354
d->jt->setForm(submitForm);
358
void RegistrationDlg::jt_finished()
361
d->gr_form->setEnabled(true);
362
d->pb_reg->setEnabled(true);
363
JT_Register *jt = d->jt;
368
d->form = jt->form();
369
QString str = tr("<b>Registration for \"%1\":</b><br><br>").arg(d->jid.full());
370
str += plain2rich(d->form.instructions());
371
d->lb_top->setText(str);
372
d->lb_top->setFixedWidth(300);
374
for(Form::ConstIterator it = d->form.begin(); it != d->form.end(); ++it) {
375
const FormField &f = *it;
377
QLabel *lb = new QLabel(f.fieldName(), d->gr_form);
378
QLineEdit *le = new QLineEdit(d->gr_form);
380
le->setEchoMode(QLineEdit::Password);
381
le->setText(f.value());
383
d->lb_field.append(lb);
384
d->le_field.append(le);
387
if (!d->le_field.isEmpty())
388
d->le_field.first()->setFocus();
393
qApp->processEvents();
394
//QDesktopWidget *w = QApplication::desktop();
395
//setGeometry((w->width()/2)-(width()/2), (w->height()/2)-(height()/2), minimumWidth(), minimumHeight());
396
resize(minimumSize());
400
QMessageBox::information(this, tr("Success"), tr("Registration successful."));
406
QMessageBox::critical(this, tr("Error"), tr("Unable to retrieve registration form.\nReason: %1").arg(jt->statusString()));
411
QMessageBox::critical(this, tr("Error"), tr("Error submitting registration form.\nReason: %1").arg(jt->statusString()));
418
//----------------------------------------------------------------------------
420
//----------------------------------------------------------------------------
421
class SearchDlg::Private
430
QGuardedPtr<JT_Search> jt;
434
QPtrList<QLabel> lb_field;
435
QPtrList<QLineEdit> le_field;
438
SearchDlg::SearchDlg(const Jid &jid, PsiAccount *pa)
439
:SearchUI(0, 0, WDestructiveClose)
444
d->pa->dialogRegister(this, d->jid);
447
setCaption(caption().arg(d->jid.full()));
451
d->gr_form = new QGrid(2, Horizontal, gb_search);
452
d->gr_form->setSpacing(4);
453
replaceWidget(lb_form, d->gr_form);
456
pb_add->setEnabled(false);
457
pb_info->setEnabled(false);
458
pb_stop->setEnabled(false);
459
pb_search->setEnabled(false);
461
lv_results->setMultiSelection(true);
462
lv_results->setSelectionMode( QListView::Extended );
463
connect(lv_results, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
311
464
connect(pb_close, SIGNAL(clicked()), SLOT(close()));
312
hb2->addWidget(pb_close);
316
resize(320, height() + 80);
319
void RegistrationDlg::closeEvent(QCloseEvent *e)
322
//QMessageBox::information(this, tr("Busy"), tr("Registration has already been submitted, it cannot be canceled. Please wait for the server to respond."));
330
void RegistrationDlg::putRegFormResponse(bool ok, const QString &err)
336
QMessageBox::information(this, tr("Success"), tr("Registration was successful."));
339
QMessageBox::critical(this, tr("Failed"), QString(tr("Registration failed. Reason:\n\"%1\"")).arg(err));
345
void RegistrationDlg::doRegSubmit()
347
JabForm submitform = form;
349
// import the changes back into the form.
350
// the QPtrList of QLineEdits should be in the same order
351
QPtrListIterator<JabFormField> it(submitform);
352
QPtrListIterator<QLineEdit> lit(le_field);
354
for(; (f = it.current());) {
355
QLineEdit *le = lit.current();
356
f->setValue(le->text());
361
pb_register->setEnabled(FALSE);
362
pb_close->setEnabled(FALSE);
366
signalSubmitForm(submitform, &id);
369
void RegistrationDlg::localUpdate(const JabRosterEntry &e)
371
int localStatus = e.localStatus();
373
// if the user goes offline then cancel the form
465
connect(pb_search, SIGNAL(clicked()), SLOT(doSearchSet()));
466
connect(pb_stop, SIGNAL(clicked()), SLOT(doStop()));
467
connect(pb_add, SIGNAL(clicked()), SLOT(doAdd()));
468
connect(pb_info, SIGNAL(clicked()), SLOT(doInfo()));
475
SearchDlg::~SearchDlg()
478
d->pa->dialogUnregister(this);
482
/*void SearchDlg::localUpdate(const JabRosterEntry &e)
484
int oldstate = localStatus;
485
localStatus = e.localStatus();
374
487
if(localStatus == STATUS_OFFLINE) {
376
putRegFormResponse(FALSE, "Disconnected"); // <-- this will turn off busy also
382
/*static*/ RegistrationDlg * RegistrationDlg::find(const QString &xjid)
384
return (RegistrationDlg *)UniqueWindowBank::find("RegistrationDlg", cleanJid(xjid));
493
pb_search->setEnabled(FALSE);
494
pb_stop->setEnabled(FALSE);
499
if(oldstate == STATUS_OFFLINE) {
500
pb_search->setEnabled(TRUE);
505
void SearchDlg::addEntry(const QString &jid, const QString &nick, const QString &first, const QString &last, const QString &email)
507
QListViewItem *lvi = new QListViewItem(lv_results);
508
lvi->setText(0, nick);
509
lvi->setText(1, first);
510
lvi->setText(2, last);
511
lvi->setText(3, email);
512
lvi->setText(4, jid);
515
void SearchDlg::doSearchGet()
517
lb_instructions->setText(tr("<qt>Fetching search form for %1 ...</qt>").arg(d->jid.full()));
521
d->jt = new JT_Search(d->pa->client()->rootTask());
522
connect(d->jt, SIGNAL(finished()), SLOT(jt_finished()));
527
void SearchDlg::doSearchSet()
529
if(d->busy->isActive())
532
if(!d->pa->checkConnected(this))
535
Form submitForm = d->form;
537
// import the changes back into the form.
538
// the QPtrList of QLineEdits should be in the same order
539
QPtrListIterator<QLineEdit> lit(d->le_field);
540
for(Form::Iterator it = submitForm.begin(); it != submitForm.end(); ++it) {
542
QLineEdit *le = lit.current();
543
f.setValue(le->text());
549
pb_search->setEnabled(false);
550
pb_stop->setEnabled(true);
551
d->gr_form->setEnabled(false);
555
d->jt = new JT_Search(d->pa->client()->rootTask());
556
connect(d->jt, SIGNAL(finished()), SLOT(jt_finished()));
557
d->jt->set(submitForm);
561
void SearchDlg::jt_finished()
564
JT_Search *jt = d->jt;
568
d->gr_form->setEnabled(true);
569
pb_search->setEnabled(true);
570
pb_stop->setEnabled(false);
575
d->form = jt->form();
576
QString str = plain2rich(d->form.instructions());
577
lb_instructions->setText(str);
579
for(Form::ConstIterator it = d->form.begin(); it != d->form.end(); ++it) {
580
const FormField &f = *it;
582
QLabel *lb = new QLabel(f.fieldName(), d->gr_form);
583
QLineEdit *le = new QLineEdit(d->gr_form);
585
le->setEchoMode(QLineEdit::Password);
586
le->setText(f.value());
588
d->lb_field.append(lb);
589
d->le_field.append(le);
591
connect(le, SIGNAL(returnPressed()), this, SLOT(doSearchSet()));
595
pb_search->setEnabled(true);
598
const QValueList<SearchResult> &list = jt->results();
600
QMessageBox::information(this, tr("Search Results"), tr("Search returned 0 results."));
602
for(QValueList<SearchResult>::ConstIterator it = list.begin(); it != list.end(); ++it) {
603
const SearchResult &r = *it;
604
addEntry(r.jid().full(), r.nick(), r.first(), r.last(), r.email());
611
QMessageBox::critical(this, tr("Error"), tr("Unable to retrieve search form.\nReason: %1").arg(jt->statusString()));
615
QMessageBox::critical(this, tr("Error"), tr("Error retrieving search results.\nReason: %1").arg(jt->statusString()));
620
void SearchDlg::clear()
623
pb_add->setEnabled(false);
624
pb_info->setEnabled(false);
627
void SearchDlg::doStop()
629
if(!d->busy->isActive())
636
d->gr_form->setEnabled(true);
637
pb_search->setEnabled(true);
638
pb_stop->setEnabled(false);
641
void SearchDlg::selectionChanged()
644
QListViewItem *lastChild = lv_results->firstChild();
647
pb_add->setEnabled(false);
648
pb_info->setEnabled(false);
652
if( lastChild->isSelected() ) {
653
pb_add->setEnabled(true);
654
pb_info->setEnabled(true);
659
while ( lastChild->nextSibling() ) {
660
lastChild = lastChild->nextSibling();
661
if( lastChild->isSelected() ) {
662
pb_add->setEnabled(true);
663
pb_info->setEnabled(true);
670
void SearchDlg::doAdd()
673
QListViewItem *i = lv_results->firstChild();
679
if( i->isSelected() ) {
680
name = jidnick(i->text(4), i->text(0));
681
add(Jid(i->text(4)), i->text(0), QStringList(), true);
686
while( i->nextSibling() ) {
687
i = i->nextSibling();
688
if( i->isSelected() ) {
689
name = jidnick(i->text(4), i->text(0));
690
add(Jid(i->text(4)), i->text(0), QStringList(), true);
697
QMessageBox::information(this, tr("Add User: Success"), tr("Added %1 to your roster.").arg(name));
699
QMessageBox::information(this, tr("Add User: Success"), tr("Added %1 users to your roster.").arg(d));
702
void SearchDlg::doInfo()
704
QListViewItem *i = lv_results->firstChild();
710
if( i->isSelected() ) {
711
aInfo(Jid(i->text(4)));
715
while( i->nextSibling() ) {
716
i = i->nextSibling();
717
if( i->isSelected() ) {
718
aInfo(Jid(i->text(4)));