author | zautrix <zautrix> | 2004-07-05 09:24:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-05 09:24:56 (UTC) |
commit | 5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0 (patch) (unidiff) | |
tree | f41b695d2b18bf7d7ff84d0d8b39faf15d229669 | |
parent | c2d4beeaeda44694a3e1c0b72a5808d2f518b286 (diff) | |
download | kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.zip kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.gz kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.bz2 |
Removed strange handling of addresseeeditor
-rw-r--r-- | kaddressbook/addresseeeditordialog.cpp | 34 | ||||
-rw-r--r-- | kaddressbook/addresseeeditordialog.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 44 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 4 | ||||
-rw-r--r-- | microkde/kdialogbase.cpp | 12 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 4 |
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 | ||
35 | AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, | 36 | AddresseeEditorDialog::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 | ||
59 | AddresseeEditorDialog::~AddresseeEditorDialog() | 59 | AddresseeEditorDialog::~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 | ||
66 | void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) | 65 | void 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 | ||
73 | KABC::Addressee AddresseeEditorDialog::addressee() | 72 | KABC::Addressee AddresseeEditorDialog::addressee() |
74 | { | 73 | { |
75 | return mEditorWidget->addressee(); | 74 | return mEditorWidget->addressee(); |
76 | } | 75 | } |
77 | 76 | ||
78 | bool AddresseeEditorDialog::dirty() | 77 | bool AddresseeEditorDialog::dirty() |
79 | { | 78 | { |
80 | return mEditorWidget->dirty(); | 79 | return mEditorWidget->dirty(); |
81 | } | 80 | } |
82 | 81 | ||
83 | void AddresseeEditorDialog::slotApply() | 82 | void 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 | ||
94 | void AddresseeEditorDialog:: accept () | ||
95 | { | ||
96 | slotOk(); | ||
97 | |||
98 | } | ||
95 | void AddresseeEditorDialog::slotOk() | 99 | void 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 | ||
109 | void AddresseeEditorDialog::widgetModified() | 107 | void AddresseeEditorDialog::widgetModified() |
110 | { | 108 | { |
111 | enableButton( KDialogBase::Apply, true ); | 109 | enableButton( KDialogBase::Apply, true ); |
112 | } | 110 | } |
113 | 111 | ||
114 | void AddresseeEditorDialog::slotCancel() | 112 | void 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 | |||
@@ -32,31 +32,32 @@ class AddresseeEditorWidget; | |||
32 | class QWidget; | 32 | class QWidget; |
33 | class KABCore; | 33 | class KABCore; |
34 | 34 | ||
35 | class AddresseeEditorDialog : public KDialogBase | 35 | class 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 | |||
@@ -42,48 +42,49 @@ | |||
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> |
@@ -177,49 +178,50 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
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 | ||
205 | KABCore::~KABCore() | 207 | KABCore::~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 | ||
221 | void KABCore::restoreSettings() | 223 | void 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 ); |
@@ -769,55 +771,55 @@ void KABCore::contactModified( const KABC::Addressee &addr ) | |||
769 | void KABCore::newContact() | 771 | void 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 | ||
805 | void KABCore::addEmail( QString aStr ) | 807 | void 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 | } |
@@ -846,59 +848,50 @@ void KABCore::importVCard( const QString &vCard, bool showPreview ) | |||
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 |
850 | void KABCore::editContact2() { | 852 | void KABCore::editContact2() { |
851 | editContact( QString::null ); | 853 | editContact( QString::null ); |
852 | } | 854 | } |
853 | 855 | ||
854 | void KABCore::editContact( const QString &uid ) | 856 | void 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 | ||
884 | void KABCore::save() | 877 | void 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!")); |
@@ -1067,66 +1060,67 @@ void KABCore::configurationChanged() | |||
1067 | 1060 | ||
1068 | void KABCore::addressBookChanged() | 1061 | void 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 | ||
1088 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1081 | AddresseeEditorDialog *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 | ||
1106 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1099 | void 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 | ||
1111 | void KABCore::initGUI() | 1105 | void 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 ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index b84ec22..c823f1f 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -338,50 +338,50 @@ class KABCore : public QWidget | |||
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; |
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 2ea2053..c953058 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -56,107 +56,116 @@ void KDialogBase::init( const QString &caption, int buttonMask, | |||
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 | ||
103 | QTabWidget *KDialogBase::tabWidget() | 110 | QTabWidget *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 | ||
112 | void KDialogBase::hideButtons() | 119 | void 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 | } |
122 | void KDialogBase::initLayout() | 130 | void 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 | ||
143 | QFrame *KDialogBase::addPage( const QString &name ) | 152 | QFrame *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 | ||
151 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 160 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
152 | { | 161 | { |
153 | return addPage( name ); | 162 | return addPage( name ); |
154 | } | 163 | } |
155 | 164 | ||
156 | 165 | ||
157 | void KDialogBase::setMainWidget( QWidget *widget ) | 166 | void 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(); |
@@ -175,48 +184,51 @@ void KDialogBase::enableButton( ButtonCode id, bool state ) | |||
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 | ||
181 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 190 | QPushButton *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 | ||
209 | void KDialogBase::enableButtonOK( bool state ) | 221 | void KDialogBase::enableButtonOK( bool state ) |
210 | { | 222 | { |
211 | enableButton( Ok, state ); | 223 | enableButton( Ok, state ); |
212 | } | 224 | } |
213 | 225 | ||
214 | void KDialogBase::enableButtonApply( bool state ) | 226 | void KDialogBase::enableButtonApply( bool state ) |
215 | { | 227 | { |
216 | enableButton( Apply, state ); | 228 | enableButton( Apply, state ); |
217 | } | 229 | } |
218 | 230 | ||
219 | void KDialogBase::showButton( ButtonCode id, bool show ) | 231 | void KDialogBase::showButton( ButtonCode id, bool show ) |
220 | { | 232 | { |
221 | QPushButton *button = findButton( id ); | 233 | QPushButton *button = findButton( id ); |
222 | if ( button ) { | 234 | if ( button ) { |
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 199d2fa..7b44bfb 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h | |||
@@ -84,56 +84,58 @@ class KDialogBase : public KDialog | |||
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 |