diff options
Diffstat (limited to 'kopete/protocols/groupwise/ui')
27 files changed, 3921 insertions, 0 deletions
diff --git a/kopete/protocols/groupwise/ui/Makefile.am b/kopete/protocols/groupwise/ui/Makefile.am new file mode 100644 index 00000000..3cd76e27 --- /dev/null +++ b/kopete/protocols/groupwise/ui/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(top_srcdir)/protocols/groupwise/libgroupwise \ + -I$(top_srcdir)/kopete/protocols/groupwise/libgroupwise -I$(top_srcdir)/kopete/protocols/groupwise/libgroupwise/qca/src +METASOURCES = AUTO +noinst_LTLIBRARIES = libkopetegroupwiseui.la +AM_CPPFLAGS = $(KOPETE_INCLUDES) \ + -I$(srcdir)/..\ + -I$(srcdir)/../libgroupwise \ + $(all_includes) + +libkopetegroupwiseui_la_LDFLAGS = $(all_libraries) +libkopetegroupwiseui_la_SOURCES = gwaccountpreferences.ui gwaddcontactpage.cpp \ + gwaddui.ui gweditaccountwidget.cpp gwreceiveinvitationdialog.cpp \ + gwshowinvitation.ui gwcontactpropswidget.ui gwcontactproperties.cpp gwprivacy.ui \ + gwprivacydialog.cpp gwsearch.cpp gwcustomstatuswidget.ui gwcustomstatusedit.ui \ + gwcontactsearch.ui gwchatsearchwidget.ui gwchatsearchdialog.cpp gwchatpropswidget.ui \ + gwchatpropsdialog.cpp + +noinst_HEADERS = gwreceiveinvitationdialog.h gwcontactproperties.h \ + gwprivacydialog.h gwsearch.h gwchatsearchdialog.h gwchatpropsdialog.h diff --git a/kopete/protocols/groupwise/ui/gwaccountpreferences.ui b/kopete/protocols/groupwise/ui/gwaccountpreferences.ui new file mode 100644 index 00000000..b5cfabcc --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwaccountpreferences.ui @@ -0,0 +1,320 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseAccountPreferences</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseAccountPreferences</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>366</width> + <height>404</height> + </rect> + </property> + <property name="caption"> + <string>Account Preferences - Groupwise</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>tabWidget11</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>B&asic Setup</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox55</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>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>&User ID:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_userId</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The account name of your account.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The account name of your account.</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>m_userId</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The account name of your account.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The account name of your account.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="Kopete::UI::PasswordWidget"> + <property name="name"> + <cstring>m_password</cstring> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_autoConnect</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="Line"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </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>true</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>m_server</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 im.yourcorp.com).</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>m_server</cstring> + </property> + <property name="enabled"> + <bool>true</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 im.yourcorp.com).</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>labelPort</cstring> + </property> + <property name="enabled"> + <bool>true</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>m_port</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>m_port</cstring> + </property> + <property name="enabled"> + <bool>true</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>8300</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> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Advanced &Options</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_alwaysAccept</cstring> + </property> + <property name="text"> + <string>A&lways accept invitations</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>91</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>labelStatusMessage</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + </vbox> +</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="866">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032949444154388db59531681b6714c77f32373c8186ef0305eea005093258900eca26d30e3174a8a807d1c9ee940e5d4a276f09a414e22974ee609a4c75a0857a70a20c199ce93424e43414aee0c26910dc8105f7410df706413a7c915551db049a3e38b87bf7bedffddfc7ff7d578be398456c6c6cbce13d441cc7b5da02fcf4e8e99bde7a8f899b501515d959f64e10e71cd949c6e8d508e6cb7cb050fae49727444d87ed08a566dc0cea545a621b96725e62c522f312c4929ff9e7725e6203439282ec0bc72f74150c30c927d89690163f539619a044564973a1980ae54c01c136a1db518a0024808942780dead16a27e7e0ca55949a81668023b242fcd2901c394663072cd408ad75e18b6d43a7076143710aa1b9049ccd326e064a5979e8f0191cfc5878544368af1b24807caa4cfe507ef8aea0bf6dd8b92de7f00bc1562c95e64416e297f216aadcfa3ca43f10da1f8243112286871507fb05c3c7059d568bde96c5885b01af2d6e4a2db10dc8ff128e0fdd39f4cbaf8576dbe170702afcf6b86467bbce57df8680f0d3230767e0e62bdc55c5e53c476742fabbc318437f209886c3cd41d4b0f74049c78ef21476ef5846cf7ded2831848d55f0aa62816caade11adb7ed2fa0f71ce9d8619ac2e627824a45a72b00e413c5a95c0cf63e052bbe2014bfa738c3de3d251dfb0f8a80fda04e6480600113cc558a11a0e10b93a9225886cff04a8d10868662eab87f37271e59f2136f85a855bfda15f9594eb7a3b4ae0b933f95e161c5ceed88f254e97f2ad49b75eedf8562e2d8fb264355314da1dbada866abe47fedb106d01f78b71fec170c8f7276ef58da3de8f64a76bf6f634283730e9d2b9b8390ce0dae565c6a8e04b0710b746678f8a8e0e18382d173a1d7151c909fe4e84ccf57be3e76245b115143584ee73f27afc8e80b4c667e4c37b7054c8be1afde0de978a9c63485fea0457cec70aa089015ab9297e0938c240573cdb7651a4a7f20f43feb304a72aac2e73bd723da1fe5746ec0682bc26070f38c345905d7e238f6077c00dd8f85280211fcd91af84b02ef94a50c004502c1394813252f14575ca09839242f9484cb42df31e763edd237ff31d6c0ffa3fe17f0fb86c7715cfb1ba8bd86cc8d2decd30000000049454e44ae426082</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwaddcontactpage.cpp b/kopete/protocols/groupwise/ui/gwaddcontactpage.cpp new file mode 100644 index 00000000..93616f95 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwaddcontactpage.cpp @@ -0,0 +1,108 @@ +/* + Kopete GroupWise Protocol + gweditaccountwidget.cpp - widget for adding GroupWise contacts + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Testbed + Copyright (c) 2003 by Will Stephenson <will@stevello.free-online.co.uk> + + Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 "gwaddcontactpage.h" + +//#include <qcombobox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qlistview.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qtabwidget.h> +#include <qvaluelist.h> + +#include <kdebug.h> +#include <klocale.h> + +#include "kopeteaccount.h" +#include "kopetemetacontact.h" + +#include "client.h" +#include "gwaccount.h" +#include "gwerror.h" +//#include "gwprotocol.h" +#include "gwsearch.h" +#include "gwaddui.h" +#include "userdetailsmanager.h" + +GroupWiseAddContactPage::GroupWiseAddContactPage( Kopete::Account * owner, QWidget* parent, const char* name ) + : AddContactPage(parent, name) +{ + m_account = static_cast<GroupWiseAccount *>( owner ); + kdDebug(GROUPWISE_DEBUG_GLOBAL) << k_funcinfo << endl; + ( new QVBoxLayout( this ) )->setAutoAdd( true ); + if (owner->isConnected ()) + { + m_searchUI = new GroupWiseContactSearch( m_account, QListView::Single, false, + this, "acwsearchwidget" ); + show(); + m_canadd = true; + } + else + { + m_noaddMsg1 = new QLabel (i18n ("You need to be connected to be able to add contacts."), this); + m_noaddMsg2 = new QLabel (i18n ("Connect to GroupWise Messenger and try again."), this); + m_canadd = false; + } +} + +GroupWiseAddContactPage::~GroupWiseAddContactPage() +{ +// , i18n( "The search was cancelled" ) +// , i18n( "There was an error while carrying out your search. Please change your search terms or try again later." ) +// i18n( "There was an error while carrying out your search. Please change your search terms or try again later." ) +} + +bool GroupWiseAddContactPage::apply( Kopete::Account* account, Kopete::MetaContact* parentContact ) +{ + if ( validateData() ) + { + QString contactId; + QString displayName; + + QValueList< ContactDetails > selected = m_searchUI->selectedResults(); + if ( selected.count() == 1 ) + { + ContactDetails dt = selected.first(); + m_account->client()->userDetailsManager()->addDetails( dt ); + contactId = dt.dn; + displayName = dt.givenName + " " + dt.surname; + } + else + return false; + + return ( account->addContact ( contactId, parentContact, Kopete::Account::ChangeKABC ) ); + } + else + return false; +} + +bool GroupWiseAddContactPage::validateData() +{ + if ( m_canadd ) + return ( m_searchUI->m_results->selectedItem() ); + else + return false; +} + +#include "gwaddcontactpage.moc" diff --git a/kopete/protocols/groupwise/ui/gwaddcontactpage.h b/kopete/protocols/groupwise/ui/gwaddcontactpage.h new file mode 100644 index 00000000..aa195edd --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwaddcontactpage.h @@ -0,0 +1,68 @@ +/* + Kopete GroupWise Protocol + gweditaccountwidget.h- widget for adding GroupWise contacts + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Testbed + Copyright (c) 2003 by Will Stephenson <will@stevello.free-online.co.uk> + + Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 TESTBEDADDCONTACTPAGE_H +#define TESTBEDADDCONTACTPAGE_H + +#include "gwerror.h" + +#include <addcontactpage.h> + +class QLabel; +namespace Kopete { class Account; } +namespace Kopete { class MetaContact; } +class GroupWiseAccount; +class GroupWiseAddUI; +//TODO: change this to a wrapper around Contact Search and Chatroom Search +class GroupWiseContactSearch; + +/** + * A page in the Add Contact Wizard + * @author Will Stephenson +*/ +class GroupWiseAddContactPage : public AddContactPage +{ + Q_OBJECT +public: + GroupWiseAddContactPage( Kopete::Account * owner, QWidget* parent = 0, const char* name = 0 ); + ~GroupWiseAddContactPage(); + + /** + * Make a contact out of the entered data + */ + virtual bool apply(Kopete::Account* a, Kopete::MetaContact* m); + /** + * Is the data correct? + */ + virtual bool validateData(); +protected: + QValueList< GroupWise::ContactDetails > m_searchResults; + unsigned char searchOperation( int comboIndex ); + GroupWiseAccount * m_account; + GroupWiseAddUI * m_gwAddUI; + //TODO: make wrapper + GroupWiseContactSearch * m_searchUI; + QLabel *m_noaddMsg1; + QLabel *m_noaddMsg2; + bool m_canadd; +}; + +#endif diff --git a/kopete/protocols/groupwise/ui/gwaddui.ui b/kopete/protocols/groupwise/ui/gwaddui.ui new file mode 100644 index 00000000..16859bef --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwaddui.ui @@ -0,0 +1,137 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseAddUI</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseAddUI</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>392</width> + <height>343</height> + </rect> + </property> + <property name="caption"> + <string>TestbedAddUI</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>m_tabWidget</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Basic</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>bg_addMethod</cstring> + </property> + <property name="title"> + <string>Add Using</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>m_userName</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>A full or partial name. Asterisks are ignored</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Type some or all of the contact's name. Matches will be shown below</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>rb_userId</cstring> + </property> + <property name="text"> + <string>User &ID:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>rb_userName</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Userna&me:</string> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_userId</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + <property name="toolTip" stdset="0"> + <string>A correct User ID</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Use this field to add a contact if you already know the user's exact User ID</string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Ad&vanced</string> + </attribute> + </widget> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>rb_userId</sender> + <signal>toggled(bool)</signal> + <receiver>m_userId</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>rb_userName</sender> + <signal>toggled(bool)</signal> + <receiver>m_userName</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwchatpropsdialog.cpp b/kopete/protocols/groupwise/ui/gwchatpropsdialog.cpp new file mode 100644 index 00000000..eabb75ab --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwchatpropsdialog.cpp @@ -0,0 +1,122 @@ +/* + Kopete Groupwise Protocol + gwchatpropsdialog.h - dialog for viewing/modifying chat properties + + Copyright (c) 2005 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 <qcheckbox.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qlistview.h> + +#include <kdebug.h> +#include <kpushbutton.h> +#include <klocale.h> +#include "gwerror.h" +#include "gwchatpropswidget.h" + +#include "gwchatpropsdialog.h" + +GroupWiseChatPropsDialog::GroupWiseChatPropsDialog( QWidget * parent, const char * name ) + : KDialogBase( parent, name, false, i18n( "Chatroom properties" ), + KDialogBase::Ok|KDialogBase::Cancel, Ok, true ), m_dirty( false ) +{ + initialise(); +} + +GroupWiseChatPropsDialog::GroupWiseChatPropsDialog( const GroupWise::Chatroom & room, bool readOnly, + QWidget * parent, const char * name ) + : KDialogBase( parent, name, false, i18n( "Chatroom properties" ), + KDialogBase::Ok|KDialogBase::Cancel, Ok, true ), m_dirty( false ) +{ + initialise(); + m_widget->m_description->setText( room.description ); + m_widget->m_displayName->setText( room.displayName ); + m_widget->m_disclaimer->setText( room.disclaimer ); + m_widget->m_owner->setText( room.ownerDN ); + m_widget->m_query->setText( room.query ); + m_widget->m_topic->setText( room.topic ); + m_widget->m_archive->setChecked( room.archive ); + m_widget->m_maxUsers->setText( QString::number( room.maxUsers ) ); + m_widget->m_createdOn->setText( room.createdOn.toString() ); + m_widget->m_creator->setText( room.creatorDN ); + + m_widget->m_chkRead->setChecked( room.chatRights & GroupWise::Chatroom::Read || room.chatRights & GroupWise::Chatroom::Write || room.chatRights & GroupWise::Chatroom::Owner ); + m_widget->m_chkWrite->setChecked( room.chatRights & GroupWise::Chatroom::Write || room.chatRights & GroupWise::Chatroom::Owner ); + m_widget->m_chkModify->setChecked( room.chatRights & GroupWise::Chatroom::Modify || room.chatRights & GroupWise::Chatroom::Owner ); + + if ( readOnly ) + { + m_widget->m_description->setReadOnly( true ); + m_widget->m_disclaimer->setReadOnly( true ); + m_widget->m_owner->setReadOnly( true ); + m_widget->m_query->setReadOnly( true ); + m_widget->m_topic->setReadOnly( true ); + m_widget->m_archive->setEnabled( false ); + m_widget->m_maxUsers->setReadOnly( true ); + m_widget->m_createdOn->setReadOnly( true ); + m_widget->m_creator->setReadOnly( true ); + m_widget->m_chkRead->setEnabled( false ); + m_widget->m_chkWrite->setEnabled( false ); + m_widget->m_chkModify->setEnabled( false ); + m_widget->m_btnAddAcl->setEnabled( false ); + m_widget->m_btnEditAcl->setEnabled( false ); + m_widget->m_btnDeleteAcl->setEnabled( false ); + } + +} + +void GroupWiseChatPropsDialog::initialise() +{ + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << endl; + m_widget = new GroupWiseChatPropsWidget( this ); + connect( m_widget->m_topic, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_owner, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_createdOn, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_creator, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_description, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_disclaimer, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_query, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_archive, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_maxUsers, SIGNAL( textChanged( const QString & ) ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_btnAddAcl, SIGNAL( clicked() ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_btnEditAcl, SIGNAL( clicked() ), SLOT( slotWidgetChanged() ) ); + connect( m_widget->m_btnDeleteAcl, SIGNAL( clicked() ), SLOT( slotWidgetChanged() ) ); + setMainWidget( m_widget ); + show(); +} + +GroupWise::Chatroom GroupWiseChatPropsDialog::room() +{ + GroupWise::Chatroom room; + room.description = m_widget->m_description->text(); + room.displayName = m_widget->m_displayName->text(); + room.disclaimer = m_widget->m_disclaimer->text(); + room.ownerDN = m_widget->m_owner->text(); + room.query = m_widget->m_query->text(); + room.topic = m_widget->m_topic->text(); + room.archive = m_widget->m_archive->isChecked(); + room.maxUsers = m_widget->m_maxUsers->text().toInt(); + +// room. + return room; +} + +void GroupWiseChatPropsDialog::slotWidgetChanged() +{ + m_dirty = true; +} + +#include "gwchatpropsdialog.moc" diff --git a/kopete/protocols/groupwise/ui/gwchatpropsdialog.h b/kopete/protocols/groupwise/ui/gwchatpropsdialog.h new file mode 100644 index 00000000..058d6b20 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwchatpropsdialog.h @@ -0,0 +1,69 @@ +/* + Kopete Groupwise Protocol + gwchatpropsdialog.h - dialog for viewing/modifying chat properties + + Copyright (c) 2005 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 GWCHATPROPSDIALOG_H +#define GWCHATPROPSDIALOG_H + +#include <kdialogbase.h> + +#include "gwchatrooms.h" + +class GroupWiseChatPropsWidget; +/** + * Dialog for viewing/modifying chat properties. + * Chatroom list dialog gets props from manager + * Chatroom list dialog opens chatpropsdlg using props, connects to OkClicked signal + * User makes changes + * CLD asks CPD for changes. + * CLD passes changes to manager + * manager sends ChatUpdate to server + * on success, manager updates own model. + + 1) Create dialog with populated widget from supplied Chatroom. + 2) Add readonly mode. + 3) Track which things changed? Easier to get the changed Chatroom back and diff in the manager, simpler api connecting + */ +class GroupWiseChatPropsDialog : public KDialogBase +{ + Q_OBJECT + public: + /** + * Construct an empty dialog + */ + GroupWiseChatPropsDialog( QWidget * parent, const char * name ); + /** + * Construct a populated dialog + */ + GroupWiseChatPropsDialog( const GroupWise::Chatroom & room, bool readOnly, + QWidget * parent, const char * name ); + + ~GroupWiseChatPropsDialog() {} + + bool dirty() { return m_dirty; }; + GroupWise::Chatroom room(); + protected: + void initialise(); + protected slots: + void slotWidgetChanged(); + private: + GroupWiseChatPropsWidget * m_widget; + GroupWise::Chatroom m_room; + bool m_dirty; +}; + +#endif diff --git a/kopete/protocols/groupwise/ui/gwchatpropswidget.ui b/kopete/protocols/groupwise/ui/gwchatpropswidget.ui new file mode 100644 index 00000000..ecb764b9 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwchatpropswidget.ui @@ -0,0 +1,394 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseChatPropsWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseChatPropsWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>493</width> + <height>425</height> + </rect> + </property> + <property name="caption"> + <string>GroupWiseChatPropertiesWidget</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_displayName</cstring> + </property> + <property name="text"> + <string>DISPLAY NAME</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout16</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>m_creator</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>The user who created the chatroom</string> + </property> + </widget> + <widget class="QLabel" row="2" column="2"> + <property name="name"> + <cstring>textLabel10_2</cstring> + </property> + <property name="text"> + <string>Query:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_firstName_2</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lblTopic</cstring> + </property> + <property name="text"> + <string>Topic:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_displayName</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="3"> + <property name="name"> + <cstring>m_disclaimer</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>A disclaimer for users entering the chatroom</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>m__2_2</cstring> + </property> + <property name="text"> + <string>Owner:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_displayName_3</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_topic</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>The current topic of the discussion</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="3"> + <property name="name"> + <cstring>m_query</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>UNKNOWN</string> + </property> + </widget> + <widget class="QLabel" row="3" column="2"> + <property name="name"> + <cstring>textLabel11_2_2</cstring> + </property> + <property name="text"> + <string>Maximum Users:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_lastName_2_2</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>m__2_2_2</cstring> + </property> + <property name="text"> + <string>Created on:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_displayName_3</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>lbl_displayName_2</cstring> + </property> + <property name="text"> + <string>Disclaimer:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_displayName_2</cstring> + </property> + </widget> + <widget class="QLineEdit" row="5" column="1"> + <property name="name"> + <cstring>m_description</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>General description of the chatroom</string> + </property> + </widget> + <widget class="QLineEdit" row="3" column="3"> + <property name="name"> + <cstring>m_maxUsers</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Maximum simultaneous users allowed in the chatroom</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel10</cstring> + </property> + <property name="text"> + <string>Creator:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_firstName</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel11</cstring> + </property> + <property name="text"> + <string>Description:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_lastName</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>m_createdOn</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Date and time the chatroom was created</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="2"> + <property name="name"> + <cstring>m_archive</cstring> + </property> + <property name="text"> + <string>Archived</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Indicates if the chatroom is being archived on the server</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>m_owner</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>The user who owns this chatroom</string> + </property> + </widget> + <widget class="Line" row="0" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>line4</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>buttonGroup2</cstring> + </property> + <property name="title"> + <string>Default Access</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_chkRead</cstring> + </property> + <property name="text"> + <string>Read Message</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>General permission to read messages in the chatroom</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_chkWrite</cstring> + </property> + <property name="text"> + <string>Write Message</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>General permission to write messages in the chatroom</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_chkModify</cstring> + </property> + <property name="text"> + <string>Modify Access</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>General permission to modify the chatroom's access control list</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Access Control List</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kListBox1</cstring> + </property> + </widget> + <widget class="KListBox"> + <property name="name"> + <cstring>m_acl</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Access permissions for specific users</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_btnAddAcl</cstring> + </property> + <property name="text"> + <string>A&dd</string> + </property> + <property name="toolTip" stdset="0"> + <string>Add a new ACL entry</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_btnEditAcl</cstring> + </property> + <property name="text"> + <string>Ed&it</string> + </property> + <property name="toolTip" stdset="0"> + <string>Edit an existing ACL entry</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_btnDeleteAcl</cstring> + </property> + <property name="text"> + <string>D&elete</string> + </property> + <property name="toolTip" stdset="0"> + <string>Delete a ACL entry</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistbox.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwchatsearchdialog.cpp b/kopete/protocols/groupwise/ui/gwchatsearchdialog.cpp new file mode 100644 index 00000000..fb67a03e --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwchatsearchdialog.cpp @@ -0,0 +1,106 @@ +/* + Kopete Groupwise Protocol + gwchatsearchdialog.cpp - dialog for searching for chatrooms + + Copyright (c) 2005 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 <qmap.h> + +#include <klistview.h> +#include <klistviewsearchline.h> + +#include <kpushbutton.h> +#include <kdebug.h> +#include <klocale.h> +#include "client.h" +#include "chatroommanager.h" + +#include "gwaccount.h" +#include "gwprotocol.h" +#include "gwchatsearchwidget.h" +#include "gwchatpropsdialog.h" + +#include "gwchatsearchdialog.h" + +GroupWiseChatSearchDialog::GroupWiseChatSearchDialog( GroupWiseAccount * account, QWidget *parent, const char *name ) + : KDialogBase( parent, name, false, i18n( "Search Chatrooms" ), + KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, Ok, true ), m_account( account ) +{ + m_widget = new GroupWiseChatSearchWidget( this ); +// m_widget->m_searchLineWidget->createSearchLine( m_widget->m_chatrooms ); + setMainWidget( m_widget ); + + m_manager = m_account->client()->chatroomManager(); + + connect ( m_manager, SIGNAL( updated() ), SLOT( slotManagerUpdated() ) ); + connect ( m_manager, SIGNAL( gotProperties( const GroupWise::Chatroom & ) ), + SLOT( slotGotProperties( const GroupWise::Chatroom & ) ) ); + + connect( m_widget->m_btnRefresh, SIGNAL( clicked() ), SLOT( slotUpdateClicked() ) ); + connect( m_widget->m_btnProperties, SIGNAL( clicked() ), SLOT( slotPropertiesClicked() ) ); + + m_manager->updateRooms(); + show(); +} + +GroupWiseChatSearchDialog::~GroupWiseChatSearchDialog() +{ +} + +void GroupWiseChatSearchDialog::slotUpdateClicked() +{ + kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << "updating chatroom list " << endl; + m_widget->m_chatrooms->clear(); + QListViewItem * first = m_widget->m_chatrooms->firstChild(); + QString updateMessage = i18n("Updating chatroom list..." ); +/* if ( first ) + new QListViewItem( first, updateMessage ); + else*/ + new QListViewItem( m_widget->m_chatrooms, updateMessage ); + m_manager->updateRooms(); + +} + +void GroupWiseChatSearchDialog::slotManagerUpdated() +{ + ChatroomMap rooms = m_manager->rooms(); + ChatroomMap::iterator it = rooms.begin(); + const ChatroomMap::iterator end = rooms.end(); + while ( it != end ) + { + new QListViewItem( m_widget->m_chatrooms, + it.data().displayName, + m_account->protocol()->dnToDotted( it.data().ownerDN ), + QString::number( it.data().participantsCount ) ); + ++it; + } +} + +void GroupWiseChatSearchDialog::slotPropertiesClicked() +{ + QListViewItem * selected = m_widget->m_chatrooms->selectedItem(); + if ( selected ) + { + m_manager->requestProperties( selected->text( 0 ) ); + } +} + +void GroupWiseChatSearchDialog::slotGotProperties(const GroupWise::Chatroom & room) +{ + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << endl; + new GroupWiseChatPropsDialog( room, true, this, "chatpropsdlg" ); +} + +#include "gwchatsearchdialog.moc" diff --git a/kopete/protocols/groupwise/ui/gwchatsearchdialog.h b/kopete/protocols/groupwise/ui/gwchatsearchdialog.h new file mode 100644 index 00000000..667e6394 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwchatsearchdialog.h @@ -0,0 +1,49 @@ +/* + Kopete Groupwise Protocol + gwchatsearchdialog.h - dialog for searching for chatrooms + + Copyright (c) 2005 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 GWCHATSEARCHDIALOG_H +#define GWCHATSEARCHDIALOG_H + +class GroupWiseAccount; +class GroupWiseChatSearchWidget; + +#include "gwchatrooms.h" + +#include <kdialogbase.h> + +class GroupWiseChatSearchDialog : public KDialogBase +{ + Q_OBJECT + public: + GroupWiseChatSearchDialog( GroupWiseAccount * account, QWidget * parent, const char * name ); + ~GroupWiseChatSearchDialog(); + protected: + void populateWidget(); + protected slots: + /* Button handlers */ + void slotPropertiesClicked(); + void slotUpdateClicked(); + /* Manager update handler */ + void slotManagerUpdated(); + void slotGotProperties( const GroupWise::Chatroom & room ); + private: + GroupWiseAccount * m_account; + ChatroomManager * m_manager; + GroupWiseChatSearchWidget * m_widget; +}; +#endif diff --git a/kopete/protocols/groupwise/ui/gwchatsearchwidget.ui b/kopete/protocols/groupwise/ui/gwchatsearchwidget.ui new file mode 100644 index 00000000..f6f2014c --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwchatsearchwidget.ui @@ -0,0 +1,116 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseChatSearchWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseChatSearchWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>579</width> + <height>480</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Chatroom </string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Owner</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Members</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_chatrooms</cstring> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + <property name="itemsMovable"> + <bool>false</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_btnProperties</cstring> + </property> + <property name="text"> + <string>&Properties</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>340</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnRefresh</cstring> + </property> + <property name="text"> + <string>&Refresh</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwcontactproperties.cpp b/kopete/protocols/groupwise/ui/gwcontactproperties.cpp new file mode 100644 index 00000000..120296ce --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwcontactproperties.cpp @@ -0,0 +1,144 @@ +/* + Kopete Groupwise Protocol + gwcontactproperties.cpp - dialog showing a contact's server side properties + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 <qclipboard.h> +#include <qheader.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <klistview.h> +#include <qmap.h> +#include <qpopupmenu.h> + +#include <kapplication.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <klocale.h> +#include <kopeteglobal.h> +#include <kopeteonlinestatus.h> +#include <kopetemetacontact.h> +#include <kopeteuiglobal.h> +#include <kaction.h> +#include <kstdaction.h> + +#include "gwcontact.h" +#include "gwcontactpropswidget.h" +#include "gwprotocol.h" + +#include "gwcontactproperties.h" + +GroupWiseContactProperties::GroupWiseContactProperties( GroupWiseContact * contact, QWidget *parent, const char *name) + : QObject(parent, name) +{ + init(); + // set up the contents of the props widget + m_propsWidget->m_userId->setText( contact->contactId() ); + m_propsWidget->m_status->setText( contact->onlineStatus().description() ); + m_propsWidget->m_displayName->setText( contact->metaContact()->displayName() ); + m_propsWidget->m_firstName->setText( contact->property( Kopete::Global::Properties::self()->firstName() ).value().toString() ); + m_propsWidget->m_lastName->setText( contact->property( Kopete::Global::Properties::self()->lastName() ).value().toString() ); + + setupProperties( contact->serverProperties() ); + m_dialog->show(); +} + +GroupWiseContactProperties::GroupWiseContactProperties( GroupWise::ContactDetails cd, QWidget *parent, const char *name ) + : QObject(parent, name) +{ + init(); + // set up the contents of the props widget + m_propsWidget->m_userId->setText( GroupWiseProtocol::protocol()->dnToDotted( cd.dn ) ); + m_propsWidget->m_status->setText( GroupWiseProtocol::protocol()->gwStatusToKOS( cd.status ).description() ); + m_propsWidget->m_displayName->setText( cd.fullName.isEmpty() ? ( cd.givenName + " " + cd.surname ) : cd.fullName ); + m_propsWidget->m_firstName->setText( cd.givenName ); + m_propsWidget->m_lastName->setText( cd.surname ); + + setupProperties( cd.properties ); + + m_dialog->show(); +} + +GroupWiseContactProperties::~GroupWiseContactProperties() +{ +} + +void GroupWiseContactProperties::init() +{ + m_dialog = new KDialogBase( ::qt_cast<QWidget*>( parent() ), "gwcontactpropsdialog", false, i18n( "Contact Properties" ), KDialogBase::Ok ); + m_propsWidget = new GroupWiseContactPropsWidget( m_dialog ); + // set up the context menu and copy action + m_copyAction = KStdAction::copy( this, SLOT( slotCopy() ), 0 ); + connect( m_propsWidget->m_propsView, + SIGNAL( contextMenuRequested( QListViewItem *, const QPoint & , int) ), + SLOT( slotShowContextMenu( QListViewItem *, const QPoint & ) ) ); + + // insert the props widget into the dialog + m_dialog->setMainWidget( m_propsWidget ); +} + +void GroupWiseContactProperties::setupProperties( QMap< QString, QString > serverProps ) +{ + m_propsWidget->m_propsView->header()->hide(); + QMap< QString, QString >::Iterator it; + QMap< QString, QString >::Iterator end = serverProps.end(); + for ( it = serverProps.begin(); it != end; ++it ) + { + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << " adding property: " << it.key() << ", " << it.data() << endl; + QString key = it.key(); + QString localised; + if ( key == "telephoneNumber" ) + localised = i18n( "Telephone Number" ); + else if ( key == "OU" ) + localised = i18n( "Department" ); + else if ( key == "L" ) + localised = i18n( "Location" ); + else if ( key == "mailstop" ) + localised = i18n( "Mailstop" ); + else if ( key == "personalTitle" ) + localised = i18n( "Personal Title" ); + else if ( key == "title" ) + localised = i18n( "Title" ); + else if ( key == "Internet EMail Address" ) + localised = i18n( "Email Address" ); + else + localised = key; + + new KListViewItem( m_propsWidget->m_propsView, localised, it.data() ); + } +} + +void GroupWiseContactProperties::slotShowContextMenu( QListViewItem * item, const QPoint & pos ) +{ + if ( item ) + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << "for item " << item->text(0) << ", " << item->text(1) << endl; + else + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << "no selected item" << endl; + QPopupMenu * popupMenu = new QPopupMenu( m_propsWidget->m_propsView ); + m_copyAction->plug( popupMenu ); + popupMenu->exec( pos ); +} + +void GroupWiseContactProperties::slotCopy() +{ + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << endl; + if ( m_propsWidget->m_propsView->currentItem() ) + { + QClipboard *cb = kapp->clipboard(); + cb->setText( m_propsWidget->m_propsView->currentItem()->text( 1 ) ); + } +} +#include "gwcontactproperties.moc" diff --git a/kopete/protocols/groupwise/ui/gwcontactproperties.h b/kopete/protocols/groupwise/ui/gwcontactproperties.h new file mode 100644 index 00000000..5684cf2a --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwcontactproperties.h @@ -0,0 +1,60 @@ +/* + Kopete Groupwise Protocol + gwcontactproperties.h - dialog showing a contact's server side properties + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 GROUPWISECONTACTPROPERTIES_H +#define GROUPWISECONTACTPROPERTIES_H + + +#include <qobject.h> + +class GroupWiseContactPropsWidget; +class KDialogBase; +class QListViewItem; +class KAction; + +/** +Logic, wrapping UI, for displaying contact properties + +@author SUSE AG +*/ +class GroupWiseContactProperties : public QObject +{ +Q_OBJECT +public: + /** + * Display properties given a GroupWiseContact + */ + GroupWiseContactProperties( GroupWiseContact * contact, QWidget *parent, const char *name ); + /** + * Display properties given a GroupWise::ContactDetails + */ + GroupWiseContactProperties( GroupWise::ContactDetails contactDetails, QWidget *parent = 0, const char *name = 0 ); + ~GroupWiseContactProperties(); +protected: + void setupProperties( QMap< QString, QString > serverProps ); + void init(); +protected slots: + void slotShowContextMenu( QListViewItem *, const QPoint & ); + void slotCopy(); +private: + GroupWiseContactPropsWidget * m_propsWidget; + KAction * m_copyAction; + KDialogBase * m_dialog; +}; + +#endif diff --git a/kopete/protocols/groupwise/ui/gwcontactpropswidget.ui b/kopete/protocols/groupwise/ui/gwcontactpropswidget.ui new file mode 100644 index 00000000..3aece991 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwcontactpropswidget.ui @@ -0,0 +1,211 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseContactPropsWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseContactPropsWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>373</width> + <height>444</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_userId</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>3</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>USER_ID</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line4</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>m_lastName</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Change the display name used for this contact</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel14</cstring> + </property> + <property name="text"> + <string>Status:</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>m_displayName</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Change the display name used for this contact</string> + </property> + </widget> + <widget class="QLabel" row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>m_status</cstring> + </property> + <property name="text"> + <string>USER_STATUS</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel10</cstring> + </property> + <property name="text"> + <string>First name:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>lbl_displayName</cstring> + </property> + <property name="text"> + <string>&Display name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_displayName</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>m_firstName</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Change the display name used for this contact</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel11</cstring> + </property> + <property name="text"> + <string>Last name:</string> + </property> + </widget> + </grid> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line1_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel15</cstring> + </property> + <property name="text"> + <string>Additional properties:</string> + </property> + </widget> + <widget class="KListView"> + <column> + <property name="text"> + <string>Property</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Value</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_propsView</cstring> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + <property name="itemsMovable"> + <bool>false</bool> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwcontactsearch.ui b/kopete/protocols/groupwise/ui/gwcontactsearch.ui new file mode 100644 index 00000000..868072ce --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwcontactsearch.ui @@ -0,0 +1,386 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseContactSearchWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseContactSearchWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>435</width> + <height>410</height> + </rect> + </property> + <property name="caption"> + <string>Search GroupWise Messenger</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </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>&First name</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_firstName</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>&User ID</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_userId</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>&Title</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_title</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="2"> + <property name="name"> + <cstring>m_userId</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="2"> + <property name="name"> + <cstring>m_firstName</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>&Department</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_dept</cstring> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <item> + <property name="text"> + <string>contains</string> + </property> + </item> + <item> + <property name="text"> + <string>begins with</string> + </property> + </item> + <item> + <property name="text"> + <string>equals</string> + </property> + </item> + <property name="name"> + <cstring>m_userIdOperation</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>contains</string> + </property> + </item> + <item> + <property name="text"> + <string>begins with</string> + </property> + </item> + <item> + <property name="text"> + <string>equals</string> + </property> + </item> + <property name="name"> + <cstring>m_firstNameOperation</cstring> + </property> + </widget> + <widget class="QLineEdit" row="4" column="2"> + <property name="name"> + <cstring>m_dept</cstring> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>contains</string> + </property> + </item> + <item> + <property name="text"> + <string>begins with</string> + </property> + </item> + <item> + <property name="text"> + <string>equals</string> + </property> + </item> + <property name="name"> + <cstring>m_lastNameOperation</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Last &name</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_lastName</cstring> + </property> + </widget> + <widget class="QPushButton" row="1" column="3"> + <property name="name"> + <cstring>m_clear</cstring> + </property> + <property name="text"> + <string>Cl&ear</string> + </property> + </widget> + <widget class="QComboBox" row="4" column="1"> + <item> + <property name="text"> + <string>contains</string> + </property> + </item> + <item> + <property name="text"> + <string>begins with</string> + </property> + </item> + <item> + <property name="text"> + <string>equals</string> + </property> + </item> + <property name="name"> + <cstring>m_deptOperation</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="2"> + <property name="name"> + <cstring>m_title</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="2"> + <property name="name"> + <cstring>m_lastName</cstring> + </property> + </widget> + <widget class="QPushButton" row="0" column="3"> + <property name="name"> + <cstring>m_search</cstring> + </property> + <property name="text"> + <string>&Search</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QComboBox" row="3" column="1"> + <item> + <property name="text"> + <string>contains</string> + </property> + </item> + <item> + <property name="text"> + <string>begins with</string> + </property> + </item> + <item> + <property name="text"> + <string>equals</string> + </property> + </item> + <property name="name"> + <cstring>m_titleOperation</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel9</cstring> + </property> + <property name="text"> + <string>&Results:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_results</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Status</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>First Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Last Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>User ID</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_results</cstring> + </property> + <property name="resizePolicy"> + <enum>AutoOneFit</enum> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_details</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Detai&ls</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>141</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>m_matchCount</cstring> + </property> + <property name="text"> + <string>0 matching users found</string> + </property> + </widget> + </vbox> +</widget> +<tabstops> + <tabstop>m_firstName</tabstop> + <tabstop>m_lastNameOperation</tabstop> + <tabstop>m_lastName</tabstop> + <tabstop>m_userIdOperation</tabstop> + <tabstop>m_userId</tabstop> + <tabstop>m_titleOperation</tabstop> + <tabstop>m_title</tabstop> + <tabstop>m_deptOperation</tabstop> + <tabstop>m_dept</tabstop> + <tabstop>m_search</tabstop> + <tabstop>m_clear</tabstop> + <tabstop>m_results</tabstop> + <tabstop>m_details</tabstop> + <tabstop>m_firstNameOperation</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwcustomstatusedit.ui b/kopete/protocols/groupwise/ui/gwcustomstatusedit.ui new file mode 100644 index 00000000..43a9af15 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwcustomstatusedit.ui @@ -0,0 +1,92 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseCustomStatusEdit</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseCustomStatusEdit</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>260</width> + <height>113</height> + </rect> + </property> + <property name="caption"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_name</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>m_cmbStatus</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>&Status:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comboBox1</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Awa&y message:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lineEdit2</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>&Name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lineEdit1</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>m_awayMessage</cstring> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwcustomstatuswidget.ui b/kopete/protocols/groupwise/ui/gwcustomstatuswidget.ui new file mode 100644 index 00000000..8c69aa76 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwcustomstatuswidget.ui @@ -0,0 +1,112 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>GroupWiseCustomStatusWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWiseCustomStatusWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>343</width> + <height>215</height> + </rect> + </property> + <property name="caption"> + <string></string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Auto Reply</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_list</cstring> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnAdd</cstring> + </property> + <property name="text"> + <string>&Add</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnEdit</cstring> + </property> + <property name="text"> + <string>&Edit</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnRemove</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>41</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/kopete/protocols/groupwise/ui/gweditaccountwidget.cpp b/kopete/protocols/groupwise/ui/gweditaccountwidget.cpp new file mode 100644 index 00000000..87468ccf --- /dev/null +++ b/kopete/protocols/groupwise/ui/gweditaccountwidget.cpp @@ -0,0 +1,136 @@ +/* + Kopete GroupWise Protocol + gweditaccountwidget.cpp - widget for adding or editing GroupWise accounts + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Testbed + Copyright (c) 2003 by Will Stephenson <will@stevello.free-online.co.uk> + + Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 <qcheckbox.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qspinbox.h> + +#include <kapplication.h> +#include <kdebug.h> +#include <kconfig.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kpassdlg.h> +#include "kopetepasswordedaccount.h" +#include "kopetepasswordwidget.h" + +#include "gwaccountpreferences.h" +#include "gwaccount.h" +#include "gwerror.h" +#include "gwprotocol.h" + +#include "gweditaccountwidget.h" + +GroupWiseEditAccountWidget::GroupWiseEditAccountWidget( QWidget* parent, Kopete::Account* theAccount) +: QWidget( parent ), KopeteEditAccountWidget( theAccount ) +{ + kdDebug(GROUPWISE_DEBUG_GLOBAL) << k_funcinfo << endl; + m_layout = new QVBoxLayout( this ); + m_preferencesDialog = new GroupWiseAccountPreferences( this ); + m_layout->addWidget( m_preferencesDialog ); + connect( m_preferencesDialog->m_password, SIGNAL( changed() ), this, SLOT( configChanged() ) ); + connect( m_preferencesDialog->m_server, SIGNAL( textChanged( const QString & ) ), this, SLOT( configChanged() ) ); + connect( m_preferencesDialog->m_port, SIGNAL( valueChanged( int ) ), this, SLOT( configChanged() ) ); + if ( account() ) + reOpen(); + else + { + // look for a default server and port setting + KConfig *config = kapp->config(); + config->setGroup("GroupWise Messenger"); + m_preferencesDialog->m_server->setText( config->readEntry( "DefaultServer" ) ); + m_preferencesDialog->m_port->setValue( config->readNumEntry( "DefaultPort", 8300 ) ); + } + QWidget::setTabOrder( m_preferencesDialog->m_userId, m_preferencesDialog->m_password->mRemembered ); + QWidget::setTabOrder( m_preferencesDialog->m_password->mRemembered, m_preferencesDialog->m_password->mPassword ); + QWidget::setTabOrder( m_preferencesDialog->m_password->mPassword, m_preferencesDialog->m_autoConnect ); + +} + +GroupWiseEditAccountWidget::~GroupWiseEditAccountWidget() +{ +} + +GroupWiseAccount *GroupWiseEditAccountWidget::account () +{ + Q_ASSERT( KopeteEditAccountWidget::account() ); + return dynamic_cast< GroupWiseAccount *>( KopeteEditAccountWidget::account() ); +} + +void GroupWiseEditAccountWidget::reOpen() +{ + kdDebug(GROUPWISE_DEBUG_GLOBAL) << k_funcinfo << endl; + + m_preferencesDialog->m_password->load( &account()->password () ); + // Kopete at least <=0.90 doesn't support changing account IDs + m_preferencesDialog->m_userId->setDisabled( true ); + m_preferencesDialog->m_userId->setText( account()->accountId() ); + m_preferencesDialog->m_password->load( &account()->password() ); + m_preferencesDialog->m_server->setText( account()->configGroup()->readEntry( "Server") ); + m_preferencesDialog->m_port->setValue( account()->configGroup()->readNumEntry( "Port" ) ); + m_preferencesDialog->m_autoConnect->setChecked( account()->excludeConnect() ); + m_preferencesDialog->m_alwaysAccept->setChecked( account()->configGroup()->readBoolEntry( "AlwaysAcceptInvitations" ) ); +} + +Kopete::Account* GroupWiseEditAccountWidget::apply() +{ + kdDebug(GROUPWISE_DEBUG_GLOBAL) << k_funcinfo << endl; + + if ( !account() ) + setAccount( new GroupWiseAccount( GroupWiseProtocol::protocol(), m_preferencesDialog->m_userId->text() ) ); + + if(account()->isConnected()) + { + KMessageBox::information(this, + i18n("The changes you just made will take effect next time you log in with GroupWise."), + i18n("GroupWise Settings Changed While Signed In")); + } + + writeConfig(); + + return account(); +} + +bool GroupWiseEditAccountWidget::validateData() +{ + return !( m_preferencesDialog->m_userId->text().isEmpty() || m_preferencesDialog->m_server->text().isEmpty() ); +} + +void GroupWiseEditAccountWidget::writeConfig() +{ + kdDebug(GROUPWISE_DEBUG_GLOBAL) << k_funcinfo << endl; + account()->configGroup()->writeEntry( "Server", m_preferencesDialog->m_server->text() ); + account()->configGroup()->writeEntry( "Port", QString::number( m_preferencesDialog->m_port->value() ) ); + account()->configGroup()->writeEntry( "AlwaysAcceptInvitations", + m_preferencesDialog->m_alwaysAccept->isChecked() ? "true" : "false" ); + + account()->setExcludeConnect( m_preferencesDialog->m_autoConnect->isChecked() ); + m_preferencesDialog->m_password->save( &account()->password() ); + settings_changed = false; +} + +void GroupWiseEditAccountWidget::configChanged () +{ + settings_changed = true; +} + +#include "gweditaccountwidget.moc" diff --git a/kopete/protocols/groupwise/ui/gweditaccountwidget.h b/kopete/protocols/groupwise/ui/gweditaccountwidget.h new file mode 100644 index 00000000..27c54ee2 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gweditaccountwidget.h @@ -0,0 +1,64 @@ +/* + Kopete GroupWise Protocol + gweditaccountwidget.h - widget for adding or editing GroupWise accounts + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Testbed + Copyright (c) 2003 by Will Stephenson <will@stevello.free-online.co.uk> + + Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 TESTBEDEDITACCOUNTWIDGET_H +#define TESTBEDEDITACCOUNTWIDGET_H + +#include <qwidget.h> +#include <editaccountwidget.h> + +class QVBoxLayout; +namespace Kopete { class Account; } +class GroupWiseAccountPreferences; + +/** + * A widget for editing this protocol's accounts + * @author Will Stephenson +*/ +class GroupWiseEditAccountWidget : public QWidget, public KopeteEditAccountWidget +{ +Q_OBJECT +public: + GroupWiseEditAccountWidget( QWidget* parent, Kopete::Account* account); + + ~GroupWiseEditAccountWidget(); + + /** + * Make an account out of the entered data + */ + virtual Kopete::Account* apply(); + /** + * Is the data correct? + */ + virtual bool validateData(); +protected slots: + void configChanged(); +protected: + bool settings_changed; + GroupWiseAccount * account(); + void reOpen(); + void writeConfig(); + Kopete::Account *m_account; + QVBoxLayout *m_layout; + GroupWiseAccountPreferences *m_preferencesDialog; +}; + +#endif diff --git a/kopete/protocols/groupwise/ui/gwprivacy.ui b/kopete/protocols/groupwise/ui/gwprivacy.ui new file mode 100644 index 00000000..8b09cab6 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwprivacy.ui @@ -0,0 +1,193 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>GroupWisePrivacyWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>GroupWisePrivacyWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>463</width> + <height>314</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Who can see my online status and send me messages:</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>A&llowed</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_allowList</cstring> + </property> + </widget> + <widget class="QListBox"> + <property name="name"> + <cstring>m_allowList</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <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>21</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnBlock</cstring> + </property> + <property name="text"> + <string>&Block >></string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnAllow</cstring> + </property> + <property name="text"> + <string><< Allo&w</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>53</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnAdd</cstring> + </property> + <property name="text"> + <string>A&dd...</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_btnRemove</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>52</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Bloc&ked</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_denyList</cstring> + </property> + </widget> + <widget class="QListBox"> + <property name="name"> + <cstring>m_denyList</cstring> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>m_status</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kopete/protocols/groupwise/ui/gwprivacydialog.cpp b/kopete/protocols/groupwise/ui/gwprivacydialog.cpp new file mode 100644 index 00000000..d46daf4a --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwprivacydialog.cpp @@ -0,0 +1,349 @@ +/* + Kopete Groupwise Protocol + gwprivacydialog.cpp - dialog summarising, and editing, the user's privacy settings + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 <qlabel.h> +#include <qlistbox.h> +#include <qpushbutton.h> +#include <qstringlist.h> +#include <qlistview.h> + +#include <kdebug.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "client.h" +#include "gwaccount.h" +#include "gwprivacy.h" +#include "gwprotocol.h" +#include "gwsearch.h" +#include "privacymanager.h" +#include "userdetailsmanager.h" +#include "gwprivacydialog.h" + +class PrivacyLBI : public QListBoxPixmap +{ +public: + PrivacyLBI( QListBox * listBox, const QPixmap & pixmap, const QString & text, const QString & dn ) + : QListBoxPixmap( listBox, pixmap, text ), m_dn( dn ) + { + } + QString dn() { return m_dn; } +private: + QString m_dn; +}; + +GroupWisePrivacyDialog::GroupWisePrivacyDialog( GroupWiseAccount * account, QWidget *parent, const char *name ) + : KDialogBase( parent, name, false, i18n( "Account specific privacy settings", "Manage Privacy for %1" ).arg( account->accountId() ), + KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, Ok, true ), m_account( account ), m_dirty( false ), m_searchDlg(0) +{ + m_privacy = new GroupWisePrivacyWidget( this ); + setMainWidget( m_privacy ); + PrivacyManager * mgr = m_account->client()->privacyManager(); + // populate the widget; + // admin lock + if ( mgr->isPrivacyLocked() ) + { + m_privacy->m_status->setText( i18n( "Privacy settings have been administratively locked" ) ); + disableWidgets(); + } + + populateWidgets(); + + m_privacy->m_allowList->setSelectionMode( QListBox::Extended ); + m_privacy->m_denyList->setSelectionMode( QListBox::Extended ); + + connect( m_privacy->m_btnAllow, SIGNAL( clicked() ), SLOT( slotAllowClicked() ) ); + connect( m_privacy->m_btnBlock, SIGNAL( clicked() ), SLOT( slotBlockClicked() ) ); + connect( m_privacy->m_btnAdd, SIGNAL( clicked() ), SLOT( slotAddClicked() ) ); + connect( m_privacy->m_btnRemove, SIGNAL( clicked() ), SLOT( slotRemoveClicked() ) ); + connect( m_privacy->m_allowList, SIGNAL( selectionChanged() ), SLOT( slotAllowListClicked() ) ); + connect( m_privacy->m_denyList, SIGNAL( selectionChanged() ), SLOT( slotDenyListClicked() ) ); + connect( mgr, SIGNAL( privacyChanged( const QString &, bool ) ), SLOT( slotPrivacyChanged() ) ); + m_privacy->m_btnAdd->setEnabled( true ); + m_privacy->m_btnAllow->setEnabled( false ); + m_privacy->m_btnBlock->setEnabled( false ); + m_privacy->m_btnRemove->setEnabled( false ); + +/* showButtonOK( true ); + showButtonApply( true ); + showButtonCancel( true ); + */ + show(); +} + +GroupWisePrivacyDialog::~GroupWisePrivacyDialog() +{ +} + +void GroupWisePrivacyDialog::populateWidgets() +{ + m_dirty = false; + PrivacyManager * mgr = m_account->client()->privacyManager(); + + // default policy + QString defaultPolicyText = i18n( "<Everyone Else>" ); + if ( mgr->defaultAllow() ) + m_defaultPolicy = new QListBoxText( m_privacy->m_allowList, defaultPolicyText ); + else + m_defaultPolicy = new QListBoxText( m_privacy->m_denyList, defaultPolicyText ); + + QPixmap icon = m_account->protocol()->groupwiseAvailable.iconFor( m_account ); + + // allow list + QStringList allowList = mgr->allowList(); + QStringList::Iterator end = allowList.end(); + for ( QStringList::Iterator it = allowList.begin(); it != end; ++it ) + { + GroupWise::ContactDetails cd = m_account->client()->userDetailsManager()->details( *it ); + if ( cd.fullName.isEmpty() ) + cd.fullName = cd.givenName + " " + cd.surname; + new PrivacyLBI( m_privacy->m_allowList, icon, cd.fullName, *it ); + } + // deny list + QStringList denyList = mgr->denyList(); + end = denyList.end(); + for ( QStringList::Iterator it = denyList.begin(); it != end; ++it ) + { + GroupWise::ContactDetails cd = m_account->client()->userDetailsManager()->details( *it ); + if ( cd.fullName.isEmpty() ) + cd.fullName = cd.givenName + " " + cd.surname; + new PrivacyLBI( m_privacy->m_denyList, icon, cd.fullName, *it ); + } + updateButtonState(); +} + +void GroupWisePrivacyDialog::disableWidgets() +{ + if ( m_privacy ) + { + m_privacy->m_btnAllow->setEnabled( false ); + m_privacy->m_btnBlock->setEnabled( false ); + m_privacy->m_btnAdd->setEnabled( false ); + m_privacy->m_btnRemove->setEnabled( false ); + } +} + +void GroupWisePrivacyDialog::slotBlockClicked() +{ + // take each selected item from the allow list and add it to the deny list + // start at the bottom, as we are changing the contents of the list as we go + for( int i = m_privacy->m_allowList->count() - 1; i >= 0 ; --i ) + { + if ( m_privacy->m_allowList->isSelected( i ) ) + { + m_dirty = true; + QListBoxItem * lbi = m_privacy->m_allowList->item( i ); + m_privacy->m_allowList->takeItem( lbi ); + m_privacy->m_denyList->insertItem( lbi ); + } + } + updateButtonState(); +} + +void GroupWisePrivacyDialog::slotAllowClicked() +{ + // take each selected item from the deny list and add it to the allow list + for( int i = m_privacy->m_denyList->count() - 1; i >= 0 ; --i ) + { + if ( m_privacy->m_denyList->isSelected( i ) ) + { + m_dirty = true; + QListBoxItem * lbi = m_privacy->m_denyList->item( i ); + m_privacy->m_denyList->takeItem( lbi ); + m_privacy->m_allowList->insertItem( lbi ); + } + } + updateButtonState(); +} + +void GroupWisePrivacyDialog::slotAddClicked() +{ + if ( !m_searchDlg ) + { + m_searchDlg = new KDialogBase( this, "privacysearchdialog", false, + i18n( "Search for Contact to Block" ), + KDialogBase::Ok|KDialogBase::Cancel ); + m_search = new GroupWiseContactSearch( m_account, QListView::Multi, false, m_searchDlg, "privacysearchwidget" ); + m_searchDlg->setMainWidget( m_search ); + connect( m_searchDlg, SIGNAL( okClicked() ), SLOT( slotSearchedForUsers() ) ); + connect( m_search, SIGNAL( selectionValidates( bool ) ), m_searchDlg, SLOT( enableButtonOK( bool ) ) ); + m_searchDlg->enableButtonOK( false ); + } + m_searchDlg->show(); +} + +void GroupWisePrivacyDialog::slotSearchedForUsers() +{ + // create an item for each result, in the block list + QValueList< ContactDetails > selected = m_search->selectedResults(); + QValueList< ContactDetails >::Iterator it = selected.begin(); + const QValueList< ContactDetails >::Iterator end = selected.end(); + QPixmap icon = m_account->protocol()->groupwiseAvailable.iconFor( m_account ); + for ( ; it != end; ++it ) + { + m_dirty = true; + m_account->client()->userDetailsManager()->addDetails( *it ); + if ( (*it).fullName.isEmpty() ) + (*it).fullName = (*it).givenName + " " + (*it).surname; + new PrivacyLBI( m_privacy->m_denyList, icon, (*it).fullName, (*it).dn ); + } +} + +void GroupWisePrivacyDialog::slotRemoveClicked() +{ + // remove any selected items from either list, except the default policy + for( int i = m_privacy->m_denyList->count() - 1; i >= 0 ; --i ) + { + if ( m_privacy->m_denyList->isSelected( i ) ) + { + m_dirty = true; + QListBoxItem * lbi = m_privacy->m_denyList->item( i ); + // can't remove the default policy + if ( lbi == m_defaultPolicy ) + continue; + m_privacy->m_denyList->removeItem( i ); + } + } + for( int i = m_privacy->m_allowList->count() - 1; i >= 0 ; --i ) + { + if ( m_privacy->m_allowList->isSelected( i ) ) + { + m_dirty = true; + QListBoxItem * lbi = m_privacy->m_allowList->item( i ); + // can't remove the default policy + if ( lbi == m_defaultPolicy ) + continue; + m_privacy->m_allowList->removeItem( i ); + } + } + updateButtonState(); +} + +void GroupWisePrivacyDialog::slotAllowListClicked() +{ + // don't get into feedback + disconnect( m_privacy->m_denyList, SIGNAL( selectionChanged() ), this, SLOT( slotDenyListClicked() ) ); + m_privacy->m_denyList->clearSelection(); + connect( m_privacy->m_denyList, SIGNAL( selectionChanged() ), SLOT( slotDenyListClicked() ) ); + bool selected = false; + for( int i = m_privacy->m_allowList->count() - 1; i >= 0 ; --i ) + { + if ( m_privacy->m_allowList->isSelected( i ) ) + { + selected = true; + break; + } + } + m_privacy->m_btnAllow->setEnabled( false ); + m_privacy->m_btnBlock->setEnabled( selected ); + m_privacy->m_btnRemove->setEnabled( selected ); +} + +void GroupWisePrivacyDialog::slotDenyListClicked() +{ + // don't get into feedback + disconnect( m_privacy->m_allowList, SIGNAL( selectionChanged() ), this, SLOT( slotAllowListClicked() ) ); + m_privacy->m_allowList->clearSelection(); + connect( m_privacy->m_allowList, SIGNAL( selectionChanged() ), SLOT( slotAllowListClicked() ) ); + bool selected = false; + for( int i = m_privacy->m_denyList->count() - 1; i >= 0 ; --i ) + { + if ( m_privacy->m_denyList->isSelected( i ) ) + { + selected = true; + break; + } + } + m_privacy->m_btnAllow->setEnabled( selected ); + m_privacy->m_btnBlock->setEnabled( false ); + m_privacy->m_btnRemove->setEnabled( selected ); +} + +void GroupWisePrivacyDialog::slotPrivacyChanged() +{ + m_privacy->m_denyList->clear(); + m_privacy->m_allowList->clear(); + populateWidgets(); +} + +void GroupWisePrivacyDialog::updateButtonState() +{ + enableButtonApply( m_dirty ); +} + +void GroupWisePrivacyDialog::slotOk() +{ + if ( m_dirty ) + commitChanges(); + KDialogBase::slotOk(); +} + +void GroupWisePrivacyDialog::slotApply() +{ + if ( m_dirty ) + { + commitChanges(); + m_dirty = false; + updateButtonState(); + } + KDialogBase::slotApply(); +} + +void GroupWisePrivacyDialog::commitChanges() +{ + if ( m_account->isConnected() ) + { + bool defaultDeny = false; + QStringList denyList; + QStringList allowList; + // pass on our current allow, deny and default policy to the PrivacyManager + for( int i = 0; i < (int)m_privacy->m_denyList->count(); ++i ) + { + if ( m_privacy->m_denyList->item( i ) == m_defaultPolicy ) + defaultDeny = true; + else + { + PrivacyLBI * lbi = static_cast<PrivacyLBI *>( m_privacy->m_denyList->item( i ) ); + denyList.append( lbi->dn() ); + } + } + for( int i = 0; i < (int)m_privacy->m_allowList->count(); ++i ) + { + if ( m_privacy->m_allowList->item( i ) == m_defaultPolicy ) + defaultDeny = false; + else + { + PrivacyLBI * lbi = static_cast<PrivacyLBI *>( m_privacy->m_allowList->item( i ) ); + allowList.append( lbi->dn() ); + } + } + PrivacyManager * mgr = m_account->client()->privacyManager(); + mgr->setPrivacy( defaultDeny, allowList, denyList ); + } + else + errorNotConnected(); +} + +void GroupWisePrivacyDialog::errorNotConnected() +{ + KMessageBox::queuedMessageBox( this, KMessageBox::Information, + i18n( "You can only change privacy settings while you are logged in to the GroupWise Messenger server." ) , i18n("'%1' Not Logged In").arg( m_account->accountId() ) ); +} + +#include "gwprivacydialog.moc" diff --git a/kopete/protocols/groupwise/ui/gwprivacydialog.h b/kopete/protocols/groupwise/ui/gwprivacydialog.h new file mode 100644 index 00000000..a5467e47 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwprivacydialog.h @@ -0,0 +1,67 @@ +/* + Kopete Groupwise Protocol + gwprivacydialog.h - dialog summarising, and editing, the user's privacy settings + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 GWPRIVACYDIALOG_H +#define GWPRIVACYDIALOG_H + +#include <kdialogbase.h> + +class GroupWiseAccount; +class GroupWisePrivacyWidget; +class GroupWiseContactSearch; +class QListBoxItem; + +/** +Logic for the UI part managing the allow and deny lists, and the default privacy setting. + +@author Kopete Developers +*/ +class GroupWisePrivacyDialog : public KDialogBase +{ +Q_OBJECT +public: + GroupWisePrivacyDialog( GroupWiseAccount * account, QWidget * parent, const char * name ); + ~GroupWisePrivacyDialog(); +protected: + void commitChanges(); + void errorNotConnected(); + void disableWidgets(); + void populateWidgets(); + void updateButtonState(); +protected slots: + void slotAllowClicked(); + void slotBlockClicked(); + void slotAddClicked(); + void slotRemoveClicked(); + void slotAllowListClicked(); + void slotDenyListClicked(); + void slotPrivacyChanged(); + void slotSearchedForUsers(); + void slotOk(); + void slotApply(); + +private: + GroupWiseAccount * m_account; + GroupWisePrivacyWidget * m_privacy; + GroupWiseContactSearch * m_search; + QListBoxItem * m_defaultPolicy; + bool m_dirty; + KDialogBase * m_searchDlg; +}; + +#endif diff --git a/kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.cpp b/kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.cpp new file mode 100644 index 00000000..5b0b4014 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.cpp @@ -0,0 +1,77 @@ +/* + Kopete Groupwise Protocol + gwreceiveinvitationdialog.cpp - dialog shown when the user receives an invitation to chat + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 <qcheckbox.h> +#include <qlabel.h> + +#include <kconfig.h> +#include <klocale.h> +#include <kopetecontact.h> +#include <kopeteglobal.h> +#include <kopetemetacontact.h> +#include "client.h" +#include "gwaccount.h" +#include "gwcontact.h" +#include "gwerror.h" +#include "gwprotocol.h" +#include "gwshowinvitation.h" + +#include "gwreceiveinvitationdialog.h" + +ReceiveInvitationDialog::ReceiveInvitationDialog( GroupWiseAccount * account, const ConferenceEvent & event, QWidget *parent, const char *name) + : KDialogBase( i18n("Invitation to Conversation"), KDialogBase::Yes|KDialogBase::No, KDialogBase::Yes, KDialogBase::No, parent, name, false ) +{ + m_account = account; + m_guid = event.guid; + connect( this, SIGNAL( yesClicked() ), SLOT( slotYesClicked() ) ); + connect( this, SIGNAL( noClicked() ), SLOT( slotNoClicked() ) ); + + GroupWiseContact * c = account->contactForDN( event.user ); + + m_wid = new ShowInvitationWidget ( this ); + if ( c ) + m_wid->m_contactName->setText( c->metaContact()->displayName() ); + else //something is very wrong + m_wid->m_contactName->setText( event.user ); + + m_wid->m_dateTime->setText( KGlobal::locale()->formatDateTime( event.timeStamp ) ); + m_wid->m_message->setText( QString("<b>%1</b>").arg( event.message ) ); + + setMainWidget( m_wid ); +} + +ReceiveInvitationDialog::~ReceiveInvitationDialog() +{ +} + +void ReceiveInvitationDialog::slotYesClicked() +{ + m_account->client()->joinConference( m_guid ); + // save the state of always accept invitations + QString alwaysAccept = m_wid->cb_dontShowAgain->isChecked() ? "true" : "false"; + m_account->configGroup()->writeEntry( "AlwaysAcceptInvitations", alwaysAccept ); + deleteLater(); +} + +void ReceiveInvitationDialog::slotNoClicked() +{ + m_account->client()->rejectInvitation( m_guid ); + deleteLater(); +} + +#include "gwreceiveinvitationdialog.moc" diff --git a/kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.h b/kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.h new file mode 100644 index 00000000..0486c964 --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.h @@ -0,0 +1,48 @@ +/* + Kopete Groupwise Protocol + gwreceiveinvitationdialog.h - dialog shown when the user receives an invitation to chat + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 GWRECEIVEINVITATIONDIALOG_H +#define GWRECEIVEINVITATIONDIALOG_H + +#include <kdialogbase.h> + +class ShowInvitationWidget; + +/** +This is the dialog that is shown when you receive an invitation to chat. + +@author SUSE AG +*/ +class ReceiveInvitationDialog : public KDialogBase +{ +Q_OBJECT +public: + ReceiveInvitationDialog( GroupWiseAccount * account, const ConferenceEvent & event, QWidget *parent, const char *name ); + ~ReceiveInvitationDialog(); +signals: + void invitationAccepted( bool, const GroupWise::ConferenceGuid & guid ); +protected slots: + void slotYesClicked(); + void slotNoClicked(); +private: + GroupWiseAccount * m_account; + ConferenceGuid m_guid; // the conference we were invited to join. + ShowInvitationWidget * m_wid; +}; + +#endif diff --git a/kopete/protocols/groupwise/ui/gwsearch.cpp b/kopete/protocols/groupwise/ui/gwsearch.cpp new file mode 100644 index 00000000..1c80e3eb --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwsearch.cpp @@ -0,0 +1,281 @@ +/* + Kopete Groupwise Protocol + gwsearch.cpp - logic for server side search widget + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 <qcombobox.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qlistview.h> +#include <qpushbutton.h> +//#include <qvaluelist.h> + +#include <kdebug.h> +#include <klocale.h> + +#include <kopetemetacontact.h> + +#include "client.h" +#include "gwaccount.h" +#include "gwcontact.h" +#include "gwcontactproperties.h" +#include "gwprotocol.h" +#include "tasks/searchusertask.h" + +#include "gwsearch.h" + +class GWSearchResultsLVI : public QListViewItem +{ +public: + GWSearchResultsLVI( QListView * parent, GroupWise::ContactDetails details, int status, const QPixmap & statusPM/*, const QString & userId */) + : QListViewItem( parent, QString::null, details.givenName, details.surname, GroupWiseProtocol::protocol()->dnToDotted( details.dn ) ), m_details( details ), m_status( status ) + { + setPixmap( 0, statusPM ); + } + QString key( int column, bool ascending ) const + { + if ( column == 0 ) + return QString::number( 99 - m_status ); + else + return QListViewItem::key( column, ascending ); + } + GroupWise::ContactDetails m_details; + int m_status; +}; + +GroupWiseContactSearch::GroupWiseContactSearch( GroupWiseAccount * account, QListView::SelectionMode mode, bool onlineOnly, QWidget *parent, const char *name) + : GroupWiseContactSearchWidget(parent, name), m_account( account ), m_onlineOnly( onlineOnly ) +{ + m_results->setSelectionMode( mode ); + m_results->setAllColumnsShowFocus( true ); + connect( m_details, SIGNAL( clicked() ), SLOT( slotShowDetails() ) ); + connect( m_results, SIGNAL( selectionChanged() ), SLOT( slotValidateSelection() ) ); + connect( m_search, SIGNAL( clicked() ), SLOT( slotDoSearch() ) ); + connect( m_clear, SIGNAL( clicked() ), SLOT( slotClear() ) ); +} + + +GroupWiseContactSearch::~GroupWiseContactSearch() +{ +} + +void GroupWiseContactSearch::slotClear() +{ + m_firstName->clear(); + m_lastName->clear(); + m_userId->clear(); + m_title->clear(); + m_dept->clear(); +} + +void GroupWiseContactSearch::slotDoSearch() +{ + // build a query + QValueList< GroupWise::UserSearchQueryTerm > searchTerms; + if ( !m_firstName->text().isEmpty() ) + { + GroupWise::UserSearchQueryTerm arg; + arg.argument = m_firstName->text(); + arg.field = "Given Name"; + arg.operation = searchOperation( m_firstNameOperation->currentItem() ); + searchTerms.append( arg ); + } + if ( !m_lastName->text().isEmpty() ) + { + GroupWise::UserSearchQueryTerm arg; + arg.argument = m_lastName->text(); + arg.field = "Surname"; + arg.operation = searchOperation( m_lastNameOperation->currentItem() ); + searchTerms.append( arg ); + } + if ( !m_userId->text().isEmpty() ) + { + GroupWise::UserSearchQueryTerm arg; + arg.argument = m_userId->text(); + arg.field = NM_A_SZ_USERID; + arg.operation = searchOperation( m_userIdOperation->currentItem() ); + searchTerms.append( arg ); + } + if ( !m_title->text().isEmpty() ) + { + GroupWise::UserSearchQueryTerm arg; + arg.argument = m_title->text(); + arg.field = NM_A_SZ_TITLE; + arg.operation = searchOperation( m_titleOperation->currentItem() ); + searchTerms.append( arg ); + } + if ( !m_dept->text().isEmpty() ) + { + GroupWise::UserSearchQueryTerm arg; + arg.argument = m_dept->text(); + arg.field = NM_A_SZ_DEPARTMENT; + arg.operation = searchOperation( m_deptOperation->currentItem() ); + searchTerms.append( arg ); + } + if ( !searchTerms.isEmpty() ) + { + // start a search task + SearchUserTask * st = new SearchUserTask( m_account->client()->rootTask() ); + st->search( searchTerms ); + connect( st, SIGNAL( finished() ), SLOT( slotGotSearchResults() ) ); + st->go( true ); + m_matchCount->setText( i18n( "Searching" ) ); + } + else + { + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << "no query to perform!" << endl; + } + +} + +void GroupWiseContactSearch::slotShowDetails() +{ + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << endl; + // get the first selected result + QValueList< ContactDetails > selected = selectedResults(); + if ( selected.count() ) + { + // if they are already in our contact list, show that version + ContactDetails dt = selected.first(); + GroupWiseContact * c = m_account->contactForDN( dt.dn ); + if ( c ) + new GroupWiseContactProperties( c, this, "gwcontactproperties" ); + else + new GroupWiseContactProperties( dt, this, "gwcontactproperties" ); + } +} + +void GroupWiseContactSearch::slotGotSearchResults() +{ + kdDebug( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << endl; + SearchUserTask * st = ( SearchUserTask * ) sender(); + m_searchResults = st->results(); + + m_matchCount->setText( i18n( "1 matching user found", "%n matching users found", m_searchResults.count() ) ); + + m_results->clear(); + QValueList< GroupWise::ContactDetails >::Iterator it = m_searchResults.begin(); + QValueList< GroupWise::ContactDetails >::Iterator end = m_searchResults.end(); + for ( ; it != end; ++it ) + { + // it's necessary to change the status used for the LVIs, + // because the status returned by the server does not go linearly from Unknown to Available + // which is no use for us to sort on, and converting it to a Kopete::OnlineStatus is overkill here + int statusOrdered; + switch ( (*it).status ) + { + case 0: //unknown + statusOrdered = 0; + break; + case 1: //offline + statusOrdered = 1; + break; + case 2: //online + statusOrdered = 5; + break; + case 3: //busy + statusOrdered = 2; + break; + case 4: // away + statusOrdered = 3; + break; + case 5: //idle + statusOrdered = 4; + break; + default: + statusOrdered = 0; + break; + } + + new GWSearchResultsLVI( m_results, *it, statusOrdered, + m_account->protocol()->gwStatusToKOS( (*it).status ).iconFor( m_account ) ); + } + // if there was only one hit, select it + if ( m_results->childCount() == 1 ) + m_results->firstChild()->setSelected( true ); + + slotValidateSelection(); +} + +QValueList< GroupWise::ContactDetails > GroupWiseContactSearch::selectedResults() +{ + QValueList< GroupWise::ContactDetails > lst; + QListViewItemIterator it( m_results ); + while ( it.current() ) { + if ( it.current()->isSelected() ) + lst.append( static_cast< GWSearchResultsLVI * >( it.current() )->m_details ); + ++it; + } + return lst; +} +// GWSearchResultsLVI * selection = static_cast< GWSearchResultsLVI * >( m_results->selectedItem() ); +// contactId = selection->m_dn; +// if ( displayName.isEmpty() ) +// displayName = selection->text( 1 ) + " " + selection->text( 3 ); + + +unsigned char GroupWiseContactSearch::searchOperation( int comboIndex ) +{ + switch ( comboIndex ) + { + case 0: + return NMFIELD_METHOD_SEARCH; + case 1: + return NMFIELD_METHOD_MATCHBEGIN; + case 2: + return NMFIELD_METHOD_EQUAL; + } + return NMFIELD_METHOD_IGNORE; +} + +void GroupWiseContactSearch::slotValidateSelection() +{ + bool ok = false; + // if we only allow online contacts to be selected + if ( m_onlineOnly ) + { + // check that one of the selected items is online + QListViewItemIterator it( m_results ); + while ( it.current() ) + { + if ( it.current()->isSelected() && + !( static_cast< GWSearchResultsLVI * >( it.current() )->m_status == 1 ) ) + { + ok = true; + break; + } + ++it; + } + } + else + { + // check that at least one item is selected + QListViewItemIterator it( m_results ); + while ( it.current() ) + { + if ( it.current()->isSelected() ) + { + ok = true; + break; + } + ++it; + } + } + + emit selectionValidates( ok ); +} + +#include "gwsearch.moc" diff --git a/kopete/protocols/groupwise/ui/gwsearch.h b/kopete/protocols/groupwise/ui/gwsearch.h new file mode 100644 index 00000000..83ee205e --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwsearch.h @@ -0,0 +1,58 @@ +/* + Kopete Groupwise Protocol + gwsearch.h - logic for server side search widget + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library 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 GWSEARCH_H +#define GWSEARCH_H +#include <qlistview.h> +#include "gwcontactsearch.h" + +class GroupWiseAccount; +class GroupWiseContactProperties; +class GroupWiseContactSearchWidget; + +/** +Logic for searching for and displaying users and chat rooms using a GroupWiseContactSearchWidget + +@author SUSE Linux Products GmbH +*/ +class GroupWiseContactSearch : public GroupWiseContactSearchWidget +{ +Q_OBJECT +public: + GroupWiseContactSearch( GroupWiseAccount * account, QListView::SelectionMode mode, bool onlineOnly, + QWidget *parent = 0, const char *name = 0); + ~GroupWiseContactSearch(); + QValueList< GroupWise::ContactDetails > selectedResults(); +signals: + void selectionValidates( bool ); +protected: + unsigned char searchOperation( int comboIndex ); +protected slots: + void slotClear(); + void slotDoSearch(); + void slotGotSearchResults(); + // shows a GroupWiseContactProperties for the selected contact. Dialog's parent is this instance + void slotShowDetails(); + void slotValidateSelection(); +private: + QValueList< GroupWise::ContactDetails > m_searchResults; + GroupWiseAccount * m_account; + bool m_onlineOnly; +}; + +#endif diff --git a/kopete/protocols/groupwise/ui/gwshowinvitation.ui b/kopete/protocols/groupwise/ui/gwshowinvitation.ui new file mode 100644 index 00000000..28dd1a7d --- /dev/null +++ b/kopete/protocols/groupwise/ui/gwshowinvitation.ui @@ -0,0 +1,135 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ShowInvitationWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ShowInvitationWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>495</width> + <height>204</height> + </rect> + </property> + <property name="caption"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </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><p align="right">From:</p></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string><p align="right">Sent:</p></string> + </property> + </widget> + <widget class="QLabel" row="1" column="1"> + <property name="name"> + <cstring>m_dateTime</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>INVITE_DATE_TIME</string> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>m_contactName</cstring> + </property> + <property name="text"> + <string>CONTACT_NAME</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>m_message</cstring> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string>INVITE_MESSAGE</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="text"> + <string>Would you like to join the conversation?</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cb_dontShowAgain</cstring> + </property> + <property name="text"> + <string>A&lways accept invitations</string> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> |