summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-05 09:24:56 (UTC)
committer zautrix <zautrix>2004-07-05 09:24:56 (UTC)
commit5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0 (patch) (unidiff)
treef41b695d2b18bf7d7ff84d0d8b39faf15d229669
parentc2d4beeaeda44694a3e1c0b72a5808d2f518b286 (diff)
downloadkdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.zip
kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.gz
kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.bz2
Removed strange handling of addresseeeditor
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditordialog.cpp34
-rw-r--r--kaddressbook/addresseeeditordialog.h1
-rw-r--r--kaddressbook/kabcore.cpp44
-rw-r--r--kaddressbook/kabcore.h4
-rw-r--r--microkde/kdialogbase.cpp12
-rw-r--r--microkde/kdialogbase.h4
6 files changed, 50 insertions, 49 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index 102138e..790f148 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -1,129 +1,121 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qapplication.h>
25 26
26#include <kdebug.h> 27#include <kdebug.h>
27#include <klocale.h> 28#include <klocale.h>
28#include <kglobal.h> 29#include <kglobal.h>
29 30
30#include "addresseeeditorwidget.h" 31#include "addresseeeditorwidget.h"
31#include "kabcore.h" 32#include "kabcore.h"
32 33
33#include "addresseeeditordialog.h" 34#include "addresseeeditordialog.h"
34 35
35AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, 36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
36 const char *name ) 37 const char *name )
37 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), 38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
38 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, 39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
39 KDialogBase::Ok, parent, name, false ) 40 KDialogBase::Ok, parent, name, true )
40{ 41{
41#ifdef KAB_EMBEDDED
42 resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
43#endif //KAB_EMBEDDED
44 42
45 kdDebug(5720) << "AddresseeEditorDialog()" << endl;
46 43
47 QWidget *page = plainPage(); 44 QWidget *page = plainPage();
48 45
49 QVBoxLayout *layout = new QVBoxLayout( page ); 46 QVBoxLayout *layout = new QVBoxLayout( page );
50 47
51 mEditorWidget = new AddresseeEditorWidget( core, false, page ); 48 mEditorWidget = new AddresseeEditorWidget( core, false, page );
52 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), 49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
53 SLOT( widgetModified() ) ); 50 SLOT( widgetModified() ) );
54 layout->addWidget( mEditorWidget ); 51 layout->addWidget( mEditorWidget );
55 52
56 enableButton( KDialogBase::Apply, false ); 53 enableButton( KDialogBase::Apply, false );
54 if ( QApplication::desktop()->width() < 480 ) {
55 hideButtons();
56 }
57} 57}
58 58
59AddresseeEditorDialog::~AddresseeEditorDialog() 59AddresseeEditorDialog::~AddresseeEditorDialog()
60{ 60{
61 kdDebug(5720) << "~AddresseeEditorDialog()" << endl; 61 qDebug("----------------------------------------------- ");
62 62 //emit editorDestroyed( mEditorWidget->addressee().uid() );
63 emit editorDestroyed( mEditorWidget->addressee().uid() );
64} 63}
65 64
66void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) 65void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
67{ 66{
68 enableButton( KDialogBase::Apply, false ); 67 enableButton( KDialogBase::Apply, false );
69 68
70 mEditorWidget->setAddressee( addr ); 69 mEditorWidget->setAddressee( addr );
71} 70}
72 71
73KABC::Addressee AddresseeEditorDialog::addressee() 72KABC::Addressee AddresseeEditorDialog::addressee()
74{ 73{
75 return mEditorWidget->addressee(); 74 return mEditorWidget->addressee();
76} 75}
77 76
78bool AddresseeEditorDialog::dirty() 77bool AddresseeEditorDialog::dirty()
79{ 78{
80 return mEditorWidget->dirty(); 79 return mEditorWidget->dirty();
81} 80}
82 81
83void AddresseeEditorDialog::slotApply() 82void AddresseeEditorDialog::slotApply()
84{ 83{
85 if ( mEditorWidget->dirty() ) { 84 if ( mEditorWidget->dirty() ) {
86 mEditorWidget->save(); 85 mEditorWidget->save();
87 emit contactModified( mEditorWidget->addressee() ); 86 emit contactModified( mEditorWidget->addressee() );
88 } 87 }
89 88
90 enableButton( KDialogBase::Apply, false ); 89 enableButton( KDialogBase::Apply, false );
91 90
92 KDialogBase::slotApply(); 91 KDialogBase::slotApply();
93} 92}
94 93
94void AddresseeEditorDialog:: accept ()
95{
96 slotOk();
97
98}
95void AddresseeEditorDialog::slotOk() 99void AddresseeEditorDialog::slotOk()
96{ 100{
97 slotApply(); 101 slotApply();
98 102
99 KDialogBase::slotOk(); 103 KDialogBase::slotOk();
100 104
101 // Destroy this dialog
102#ifndef KAB_EMBEDDED
103 delayedDestruct();
104#else //KAB_EMBEDDED
105 delete this;
106#endif //KAB_EMBEDDED
107} 105}
108 106
109void AddresseeEditorDialog::widgetModified() 107void AddresseeEditorDialog::widgetModified()
110{ 108{
111 enableButton( KDialogBase::Apply, true ); 109 enableButton( KDialogBase::Apply, true );
112} 110}
113 111
114void AddresseeEditorDialog::slotCancel() 112void AddresseeEditorDialog::slotCancel()
115{ 113{
116 KDialogBase::slotCancel(); 114 KDialogBase::slotCancel();
117 115
118 // Destroy this dialog 116
119#ifndef KAB_EMBEDDED
120 delayedDestruct();
121#else //KAB_EMBEDDED
122 delete this;
123#endif //KAB_EMBEDDED
124
125} 117}
126 118
127#ifndef KAB_EMBEDDED 119#ifndef KAB_EMBEDDED
128#include "addresseeeditordialog.moc" 120#include "addresseeeditordialog.moc"
129#endif //KAB_EMBEDDED 121#endif //KAB_EMBEDDED
diff --git a/kaddressbook/addresseeeditordialog.h b/kaddressbook/addresseeeditordialog.h
index 1a00d3a..a1521e2 100644
--- a/kaddressbook/addresseeeditordialog.h
+++ b/kaddressbook/addresseeeditordialog.h
@@ -1,62 +1,63 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef ADDRESSEEEDITORDIALOG_H 24#ifndef ADDRESSEEEDITORDIALOG_H
25#define ADDRESSEEEDITORDIALOG_H 25#define ADDRESSEEEDITORDIALOG_H
26 26
27#include <kdialogbase.h> 27#include <kdialogbase.h>
28 28
29#include <kabc/addressbook.h> 29#include <kabc/addressbook.h>
30 30
31class AddresseeEditorWidget; 31class AddresseeEditorWidget;
32class QWidget; 32class QWidget;
33class KABCore; 33class KABCore;
34 34
35class AddresseeEditorDialog : public KDialogBase 35class AddresseeEditorDialog : public KDialogBase
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 38
39 public: 39 public:
40 AddresseeEditorDialog( KABCore *core, QWidget *parent, const char *name = 0 ); 40 AddresseeEditorDialog( KABCore *core, QWidget *parent, const char *name = 0 );
41 ~AddresseeEditorDialog(); 41 ~AddresseeEditorDialog();
42 42
43 void setAddressee( const KABC::Addressee& ); 43 void setAddressee( const KABC::Addressee& );
44 KABC::Addressee addressee(); 44 KABC::Addressee addressee();
45 45
46 bool dirty(); 46 bool dirty();
47 47
48 signals: 48 signals:
49 void contactModified( const KABC::Addressee& ); 49 void contactModified( const KABC::Addressee& );
50 void editorDestroyed( const QString& ); 50 void editorDestroyed( const QString& );
51 51
52 protected slots: 52 protected slots:
53 virtual void slotApply(); 53 virtual void slotApply();
54 virtual void slotOk(); 54 virtual void slotOk();
55 virtual void slotCancel(); 55 virtual void slotCancel();
56 virtual void accept () ;
56 void widgetModified(); 57 void widgetModified();
57 58
58 private: 59 private:
59 AddresseeEditorWidget *mEditorWidget; 60 AddresseeEditorWidget *mEditorWidget;
60}; 61};
61 62
62#endif 63#endif
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8d08713..b06e1bc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,1492 +1,1486 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include "kabcore.h" 24#include "kabcore.h"
25 25
26#include <stdaddressbook.h> 26#include <stdaddressbook.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#include <qclipboard.h> 30#include <qclipboard.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplicaton.h> 33#include <qapplicaton.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qvbox.h> 36#include <qvbox.h>
37#include <kabc/addresseelist.h> 37#include <kabc/addresseelist.h>
38#include <kabc/errorhandler.h> 38#include <kabc/errorhandler.h>
39#include <kabc/resource.h> 39#include <kabc/resource.h>
40#include <kabc/vcardconverter.h> 40#include <kabc/vcardconverter.h>
41#include <kapplication.h> 41#include <kapplication.h>
42#include <kactionclasses.h> 42#include <kactionclasses.h>
43#include <kcmultidialog.h> 43#include <kcmultidialog.h>
44#include <kdebug.h> 44#include <kdebug.h>
45#include <kdeversion.h> 45#include <kdeversion.h>
46#include <kkeydialog.h> 46#include <kkeydialog.h>
47#include <kmessagebox.h> 47#include <kmessagebox.h>
48#include <kprinter.h> 48#include <kprinter.h>
49#include <kprotocolinfo.h> 49#include <kprotocolinfo.h>
50#include <kresources/selectdialog.h> 50#include <kresources/selectdialog.h>
51#include <kstandarddirs.h> 51#include <kstandarddirs.h>
52#include <ktempfile.h> 52#include <ktempfile.h>
53#include <kxmlguiclient.h> 53#include <kxmlguiclient.h>
54#include <kaboutdata.h> 54#include <kaboutdata.h>
55#include <libkdepim/categoryselectdialog.h> 55#include <libkdepim/categoryselectdialog.h>
56 56
57#include "addresseeutil.h" 57#include "addresseeutil.h"
58#include "addresseeeditordialog.h" 58#include "addresseeeditordialog.h"
59#include "extensionmanager.h" 59#include "extensionmanager.h"
60#include "kstdaction.h" 60#include "kstdaction.h"
61#include "kaddressbookservice.h" 61#include "kaddressbookservice.h"
62#include "ldapsearchdialog.h" 62#include "ldapsearchdialog.h"
63#include "printing/printingwizard.h" 63#include "printing/printingwizard.h"
64#else // KAB_EMBEDDED 64#else // KAB_EMBEDDED
65 65
66#include <kapplication.h>
66#include "KDGanttMinimizeSplitter.h" 67#include "KDGanttMinimizeSplitter.h"
67#include "kaddressbookmain.h" 68#include "kaddressbookmain.h"
68#include "kactioncollection.h" 69#include "kactioncollection.h"
69#include <qapp.h> 70#include <qapp.h>
70#include <qmenubar.h> 71#include <qmenubar.h>
71//#include <qtoolbar.h> 72//#include <qtoolbar.h>
72#include <qmessagebox.h> 73#include <qmessagebox.h>
73#include <kdebug.h> 74#include <kdebug.h>
74#include <kiconloader.h> // needed for SmallIcon 75#include <kiconloader.h> // needed for SmallIcon
75#include <kresources/kcmkresources.h> 76#include <kresources/kcmkresources.h>
76#include <ktoolbar.h> 77#include <ktoolbar.h>
77 78
78#include <kcmkabconfig.h> 79#include <kcmkabconfig.h>
79 80
80//US#include <qpe/resource.h> // needed for Resource::loadPixmap 81//US#include <qpe/resource.h> // needed for Resource::loadPixmap
81//#include <qlabel.h> 82//#include <qlabel.h>
82#endif // KAB_EMBEDDED 83#endif // KAB_EMBEDDED
83#include <kcmkabconfig.h> 84#include <kcmkabconfig.h>
84 85
85 86
86#include <kresources/selectdialog.h> 87#include <kresources/selectdialog.h>
87#include <kmessagebox.h> 88#include <kmessagebox.h>
88 89
89#include <picture.h> 90#include <picture.h>
90#include <resource.h> 91#include <resource.h>
91 92
92//US#include <qsplitter.h> 93//US#include <qsplitter.h>
93#include <qvbox.h> 94#include <qvbox.h>
94#include <qlayout.h> 95#include <qlayout.h>
95#include <qclipboard.h> 96#include <qclipboard.h>
96 97
97#include <libkdepim/categoryselectdialog.h> 98#include <libkdepim/categoryselectdialog.h>
98 99
99#include "addresseeutil.h" 100#include "addresseeutil.h"
100#include "undocmds.h" 101#include "undocmds.h"
101#include "addresseeeditordialog.h" 102#include "addresseeeditordialog.h"
102#include "viewmanager.h" 103#include "viewmanager.h"
103#include "details/detailsviewcontainer.h" 104#include "details/detailsviewcontainer.h"
104#include "kabprefs.h" 105#include "kabprefs.h"
105#include "xxportmanager.h" 106#include "xxportmanager.h"
106#include "incsearchwidget.h" 107#include "incsearchwidget.h"
107#include "jumpbuttonbar.h" 108#include "jumpbuttonbar.h"
108#include "extensionmanager.h" 109#include "extensionmanager.h"
109#include "addresseeconfig.h" 110#include "addresseeconfig.h"
110#include <kcmultidialog.h> 111#include <kcmultidialog.h>
111 112
112 113
113#ifdef KAB_EMBEDDED 114#ifdef KAB_EMBEDDED
114KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 115KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
115 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 116 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
116 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 117 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
117 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 118 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
118#else //KAB_EMBEDDED 119#else //KAB_EMBEDDED
119KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 120KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
120 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 121 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
121 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 122 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
122 mReadWrite( readWrite ), mModified( false ) 123 mReadWrite( readWrite ), mModified( false )
123#endif //KAB_EMBEDDED 124#endif //KAB_EMBEDDED
124{ 125{
125#ifdef KAB_EMBEDDED 126#ifdef KAB_EMBEDDED
126 //US we define here our own global actioncollection. 127 //US we define here our own global actioncollection.
127 //mActionCollection = new KActionCollection(this); 128 //mActionCollection = new KActionCollection(this);
128#endif //KAB_EMBEDDED 129#endif //KAB_EMBEDDED
129 mExtensionBarSplitter = 0; 130 mExtensionBarSplitter = 0;
130 mIsPart = !parent->inherits( "KAddressBookMain" ); 131 mIsPart = !parent->inherits( "KAddressBookMain" );
131 132
132 mAddressBook = KABC::StdAddressBook::self(); 133 mAddressBook = KABC::StdAddressBook::self();
133 KABC::StdAddressBook::setAutomaticSave( true ); 134 KABC::StdAddressBook::setAutomaticSave( true );
134 135
135#ifndef KAB_EMBEDDED 136#ifndef KAB_EMBEDDED
136 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 137 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
137#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
138 139
139 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 140 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
140 SLOT( addressBookChanged() ) ); 141 SLOT( addressBookChanged() ) );
141 142
142 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 143 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
143 "X-Department", "KADDRESSBOOK" ); 144 "X-Department", "KADDRESSBOOK" );
144 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 145 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
145 "X-Profession", "KADDRESSBOOK" ); 146 "X-Profession", "KADDRESSBOOK" );
146 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 147 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
147 "X-AssistantsName", "KADDRESSBOOK" ); 148 "X-AssistantsName", "KADDRESSBOOK" );
148 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 149 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
149 "X-ManagersName", "KADDRESSBOOK" ); 150 "X-ManagersName", "KADDRESSBOOK" );
150 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 151 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
151 "X-SpousesName", "KADDRESSBOOK" ); 152 "X-SpousesName", "KADDRESSBOOK" );
152 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 153 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
153 "X-Office", "KADDRESSBOOK" ); 154 "X-Office", "KADDRESSBOOK" );
154 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 155 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
155 "X-IMAddress", "KADDRESSBOOK" ); 156 "X-IMAddress", "KADDRESSBOOK" );
156 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 157 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
157 "X-Anniversary", "KADDRESSBOOK" ); 158 "X-Anniversary", "KADDRESSBOOK" );
158 159
159//US added this field to become compatible with Opie addressbook 160//US added this field to become compatible with Opie addressbook
160 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 161 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
161 "X-Gender", "KADDRESSBOOK" ); 162 "X-Gender", "KADDRESSBOOK" );
162 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 163 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
163 "X-Children", "KADDRESSBOOK" ); 164 "X-Children", "KADDRESSBOOK" );
164 165
165 initGUI(); 166 initGUI();
166 167
167 mIncSearchWidget->setFocus(); 168 mIncSearchWidget->setFocus();
168 169
169 170
170 connect( mViewManager, SIGNAL( selected( const QString& ) ), 171 connect( mViewManager, SIGNAL( selected( const QString& ) ),
171 SLOT( setContactSelected( const QString& ) ) ); 172 SLOT( setContactSelected( const QString& ) ) );
172 connect( mViewManager, SIGNAL( executed( const QString& ) ), 173 connect( mViewManager, SIGNAL( executed( const QString& ) ),
173 SLOT( editContact( const QString& ) ) ); 174 SLOT( editContact( const QString& ) ) );
174 connect( mViewManager, SIGNAL( deleteRequest( ) ), 175 connect( mViewManager, SIGNAL( deleteRequest( ) ),
175 SLOT( deleteContacts( ) ) ); 176 SLOT( deleteContacts( ) ) );
176 connect( mViewManager, SIGNAL( modified() ), 177 connect( mViewManager, SIGNAL( modified() ),
177 SLOT( setModified() ) ); 178 SLOT( setModified() ) );
178 179
179 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 180 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
180 181
181 connect( mXXPortManager, SIGNAL( modified() ), 182 connect( mXXPortManager, SIGNAL( modified() ),
182 SLOT( setModified() ) ); 183 SLOT( setModified() ) );
183 184
184 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 185 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
185 SLOT( incrementalSearch( const QString& ) ) ); 186 SLOT( incrementalSearch( const QString& ) ) );
186 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 187 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
187 mJumpButtonBar, SLOT( recreateButtons() ) ); 188 mJumpButtonBar, SLOT( recreateButtons() ) );
188 189
189#ifndef KAB_EMBEDDED 190#ifndef KAB_EMBEDDED
190 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 191 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
191 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 192 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
192 193
193 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 194 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
194 SLOT( sendMail( const QString& ) ) ); 195 SLOT( sendMail( const QString& ) ) );
195 connect( mDetails, SIGNAL( browse( const QString& ) ), 196 connect( mDetails, SIGNAL( browse( const QString& ) ),
196 SLOT( browse( const QString& ) ) ); 197 SLOT( browse( const QString& ) ) );
197 198
198 mAddressBookService = new KAddressBookService( this ); 199 mAddressBookService = new KAddressBookService( this );
199 200
200#endif //KAB_EMBEDDED 201#endif //KAB_EMBEDDED
201 202 mEditorDialog = 0;
203 createAddresseeEditorDialog( this );
202 setModified( false ); 204 setModified( false );
203} 205}
204 206
205KABCore::~KABCore() 207KABCore::~KABCore()
206{ 208{
207 // save(); 209 // save();
208 //saveSettings(); 210 //saveSettings();
209 //KABPrefs::instance()->writeConfig(); 211 //KABPrefs::instance()->writeConfig();
210 delete AddresseeConfig::instance(); 212 delete AddresseeConfig::instance();
211 mAddressBook = 0; 213 mAddressBook = 0;
212 KABC::StdAddressBook::close(); 214 KABC::StdAddressBook::close();
213 215
214#ifdef KAB_EMBEDDED 216#ifdef KAB_EMBEDDED
215 //US we define here our own global actioncollection. 217 //US we define here our own global actioncollection.
216 // delete mActionCollection; 218 // delete mActionCollection;
217#endif //KAB_EMBEDDED 219#endif //KAB_EMBEDDED
218 220
219} 221}
220 222
221void KABCore::restoreSettings() 223void KABCore::restoreSettings()
222{ 224{
223 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 225 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
224 226
225 mActionJumpBar->setChecked( state ); 227 mActionJumpBar->setChecked( state );
226 setJumpButtonBarVisible( state ); 228 setJumpButtonBarVisible( state );
227 229
228 state = KABPrefs::instance()->mDetailsPageVisible; 230 state = KABPrefs::instance()->mDetailsPageVisible;
229 231
230 mActionDetails->setChecked( state ); 232 mActionDetails->setChecked( state );
231 setDetailsVisible( state ); 233 setDetailsVisible( state );
232 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 234 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
233 if ( splitterSize.count() == 0 ) { 235 if ( splitterSize.count() == 0 ) {
234 splitterSize.append( width() / 2 ); 236 splitterSize.append( width() / 2 );
235 splitterSize.append( width() / 2 ); 237 splitterSize.append( width() / 2 );
236 } 238 }
237 mMiniSplitter->setSizes( splitterSize ); 239 mMiniSplitter->setSizes( splitterSize );
238 if ( mExtensionBarSplitter ) { 240 if ( mExtensionBarSplitter ) {
239 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 241 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
240 if ( splitterSize.count() == 0 ) { 242 if ( splitterSize.count() == 0 ) {
241 splitterSize.append( width() / 2 ); 243 splitterSize.append( width() / 2 );
242 splitterSize.append( width() / 2 ); 244 splitterSize.append( width() / 2 );
243 } 245 }
244 mExtensionBarSplitter->setSizes( splitterSize ); 246 mExtensionBarSplitter->setSizes( splitterSize );
245 247
246 } 248 }
247#ifndef KAB_EMBEDDED 249#ifndef KAB_EMBEDDED
248 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 250 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
249 if ( splitterSize.count() == 0 ) { 251 if ( splitterSize.count() == 0 ) {
250 splitterSize.append( width() / 2 ); 252 splitterSize.append( width() / 2 );
251 splitterSize.append( width() / 2 ); 253 splitterSize.append( width() / 2 );
252 } 254 }
253 mExtensionBarSplitter->setSizes( splitterSize ); 255 mExtensionBarSplitter->setSizes( splitterSize );
254 256
255 splitterSize = KABPrefs::instance()->mDetailsSplitter; 257 splitterSize = KABPrefs::instance()->mDetailsSplitter;
256 if ( splitterSize.count() == 0 ) { 258 if ( splitterSize.count() == 0 ) {
257 splitterSize.append( height() / 2 ); 259 splitterSize.append( height() / 2 );
258 splitterSize.append( height() / 2 ); 260 splitterSize.append( height() / 2 );
259 } 261 }
260 mDetailsSplitter->setSizes( splitterSize ); 262 mDetailsSplitter->setSizes( splitterSize );
261 263
262 mExtensionManager->restoreSettings(); 264 mExtensionManager->restoreSettings();
263 265
264#endif //KAB_EMBEDDED 266#endif //KAB_EMBEDDED
265 267
266 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 268 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
267 269
268 mViewManager->restoreSettings(); 270 mViewManager->restoreSettings();
269 mExtensionManager->restoreSettings(); 271 mExtensionManager->restoreSettings();
270} 272}
271 273
272void KABCore::saveSettings() 274void KABCore::saveSettings()
273{ 275{
274 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 276 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
275 if ( mExtensionBarSplitter ) 277 if ( mExtensionBarSplitter )
276 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 278 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
277 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 279 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
278 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 280 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
279#ifndef KAB_EMBEDDED 281#ifndef KAB_EMBEDDED
280 282
281 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 283 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
282 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 284 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
283#endif //KAB_EMBEDDED 285#endif //KAB_EMBEDDED
284 mExtensionManager->saveSettings(); 286 mExtensionManager->saveSettings();
285 mViewManager->saveSettings(); 287 mViewManager->saveSettings();
286 288
287 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 289 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
288 290
289} 291}
290 292
291KABC::AddressBook *KABCore::addressBook() const 293KABC::AddressBook *KABCore::addressBook() const
292{ 294{
293 return mAddressBook; 295 return mAddressBook;
294} 296}
295 297
296KConfig *KABCore::config() 298KConfig *KABCore::config()
297{ 299{
298#ifndef KAB_EMBEDDED 300#ifndef KAB_EMBEDDED
299 return KABPrefs::instance()->config(); 301 return KABPrefs::instance()->config();
300#else //KAB_EMBEDDED 302#else //KAB_EMBEDDED
301 return KABPrefs::instance()->getConfig(); 303 return KABPrefs::instance()->getConfig();
302#endif //KAB_EMBEDDED 304#endif //KAB_EMBEDDED
303} 305}
304 306
305KActionCollection *KABCore::actionCollection() const 307KActionCollection *KABCore::actionCollection() const
306{ 308{
307 return mGUIClient->actionCollection(); 309 return mGUIClient->actionCollection();
308} 310}
309 311
310KABC::Field *KABCore::currentSearchField() const 312KABC::Field *KABCore::currentSearchField() const
311{ 313{
312 if (mIncSearchWidget) 314 if (mIncSearchWidget)
313 return mIncSearchWidget->currentField(); 315 return mIncSearchWidget->currentField();
314 else 316 else
315 return 0; 317 return 0;
316} 318}
317 319
318QStringList KABCore::selectedUIDs() const 320QStringList KABCore::selectedUIDs() const
319{ 321{
320 return mViewManager->selectedUids(); 322 return mViewManager->selectedUids();
321} 323}
322 324
323KABC::Resource *KABCore::requestResource( QWidget *parent ) 325KABC::Resource *KABCore::requestResource( QWidget *parent )
324{ 326{
325 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 327 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
326 328
327 QPtrList<KRES::Resource> kresResources; 329 QPtrList<KRES::Resource> kresResources;
328 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 330 QPtrListIterator<KABC::Resource> resIt( kabcResources );
329 KABC::Resource *resource; 331 KABC::Resource *resource;
330 while ( ( resource = resIt.current() ) != 0 ) { 332 while ( ( resource = resIt.current() ) != 0 ) {
331 ++resIt; 333 ++resIt;
332 if ( !resource->readOnly() ) { 334 if ( !resource->readOnly() ) {
333 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 335 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
334 if ( res ) 336 if ( res )
335 kresResources.append( res ); 337 kresResources.append( res );
336 } 338 }
337 } 339 }
338 340
339 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 341 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
340 return static_cast<KABC::Resource*>( res ); 342 return static_cast<KABC::Resource*>( res );
341} 343}
342 344
343#ifndef KAB_EMBEDDED 345#ifndef KAB_EMBEDDED
344KAboutData *KABCore::createAboutData() 346KAboutData *KABCore::createAboutData()
345#else //KAB_EMBEDDED 347#else //KAB_EMBEDDED
346void KABCore::createAboutData() 348void KABCore::createAboutData()
347#endif //KAB_EMBEDDED 349#endif //KAB_EMBEDDED
348{ 350{
349#ifndef KAB_EMBEDDED 351#ifndef KAB_EMBEDDED
350 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 352 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
351 "3.1", I18N_NOOP( "The KDE Address Book" ), 353 "3.1", I18N_NOOP( "The KDE Address Book" ),
352 KAboutData::License_GPL_V2, 354 KAboutData::License_GPL_V2,
353 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 355 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
354 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 356 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
355 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 357 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
356 about->addAuthor( "Cornelius Schumacher", 358 about->addAuthor( "Cornelius Schumacher",
357 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 359 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
358 "schumacher@kde.org" ); 360 "schumacher@kde.org" );
359 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 361 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
360 "mpilone@slac.com" ); 362 "mpilone@slac.com" );
361 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 363 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
362 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 364 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
363 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 365 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
364 "michel@klaralvdalens-datakonsult.se" ); 366 "michel@klaralvdalens-datakonsult.se" );
365 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 367 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
366 "hansen@kde.org" ); 368 "hansen@kde.org" );
367 369
368 return about; 370 return about;
369#endif //KAB_EMBEDDED 371#endif //KAB_EMBEDDED
370 372
371 QString version; 373 QString version;
372#include <../version> 374#include <../version>
373 QMessageBox::about( this, "About KAddressbook/Pi", 375 QMessageBox::about( this, "About KAddressbook/Pi",
374 "KAddressbook/Platform-independent\n" 376 "KAddressbook/Platform-independent\n"
375 "(KA/Pi) " +version + " - " + 377 "(KA/Pi) " +version + " - " +
376#ifdef DESKTOP_VERSION 378#ifdef DESKTOP_VERSION
377 "Desktop Edition\n" 379 "Desktop Edition\n"
378#else 380#else
379 "PDA-Edition\n" 381 "PDA-Edition\n"
380 "for: Zaurus 5500 / 7x0 / 8x0\n" 382 "for: Zaurus 5500 / 7x0 / 8x0\n"
381#endif 383#endif
382 384
383 "(c) 2004 Ulf Schenk\n" 385 "(c) 2004 Ulf Schenk\n"
384 "(c) 1997-2003, The KDE PIM Team\n" 386 "(c) 1997-2003, The KDE PIM Team\n"
385 "Tobias Koenig Current maintainer tokoe@kde.org\n" 387 "Tobias Koenig Current maintainer tokoe@kde.org\n"
386 "Don Sanders Original author\n" 388 "Don Sanders Original author\n"
387 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 389 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
388 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 390 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
389 "Greg Stern DCOP interface\n" 391 "Greg Stern DCOP interface\n"
390 "Mark Westcot Contact pinning\n" 392 "Mark Westcot Contact pinning\n"
391 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 393 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
392 "Steffen Hansen LDAP Lookup hansen@kde.org\n" ); 394 "Steffen Hansen LDAP Lookup hansen@kde.org\n" );
393} 395}
394 396
395void KABCore::setContactSelected( const QString &uid ) 397void KABCore::setContactSelected( const QString &uid )
396{ 398{
397 KABC::Addressee addr = mAddressBook->findByUid( uid ); 399 KABC::Addressee addr = mAddressBook->findByUid( uid );
398 if ( !mDetails->isHidden() ) 400 if ( !mDetails->isHidden() )
399 mDetails->setAddressee( addr ); 401 mDetails->setAddressee( addr );
400 402
401 if ( !addr.isEmpty() ) { 403 if ( !addr.isEmpty() ) {
402 emit contactSelected( addr.formattedName() ); 404 emit contactSelected( addr.formattedName() );
403 KABC::Picture pic = addr.photo(); 405 KABC::Picture pic = addr.photo();
404 if ( pic.isIntern() ) { 406 if ( pic.isIntern() ) {
405//US emit contactSelected( pic.data() ); 407//US emit contactSelected( pic.data() );
406//US instead use: 408//US instead use:
407 QPixmap px; 409 QPixmap px;
408 if (pic.data().isNull() != true) 410 if (pic.data().isNull() != true)
409 { 411 {
410 px.convertFromImage(pic.data()); 412 px.convertFromImage(pic.data());
411 } 413 }
412 414
413 emit contactSelected( px ); 415 emit contactSelected( px );
414 } 416 }
415 } 417 }
416 418
417 419
418 mExtensionManager->setSelectionChanged(); 420 mExtensionManager->setSelectionChanged();
419 421
420 // update the actions 422 // update the actions
421 bool selected = !uid.isEmpty(); 423 bool selected = !uid.isEmpty();
422 424
423 if ( mReadWrite ) { 425 if ( mReadWrite ) {
424 mActionCut->setEnabled( selected ); 426 mActionCut->setEnabled( selected );
425 mActionPaste->setEnabled( selected ); 427 mActionPaste->setEnabled( selected );
426 } 428 }
427 429
428 mActionCopy->setEnabled( selected ); 430 mActionCopy->setEnabled( selected );
429 mActionDelete->setEnabled( selected ); 431 mActionDelete->setEnabled( selected );
430 mActionEditAddressee->setEnabled( selected ); 432 mActionEditAddressee->setEnabled( selected );
431 mActionMail->setEnabled( selected ); 433 mActionMail->setEnabled( selected );
432 mActionMailVCard->setEnabled( selected ); 434 mActionMailVCard->setEnabled( selected );
433 mActionWhoAmI->setEnabled( selected ); 435 mActionWhoAmI->setEnabled( selected );
434 mActionCategories->setEnabled( selected ); 436 mActionCategories->setEnabled( selected );
435} 437}
436 438
437void KABCore::sendMail() 439void KABCore::sendMail()
438{ 440{
439#ifndef KAB_EMBEDDED 441#ifndef KAB_EMBEDDED
440 sendMail( mViewManager->selectedEmails().join( ", " ) ); 442 sendMail( mViewManager->selectedEmails().join( ", " ) );
441#else //KAB_EMBEDDED 443#else //KAB_EMBEDDED
442 qDebug("KABCore::sendMail() ust be fixed"); 444 qDebug("KABCore::sendMail() ust be fixed");
443#endif //KAB_EMBEDDED 445#endif //KAB_EMBEDDED
444} 446}
445 447
446void KABCore::sendMail( const QString& email ) 448void KABCore::sendMail( const QString& email )
447{ 449{
448#ifndef KAB_EMBEDDED 450#ifndef KAB_EMBEDDED
449 kapp->invokeMailer( email, "" ); 451 kapp->invokeMailer( email, "" );
450#else //KAB_EMBEDDED 452#else //KAB_EMBEDDED
451 qDebug("KABCore::sendMail(const QString& email) ust be fixed"); 453 qDebug("KABCore::sendMail(const QString& email) ust be fixed");
452#endif //KAB_EMBEDDED 454#endif //KAB_EMBEDDED
453} 455}
454 456
455void KABCore::mailVCard() 457void KABCore::mailVCard()
456{ 458{
457#ifndef KAB_EMBEDDED 459#ifndef KAB_EMBEDDED
458 QStringList uids = mViewManager->selectedUids(); 460 QStringList uids = mViewManager->selectedUids();
459 if ( !uids.isEmpty() ) 461 if ( !uids.isEmpty() )
460 mailVCard( uids ); 462 mailVCard( uids );
461#else //KAB_EMBEDDED 463#else //KAB_EMBEDDED
462 qDebug("KABCore::mailVCard() must be fixed"); 464 qDebug("KABCore::mailVCard() must be fixed");
463#endif //KAB_EMBEDDED 465#endif //KAB_EMBEDDED
464} 466}
465 467
466void KABCore::mailVCard( const QStringList& uids ) 468void KABCore::mailVCard( const QStringList& uids )
467{ 469{
468#ifndef KAB_EMBEDDED 470#ifndef KAB_EMBEDDED
469 QStringList urls; 471 QStringList urls;
470 472
471 // Create a temp dir, so that we can put the files in it with proper names 473 // Create a temp dir, so that we can put the files in it with proper names
472 KTempFile tempDir; 474 KTempFile tempDir;
473 if ( tempDir.status() != 0 ) { 475 if ( tempDir.status() != 0 ) {
474 kdWarning() << strerror( tempDir.status() ) << endl; 476 kdWarning() << strerror( tempDir.status() ) << endl;
475 return; 477 return;
476 } 478 }
477 479
478 QString dirName = tempDir.name(); 480 QString dirName = tempDir.name();
479 tempDir.unlink(); 481 tempDir.unlink();
480 QDir().mkdir( dirName, true ); 482 QDir().mkdir( dirName, true );
481 483
482 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 484 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
483 KABC::Addressee a = mAddressBook->findByUid( *it ); 485 KABC::Addressee a = mAddressBook->findByUid( *it );
484 486
485 if ( a.isEmpty() ) 487 if ( a.isEmpty() )
486 continue; 488 continue;
487 489
488 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 490 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
489 491
490 QString fileName = dirName + "/" + name; 492 QString fileName = dirName + "/" + name;
491 493
492 QFile outFile(fileName); 494 QFile outFile(fileName);
493 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 495 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
494 KABC::VCardConverter converter; 496 KABC::VCardConverter converter;
495 QString vcard; 497 QString vcard;
496 498
497 converter.addresseeToVCard( a, vcard ); 499 converter.addresseeToVCard( a, vcard );
498 500
499 QTextStream t( &outFile ); // use a text stream 501 QTextStream t( &outFile ); // use a text stream
500 t.setEncoding( QTextStream::UnicodeUTF8 ); 502 t.setEncoding( QTextStream::UnicodeUTF8 );
501 t << vcard; 503 t << vcard;
502 504
503 outFile.close(); 505 outFile.close();
504 506
505 urls.append( fileName ); 507 urls.append( fileName );
506 } 508 }
507 } 509 }
508 510
509 kapp->invokeMailer( QString::null, QString::null, QString::null, 511 kapp->invokeMailer( QString::null, QString::null, QString::null,
510 QString::null, // subject 512 QString::null, // subject
511 QString::null, // body 513 QString::null, // body
512 QString::null, 514 QString::null,
513 urls ); // attachments 515 urls ); // attachments
514#else //KAB_EMBEDDED 516#else //KAB_EMBEDDED
515 qDebug("KABCore::mailVCard( must be fixed"); 517 qDebug("KABCore::mailVCard( must be fixed");
516#endif //KAB_EMBEDDED 518#endif //KAB_EMBEDDED
517 519
518} 520}
519 521
520void KABCore::browse( const QString& url ) 522void KABCore::browse( const QString& url )
521{ 523{
522#ifndef KAB_EMBEDDED 524#ifndef KAB_EMBEDDED
523 kapp->invokeBrowser( url ); 525 kapp->invokeBrowser( url );
524#else //KAB_EMBEDDED 526#else //KAB_EMBEDDED
525 qDebug("KABCore::browse must be fixed"); 527 qDebug("KABCore::browse must be fixed");
526#endif //KAB_EMBEDDED 528#endif //KAB_EMBEDDED
527} 529}
528 530
529void KABCore::selectAllContacts() 531void KABCore::selectAllContacts()
530{ 532{
531 mViewManager->setSelected( QString::null, true ); 533 mViewManager->setSelected( QString::null, true );
532} 534}
533 535
534void KABCore::deleteContacts() 536void KABCore::deleteContacts()
535{ 537{
536 QStringList uidList = mViewManager->selectedUids(); 538 QStringList uidList = mViewManager->selectedUids();
537 deleteContacts( uidList ); 539 deleteContacts( uidList );
538} 540}
539 541
540void KABCore::deleteContacts( const QStringList &uids ) 542void KABCore::deleteContacts( const QStringList &uids )
541{ 543{
542 if ( uids.count() > 0 ) { 544 if ( uids.count() > 0 ) {
543 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 545 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
544 UndoStack::instance()->push( command ); 546 UndoStack::instance()->push( command );
545 RedoStack::instance()->clear(); 547 RedoStack::instance()->clear();
546 548
547 // now if we deleted anything, refresh 549 // now if we deleted anything, refresh
548 setContactSelected( QString::null ); 550 setContactSelected( QString::null );
549 setModified( true ); 551 setModified( true );
550 } 552 }
551} 553}
552 554
553void KABCore::copyContacts() 555void KABCore::copyContacts()
554{ 556{
555 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 557 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
556 558
557 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 559 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
558 560
559 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 561 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
560 562
561 QClipboard *cb = QApplication::clipboard(); 563 QClipboard *cb = QApplication::clipboard();
562 cb->setText( clipText ); 564 cb->setText( clipText );
563} 565}
564 566
565void KABCore::cutContacts() 567void KABCore::cutContacts()
566{ 568{
567 QStringList uidList = mViewManager->selectedUids(); 569 QStringList uidList = mViewManager->selectedUids();
568 570
569//US if ( uidList.size() > 0 ) { 571//US if ( uidList.size() > 0 ) {
570 if ( uidList.count() > 0 ) { 572 if ( uidList.count() > 0 ) {
571 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 573 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
572 UndoStack::instance()->push( command ); 574 UndoStack::instance()->push( command );
573 RedoStack::instance()->clear(); 575 RedoStack::instance()->clear();
574 576
575 setModified( true ); 577 setModified( true );
576 } 578 }
577} 579}
578 580
579void KABCore::pasteContacts() 581void KABCore::pasteContacts()
580{ 582{
581 QClipboard *cb = QApplication::clipboard(); 583 QClipboard *cb = QApplication::clipboard();
582 584
583 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 585 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
584 586
585 pasteContacts( list ); 587 pasteContacts( list );
586} 588}
587 589
588void KABCore::pasteContacts( KABC::Addressee::List &list ) 590void KABCore::pasteContacts( KABC::Addressee::List &list )
589{ 591{
590 KABC::Resource *resource = requestResource( this ); 592 KABC::Resource *resource = requestResource( this );
591 KABC::Addressee::List::Iterator it; 593 KABC::Addressee::List::Iterator it;
592 for ( it = list.begin(); it != list.end(); ++it ) 594 for ( it = list.begin(); it != list.end(); ++it )
593 (*it).setResource( resource ); 595 (*it).setResource( resource );
594 596
595 PwPasteCommand *command = new PwPasteCommand( this, list ); 597 PwPasteCommand *command = new PwPasteCommand( this, list );
596 UndoStack::instance()->push( command ); 598 UndoStack::instance()->push( command );
597 RedoStack::instance()->clear(); 599 RedoStack::instance()->clear();
598 600
599 setModified( true ); 601 setModified( true );
600} 602}
601 603
602void KABCore::setWhoAmI() 604void KABCore::setWhoAmI()
603{ 605{
604 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 606 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
605 607
606 if ( addrList.count() > 1 ) { 608 if ( addrList.count() > 1 ) {
607 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 609 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
608 return; 610 return;
609 } 611 }
610 612
611 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 613 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
612 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 614 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
613 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 615 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
614} 616}
615 617
616void KABCore::setCategories() 618void KABCore::setCategories()
617{ 619{
618 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 620 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
619 if ( !dlg.exec() ) 621 if ( !dlg.exec() )
620 return; 622 return;
621 623
622 bool merge = false; 624 bool merge = false;
623 QString msg = i18n( "Merge with existing categories?" ); 625 QString msg = i18n( "Merge with existing categories?" );
624 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 626 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
625 merge = true; 627 merge = true;
626 628
627 QStringList categories = dlg.selectedCategories(); 629 QStringList categories = dlg.selectedCategories();
628 630
629 QStringList uids = mViewManager->selectedUids(); 631 QStringList uids = mViewManager->selectedUids();
630 QStringList::Iterator it; 632 QStringList::Iterator it;
631 for ( it = uids.begin(); it != uids.end(); ++it ) { 633 for ( it = uids.begin(); it != uids.end(); ++it ) {
632 KABC::Addressee addr = mAddressBook->findByUid( *it ); 634 KABC::Addressee addr = mAddressBook->findByUid( *it );
633 if ( !addr.isEmpty() ) { 635 if ( !addr.isEmpty() ) {
634 if ( !merge ) 636 if ( !merge )
635 addr.setCategories( categories ); 637 addr.setCategories( categories );
636 else { 638 else {
637 QStringList addrCategories = addr.categories(); 639 QStringList addrCategories = addr.categories();
638 QStringList::Iterator catIt; 640 QStringList::Iterator catIt;
639 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 641 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
640 if ( !addrCategories.contains( *catIt ) ) 642 if ( !addrCategories.contains( *catIt ) )
641 addrCategories.append( *catIt ); 643 addrCategories.append( *catIt );
642 } 644 }
643 addr.setCategories( addrCategories ); 645 addr.setCategories( addrCategories );
644 } 646 }
645 647
646 mAddressBook->insertAddressee( addr ); 648 mAddressBook->insertAddressee( addr );
647 } 649 }
648 } 650 }
649 651
650 if ( uids.count() > 0 ) 652 if ( uids.count() > 0 )
651 setModified( true ); 653 setModified( true );
652} 654}
653 655
654void KABCore::setSearchFields( const KABC::Field::List &fields ) 656void KABCore::setSearchFields( const KABC::Field::List &fields )
655{ 657{
656 mIncSearchWidget->setFields( fields ); 658 mIncSearchWidget->setFields( fields );
657} 659}
658 660
659void KABCore::incrementalSearch( const QString& text ) 661void KABCore::incrementalSearch( const QString& text )
660{ 662{
661 mViewManager->setSelected( QString::null, false ); 663 mViewManager->setSelected( QString::null, false );
662 664
663 if ( !text.isEmpty() ) { 665 if ( !text.isEmpty() ) {
664 KABC::Field *field = mIncSearchWidget->currentField(); 666 KABC::Field *field = mIncSearchWidget->currentField();
665 667
666 QString pattern = text.lower(); 668 QString pattern = text.lower();
667 669
668#if KDE_VERSION >= 319 670#if KDE_VERSION >= 319
669 KABC::AddresseeList list( mAddressBook->allAddressees() ); 671 KABC::AddresseeList list( mAddressBook->allAddressees() );
670 if ( field ) { 672 if ( field ) {
671 list.sortByField( field ); 673 list.sortByField( field );
672 KABC::AddresseeList::Iterator it; 674 KABC::AddresseeList::Iterator it;
673 for ( it = list.begin(); it != list.end(); ++it ) { 675 for ( it = list.begin(); it != list.end(); ++it ) {
674 if ( field->value( *it ).lower().startsWith( pattern ) ) { 676 if ( field->value( *it ).lower().startsWith( pattern ) ) {
675 mViewManager->setSelected( (*it).uid(), true ); 677 mViewManager->setSelected( (*it).uid(), true );
676 return; 678 return;
677 } 679 }
678 } 680 }
679 } else { 681 } else {
680 KABC::AddresseeList::Iterator it; 682 KABC::AddresseeList::Iterator it;
681 for ( it = list.begin(); it != list.end(); ++it ) { 683 for ( it = list.begin(); it != list.end(); ++it ) {
682 KABC::Field::List fieldList = mIncSearchWidget->fields(); 684 KABC::Field::List fieldList = mIncSearchWidget->fields();
683 KABC::Field::List::ConstIterator fieldIt; 685 KABC::Field::List::ConstIterator fieldIt;
684 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 686 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
685 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 687 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
686 mViewManager->setSelected( (*it).uid(), true ); 688 mViewManager->setSelected( (*it).uid(), true );
687 return; 689 return;
688 } 690 }
689 } 691 }
690 } 692 }
691 } 693 }
692#else 694#else
693 KABC::AddressBook::Iterator it; 695 KABC::AddressBook::Iterator it;
694 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 696 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
695 if ( field ) { 697 if ( field ) {
696 if ( field->value( *it ).lower().startsWith( pattern ) ) { 698 if ( field->value( *it ).lower().startsWith( pattern ) ) {
697 mViewManager->setSelected( (*it).uid(), true ); 699 mViewManager->setSelected( (*it).uid(), true );
698 return; 700 return;
699 } 701 }
700 } else { 702 } else {
701 KABC::Field::List fieldList = mIncSearchWidget->fields(); 703 KABC::Field::List fieldList = mIncSearchWidget->fields();
702 KABC::Field::List::ConstIterator fieldIt; 704 KABC::Field::List::ConstIterator fieldIt;
703 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 705 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
704 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { 706 if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) {
705 mViewManager->setSelected( (*it).uid(), true ); 707 mViewManager->setSelected( (*it).uid(), true );
706 return; 708 return;
707 } 709 }
708 } 710 }
709 } 711 }
710 } 712 }
711#endif 713#endif
712 } 714 }
713} 715}
714 716
715void KABCore::setModified() 717void KABCore::setModified()
716{ 718{
717 setModified( true ); 719 setModified( true );
718} 720}
719 721
720void KABCore::setModifiedWOrefresh() 722void KABCore::setModifiedWOrefresh()
721{ 723{
722 // qDebug("KABCore::setModifiedWOrefresh() "); 724 // qDebug("KABCore::setModifiedWOrefresh() ");
723 mModified = true; 725 mModified = true;
724 mActionSave->setEnabled( mModified ); 726 mActionSave->setEnabled( mModified );
725#ifdef DESKTOP_VERSION 727#ifdef DESKTOP_VERSION
726 mDetails->refreshView(); 728 mDetails->refreshView();
727#endif 729#endif
728 730
729} 731}
730void KABCore::setModified( bool modified ) 732void KABCore::setModified( bool modified )
731{ 733{
732 mModified = modified; 734 mModified = modified;
733 mActionSave->setEnabled( mModified ); 735 mActionSave->setEnabled( mModified );
734 736
735 if ( modified ) 737 if ( modified )
736 mJumpButtonBar->recreateButtons(); 738 mJumpButtonBar->recreateButtons();
737 739
738 mViewManager->refreshView(); 740 mViewManager->refreshView();
739 mDetails->refreshView(); 741 mDetails->refreshView();
740 742
741} 743}
742 744
743bool KABCore::modified() const 745bool KABCore::modified() const
744{ 746{
745 return mModified; 747 return mModified;
746} 748}
747 749
748void KABCore::contactModified( const KABC::Addressee &addr ) 750void KABCore::contactModified( const KABC::Addressee &addr )
749{ 751{
750 752
751 Command *command = 0; 753 Command *command = 0;
752 QString uid; 754 QString uid;
753 755
754 // check if it exists already 756 // check if it exists already
755 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 757 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
756 if ( origAddr.isEmpty() ) 758 if ( origAddr.isEmpty() )
757 command = new PwNewCommand( mAddressBook, addr ); 759 command = new PwNewCommand( mAddressBook, addr );
758 else { 760 else {
759 command = new PwEditCommand( mAddressBook, origAddr, addr ); 761 command = new PwEditCommand( mAddressBook, origAddr, addr );
760 uid = addr.uid(); 762 uid = addr.uid();
761 } 763 }
762 764
763 UndoStack::instance()->push( command ); 765 UndoStack::instance()->push( command );
764 RedoStack::instance()->clear(); 766 RedoStack::instance()->clear();
765 767
766 setModified( true ); 768 setModified( true );
767} 769}
768 770
769void KABCore::newContact() 771void KABCore::newContact()
770{ 772{
771 AddresseeEditorDialog *dialog = 0; 773 AddresseeEditorDialog *dialog = 0;
772 774
773 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 775 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
774 776
775 QPtrList<KRES::Resource> kresResources; 777 QPtrList<KRES::Resource> kresResources;
776 QPtrListIterator<KABC::Resource> it( kabcResources ); 778 QPtrListIterator<KABC::Resource> it( kabcResources );
777 KABC::Resource *resource; 779 KABC::Resource *resource;
778 while ( ( resource = it.current() ) != 0 ) { 780 while ( ( resource = it.current() ) != 0 ) {
779 ++it; 781 ++it;
780 if ( !resource->readOnly() ) { 782 if ( !resource->readOnly() ) {
781 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 783 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
782 if ( res ) 784 if ( res )
783 kresResources.append( res ); 785 kresResources.append( res );
784 } 786 }
785 } 787 }
786 788
787 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 789 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
788 resource = static_cast<KABC::Resource*>( res ); 790 resource = static_cast<KABC::Resource*>( res );
789 791
790 if ( resource ) { 792 if ( resource ) {
791 KABC::Addressee addr; 793 KABC::Addressee addr;
792 addr.setResource( resource ); 794 addr.setResource( resource );
793 dialog = createAddresseeEditorDialog( this ); 795 mEditorDialog->setAddressee( addr );
794 dialog->setAddressee( addr ); 796 KApplication::execDialog ( mEditorDialog );
795 797
796 } else 798 } else
797 return; 799 return;
798 800
799 mEditorDict.insert( dialog->addressee().uid(), dialog ); 801 // mEditorDict.insert( dialog->addressee().uid(), dialog );
800 802
801 dialog->show(); 803 dialog->show();
802 804
803} 805}
804 806
805void KABCore::addEmail( QString aStr ) 807void KABCore::addEmail( QString aStr )
806{ 808{
807#ifndef KAB_EMBEDDED 809#ifndef KAB_EMBEDDED
808 QString fullName, email; 810 QString fullName, email;
809 811
810 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 812 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
811 813
812 // Try to lookup the addressee matching the email address 814 // Try to lookup the addressee matching the email address
813 bool found = false; 815 bool found = false;
814 QStringList emailList; 816 QStringList emailList;
815 KABC::AddressBook::Iterator it; 817 KABC::AddressBook::Iterator it;
816 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 818 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
817 emailList = (*it).emails(); 819 emailList = (*it).emails();
818 if ( emailList.contains( email ) > 0 ) { 820 if ( emailList.contains( email ) > 0 ) {
819 found = true; 821 found = true;
820 (*it).setNameFromString( fullName ); 822 (*it).setNameFromString( fullName );
821 editContact( (*it).uid() ); 823 editContact( (*it).uid() );
822 } 824 }
823 } 825 }
824 826
825 if ( !found ) { 827 if ( !found ) {
826 KABC::Addressee addr; 828 KABC::Addressee addr;
827 addr.setNameFromString( fullName ); 829 addr.setNameFromString( fullName );
828 addr.insertEmail( email, true ); 830 addr.insertEmail( email, true );
829 831
830 mAddressBook->insertAddressee( addr ); 832 mAddressBook->insertAddressee( addr );
831 mViewManager->refreshView( addr.uid() ); 833 mViewManager->refreshView( addr.uid() );
832 editContact( addr.uid() ); 834 editContact( addr.uid() );
833 } 835 }
834#else //KAB_EMBEDDED 836#else //KAB_EMBEDDED
835 qDebug("KABCore::addEmail finsih method"); 837 qDebug("KABCore::addEmail finsih method");
836#endif //KAB_EMBEDDED 838#endif //KAB_EMBEDDED
837} 839}
838 840
839void KABCore::importVCard( const KURL &url, bool showPreview ) 841void KABCore::importVCard( const KURL &url, bool showPreview )
840{ 842{
841 mXXPortManager->importVCard( url, showPreview ); 843 mXXPortManager->importVCard( url, showPreview );
842} 844}
843 845
844void KABCore::importVCard( const QString &vCard, bool showPreview ) 846void KABCore::importVCard( const QString &vCard, bool showPreview )
845{ 847{
846 mXXPortManager->importVCard( vCard, showPreview ); 848 mXXPortManager->importVCard( vCard, showPreview );
847} 849}
848 850
849//US added a second method without defaultparameter 851//US added a second method without defaultparameter
850void KABCore::editContact2() { 852void KABCore::editContact2() {
851 editContact( QString::null ); 853 editContact( QString::null );
852} 854}
853 855
854void KABCore::editContact( const QString &uid ) 856void KABCore::editContact( const QString &uid )
855{ 857{
856 858
857 if ( mExtensionManager->isQuickEditVisible() ) 859 if ( mExtensionManager->isQuickEditVisible() )
858 return; 860 return;
859 861
860 // First, locate the contact entry 862 // First, locate the contact entry
861 QString localUID = uid; 863 QString localUID = uid;
862 if ( localUID.isNull() ) { 864 if ( localUID.isNull() ) {
863 QStringList uidList = mViewManager->selectedUids(); 865 QStringList uidList = mViewManager->selectedUids();
864 if ( uidList.count() > 0 ) 866 if ( uidList.count() > 0 )
865 localUID = *( uidList.at( 0 ) ); 867 localUID = *( uidList.at( 0 ) );
866 } 868 }
867 869
868 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 870 KABC::Addressee addr = mAddressBook->findByUid( localUID );
869 if ( !addr.isEmpty() ) { 871 if ( !addr.isEmpty() ) {
870 AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); 872 mEditorDialog->setAddressee( addr );
871 if ( !dialog ) { 873 KApplication::execDialog ( mEditorDialog );
872 dialog = createAddresseeEditorDialog( this );
873
874 mEditorDict.insert( addr.uid(), dialog );
875
876 dialog->setAddressee( addr );
877 }
878
879 dialog->raise();
880 dialog->show();
881 } 874 }
882} 875}
883 876
884void KABCore::save() 877void KABCore::save()
885{ 878{
886 if ( !mModified ) 879 if ( !mModified )
887 return; 880 return;
888 QString text = i18n( "There was an error while attempting to save\n the " 881 QString text = i18n( "There was an error while attempting to save\n the "
889 "address book. Please check that some \nother application is " 882 "address book. Please check that some \nother application is "
890 "not using it. " ); 883 "not using it. " );
891 statusMessage(i18n("Saving addressbook ... ")); 884 statusMessage(i18n("Saving addressbook ... "));
892#ifndef KAB_EMBEDDED 885#ifndef KAB_EMBEDDED
893 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 886 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
894 if ( !b || !b->save() ) { 887 if ( !b || !b->save() ) {
895 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 888 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
896 } 889 }
897#else //KAB_EMBEDDED 890#else //KAB_EMBEDDED
898 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 891 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
899 if ( !b || !b->save() ) { 892 if ( !b || !b->save() ) {
900 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 893 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
901 } 894 }
902#endif //KAB_EMBEDDED 895#endif //KAB_EMBEDDED
903 896
904 statusMessage(i18n("Addressbook saved!")); 897 statusMessage(i18n("Addressbook saved!"));
905 setModified( false ); 898 setModified( false );
906} 899}
907 900
908void KABCore::statusMessage(QString mess , int time ) 901void KABCore::statusMessage(QString mess , int time )
909{ 902{
910 //topLevelWidget()->setCaption( mess ); 903 //topLevelWidget()->setCaption( mess );
911 // pending setting timer to revome message 904 // pending setting timer to revome message
912} 905}
913void KABCore::undo() 906void KABCore::undo()
914{ 907{
915 UndoStack::instance()->undo(); 908 UndoStack::instance()->undo();
916 909
917 // Refresh the view 910 // Refresh the view
918 mViewManager->refreshView(); 911 mViewManager->refreshView();
919} 912}
920 913
921void KABCore::redo() 914void KABCore::redo()
922{ 915{
923 RedoStack::instance()->redo(); 916 RedoStack::instance()->redo();
924 917
925 // Refresh the view 918 // Refresh the view
926 mViewManager->refreshView(); 919 mViewManager->refreshView();
927} 920}
928 921
929void KABCore::setJumpButtonBarVisible( bool visible ) 922void KABCore::setJumpButtonBarVisible( bool visible )
930{ 923{
931 if ( visible ) 924 if ( visible )
932 mJumpButtonBar->show(); 925 mJumpButtonBar->show();
933 else 926 else
934 mJumpButtonBar->hide(); 927 mJumpButtonBar->hide();
935} 928}
936void KABCore::setDetailsToState() 929void KABCore::setDetailsToState()
937{ 930{
938 setDetailsVisible( mActionDetails->isChecked() ); 931 setDetailsVisible( mActionDetails->isChecked() );
939} 932}
940 933
941void KABCore::setDetailsVisible( bool visible ) 934void KABCore::setDetailsVisible( bool visible )
942{ 935{
943 if ( visible ) 936 if ( visible )
944 mDetails->show(); 937 mDetails->show();
945 else 938 else
946 mDetails->hide(); 939 mDetails->hide();
947} 940}
948 941
949void KABCore::extensionModified( const KABC::Addressee::List &list ) 942void KABCore::extensionModified( const KABC::Addressee::List &list )
950{ 943{
951 944
952 if ( list.count() != 0 ) { 945 if ( list.count() != 0 ) {
953 KABC::Addressee::List::ConstIterator it; 946 KABC::Addressee::List::ConstIterator it;
954 for ( it = list.begin(); it != list.end(); ++it ) 947 for ( it = list.begin(); it != list.end(); ++it )
955 mAddressBook->insertAddressee( *it ); 948 mAddressBook->insertAddressee( *it );
956 if ( list.count() > 1 ) 949 if ( list.count() > 1 )
957 setModified(); 950 setModified();
958 else 951 else
959 setModifiedWOrefresh(); 952 setModifiedWOrefresh();
960 } 953 }
961 if ( list.count() == 0 ) 954 if ( list.count() == 0 )
962 mViewManager->refreshView(); 955 mViewManager->refreshView();
963 else 956 else
964 mViewManager->refreshView( list[ 0 ].uid() ); 957 mViewManager->refreshView( list[ 0 ].uid() );
965 958
966 959
967 960
968} 961}
969 962
970QString KABCore::getNameByPhone( const QString &phone ) 963QString KABCore::getNameByPhone( const QString &phone )
971{ 964{
972#ifndef KAB_EMBEDDED 965#ifndef KAB_EMBEDDED
973 QRegExp r( "[/*/-/ ]" ); 966 QRegExp r( "[/*/-/ ]" );
974 QString localPhone( phone ); 967 QString localPhone( phone );
975 968
976 bool found = false; 969 bool found = false;
977 QString ownerName = ""; 970 QString ownerName = "";
978 KABC::AddressBook::Iterator iter; 971 KABC::AddressBook::Iterator iter;
979 KABC::PhoneNumber::List::Iterator phoneIter; 972 KABC::PhoneNumber::List::Iterator phoneIter;
980 KABC::PhoneNumber::List phoneList; 973 KABC::PhoneNumber::List phoneList;
981 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 974 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
982 phoneList = (*iter).phoneNumbers(); 975 phoneList = (*iter).phoneNumbers();
983 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 976 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
984 ++phoneIter) { 977 ++phoneIter) {
985 // Get rid of separator chars so just the numbers are compared. 978 // Get rid of separator chars so just the numbers are compared.
986 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 979 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
987 ownerName = (*iter).formattedName(); 980 ownerName = (*iter).formattedName();
988 found = true; 981 found = true;
989 } 982 }
990 } 983 }
991 } 984 }
992 985
993 return ownerName; 986 return ownerName;
994#else //KAB_EMBEDDED 987#else //KAB_EMBEDDED
995 qDebug("KABCore::getNameByPhone finsih method"); 988 qDebug("KABCore::getNameByPhone finsih method");
996 return ""; 989 return "";
997#endif //KAB_EMBEDDED 990#endif //KAB_EMBEDDED
998 991
999} 992}
1000 993
1001void KABCore::openConfigDialog() 994void KABCore::openConfigDialog()
1002{ 995{
1003 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 996 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1004 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 997 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1005 ConfigureDialog->addModule(kabcfg ); 998 ConfigureDialog->addModule(kabcfg );
1006 connect( ConfigureDialog, SIGNAL( applyClicked() ), 999 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1007 this, SLOT( configurationChanged() ) ); 1000 this, SLOT( configurationChanged() ) );
1008 connect( ConfigureDialog, SIGNAL( okClicked() ), 1001 connect( ConfigureDialog, SIGNAL( okClicked() ),
1009 this, SLOT( configurationChanged() ) ); 1002 this, SLOT( configurationChanged() ) );
1010 saveSettings(); 1003 saveSettings();
1011 ConfigureDialog->showMaximized(); 1004 ConfigureDialog->showMaximized();
1012 if ( ConfigureDialog->exec() ) 1005 if ( ConfigureDialog->exec() )
1013 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1006 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1014 delete ConfigureDialog; 1007 delete ConfigureDialog;
1015} 1008}
1016 1009
1017void KABCore::openLDAPDialog() 1010void KABCore::openLDAPDialog()
1018{ 1011{
1019#ifndef KAB_EMBEDDED 1012#ifndef KAB_EMBEDDED
1020 if ( !mLdapSearchDialog ) { 1013 if ( !mLdapSearchDialog ) {
1021 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1014 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1022 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1015 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1023 SLOT( refreshView() ) ); 1016 SLOT( refreshView() ) );
1024 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1017 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1025 SLOT( setModified() ) ); 1018 SLOT( setModified() ) );
1026 } else 1019 } else
1027 mLdapSearchDialog->restoreSettings(); 1020 mLdapSearchDialog->restoreSettings();
1028 1021
1029 if ( mLdapSearchDialog->isOK() ) 1022 if ( mLdapSearchDialog->isOK() )
1030 mLdapSearchDialog->exec(); 1023 mLdapSearchDialog->exec();
1031#else //KAB_EMBEDDED 1024#else //KAB_EMBEDDED
1032 qDebug("KABCore::openLDAPDialog() finsih method"); 1025 qDebug("KABCore::openLDAPDialog() finsih method");
1033#endif //KAB_EMBEDDED 1026#endif //KAB_EMBEDDED
1034} 1027}
1035 1028
1036void KABCore::print() 1029void KABCore::print()
1037{ 1030{
1038#ifndef KAB_EMBEDDED 1031#ifndef KAB_EMBEDDED
1039 KPrinter printer; 1032 KPrinter printer;
1040 if ( !printer.setup( this ) ) 1033 if ( !printer.setup( this ) )
1041 return; 1034 return;
1042 1035
1043 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1036 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1044 mViewManager->selectedUids(), this ); 1037 mViewManager->selectedUids(), this );
1045 1038
1046 wizard.exec(); 1039 wizard.exec();
1047#else //KAB_EMBEDDED 1040#else //KAB_EMBEDDED
1048 qDebug("KABCore::print() finsih method"); 1041 qDebug("KABCore::print() finsih method");
1049#endif //KAB_EMBEDDED 1042#endif //KAB_EMBEDDED
1050 1043
1051} 1044}
1052 1045
1053 1046
1054void KABCore::addGUIClient( KXMLGUIClient *client ) 1047void KABCore::addGUIClient( KXMLGUIClient *client )
1055{ 1048{
1056 if ( mGUIClient ) 1049 if ( mGUIClient )
1057 mGUIClient->insertChildClient( client ); 1050 mGUIClient->insertChildClient( client );
1058 else 1051 else
1059 KMessageBox::error( this, "no KXMLGUICLient"); 1052 KMessageBox::error( this, "no KXMLGUICLient");
1060} 1053}
1061 1054
1062 1055
1063void KABCore::configurationChanged() 1056void KABCore::configurationChanged()
1064{ 1057{
1065 mExtensionManager->reconfigure(); 1058 mExtensionManager->reconfigure();
1066} 1059}
1067 1060
1068void KABCore::addressBookChanged() 1061void KABCore::addressBookChanged()
1069{ 1062{
1070#ifndef KAB_EMBEDDED 1063#ifndef KAB_EMBEDDED
1071 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1064 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1072 while ( it.current() ) { 1065 while ( it.current() ) {
1073 if ( it.current()->dirty() ) { 1066 if ( it.current()->dirty() ) {
1074 QString text = i18n( "Data has been changed externally. Unsaved " 1067 QString text = i18n( "Data has been changed externally. Unsaved "
1075 "changes will be lost." ); 1068 "changes will be lost." );
1076 KMessageBox::information( this, text ); 1069 KMessageBox::information( this, text );
1077 } 1070 }
1078 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1071 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1079 ++it; 1072 ++it;
1080 } 1073 }
1081 1074
1082 mViewManager->refreshView(); 1075 mViewManager->refreshView();
1083#else //KAB_EMBEDDED 1076#else //KAB_EMBEDDED
1084 qDebug("KABCore::addressBookChanged() finsih method"); 1077 qDebug("KABCore::addressBookChanged() finsih method");
1085#endif //KAB_EMBEDDED 1078#endif //KAB_EMBEDDED
1086} 1079}
1087 1080
1088AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1081AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1089 const char *name ) 1082 const char *name )
1090{ 1083{
1091 AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, 1084
1085 if ( mEditorDialog == 0 ) {
1086 mEditorDialog = new AddresseeEditorDialog( this, parent,
1092 name ? name : "editorDialog" ); 1087 name ? name : "editorDialog" );
1093 1088
1094//US 1089
1095 dialog->setMaximumSize( 640, 480 ); 1090 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1096 dialog->showMaximized();
1097
1098 connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1099 SLOT( contactModified( const KABC::Addressee& ) ) ); 1091 SLOT( contactModified( const KABC::Addressee& ) ) );
1100 connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), 1092 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1101 SLOT( slotEditorDestroyed( const QString& ) ) ); 1093 // SLOT( slotEditorDestroyed( const QString& ) ) );
1094 }
1102 1095
1103 return dialog; 1096 return mEditorDialog;
1104} 1097}
1105 1098
1106void KABCore::slotEditorDestroyed( const QString &uid ) 1099void KABCore::slotEditorDestroyed( const QString &uid )
1107{ 1100{
1108 mEditorDict.remove( uid ); 1101 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! ");
1102 //mEditorDict.remove( uid );
1109} 1103}
1110 1104
1111void KABCore::initGUI() 1105void KABCore::initGUI()
1112{ 1106{
1113#ifndef KAB_EMBEDDED 1107#ifndef KAB_EMBEDDED
1114 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1108 QHBoxLayout *topLayout = new QHBoxLayout( this );
1115 topLayout->setSpacing( KDialogBase::spacingHint() ); 1109 topLayout->setSpacing( KDialogBase::spacingHint() );
1116 1110
1117 mExtensionBarSplitter = new QSplitter( this ); 1111 mExtensionBarSplitter = new QSplitter( this );
1118 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1112 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1119 1113
1120 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1114 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1121 1115
1122 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1116 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1123 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1117 mIncSearchWidget = new IncSearchWidget( viewSpace );
1124 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1118 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1125 SLOT( incrementalSearch( const QString& ) ) ); 1119 SLOT( incrementalSearch( const QString& ) ) );
1126 1120
1127 mViewManager = new ViewManager( this, viewSpace ); 1121 mViewManager = new ViewManager( this, viewSpace );
1128 viewSpace->setStretchFactor( mViewManager, 1 ); 1122 viewSpace->setStretchFactor( mViewManager, 1 );
1129 1123
1130 mDetails = new ViewContainer( mDetailsSplitter ); 1124 mDetails = new ViewContainer( mDetailsSplitter );
1131 1125
1132 mJumpButtonBar = new JumpButtonBar( this, this ); 1126 mJumpButtonBar = new JumpButtonBar( this, this );
1133 1127
1134 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1128 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1135 1129
1136 topLayout->addWidget( mExtensionBarSplitter ); 1130 topLayout->addWidget( mExtensionBarSplitter );
1137 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1131 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1138 topLayout->addWidget( mJumpButtonBar ); 1132 topLayout->addWidget( mJumpButtonBar );
1139 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1133 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1140 1134
1141 mXXPortManager = new XXPortManager( this, this ); 1135 mXXPortManager = new XXPortManager( this, this );
1142 1136
1143#else //KAB_EMBEDDED 1137#else //KAB_EMBEDDED
1144 //US initialize viewMenu before settingup viewmanager. 1138 //US initialize viewMenu before settingup viewmanager.
1145 // Viewmanager needs this menu to plugin submenues. 1139 // Viewmanager needs this menu to plugin submenues.
1146 viewMenu = new QPopupMenu( this ); 1140 viewMenu = new QPopupMenu( this );
1147 settingsMenu = new QPopupMenu( this ); 1141 settingsMenu = new QPopupMenu( this );
1148 //filterMenu = new QPopupMenu( this ); 1142 //filterMenu = new QPopupMenu( this );
1149 ImportMenu = new QPopupMenu( this ); 1143 ImportMenu = new QPopupMenu( this );
1150 ExportMenu = new QPopupMenu( this ); 1144 ExportMenu = new QPopupMenu( this );
1151 1145
1152 1146
1153//US since we have no splitter for the embedded system, setup 1147//US since we have no splitter for the embedded system, setup
1154// a layout with two frames. One left and one right. 1148// a layout with two frames. One left and one right.
1155 1149
1156 QBoxLayout *topLayout; 1150 QBoxLayout *topLayout;
1157 1151
1158 // = new QHBoxLayout( this ); 1152 // = new QHBoxLayout( this );
1159// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1153// QBoxLayout *topLayout = (QBoxLayout*)layout();
1160 1154
1161// QWidget *mainBox = new QWidget( this ); 1155// QWidget *mainBox = new QWidget( this );
1162// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1156// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1163 1157
1164#ifdef DESKTOP_VERSION 1158#ifdef DESKTOP_VERSION
1165 topLayout = new QHBoxLayout( this ); 1159 topLayout = new QHBoxLayout( this );
1166 1160
1167 1161
1168 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1162 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1169 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1163 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1170 1164
1171 topLayout->addWidget(mMiniSplitter ); 1165 topLayout->addWidget(mMiniSplitter );
1172 1166
1173 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1167 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1174 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1168 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1175 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1169 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1176 mDetails = new ViewContainer( mMiniSplitter ); 1170 mDetails = new ViewContainer( mMiniSplitter );
1177 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1171 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1178#else 1172#else
1179 if ( QApplication::desktop()->width() > 480 ) { 1173 if ( QApplication::desktop()->width() > 480 ) {
1180 topLayout = new QHBoxLayout( this ); 1174 topLayout = new QHBoxLayout( this );
1181 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1175 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1182 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1176 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1183 } else { 1177 } else {
1184 1178
1185 topLayout = new QHBoxLayout( this ); 1179 topLayout = new QHBoxLayout( this );
1186 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1180 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1187 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1181 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1188 } 1182 }
1189 1183
1190 topLayout->addWidget(mMiniSplitter ); 1184 topLayout->addWidget(mMiniSplitter );
1191 mViewManager = new ViewManager( this, mMiniSplitter ); 1185 mViewManager = new ViewManager( this, mMiniSplitter );
1192 mDetails = new ViewContainer( mMiniSplitter ); 1186 mDetails = new ViewContainer( mMiniSplitter );
1193 1187
1194 1188
1195 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1189 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1196#endif 1190#endif
1197 //eh->hide(); 1191 //eh->hide();
1198 // topLayout->addWidget(mExtensionManager ); 1192 // topLayout->addWidget(mExtensionManager );
1199 1193
1200 1194
1201/*US 1195/*US
1202#ifndef KAB_NOSPLITTER 1196#ifndef KAB_NOSPLITTER
1203 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1197 QHBoxLayout *topLayout = new QHBoxLayout( this );
1204//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1198//US topLayout->setSpacing( KDialogBase::spacingHint() );
1205 topLayout->setSpacing( 10 ); 1199 topLayout->setSpacing( 10 );
1206 1200
1207 mDetailsSplitter = new QSplitter( this ); 1201 mDetailsSplitter = new QSplitter( this );
1208 1202
1209 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1203 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1210 1204
1211 mViewManager = new ViewManager( this, viewSpace ); 1205 mViewManager = new ViewManager( this, viewSpace );
1212 viewSpace->setStretchFactor( mViewManager, 1 ); 1206 viewSpace->setStretchFactor( mViewManager, 1 );
1213 1207
1214 mDetails = new ViewContainer( mDetailsSplitter ); 1208 mDetails = new ViewContainer( mDetailsSplitter );
1215 1209
1216 topLayout->addWidget( mDetailsSplitter ); 1210 topLayout->addWidget( mDetailsSplitter );
1217 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1211 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1218#else //KAB_NOSPLITTER 1212#else //KAB_NOSPLITTER
1219 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1213 QHBoxLayout *topLayout = new QHBoxLayout( this );
1220//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1214//US topLayout->setSpacing( KDialogBase::spacingHint() );
1221 topLayout->setSpacing( 10 ); 1215 topLayout->setSpacing( 10 );
1222 1216
1223// mDetailsSplitter = new QSplitter( this ); 1217// mDetailsSplitter = new QSplitter( this );
1224 1218
1225 QVBox *viewSpace = new QVBox( this ); 1219 QVBox *viewSpace = new QVBox( this );
1226 1220
1227 mViewManager = new ViewManager( this, viewSpace ); 1221 mViewManager = new ViewManager( this, viewSpace );
1228 viewSpace->setStretchFactor( mViewManager, 1 ); 1222 viewSpace->setStretchFactor( mViewManager, 1 );
1229 1223
1230 mDetails = new ViewContainer( this ); 1224 mDetails = new ViewContainer( this );
1231 1225
1232 topLayout->addWidget( viewSpace ); 1226 topLayout->addWidget( viewSpace );
1233// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1227// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1234 topLayout->addWidget( mDetails ); 1228 topLayout->addWidget( mDetails );
1235#endif //KAB_NOSPLITTER 1229#endif //KAB_NOSPLITTER
1236*/ 1230*/
1237 1231
1238 1232
1239#endif //KAB_EMBEDDED 1233#endif //KAB_EMBEDDED
1240 initActions(); 1234 initActions();
1241 1235
1242#ifdef KAB_EMBEDDED 1236#ifdef KAB_EMBEDDED
1243 addActionsManually(); 1237 addActionsManually();
1244 //US make sure the export and import menues are initialized before creating the xxPortManager. 1238 //US make sure the export and import menues are initialized before creating the xxPortManager.
1245 mXXPortManager = new XXPortManager( this, this ); 1239 mXXPortManager = new XXPortManager( this, this );
1246 1240
1247 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1241 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1248 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1242 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1249 // mActionQuit->plug ( mMainWindow->toolBar()); 1243 // mActionQuit->plug ( mMainWindow->toolBar());
1250 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1244 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1251 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1245 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1252 // mIncSearchWidget->hide(); 1246 // mIncSearchWidget->hide();
1253 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1247 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1254 SLOT( incrementalSearch( const QString& ) ) ); 1248 SLOT( incrementalSearch( const QString& ) ) );
1255 1249
1256 1250
1257 mJumpButtonBar = new JumpButtonBar( this, this ); 1251 mJumpButtonBar = new JumpButtonBar( this, this );
1258 1252
1259 topLayout->addWidget( mJumpButtonBar ); 1253 topLayout->addWidget( mJumpButtonBar );
1260//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1254//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1261 1255
1262// mMainWindow->getIconToolBar()->raise(); 1256// mMainWindow->getIconToolBar()->raise();
1263 1257
1264#endif //KAB_EMBEDDED 1258#endif //KAB_EMBEDDED
1265 1259
1266} 1260}
1267void KABCore::initActions() 1261void KABCore::initActions()
1268{ 1262{
1269//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1263//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1270 1264
1271#ifndef KAB_EMBEDDED 1265#ifndef KAB_EMBEDDED
1272 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1266 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1273 SLOT( clipboardDataChanged() ) ); 1267 SLOT( clipboardDataChanged() ) );
1274#endif //KAB_EMBEDDED 1268#endif //KAB_EMBEDDED
1275 1269
1276 // file menu 1270 // file menu
1277 if ( mIsPart ) { 1271 if ( mIsPart ) {
1278 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1272 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1279 SLOT( sendMail() ), actionCollection(), 1273 SLOT( sendMail() ), actionCollection(),
1280 "kaddressbook_mail" ); 1274 "kaddressbook_mail" );
1281 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1275 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1282 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1276 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1283 1277
1284 } else { 1278 } else {
1285 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1279 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1286 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1280 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1287 } 1281 }
1288 1282
1289 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1283 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1290 SLOT( save() ), actionCollection(), "file_sync" ); 1284 SLOT( save() ), actionCollection(), "file_sync" );
1291 1285
1292 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1286 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1293 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1287 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1294 1288
1295 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1289 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1296 this, SLOT( mailVCard() ), 1290 this, SLOT( mailVCard() ),
1297 actionCollection(), "file_mail_vcard"); 1291 actionCollection(), "file_mail_vcard");
1298 1292
1299 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1293 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1300 this, SLOT( editContact2() ), 1294 this, SLOT( editContact2() ),
1301 actionCollection(), "file_properties" ); 1295 actionCollection(), "file_properties" );
1302 1296
1303#ifdef KAB_EMBEDDED 1297#ifdef KAB_EMBEDDED
1304 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1298 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1305 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1299 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1306 mMainWindow, SLOT( exit() ), 1300 mMainWindow, SLOT( exit() ),
1307 actionCollection(), "quit" ); 1301 actionCollection(), "quit" );
1308#endif //KAB_EMBEDDED 1302#endif //KAB_EMBEDDED
1309 1303
1310 // edit menu 1304 // edit menu
1311 if ( mIsPart ) { 1305 if ( mIsPart ) {
1312 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1306 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1313 SLOT( copyContacts() ), actionCollection(), 1307 SLOT( copyContacts() ), actionCollection(),
1314 "kaddressbook_copy" ); 1308 "kaddressbook_copy" );
1315 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1309 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1316 SLOT( cutContacts() ), actionCollection(), 1310 SLOT( cutContacts() ), actionCollection(),
1317 "kaddressbook_cut" ); 1311 "kaddressbook_cut" );
1318 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1312 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1319 SLOT( pasteContacts() ), actionCollection(), 1313 SLOT( pasteContacts() ), actionCollection(),
1320 "kaddressbook_paste" ); 1314 "kaddressbook_paste" );
1321 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1315 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1322 SLOT( selectAllContacts() ), actionCollection(), 1316 SLOT( selectAllContacts() ), actionCollection(),
1323 "kaddressbook_select_all" ); 1317 "kaddressbook_select_all" );
1324 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1318 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1325 SLOT( undo() ), actionCollection(), 1319 SLOT( undo() ), actionCollection(),
1326 "kaddressbook_undo" ); 1320 "kaddressbook_undo" );
1327 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1321 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1328 this, SLOT( redo() ), actionCollection(), 1322 this, SLOT( redo() ), actionCollection(),
1329 "kaddressbook_redo" ); 1323 "kaddressbook_redo" );
1330 } else { 1324 } else {
1331 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1325 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1332 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1326 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1333 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1327 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1334 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1328 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1335 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1329 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1336 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1330 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1337 } 1331 }
1338 1332
1339 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1333 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1340 Key_Delete, this, SLOT( deleteContacts() ), 1334 Key_Delete, this, SLOT( deleteContacts() ),
1341 actionCollection(), "edit_delete" ); 1335 actionCollection(), "edit_delete" );
1342 1336
1343 mActionUndo->setEnabled( false ); 1337 mActionUndo->setEnabled( false );
1344 mActionRedo->setEnabled( false ); 1338 mActionRedo->setEnabled( false );
1345 1339
1346 // settings menu 1340 // settings menu
1347#ifdef KAB_EMBEDDED 1341#ifdef KAB_EMBEDDED
1348//US special menuentry to configure the addressbook resources. On KDE 1342//US special menuentry to configure the addressbook resources. On KDE
1349// you do that through the control center !!! 1343// you do that through the control center !!!
1350 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1344 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1351 SLOT( configureResources() ), actionCollection(), 1345 SLOT( configureResources() ), actionCollection(),
1352 "kaddressbook_configure_resources" ); 1346 "kaddressbook_configure_resources" );
1353#endif //KAB_EMBEDDED 1347#endif //KAB_EMBEDDED
1354 1348
1355 if ( mIsPart ) { 1349 if ( mIsPart ) {
1356 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1350 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1357 SLOT( openConfigDialog() ), actionCollection(), 1351 SLOT( openConfigDialog() ), actionCollection(),
1358 "kaddressbook_configure" ); 1352 "kaddressbook_configure" );
1359 1353
1360 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1354 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1361 this, SLOT( configureKeyBindings() ), actionCollection(), 1355 this, SLOT( configureKeyBindings() ), actionCollection(),
1362 "kaddressbook_configure_shortcuts" ); 1356 "kaddressbook_configure_shortcuts" );
1363#ifdef KAB_EMBEDDED 1357#ifdef KAB_EMBEDDED
1364 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1358 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1365 mActionConfigureToolbars->setEnabled( false ); 1359 mActionConfigureToolbars->setEnabled( false );
1366#endif //KAB_EMBEDDED 1360#endif //KAB_EMBEDDED
1367 1361
1368 } else { 1362 } else {
1369 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1363 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1370 1364
1371 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1365 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1372 } 1366 }
1373 1367
1374 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1368 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1375 actionCollection(), "options_show_jump_bar" ); 1369 actionCollection(), "options_show_jump_bar" );
1376 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1370 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1377 1371
1378 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1372 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1379 actionCollection(), "options_show_details" ); 1373 actionCollection(), "options_show_details" );
1380 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1374 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1381 1375
1382 // misc 1376 // misc
1383 // only enable LDAP lookup if we can handle the protocol 1377 // only enable LDAP lookup if we can handle the protocol
1384#ifndef KAB_EMBEDDED 1378#ifndef KAB_EMBEDDED
1385 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1379 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1386 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1380 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1387 this, SLOT( openLDAPDialog() ), actionCollection(), 1381 this, SLOT( openLDAPDialog() ), actionCollection(),
1388 "ldap_lookup" ); 1382 "ldap_lookup" );
1389 } 1383 }
1390#else //KAB_EMBEDDED 1384#else //KAB_EMBEDDED
1391 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1385 //qDebug("KABCore::initActions() LDAP has to be implemented");
1392#endif //KAB_EMBEDDED 1386#endif //KAB_EMBEDDED
1393 1387
1394 1388
1395 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1389 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1396 SLOT( setWhoAmI() ), actionCollection(), 1390 SLOT( setWhoAmI() ), actionCollection(),
1397 "set_personal" ); 1391 "set_personal" );
1398 1392
1399 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1393 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1400 SLOT( setCategories() ), actionCollection(), 1394 SLOT( setCategories() ), actionCollection(),
1401 "edit_set_categories" ); 1395 "edit_set_categories" );
1402 1396
1403#ifdef KAB_EMBEDDED 1397#ifdef KAB_EMBEDDED
1404 1398
1405 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1399 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1406 this, SLOT( createAboutData() ), actionCollection(), 1400 this, SLOT( createAboutData() ), actionCollection(),
1407 "kaddressbook_about_data" ); 1401 "kaddressbook_about_data" );
1408#endif //KAB_EMBEDDED 1402#endif //KAB_EMBEDDED
1409 1403
1410 clipboardDataChanged(); 1404 clipboardDataChanged();
1411 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1405 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1412 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1406 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1413} 1407}
1414 1408
1415//US we need this function, to plug all actions into the correct menues. 1409//US we need this function, to plug all actions into the correct menues.
1416// KDE uses a XML format to plug the actions, but we work her without this overhead. 1410// KDE uses a XML format to plug the actions, but we work her without this overhead.
1417void KABCore::addActionsManually() 1411void KABCore::addActionsManually()
1418{ 1412{
1419//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1413//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1420 1414
1421#ifdef KAB_EMBEDDED 1415#ifdef KAB_EMBEDDED
1422 QPopupMenu *fileMenu = new QPopupMenu( this ); 1416 QPopupMenu *fileMenu = new QPopupMenu( this );
1423 QPopupMenu *editMenu = new QPopupMenu( this ); 1417 QPopupMenu *editMenu = new QPopupMenu( this );
1424 QPopupMenu *helpMenu = new QPopupMenu( this ); 1418 QPopupMenu *helpMenu = new QPopupMenu( this );
1425 1419
1426 KToolBar* tb = mMainWindow->toolBar(); 1420 KToolBar* tb = mMainWindow->toolBar();
1427 1421
1428#ifdef DESKTOP_VERSION 1422#ifdef DESKTOP_VERSION
1429 QMenuBar* mb = mMainWindow->menuBar(); 1423 QMenuBar* mb = mMainWindow->menuBar();
1430 1424
1431 //US setup menubar. 1425 //US setup menubar.
1432 //Disable the following block if you do not want to have a menubar. 1426 //Disable the following block if you do not want to have a menubar.
1433 mb->insertItem( "&File", fileMenu ); 1427 mb->insertItem( "&File", fileMenu );
1434 mb->insertItem( "&Edit", editMenu ); 1428 mb->insertItem( "&Edit", editMenu );
1435 mb->insertItem( "&View", viewMenu ); 1429 mb->insertItem( "&View", viewMenu );
1436 mb->insertItem( "&Settings", settingsMenu ); 1430 mb->insertItem( "&Settings", settingsMenu );
1437 mb->insertItem( "&Help", helpMenu ); 1431 mb->insertItem( "&Help", helpMenu );
1438 mIncSearchWidget = new IncSearchWidget( tb ); 1432 mIncSearchWidget = new IncSearchWidget( tb );
1439 // tb->insertWidget(-1, 0, mIncSearchWidget); 1433 // tb->insertWidget(-1, 0, mIncSearchWidget);
1440 1434
1441#else 1435#else
1442 //US setup toolbar 1436 //US setup toolbar
1443 QMenuBar *menuBarTB = new QMenuBar( tb ); 1437 QMenuBar *menuBarTB = new QMenuBar( tb );
1444 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1438 QPopupMenu *popupBarTB = new QPopupMenu( this );
1445 menuBarTB->insertItem( "ME", popupBarTB); 1439 menuBarTB->insertItem( "ME", popupBarTB);
1446 tb->insertWidget(-1, 0, menuBarTB); 1440 tb->insertWidget(-1, 0, menuBarTB);
1447 mIncSearchWidget = new IncSearchWidget( tb ); 1441 mIncSearchWidget = new IncSearchWidget( tb );
1448 1442
1449 tb->enableMoving(false); 1443 tb->enableMoving(false);
1450 popupBarTB->insertItem( "&File", fileMenu ); 1444 popupBarTB->insertItem( "&File", fileMenu );
1451 popupBarTB->insertItem( "&Edit", editMenu ); 1445 popupBarTB->insertItem( "&Edit", editMenu );
1452 popupBarTB->insertItem( "&View", viewMenu ); 1446 popupBarTB->insertItem( "&View", viewMenu );
1453 popupBarTB->insertItem( "&Settings", settingsMenu ); 1447 popupBarTB->insertItem( "&Settings", settingsMenu );
1454 mViewManager->getFilterAction()->plug ( popupBarTB); 1448 mViewManager->getFilterAction()->plug ( popupBarTB);
1455 popupBarTB->insertItem( "&Help", helpMenu ); 1449 popupBarTB->insertItem( "&Help", helpMenu );
1456 if (QApplication::desktop()->width() > 320 ) { 1450 if (QApplication::desktop()->width() > 320 ) {
1457 // mViewManager->getFilterAction()->plug ( tb); 1451 // mViewManager->getFilterAction()->plug ( tb);
1458 } 1452 }
1459#endif 1453#endif
1460 // mActionQuit->plug ( mMainWindow->toolBar()); 1454 // mActionQuit->plug ( mMainWindow->toolBar());
1461 1455
1462 1456
1463 1457
1464 //US Now connect the actions with the menue entries. 1458 //US Now connect the actions with the menue entries.
1465 mActionPrint->plug( fileMenu ); 1459 mActionPrint->plug( fileMenu );
1466 mActionMail->plug( fileMenu ); 1460 mActionMail->plug( fileMenu );
1467 fileMenu->insertSeparator(); 1461 fileMenu->insertSeparator();
1468 1462
1469 mActionNewContact->plug( fileMenu ); 1463 mActionNewContact->plug( fileMenu );
1470 mActionNewContact->plug( tb ); 1464 mActionNewContact->plug( tb );
1471 1465
1472 mActionEditAddressee->plug( fileMenu ); 1466 mActionEditAddressee->plug( fileMenu );
1473 fileMenu->insertSeparator(); 1467 fileMenu->insertSeparator();
1474 mActionSave->plug( fileMenu ); 1468 mActionSave->plug( fileMenu );
1475 fileMenu->insertItem( "&Import", ImportMenu ); 1469 fileMenu->insertItem( "&Import", ImportMenu );
1476 fileMenu->insertItem( "&Emport", ExportMenu ); 1470 fileMenu->insertItem( "&Emport", ExportMenu );
1477 fileMenu->insertSeparator(); 1471 fileMenu->insertSeparator();
1478 mActionMailVCard->plug( fileMenu ); 1472 mActionMailVCard->plug( fileMenu );
1479 fileMenu->insertSeparator(); 1473 fileMenu->insertSeparator();
1480 mActionQuit->plug( fileMenu ); 1474 mActionQuit->plug( fileMenu );
1481 1475
1482 1476
1483 // edit menu 1477 // edit menu
1484 mActionUndo->plug( editMenu ); 1478 mActionUndo->plug( editMenu );
1485 mActionRedo->plug( editMenu ); 1479 mActionRedo->plug( editMenu );
1486 editMenu->insertSeparator(); 1480 editMenu->insertSeparator();
1487 mActionCut->plug( editMenu ); 1481 mActionCut->plug( editMenu );
1488 mActionCopy->plug( editMenu ); 1482 mActionCopy->plug( editMenu );
1489 mActionPaste->plug( editMenu ); 1483 mActionPaste->plug( editMenu );
1490 mActionDelete->plug( editMenu ); 1484 mActionDelete->plug( editMenu );
1491 editMenu->insertSeparator(); 1485 editMenu->insertSeparator();
1492 mActionSelectAll->plug( editMenu ); 1486 mActionSelectAll->plug( editMenu );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index b84ec22..c823f1f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,421 +1,421 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35 35
36namespace KABC { 36namespace KABC {
37class AddressBook; 37class AddressBook;
38} 38}
39 39
40#ifndef KAB_EMBEDDED 40#ifndef KAB_EMBEDDED
41class KAboutData; 41class KAboutData;
42class KConfig; 42class KConfig;
43 43
44class KAddressBookService; 44class KAddressBookService;
45class LDAPSearchDialog; 45class LDAPSearchDialog;
46#else //KAB_EMBEDDED 46#else //KAB_EMBEDDED
47class KAddressBookMain; 47class KAddressBookMain;
48//US class QAction; 48//US class QAction;
49#endif //KAB_EMBEDDED 49#endif //KAB_EMBEDDED
50class KCMultiDialog; 50class KCMultiDialog;
51class KXMLGUIClient; 51class KXMLGUIClient;
52class ExtensionManager; 52class ExtensionManager;
53class XXPortManager; 53class XXPortManager;
54class JumpButtonBar; 54class JumpButtonBar;
55class IncSearchWidget; 55class IncSearchWidget;
56class KDGanttMinimizeSplitter; 56class KDGanttMinimizeSplitter;
57class KAction; 57class KAction;
58class KActionCollection; 58class KActionCollection;
59class KToggleAction; 59class KToggleAction;
60 60
61class QAction; 61class QAction;
62class QMenuBar; 62class QMenuBar;
63class QSplitter; 63class QSplitter;
64class ViewContainer; 64class ViewContainer;
65class ViewManager; 65class ViewManager;
66class AddresseeEditorDialog; 66class AddresseeEditorDialog;
67 67
68class KABCore : public QWidget 68class KABCore : public QWidget
69{ 69{
70 Q_OBJECT 70 Q_OBJECT
71 71
72 public: 72 public:
73 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 73 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
74 74
75 75
76 ~KABCore(); 76 ~KABCore();
77 77
78 78
79#ifdef KAB_EMBEDDED 79#ifdef KAB_EMBEDDED
80 //US added functionality 80 //US added functionality
81 QPopupMenu* getViewMenu() {return viewMenu;} 81 QPopupMenu* getViewMenu() {return viewMenu;}
82 QPopupMenu* getFilterMenu() {return filterMenu;} 82 QPopupMenu* getFilterMenu() {return filterMenu;}
83 QPopupMenu* getSettingsMenu() {return settingsMenu;} 83 QPopupMenu* getSettingsMenu() {return settingsMenu;}
84 void addActionsManually(); 84 void addActionsManually();
85#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
86 /** 86 /**
87 Restores the global settings. 87 Restores the global settings.
88 */ 88 */
89 void restoreSettings(); 89 void restoreSettings();
90 90
91 /** 91 /**
92 Saves the global settings. 92 Saves the global settings.
93 */ 93 */
94 void saveSettings(); 94 void saveSettings();
95 95
96 /** 96 /**
97 Returns a pointer to the StdAddressBook of the application. 97 Returns a pointer to the StdAddressBook of the application.
98 */ 98 */
99 KABC::AddressBook *addressBook() const; 99 KABC::AddressBook *addressBook() const;
100 100
101 /** 101 /**
102 Returns a pointer to the KConfig object of the application. 102 Returns a pointer to the KConfig object of the application.
103 */ 103 */
104 static KConfig *config(); 104 static KConfig *config();
105 105
106 /** 106 /**
107 Returns a pointer to the global KActionCollection object. So 107 Returns a pointer to the global KActionCollection object. So
108 other classes can register their actions easily. 108 other classes can register their actions easily.
109 */ 109 */
110 KActionCollection *actionCollection() const; 110 KActionCollection *actionCollection() const;
111 111
112 /** 112 /**
113 Returns the current search field of the Incremental Search Widget. 113 Returns the current search field of the Incremental Search Widget.
114 */ 114 */
115 KABC::Field *currentSearchField() const; 115 KABC::Field *currentSearchField() const;
116 116
117 /** 117 /**
118 Returns the uid list of the currently selected contacts. 118 Returns the uid list of the currently selected contacts.
119 */ 119 */
120 QStringList selectedUIDs() const; 120 QStringList selectedUIDs() const;
121 121
122 /** 122 /**
123 Displays the ResourceSelectDialog and returns the selected 123 Displays the ResourceSelectDialog and returns the selected
124 resource or a null pointer if no resource was selected by 124 resource or a null pointer if no resource was selected by
125 the user. 125 the user.
126 */ 126 */
127 KABC::Resource *requestResource( QWidget *parent ); 127 KABC::Resource *requestResource( QWidget *parent );
128 128
129#ifndef KAB_EMBEDDED 129#ifndef KAB_EMBEDDED
130 static KAboutData *createAboutData(); 130 static KAboutData *createAboutData();
131#endif //KAB_EMBEDDED 131#endif //KAB_EMBEDDED
132 132
133#ifdef KAB_EMBEDDED 133#ifdef KAB_EMBEDDED
134 inline QPopupMenu* getImportMenu() { return ImportMenu;} 134 inline QPopupMenu* getImportMenu() { return ImportMenu;}
135 inline QPopupMenu* getExportMenu() { return ExportMenu;} 135 inline QPopupMenu* getExportMenu() { return ExportMenu;}
136#endif //KAB_EMBEDDED 136#endif //KAB_EMBEDDED
137 137
138 public slots: 138 public slots:
139#ifdef KAB_EMBEDDED 139#ifdef KAB_EMBEDDED
140 void createAboutData(); 140 void createAboutData();
141#endif //KAB_EMBEDDED 141#endif //KAB_EMBEDDED
142 142
143 void statusMessage(QString, int time = 0 ); 143 void statusMessage(QString, int time = 0 );
144 /** 144 /**
145 Is called whenever a contact is selected in the view. 145 Is called whenever a contact is selected in the view.
146 */ 146 */
147 void setContactSelected( const QString &uid ); 147 void setContactSelected( const QString &uid );
148 148
149 /** 149 /**
150 Opens the preferred mail composer with all selected contacts as 150 Opens the preferred mail composer with all selected contacts as
151 arguments. 151 arguments.
152 */ 152 */
153 void sendMail(); 153 void sendMail();
154 154
155 /** 155 /**
156 Opens the preferred mail composer with the given contacts as 156 Opens the preferred mail composer with the given contacts as
157 arguments. 157 arguments.
158 */ 158 */
159 void sendMail( const QString& email ); 159 void sendMail( const QString& email );
160 160
161 161
162 void mailVCard(); 162 void mailVCard();
163 void mailVCard(const QStringList& uids); 163 void mailVCard(const QStringList& uids);
164 164
165 /** 165 /**
166 Starts the preferred web browser with the given URL as argument. 166 Starts the preferred web browser with the given URL as argument.
167 */ 167 */
168 void browse( const QString& url ); 168 void browse( const QString& url );
169 169
170 /** 170 /**
171 Select all contacts in the view. 171 Select all contacts in the view.
172 */ 172 */
173 void selectAllContacts(); 173 void selectAllContacts();
174 174
175 /** 175 /**
176 Deletes all selected contacts from the address book. 176 Deletes all selected contacts from the address book.
177 */ 177 */
178 void deleteContacts(); 178 void deleteContacts();
179 179
180 /** 180 /**
181 Deletes given contacts from the address book. 181 Deletes given contacts from the address book.
182 182
183 @param uids The uids of the contacts, which shall be deleted. 183 @param uids The uids of the contacts, which shall be deleted.
184 */ 184 */
185 void deleteContacts( const QStringList &uids ); 185 void deleteContacts( const QStringList &uids );
186 186
187 /** 187 /**
188 Copys the selected contacts into clipboard for later pasting. 188 Copys the selected contacts into clipboard for later pasting.
189 */ 189 */
190 void copyContacts(); 190 void copyContacts();
191 191
192 /** 192 /**
193 Cuts the selected contacts and stores them for later pasting. 193 Cuts the selected contacts and stores them for later pasting.
194 */ 194 */
195 void cutContacts(); 195 void cutContacts();
196 196
197 /** 197 /**
198 Paste contacts from clipboard into the address book. 198 Paste contacts from clipboard into the address book.
199 */ 199 */
200 void pasteContacts(); 200 void pasteContacts();
201 201
202 /** 202 /**
203 Paste given contacts into the address book. 203 Paste given contacts into the address book.
204 204
205 @param list The list of addressee, which shall be pasted. 205 @param list The list of addressee, which shall be pasted.
206 */ 206 */
207 void pasteContacts( KABC::Addressee::List &list ); 207 void pasteContacts( KABC::Addressee::List &list );
208 208
209 /** 209 /**
210 Sets the whoAmI contact, that is used by many other programs to 210 Sets the whoAmI contact, that is used by many other programs to
211 get personal information about the current user. 211 get personal information about the current user.
212 */ 212 */
213 void setWhoAmI(); 213 void setWhoAmI();
214 214
215 /** 215 /**
216 Displays the category dialog and applies the result to all 216 Displays the category dialog and applies the result to all
217 selected contacts. 217 selected contacts.
218 */ 218 */
219 void setCategories(); 219 void setCategories();
220 220
221 /** 221 /**
222 Sets the field list of the Incremental Search Widget. 222 Sets the field list of the Incremental Search Widget.
223 */ 223 */
224 void setSearchFields( const KABC::Field::List &fields ); 224 void setSearchFields( const KABC::Field::List &fields );
225 225
226 /** 226 /**
227 Search with the current search field for a contact, that matches 227 Search with the current search field for a contact, that matches
228 the given text, and selects it in the view. 228 the given text, and selects it in the view.
229 */ 229 */
230 void incrementalSearch( const QString& text ); 230 void incrementalSearch( const QString& text );
231 231
232 /** 232 /**
233 Marks the address book as modified. 233 Marks the address book as modified.
234 */ 234 */
235 void setModified(); 235 void setModified();
236 /** 236 /**
237 Marks the address book as modified without refreshing the view. 237 Marks the address book as modified without refreshing the view.
238 */ 238 */
239 void setModifiedWOrefresh(); 239 void setModifiedWOrefresh();
240 240
241 /** 241 /**
242 Marks the address book as modified concerning the argument. 242 Marks the address book as modified concerning the argument.
243 */ 243 */
244 void setModified( bool modified ); 244 void setModified( bool modified );
245 245
246 /** 246 /**
247 Returns whether the address book is modified. 247 Returns whether the address book is modified.
248 */ 248 */
249 bool modified() const; 249 bool modified() const;
250 250
251 /** 251 /**
252 Called whenever an contact is modified in the contact editor 252 Called whenever an contact is modified in the contact editor
253 dialog or the quick edit. 253 dialog or the quick edit.
254 */ 254 */
255 void contactModified( const KABC::Addressee &addr ); 255 void contactModified( const KABC::Addressee &addr );
256 256
257 /** 257 /**
258 DCOP METHODS. 258 DCOP METHODS.
259 */ 259 */
260 void addEmail( QString addr ); 260 void addEmail( QString addr );
261 void importVCard( const KURL& url, bool showPreview ); 261 void importVCard( const KURL& url, bool showPreview );
262 void importVCard( const QString& vCard, bool showPreview ); 262 void importVCard( const QString& vCard, bool showPreview );
263 void newContact(); 263 void newContact();
264 QString getNameByPhone( const QString& phone ); 264 QString getNameByPhone( const QString& phone );
265 /** 265 /**
266 END DCOP METHODS 266 END DCOP METHODS
267 */ 267 */
268 268
269 /** 269 /**
270 Saves the contents of the AddressBook back to disk. 270 Saves the contents of the AddressBook back to disk.
271 */ 271 */
272 void save(); 272 void save();
273 273
274 /** 274 /**
275 Undos the last command using the undo stack. 275 Undos the last command using the undo stack.
276 */ 276 */
277 void undo(); 277 void undo();
278 278
279 /** 279 /**
280 Redos the last command that was undone, using the redo stack. 280 Redos the last command that was undone, using the redo stack.
281 */ 281 */
282 void redo(); 282 void redo();
283 283
284 /** 284 /**
285 Shows the edit dialog for the given uid. If the uid is QString::null, 285 Shows the edit dialog for the given uid. If the uid is QString::null,
286 the method will try to find a selected addressee in the view. 286 the method will try to find a selected addressee in the view.
287 */ 287 */
288 void editContact( const QString &uid /*US = QString::null*/ ); 288 void editContact( const QString &uid /*US = QString::null*/ );
289//US added a second method without defaultparameter 289//US added a second method without defaultparameter
290 void editContact2(); 290 void editContact2();
291 291
292 /** 292 /**
293 Launches the configuration dialog. 293 Launches the configuration dialog.
294 */ 294 */
295 void openConfigDialog(); 295 void openConfigDialog();
296 296
297 /** 297 /**
298 Launches the ldap search dialog. 298 Launches the ldap search dialog.
299 */ 299 */
300 void openLDAPDialog(); 300 void openLDAPDialog();
301 301
302 /** 302 /**
303 Creates a KAddressBookPrinter, which will display the print 303 Creates a KAddressBookPrinter, which will display the print
304 dialog and do the printing. 304 dialog and do the printing.
305 */ 305 */
306 void print(); 306 void print();
307 307
308 /** 308 /**
309 Registers a new GUI client, so plugins can register its actions. 309 Registers a new GUI client, so plugins can register its actions.
310 */ 310 */
311 void addGUIClient( KXMLGUIClient *client ); 311 void addGUIClient( KXMLGUIClient *client );
312 312
313 signals: 313 signals:
314 void contactSelected( const QString &name ); 314 void contactSelected( const QString &name );
315 void contactSelected( const QPixmap &pixmap ); 315 void contactSelected( const QPixmap &pixmap );
316 public slots: 316 public slots:
317 void setDetailsVisible( bool visible ); 317 void setDetailsVisible( bool visible );
318 void setDetailsToState(); 318 void setDetailsToState();
319 private slots: 319 private slots:
320 void setJumpButtonBarVisible( bool visible ); 320 void setJumpButtonBarVisible( bool visible );
321 321
322 void extensionModified( const KABC::Addressee::List &list ); 322 void extensionModified( const KABC::Addressee::List &list );
323 void clipboardDataChanged(); 323 void clipboardDataChanged();
324 void updateActionMenu(); 324 void updateActionMenu();
325 void configureKeyBindings(); 325 void configureKeyBindings();
326#ifdef KAB_EMBEDDED 326#ifdef KAB_EMBEDDED
327 void configureResources(); 327 void configureResources();
328#endif //KAB_EMBEDDED 328#endif //KAB_EMBEDDED
329 329
330 void slotEditorDestroyed( const QString &uid ); 330 void slotEditorDestroyed( const QString &uid );
331 void configurationChanged(); 331 void configurationChanged();
332 void addressBookChanged(); 332 void addressBookChanged();
333 333
334 private: 334 private:
335 void initGUI(); 335 void initGUI();
336 void initActions(); 336 void initActions();
337 337
338 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 338 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
339 const char *name = 0 ); 339 const char *name = 0 );
340 340
341 KXMLGUIClient *mGUIClient; 341 KXMLGUIClient *mGUIClient;
342 342
343 KABC::AddressBook *mAddressBook; 343 KABC::AddressBook *mAddressBook;
344 344
345 ViewManager *mViewManager; 345 ViewManager *mViewManager;
346 // QSplitter *mDetailsSplitter; 346 // QSplitter *mDetailsSplitter;
347 KDGanttMinimizeSplitter *mExtensionBarSplitter; 347 KDGanttMinimizeSplitter *mExtensionBarSplitter;
348 ViewContainer *mDetails; 348 ViewContainer *mDetails;
349 KDGanttMinimizeSplitter* mMiniSplitter; 349 KDGanttMinimizeSplitter* mMiniSplitter;
350 XXPortManager *mXXPortManager; 350 XXPortManager *mXXPortManager;
351 JumpButtonBar *mJumpButtonBar; 351 JumpButtonBar *mJumpButtonBar;
352 IncSearchWidget *mIncSearchWidget; 352 IncSearchWidget *mIncSearchWidget;
353 ExtensionManager *mExtensionManager; 353 ExtensionManager *mExtensionManager;
354 354
355 KCMultiDialog *mConfigureDialog; 355 KCMultiDialog *mConfigureDialog;
356 356
357#ifndef KAB_EMBEDDED 357#ifndef KAB_EMBEDDED
358 358
359 KCMultiDialog *mConfigureDialog; 359 KCMultiDialog *mConfigureDialog;
360 LDAPSearchDialog *mLdapSearchDialog; 360 LDAPSearchDialog *mLdapSearchDialog;
361#endif //KAB_EMBEDDED 361#endif //KAB_EMBEDDED
362 QDict<AddresseeEditorDialog> mEditorDict; 362 // QDict<AddresseeEditorDialog> mEditorDict;
363 363 AddresseeEditorDialog *mEditorDialog;
364 bool mReadWrite; 364 bool mReadWrite;
365 bool mModified; 365 bool mModified;
366 bool mIsPart; 366 bool mIsPart;
367 367
368 //US file menu 368 //US file menu
369 KAction *mActionMail; 369 KAction *mActionMail;
370 KAction* mActionPrint; 370 KAction* mActionPrint;
371 KAction* mActionNewContact; 371 KAction* mActionNewContact;
372 KAction *mActionSave; 372 KAction *mActionSave;
373 KAction *mActionEditAddressee; 373 KAction *mActionEditAddressee;
374 KAction *mActionMailVCard; 374 KAction *mActionMailVCard;
375 KAction *mActionQuit; 375 KAction *mActionQuit;
376 376
377 //US edit menu 377 //US edit menu
378 KAction *mActionCopy; 378 KAction *mActionCopy;
379 KAction *mActionCut; 379 KAction *mActionCut;
380 KAction *mActionPaste; 380 KAction *mActionPaste;
381 KAction *mActionSelectAll; 381 KAction *mActionSelectAll;
382 KAction *mActionUndo; 382 KAction *mActionUndo;
383 KAction *mActionRedo; 383 KAction *mActionRedo;
384 KAction *mActionDelete; 384 KAction *mActionDelete;
385 385
386 //US settings menu 386 //US settings menu
387 KAction *mActionConfigResources; 387 KAction *mActionConfigResources;
388 KAction *mActionConfigKAddressbook; 388 KAction *mActionConfigKAddressbook;
389 KAction *mActionConfigShortcuts; 389 KAction *mActionConfigShortcuts;
390 KAction *mActionConfigureToolbars; 390 KAction *mActionConfigureToolbars;
391 KAction *mActionKeyBindings; 391 KAction *mActionKeyBindings;
392 KToggleAction *mActionJumpBar; 392 KToggleAction *mActionJumpBar;
393 KToggleAction *mActionDetails; 393 KToggleAction *mActionDetails;
394 KAction *mActionWhoAmI; 394 KAction *mActionWhoAmI;
395 KAction *mActionCategories; 395 KAction *mActionCategories;
396 KAction *mActionAboutKAddressbook; 396 KAction *mActionAboutKAddressbook;
397 397
398 KAction *mActionDeleteView; 398 KAction *mActionDeleteView;
399 399
400 QPopupMenu *viewMenu; 400 QPopupMenu *viewMenu;
401 QPopupMenu *filterMenu; 401 QPopupMenu *filterMenu;
402 QPopupMenu *settingsMenu; 402 QPopupMenu *settingsMenu;
403 403
404//US QAction *mActionSave; 404//US QAction *mActionSave;
405 QPopupMenu *ImportMenu; 405 QPopupMenu *ImportMenu;
406 QPopupMenu *ExportMenu; 406 QPopupMenu *ExportMenu;
407 407
408#ifndef KAB_EMBEDDED 408#ifndef KAB_EMBEDDED
409 KAddressBookService *mAddressBookService; 409 KAddressBookService *mAddressBookService;
410#endif //KAB_EMBEDDED 410#endif //KAB_EMBEDDED
411 411
412 class KABCorePrivate; 412 class KABCorePrivate;
413 KABCorePrivate *d; 413 KABCorePrivate *d;
414 414
415#ifdef KAB_EMBEDDED 415#ifdef KAB_EMBEDDED
416 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 416 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
417#endif //KAB_EMBEDDED 417#endif //KAB_EMBEDDED
418 418
419}; 419};
420 420
421#endif 421#endif
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index 2ea2053..c953058 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -1,278 +1,290 @@
1#include <qtabwidget.h> 1#include <qtabwidget.h>
2#include <qpushbutton.h> 2#include <qpushbutton.h>
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qframe.h> 4#include <qframe.h>
5 5
6 6
7#include "klocale.h" 7#include "klocale.h"
8#include "kdebug.h" 8#include "kdebug.h"
9 9
10#include "kdialogbase.h" 10#include "kdialogbase.h"
11 11
12KDialogBase::KDialogBase() 12KDialogBase::KDialogBase()
13{ 13{
14} 14}
15 15
16KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, 16KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal,
17 const QString &caption, 17 const QString &caption,
18 int buttonMask, ButtonCode defaultButton, 18 int buttonMask, ButtonCode defaultButton,
19 bool separator, 19 bool separator,
20 const QString &user1, 20 const QString &user1,
21 const QString &user2, 21 const QString &user2,
22 const QString &user3) : 22 const QString &user3) :
23 KDialog( parent, name, modal ) 23 KDialog( parent, name, modal )
24{ 24{
25 init( caption, buttonMask, user1, user2 ); 25 init( caption, buttonMask, user1, user2 );
26 if (findButton( defaultButton ) ) 26 if (findButton( defaultButton ) )
27 (findButton( defaultButton ) )->setFocus(); 27 (findButton( defaultButton ) )->setFocus();
28 28
29} 29}
30 30
31KDialogBase::KDialogBase( int dialogFace, const QString &caption, 31KDialogBase::KDialogBase( int dialogFace, const QString &caption,
32 int buttonMask, ButtonCode defaultButton, 32 int buttonMask, ButtonCode defaultButton,
33 QWidget *parent, const char *name, bool modal, 33 QWidget *parent, const char *name, bool modal,
34 bool separator, 34 bool separator,
35 const QString &user1, 35 const QString &user1,
36 const QString &user2, 36 const QString &user2,
37 const QString &user3) : 37 const QString &user3) :
38 KDialog( parent, name, modal ) 38 KDialog( parent, name, modal )
39{ 39{
40 init( caption, buttonMask, user1, user2 ); 40 init( caption, buttonMask, user1, user2 );
41 if (findButton( defaultButton ) ) 41 if (findButton( defaultButton ) )
42 (findButton( defaultButton ) )->setFocus(); 42 (findButton( defaultButton ) )->setFocus();
43 43
44} 44}
45 45
46KDialogBase::~KDialogBase() 46KDialogBase::~KDialogBase()
47{ 47{
48} 48}
49 49
50void KDialogBase::init( const QString &caption, int buttonMask, 50void KDialogBase::init( const QString &caption, int buttonMask,
51 const QString &user1 ,const QString &user2 ) 51 const QString &user1 ,const QString &user2 )
52{ 52{
53 mMainWidget = 0; 53 mMainWidget = 0;
54 mTabWidget = 0; 54 mTabWidget = 0;
55 mPlainPage = 0; 55 mPlainPage = 0;
56 mTopLayout = 0; 56 mTopLayout = 0;
57 if ( !caption.isEmpty() ) { 57 if ( !caption.isEmpty() ) {
58 setCaption( caption ); 58 setCaption( caption );
59 } 59 }
60 60
61 if ( buttonMask & User1 ) { 61 if ( buttonMask & User1 ) {
62 mUser1Button = new QPushButton( user1, this ); 62 mUser1Button = new QPushButton( user1, this );
63 connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); 63 connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) );
64 } else { 64 } else {
65 mUser1Button = 0; 65 mUser1Button = 0;
66 } 66 }
67 if ( buttonMask & User2 ) { 67 if ( buttonMask & User2 ) {
68 mUser2Button = new QPushButton( user2, this ); 68 mUser2Button = new QPushButton( user2, this );
69 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); 69 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) );
70 } else { 70 } else {
71 mUser2Button = 0; 71 mUser2Button = 0;
72 } 72 }
73 73
74 if ( buttonMask & Ok ) { 74 if ( buttonMask & Ok ) {
75 mOkButton = new QPushButton( i18n("Ok"), this ); 75 mOkButton = new QPushButton( i18n("Ok"), this );
76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); 76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) );
77 } else { 77 } else {
78 mOkButton = 0; 78 mOkButton = 0;
79 } 79 }
80 if ( buttonMask & Default ) {
81 qDebug("buttonMask & Default ");
82 mDefaultButton = new QPushButton( i18n("Default"), this );
83 connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) );
84 } else {
85 mDefaultButton = 0;
86 }
80 87
81 if ( buttonMask & Apply ) { 88 if ( buttonMask & Apply ) {
82 mApplyButton = new QPushButton( i18n("Apply"), this ); 89 mApplyButton = new QPushButton( i18n("Apply"), this );
83 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); 90 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) );
84 } else { 91 } else {
85 mApplyButton = 0; 92 mApplyButton = 0;
86 } 93 }
87 94
88 if ( buttonMask & Cancel ) { 95 if ( buttonMask & Cancel ) {
89 mCancelButton = new QPushButton( i18n("Cancel"), this ); 96 mCancelButton = new QPushButton( i18n("Cancel"), this );
90 connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); 97 connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) );
91 } else { 98 } else {
92 mCancelButton = 0; 99 mCancelButton = 0;
93 } 100 }
94 101
95 if ( buttonMask & Close ) { 102 if ( buttonMask & Close ) {
96 mCloseButton = new QPushButton( i18n("Close"), this ); 103 mCloseButton = new QPushButton( i18n("Close"), this );
97 connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); 104 connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) );
98 } else { 105 } else {
99 mCloseButton = 0; 106 mCloseButton = 0;
100 } 107 }
101} 108}
102 109
103QTabWidget *KDialogBase::tabWidget() 110QTabWidget *KDialogBase::tabWidget()
104{ 111{
105 if ( !mTabWidget ) { 112 if ( !mTabWidget ) {
106 mTabWidget = new QTabWidget( this ); 113 mTabWidget = new QTabWidget( this );
107 setMainWidget( mTabWidget ); 114 setMainWidget( mTabWidget );
108 } 115 }
109 return mTabWidget; 116 return mTabWidget;
110} 117}
111 118
112void KDialogBase::hideButtons() 119void KDialogBase::hideButtons()
113{ 120{
114 if ( mUser1Button ) mUser1Button->hide() ; 121 if ( mUser1Button ) mUser1Button->hide() ;
115 if ( mUser2Button ) mUser2Button->hide() ; 122 if ( mUser2Button ) mUser2Button->hide() ;
116 if ( mOkButton ) mOkButton->hide() ; 123 if ( mOkButton ) mOkButton->hide() ;
117 if ( mApplyButton ) mApplyButton->hide() ; 124 if ( mApplyButton ) mApplyButton->hide() ;
125 if ( mDefaultButton ) mDefaultButton->hide();
118 if ( mCancelButton ) mCancelButton->hide() ; 126 if ( mCancelButton ) mCancelButton->hide() ;
119 if ( mCloseButton ) mCloseButton->hide() ; 127 if ( mCloseButton ) mCloseButton->hide() ;
120 128
121} 129}
122void KDialogBase::initLayout() 130void KDialogBase::initLayout()
123{ 131{
124 132
125 delete mTopLayout; 133 delete mTopLayout;
126 mTopLayout = new QVBoxLayout( this ); 134 mTopLayout = new QVBoxLayout( this );
127 mTopLayout->setMargin( marginHint() ); 135 mTopLayout->setMargin( marginHint() );
128 mTopLayout->setSpacing( spacingHint() ); 136 mTopLayout->setSpacing( spacingHint() );
129 137
130 mTopLayout->addWidget( mMainWidget ); 138 mTopLayout->addWidget( mMainWidget );
131 139
132 QBoxLayout *buttonLayout = new QHBoxLayout; 140 QBoxLayout *buttonLayout = new QHBoxLayout;
133 mTopLayout->addLayout( buttonLayout ); 141 mTopLayout->addLayout( buttonLayout );
134 142
135 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); 143 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button );
136 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); 144 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button );
137 if ( mOkButton ) buttonLayout->addWidget( mOkButton ); 145 if ( mOkButton ) buttonLayout->addWidget( mOkButton );
138 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); 146 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton );
147 if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton );
139 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); 148 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton );
140 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); 149 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton );
141} 150}
142 151
143QFrame *KDialogBase::addPage( const QString &name ) 152QFrame *KDialogBase::addPage( const QString &name )
144{ 153{
145// kdDebug() << "KDialogBase::addPage(): " << name << endl; 154// kdDebug() << "KDialogBase::addPage(): " << name << endl;
146 QFrame *frame = new QFrame( tabWidget() ); 155 QFrame *frame = new QFrame( tabWidget() );
147 tabWidget()->addTab( frame, name ); 156 tabWidget()->addTab( frame, name );
148 return frame; 157 return frame;
149} 158}
150 159
151QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) 160QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & )
152{ 161{
153 return addPage( name ); 162 return addPage( name );
154} 163}
155 164
156 165
157void KDialogBase::setMainWidget( QWidget *widget ) 166void KDialogBase::setMainWidget( QWidget *widget )
158{ 167{
159 kdDebug() << "KDialogBase::setMainWidget()" << endl; 168 kdDebug() << "KDialogBase::setMainWidget()" << endl;
160 169
161 mMainWidget = widget; 170 mMainWidget = widget;
162 initLayout(); 171 initLayout();
163} 172}
164 173
165void KDialogBase::setButtonText( ButtonCode id, const QString &text ) 174void KDialogBase::setButtonText( ButtonCode id, const QString &text )
166{ 175{
167 QPushButton *button = findButton( id ); 176 QPushButton *button = findButton( id );
168 if ( button ) { 177 if ( button ) {
169 button->setText( text ); 178 button->setText( text );
170 } 179 }
171} 180}
172 181
173void KDialogBase::enableButton( ButtonCode id, bool state ) 182void KDialogBase::enableButton( ButtonCode id, bool state )
174{ 183{
175 QPushButton *button = findButton( id ); 184 QPushButton *button = findButton( id );
176 if ( button ) { 185 if ( button ) {
177 button->setEnabled( state ); 186 button->setEnabled( state );
178 } 187 }
179} 188}
180 189
181QPushButton *KDialogBase::findButton( ButtonCode id ) 190QPushButton *KDialogBase::findButton( ButtonCode id )
182{ 191{
183 QPushButton *button = 0; 192 QPushButton *button = 0;
184 switch ( id ) { 193 switch ( id ) {
185 case Ok: 194 case Ok:
186 button = mOkButton; 195 button = mOkButton;
187 break; 196 break;
188 case Apply: 197 case Apply:
189 button = mApplyButton; 198 button = mApplyButton;
190 break; 199 break;
191 case User1: 200 case User1:
192 button = mUser1Button; 201 button = mUser1Button;
193 break; 202 break;
194 case User2: 203 case User2:
195 button = mUser2Button; 204 button = mUser2Button;
196 break; 205 break;
197 case Cancel: 206 case Cancel:
198 button = mCancelButton; 207 button = mCancelButton;
208 break;
209 case Default:
210 button = mDefaultButton;
199 break; 211 break;
200 case Close: 212 case Close:
201 button = mCloseButton; 213 button = mCloseButton;
202 break; 214 break;
203 default: 215 default:
204 break; 216 break;
205 } 217 }
206 return button; 218 return button;
207} 219}
208 220
209void KDialogBase::enableButtonOK( bool state ) 221void KDialogBase::enableButtonOK( bool state )
210{ 222{
211 enableButton( Ok, state ); 223 enableButton( Ok, state );
212} 224}
213 225
214void KDialogBase::enableButtonApply( bool state ) 226void KDialogBase::enableButtonApply( bool state )
215{ 227{
216 enableButton( Apply, state ); 228 enableButton( Apply, state );
217} 229}
218 230
219void KDialogBase::showButton( ButtonCode id, bool show ) 231void KDialogBase::showButton( ButtonCode id, bool show )
220{ 232{
221 QPushButton *button = findButton( id ); 233 QPushButton *button = findButton( id );
222 if ( button ) { 234 if ( button ) {
223 if ( show ) button->show(); 235 if ( show ) button->show();
224 else button->hide(); 236 else button->hide();
225 } 237 }
226} 238}
227 239
228int KDialogBase::pageIndex( QWidget *widget ) const 240int KDialogBase::pageIndex( QWidget *widget ) const
229{ 241{
230 return 0; 242 return 0;
231} 243}
232 244
233 245
234bool KDialogBase::showPage( int index ) 246bool KDialogBase::showPage( int index )
235{ 247{
236 tabWidget()->setCurrentPage( index );return false; 248 tabWidget()->setCurrentPage( index );return false;
237} 249}
238 250
239QFrame *KDialogBase::plainPage() 251QFrame *KDialogBase::plainPage()
240{ 252{
241 if ( !mPlainPage ) { 253 if ( !mPlainPage ) {
242 mPlainPage = new QFrame( this ); 254 mPlainPage = new QFrame( this );
243 setMainWidget( mPlainPage ); 255 setMainWidget( mPlainPage );
244 } 256 }
245 return mPlainPage; 257 return mPlainPage;
246} 258}
247 259
248void KDialogBase::slotOk() 260void KDialogBase::slotOk()
249{ 261{
250 emit okClicked(); 262 emit okClicked();
251 accept(); 263 accept();
252} 264}
253 265
254void KDialogBase::slotApply() 266void KDialogBase::slotApply()
255{ 267{
256 emit applyClicked(); 268 emit applyClicked();
257} 269}
258 270
259void KDialogBase::slotCancel() 271void KDialogBase::slotCancel()
260{ 272{
261 emit cancelClicked(); 273 emit cancelClicked();
262 reject(); 274 reject();
263} 275}
264 276
265void KDialogBase::slotClose() 277void KDialogBase::slotClose()
266{ 278{
267 emit closeClicked(); 279 emit closeClicked();
268 reject(); 280 reject();
269} 281}
270 282
271void KDialogBase::slotUser1() 283void KDialogBase::slotUser1()
272{ 284{
273 emit user1Clicked(); 285 emit user1Clicked();
274} 286}
275void KDialogBase::slotUser2() 287void KDialogBase::slotUser2()
276{ 288{
277 emit user2Clicked(); 289 emit user2Clicked();
278} 290}
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h
index 199d2fa..7b44bfb 100644
--- a/microkde/kdialogbase.h
+++ b/microkde/kdialogbase.h
@@ -1,139 +1,141 @@
1#ifndef MINIKDE_KDIALOGBASE_H 1#ifndef MINIKDE_KDIALOGBASE_H
2#define MINIKDE_KDIALOGBASE_H 2#define MINIKDE_KDIALOGBASE_H
3 3
4#include <qframe.h> 4#include <qframe.h>
5 5
6#include "kdialog.h" 6#include "kdialog.h"
7 7
8class QPushButton; 8class QPushButton;
9class QLayout; 9class QLayout;
10class QTabWidget; 10class QTabWidget;
11class QBoxLayout; 11class QBoxLayout;
12 12
13class KDialogBase : public KDialog 13class KDialogBase : public KDialog
14{ 14{
15 Q_OBJECT 15 Q_OBJECT
16 public: 16 public:
17 enum ButtonCode 17 enum ButtonCode
18 { 18 {
19 Help = 0x00000001, 19 Help = 0x00000001,
20 Default = 0x00000002, 20 Default = 0x00000002,
21 Ok = 0x00000004, 21 Ok = 0x00000004,
22 Apply = 0x00000008, 22 Apply = 0x00000008,
23 Try = 0x00000010, 23 Try = 0x00000010,
24 Cancel = 0x00000020, 24 Cancel = 0x00000020,
25 Close = 0x00000040, 25 Close = 0x00000040,
26 User1 = 0x00000080, 26 User1 = 0x00000080,
27 User2 = 0x00000100, 27 User2 = 0x00000100,
28 User3 = 0x00000200, 28 User3 = 0x00000200,
29 No = 0x00000080, 29 No = 0x00000080,
30 Yes = 0x00000100, 30 Yes = 0x00000100,
31 Details = 0x00000400, 31 Details = 0x00000400,
32 Filler = 0x40000000, 32 Filler = 0x40000000,
33 Stretch = 0x80000000 33 Stretch = 0x80000000
34 }; 34 };
35 35
36 enum DialogType 36 enum DialogType
37 { 37 {
38 TreeList, 38 TreeList,
39 Tabbed, 39 Tabbed,
40 Plain, 40 Plain,
41 Swallow, 41 Swallow,
42 IconList 42 IconList
43 }; 43 };
44 44
45 KDialogBase(); 45 KDialogBase();
46 KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, 46 KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true,
47 const QString &caption=QString::null, 47 const QString &caption=QString::null,
48 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, 48 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
49 bool separator=false, 49 bool separator=false,
50 const QString &user1=QString::null, 50 const QString &user1=QString::null,
51 const QString &user2=QString::null, 51 const QString &user2=QString::null,
52 const QString &user3=QString::null); 52 const QString &user3=QString::null);
53 KDialogBase( int dialogFace, const QString &caption, 53 KDialogBase( int dialogFace, const QString &caption,
54 int buttonMask, ButtonCode defaultButton, 54 int buttonMask, ButtonCode defaultButton,
55 QWidget *parent=0, const char *name=0, bool modal=true, 55 QWidget *parent=0, const char *name=0, bool modal=true,
56 bool separator=false, 56 bool separator=false,
57 const QString &user1=QString::null, 57 const QString &user1=QString::null,
58 const QString &user2=QString::null, 58 const QString &user2=QString::null,
59 const QString &user3=QString::null); 59 const QString &user3=QString::null);
60 virtual ~KDialogBase(); 60 virtual ~KDialogBase();
61 61
62 QFrame *addPage( const QString & ); 62 QFrame *addPage( const QString & );
63 QFrame *addPage( const QString &, int, const QPixmap & ); 63 QFrame *addPage( const QString &, int, const QPixmap & );
64 64
65 void setMainWidget( QWidget *widget ); 65 void setMainWidget( QWidget *widget );
66 66
67 void setButtonText( ButtonCode id, const QString &text ); 67 void setButtonText( ButtonCode id, const QString &text );
68 68
69 void enableButton( ButtonCode id, bool state ); 69 void enableButton( ButtonCode id, bool state );
70 void enableButtonOK( bool state ); 70 void enableButtonOK( bool state );
71 void enableButtonApply( bool state ); 71 void enableButtonApply( bool state );
72 72
73 void showButton( ButtonCode, bool show ); 73 void showButton( ButtonCode, bool show );
74 74
75 int pageIndex( QWidget *widget ) const; 75 int pageIndex( QWidget *widget ) const;
76 76
77 bool showPage( int index ); 77 bool showPage( int index );
78 void hideButtons(); 78 void hideButtons();
79 79
80 QFrame *plainPage(); 80 QFrame *plainPage();
81 81
82 signals: 82 signals:
83 void user1Clicked(); 83 void user1Clicked();
84 void user2Clicked(); 84 void user2Clicked();
85 /** 85 /**
86 * The Apply button was pressed. This signal is only emitted if 86 * The Apply button was pressed. This signal is only emitted if
87 * @ref slotApply() is not replaced. 87 * @ref slotApply() is not replaced.
88 */ 88 */
89 void applyClicked(); 89 void applyClicked();
90 90
91 /** 91 /**
92 * The OK button was pressed. This signal is only emitted if 92 * The OK button was pressed. This signal is only emitted if
93 * @ref slotOk() is not replaced. 93 * @ref slotOk() is not replaced.
94 */ 94 */
95 void okClicked(); 95 void okClicked();
96 96
97 /** 97 /**
98 * The Cancel button was pressed. This signal is only emitted if 98 * The Cancel button was pressed. This signal is only emitted if
99 * @ref slotCancel() is not replaced. 99 * @ref slotCancel() is not replaced.
100 */ 100 */
101 void cancelClicked(); 101 void cancelClicked();
102 102
103 /** 103 /**
104 * The Close button was pressed. This signal is only emitted if 104 * The Close button was pressed. This signal is only emitted if
105 * @ref slotClose() is not replaced. 105 * @ref slotClose() is not replaced.
106 */ 106 */
107 void closeClicked(); 107 void closeClicked();
108 void defaultClicked();
108 109
109 protected slots: 110 protected slots:
110 virtual void slotOk(); 111 virtual void slotOk();
111 virtual void slotApply(); 112 virtual void slotApply();
112 virtual void slotCancel(); 113 virtual void slotCancel();
113 virtual void slotClose(); 114 virtual void slotClose();
114 virtual void slotUser1(); 115 virtual void slotUser1();
115 virtual void slotUser2(); 116 virtual void slotUser2();
116 117
117 protected: 118 protected:
118 QPushButton *findButton( ButtonCode ); 119 QPushButton *findButton( ButtonCode );
119 120
120 private: 121 private:
121 QTabWidget *tabWidget(); 122 QTabWidget *tabWidget();
122 void init( const QString &caption, int buttonMask, 123 void init( const QString &caption, int buttonMask,
123 const QString &user1=QString::null, const QString &user2=QString::null ); 124 const QString &user1=QString::null, const QString &user2=QString::null );
124 void initLayout(); 125 void initLayout();
125 126
126 QWidget *mMainWidget; 127 QWidget *mMainWidget;
127 QTabWidget *mTabWidget; 128 QTabWidget *mTabWidget;
128 QFrame *mPlainPage; 129 QFrame *mPlainPage;
129 QBoxLayout *mTopLayout; 130 QBoxLayout *mTopLayout;
130 131
131 QPushButton *mUser1Button; 132 QPushButton *mUser1Button;
132 QPushButton *mUser2Button; 133 QPushButton *mUser2Button;
133 QPushButton *mCloseButton; 134 QPushButton *mCloseButton;
134 QPushButton *mOkButton; 135 QPushButton *mOkButton;
135 QPushButton *mApplyButton; 136 QPushButton *mApplyButton;
136 QPushButton *mCancelButton; 137 QPushButton *mCancelButton;
138 QPushButton *mDefaultButton;
137}; 139};
138 140
139#endif 141#endif