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,329 +1,331 @@
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;
@@ -665,572 +667,564 @@ void KABCore::incrementalSearch( const QString& text )
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*/
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index b84ec22..c823f1f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -234,188 +234,188 @@ class KABCore : public QWidget
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