diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/jabber/ui | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/jabber/ui')
38 files changed, 7185 insertions, 0 deletions
diff --git a/kopete/protocols/jabber/ui/Makefile.am b/kopete/protocols/jabber/ui/Makefile.am new file mode 100644 index 00000000..caf81209 --- /dev/null +++ b/kopete/protocols/jabber/ui/Makefile.am @@ -0,0 +1,31 @@ +METASOURCES = AUTO +AM_CPPFLAGS = $(KOPETE_INCLUDES) \ + -I$(srcdir)/../libiris/iris/include \ + -I$(srcdir)/../libiris/iris/xmpp-im \ + -I$(srcdir)/../libiris/iris/jabber \ + -I$(srcdir)/../libiris/qca/src \ + -I$(srcdir)/../libiris/cutestuff/util \ + -I$(srcdir)/.. \ + $(all_includes) + +noinst_LTLIBRARIES = libkopetejabberui.la + +libkopetejabberui_la_SOURCES = dlgsendraw.ui dlgjabbersendraw.cpp \ + dlgaddcontact.ui jabberaddcontactpage.cpp dlgvcard.ui dlgjabbervcard.cpp \ + dlgjabberservices.cpp dlgregister.ui dlgjabberregister.cpp dlgbrowse.ui dlgjabberbrowse.cpp \ + dlgjabbereditaccountwidget.ui jabbereditaccountwidget.cpp dlgjabberregisteraccount.ui \ + jabberregisteraccount.cpp dlgjabberchooseserver.ui jabberchooseserver.cpp dlgchangepassword.ui \ + dlgjabberchangepassword.cpp empty.cpp dlgchatroomslist.ui dlgjabberchatroomslist.cpp dlgchatjoin.ui \ + dlgjabberchatjoin.cpp dlgservices.ui + +EXTRA_DIST = dlgjabbereditaccountwidget.ui \ + dlgsendraw.ui \ + dlgaddcontact.ui \ + dlgrename.ui \ + dlgvcard.ui \ + dlgservices.ui \ + dlgregister.ui \ + dlgbrowse.ui + + +noinst_HEADERS = dlgjabberchatroomslist.h dlgjabberchatjoin.h diff --git a/kopete/protocols/jabber/ui/dlgaddcontact.ui b/kopete/protocols/jabber/ui/dlgaddcontact.ui new file mode 100644 index 00000000..20a4ab98 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgaddcontact.ui @@ -0,0 +1,105 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>dlgAddContact</class> +<widget class="QWidget"> + <property name="name"> + <cstring>dlgAddContact</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>398</width> + <height>345</height> + </rect> + </property> + <property name="caption"> + <string>Add Contacts</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout24</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblID</cstring> + </property> + <property name="text"> + <string>&Jabber ID:</string> + </property> + <property name="alignment"> + <set>AlignTop</set> + </property> + <property name="buddy" stdset="0"> + <cstring>addID</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The Jabber ID for the account you would like to add.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The Jabber ID for the account you would like to add. Note that this must include the username and the domain (like an E-mail address), as there are many Jabber servers.</string> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>addID</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The Jabber ID for the account you would like to add.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The Jabber ID for the account you would like to add. Note that this must include the username and the domain (like an E-mail address), as there are many Jabber servers.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><i>(for example: joe@jabber.org)</i></string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter|AlignRight</set> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>190</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgbrowse.ui b/kopete/protocols/jabber/ui/dlgbrowse.ui new file mode 100644 index 00000000..f45f224a --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgbrowse.ui @@ -0,0 +1,201 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>dlgBrowse</class> +<widget class="QDialog"> + <property name="name"> + <cstring>dlgBrowse</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>818</width> + <height>381</height> + </rect> + </property> + <property name="caption"> + <string>Jabber Search</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSplitter" row="0" column="0"> + <property name="name"> + <cstring>splitter1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>dynamicForm</cstring> + </property> + <property name="title"> + <string>Search For</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblWait</cstring> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="text"> + <string>Please wait while retrieving search form...</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + </vbox> + </widget> + <widget class="QTable"> + <column> + <property name="text"> + <string>JID</string> + </property> + </column> + <column> + <property name="text"> + <string>First Name</string> + </property> + </column> + <column> + <property name="text"> + <string>Last Name</string> + </property> + </column> + <column> + <property name="text"> + <string>Nick</string> + </property> + </column> + <column> + <property name="text"> + <string>Email</string> + </property> + </column> + <property name="name"> + <cstring>tblResults</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="resizePolicy"> + <enum>AutoOneFit</enum> + </property> + <property name="numRows"> + <number>0</number> + </property> + <property name="numCols"> + <number>5</number> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="selectionMode"> + <enum>NoSelection</enum> + </property> + <property name="focusStyle"> + <enum>FollowStyle</enum> + </property> + </widget> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>buttonsLayout</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>buttonsSpacer</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>btnSearch</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Search</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>btnClose</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Close</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>false</bool> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>btnClose</sender> + <signal>clicked()</signal> + <receiver>dlgBrowse</receiver> + <slot>close()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgchangepassword.ui b/kopete/protocols/jabber/ui/dlgchangepassword.ui new file mode 100644 index 00000000..c3e34de6 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgchangepassword.ui @@ -0,0 +1,88 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>DlgChangePassword</class> +<widget class="QWidget"> + <property name="name"> + <cstring>DlgChangePassword</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>308</width> + <height>147</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Current password:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>New password:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>New password:</string> + </property> + </widget> + <widget class="KPasswordEdit" row="0" column="1"> + <property name="name"> + <cstring>peCurrentPassword</cstring> + </property> + </widget> + <widget class="KPasswordEdit" row="1" column="1"> + <property name="name"> + <cstring>peNewPassword1</cstring> + </property> + </widget> + <widget class="KPasswordEdit" row="2" column="1"> + <property name="name"> + <cstring>peNewPassword2</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lblStatus</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Please enter your current password first +and then your new password twice.</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kpassdlg.h</includehint> + <includehint>kpassdlg.h</includehint> + <includehint>kpassdlg.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgchatjoin.ui b/kopete/protocols/jabber/ui/dlgchatjoin.ui new file mode 100644 index 00000000..699f9ef4 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgchatjoin.ui @@ -0,0 +1,130 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>dlgChatJoin</class> +<widget class="KDialog"> + <property name="name"> + <cstring>dlgChatJoin</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>291</width> + <height>160</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>lblNick</cstring> + </property> + <property name="text"> + <string>Nick:</string> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>leServer</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>leNick</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>leRoom</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lblRoom</cstring> + </property> + <property name="text"> + <string>Room:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lblServer</cstring> + </property> + <property name="text"> + <string>Server:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="1"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>41</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>pbJoin</cstring> + </property> + <property name="text"> + <string>&Join</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pbBrowse</cstring> + </property> + <property name="text"> + <string>Bro&wse</string> + </property> + </widget> + </hbox> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>pbJoin</sender> + <signal>clicked()</signal> + <receiver>dlgChatJoin</receiver> + <slot>slotJoin()</slot> + </connection> + <connection> + <sender>pbBrowse</sender> + <signal>clicked()</signal> + <receiver>dlgChatJoin</receiver> + <slot>slotBowse()</slot> + </connection> +</connections> +<tabstops> + <tabstop>leRoom</tabstop> + <tabstop>leServer</tabstop> + <tabstop>leNick</tabstop> +</tabstops> +<slots> + <slot>slotBowse()</slot> + <slot>slotJoin()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgchatroomslist.ui b/kopete/protocols/jabber/ui/dlgchatroomslist.ui new file mode 100644 index 00000000..f4624de3 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgchatroomslist.ui @@ -0,0 +1,185 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>dlgChatRoomsList</class> +<widget class="KDialog"> + <property name="name"> + <cstring>dlgChatRoomsList</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>467</width> + <height>298</height> + </rect> + </property> + <property name="caption"> + <string>List Chatrooms</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblServer</cstring> + </property> + <property name="text"> + <string>Server</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leServer</cstring> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pbQuery</cstring> + </property> + <property name="text"> + <string>&Query</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QTable"> + <column> + <property name="text"> + <string>Chatroom Name</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </column> + <column> + <property name="text"> + <string>Chatroom Description</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </column> + <property name="name"> + <cstring>tblChatRoomsList</cstring> + </property> + <property name="focusPolicy"> + <enum>ClickFocus</enum> + </property> + <property name="numRows"> + <number>0</number> + </property> + <property name="numCols"> + <number>2</number> + </property> + <property name="rowMovingEnabled"> + <bool>true</bool> + </property> + <property name="columnMovingEnabled"> + <bool>true</bool> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="selectionMode"> + <enum>SingleRow</enum> + </property> + <property name="focusStyle"> + <enum>FollowStyle</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>121</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>pbJoin</cstring> + </property> + <property name="text"> + <string>&Join</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pbClose</cstring> + </property> + <property name="text"> + <string>Clos&e</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>pbClose</sender> + <signal>clicked()</signal> + <receiver>dlgChatRoomsList</receiver> + <slot>close()</slot> + </connection> + <connection> + <sender>pbJoin</sender> + <signal>clicked()</signal> + <receiver>dlgChatRoomsList</receiver> + <slot>slotJoin()</slot> + </connection> + <connection> + <sender>pbQuery</sender> + <signal>clicked()</signal> + <receiver>dlgChatRoomsList</receiver> + <slot>slotQuery()</slot> + </connection> + <connection> + <sender>tblChatRoomsList</sender> + <signal>clicked(int,int,int,const QPoint&)</signal> + <receiver>dlgChatRoomsList</receiver> + <slot>slotClick(int,int,int,const QPoint&)</slot> + </connection> + <connection> + <sender>tblChatRoomsList</sender> + <signal>doubleClicked(int,int,int,const QPoint&)</signal> + <receiver>dlgChatRoomsList</receiver> + <slot>slotDoubleClick(int,int,int,const QPoint&)</slot> + </connection> +</connections> +<slots> + <slot>slotQuery()</slot> + <slot>slotJoin()</slot> + <slot>slotClick(int row, int col, int button, const QPoint& mousePos)</slot> + <slot>slotDoubleClick(int row, int col, int button, const QPoint& mousePos)</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdialog.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgjabberbrowse.cpp b/kopete/protocols/jabber/ui/dlgjabberbrowse.cpp new file mode 100644 index 00000000..f8e2b4ce --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberbrowse.cpp @@ -0,0 +1,144 @@ + +/*************************************************************************** + dlgjabberbrowse.cpp - description + ------------------- + begin : Wed Dec 11 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kpushbutton.h> +#include <qgroupbox.h> +#include <qtable.h> +#include <qlabel.h> + +#include <kmessagebox.h> +#include <klocale.h> + +#include "jabberaccount.h" +#include "jabberprotocol.h" +#include "jabberclient.h" +#include "jabberformtranslator.h" +#include "dlgjabberbrowse.h" + +dlgJabberBrowse::dlgJabberBrowse (JabberAccount *account, const XMPP::Jid & jid, QWidget * parent, const char *name):dlgBrowse (parent, name) +{ + m_account = account; + + // disable the left margin + tblResults->setLeftMargin (0); + + // no content for now + tblResults->setNumRows (0); + + // disable user selections + tblResults->setSelectionMode (QTable::NoSelection); + + XMPP::JT_Search * task = new XMPP::JT_Search (m_account->client()->rootTask ()); + + connect (task, SIGNAL (finished ()), this, SLOT (slotGotForm ())); + + task->get (jid); + task->go (true); +} + +void dlgJabberBrowse::slotGotForm () +{ + XMPP::JT_Search * task = (XMPP::JT_Search *) sender (); + + // delete the wait message + delete lblWait; + + if (!task->success ()) + { + KMessageBox::queuedMessageBox(this, KMessageBox::Information, i18n ("Unable to retrieve search form."), i18n ("Jabber Error")); + + return; + } + + + // translate the form and create it inside the display widget + translator = new JabberFormTranslator (task->form (), dynamicForm); + dynamicForm->layout()->add( translator ); + translator->show(); + + // enable the send button + btnSearch->setEnabled (true); + + // adjust table + tblResults->setNumCols (5); + + for (int i = 0; i < 5; i++) + { + // allow autostretching + tblResults->setColumnStretchable (i, true); + } + + connect (btnSearch, SIGNAL (clicked ()), this, SLOT (slotSendForm ())); + +} + +void dlgJabberBrowse::slotSendForm () +{ + + XMPP::JT_Search * task = new XMPP::JT_Search (m_account->client()->rootTask ()); + + connect (task, SIGNAL (finished ()), this, SLOT (slotSentForm ())); + + task->set (translator->resultData ()); + task->go (true); + + btnSearch->setEnabled (false); + btnClose->setEnabled (false); + +} + +void dlgJabberBrowse::slotSentForm () +{ + XMPP::JT_Search * task = (XMPP::JT_Search *) sender (); + + btnSearch->setEnabled (true); + btnClose->setEnabled (true); + + if (!task->success ()) + { + KMessageBox::queuedMessageBox (this, KMessageBox::Error, i18n ("The Jabber server declined the search."), i18n ("Jabber Search")); + + return; + } + + tblResults->setNumRows (task->results ().count ()); + + int row = 0; + + for (QValueList < XMPP::SearchResult >::const_iterator it = task->results ().begin (); it != task->results ().end (); ++it) + { + tblResults->setText (row, 0, (*it).jid ().userHost ()); + tblResults->setText (row, 1, (*it).first ()); + tblResults->setText (row, 2, (*it).last ()); + tblResults->setText (row, 3, (*it).nick ()); + tblResults->setText (row, 4, (*it).email ()); + + row++; + } + for (int i = 0; i < 5; i++) + { + tblResults->setColumnStretchable (i, false); + tblResults->adjustColumn (i); + } +} + +dlgJabberBrowse::~dlgJabberBrowse () +{ +} + +#include "dlgjabberbrowse.moc" diff --git a/kopete/protocols/jabber/ui/dlgjabberbrowse.h b/kopete/protocols/jabber/ui/dlgjabberbrowse.h new file mode 100644 index 00000000..8a8b6cc1 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberbrowse.h @@ -0,0 +1,54 @@ + +/*************************************************************************** + dlgjabberbrowse.h - description + ------------------- + begin : Wed Dec 11 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef DLGJABBERBROWSE_H +#define DLGJABBERBROWSE_H + +#include <qwidget.h> + +#include "xmpp_tasks.h" + +#include "jabberaccount.h" +#include "jabberformtranslator.h" +#include "dlgbrowse.h" + +/** + *@author Till Gerken <till@tantalo.net> + */ + +class dlgJabberBrowse:public dlgBrowse +{ + + Q_OBJECT + +public: + dlgJabberBrowse (JabberAccount *account, const XMPP::Jid & jid, QWidget * parent = 0, const char *name = 0); + ~dlgJabberBrowse (); + +private slots: + void slotGotForm (); + void slotSendForm (); + void slotSentForm (); + +private: + JabberAccount *m_account; + JabberFormTranslator * translator; + +}; + +#endif diff --git a/kopete/protocols/jabber/ui/dlgjabberchangepassword.cpp b/kopete/protocols/jabber/ui/dlgjabberchangepassword.cpp new file mode 100644 index 00000000..9f6ae65d --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberchangepassword.cpp @@ -0,0 +1,135 @@ + +/*************************************************************************** + Change the password of a Jabber account + ------------------- + begin : Tue May 31 2005 + copyright : (C) 2005 by Till Gerken <till@tantalo.net> + + Kopete (C) 2001-2005 Kopete developers <kopete-devel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "dlgjabberchangepassword.h" + +#include <kdebug.h> +#include <klocale.h> +#include <kpassdlg.h> +#include <kmessagebox.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <kopetepassword.h> +#include <xmpp_tasks.h> +#include "jabberaccount.h" +#include "dlgchangepassword.h" + +DlgJabberChangePassword::DlgJabberChangePassword ( JabberAccount *account, QWidget *parent, const char *name ) + : KDialogBase ( parent, name, true, i18n("Change Jabber Password"), + KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, true ) +{ + + m_account = account; + + m_mainWidget = new DlgChangePassword ( this ); + setMainWidget ( m_mainWidget ); + +} + +DlgJabberChangePassword::~DlgJabberChangePassword() +{ +} + +void DlgJabberChangePassword::slotOk () +{ + + if ( !strlen ( m_mainWidget->peCurrentPassword->password () ) + || ( m_account->password().cachedValue () != m_mainWidget->peCurrentPassword->password () ) ) + { + KMessageBox::queuedMessageBox ( this, KMessageBox::Sorry, + i18n ( "You entered your current password incorrectly." ), + i18n ( "Password Incorrect" ) ); + return; + } + + if ( strcmp ( m_mainWidget->peNewPassword1->password (), m_mainWidget->peNewPassword2->password () ) != 0 ) + { + KMessageBox::queuedMessageBox ( this, KMessageBox::Sorry, + i18n ( "Your new passwords do not match. Please enter them again." ), + i18n ( "Password Incorrect" ) ); + return; + } + + if ( !strlen ( m_mainWidget->peNewPassword1->password () ) ) + { + KMessageBox::queuedMessageBox ( this, KMessageBox::Sorry, + i18n ( "For security reasons, you are not allowed to set an empty password." ), + i18n ( "Password Incorrect" ) ); + return; + } + + if ( !m_account->isConnected () ) + { + if ( KMessageBox::questionYesNo ( this, + i18n ( "Your account needs to be connected before the password can be changed. Do you want to try to connect now?" ), + i18n ( "Jabber Password Change" ), i18n("Connect"), i18n("Stay Offline") ) == KMessageBox::Yes ) + { + connect ( m_account, SIGNAL ( isConnectedChanged () ), this, SLOT ( slotChangePassword () ) ); + m_account->connect (); + } + } + else + { + slotChangePassword (); + } + +} + +void DlgJabberChangePassword::slotCancel () +{ + + deleteLater (); + +} + +void DlgJabberChangePassword::slotChangePassword () +{ + + XMPP::JT_Register *task = new XMPP::JT_Register ( m_account->client()->rootTask () ); + QObject::connect ( task, SIGNAL ( finished () ), this, SLOT ( slotChangePasswordDone () ) ); + + task->changepw ( m_mainWidget->peNewPassword1->password () ); + task->go ( true ); + +} + +void DlgJabberChangePassword::slotChangePasswordDone () +{ + + XMPP::JT_Register *task = (XMPP::JT_Register *) sender (); + + if ( task->success () ) + { + KMessageBox::queuedMessageBox ( dynamic_cast<QWidget*>(parent()), KMessageBox::Information, + i18n ( "Your password has been changed successfully. Please note that the change may not be instantaneous. If you have problems logging in with your new password, please contact the administrator." ), + i18n ( "Jabber Password Change" ) ); + + m_account->password().set ( m_mainWidget->peNewPassword1->password () ); + } + else + { + KMessageBox::queuedMessageBox ( dynamic_cast<QWidget*>(parent()), KMessageBox::Sorry, + i18n ( "Your password could not be changed. Either your server does not support this feature or the administrator does not allow you to change your password." ) ); + } + + deleteLater(); + +} + +#include "dlgjabberchangepassword.moc" diff --git a/kopete/protocols/jabber/ui/dlgjabberchangepassword.h b/kopete/protocols/jabber/ui/dlgjabberchangepassword.h new file mode 100644 index 00000000..84e880c5 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberchangepassword.h @@ -0,0 +1,51 @@ + +/*************************************************************************** + Change the password of a Jabber account + ------------------- + begin : Tue May 31 2005 + copyright : (C) 2005 by Till Gerken <till@tantalo.net> + + Kopete (C) 2001-2005 Kopete developers <kopete-devel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef DLGJABBERCHANGEPASSWORD_H +#define DLGJABBERCHANGEPASSWORD_H + +#include <kdialogbase.h> + +class JabberAccount; +class DlgChangePassword; + +/** +@author Till Gerken +*/ +class DlgJabberChangePassword : public KDialogBase +{ + +Q_OBJECT + +public: + DlgJabberChangePassword ( JabberAccount *account, QWidget *parent = 0, const char *name = 0); + ~DlgJabberChangePassword(); + +private slots: + void slotOk (); + void slotCancel (); + void slotChangePassword (); + void slotChangePasswordDone (); + +private: + DlgChangePassword *m_mainWidget; + JabberAccount *m_account; +}; + +#endif diff --git a/kopete/protocols/jabber/ui/dlgjabberchatjoin.cpp b/kopete/protocols/jabber/ui/dlgjabberchatjoin.cpp new file mode 100644 index 00000000..620bff03 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberchatjoin.cpp @@ -0,0 +1,129 @@ + +/*************************************************************************** + dlgjabberchatjoin.cpp - description + ------------------- + begin : Fri Dec 13 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kdebug.h> +#include <klocale.h> +#include <qlineedit.h> +#include <qpushbutton.h> + +#include "jabberaccount.h" +#include "jabberclient.h" +#include "dlgjabberchatroomslist.h" + +#include "dlgjabberchatjoin.h" + +dlgJabberChatJoin::dlgJabberChatJoin(JabberAccount *account, QWidget* parent, const char* name) : +dlgChatJoin(parent, name), +m_account(account) +{ + setCaption(i18n("Join Jabber Groupchat")); + leNick->setText(m_account->client()->client()->user()); + checkDefaultChatroomServer(); +} + +dlgJabberChatJoin::~dlgJabberChatJoin() +{ +} + +/*$SPECIALIZATION$*/ +void dlgJabberChatJoin::slotJoin() +{ + if(!m_account->isConnected()) + { + m_account->errorConnectFirst(); + return; + } + + m_account->client()->joinGroupChat(leServer->text(), leRoom->text(), leNick->text()); + accept(); +} + +void dlgJabberChatJoin::slotBowse() +{ + if(!m_account->isConnected()) + { + m_account->errorConnectFirst(); + return; + } + + dlgJabberChatRoomsList *crl = new dlgJabberChatRoomsList(m_account, leServer->text() , leNick->text()); + crl->show(); + accept(); +} + +/* + TODO : Used to look for the default chat server, + this is duplicate with dlgjabberservices.cpp + should be merged elsewhere ! +*/ +// JabberAccount *m_account; +// XMPP::JT_GetServices * serviceTask; + +void dlgJabberChatJoin::checkDefaultChatroomServer() +{ + XMPP::JT_GetServices *serviceTask = new XMPP::JT_GetServices(m_account->client()->rootTask()); + connect(serviceTask, SIGNAL (finished()), this, SLOT (slotQueryFinished())); + + serviceTask->get(m_account->server()); + serviceTask->go(true); +} + +void dlgJabberChatJoin::slotQueryFinished() +{ + XMPP::JT_GetServices *task = (XMPP::JT_GetServices*)sender(); + if (!task->success ()) + return; + + if(!leServer->text().isEmpty()) + { //the user already started to type the server manyally. abort auto-detect + return; + } + + for (XMPP::AgentList::const_iterator it = task->agents().begin(); it != task->agents().end(); ++it) + { + XMPP::JT_DiscoInfo *discoTask = new XMPP::JT_DiscoInfo(m_account->client()->rootTask()); + connect(discoTask, SIGNAL (finished()), this, SLOT (slotDiscoFinished())); + + discoTask->get((*it).jid().full()); + discoTask->go(true); + } +} + +void dlgJabberChatJoin::slotDiscoFinished() +{ + XMPP::JT_DiscoInfo *task = (XMPP::JT_DiscoInfo*)sender(); + + if (!task->success()) + return; + + if(!leServer->text().isEmpty()) + { //the user already started to type the server manyally. abort auto-detect + return; + } + + + if (task->item().features().canGroupchat() && !task->item().features().isGateway()) + { + leServer->setText(task->item().jid().full()); + } +} + +// end todo + +#include "dlgjabberchatjoin.moc" + diff --git a/kopete/protocols/jabber/ui/dlgjabberchatjoin.h b/kopete/protocols/jabber/ui/dlgjabberchatjoin.h new file mode 100644 index 00000000..fad58fcb --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberchatjoin.h @@ -0,0 +1,65 @@ + +/*************************************************************************** + dlgjabberchatjoin.h - description + ------------------- + begin : Fri Dec 13 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef DLGJABBERCHATJOIN_H +#define DLGJABBERCHATJOIN_H + +#include "dlgchatjoin.h" +#include "jabberaccount.h" + +class dlgJabberChatJoin : public dlgChatJoin +{ + Q_OBJECT + +public: + dlgJabberChatJoin(JabberAccount *account, QWidget* parent = 0, const char* name = 0); + ~dlgJabberChatJoin(); + /*$PUBLIC_FUNCTIONS$*/ + +public slots: + /*$PUBLIC_SLOTS$*/ + virtual void slotJoin(); + virtual void slotBowse(); + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + +private: + + + JabberAccount *m_account; + + /* + TODO : Used to look for the default chat server, + this is duplicate with dlgjabberservices.h + should be merged elsewhere ! + */ + void checkDefaultChatroomServer(); +private slots: + void slotQueryFinished(); + void slotDiscoFinished(); + + // end todo. + +}; + +#endif + diff --git a/kopete/protocols/jabber/ui/dlgjabberchatroomslist.cpp b/kopete/protocols/jabber/ui/dlgjabberchatroomslist.cpp new file mode 100644 index 00000000..aea2843f --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberchatroomslist.cpp @@ -0,0 +1,117 @@ +// +// C++ Implementation: +// +// Description: +// +// +// Author: Kopete Developers <kopete-devel@kde.org>, (C) 2005 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <kmessagebox.h> +#include <klocale.h> +#include <kdebug.h> + +#include <qtable.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qlabel.h> + +#include "dlgjabberchatroomslist.h" +#include "jabberprotocol.h" + +dlgJabberChatRoomsList::dlgJabberChatRoomsList(JabberAccount* account, const QString& server, const QString &nick, QWidget *parent, const char *name) : +dlgChatRoomsList(parent, name), + m_account(account) , m_selectedRow(-1) , m_nick(nick) +{ + if (!server.isNull()) + leServer->setText(server); + else if(m_account->isConnected()) + leServer->setText(m_account->server()); + + m_chatServer = leServer->text(); + + // locales + setCaption(i18n("List Chatrooms")); + + tblChatRoomsList->setLeftMargin (0); + tblChatRoomsList->setColumnStretchable(0, true); + tblChatRoomsList->setColumnStretchable(1, true); + + if (!server.isNull()) + slotQuery(); +} + +dlgJabberChatRoomsList::~dlgJabberChatRoomsList() +{ +} + +/*$SPECIALIZATION$*/ +void dlgJabberChatRoomsList::slotJoin() +{ + if(!m_account->isConnected()) + { + m_account->errorConnectFirst(); + return; + } + + if (m_selectedRow >= 0) + { + kdDebug (JABBER_DEBUG_GLOBAL) << "join chat room : " << m_account->client()->client()->user() << " @ " << tblChatRoomsList->text(m_selectedRow, 0) << " on " << m_chatServer << endl; + m_account->client()->joinGroupChat(m_chatServer, tblChatRoomsList->text(m_selectedRow, 0), m_nick); + } +} + +void dlgJabberChatRoomsList::slotQuery() +{ + if(!m_account->isConnected()) + { + m_account->errorConnectFirst(); + return; + } + + tblChatRoomsList->setNumRows(0); + + XMPP::JT_DiscoItems *discoTask = new XMPP::JT_DiscoItems(m_account->client()->rootTask()); + connect (discoTask, SIGNAL(finished()), this, SLOT(slotQueryFinished())); + + m_chatServer = leServer->text(); + discoTask->get(leServer->text()); + discoTask->go(true); +} + +void dlgJabberChatRoomsList::slotQueryFinished() +{ + XMPP::JT_DiscoItems *task = (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; + } + + const XMPP::DiscoList& items = task->items(); + tblChatRoomsList->setNumRows(items.count()); + + int row = 0; + for (XMPP::DiscoList::const_iterator it = items.begin(); it != items.end(); ++it) + { + tblChatRoomsList->setText(row, 0, (*it).jid().user()); + tblChatRoomsList->setText(row, 1, (*it).name()); + ++row; + } +} + +void dlgJabberChatRoomsList::slotDoubleClick(int row, int /*col*/, int /*button*/, const QPoint& /*mousePos*/) +{ + m_selectedRow = row; + slotJoin(); +} + +void dlgJabberChatRoomsList::slotClick(int row, int /*col*/, int /*button*/, const QPoint& /*mousePos*/) +{ + m_selectedRow = row; +} + +#include "dlgjabberchatroomslist.moc" + diff --git a/kopete/protocols/jabber/ui/dlgjabberchatroomslist.h b/kopete/protocols/jabber/ui/dlgjabberchatroomslist.h new file mode 100644 index 00000000..1db296d7 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberchatroomslist.h @@ -0,0 +1,54 @@ +// +// C++ Interface: +// +// Description: +// +// +// Author: Kopete Developers <kopete-devel@kde.org>, (C) 2005 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#ifndef DLGJABBERCHATROOMSLIST_H +#define DLGJABBERCHATROOMSLIST_H + +#include "jabberaccount.h" +#include "xmpp_tasks.h" + +#include "dlgchatroomslist.h" + +class dlgJabberChatRoomsList : public dlgChatRoomsList +{ + Q_OBJECT + +public: + dlgJabberChatRoomsList(JabberAccount* account, const QString& server = QString::null, const QString& nick = QString::null, QWidget* parent = 0, const char* name = 0); + ~dlgJabberChatRoomsList(); + /*$PUBLIC_FUNCTIONS$*/ + +public slots: + /*$PUBLIC_SLOTS$*/ + virtual void slotJoin(); + virtual void slotQuery(); + virtual void slotDoubleClick(int row, int col, int button, const QPoint& mousePos); + virtual void slotClick(int row, int col, int button, const QPoint& mousePos); + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + + void slotQueryFinished(); + +private: + + JabberAccount *m_account; + int m_selectedRow; + QString m_chatServer; + QString m_nick; +}; + +#endif + diff --git a/kopete/protocols/jabber/ui/dlgjabberchooseserver.ui b/kopete/protocols/jabber/ui/dlgjabberchooseserver.ui new file mode 100644 index 00000000..0a04b388 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberchooseserver.ui @@ -0,0 +1,107 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>DlgJabberChooseServer</class> +<widget class="QWidget"> + <property name="name"> + <cstring>DlgJabberChooseServer</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>334</width> + <height>343</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>300</width> + <height>300</height> + </size> + </property> + <property name="caption"> + <string>Choose Server - Jabber</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTable" row="0" column="0"> + <column> + <property name="text"> + <string>Server</string> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + </column> + <column> + <property name="text"> + <string>Description</string> + </property> + </column> + <property name="name"> + <cstring>listServers</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="resizePolicy"> + <enum>Default</enum> + </property> + <property name="hScrollBarMode"> + <enum>Auto</enum> + </property> + <property name="numRows"> + <number>0</number> + </property> + <property name="numCols"> + <number>2</number> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="sorting"> + <bool>false</bool> + </property> + <property name="selectionMode"> + <enum>SingleRow</enum> + </property> + <property name="resizeMode" stdset="0"> + </property> + </widget> + <widget class="KActiveLabel" row="2" column="0"> + <property name="name"> + <cstring>linkServerDetails</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><a href="http://www.jabber.org/network/">Details about free public Jabber servers</a></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lblStatus</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </grid> +</widget> +<images> + <image name="image0"> + <data format="XPM.GZ" length="2846">789c75d54953dd381007f03b9fe255fa969aea585ea59a9a039084256c0f0810a6e6204b32fbfe58a7e6bb8fddff3609c90ce6f27b6acbea764bfef07e72b0b53e79ff61ee6ee6672761128efdede47dbcbfb878fef3af3ffe9e7b67eac9f05fb849feeeb7b977d3d9244c36ae2ed300ef7b50664cac337127b626cf9db885f3a22e075325762694324edfc4de74954c4e6b705ed595dc4fe2ceb842c6fdd16093e5be6e24be1e9ce7856f647e7f227685ad647db4230e65d178194fe26eb8c43cb8903f89df1e5d4a3c1d8a7d9559acff40dccf57c1e5e0d20c97b811fb2ad928f31f8b43e59b56c6dde0aa1d2ef1ba3895b194f5901d5cd7755307b93f8add70c9f87470636a5be2fe7d71d5b416f905b1b399433db706dbcc3695d4930ab1192ef1e660d7b8429fbf216e6dd2f9b3c1a18d59443df7c4a9772dcec5dd70897707f7a355c2f33f8a8bc66678fe17b5cb50bf4f62eb7223fd430fe2d0a40cf7afc2ce1658cff9e0646c9521fe515cfad2209f457555607ee99f543bafcf3f1337aecbe4fdd005eccb4ceacd976217cacccaf8bdd8b719fa830fd57926f5e62b38984ceac12fea5ac7a5bf53eb23c689e156f3e5353834fafc67b5c3faf862b491fcf949dd66526f967aa61082ce77a04e46eac7f23e536c8b1ce3ab70e80cf291fe4ba96f70a91fefc33137c8675edcb555867807c7d220bf95d139eedf53d746fa95b3d1fafc85c15dd666b9bc0fb670b4c88fbcba3f2164fcebab518f1bb1f10eef9f23dc6abf7003c760a45f7977748efbafc579db68fc231cfb05cbf34fd429c7fb3f1d5da0decba3b15fb85677c89fe4bceb8a7e39c8bf529b1cfd78acce612e5f8d7c315eb699e697d441dfcf0e9c8c9e4f97ea02f5a4237595cbf9c84be2fe80a9b17fa3ba413da8535bac97d2abf17ee53ce9ea100af8014ed6211f1d4faec27e9c8d463d19eb69fa7a231f525b7501275fa3bfcd683d9feed46d055fa9638e7c3e8fd6f3fbf6d518bf51a702cf43beb61dfbe71c4efd8692f8157572a8dff6abd10fd7ea0ef3d1c2e806cf43bfdace75a817d6e3a2b7e8974db8df7118bf57772df617fadf875062ff213fdf7738ce8f2775897a30fab58d49e7cfe1ae6ad11ff3eadae23c5d52fb12df4fa3ee2fb91ffd1b626cb05fb6e0ae8ea8d799ba89e8d799daeaf7e159ed1accff32da62bfcbf7a08b7dc658ffa2da27d47baa6e615a56077d1fe887d4cf88f59caa6327ef87e57bd20d7fb2fee90c17137b6e3970e4c41d1f8dbf7f8fe1633ee1533ee373bee04bbee26b3e7e1bc3377ccb773ce37b7ee0477ee2677ee179be7913b3c08bfc913ff1675ee2655ee155fec26bbcfe26668337798ba7bccd3bbccb5f798ff7f980bfbd8939e48c0de75c70c915d7dcb06547fc630c11796a2950a4441d1dd1319dd0299dbd8939a70bbaecc7afe89a6ee896ee6846f774fe36777aa0c73ee2899ee985e6698116e9e1e7faf4511fe9137da6255aa6155aa52fbfd6b08f59a375daa04ddaa2296d8fbffe14b343bbf495f6689f0ee8dbffc41c524686722aa8a4ea7f626a6ac892f3ecc9fbff8e99ce7ceb838f3ef9eefb6fbfc4787fe48ffdc98fb3f431fffc3ef72fd6519eaa</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kactivelabel.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgjabbereditaccountwidget.ui b/kopete/protocols/jabber/ui/dlgjabbereditaccountwidget.ui new file mode 100644 index 00000000..099e84a6 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabbereditaccountwidget.ui @@ -0,0 +1,993 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>DlgJabberEditAccountWidget</class> +<author>Daniel Stone</author> +<widget class="QWidget"> + <property name="name"> + <cstring>DlgJabberEditAccountWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>706</width> + <height>455</height> + </rect> + </property> + <property name="caption"> + <string>Account Preferences - Jabber</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <property name="whatsThis" stdset="0"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget10</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Basic Setup</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox65</cstring> + </property> + <property name="title"> + <string>Account Information</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout61</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1_3</cstring> + </property> + <property name="text"> + <string>&Jabber ID:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mID</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The Jabber ID for the account you would like to use.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The Jabber ID for the account you would like to use. Note that this must include the username and the domain (like an E-mail address), as there are many Jabber servers.</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>mID</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>The Jabber ID for the account you would like to use.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The Jabber ID for the account you would like to use. Note that this must include the username and the domain (for example, joe@jabber.org), as there are many Jabber servers.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="Kopete::UI::PasswordWidget"> + <property name="name"> + <cstring>mPass</cstring> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbAutoConnect</cstring> + </property> + <property name="text"> + <string>E&xclude from connect all</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check to disable automatic connection. If checked, you may connect to this account manually using the icon in the bottom of the main Kopete window</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbGlobalIdentity</cstring> + </property> + <property name="text"> + <string>Exclu&de from Global Identity</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox5</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Registration</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblRegistration</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>To connect to the Jabber network, you will need an account on a Jabber server. If you do not yet have an account, please click the button to create one.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnRegister</cstring> + </property> + <property name="text"> + <string>Re&gister New Account</string> + </property> + <property name="toolTip" stdset="0"> + <string>Register a new account on this network.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Register a new account on this network.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox8_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Change Password</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton" row="0" column="1"> + <property name="name"> + <cstring>btnChangePassword</cstring> + </property> + <property name="text"> + <string>Change &Your Password</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>tlChangePwSuccess</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>If you have an existing Jabber account and would like to change its password, you can use this button to enter a new password.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Maximum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Co&nnection</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox66</cstring> + </property> + <property name="title"> + <string>Connection Preferences</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbUseSSL</cstring> + </property> + <property name="text"> + <string>Use protocol encr&yption (SSL)</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check this box to enable SSL encrypted communication with the server.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check this box to enable SSL encrypted communication with the server. Note that this is not end-to-end encryption, but rather encrypted communication with the server.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbAllowPlainTextPassword</cstring> + </property> + <property name="text"> + <string>Allow plain-te&xt password authentication</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbCustomServer</cstring> + </property> + <property name="text"> + <string>&Override default server information</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout66</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelServer</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Ser&ver:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mServer</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The IP address or hostname of the server you would like to connect to.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The IP address or hostname of the server you would like to connect to (for example jabber.org).</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>mServer</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>The IP address or hostname of the server you would like to connect to.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The IP address or hostname of the server you would like to connect to (for example jabber.org).</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>labelPort</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Po&rt:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mPort</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The port on the server that you would like to connect to.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The port on the server that you would like to connect to (default is 5222).</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>mPort</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>65535</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="value"> + <number>5222</number> + </property> + <property name="toolTip" stdset="0"> + <string>The port on the server that you would like to connect to.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The port on the server that you would like to connect to (default is 5222).</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox8</cstring> + </property> + <property name="title"> + <string>Location Settings</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel3_3</cstring> + </property> + <property name="text"> + <string>R&esource:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mResource</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The resource name you would like to use on the Jabber network.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The resource name you would like to use on the Jabber network. Jabber allows you to sign on with the same account from multiple locations with different resource names, so you may wish to enter 'Home' or 'Work' here, for example.</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>mResource</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>Kopete</string> + </property> + <property name="toolTip" stdset="0"> + <string>The resource name you would like to use on the Jabber network.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The resource name you would like to use on the Jabber network. Jabber allows you to sign on with the same account from multiple locations with different resource names, so you may wish to enter 'Home' or 'Work' here, for example.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer28</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel3_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>P&riority:</string> + </property> + <property name="alignment"> + <set>AlignVCenter</set> + </property> + <property name="buddy" stdset="0"> + <cstring>mResource</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The resource name you would like to use on the Jabber network.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The resource name you would like to use on the Jabber network. Jabber allows you to sign on with the same account from multiple locations with different resource names, so you may wish to enter 'Home' or 'Work' here, for example.</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>mPriority</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>32767</height> + </size> + </property> + <property name="value"> + <number>5</number> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Each resource can have different <b>priority </b> levels. The messages will be sent to the resource which has the highest priority level. + +If two resources have the same priority, the messages will be sent to the one connected the latest.</qt></string> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer43</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>200</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Fi&le Transfer</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox4</cstring> + </property> + <property name="title"> + <string>File Transfer Settings</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout70</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>leProxyJID</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Pro&xy JID:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>leProxyJID</cstring> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout68</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leLocalIP</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Por&t:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>sbLocalPort</cstring> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>sbLocalPort</cstring> + </property> + <property name="maxValue"> + <number>65535</number> + </property> + <property name="value"> + <number>8010</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Public &IP address:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>leLocalIP</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string><i><ul><li>The information in the "public IP address" and "port" fields apply to all Jabber accounts.</li> +<li>You can leave the "public IP address" empty if you do not use NAT.</li> +<li>A hostname is also valid.</li> +<li>Changes to these fields will only take effect the next time you start Kopete.</li> +<li>The "Proxy JID" can be configured per account.</li></ul></i></string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer29</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>241</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Pri&vacy</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox7</cstring> + </property> + <property name="title"> + <string>General Privacy</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>cbHideSystemInfo</cstring> + </property> + <property name="text"> + <string>&Hide system and client info</string> + </property> + <property name="whatsThis" stdset="0"> + <string>By default, Kopete gives the other users some info about your system and the client. You can check this box in order to hide those infos.</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox6</cstring> + </property> + <property name="title"> + <string>Notifications</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbSendEvents</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Always send not&ifications</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Check this box if you want to always send notifications to your contacts.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbSendDeliveredEvent</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Alwa&ys send delivered notifications</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Check this box to send the <b>Delivered notification</b> to your contacts : when a message is delivered to Kopete, Kopete can notify your contact that it has received the message.</qt></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbSendDisplayedEvent</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Al&ways send displayed notifications</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Check this box to send the <b>Displayed notification</b> to your contacts : when a message is displayed in Kopete, Kopete can notify your contact that it has displayed the message.</qt></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbSendComposingEvent</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Always send &typing notifications</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Check this box to send the <b>Typing notification</b> to your contacts : when you are composing a message, you might want your contact to know that you are typing so that he knows you are answering.</qt></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cbSendGoneEvent</cstring> + </property> + <property name="text"> + <string>Always send &gone notifications (closing the window)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>110</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + </grid> +</widget> +<customwidgets> + <customwidget> + <class>Kopete::UI::PasswordWidget</class> + <header location="local">kopetepasswordwidget.h</header> + <sizehint> + <width>50</width> + <height>50</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>1</hordata> + <verdata>0</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>changed()</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="868">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032b49444154388db59531681b6714c77f32373c8186ef0305eea0050932f8201d944d493bc4d0a1a21e4427bb533a74299dbc25905288a7d0b9836932d58116eac1411932388ba421a5a7a17005174e83e00e2cb80f6ab83708d2e18bec8ada26d0f4c1c1ddbbf7fdeeff3efeefbbda70346419b76fdd7ecd3b88e16858ab2dc183c3c1ebee7a97a99b521515d969f65610e71cd971c6f8d7312ccef3c152e9b39f9e11351d36164acdb819d4a9b4c4362ce5a2c48a45162588253ff5cfe5a2c406862405d9138e5eea2a18609a4fb12d212d7ea42c334089ac92e6423113cab902826d4227568a002480a942780dead16a2767e0ca55949a81668023b2c2e8952139748c270e58aa115aebc2675b86b80b6143710aa1b9049ccd336e064a5979e8e039ec7f5f78544368af1b24807ca64cff50befba6a0b765d8be2b67f00bc1562c95e6441646afe40d54b9f36948af2fb4df078722440c0e2af6f70a064f0be2568beea6c5885b01af2d6f4a2db10dc8ff128e0edc19f4f32f8576dbe1707022fcf2b4647babce175f8780f0c31307a7e0162bdc55c5e52247e742fabbc31843af2f9886c32d40d4b0fb4849278ef20476ee59c62f7ced3831848d55f0aa62816ca6de11ad37ed2fa10f1ce9c4619ac2c647824a45dc1100f2a9e2542e067b9f82155f108adf539c61f781924efc0745c0be57273240b08409e62ac508d0f085c94c112c83e778a54608434331733cbc9f331a5bf2636f85a855bfda15f9694e27565ad785e99fcae0a062fb6e4479a2f43e16eacd3a0fef433175ec7e95a1aa98a6d0e95454f355f2bff65803e8f5bddbf7f70a0687393bf72ced2e74ba253bdfb631a1c139872e948d7e487c83ab15979a2301dcba033a373c7e52f0f851c1f885d0ed080ec88f7374ae672b7f3b72249b115143389fce7f4e5e91d11398cefd986e6c099816839fbd1bd2c9b91ad3147afd16a32387534580ac58957c0e3ece485230d77c5ba6a1f4fa42ef9398719253153e1f5f8f687f9013df80f16684c1e0161969b20aae0d47437fc007d0f950882210c19fad81bf24f04e399701a04820380769a2e485e28a0b14b380e4a5927059e85be67cac5dfae63fc61af87fd4ff027ed7f0e16858fb1ba5cd86c64770b2e90000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>cbSendEvents</sender> + <signal>toggled(bool)</signal> + <receiver>cbSendDisplayedEvent</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>cbSendEvents</sender> + <signal>toggled(bool)</signal> + <receiver>cbSendComposingEvent</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>cbSendEvents</sender> + <signal>toggled(bool)</signal> + <receiver>cbSendDeliveredEvent</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>tabWidget10</tabstop> + <tabstop>mID</tabstop> + <tabstop>mPass</tabstop> + <tabstop>cbAutoConnect</tabstop> + <tabstop>btnRegister</tabstop> + <tabstop>btnChangePassword</tabstop> + <tabstop>cbUseSSL</tabstop> + <tabstop>cbAllowPlainTextPassword</tabstop> + <tabstop>cbCustomServer</tabstop> + <tabstop>mServer</tabstop> + <tabstop>mPort</tabstop> + <tabstop>mResource</tabstop> + <tabstop>mPriority</tabstop> + <tabstop>leLocalIP</tabstop> + <tabstop>sbLocalPort</tabstop> + <tabstop>leProxyJID</tabstop> + <tabstop>cbHideSystemInfo</tabstop> + <tabstop>cbSendEvents</tabstop> + <tabstop>cbSendDeliveredEvent</tabstop> + <tabstop>cbSendDisplayedEvent</tabstop> + <tabstop>cbSendComposingEvent</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kopetepasswordwidget.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgjabberregister.cpp b/kopete/protocols/jabber/ui/dlgjabberregister.cpp new file mode 100644 index 00000000..e16b5652 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberregister.cpp @@ -0,0 +1,117 @@ + +/*************************************************************************** + dlgjabberregister.cpp - description + ------------------- + begin : Mon Dec 9 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qpushbutton.h> + +#include <kmessagebox.h> +#include <klocale.h> + +#include "jabberaccount.h" +#include "jabberprotocol.h" +#include "jabberclient.h" +#include "dlgjabberregister.h" + +dlgJabberRegister::dlgJabberRegister (JabberAccount *account, const XMPP::Jid & jid, QWidget * parent, const char *name):dlgRegister (parent, name) +{ + m_account = account; + + XMPP::JT_Register * task = new XMPP::JT_Register(m_account->client()->rootTask ()); + + connect (task, SIGNAL (finished ()), this, SLOT (slotGotForm ())); + + task->getForm (jid); + task->go (true); + + translator = 0; + +} + +void dlgJabberRegister::slotGotForm () +{ + XMPP::JT_Register * task = (XMPP::JT_Register *) sender (); + + // remove the "wait" message + delete lblWait; + + if (!task->success ()) + { + KMessageBox::error (this, i18n ("Unable to retrieve registration form.\nReason: \"%1\"").arg (task->statusString (), 1), i18n ("Jabber Error")); + + deleteLater (); + + return; + } + + // translate the form and create it inside the box widget + translator = new JabberFormTranslator (task->form (), grpForm); + static_cast<QBoxLayout*>(grpForm->layout())->insertWidget(1, translator); + translator->show(); + resize(sizeHint()); + + // enable the send button + btnRegister->setEnabled (true); + + connect (btnRegister, SIGNAL (clicked ()), this, SLOT (slotSendForm ())); + +} + +void dlgJabberRegister::slotSendForm () +{ + if(!translator) + return; + XMPP::JT_Register * task = new XMPP::JT_Register (m_account->client()->rootTask ()); + + connect (task, SIGNAL (finished ()), this, SLOT (slotSentForm ())); + + task->setForm (translator->resultData ()); + task->go (true); + + btnRegister->setEnabled (false); + btnCancel->setEnabled (false); + +} + +void dlgJabberRegister::slotSentForm () +{ + XMPP::JT_Register * task = (XMPP::JT_Register *) sender (); + + if (task->success ()) + { + KMessageBox::information (this, i18n ("Registration sent successfully."), i18n ("Jabber Registration")); + + deleteLater (); + } + else + { + KMessageBox::error (this, + i18n ("The server denied the registration form.\nReason: \"%1\"").arg (task->statusString (), 1), i18n ("Jabber Registration")); + + btnRegister->setEnabled (true); + btnRegister->setEnabled (true); + } + +} + +dlgJabberRegister::~dlgJabberRegister () +{ + + delete translator; + +} + +#include "dlgjabberregister.moc" diff --git a/kopete/protocols/jabber/ui/dlgjabberregister.h b/kopete/protocols/jabber/ui/dlgjabberregister.h new file mode 100644 index 00000000..36bc0bab --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberregister.h @@ -0,0 +1,58 @@ + +/*************************************************************************** + dlgjabberregister.h - description + ------------------- + begin : Mon Dec 9 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef DLGJABBERREGISTER_H +#define DLGJABBERREGISTER_H + +#include <qwidget.h> +#include <qlayout.h> +#include <qgroupbox.h> +#include <qlabel.h> + +#include "im.h" +#include "xmpp.h" + +#include "jabberaccount.h" +#include "dlgregister.h" +#include "jabberformtranslator.h" + +/** + *@author Till Gerken <till@tantalo.net> + */ + +class dlgJabberRegister:public dlgRegister +{ + + Q_OBJECT + +public: + dlgJabberRegister (JabberAccount *account, const XMPP::Jid & jid, QWidget * parent = 0, const char *name = 0); + ~dlgJabberRegister (); + +private slots: + void slotGotForm (); + void slotSendForm (); + void slotSentForm (); + +private: + JabberAccount *m_account; + JabberFormTranslator * translator; + +}; + +#endif diff --git a/kopete/protocols/jabber/ui/dlgjabberregisteraccount.ui b/kopete/protocols/jabber/ui/dlgjabberregisteraccount.ui new file mode 100644 index 00000000..c411bb96 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberregisteraccount.ui @@ -0,0 +1,319 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>DlgJabberRegisterAccount</class> +<widget class="QWidget"> + <property name="name"> + <cstring>DlgJabberRegisterAccount</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>346</width> + <height>376</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>300</width> + <height>350</height> + </size> + </property> + <property name="caption"> + <string>Register Account - Jabber</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="1"> + <property name="name"> + <cstring>lblJID</cstring> + </property> + <property name="text"> + <string>Desired Jabber &ID:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>leJID</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>pixPasswordVerify</cstring> + </property> + <property name="minimumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="2"> + <property name="name"> + <cstring>layoutServerEntry</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leServer</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>btnChooseServer</cstring> + </property> + <property name="text"> + <string>C&hoose...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="2" column="1"> + <property name="name"> + <cstring>lblPassword</cstring> + </property> + <property name="text"> + <string>Pass&word:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lePassword</cstring> + </property> + </widget> + <widget class="KIntSpinBox" row="4" column="2"> + <property name="name"> + <cstring>sbPort</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxValue"> + <number>65535</number> + </property> + </widget> + <widget class="QCheckBox" row="5" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>cbUseSSL</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Use protocol encr&yption (SSL)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Check this box to enable SSL encrypted communication with the server.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check this box to enable SSL encrypted communication with the server. Note that this is not end-to-end encryption, but rather encrypted communication with the server.</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>pixJID</cstring> + </property> + <property name="minimumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + </widget> + <widget class="QLabel" row="4" column="1"> + <property name="name"> + <cstring>lblPort</cstring> + </property> + <property name="text"> + <string>&Port:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>sbPort</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="1"> + <property name="name"> + <cstring>lblPasswordVerify</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>&Repeat password:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lePasswordVerify</cstring> + </property> + </widget> + <widget class="KPasswordEdit" row="2" column="2"> + <property name="name"> + <cstring>lePassword</cstring> + </property> + <property name="echoMode"> + <enum>Password</enum> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>pixServer</cstring> + </property> + <property name="minimumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>lblServer</cstring> + </property> + <property name="text"> + <string>Jabber &server:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>leServer</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>pixPassword</cstring> + </property> + <property name="minimumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + </widget> + <widget class="KPasswordEdit" row="3" column="2"> + <property name="name"> + <cstring>lePasswordVerify</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="echoMode"> + <enum>Password</enum> + </property> + </widget> + <widget class="QLineEdit" row="1" column="2"> + <property name="name"> + <cstring>leJID</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLayoutWidget" row="6" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblJIDInformation</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>100</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacerMiddle</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>lblStatusMessage</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + </vbox> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>leServer</tabstop> + <tabstop>btnChooseServer</tabstop> + <tabstop>leJID</tabstop> + <tabstop>lePassword</tabstop> + <tabstop>lePasswordVerify</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kpushbutton.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kpassdlg.h</includehint> + <includehint>kpassdlg.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgjabbersendraw.cpp b/kopete/protocols/jabber/ui/dlgjabbersendraw.cpp new file mode 100644 index 00000000..17b2d181 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabbersendraw.cpp @@ -0,0 +1,116 @@ + +/*************************************************************************** + dlgjabbersendraw.cpp - Raw XML dialog + ------------------- + begin : Sun Aug 25 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + *************************************************************************** + + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "dlgjabbersendraw.h" + +#include <qcombobox.h> +#include <qpushbutton.h> +#include <qtextedit.h> +#include <kdebug.h> +#include "jabberclient.h" + +dlgJabberSendRaw::dlgJabberSendRaw ( JabberClient *client, QWidget *parent, const char *name ) + : DlgSendRaw (parent, name) +{ + // Connect the GUI elements to things that do stuff + connect (btnSend, SIGNAL (clicked ()), this, SLOT (slotSend ())); + connect (btnClose, SIGNAL (clicked ()), this, SLOT (slotCancel ())); + connect (btnClear, SIGNAL (clicked ()), this, SLOT (slotClear ())); + connect (inputWidget, SIGNAL (activated (int)), this, SLOT (slotCreateMessage (int))); + + m_client = client; + + show(); +} + +dlgJabberSendRaw::~dlgJabberSendRaw () +{ + // Nothing yet +} + +void dlgJabberSendRaw::slotCancel () +{ + close(true); +} + +void dlgJabberSendRaw::slotClear () +{ + inputWidget->setCurrentItem(0); + tePacket->clear(); +} + +void dlgJabberSendRaw::slotCreateMessage(int index) +{ + switch (index) { + case 1: + tePacket->setText(QString("<iq type='set' to='%1'>\n<query xmlns='jabber:iq:register'><remove/>\n</query>\n</iq>") + .arg ( m_client->jid().domain () ) ); + break; + case 2: + tePacket->setText("<presence>\n<show>\?\?\?</show>\n<status>\?\?\?</status>\n</presence>"); + break; + case 3: + tePacket->setText("<iq type='get' to='USER@DOMAIN'>\n<query xmlns='jabber:iq:last'/></iq>"); + break; + case 4: + tePacket->setText(QString("<message to='USER@DOMAIN' from='%1@%2/%3'>\n<body>Body text</body>\n</message>") + .arg ( m_client->jid().node (), m_client->jid().domain (), m_client->jid().resource () ) ); + break; + case 5: + tePacket->setText(QString("<message to='USER@DOMAIN' from='%1@%2/%3'>\n<subject>Subject</subject><body>Body text</body>\n</message>") + .arg ( m_client->jid().node (), m_client->jid().domain (), m_client->jid().resource () ) ); + + break; + case 6: + tePacket->setText("<iq type='set'>\n<query xmlns='jabber:iq:roster'>\n<item name='NAME' jid='USER@DOMAIN'>\n<group>GROUP</group>\n</item>\n</query>\n</iq>"); + break; + case 7: + tePacket->setText("<iq type='set'>\n<query xmlns='jabber:iq:roster'>\n<item jid='USER@DOMAIN' subscription='remove'/>\n</query>\n</iq>"); + break; + case 8: + tePacket->setText("<presence to='USER@DOMAIN' type='\?\?\?'/>"); + break; + default: + tePacket->clear(); + break; + } +} + +void dlgJabberSendRaw::slotSend() +{ + kdDebug (14130) << "[dlgJabberSendRaw] Sending RAW message" << endl; + + // Tell our engine to send + m_client->send (tePacket->text ()); + + // set temlapte combobox to "User Defined" and clear content + inputWidget->setCurrentItem(0); + tePacket->clear(); +} + +#include "dlgjabbersendraw.moc" + +/* + * Local variables: + * mode: c++ + * c-indentation-style: k&r + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/protocols/jabber/ui/dlgjabbersendraw.h b/kopete/protocols/jabber/ui/dlgjabbersendraw.h new file mode 100644 index 00000000..6570363b --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabbersendraw.h @@ -0,0 +1,85 @@ + +/*************************************************************************** + dlgjabbersendraw.h - Raw XML dialog + ------------------- + begin : Sun Aug 25 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + *************************************************************************** + + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef DLGJABBERSENDRAW_H +#define DLGJABBERSENDRAW_H + +#include <qwidget.h> +#include "dlgsendraw.h" + +class JabberClient; + +/** + * A dialog to send raw strings to the jabber server. + * + * It comes with a QComboBox to choose some "template" strings + * like "Availability Status", "Subscription",... + * + * @author Till Gerken <till@tantalo.net> + * @author Chris TenHarmsel <tenharmsel@users.sf.net> + */ +class dlgJabberSendRaw:public DlgSendRaw +{ +Q_OBJECT + +public: + dlgJabberSendRaw ( JabberClient *client, QWidget * parent = 0, const char *name = 0); + virtual ~ dlgJabberSendRaw (); + +public slots: + + /** + * Closes the SendRaw Dialog. + */ + void slotCancel (); + + /** + * Clears current xml message in tePacket. + */ + void slotClear (); + + /** + * Sets a xml message in tePacket(QTextWidget) + * according to the state of inputWidget. + */ + void slotCreateMessage (int); + + /** + * Sends a xml message to the server, + * clears tePacket afterwards. + */ + void slotSend(); + +private: + /** + * This is what we talk through + */ + JabberClient *m_client; +}; + + +#endif + +/* + * Local variables: + * c-indentation-style: k&r + * c-basic-offset: 8 + * indent-tabs-mode: t + * End: + */ +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/protocols/jabber/ui/dlgjabberservices.cpp b/kopete/protocols/jabber/ui/dlgjabberservices.cpp new file mode 100644 index 00000000..00e99f45 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberservices.cpp @@ -0,0 +1,237 @@ + +/*************************************************************************** + dlgjabberservices.cpp - Service browsing + ------------------- + begin : Mon Dec 9 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kmessagebox.h> +#include <klocale.h> +#include <kdebug.h> + +#include <qpushbutton.h> +#include <qlineedit.h> +#include <qtable.h> + +#include "jabberaccount.h" +#include "jabberclient.h" +#include "dlgjabberregister.h" +#include "dlgjabberbrowse.h" +#include "dlgjabberservices.h" + +#include "dlgjabberservices.moc" + +dlgJabberServices::dlgJabberServices (JabberAccount *account, QWidget *parent, const char *name):dlgServices (parent, name) +{ + m_account = account; + + if(m_account->isConnected()) + { + // pre-populate the server field + leServer->setText(m_account->server()); + } + + // disable the left margin + //tblServices->setLeftMargin (0); + + // no content for now + //tblServices->setNumRows (0); + + // disable the buttons as long as nothing has been selected + btnRegister->setDisabled (true); + btnBrowse->setDisabled (true); + + // allow autostretching + //tblServices->setColumnStretchable (0, true); + //tblServices->setColumnStretchable (1, true); + + // disable user selections + //tblServices->setSelectionMode (QTable::NoSelection); + + // name table headers + //tblServices->horizontalHeader ()->setLabel (0, i18n ("Name")); + //tblServices->horizontalHeader ()->setLabel (1, i18n ("Address")); + + connect (btnQuery, SIGNAL (clicked ()), this, SLOT (slotDisco ())); + //connect (tblServices, SIGNAL (clicked (int, int, int, const QPoint &)), this, SLOT (slotSetSelection (int, int, int, const QPoint &))); + connect (lvServices, SIGNAL (selectionChanged (QListViewItem *)), this, SLOT (slotSetSelection (QListViewItem *))); + + connect (btnRegister, SIGNAL (clicked ()), this, SLOT (slotRegister ())); + connect (btnBrowse, SIGNAL (clicked ()), this, SLOT (slotBrowse ())); + +} + +void dlgJabberServices::slotSetSelection (QListViewItem *it) +{ + dlgJabberServies_item *item=dynamic_cast<dlgJabberServies_item*>(it); + if(!item) + { + btnRegister->setDisabled (true); + btnBrowse->setDisabled (true); + } + else + { + btnRegister->setDisabled (! item->can_register); + btnBrowse->setDisabled (! item->can_browse); + current_jid=item->jid; + } + +} + +void dlgJabberServices::slotService () +{ + + if(!m_account->isConnected()) + { + m_account->errorConnectFirst(); + return; + } + + XMPP::JT_GetServices *serviceTask = new XMPP::JT_GetServices (m_account->client()->rootTask ()); + connect (serviceTask, SIGNAL (finished ()), this, SLOT (slotServiceFinished ())); + + /* populate server field if it is empty */ + if(leServer->text().isEmpty()) + leServer->setText(m_account->server()); + + kdDebug (14130) << "[dlgJabberServices] Trying to fetch a list of services at " << leServer->text () << endl; + + serviceTask->get (leServer->text ()); + serviceTask->go (true); +} + + + +void dlgJabberServices::slotServiceFinished () +{ + kdDebug (14130) << "[dlgJabberServices] Query task finished" << endl; + + XMPP::JT_GetServices * task = (XMPP::JT_GetServices *) sender (); + + if (!task->success ()) + { + QString error = task->statusString(); + KMessageBox::queuedMessageBox (this, KMessageBox::Error, i18n ("Unable to retrieve the list of services.\nReason: %1").arg(error), i18n ("Jabber Error")); + return; + } + + lvServices->clear(); + + for (XMPP::AgentList::const_iterator it = task->agents ().begin (); it != task->agents ().end (); ++it) + { + dlgJabberServies_item *item=new dlgJabberServies_item( lvServices , (*it).jid ().userHost () , (*it).name ()); + item->jid=(*it).jid(); + item->can_browse=(*it).features().canSearch(); + item->can_register=(*it).features().canRegister(); + } +} + +void dlgJabberServices::slotDisco() +{ + lvServices->clear(); + + if(!m_account->isConnected()) + { + m_account->errorConnectFirst(); + return; + } + + JT_DiscoItems *jt = new JT_DiscoItems(m_account->client()->rootTask()); + connect(jt, SIGNAL(finished()), this, SLOT(slotDiscoFinished())); + + /* populate server field if it is empty */ + if(leServer->text().isEmpty()) + leServer->setText(m_account->server()); + + jt->get(leServer->text() , QString()); + jt->go(true); +} + + + + + +void dlgJabberServices::slotDiscoFinished( ) +{ + XMPP::JT_DiscoItems *jt = (JT_DiscoItems *)sender(); + + if ( jt->success() ) + { + QValueList<XMPP::DiscoItem> list = jt->items(); + + lvServices->clear(); + + for(QValueList<XMPP::DiscoItem>::ConstIterator it = list.begin(); it != list.end(); ++it) + { + const XMPP::DiscoItem a = *it; + dlgJabberServies_item *item=new dlgJabberServies_item( lvServices , (*it).jid ().userHost () , (*it).name ()); + item->jid=a.jid(); + item->updateInfo(a.jid() , a.node(), m_account); + } + } + else + { + slotService(); + } +} + + +void dlgJabberServices::slotRegister () +{ + + dlgJabberRegister *registerDialog = new dlgJabberRegister (m_account, current_jid); + + registerDialog->show (); + registerDialog->raise (); + +} + +void dlgJabberServices::slotBrowse () +{ + + dlgJabberBrowse *browseDialog = new dlgJabberBrowse (m_account, current_jid); + + browseDialog->show (); + browseDialog->raise (); + +} + +dlgJabberServices::~dlgJabberServices () +{ +} + +void dlgJabberServies_item::updateInfo( const XMPP::Jid & jid , const QString & node , JabberAccount *account ) +{ + XMPP::JT_DiscoInfo *jt = new XMPP::JT_DiscoInfo(account->client()->rootTask()); + connect(jt, SIGNAL(finished()),this, SLOT(slotDiscoFinished())); + jt->get(jid, node); + jt->go(true); + +} + +void dlgJabberServies_item::slotDiscoFinished( ) +{ + JT_DiscoInfo *jt = (JT_DiscoInfo *)sender(); + + if ( jt->success() ) + { + can_browse = jt->item().features().canSearch(); + can_register = jt->item().features().canRegister(); + } + else + { + //TODO: error message (it's a simple message box to show) + } +} + diff --git a/kopete/protocols/jabber/ui/dlgjabberservices.h b/kopete/protocols/jabber/ui/dlgjabberservices.h new file mode 100644 index 00000000..f2d4cedc --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabberservices.h @@ -0,0 +1,73 @@ + +/*************************************************************************** + dlgjabberservices.h - description + ------------------- + begin : Mon Dec 9 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef DLGJABBERSERVICES_H +#define DLGJABBERSERVICES_H + +#include <qwidget.h> + +#include "jabberaccount.h" +#include "xmpp_tasks.h" + +#include "dlgservices.h" +#include <qlistview.h> + +/** + *@author Till Gerken <till@tantalo.net> + */ + +class dlgJabberServices:public dlgServices +{ + Q_OBJECT + +public: + dlgJabberServices (JabberAccount *account, QWidget *parent = 0, const char *name = 0); + ~dlgJabberServices (); + +private slots: + void slotSetSelection (QListViewItem *); + void slotService (); + void slotServiceFinished (); + void slotRegister (); + void slotBrowse (); + + void slotDisco(); + void slotDiscoFinished(); + +private: + JabberAccount *m_account; + XMPP::Jid current_jid; + +}; + + +class dlgJabberServies_item : protected QObject, public QListViewItem +{ + Q_OBJECT + public: + dlgJabberServies_item( QListView *parent , const QString &s1 , const QString &s2 ) + : QListViewItem(parent,s1,s2), can_browse(false) , can_register(false) {} + bool can_browse, can_register; + XMPP::Jid jid; + + void updateInfo(const XMPP::Jid& jid, const QString &node , JabberAccount *account); + private slots: + void slotDiscoFinished(); +}; + +#endif diff --git a/kopete/protocols/jabber/ui/dlgjabbervcard.cpp b/kopete/protocols/jabber/ui/dlgjabbervcard.cpp new file mode 100644 index 00000000..b35e091a --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabbervcard.cpp @@ -0,0 +1,563 @@ + +/*************************************************************************** + dlgjabbervcard.cpp - vCard dialog + ------------------- + begin : Thu Aug 08 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + (C) 2005 by Michaël Larouche <michael.larouche@kdemail.net> + email : kopete-devel@kde.org + + Rewritten version of the original dialog + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "dlgjabbervcard.h" + +// Qt includes +#include <qtextedit.h> +#include <qwidgetstack.h> +#include <qregexp.h> +#include <qbuffer.h> + +// KDE includes +#include <kdebug.h> +#include <kpushbutton.h> +#include <klineedit.h> +#include <klocale.h> +#include <kurllabel.h> +#include <kmessagebox.h> +#include <krun.h> +#include <kio/netaccess.h> +#include <kfiledialog.h> +#include <kpixmapregionselectordialog.h> +#include <kstandarddirs.h> + +// libiris(XMPP backend) includes +#include "im.h" +#include "xmpp.h" +#include "xmpp_tasks.h" + +// Kopete includes +#include "jabberprotocol.h" +#include "jabbercontact.h" +#include "jabberaccount.h" +#include "jabbercontactpool.h" +#include "jabberbasecontact.h" +#include "jabberclient.h" +#include "dlgvcard.h" + +/* + * Constructs a dlgJabberVCard which is a child of 'parent', with the + * name 'name' + * + */ +dlgJabberVCard::dlgJabberVCard (JabberAccount *account, JabberBaseContact *contact, QWidget * parent, const char *name) + : KDialogBase (parent, name, false, i18n("Jabber vCard"), Close | User1 | User2, Close, false, i18n("&Save User Info"), i18n("&Fetch vCard") ) +{ + + m_account = account; + m_contact = contact; + + m_mainWidget = new dlgVCard(this); + setMainWidget(m_mainWidget); + + connect (this, SIGNAL (user1Clicked()), this, SLOT (slotSaveVCard ())); + connect (this, SIGNAL( user2Clicked()), this, SLOT (slotGetVCard ())); + + connect (m_mainWidget->btnSelectPhoto, SIGNAL (clicked()), this, SLOT (slotSelectPhoto())); + connect (m_mainWidget->btnClearPhoto, SIGNAL (clicked()), this, SLOT (slotClearPhoto())); + connect (m_mainWidget->urlHomeEmail, SIGNAL (leftClickedURL(const QString &)), this, SLOT (slotOpenURL (const QString &))); + connect (m_mainWidget->urlWorkEmail, SIGNAL (leftClickedURL(const QString &)), this, SLOT (slotOpenURL (const QString &))); + connect (m_mainWidget->urlHomepage, SIGNAL (leftClickedURL(const QString &)), this, SLOT (slotOpenURL (const QString &))); + + assignContactProperties(); + + show (); + raise (); + + slotGetVCard(); +} + +/* + * Destroys the object and frees any allocated resources + */ +dlgJabberVCard::~dlgJabberVCard () +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Activated when the close button gets pressed. Deletes the dialog. + */ +void dlgJabberVCard::slotClose() +{ + kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Deleting dialog." << endl; + delayedDestruct(); +} + +/* + * Assign the contact properties to this dialog + */ +void dlgJabberVCard::assignContactProperties () +{ + // general tab + m_mainWidget->leNick->setText (m_contact->property(m_account->protocol()->propNickName).value().toString()); + m_mainWidget->leName->setText (m_contact->property(m_account->protocol()->propFullName).value().toString()); + // Guess the JID from the Kopete::Contact if the propJid is empty. + if( m_contact->property( m_account->protocol()->propJid ).value().toString().isEmpty() ) + m_mainWidget->leJID->setText (m_contact->rosterItem().jid().full()); + else + m_mainWidget->leJID->setText (m_contact->property(m_account->protocol()->propJid).value().toString()); + m_mainWidget->leBirthday->setText (m_contact->property(m_account->protocol()->propBirthday).value().toString()); + m_mainWidget->leTimezone->setText (m_contact->property(m_account->protocol()->propTimezone).value().toString()); + + QString homepage = m_contact->property(m_account->protocol()->propHomepage).value().toString(); + m_mainWidget->leHomepage->setText (homepage); + m_mainWidget->urlHomepage->setText (homepage); + m_mainWidget->urlHomepage->setURL (homepage); + m_mainWidget->urlHomepage->setUseCursor ( !homepage.isEmpty () ); + + // Set photo + m_photoPath = m_contact->property(m_account->protocol()->propPhoto).value().toString(); + if( !m_photoPath.isEmpty() ) + { + m_mainWidget->lblPhoto->setPixmap( QPixmap(m_photoPath) ); + } + + // addresses + m_mainWidget->leWorkStreet->setText (m_contact->property(m_account->protocol()->propWorkStreet).value().toString()); + m_mainWidget->leWorkExtAddr->setText (m_contact->property(m_account->protocol()->propWorkExtAddr).value().toString()); + m_mainWidget->leWorkPOBox->setText (m_contact->property(m_account->protocol()->propWorkPOBox).value().toString()); + m_mainWidget->leWorkCity->setText (m_contact->property(m_account->protocol()->propWorkCity).value().toString()); + m_mainWidget->leWorkPostalCode->setText (m_contact->property(m_account->protocol()->propWorkPostalCode).value().toString()); + m_mainWidget->leWorkCountry->setText (m_contact->property(m_account->protocol()->propWorkCountry).value().toString()); + + m_mainWidget->leHomeStreet->setText (m_contact->property(m_account->protocol()->propHomeStreet).value().toString()); + m_mainWidget->leHomeExtAddr->setText (m_contact->property(m_account->protocol()->propHomeExtAddr).value().toString()); + m_mainWidget->leHomePOBox->setText (m_contact->property(m_account->protocol()->propHomePOBox).value().toString()); + m_mainWidget->leHomeCity->setText (m_contact->property(m_account->protocol()->propHomeCity).value().toString()); + m_mainWidget->leHomePostalCode->setText (m_contact->property(m_account->protocol()->propHomePostalCode).value().toString()); + m_mainWidget->leHomeCountry->setText (m_contact->property(m_account->protocol()->propHomeCountry).value().toString()); + + // email + m_mainWidget->urlWorkEmail->setUseCursor ( false ); + m_mainWidget->urlHomeEmail->setUseCursor ( false ); + + QString workEmail = m_contact->property(m_account->protocol()->propWorkEmailAddress).value().toString(); + QString homeEmail = m_contact->property(m_account->protocol()->propEmailAddress).value().toString(); + m_mainWidget->leWorkEmail->setText (workEmail); + m_mainWidget->urlWorkEmail->setText (workEmail); + m_mainWidget->urlWorkEmail->setURL ("mailto:" + workEmail); + bool enableMail=!workEmail.stripWhiteSpace().isEmpty (); + m_mainWidget->urlWorkEmail->setUseCursor ( enableMail ); + m_mainWidget->urlWorkEmail->setEnabled ( enableMail ); + + m_mainWidget->leHomeEmail->setText (homeEmail); + m_mainWidget->urlHomeEmail->setText (homeEmail); + enableMail=!homeEmail.stripWhiteSpace().isEmpty (); + m_mainWidget->urlHomeEmail->setURL ("mailto:" + homeEmail); + m_mainWidget->urlHomeEmail->setUseCursor ( enableMail ); + m_mainWidget->urlHomeEmail->setEnabled ( enableMail ); + + // work information tab + m_mainWidget->leCompany->setText (m_contact->property(m_account->protocol()->propCompanyName).value().toString()); + m_mainWidget->leDepartment->setText (m_contact->property(m_account->protocol()->propCompanyDepartement).value().toString()); + m_mainWidget->lePosition->setText (m_contact->property(m_account->protocol()->propCompanyPosition).value().toString()); + m_mainWidget->leRole->setText (m_contact->property(m_account->protocol()->propCompanyRole).value().toString()); + + // phone numbers tab + m_mainWidget->lePhoneFax->setText(m_contact->property(m_account->protocol()->propPhoneFax).value().toString()); + m_mainWidget->lePhoneWork->setText(m_contact->property(m_account->protocol()->propWorkPhone).value().toString()); + m_mainWidget->lePhoneCell->setText(m_contact->property(m_account->protocol()->propPrivateMobilePhone).value().toString()); + m_mainWidget->lePhoneHome->setText(m_contact->property(m_account->protocol()->propPrivatePhone).value().toString()); + + // about tab + m_mainWidget->teAbout->setText (m_contact->property(m_account->protocol()->propAbout).value().toString()); + + if(m_account->myself() == m_contact) + setReadOnly (false); + else + setReadOnly (true); +} + +void dlgJabberVCard::setReadOnly (bool state) +{ + // general tab + m_mainWidget->leNick->setReadOnly (state); + m_mainWidget->leName->setReadOnly (state); + m_mainWidget->leJID->setReadOnly (state); + m_mainWidget->leBirthday->setReadOnly (state); + m_mainWidget->leTimezone->setReadOnly (state); + m_mainWidget->wsHomepage->raiseWidget(state ? 0 : 1); + // Disable photo buttons when read only + m_mainWidget->btnSelectPhoto->setEnabled(!state); + m_mainWidget->btnClearPhoto->setEnabled(!state); + + // home address tab + m_mainWidget->leHomeStreet->setReadOnly (state); + m_mainWidget->leHomeExtAddr->setReadOnly (state); + m_mainWidget->leHomePOBox->setReadOnly (state); + m_mainWidget->leHomeCity->setReadOnly (state); + m_mainWidget->leHomePostalCode->setReadOnly (state); + m_mainWidget->leHomeCountry->setReadOnly (state); + m_mainWidget->wsHomeEmail->raiseWidget(state ? 0 : 1); + + // work address tab + m_mainWidget->leWorkStreet->setReadOnly (state); + m_mainWidget->leWorkExtAddr->setReadOnly (state); + m_mainWidget->leWorkPOBox->setReadOnly (state); + m_mainWidget->leWorkCity->setReadOnly (state); + m_mainWidget->leWorkPostalCode->setReadOnly (state); + m_mainWidget->leWorkCountry->setReadOnly (state); + m_mainWidget->wsWorkEmail->raiseWidget(state ? 0 : 1); + + // work information tab + m_mainWidget->leCompany->setReadOnly (state); + m_mainWidget->leDepartment->setReadOnly (state); + m_mainWidget->lePosition->setReadOnly (state); + m_mainWidget->leRole->setReadOnly (state); + + // phone numbers tab + m_mainWidget->lePhoneHome->setReadOnly (state); + m_mainWidget->lePhoneWork->setReadOnly (state); + m_mainWidget->lePhoneFax->setReadOnly (state); + m_mainWidget->lePhoneCell->setReadOnly (state); + + // about tab + m_mainWidget->teAbout->setReadOnly (state); + + // save button + enableButton(User1, !state); +} + +void dlgJabberVCard::setEnabled(bool state) +{ + // general tab + m_mainWidget->leNick->setEnabled (state); + m_mainWidget->leName->setEnabled (state); + m_mainWidget->leJID->setEnabled (state); + m_mainWidget->leBirthday->setEnabled (state); + m_mainWidget->leTimezone->setEnabled (state); + m_mainWidget->wsHomepage->raiseWidget(state ? 1 : 0); + // Disable photo buttons when read only + m_mainWidget->btnSelectPhoto->setEnabled(state); + m_mainWidget->btnClearPhoto->setEnabled(state); + + // home address tab + m_mainWidget->leHomeStreet->setEnabled (state); + m_mainWidget->leHomeExtAddr->setEnabled (state); + m_mainWidget->leHomePOBox->setEnabled (state); + m_mainWidget->leHomeCity->setEnabled (state); + m_mainWidget->leHomePostalCode->setEnabled (state); + m_mainWidget->leHomeCountry->setEnabled (state); + m_mainWidget->wsHomeEmail->raiseWidget(state ? 0 : 1); + + // work address tab + m_mainWidget->leWorkStreet->setEnabled (state); + m_mainWidget->leWorkExtAddr->setEnabled (state); + m_mainWidget->leWorkPOBox->setEnabled (state); + m_mainWidget->leWorkCity->setEnabled (state); + m_mainWidget->leWorkPostalCode->setEnabled (state); + m_mainWidget->leWorkCountry->setEnabled (state); + m_mainWidget->wsWorkEmail->raiseWidget(state ? 0 : 1); + + // work information tab + m_mainWidget->leCompany->setEnabled (state); + m_mainWidget->leDepartment->setEnabled (state); + m_mainWidget->lePosition->setEnabled (state); + m_mainWidget->leRole->setEnabled (state); + + // phone numbers tab + m_mainWidget->lePhoneHome->setEnabled (state); + m_mainWidget->lePhoneWork->setEnabled (state); + m_mainWidget->lePhoneFax->setEnabled (state); + m_mainWidget->lePhoneCell->setEnabled (state); + + // about tab + m_mainWidget->teAbout->setEnabled (state); + + // save button + enableButton(User1, state); + enableButton(User2, state); +} + +/* + * Saves a vCard to the contact properties + */ +void dlgJabberVCard::slotSaveVCard() +{ + setEnabled(false); + m_mainWidget->lblStatus->setText( i18n("Saving vCard to server...") ); + + XMPP::VCard vCard; + XMPP::VCard::AddressList addressList; + XMPP::VCard::EmailList emailList; + XMPP::VCard::PhoneList phoneList; + + // General information + vCard.setNickName( m_mainWidget->leNick->text() ); + vCard.setFullName( m_mainWidget->leName->text() ); + vCard.setJid( m_mainWidget->leJID->text() ); + vCard.setBdayStr( m_mainWidget->leBirthday->text() ); + vCard.setTimezone( m_mainWidget->leTimezone->text() ); + vCard.setUrl( m_mainWidget->leHomepage->text() ); + + // home address tab + XMPP::VCard::Address homeAddress; + + homeAddress.home = true; + homeAddress.street = m_mainWidget->leHomeStreet->text(); + homeAddress.extaddr = m_mainWidget->leHomeExtAddr->text(); + homeAddress.pobox = m_mainWidget->leHomePOBox->text(); + homeAddress.locality = m_mainWidget->leHomeCity->text(); + homeAddress.pcode = m_mainWidget->leHomePostalCode->text(); + homeAddress.country = m_mainWidget->leHomeCountry->text(); + + // work address tab + XMPP::VCard::Address workAddress; + + workAddress.work = true; + workAddress.street = m_mainWidget->leWorkStreet->text(); + workAddress.extaddr = m_mainWidget->leWorkExtAddr->text(); + workAddress.pobox = m_mainWidget->leWorkPOBox->text(); + workAddress.locality = m_mainWidget->leWorkCity->text(); + workAddress.pcode = m_mainWidget->leWorkPostalCode->text(); + workAddress.country = m_mainWidget->leWorkCountry->text(); + + addressList.append(homeAddress); + addressList.append(workAddress); + + vCard.setAddressList(addressList); + + // home email + XMPP::VCard::Email homeEmail; + + homeEmail.home = true; + homeEmail.userid = m_mainWidget->leHomeEmail->text(); + + // work email + XMPP::VCard::Email workEmail; + + workEmail.work = true; + workEmail.userid = m_mainWidget->leWorkEmail->text(); + + emailList.append(homeEmail); + emailList.append(workEmail); + + vCard.setEmailList(emailList); + + // work information tab + XMPP::VCard::Org org; + org.name = m_mainWidget->leCompany->text(); + org.unit = QStringList::split(",", m_mainWidget->leDepartment->text()); + vCard.setOrg(org); + vCard.setTitle( m_mainWidget->lePosition->text() ); + vCard.setRole( m_mainWidget->leRole->text() ); + + // phone numbers tab + XMPP::VCard::Phone phoneHome; + phoneHome.home = true; + phoneHome.number = m_mainWidget->lePhoneHome->text(); + + XMPP::VCard::Phone phoneWork; + phoneWork.work = true; + phoneWork.number = m_mainWidget->lePhoneWork->text(); + + XMPP::VCard::Phone phoneFax; + phoneFax.fax = true; + phoneFax.number = m_mainWidget->lePhoneFax->text(); + + XMPP::VCard::Phone phoneCell; + phoneCell.cell = true; + phoneCell.number = m_mainWidget->lePhoneCell->text(); + + phoneList.append(phoneHome); + phoneList.append(phoneWork); + phoneList.append(phoneFax); + phoneList.append(phoneCell); + + vCard.setPhoneList(phoneList); + + // about tab + vCard.setDesc( m_mainWidget->teAbout->text() ); + + // Set contact photo as a binary value (if he has set a photo) + if( !m_photoPath.isEmpty() ) + { + QString photoPath = m_photoPath; + QImage image( photoPath ); + QByteArray ba; + QBuffer buffer( ba ); + buffer.open( IO_WriteOnly ); + image.save( &buffer, "PNG" ); + vCard.setPhoto( ba ); + } + + vCard.setVersion("3.0"); + vCard.setProdId("Kopete"); + + XMPP::JT_VCard *task = new XMPP::JT_VCard( m_account->client()->rootTask() ); + // signal to ourselves when the vCard data arrived + QObject::connect(task, SIGNAL(finished()), this, SLOT(slotVCardSaved())); + task->set(vCard); + task->go(true); +} + +void dlgJabberVCard::slotVCardSaved() +{ + XMPP::JT_VCard *vCard = (XMPP::JT_VCard*)sender(); + + if( vCard->success() ) + { + m_mainWidget->lblStatus->setText( i18n("vCard save sucessful.") ); + m_contact->setPropertiesFromVCard( vCard->vcard() ); + } + else + { + m_mainWidget->lblStatus->setText( i18n("Error: Unable to save vCard.") ); + } + + setEnabled(true); +} + +void dlgJabberVCard::slotGetVCard() +{ + m_mainWidget->lblStatus->setText( i18n("Fetching contact vCard...") ); + + setReadOnly(true); + setEnabled(false); + + XMPP::JT_VCard *task = new XMPP::JT_VCard ( m_account->client()->rootTask() ); + // signal to ourselves when the vCard data arrived + QObject::connect( task, SIGNAL ( finished () ), this, SLOT ( slotGotVCard () ) ); + task->get ( m_contact->rosterItem().jid().full() ); + task->go ( true ); +} + +void dlgJabberVCard::slotGotVCard() +{ + XMPP::JT_VCard * vCard = (XMPP::JT_VCard *) sender (); + + if( vCard->success() ) + { + m_contact->setPropertiesFromVCard( vCard->vcard() ); + setEnabled( true ); + + assignContactProperties(); + + m_mainWidget->lblStatus->setText( i18n("vCard fetching Done.") ); + } + else + { + m_mainWidget->lblStatus->setText( i18n("Error: vCard could not be fetched correctly. Check connectivity with the Jabber server.") ); + //it is maybe possible to anyway edit our own vCard (if it is new + if(m_account->myself() == m_contact) + setEnabled( true ); + } +} + +void dlgJabberVCard::slotSelectPhoto() +{ + QString path; + bool remoteFile = false; + KURL filePath = KFileDialog::getImageOpenURL( QString::null, this, i18n( "Jabber Photo" ) ); + if( filePath.isEmpty() ) + return; + + if( !filePath.isLocalFile() ) + { + if( !KIO::NetAccess::download( filePath, path, this ) ) + { + KMessageBox::queuedMessageBox( this, KMessageBox::Sorry, i18n( "Downloading of Jabber contact photo failed!" ) ); + return; + } + remoteFile = true; + } + else + path = filePath.path(); + + QImage img( path ); + img = KPixmapRegionSelectorDialog::getSelectedImage( QPixmap(img), 96, 96, this ); + + if( !img.isNull() ) + { + if(img.width() > 96 || img.height() > 96) + { + // Scale and crop the picture. + img = img.smoothScale( 96, 96, QImage::ScaleMin ); + // crop image if not square + if(img.width() < img.height()) + img = img.copy((img.width()-img.height())/2, 0, 96, 96); + else if (img.width() > img.height()) + img = img.copy(0, (img.height()-img.width())/2, 96, 96); + + } + else if (img.width() < 32 || img.height() < 32) + { + // Scale and crop the picture. + img = img.smoothScale( 32, 32, QImage::ScaleMin ); + // crop image if not square + if(img.width() < img.height()) + img = img.copy((img.width()-img.height())/2, 0, 32, 32); + else if (img.width() > img.height()) + img = img.copy(0, (img.height()-img.width())/2, 32, 32); + + } + else if (img.width() != img.height()) + { + if(img.width() < img.height()) + img = img.copy((img.width()-img.height())/2, 0, img.height(), img.height()); + else if (img.width() > img.height()) + img = img.copy(0, (img.height()-img.width())/2, img.height(), img.height()); + } + + m_photoPath = locateLocal("appdata", "jabberphotos/" + m_contact->rosterItem().jid().full().lower().replace(QRegExp("[./~]"),"-") +".png"); + if( img.save(m_photoPath, "PNG") ) + { + m_mainWidget->lblPhoto->setPixmap( QPixmap(img) ); + } + else + { + m_photoPath = QString::null; + } + } + else + { + KMessageBox::queuedMessageBox( this, KMessageBox::Sorry, i18n( "<qt>An error occurred when trying to change the photo.<br>" + "Make sure that you have selected a correct image file</qt>" ) ); + } + if( remoteFile ) + KIO::NetAccess::removeTempFile( path ); +} + +void dlgJabberVCard::slotClearPhoto() +{ + m_mainWidget->lblPhoto->setPixmap( QPixmap() ); + m_photoPath = QString::null; +} + +void dlgJabberVCard::slotOpenURL(const QString &url) +{ + if ( !url.isEmpty () || (url == QString::fromLatin1("mailto:") ) ) + new KRun(KURL( url ) ); +} + +#include "dlgjabbervcard.moc" + +/* + * Local variables: + * c-indentation-style: k&r + * c-basic-offset: 8 + * indent-tabs-mode: t + * End: + */ +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/protocols/jabber/ui/dlgjabbervcard.h b/kopete/protocols/jabber/ui/dlgjabbervcard.h new file mode 100644 index 00000000..2bea5a2b --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgjabbervcard.h @@ -0,0 +1,118 @@ + +/*************************************************************************** + dlgjabbervcard.h - vCard dialog + ------------------- + begin : Thu Aug 08 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + (C) 2005 by Michaël Larouche <michael.larouche@kdemail.net> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef DLGJABBERVCARD_H +#define DLGJABBERVCARD_H + +#include <kdialogbase.h> +#include "xmpp_vcard.h" + +class JabberAccount; +class JabberContact; +class JabberBaseContact; +class QString; +class dlgVCard; + +/** + * @brief Show the information of a Jabber contact. + * + * This dialog shows the information of a Jabber contact from + * the contact properties(from Kopete). + * Also it is used to edit the information of the Account myself contact. + * + * First it fetch a new version of the vcard then it display the + * information. User can force the update using the "Update vCard" button. + * + * @author Till Gerken <till@tantolo.net> + * @author Michaël Larouche <michael.larouche@kdemail.net> + */ +class dlgJabberVCard : public KDialogBase +{ + Q_OBJECT + +public: + /** + * Create the information(vcard) dialog. + * + * @param account the current Jabber account + * @param contact the contact to display or edit information. + * @param widget Parent widget. + * @param name widget name. + */ + dlgJabberVCard (JabberAccount *account, JabberBaseContact *contact, QWidget * parent = 0, const char *name = 0); + ~dlgJabberVCard (); + +private slots: + /** + * Show the KFileDialog for image to select a photo for the contact. + */ + void slotSelectPhoto(); + /** + * Remove(clear) the photo. + * Maybe the user doesn't want to export a photo anymore. + */ + void slotClearPhoto(); + /** + * Send vCard to the server. + */ + void slotSaveVCard(); + /** + * Put back the information from the dialog into the contact properties + */ + void slotVCardSaved(); + /** + * Close the dialog. + */ + void slotClose(); + /** + * Open a link. (ex: the homepage link or the email address) + */ + void slotOpenURL(const QString &url); + + /** + * Retrieve vCard information for the current contact. + */ + void slotGetVCard(); + /** + * vCard was succesfully fetched, update contact properties + * and enable display. + */ + void slotGotVCard(); + +private: + JabberAccount *m_account; + JabberBaseContact *m_contact; + dlgVCard *m_mainWidget; + QString m_photoPath; + + void assignContactProperties(); + void setReadOnly(bool state); + void setEnabled(bool state); + +}; + +#endif // DLGJABBERVCARD_H + +/* + * Local variables: + * c-indentation-style: k&r + * c-basic-offset: 8 + * indent-tabs-mode: t + * End: + */ diff --git a/kopete/protocols/jabber/ui/dlgregister.ui b/kopete/protocols/jabber/ui/dlgregister.ui new file mode 100644 index 00000000..a3930c2e --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgregister.ui @@ -0,0 +1,162 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>dlgRegister</class> +<widget class="QDialog"> + <property name="name"> + <cstring>dlgRegister</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>338</width> + <height>119</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>Register with Jabber Service</string> + </property> + <property name="sizeGripEnabled"> + <bool>false</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>grpForm</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="margin"> + <number>10</number> + </property> + <property name="title"> + <string>Registration Form</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblWait</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Please wait while querying the server...</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnRegister</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Register</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>btnCancel</sender> + <signal>clicked()</signal> + <receiver>dlgRegister</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgsendraw.ui b/kopete/protocols/jabber/ui/dlgsendraw.ui new file mode 100644 index 00000000..08e31f66 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgsendraw.ui @@ -0,0 +1,159 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>DlgSendRaw</class> +<widget class="QDialog"> + <property name="name"> + <cstring>DlgSendRaw</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>519</width> + <height>233</height> + </rect> + </property> + <property name="caption"> + <string>Send Raw XML Packet</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblInfo</cstring> + </property> + <property name="paletteForegroundColor"> + <color> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="text"> + <string>Type in the packet that should be sent to the server:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lblRealStatus</cstring> + </property> + </widget> + <widget class="QTextEdit"> + <property name="name"> + <cstring>tePacket</cstring> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>User Defined</string> + </property> + </item> + <item> + <property name="text"> + <string>Account Deletion</string> + </property> + </item> + <item> + <property name="text"> + <string>Availability Status</string> + </property> + </item> + <item> + <property name="text"> + <string>Last Active Time</string> + </property> + </item> + <item> + <property name="text"> + <string>Message with Body</string> + </property> + </item> + <item> + <property name="text"> + <string>Message with Subject</string> + </property> + </item> + <item> + <property name="text"> + <string>Add Roster Item</string> + </property> + </item> + <item> + <property name="text"> + <string>Delete Roster Item</string> + </property> + </item> + <item> + <property name="text"> + <string>Subscription</string> + </property> + </item> + <property name="name"> + <cstring>inputWidget</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnClear</cstring> + </property> + <property name="text"> + <string>Clea&r</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnSend</cstring> + </property> + <property name="text"> + <string>&Send</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>25</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnClose</cstring> + </property> + <property name="text"> + <string>&Close</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgservices.ui b/kopete/protocols/jabber/ui/dlgservices.ui new file mode 100644 index 00000000..7679309d --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgservices.ui @@ -0,0 +1,199 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>dlgServices</class> +<widget class="QDialog"> + <property name="name"> + <cstring>dlgServices</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>446</width> + <height>292</height> + </rect> + </property> + <property name="caption"> + <string>Jabber Service Management</string> + </property> + <property name="sizeGripEnabled"> + <bool>false</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblServer</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Server:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leServer</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnQuery</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Query Server</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QListView"> + <column> + <property name="text"> + <string>Jid</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>lvServices</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>111</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnRegister</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Register</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnBrowse</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Browse</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnClose</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Close</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>btnClose</sender> + <signal>clicked()</signal> + <receiver>dlgServices</receiver> + <slot>close()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/jabber/ui/dlgvcard.ui b/kopete/protocols/jabber/ui/dlgvcard.ui new file mode 100644 index 00000000..efaf5519 --- /dev/null +++ b/kopete/protocols/jabber/ui/dlgvcard.ui @@ -0,0 +1,1064 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>dlgVCard</class> +<widget class="QWidget"> + <property name="name"> + <cstring>dlgVCard</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>764</width> + <height>487</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget3</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&General</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblBirthday</cstring> + </property> + <property name="text"> + <string>Birthday:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leBirthday</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblHomepage</cstring> + </property> + <property name="text"> + <string>Homepage:</string> + </property> + </widget> + <widget class="QWidgetStack"> + <property name="name"> + <cstring>wsHomepage</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <widget class="KURLLabel"> + <property name="name"> + <cstring>urlHomepage</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>5</y> + <width>450</width> + <height>18</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leHomepage</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>450</width> + <height>25</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblTimezone</cstring> + </property> + <property name="text"> + <string>Timezone:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leTimezone</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblJID</cstring> + </property> + <property name="text"> + <string>Jabber ID:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leJID</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblName</cstring> + </property> + <property name="text"> + <string>Full name:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leName</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>lblNick</cstring> + </property> + <property name="text"> + <string>Nickname:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leNick</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <spacer row="7" column="0"> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="7" column="1"> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Photo</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>btnSelectPhoto</cstring> + </property> + <property name="text"> + <string>&Select Photo...</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>btnClearPhoto</cstring> + </property> + <property name="text"> + <string>Clear Pho&to</string> + </property> + </widget> + <widget class="QLabel" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lblPhoto</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>96</width> + <height>96</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>96</width> + <height>96</height> + </size> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <spacer row="0" column="0"> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="0" column="3"> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Home Address</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout36</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>lblState</cstring> + </property> + <property name="text"> + <string>Postal code:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>lblPOBox</cstring> + </property> + <property name="text"> + <string>PO box:</string> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>leHomeExtAddr</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>lblCity</cstring> + </property> + <property name="text"> + <string>City:</string> + </property> + </widget> + <spacer row="8" column="1"> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QWidgetStack" row="6" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>wsHomeEmail</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <widget class="KURLLabel"> + <property name="name"> + <cstring>urlHomeEmail</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>4</y> + <width>430</width> + <height>18</height> + </rect> + </property> + </widget> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leHomeEmail</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>450</width> + <height>25</height> + </rect> + </property> + </widget> + </widget> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>lblCountry</cstring> + </property> + <property name="text"> + <string>Country:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lblStreet</cstring> + </property> + <property name="text"> + <string>Street:</string> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>lblEmail</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Email:</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>leHomePOBox</cstring> + </property> + </widget> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>leHomePostalCode</cstring> + </property> + </widget> + <spacer row="7" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>spacer13</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + <widget class="QLineEdit" row="5" column="1"> + <property name="name"> + <cstring>leHomeCountry</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>leHomeCity</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>leHomeStreet</cstring> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Work Address</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout37</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="8" column="1"> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>leWorkPOBox</cstring> + </property> + </widget> + <widget class="QLineEdit" row="5" column="1"> + <property name="name"> + <cstring>leWorkCountry</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>lblCity_2</cstring> + </property> + <property name="text"> + <string>City:</string> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>leWorkExtAddr</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>lblPOBox_2</cstring> + </property> + <property name="text"> + <string>PO box:</string> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>leWorkCity</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>leWorkStreet</cstring> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>lblEmail_2</cstring> + </property> + <property name="text"> + <string>Email:</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>lblCountry_2</cstring> + </property> + <property name="text"> + <string>Country:</string> + </property> + </widget> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>leWorkPostalCode</cstring> + </property> + </widget> + <spacer row="7" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>spacer25</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>lblState_2</cstring> + </property> + <property name="text"> + <string>Postal code:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lblStreet_2</cstring> + </property> + <property name="text"> + <string>Street:</string> + </property> + </widget> + <widget class="QWidgetStack" row="6" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>wsWorkEmail</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <widget class="KURLLabel"> + <property name="name"> + <cstring>urlWorkEmail</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>5</y> + <width>437</width> + <height>18</height> + </rect> + </property> + </widget> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <widget class="QLineEdit"> + <property name="name"> + <cstring>leWorkEmail</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>450</width> + <height>25</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Wor&k Information</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout57</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>leDepartment</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>leCompany</cstring> + </property> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>spacer26</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>lblPosition</cstring> + </property> + <property name="text"> + <string>Position:</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>lePosition</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>leRole</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>lblRole</cstring> + </property> + <property name="text"> + <string>Role:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lblDepartment</cstring> + </property> + <property name="text"> + <string>Department:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lblCompany</cstring> + </property> + <property name="text"> + <string>Company:</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Phone &Numbers</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout59</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="4" column="1"> + <property name="name"> + <cstring>spacer27</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>lePhoneFax</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>lePhoneCell</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>lblPhoneFax</cstring> + </property> + <property name="text"> + <string>Fax:</string> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>lePhoneHome</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>lblPhoneCell</cstring> + </property> + <property name="text"> + <string>Cell:</string> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>lePhoneWork</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lblPhoneWork</cstring> + </property> + <property name="text"> + <string>Work:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lblPhoneHome</cstring> + </property> + <property name="text"> + <string>Home:</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>A&bout</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTextEdit" row="0" column="0"> + <property name="name"> + <cstring>teAbout</cstring> + </property> + </widget> + </grid> + </widget> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lblStatus</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>tabWidget3</tabstop> + <tabstop>leNick</tabstop> + <tabstop>leName</tabstop> + <tabstop>leJID</tabstop> + <tabstop>leBirthday</tabstop> + <tabstop>leTimezone</tabstop> + <tabstop>leHomepage</tabstop> + <tabstop>leHomeStreet</tabstop> + <tabstop>leHomeExtAddr</tabstop> + <tabstop>leHomePOBox</tabstop> + <tabstop>leHomeCity</tabstop> + <tabstop>leHomePostalCode</tabstop> + <tabstop>leHomeCountry</tabstop> + <tabstop>leHomeEmail</tabstop> + <tabstop>leWorkStreet</tabstop> + <tabstop>leWorkExtAddr</tabstop> + <tabstop>leWorkPOBox</tabstop> + <tabstop>leWorkCity</tabstop> + <tabstop>leWorkPostalCode</tabstop> + <tabstop>leWorkCountry</tabstop> + <tabstop>leWorkEmail</tabstop> + <tabstop>leCompany</tabstop> + <tabstop>leDepartment</tabstop> + <tabstop>lePosition</tabstop> + <tabstop>leRole</tabstop> + <tabstop>lePhoneHome</tabstop> + <tabstop>lePhoneWork</tabstop> + <tabstop>lePhoneFax</tabstop> + <tabstop>lePhoneCell</tabstop> + <tabstop>teAbout</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kurllabel.h</includehint> + <includehint>kurllabel.h</includehint> + <includehint>kurllabel.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/jabber/ui/empty.cpp b/kopete/protocols/jabber/ui/empty.cpp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/kopete/protocols/jabber/ui/empty.cpp diff --git a/kopete/protocols/jabber/ui/jabberaddcontactpage.cpp b/kopete/protocols/jabber/ui/jabberaddcontactpage.cpp new file mode 100644 index 00000000..950d5680 --- /dev/null +++ b/kopete/protocols/jabber/ui/jabberaddcontactpage.cpp @@ -0,0 +1,224 @@ + +/*************************************************************************** + jabberaddcontactpage.cpp - Add contact widget + ------------------- + begin : Thu Aug 08 2002 + copyright : (C) 2003 by Till Gerken <till@tantalo.net> + (C) 2003 by Daniel Stone <dstone@kde.org> + (C) 2006 by Olivier Goffart <ogoffart at kde.org> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "jabberaddcontactpage.h" + +#include <qlayout.h> +#include <klineedit.h> +#include <klocale.h> +#include <kopeteaccount.h> +#include <qlabel.h> +#include <kopetegroup.h> +#include <kopetemetacontact.h> + +#include "dlgaddcontact.h" +#include "jabberaccount.h" +#include "jabbertransport.h" +#include "kopetecontact.h" +#include "jabberclient.h" +#include "xmpp_tasks.h" + +JabberAddContactPage::JabberAddContactPage (Kopete::Account * owner, QWidget * parent, const char *name):AddContactPage (parent, name) +{ + (new QVBoxLayout (this))->setAutoAdd (true); + + JabberTransport *transport=dynamic_cast<JabberTransport*>(owner); + JabberAccount *jaccount= transport ? transport->account() : dynamic_cast<JabberAccount*>(owner); + + if (jaccount->isConnected ()) + { + jabData = new dlgAddContact (this); + jabData->show (); + + if(transport) + { + jabData->textLabel1->setText( i18n("Loading instruction from gateway...") ); + XMPP::JT_Gateway * gatewayTask = new XMPP::JT_Gateway ( jaccount->client()->rootTask () ); + QObject::connect (gatewayTask, SIGNAL (finished ()), this, SLOT (slotPromtReceived())); + gatewayTask->get ( transport->myself()->contactId() ); + gatewayTask->go ( true ); + } + canadd = true; + } + else + { + noaddMsg1 = new QLabel (i18n ("You need to be connected to be able to add contacts."), this); + noaddMsg2 = new QLabel (i18n ("Connect to the Jabber network and try again."), this); + canadd = false; + } + +} + +JabberAddContactPage::~JabberAddContactPage () +{ +} + +bool JabberAddContactPage::validateData () +{ + return true; +} + + +bool JabberAddContactPage::apply ( Kopete::Account *account, Kopete::MetaContact *parentContact ) +{ + + if( canadd && validateData () ) + { + JabberTransport *transport=dynamic_cast<JabberTransport*>(account); + JabberAccount *jaccount=transport?transport->account():dynamic_cast<JabberAccount*>(account); + + QString contactId = jabData->addID->text (); + + if(transport) + { + XMPP::JT_Gateway * gatewayTask = new XMPP::JT_Gateway ( jaccount->client()->rootTask () ); + JabberAddContactPage_there_is_no_possibility_to_add_assync_WORKAROUND *workaround = + new JabberAddContactPage_there_is_no_possibility_to_add_assync_WORKAROUND( transport , parentContact , gatewayTask ); + QObject::connect (gatewayTask, SIGNAL (finished ()), workaround, SLOT (slotJidReceived())); + gatewayTask->set ( transport->myself()->contactId() , contactId ); + gatewayTask->go ( true ); + return true; + } + + QString displayName = parentContact->displayName (); + /* + if ( displayName.isEmpty () ) + displayName = contactId; + */ + // collect all group names + QStringList groupNames; + Kopete::GroupList groupList = parentContact->groups(); + for(Kopete::Group *group = groupList.first(); group; group = groupList.next()) + groupNames += group->displayName(); + + if ( jaccount->addContact ( contactId, parentContact, Kopete::Account::ChangeKABC ) ) + { + XMPP::RosterItem item; + XMPP::Jid jid ( contactId ); + + item.setJid ( jid ); + item.setName ( displayName ); + item.setGroups ( groupNames ); + + // add the new contact to our roster. + XMPP::JT_Roster * rosterTask = new XMPP::JT_Roster ( jaccount->client()->rootTask () ); + + rosterTask->set ( item.jid(), item.name(), item.groups() ); + rosterTask->go ( true ); + + // send a subscription request. + XMPP::JT_Presence *presenceTask = new XMPP::JT_Presence ( jaccount->client()->rootTask () ); + + presenceTask->sub ( jid, "subscribe" ); + presenceTask->go ( true ); + + return true; + } + } + + return false; +} + +void JabberAddContactPage::slotPromtReceived( ) +{ + XMPP::JT_Gateway * task = (XMPP::JT_Gateway *) sender (); + + if (task->success ()) + { + jabData->lblID->setText( task->prompt() ); + jabData->textLabel1->setText( task->desc() ); + } + else + { + jabData->textLabel1->setText( i18n("An error occured while loading instructions from gateway.") ); + } +} + +JabberAddContactPage_there_is_no_possibility_to_add_assync_WORKAROUND::JabberAddContactPage_there_is_no_possibility_to_add_assync_WORKAROUND( JabberTransport *t, Kopete::MetaContact * mc, QObject* task ) + : QObject(task) , metacontact(mc) , transport(t) +{} + +void JabberAddContactPage_there_is_no_possibility_to_add_assync_WORKAROUND::slotJidReceived( ) +{ + XMPP::JT_Gateway * task = (XMPP::JT_Gateway *) sender (); + + if (!task->success ()) + { + return; + // maybe we should show an error message, but i don't like showing error message - Olivier + } + + QString contactId=task->prompt(); + + Kopete::MetaContact* parentContact=metacontact; + JabberAccount *jaccount=transport->account();; + + /*\ + * this is a copy of the end of JabberAddContactPage::apply + \*/ + + QString displayName = parentContact->displayName (); + /* + if ( displayName.isEmpty () ) + displayName = contactId; + */ + // collect all group names + QStringList groupNames; + Kopete::GroupList groupList = parentContact->groups(); + for(Kopete::Group *group = groupList.first(); group; group = groupList.next()) + groupNames += group->displayName(); + + if ( jaccount->addContact ( contactId, parentContact, Kopete::Account::ChangeKABC ) ) + { + XMPP::RosterItem item; + XMPP::Jid jid ( contactId ); + + item.setJid ( jid ); + item.setName ( displayName ); + item.setGroups ( groupNames ); + + // add the new contact to our roster. + XMPP::JT_Roster * rosterTask = new XMPP::JT_Roster ( jaccount->client()->rootTask () ); + + rosterTask->set ( item.jid(), item.name(), item.groups() ); + rosterTask->go ( true ); + + // send a subscription request. + XMPP::JT_Presence *presenceTask = new XMPP::JT_Presence ( jaccount->client()->rootTask () ); + + presenceTask->sub ( jid, "subscribe" ); + presenceTask->go ( true ); + + return; + } +} + + + +#include "jabberaddcontactpage.moc" + +/* + * Local variables: + * c-indentation-style: k&r + * c-basic-offset: 8 + * indent-tabs-mode: t + * End: + */ +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/protocols/jabber/ui/jabberaddcontactpage.h b/kopete/protocols/jabber/ui/jabberaddcontactpage.h new file mode 100644 index 00000000..8081d0ad --- /dev/null +++ b/kopete/protocols/jabber/ui/jabberaddcontactpage.h @@ -0,0 +1,76 @@ + +/*************************************************************************** + jabberaddcontactpage.h - Add contact widget + ------------------- + begin : Thu Aug 08 2002 + copyright : (C) 2003 by Till Gerken <till@tantalo.net> + (C) 2003 by Daniel Stone <dstone@kde.org> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef JABBERADDCONTACTPAGE_H +#define JABBERADDCONTACTPAGE_H + +#include <addcontactpage.h> + +/** + *@author Daniel Stone + */ +class dlgAddContact; +class JabberAccount; +class QLabel; + +class JabberAddContactPage:public AddContactPage +{ + Q_OBJECT + +public: + JabberAddContactPage (Kopete::Account * owner, QWidget * parent = 0, const char *name = 0); + ~JabberAddContactPage (); + virtual bool validateData (); + virtual bool apply (Kopete::Account *, Kopete::MetaContact *); + dlgAddContact *jabData; + QLabel *noaddMsg1; + QLabel *noaddMsg2; + bool canadd; +public slots: + void slotPromtReceived(); +}; + +class JabberTransport; + +/** + * @author Olivier Goffart + * this class is just there to workaround the fact that it's not possible to add contact assync with Kopete::AddContactPage::apply + */ +class JabberAddContactPage_there_is_no_possibility_to_add_assync_WORKAROUND : public QObject +{ Q_OBJECT + public: + JabberAddContactPage_there_is_no_possibility_to_add_assync_WORKAROUND( JabberTransport * , Kopete::MetaContact *mc, QObject *parent); + Kopete::MetaContact *metacontact; + JabberTransport *transport; + public slots: + void slotJidReceived(); +}; + + +#endif + + +/* + * Local variables: + * c-indentation-style: k&r + * c-basic-offset: 8 + * indent-tabs-mode: t + * End: + */ +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/protocols/jabber/ui/jabberchooseserver.cpp b/kopete/protocols/jabber/ui/jabberchooseserver.cpp new file mode 100644 index 00000000..66598432 --- /dev/null +++ b/kopete/protocols/jabber/ui/jabberchooseserver.cpp @@ -0,0 +1,149 @@ + +/*************************************************************************** + jabberchooseserver.cpp - Server list for Jabber + ------------------- + begin : Mon Jul 12 2004 + copyright : (C) 2004 by Till Gerken <till@tantalo.net> + + Kopete (C) 2001-2004 Kopete developers <kopete-devel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "jabberchooseserver.h" + +#include <kdebug.h> +#include <klocale.h> +#include <kio/global.h> +#include <kio/job.h> +#include <kio/jobclasses.h> +#include <qtable.h> +#include <qlabel.h> +#include "jabberprotocol.h" +#include "dlgjabberchooseserver.h" +#include "jabberregisteraccount.h" + +JabberChooseServer::JabberChooseServer ( JabberRegisterAccount *parent, const char *name ) + : KDialogBase ( parent, name, true, i18n("Choose Jabber Server"), + KDialogBase::Ok | KDialogBase::Cancel ) +{ + + mParentWidget = parent; + mSelectedRow = -1; + + mMainWidget = new DlgJabberChooseServer ( this ); + setMainWidget ( mMainWidget ); + + mMainWidget->lblStatus->setText ( i18n ( "Retrieving server list...") ); + + mMainWidget->listServers->setLeftMargin ( 0 ); + + // retrieve server list + mTransferJob = KIO::get ( "http://www.jabber.org/servers.xml" ); + + connect ( mTransferJob, SIGNAL ( result ( KIO::Job* ) ), this, SLOT ( slotTransferResult ( KIO::Job* ) ) ); + connect ( mTransferJob, SIGNAL ( data ( KIO::Job*, const QByteArray& ) ), this, SLOT ( slotTransferData ( KIO::Job*, const QByteArray& ) ) ); + + connect ( mMainWidget->listServers, SIGNAL ( pressed ( int, int, int, const QPoint & ) ), this, SLOT ( slotSetSelection ( int ) ) ); + connect ( mMainWidget->listServers, SIGNAL ( doubleClicked ( int, int, int, const QPoint & ) ), this, SLOT ( slotOk () ) ); + + enableButtonOK ( false ); + +} + +JabberChooseServer::~JabberChooseServer() +{ +} + +void JabberChooseServer::slotOk () +{ + + if ( mSelectedRow != -1 ) + { + mParentWidget->setServer ( mMainWidget->listServers->text ( mSelectedRow, 0 ) ); + } + + deleteLater (); + +} + +void JabberChooseServer::slotCancel () +{ + + deleteLater (); + +} + +void JabberChooseServer::slotSetSelection ( int row ) +{ + + mSelectedRow = row; + mMainWidget->listServers->selectRow ( row ); + enableButtonOK ( true ); + +} + +void JabberChooseServer::slotTransferData ( KIO::Job */*job*/, const QByteArray &data ) +{ + + unsigned oldSize = xmlServerList.size (); + + xmlServerList.resize ( oldSize + data.size () ); + + memcpy ( &xmlServerList.data()[oldSize], data.data (), data.size () ); + + kdDebug ( JABBER_DEBUG_GLOBAL ) << k_funcinfo << "Server list now " << xmlServerList.size () << endl; + +} + +void JabberChooseServer::slotTransferResult ( KIO::Job *job ) +{ + + if ( job->error () || mTransferJob->isErrorPage () ) + { + mMainWidget->lblStatus->setText ( i18n ( "Could not retrieve server list." ) ); + return; + } + else + { + kdDebug ( JABBER_DEBUG_GLOBAL ) << k_funcinfo << "Received server list ok!" << endl; + + // clear status message + mMainWidget->lblStatus->setText ( "" ); + + // parse XML list + QDomDocument doc; + + if ( !doc.setContent ( xmlServerList ) ) + { + mMainWidget->lblStatus->setText ( i18n ( "Could not parse the server list.") ); + return; + } + + QDomElement docElement = doc.documentElement (); + + mMainWidget->listServers->setNumRows ( docElement.childNodes().count () ); + + int listIndex = 0; + for( QDomNode node = docElement.firstChild (); !node.isNull (); node = node.nextSibling (), listIndex++ ) + { + QDomNamedNodeMap attributes = node.attributes (); + mMainWidget->listServers->setText ( listIndex, 0, attributes.namedItem ( "jid" ).nodeValue () ); + mMainWidget->listServers->setText ( listIndex, 1, attributes.namedItem ( "name" ).nodeValue () ); + } + + mMainWidget->listServers->adjustColumn ( 0 ); + mMainWidget->listServers->adjustColumn ( 1 ); + } + +} + + +#include "jabberchooseserver.moc" diff --git a/kopete/protocols/jabber/ui/jabberchooseserver.h b/kopete/protocols/jabber/ui/jabberchooseserver.h new file mode 100644 index 00000000..0cc8045d --- /dev/null +++ b/kopete/protocols/jabber/ui/jabberchooseserver.h @@ -0,0 +1,65 @@ + +/*************************************************************************** + jabberchooseserver.h - Server list for Jabber + ------------------- + begin : Mon Jul 12 2004 + copyright : (C) 2004 by Till Gerken <till@tantalo.net> + + Kopete (C) 2001-2004 Kopete developers <kopete-devel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef JABBERCHOOSESERVER_H +#define JABBERCHOOSESERVER_H + +#include <kdialogbase.h> +#include <qcstring.h> + +class JabberRegisterAccount; +class DlgJabberChooseServer; + +namespace KIO +{ + class Job; + class TransferJob; +} + +/** +@author Kopete Developers +*/ +class JabberChooseServer : public KDialogBase +{ + +Q_OBJECT + +public: + JabberChooseServer ( JabberRegisterAccount *parent = 0, const char *name = 0); + + ~JabberChooseServer(); + +private slots: + void slotOk (); + void slotCancel (); + void slotTransferData ( KIO::Job *job, const QByteArray &data ); + void slotTransferResult ( KIO::Job *job ); + void slotSetSelection ( int row ); + +private: + DlgJabberChooseServer *mMainWidget; + JabberRegisterAccount *mParentWidget; + KIO::TransferJob *mTransferJob; + QByteArray xmlServerList; + + int mSelectedRow; + +}; + +#endif diff --git a/kopete/protocols/jabber/ui/jabbereditaccountwidget.cpp b/kopete/protocols/jabber/ui/jabbereditaccountwidget.cpp new file mode 100644 index 00000000..b0284e41 --- /dev/null +++ b/kopete/protocols/jabber/ui/jabbereditaccountwidget.cpp @@ -0,0 +1,286 @@ + +/*************************************************************************** + jabberaccountwidget.cpp - Account widget for Jabber + ------------------- + begin : Mon Dec 9 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + Based on code by Olivier Goffart <ogoffart @ kde.org> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kdebug.h> +#include <qlineedit.h> +#include <qcheckbox.h> +#include <qpushbutton.h> +#include <qspinbox.h> +#include <qcombobox.h> +#include <qlabel.h> + +#include <kconfig.h> +#include <kmessagebox.h> +#include <klocale.h> +#include <kpassdlg.h> +#include <kopetepassword.h> +#include <kopetepasswordedaccount.h> + +#include "kopeteuiglobal.h" +#include "kopetepasswordwidget.h" + +#include "jabberclient.h" +#include "jabbereditaccountwidget.h" +#include "jabberregisteraccount.h" +#include "dlgjabberchangepassword.h" + +JabberEditAccountWidget::JabberEditAccountWidget (JabberProtocol * proto, JabberAccount * ident, QWidget * parent, const char *name) + : DlgJabberEditAccountWidget (parent, name), KopeteEditAccountWidget (ident) +{ + + m_protocol = proto; + + connect (mID, SIGNAL (textChanged (const QString &)), this, SLOT (updateServerField ())); + connect (cbCustomServer, SIGNAL (toggled (bool)), this, SLOT (updateServerField ())); + + connect (cbUseSSL, SIGNAL (toggled (bool)), this, SLOT (sslToggled (bool))); + + connect (btnChangePassword, SIGNAL ( clicked() ), this, SLOT ( slotChangePasswordClicked () )); + + if (account()) + { + // we are working with an existing account + reopen (); + btnRegister->setEnabled ( false ); + } + else + { + // this is a new account + btnChangePassword->setEnabled ( false ); + connect (btnRegister, SIGNAL (clicked ()), this, SLOT (registerClicked ())); + } +} + +JabberEditAccountWidget::~JabberEditAccountWidget () +{ +} + +JabberAccount *JabberEditAccountWidget::account () +{ + + return dynamic_cast<JabberAccount *>(KopeteEditAccountWidget::account () ); + +} + +void JabberEditAccountWidget::reopen () +{ + + // FIXME: this is temporary until Kopete supports accound ID changes! + mID->setDisabled(true); + + mID->setText (account()->accountId ()); + mPass->load (&account()->password ()); + cbAutoConnect->setChecked (account()->excludeConnect()); + + mResource->setText (account()->configGroup()->readEntry ("Resource", QString::fromLatin1("Kopete"))); + mPriority->setValue (account()->configGroup()->readNumEntry ("Priority", 5)); + mServer->setText (account()->configGroup()->readEntry ("Server", QString::null)); + + cbUseSSL->setChecked (account()->configGroup()->readBoolEntry( "UseSSL", false)); + + mPort->setValue (account()->configGroup()->readNumEntry("Port", 5222)); + + QString auth = account()->configGroup()->readEntry("AuthType", QString::null); + + cbCustomServer->setChecked (account()->configGroup()->readBoolEntry("CustomServer",false)); + + if(cbCustomServer->isChecked ()) + { + labelServer->setEnabled(true); + mServer->setEnabled(true); + labelPort->setEnabled(true); + mPort->setEnabled(true); + } + else + { + mServer->setEnabled (false); + mServer->setText(mID->text().section("@", 1)); + } + + cbAllowPlainTextPassword->setChecked (account()->configGroup()->readBoolEntry("AllowPlainTextPassword", true)); + + KGlobal::config()->setGroup("Jabber"); + leLocalIP->setText (KGlobal::config()->readEntry("LocalIP", "")); + sbLocalPort->setValue (KGlobal::config()->readNumEntry("LocalPort", 8010)); + + leProxyJID->setText (account()->configGroup()->readEntry("ProxyJID", QString::null)); + + // Privacy + cbSendEvents->setChecked( account()->configGroup()->readBoolEntry("SendEvents", true) ); + cbSendDeliveredEvent->setChecked( account()->configGroup()->readBoolEntry("SendDeliveredEvent", true) ); + cbSendDisplayedEvent->setChecked( account()->configGroup()->readBoolEntry("SendDisplayedEvent", true) ); + cbSendComposingEvent->setChecked( account()->configGroup()->readBoolEntry("SendComposingEvent", true) ); + cbSendGoneEvent->setChecked( account()->configGroup()->readBoolEntry("SendGoneEvent", true) ); + + cbHideSystemInfo->setChecked( account()->configGroup()->readBoolEntry("HideSystemInfo", false) ); + + // Global Identity + cbGlobalIdentity->setChecked( account()->configGroup()->readBoolEntry("ExcludeGlobalIdentity", false) ); +} + +Kopete::Account *JabberEditAccountWidget::apply () +{ + kdDebug ( JABBER_DEBUG_GLOBAL ) << "JabberEditAccount::apply()" << endl; + + if (!account()) + { + setAccount(new JabberAccount (m_protocol, mID->text ())); + } + + if(account()->isConnected()) + { + KMessageBox::queuedMessageBox(this, KMessageBox::Information, + i18n("The changes you just made will take effect next time you log in with Jabber."), + i18n("Jabber Changes During Online Jabber Session")); + } + + this->writeConfig (); + + static_cast<JabberAccount*>(account())->setS5BServerPort ( sbLocalPort->value () ); + + return account(); +} + + +void JabberEditAccountWidget::writeConfig () +{ + account()->configGroup()->writeEntry("UseSSL", cbUseSSL->isChecked()); + + mPass->save(&account()->password ()); + + account()->configGroup()->writeEntry("CustomServer", cbCustomServer->isChecked()); + + // FIXME: The call below represents a flaw in the current Kopete API. + // Once the API is cleaned up, this will most likely require a change. + //account()->setAccountId(mID->text()); + + account()->configGroup()->writeEntry("AllowPlainTextPassword", cbAllowPlainTextPassword->isChecked()); + account()->configGroup()->writeEntry("Server", mServer->text ()); + account()->configGroup()->writeEntry("Resource", mResource->text ()); + account()->configGroup()->writeEntry("Priority", QString::number (mPriority->value ())); + account()->configGroup()->writeEntry("Port", QString::number (mPort->value ())); + + account()->setExcludeConnect(cbAutoConnect->isChecked()); + + KGlobal::config()->setGroup("Jabber"); + KGlobal::config()->writeEntry("LocalIP", leLocalIP->text()); + KGlobal::config()->writeEntry("LocalPort", sbLocalPort->value()); + + account()->configGroup()->writeEntry("ProxyJID", leProxyJID->text()); + + // Privacy + account()->configGroup()->writeEntry("SendEvents", cbSendEvents->isChecked()); + account()->configGroup()->writeEntry("SendDeliveredEvent", cbSendDeliveredEvent->isChecked()); + account()->configGroup()->writeEntry("SendDisplayedEvent", cbSendDisplayedEvent->isChecked()); + account()->configGroup()->writeEntry("SendComposingEvent", cbSendComposingEvent->isChecked()); + account()->configGroup()->writeEntry("SendGoneEvent", cbSendGoneEvent->isChecked()); + + account()->configGroup()->writeEntry("HideSystemInfo", cbHideSystemInfo->isChecked()); + + // Global Identity + account()->configGroup()->writeEntry("ExcludeGlobalIdentity", cbGlobalIdentity->isChecked()); +} + +bool JabberEditAccountWidget::validateData () +{ + + if(!mID->text().contains('@')) + { + KMessageBox::sorry(this, i18n("The Jabber ID you have chosen is invalid. " + "Please make sure it is in the form user@server.com, like an email address."), + i18n("Invalid Jabber ID")); + + return false; + } + + return true; +} + +void JabberEditAccountWidget::updateServerField () +{ + + if(!cbCustomServer->isChecked()) + { + QString newServer = mID->text().section("@", 1); + mPort->setValue(5222); + // check if ssl is enabled and set the port correctly + sslToggled(cbUseSSL->isChecked()); + mServer->setText(newServer); + labelServer->setEnabled(false); + mServer->setEnabled(false); + labelPort->setEnabled(false); + mPort->setEnabled(false); + } + else + { + labelServer->setEnabled(true); + mServer->setEnabled(true); + labelPort->setEnabled(true); + mPort->setEnabled(true); + } + +} + +void JabberEditAccountWidget::deleteClicked () +{ + + // delete account here + +} + +void JabberEditAccountWidget::registerClicked () +{ + + JabberRegisterAccount *registerDlg = new JabberRegisterAccount ( this ); + + registerDlg->show (); + +} + +void JabberEditAccountWidget::slotChangePasswordClicked () +{ + + DlgJabberChangePassword *passwordDlg = new DlgJabberChangePassword ( account (), this ); + + connect ( passwordDlg, SIGNAL ( destroyed () ), this, SLOT ( slotChangePasswordFinished () ) ); + + passwordDlg->show (); + +} + +void JabberEditAccountWidget::slotChangePasswordFinished () +{ + + // in case the password has been changed, we need to update it in the UI + reopen (); + +} + +void JabberEditAccountWidget::sslToggled (bool value) +{ + if (value && (mPort->value() == 5222)) + mPort->stepUp (); + else + if(!value && (mPort->value() == 5223)) + mPort->stepDown (); +} + +#include "jabbereditaccountwidget.moc" + +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/protocols/jabber/ui/jabbereditaccountwidget.h b/kopete/protocols/jabber/ui/jabbereditaccountwidget.h new file mode 100644 index 00000000..1f3ba378 --- /dev/null +++ b/kopete/protocols/jabber/ui/jabbereditaccountwidget.h @@ -0,0 +1,62 @@ + +/*************************************************************************** + jabberaccountwidget.h - Account widget for Jabber + ------------------- + begin : Mon Dec 9 2002 + copyright : (C) 2002-2003 by Till Gerken <till@tantalo.net> + Based on code by Olivier Goffart <ogoffart @ kde.org> + email : kopete-devel@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef JABBEREDITACCOUNTWIDEGET_H +#define JABBEREDITACCOUNTWIDEGET_H + +#include <qwidget.h> +#include <kprogress.h> +#include "editaccountwidget.h" +#include "jabberaccount.h" +#include "dlgjabbereditaccountwidget.h" +#include "jabberprotocol.h" + +/** + *@author Till Gerken <till@tantalo.net> + */ + +class JabberEditAccountWidget:public DlgJabberEditAccountWidget, public KopeteEditAccountWidget +{ + +Q_OBJECT + +public: + JabberEditAccountWidget (JabberProtocol * proto, JabberAccount *, QWidget * parent = 0, const char *name = 0); + ~JabberEditAccountWidget (); + virtual bool validateData (); + virtual Kopete::Account *apply (); + JabberAccount *account (); + +private slots: + void registerClicked (); + void slotChangePasswordClicked (); + void slotChangePasswordFinished (); + void deleteClicked (); + void sslToggled (bool); + void updateServerField (); + +private: + JabberProtocol *m_protocol; + + void reopen (); + void writeConfig (); + +}; + +#endif diff --git a/kopete/protocols/jabber/ui/jabberregisteraccount.cpp b/kopete/protocols/jabber/ui/jabberregisteraccount.cpp new file mode 100644 index 00000000..f5142736 --- /dev/null +++ b/kopete/protocols/jabber/ui/jabberregisteraccount.cpp @@ -0,0 +1,389 @@ + +/*************************************************************************** + jabberregister.cpp - Register dialog for Jabber + ------------------- + begin : Sun Jul 11 2004 + copyright : (C) 2004 by Till Gerken <till@tantalo.net> + + Kopete (C) 2001-2004 Kopete developers <kopete-devel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "jabberregisteraccount.h" + +#include <kdebug.h> +#include <klocale.h> +#include <kiconloader.h> +#include <kglobal.h> +#include <kmessagebox.h> +#include <klineedit.h> +#include <kpassdlg.h> +#include <knuminput.h> +#include <kpushbutton.h> +#include <qlabel.h> +#include <qcheckbox.h> +#include <qtimer.h> +#include <qregexp.h> + +#include "qca.h" +#include "xmpp.h" +#include "xmpp_tasks.h" + +#include "kopeteuiglobal.h" +#include "kopetepasswordwidget.h" +#include "jabberprotocol.h" +#include "jabberaccount.h" +#include "jabberclient.h" +#include "jabberconnector.h" +#include "jabbereditaccountwidget.h" +#include "jabberchooseserver.h" +#include "dlgjabberregisteraccount.h" + +JabberRegisterAccount::JabberRegisterAccount ( JabberEditAccountWidget *parent, const char *name ) + : KDialogBase ( parent, name, true, i18n("Register New Jabber Account"), + KDialogBase::Ok | KDialogBase::Cancel ) +{ + + mParentWidget = parent; + + // setup main dialog + mMainWidget = new DlgJabberRegisterAccount ( this ); + setMainWidget ( mMainWidget ); + + // replace "Ok" button with a "Register" button + KGuiItem registerButton = KStdGuiItem::ok(); + registerButton.setText ( i18n ( "Register" ) ); + setButtonOK ( registerButton ); + + enableButtonSeparator ( true ); + + // clear variables + jabberClient = new JabberClient (); + + connect ( jabberClient, SIGNAL ( csError ( int ) ), this, SLOT ( slotCSError ( int ) ) ); + connect ( jabberClient, SIGNAL ( tlsWarning ( int ) ), this, SLOT ( slotHandleTLSWarning ( int ) ) ); + connect ( jabberClient, SIGNAL ( connected () ), this, SLOT ( slotConnected () ) ); + + jidRegExp.setPattern ( "[\\w\\d.+_-]{1,}@[\\w\\d.-]{1,}" ); + hintPixmap = KGlobal::iconLoader()->loadIcon ( "jabber_online", KIcon::Small ); + + mSuccess = false; + + // get all settings from the main dialog + mMainWidget->leServer->setText ( parent->mServer->text () ); + mMainWidget->leJID->setText ( parent->mID->text () ); + mMainWidget->lePassword->setText ( parent->mPass->password () ); + // mMainWidget->lePasswordVerify->setText ( parent->mPass->password () ); //BUG 114631 + mMainWidget->sbPort->setValue ( parent->mPort->value () ); + mMainWidget->cbUseSSL->setChecked ( parent->cbUseSSL->isChecked () ); + + // connect buttons to slots, ok is already connected by default + connect ( this, SIGNAL ( cancelClicked () ), this, SLOT ( slotDeleteDialog () ) ); + connect ( mMainWidget->btnChooseServer, SIGNAL ( clicked () ), this, SLOT ( slotChooseServer () ) ); + connect ( mMainWidget->leServer, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( slotJIDInformation () ) ); + connect ( mMainWidget->leJID, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( slotJIDInformation () ) ); + connect ( mMainWidget->cbUseSSL, SIGNAL ( toggled ( bool ) ), this, SLOT ( slotSSLToggled () ) ); + + connect ( mMainWidget->leServer, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( validateData () ) ); + connect ( mMainWidget->leJID, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( validateData () ) ); + connect ( mMainWidget->lePassword, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( validateData () ) ); + connect ( mMainWidget->lePasswordVerify, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( validateData () ) ); + + // display JID info now + slotJIDInformation (); + + // display validation info + validateData (); +} + + +JabberRegisterAccount::~JabberRegisterAccount() +{ + delete jabberClient; +} + +void JabberRegisterAccount::slotDeleteDialog () +{ + + deleteLater (); + +} + +void JabberRegisterAccount::validateData () +{ + + int valid = true; + int passwordHighlight = false; + + if ( mMainWidget->leServer->text().isEmpty () ) + { + mMainWidget->lblStatusMessage->setText ( i18n ( "Please enter a server name, or click Choose." ) ); + mMainWidget->pixServer->setPixmap ( hintPixmap ); + valid = false; + } + else + { + mMainWidget->pixServer->setText ( "" ); + } + + if ( valid && !jidRegExp.exactMatch ( mMainWidget->leJID->text() ) ) + { + mMainWidget->lblStatusMessage->setText ( i18n ( "Please enter a valid Jabber ID." ) ); + mMainWidget->pixJID->setPixmap ( hintPixmap ); + valid = false; + } + else + { + mMainWidget->pixJID->setText ( "" ); + } + + if ( valid && + ( QString::fromLatin1 ( mMainWidget->lePassword->password () ).isEmpty () || + QString::fromLatin1 ( mMainWidget->lePasswordVerify->password () ).isEmpty () ) ) + { + mMainWidget->lblStatusMessage->setText ( i18n ( "Please enter the same password twice." ) ); + valid = false; + passwordHighlight = true; + } + + if ( valid && + ( QString::fromLatin1 ( mMainWidget->lePassword->password () ) != + QString::fromLatin1 ( mMainWidget->lePasswordVerify->password () ) ) ) + { + mMainWidget->lblStatusMessage->setText ( i18n ( "Password entries do not match." ) ); + valid = false; + passwordHighlight = true; + } + + if ( passwordHighlight == true ) + { + mMainWidget->pixPassword->setPixmap ( hintPixmap ); + mMainWidget->pixPasswordVerify->setPixmap ( hintPixmap ); + } + else { + mMainWidget->pixPassword->setText ( "" ); + mMainWidget->pixPasswordVerify->setText ( "" ); + } + + if ( valid ) + { + // clear status message if we have valid data + mMainWidget->lblStatusMessage->setText ( "" ); + } + + enableButtonOK ( valid ); + +} + +void JabberRegisterAccount::slotJIDInformation () +{ + + if ( !mMainWidget->leServer->text().isEmpty () && + ( !jidRegExp.exactMatch ( mMainWidget->leJID->text () ) || + ( mMainWidget->leJID->text().section ( "@", 1 ) != mMainWidget->leServer->text () ) ) ) + { + mMainWidget->lblJIDInformation->setText ( i18n ( "Unless you know what you are doing, your JID should be of the form " + "\"username@server.com\". In your case for example \"username@%1\"." ). + arg ( mMainWidget->leServer->text () ) ); + } + else + { + mMainWidget->lblJIDInformation->setText ( "" ); + } + +} + +void JabberRegisterAccount::slotSSLToggled () +{ + + if ( mMainWidget->cbUseSSL->isChecked () ) + { + if ( mMainWidget->sbPort->value () == 5222 ) + { + mMainWidget->sbPort->setValue ( 5223 ); + } + } + else + { + if ( mMainWidget->sbPort->value () == 5223 ) + { + mMainWidget->sbPort->setValue ( 5222 ); + } + } + +} + +void JabberRegisterAccount::slotChooseServer () +{ + + (new JabberChooseServer ( this ))->show (); + +} + +void JabberRegisterAccount::setServer ( const QString &server ) +{ + + mMainWidget->leServer->setText ( server ); + mMainWidget->leJID->setText ( QString ( "@%1" ).arg ( server ) ); + +} + +void JabberRegisterAccount::slotOk () +{ + + mMainWidget->lblStatusMessage->setText ( "" ); + + kdDebug ( JABBER_DEBUG_GLOBAL ) << k_funcinfo << "Registering a new Jabber account." << endl; + + enableButtonOK ( false ); + + mMainWidget->lblStatusMessage->setText ( i18n ( "Connecting to server..." ) ); + + // cancel any previous attempt + jabberClient->disconnect (); + + // FIXME: we need to use the old protocol for now + jabberClient->setUseXMPP09 ( true ); + + jabberClient->setUseSSL ( mMainWidget->cbUseSSL->isChecked () ); + + // FIXME: check this when using the new protocol + jabberClient->setOverrideHost ( true, mMainWidget->leServer->text (), mMainWidget->sbPort->value () ); + + // start connection, no authentication + switch ( jabberClient->connect ( XMPP::Jid ( mMainWidget->leJID->text () ), QString::null, false ) ) + { + case JabberClient::NoTLS: + // no SSL support, at the connecting stage this means the problem is client-side + KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error, + i18n ("SSL support could not be initialized for account %1. This is most likely because the QCA TLS plugin is not installed on your system."). + arg ( mMainWidget->leJID->text () ), + i18n ("Jabber SSL Error")); + break; + + case JabberClient::Ok: + default: + // everything alright! + break; + } + +} + +void JabberRegisterAccount::disconnect () +{ + + if(jabberClient) + jabberClient->disconnect (); + + if ( !mSuccess ) + enableButtonOK ( true ); + +} + +void JabberRegisterAccount::slotHandleTLSWarning ( int validityResult ) +{ + kdDebug ( JABBER_DEBUG_GLOBAL ) << k_funcinfo << "Handling TLS warning..." << endl; + + if ( JabberAccount::handleTLSWarning ( jabberClient, validityResult ) ) + { + // resume stream + jabberClient->continueAfterTLSWarning (); + } + else + { + // disconnect stream + disconnect (); + } + +} + +void JabberRegisterAccount::slotCSError (int error) +{ + kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "Error in stream signalled, disconnecting." << endl; + + Kopete::Account::DisconnectReason errorClass; + + mMainWidget->lblStatusMessage->setText ( i18n ( "Protocol error." ) ); + + // display message to user + JabberAccount::handleStreamError (error, jabberClient->clientStream()->errorCondition (), jabberClient->clientConnector()->errorCode (), mMainWidget->leServer->text (), errorClass); + + disconnect (); + +} + +void JabberRegisterAccount::slotConnected () +{ + kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "Launching registration task..." << endl; + + mMainWidget->lblStatusMessage->setText ( i18n ( "Connected successfully, registering new account..." ) ); + + XMPP::JT_Register * task = new XMPP::JT_Register (jabberClient->rootTask ()); + QObject::connect (task, SIGNAL (finished ()), this, SLOT (slotRegisterUserDone ())); + task->reg (mMainWidget->leJID->text().section("@", 0, 0), mMainWidget->lePassword->password ()); + task->go (true); + +} + +void JabberRegisterAccount::slotRegisterUserDone () +{ + XMPP::JT_Register * task = (XMPP::JT_Register *) sender (); + + if (task->success ()) + { + mMainWidget->lblStatusMessage->setText ( i18n ( "Registration successful." ) ); + + // save settings to parent + mParentWidget->mServer->setText ( mMainWidget->leServer->text () ); + mParentWidget->mID->setText ( mMainWidget->leJID->text () ); + mParentWidget->mPass->setPassword ( mMainWidget->lePassword->password () ); + mParentWidget->mPort->setValue ( mMainWidget->sbPort->value () ); + mParentWidget->cbUseSSL->setChecked ( mMainWidget->cbUseSSL->isChecked () ); + + // disable input widgets + mMainWidget->btnChooseServer->setEnabled ( false ); + mMainWidget->leServer->setEnabled ( false ); + mMainWidget->leJID->setEnabled ( false ); + mMainWidget->lePassword->setEnabled ( false ); + mMainWidget->lePasswordVerify->setEnabled ( false ); + mMainWidget->sbPort->setEnabled ( false ); + mMainWidget->cbUseSSL->setEnabled ( false ); + + // disable input widget labels + mMainWidget->lblServer->setEnabled ( false ); + mMainWidget->lblJID->setEnabled ( false ); + mMainWidget->lblPassword->setEnabled ( false ); + mMainWidget->lblPasswordVerify->setEnabled ( false ); + mMainWidget->lblPort->setEnabled ( false ); + + mSuccess = true; + + // rewire buttons + enableButtonOK ( false ); + setButtonCancel ( KStdGuiItem::close () ); + connect ( this, SIGNAL ( closeClicked () ), this, SLOT ( slotDeleteDialog () ) ); + } + else + { + mMainWidget->lblStatusMessage->setText ( i18n ( "Registration failed." ) ); + KMessageBox::queuedMessageBox (Kopete::UI::Global::mainWidget (), KMessageBox::Information, + i18n ("Unable to create account on the server. The Jabber ID is probably already in use."), + i18n ("Jabber Account Registration")); + + } + + // FIXME: this is required because Iris crashes if we try + // to disconnect here. Hopefully Justin can fix this. + QTimer::singleShot(0, this, SLOT(disconnect ())); + +} + +#include "jabberregisteraccount.moc" diff --git a/kopete/protocols/jabber/ui/jabberregisteraccount.h b/kopete/protocols/jabber/ui/jabberregisteraccount.h new file mode 100644 index 00000000..40d643a7 --- /dev/null +++ b/kopete/protocols/jabber/ui/jabberregisteraccount.h @@ -0,0 +1,75 @@ + +/*************************************************************************** + jabberregister.h - Register dialog for Jabber + ------------------- + begin : Sun Jul 11 2004 + copyright : (C) 2004 by Till Gerken <till@tantalo.net> + + Kopete (C) 2001-2004 Kopete developers <kopete-devel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef JABBERREGISTER_H +#define JABBERREGISTER_H + +#include <kdialogbase.h> +#include <qregexp.h> +#include <qpixmap.h> + +class DlgJabberRegisterAccount; +class JabberProtocol; +class JabberClient; +class JabberEditAccountWidget; + +/** +@author Till Gerken +*/ +class JabberRegisterAccount : public KDialogBase +{ + +Q_OBJECT + +public: + JabberRegisterAccount ( JabberEditAccountWidget *parent = 0, const char *name = 0 ); + + ~JabberRegisterAccount (); + + void setServer ( const QString &server ); + +private slots: + void slotChooseServer (); + void slotJIDInformation (); + void slotSSLToggled (); + void slotOk (); + + void slotHandleTLSWarning ( int validityResult ); + void slotCSError ( int error ); + void slotConnected (); + + void slotRegisterUserDone (); + void slotDeleteDialog (); + void validateData (); + + void disconnect (); + +private: + DlgJabberRegisterAccount *mMainWidget; + JabberEditAccountWidget *mParentWidget; + + QRegExp jidRegExp; + QPixmap hintPixmap; + + JabberClient *jabberClient; + + bool mSuccess; +}; + +#endif |