From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/groupwise/ui/Makefile.am | 19 + .../protocols/groupwise/ui/gwaccountpreferences.ui | 320 +++++++++++++++++ kopete/protocols/groupwise/ui/gwaddcontactpage.cpp | 108 ++++++ kopete/protocols/groupwise/ui/gwaddcontactpage.h | 68 ++++ kopete/protocols/groupwise/ui/gwaddui.ui | 137 +++++++ .../protocols/groupwise/ui/gwchatpropsdialog.cpp | 122 +++++++ kopete/protocols/groupwise/ui/gwchatpropsdialog.h | 69 ++++ kopete/protocols/groupwise/ui/gwchatpropswidget.ui | 394 +++++++++++++++++++++ .../protocols/groupwise/ui/gwchatsearchdialog.cpp | 106 ++++++ kopete/protocols/groupwise/ui/gwchatsearchdialog.h | 49 +++ .../protocols/groupwise/ui/gwchatsearchwidget.ui | 116 ++++++ .../protocols/groupwise/ui/gwcontactproperties.cpp | 144 ++++++++ .../protocols/groupwise/ui/gwcontactproperties.h | 60 ++++ .../protocols/groupwise/ui/gwcontactpropswidget.ui | 211 +++++++++++ kopete/protocols/groupwise/ui/gwcontactsearch.ui | 386 ++++++++++++++++++++ .../protocols/groupwise/ui/gwcustomstatusedit.ui | 92 +++++ .../protocols/groupwise/ui/gwcustomstatuswidget.ui | 112 ++++++ .../protocols/groupwise/ui/gweditaccountwidget.cpp | 136 +++++++ .../protocols/groupwise/ui/gweditaccountwidget.h | 64 ++++ kopete/protocols/groupwise/ui/gwprivacy.ui | 193 ++++++++++ kopete/protocols/groupwise/ui/gwprivacydialog.cpp | 349 ++++++++++++++++++ kopete/protocols/groupwise/ui/gwprivacydialog.h | 67 ++++ .../groupwise/ui/gwreceiveinvitationdialog.cpp | 77 ++++ .../groupwise/ui/gwreceiveinvitationdialog.h | 48 +++ kopete/protocols/groupwise/ui/gwsearch.cpp | 281 +++++++++++++++ kopete/protocols/groupwise/ui/gwsearch.h | 58 +++ kopete/protocols/groupwise/ui/gwshowinvitation.ui | 135 +++++++ 27 files changed, 3921 insertions(+) create mode 100644 kopete/protocols/groupwise/ui/Makefile.am create mode 100644 kopete/protocols/groupwise/ui/gwaccountpreferences.ui create mode 100644 kopete/protocols/groupwise/ui/gwaddcontactpage.cpp create mode 100644 kopete/protocols/groupwise/ui/gwaddcontactpage.h create mode 100644 kopete/protocols/groupwise/ui/gwaddui.ui create mode 100644 kopete/protocols/groupwise/ui/gwchatpropsdialog.cpp create mode 100644 kopete/protocols/groupwise/ui/gwchatpropsdialog.h create mode 100644 kopete/protocols/groupwise/ui/gwchatpropswidget.ui create mode 100644 kopete/protocols/groupwise/ui/gwchatsearchdialog.cpp create mode 100644 kopete/protocols/groupwise/ui/gwchatsearchdialog.h create mode 100644 kopete/protocols/groupwise/ui/gwchatsearchwidget.ui create mode 100644 kopete/protocols/groupwise/ui/gwcontactproperties.cpp create mode 100644 kopete/protocols/groupwise/ui/gwcontactproperties.h create mode 100644 kopete/protocols/groupwise/ui/gwcontactpropswidget.ui create mode 100644 kopete/protocols/groupwise/ui/gwcontactsearch.ui create mode 100644 kopete/protocols/groupwise/ui/gwcustomstatusedit.ui create mode 100644 kopete/protocols/groupwise/ui/gwcustomstatuswidget.ui create mode 100644 kopete/protocols/groupwise/ui/gweditaccountwidget.cpp create mode 100644 kopete/protocols/groupwise/ui/gweditaccountwidget.h create mode 100644 kopete/protocols/groupwise/ui/gwprivacy.ui create mode 100644 kopete/protocols/groupwise/ui/gwprivacydialog.cpp create mode 100644 kopete/protocols/groupwise/ui/gwprivacydialog.h create mode 100644 kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.cpp create mode 100644 kopete/protocols/groupwise/ui/gwreceiveinvitationdialog.h create mode 100644 kopete/protocols/groupwise/ui/gwsearch.cpp create mode 100644 kopete/protocols/groupwise/ui/gwsearch.h create mode 100644 kopete/protocols/groupwise/ui/gwshowinvitation.ui (limited to 'kopete/protocols/groupwise/ui') 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 @@ + +GroupWiseAccountPreferences + + + GroupWiseAccountPreferences + + + + 0 + 0 + 366 + 404 + + + + Account Preferences - Groupwise + + + + unnamed + + + 0 + + + 0 + + + + tabWidget11 + + + + tab + + + B&asic Setup + + + + unnamed + + + + groupBox55 + + + Account Information + + + + unnamed + + + + layout1 + + + + unnamed + + + + textLabel1 + + + &User ID: + + + m_userId + + + The account name of your account. + + + The account name of your account. + + + + + m_userId + + + The account name of your account. + + + The account name of your account. + + + + + + + m_password + + + + + m_autoConnect + + + E&xclude from connect all + + + 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 + + + + + line1 + + + HLine + + + Sunken + + + Horizontal + + + + + layout66 + + + + unnamed + + + + labelServer + + + true + + + + 5 + 0 + 0 + 0 + + + + Ser&ver: + + + m_server + + + The IP address or hostname of the server you would like to connect to. + + + The IP address or hostname of the server you would like to connect to (for example im.yourcorp.com). + + + + + m_server + + + true + + + + + + The IP address or hostname of the server you would like to connect to. + + + The IP address or hostname of the server you would like to connect to (for example im.yourcorp.com). + + + + + labelPort + + + true + + + + 5 + 0 + 0 + 0 + + + + Po&rt: + + + m_port + + + The port on the server that you would like to connect to. + + + The port on the server that you would like to connect to (default is 5222). + + + + + m_port + + + true + + + + 0 + 0 + 0 + 0 + + + + UpDownArrows + + + 65535 + + + 1 + + + 8300 + + + The port on the server that you would like to connect to. + + + The port on the server that you would like to connect to (default is 5222). + + + + + + + + + + + TabPage + + + Advanced &Options + + + + unnamed + + + + m_alwaysAccept + + + A&lways accept invitations + + + + + spacer7 + + + Vertical + + + Expanding + + + + 20 + 91 + + + + + + + + + labelStatusMessage + + + + + + AlignCenter + + + + + + + Kopete::UI::PasswordWidget +
kopetepasswordwidget.h
+ + 50 + 50 + + 0 + + 1 + 0 + 0 + 0 + + image0 + changed() +
+
+ + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032949444154388db59531681b6714c77f32373c8186ef0305eea005093258900eca26d30e3174a8a807d1c9ee940e5d4a276f09a414e22974ee609a4c75a0857a70a20c199ce93424e43414aee0c26910dc8105f7410df706413a7c915551db049a3e38b87bf7bedffddfc7ff7d578be398456c6c6cbce13d441cc7b5da02fcf4e8e99bde7a8f899b501515d959f64e10e71cd949c6e8d508e6cb7cb050fae49727444d87ed08a566dc0cea545a621b96725e62c522f312c4929ff9e7725e6203439282ec0bc72f74150c30c927d89690163f539619a044564973a1980ae54c01c136a1db518a0024808942780dead16a27e7e0ca55949a81668023b242fcd2901c394663072cd408ad75e18b6d43a7076143710aa1b9049ccd326e064a5979e8f0191cfc5878544368af1b24807caa4cfe507ef8aea0bf6dd8b92de7f00bc1562c95e64416e297f216aadcfa3ca43f10da1f8243112286871507fb05c3c7059d568bde96c5885b01af2d6e4a2db10dc8ff128e0fdd39f4cbaf8576dbe170702afcf6b86467bbce57df8680f0d3230767e0e62bdc55c5e53c476742fabbc318437f209886c3cd41d4b0f74049c78ef21476ef5846cf7ded2831848d55f0aa62816caade11adb7ed2fa0f71ce9d8619ac2e627824a45a72b00e413c5a95c0cf63e052bbe2014bfa738c3de3d251dfb0f8a80fda04e6480600113cc558a11a0e10b93a9225886cff04a8d10868662eab87f37271e59f2136f85a855bfda15f9594eb7a3b4ae0b933f95e161c5ceed88f254e97f2ad49b75eedf8562e2d8fb264355314da1dbada866abe47fedb106d01f78b71fec170c8f7276ef58da3de8f64a76bf6f634283730e9d2b9b8390ce0dae565c6a8e04b0710b746678f8a8e0e18382d173a1d7151c909fe4e84ccf57be3e76245b115143584ee73f27afc8e80b4c667e4c37b7054c8be1afde0de978a9c63485fea0457cec70aa089015ab9297e0938c240573cdb7651a4a7f20f43feb304a72aac2e73bd723da1fe5746ec0682bc26070f38c345905d7e238f6077c00dd8f85280211fcd91af84b02ef94a50c004502c1394813252f14575ca09839242f9484cb42df31e763edd237ff31d6c0ffa3fe17f0fb86c7715cfb1ba8bd86cc8d2decd30000000049454e44ae426082 + + + +
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 + + Kopete (c) 2002-2003 by the Kopete developers + + ************************************************************************* + * * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#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( 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 + + Kopete (c) 2002-2003 by the Kopete developers + + ************************************************************************* + * * + * 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 + +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 @@ + +GroupWiseAddUI + + + GroupWiseAddUI + + + + 0 + 0 + 392 + 343 + + + + TestbedAddUI + + + + + + + unnamed + + + 0 + + + 0 + + + + m_tabWidget + + + + tab + + + &Basic + + + + unnamed + + + + bg_addMethod + + + Add Using + + + + unnamed + + + + m_userName + + + false + + + A full or partial name. Asterisks are ignored + + + Type some or all of the contact's name. Matches will be shown below + + + + + rb_userId + + + User &ID: + + + true + + + + + rb_userName + + + true + + + Userna&me: + + + + + m_userId + + + StrongFocus + + + A correct User ID + + + Use this field to add a contact if you already know the user's exact User ID + + + + + + + + + tab + + + Ad&vanced + + + + + + + + rb_userId + toggled(bool) + m_userId + setEnabled(bool) + + + rb_userName + toggled(bool) + m_userName + setEnabled(bool) + + + + 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 + + ************************************************************************* + * * + * 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 +#include +#include +#include + +#include +#include +#include +#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 + + ************************************************************************* + * * + * 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 + +#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 @@ + +GroupWiseChatPropsWidget + + + GroupWiseChatPropsWidget + + + + 0 + 0 + 493 + 425 + + + + GroupWiseChatPropertiesWidget + + + + unnamed + + + + m_displayName + + + DISPLAY NAME + + + + + layout16 + + + + unnamed + + + + m_creator + + + + + + true + + + The user who created the chatroom + + + + + textLabel10_2 + + + Query: + + + m_firstName_2 + + + + + lblTopic + + + Topic: + + + m_displayName + + + + + m_disclaimer + + + + + + false + + + A disclaimer for users entering the chatroom + + + + + m__2_2 + + + Owner: + + + m_displayName_3 + + + + + m_topic + + + + + + false + + + The current topic of the discussion + + + + + m_query + + + + + + true + + + UNKNOWN + + + + + textLabel11_2_2 + + + Maximum Users: + + + m_lastName_2_2 + + + + + m__2_2_2 + + + Created on: + + + m_displayName_3 + + + + + lbl_displayName_2 + + + Disclaimer: + + + m_displayName_2 + + + + + m_description + + + + + + true + + + General description of the chatroom + + + + + m_maxUsers + + + + + + true + + + Maximum simultaneous users allowed in the chatroom + + + + + textLabel10 + + + Creator: + + + m_firstName + + + + + textLabel11 + + + Description: + + + m_lastName + + + + + m_createdOn + + + + + + false + + + Date and time the chatroom was created + + + + + m_archive + + + Archived + + + + + + Indicates if the chatroom is being archived on the server + + + + + m_owner + + + + + + false + + + The user who owns this chatroom + + + + + line4 + + + HLine + + + Sunken + + + Horizontal + + + + + + + buttonGroup2 + + + Default Access + + + + unnamed + + + + m_chkRead + + + Read Message + + + + + + General permission to read messages in the chatroom + + + + + m_chkWrite + + + Write Message + + + + + + General permission to write messages in the chatroom + + + + + m_chkModify + + + Modify Access + + + + + + General permission to modify the chatroom's access control list + + + + + + + textLabel1 + + + Access Control List + + + kListBox1 + + + + + m_acl + + + Access permissions for specific users + + + + + layout15 + + + + unnamed + + + + m_btnAddAcl + + + A&dd + + + Add a new ACL entry + + + + + m_btnEditAcl + + + Ed&it + + + Edit an existing ACL entry + + + + + m_btnDeleteAcl + + + D&elete + + + Delete a ACL entry + + + + + + + + + klistbox.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + + 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 + + ************************************************************************* + * * + * 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 + +#include +#include + +#include +#include +#include +#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 + + ************************************************************************* + * * + * 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 + +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 @@ + +GroupWiseChatSearchWidget + + + GroupWiseChatSearchWidget + + + + 0 + 0 + 579 + 480 + + + + + unnamed + + + + + Chatroom + + + true + + + true + + + + + Owner + + + true + + + true + + + + + Members + + + true + + + true + + + + m_chatrooms + + + true + + + true + + + false + + + + + layout2 + + + + unnamed + + + + m_btnProperties + + + &Properties + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 340 + 20 + + + + + + m_btnRefresh + + + &Refresh + + + + + + + + + klistview.h + kpushbutton.h + + 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 + + ************************************************************************* + * * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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( 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 + + ************************************************************************* + * * + * 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 + +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 @@ + +GroupWiseContactPropsWidget + + + GroupWiseContactPropsWidget + + + + 0 + 0 + 373 + 444 + + + + + unnamed + + + + m_userId + + + + 5 + 5 + 3 + 0 + + + + USER_ID + + + + + line4 + + + HLine + + + Sunken + + + Horizontal + + + + + layout15 + + + + unnamed + + + + m_lastName + + + + + + true + + + Change the display name used for this contact + + + + + textLabel14 + + + Status: + + + + + m_displayName + + + + + + false + + + Change the display name used for this contact + + + + + m_status + + + USER_STATUS + + + + + textLabel10 + + + First name: + + + + + lbl_displayName + + + &Display name: + + + m_displayName + + + + + m_firstName + + + + + + true + + + Change the display name used for this contact + + + + + textLabel11 + + + Last name: + + + + + + + line1_2 + + + HLine + + + Sunken + + + Horizontal + + + + + textLabel15 + + + Additional properties: + + + + + + Property + + + true + + + true + + + + + Value + + + true + + + true + + + + m_propsView + + + true + + + AllColumns + + + true + + + false + + + + + + + klistview.h + + 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 @@ + +GroupWiseContactSearchWidget + + + GroupWiseContactSearchWidget + + + + 0 + 0 + 435 + 410 + + + + Search GroupWise Messenger + + + + unnamed + + + + layout13 + + + + unnamed + + + + textLabel1 + + + &First name + + + m_firstName + + + + + textLabel3 + + + &User ID + + + m_userId + + + + + textLabel4 + + + &Title + + + m_title + + + + + m_userId + + + + + m_firstName + + + + + textLabel5 + + + &Department + + + m_dept + + + + + + contains + + + + + begins with + + + + + equals + + + + m_userIdOperation + + + + + + contains + + + + + begins with + + + + + equals + + + + m_firstNameOperation + + + + + m_dept + + + + + + contains + + + + + begins with + + + + + equals + + + + m_lastNameOperation + + + + + textLabel2 + + + Last &name + + + m_lastName + + + + + m_clear + + + Cl&ear + + + + + + contains + + + + + begins with + + + + + equals + + + + m_deptOperation + + + + + m_title + + + + + m_lastName + + + + + m_search + + + &Search + + + true + + + + + + contains + + + + + begins with + + + + + equals + + + + m_titleOperation + + + + + + + line1 + + + HLine + + + Sunken + + + Horizontal + + + + + textLabel9 + + + &Results: + + + m_results + + + + + layout12 + + + + unnamed + + + + + Status + + + true + + + true + + + + + First Name + + + true + + + true + + + + + Last Name + + + true + + + true + + + + + User ID + + + true + + + true + + + + m_results + + + AutoOneFit + + + AllColumns + + + + + layout8 + + + + unnamed + + + + m_details + + + true + + + Detai&ls + + + + + spacer6 + + + Vertical + + + Expanding + + + + 20 + 141 + + + + + + + + + + m_matchCount + + + 0 matching users found + + + + + + m_firstName + m_lastNameOperation + m_lastName + m_userIdOperation + m_userId + m_titleOperation + m_title + m_deptOperation + m_dept + m_search + m_clear + m_results + m_details + m_firstNameOperation + + + 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 @@ + +GroupWiseCustomStatusEdit + + + GroupWiseCustomStatusEdit + + + + 0 + 0 + 260 + 113 + + + + + + + + unnamed + + + + layout3 + + + + unnamed + + + + m_name + + + LineEditPanel + + + Sunken + + + + + + + + m_cmbStatus + + + + + textLabel3 + + + &Status: + + + comboBox1 + + + + + textLabel2 + + + Awa&y message: + + + lineEdit2 + + + + + textLabel1 + + + &Name: + + + lineEdit1 + + + + + m_awayMessage + + + + + + + + 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 @@ + +GroupWiseCustomStatusWidget + + + GroupWiseCustomStatusWidget + + + + 0 + 0 + 343 + 215 + + + + + + + + unnamed + + + + + Name + + + true + + + true + + + + + Auto Reply + + + true + + + true + + + + m_list + + + true + + + true + + + + + layout2 + + + + unnamed + + + + m_btnAdd + + + &Add + + + + + m_btnEdit + + + &Edit + + + + + m_btnRemove + + + &Remove + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 41 + + + + + + + + + + klistview.h + + 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 + + Kopete (c) 2002-2003 by the Kopete developers + + ************************************************************************* + * * + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#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 + + Kopete (c) 2002-2003 by the Kopete developers + + ************************************************************************* + * * + * 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 +#include + +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 @@ + +GroupWisePrivacyWidget + + + GroupWisePrivacyWidget + + + + 0 + 0 + 463 + 314 + + + + + unnamed + + + + textLabel1 + + + Who can see my online status and send me messages: + + + + + layout11 + + + + unnamed + + + + layout9 + + + + unnamed + + + + textLabel2 + + + A&llowed + + + m_allowList + + + + + m_allowList + + + + + + + layout8 + + + + unnamed + + + + spacer9 + + + Vertical + + + Expanding + + + + 20 + 21 + + + + + + m_btnBlock + + + &Block >> + + + + + m_btnAllow + + + << Allo&w + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 53 + + + + + + m_btnAdd + + + A&dd... + + + + + m_btnRemove + + + &Remove + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 52 + + + + + + + + layout10 + + + + unnamed + + + + textLabel3 + + + Bloc&ked + + + m_denyList + + + + + m_denyList + + + + + + + + + m_status + + + + + + + + + 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 + + ************************************************************************* + * * + * 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 +#include +#include +#include +#include + +#include +#include +#include +#include + +#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( "" ); + 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( 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( 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 + + ************************************************************************* + * * + * 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 + +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 + + ************************************************************************* + * * + * 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 +#include + +#include +#include +#include +#include +#include +#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("%1").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 + + ************************************************************************* + * * + * 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 + +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 + + ************************************************************************* + * * + * 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 +#include +#include +#include +#include +//#include + +#include +#include + +#include + +#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 + + ************************************************************************* + * * + * 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 +#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 @@ + +ShowInvitationWidget + + + ShowInvitationWidget + + + + 0 + 0 + 495 + 204 + + + + + + + + unnamed + + + + layout13 + + + + unnamed + + + + textLabel1 + + + <p align="right">From:</p> + + + + + textLabel3 + + + <p align="right">Sent:</p> + + + + + m_dateTime + + + + 5 + 5 + 2 + 0 + + + + INVITE_DATE_TIME + + + + + m_contactName + + + CONTACT_NAME + + + + + + + m_message + + + Panel + + + Sunken + + + INVITE_MESSAGE + + + WordBreak|AlignVCenter + + + + + layout14 + + + + unnamed + + + + textLabel6 + + + Would you like to join the conversation? + + + + + spacer8 + + + Vertical + + + Expanding + + + + 20 + 31 + + + + + + + + cb_dontShowAgain + + + A&lways accept invitations + + + + + + -- cgit v1.2.1