--===============0019149736== Content-Type: multipart/signed; boundary="nextPart2717734.gXfGu4OJgg"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart2717734.gXfGu4OJgg Content-Type: multipart/mixed; boundary="Boundary-01=_nkSxIIHWrAucFI+" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_nkSxIIHWrAucFI+ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, currently, the "join chatroom" dialog of Jabber looks quite confusing,=20 starting from the fact you have to "switch dialog" if you want to list the= =20 available chatrooms... The attached patch does the following: =2D places the "nick" lineedit on the top of the dialog =2D adds a "query" button next to the server lineedit, and a list with them= =20 below it; this way, the extra dialog is no more needed =2D adds a "cancel" button to the dialog (or close? not sure; not a big dea= l=20 anyway) =2D changes the way the Jabber services are "scanned" for chatroom services= :=20 instead of a JT_GetServices task, a JT_DiscoItems one is run. This is also= =20 what is used for the "services" dialog, and thus the automatic chatroom=20 service filling (now a combobox instead of a lineedit) works (at least with= =20 jabber.linux.it and kdetalk.net, testers for other servers are welcome). =2D disable the "join" button if at least one of nick, server and chatroom= =20 lineedits is empty =2D double click on a chatroom writes it in the chatroom lineedit, and if n= ick=20 and server ones are not empty, the "join" action is started I should have not forgotten anything so... comments? =2D-=20 Pino Toscano --Boundary-01=_nkSxIIHWrAucFI+ Content-Type: text/x-diff; charset="iso 8859-15"; name="kopete-jabber-chatjoin.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kopete-jabber-chatjoin.diff" Index: ui/dlgjabberchatjoin.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- ui/dlgjabberchatjoin.cpp (revisione 858346) +++ ui/dlgjabberchatjoin.cpp (copia locale) @@ -18,22 +18,23 @@ =20 #include #include +#include #include #include =20 #include "jabberaccount.h" #include "jabberclient.h" =2D#include "dlgjabberchatroomslist.h" =20 +#include "xmpp_tasks.h" + #include "dlgjabberchatjoin.h" =20 dlgJabberChatJoin::dlgJabberChatJoin(JabberAccount *account, QWidget* pare= nt)=20 : KDialog(parent), m_account(account) { setCaption( i18n("Join Jabber Groupchat") ); =2D setButtons( KDialog::User1 | KDialog::User2 ); + setButtons( KDialog::Cancel | KDialog::User1 ); setButtonGuiItem( KDialog::User1, KGuiItem( i18n("Join") ) ); =2D setButtonGuiItem( KDialog::User2, KGuiItem( i18n("Browser") ) ); =09 QWidget *mainWidget =3D new QWidget(this); m_ui.setupUi(mainWidget); @@ -43,7 +44,13 @@ checkDefaultChatroomServer(); =20 connect(this, SIGNAL(user1Clicked()), this, SLOT(slotJoin())); =2D connect(this, SIGNAL(user2Clicked()), this, SLOT(slotBowse())); + connect(m_ui.pbQuery, SIGNAL(clicked()), this, SLOT(slotQuery())); + connect(m_ui.tblChatRoomsList, SIGNAL(itemDoubleClicked(QTreeWidgetItem *= , int)), this, SLOT(slotDoubleClick(QTreeWidgetItem *))); + connect(m_ui.leServer, SIGNAL(textChanged(QString)), this, SLOT(slotCheck= Data())); + connect(m_ui.leRoom, SIGNAL(textChanged(QString)), this, SLOT(slotCheckDa= ta())); + connect(m_ui.leNick, SIGNAL(textChanged(QString)), this, SLOT(slotCheckDa= ta())); + + slotCheckData(); } =20 dlgJabberChatJoin::~dlgJabberChatJoin() @@ -59,23 +66,10 @@ return; } =20 =2D m_account->client()->joinGroupChat(m_ui.leServer->text(), m_ui.leRoom->= text(), m_ui.leNick->text()); + m_account->client()->joinGroupChat(m_ui.leServer->currentText(), m_ui.leR= oom->text(), m_ui.leNick->text()); accept(); } =20 =2Dvoid dlgJabberChatJoin::slotBowse() =2D{ =2D if(!m_account->isConnected()) =2D { =2D m_account->errorConnectFirst(); =2D return; =2D } =2D =2D dlgJabberChatRoomsList *crl =3D new dlgJabberChatRoomsList(m_account, m= _ui.leServer->text() , m_ui.leNick->text()); =2D crl->show(); =2D accept(); =2D} =2D /* TODO : Used to look for the default chat server, this is duplicate with dlgjabberservices.cpp @@ -86,7 +80,7 @@ =20 void dlgJabberChatJoin::checkDefaultChatroomServer() { =2D XMPP::JT_GetServices *serviceTask =3D new XMPP::JT_GetServices(m_accoun= t->client()->rootTask()); + XMPP::JT_DiscoItems *serviceTask =3D new JT_DiscoItems(m_account->client(= )->rootTask()); connect(serviceTask, SIGNAL (finished()), this, SLOT (slotQueryFinished()= )); =20 serviceTask->get(m_account->server()); @@ -95,16 +89,12 @@ =20 void dlgJabberChatJoin::slotQueryFinished() { =2D XMPP::JT_GetServices *task =3D (XMPP::JT_GetServices*)sender(); =2D if (!task->success ()) + XMPP::JT_DiscoItems *task =3D (JT_DiscoItems *)sender(); + if (!task->success()) return; =2D=09 =2D if(!m_ui.leServer->text().isEmpty()) =2D { //the user already started to type the server manyally. abort auto-d= etect =2D return; =2D } =20 =2D for (XMPP::AgentList::const_iterator it =3D task->agents().begin(); it = !=3D task->agents().end(); ++it) + const XMPP::DiscoList &list =3D task->items(); + for (XMPP::DiscoList::ConstIterator it =3D list.begin(); it !=3D list.end= (); ++it) { XMPP::JT_DiscoInfo *discoTask =3D new XMPP::JT_DiscoInfo(m_account->clie= nt()->rootTask()); connect(discoTask, SIGNAL (finished()), this, SLOT (slotDiscoFinished())= ); @@ -121,18 +111,68 @@ if (!task->success()) return; =09 =2D if(!m_ui.leServer->text().isEmpty()) =2D { //the user already started to type the server manyally. abort auto-d= etect + if (task->item().features().canGroupchat() && !task->item().features().is= Gateway()) + { + const QString text =3D m_ui.leServer->currentText(); + const bool wasEmpty =3D m_ui.leServer->count() =3D=3D 0; + m_ui.leServer->addItem(task->item().jid().full()); + // the combobox was empty, and the edit text was not empty, + // so restore the previous edit text + if (wasEmpty && !text.isEmpty()) + { + m_ui.leServer->setEditText(text); + } + } +} + +void dlgJabberChatJoin::slotQuery() +{ + XMPP::JT_DiscoItems *discoTask =3D new XMPP::JT_DiscoItems(m_account->cli= ent()->rootTask()); + connect (discoTask, SIGNAL(finished()), this, SLOT(slotChatRooomsQueryFin= ished())); + + m_ui.tblChatRoomsList->clear(); + + discoTask->get(m_ui.leServer->currentText()); + discoTask->go(true); +} + +void dlgJabberChatJoin::slotChatRooomsQueryFinished() +{ + XMPP::JT_DiscoItems *task =3D (XMPP::JT_DiscoItems*)sender(); + if (!task->success()) + { + KMessageBox::queuedMessageBox(this, KMessageBox::Error, i18n("Unable to = retrieve the list of chat rooms."), i18n("Jabber Error")); return; } =20 + const XMPP::DiscoList& items =3D task->items(); =20 =2D if (task->item().features().canGroupchat() && !task->item().features().= isGateway()) + for (XMPP::DiscoList::const_iterator it =3D items.begin(); it !=3D items.= end(); ++it) { =2D m_ui.leServer->setText(task->item().jid().full()); + const XMPP::DiscoItem &di =3D *it; + QTreeWidgetItem *item =3D new QTreeWidgetItem(); + item->setText(0, di.jid().user()); + item->setText(1, di.name()); + m_ui.tblChatRoomsList->addTopLevelItem(item); } + m_ui.tblChatRoomsList->sortItems(0, Qt::AscendingOrder); } =20 +void dlgJabberChatJoin::slotDoubleClick(QTreeWidgetItem *item) +{ + m_ui.leRoom->setText(item->text(0)); + if (!(m_ui.leServer->currentText().isEmpty() || m_ui.leNick->text().isEmp= ty())) + { + slotJoin(); + } +} + +void dlgJabberChatJoin::slotCheckData() +{ + bool enableJoinButton =3D !(m_ui.leServer->currentText().isEmpty() || m_u= i.leRoom->text().isEmpty() || m_ui.leNick->text().isEmpty()); + enableButton(User1, enableJoinButton); +} + // end todo =20 #include "dlgjabberchatjoin.moc" Index: ui/dlgjabberchatjoin.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- ui/dlgjabberchatjoin.h (revisione 858346) +++ ui/dlgjabberchatjoin.h (copia locale) @@ -36,7 +36,7 @@ public slots: /*$PUBLIC_SLOTS$*/ virtual void slotJoin(); =2D virtual void slotBowse(); + virtual void slotQuery(); =20 protected: /*$PROTECTED_FUNCTIONS$*/ @@ -56,6 +56,9 @@ private slots: void slotQueryFinished(); void slotDiscoFinished(); + void slotChatRooomsQueryFinished(); + void slotCheckData(); + void slotDoubleClick(QTreeWidgetItem *item); =20 // end todo. =20 Index: ui/dlgchatjoin.ui =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- ui/dlgchatjoin.ui (revisione 858346) +++ ui/dlgchatjoin.ui (copia locale) @@ -9,54 +9,71 @@ 315 =2D =2D =2D =2D =2D =2D =2D Room: =2D =2D =2D =2D =2D =2D =2D =2D =2D =2D Server: =2D =2D =2D =2D =2D =2D =2D =2D =2D =2D Nick: =2D =2D =2D =2D =2D =2D =2D + + + + + Nick: + + =2D =2D =2D =2D Qt::Vertical + + + + + + + Server: =2D =2D =2D 20 =2D 40 =2D + + + + + + + 0 + 0 + =2D + + true + + + + + + &Query + + + + + + + false + + + + Chatroom Name + + + + + Chatroom Description + + + + + + + + Room: + + + + + + --Boundary-01=_nkSxIIHWrAucFI+-- --nextPart2717734.gXfGu4OJgg Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQBIxSknTNH2piB/L3oRAvdlAJ9916i97OcvB/DoGmWQ6w1/AyfWpwCgwh+e QlExfKRLikeijWYVWKmcOp8= =pdsP -----END PGP SIGNATURE----- --nextPart2717734.gXfGu4OJgg-- --===============0019149736== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kopete-devel mailing list kopete-devel@kde.org https://mail.kde.org/mailman/listinfo/kopete-devel --===============0019149736==--