author | zautrix <zautrix> | 2004-07-03 22:32:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-03 22:32:36 (UTC) |
commit | 00fe3539778c859d22f595e516733b3cc792e167 (patch) (unidiff) | |
tree | 0970b0a64c63395a0d66f1debe8226501b08e7ea | |
parent | 5e59162e6eb6603610d1ca4c96d5d97acae0f60b (diff) | |
download | kdepimpi-00fe3539778c859d22f595e516733b3cc792e167.zip kdepimpi-00fe3539778c859d22f595e516733b3cc792e167.tar.gz kdepimpi-00fe3539778c859d22f595e516733b3cc792e167.tar.bz2 |
Made configure kaddressbook dialog fitting on 5500 display
-rw-r--r-- | kaddressbook/kabcore.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/addresseewidget.cpp | 14 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 14 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.cpp | 6 |
4 files changed, 26 insertions, 9 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7bf1a2f..a6d722d 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,1605 +1,1606 @@ | |||
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 "KDGanttMinimizeSplitter.h" | 66 | #include "KDGanttMinimizeSplitter.h" |
67 | #include "kaddressbookmain.h" | 67 | #include "kaddressbookmain.h" |
68 | #include "kactioncollection.h" | 68 | #include "kactioncollection.h" |
69 | #include <qapp.h> | 69 | #include <qapp.h> |
70 | #include <qmenubar.h> | 70 | #include <qmenubar.h> |
71 | //#include <qtoolbar.h> | 71 | //#include <qtoolbar.h> |
72 | #include <qmessagebox.h> | 72 | #include <qmessagebox.h> |
73 | #include <kdebug.h> | 73 | #include <kdebug.h> |
74 | #include <kiconloader.h> // needed for SmallIcon | 74 | #include <kiconloader.h> // needed for SmallIcon |
75 | #include <kresources/kcmkresources.h> | 75 | #include <kresources/kcmkresources.h> |
76 | #include <ktoolbar.h> | 76 | #include <ktoolbar.h> |
77 | 77 | ||
78 | #include <kcmkabconfig.h> | 78 | #include <kcmkabconfig.h> |
79 | 79 | ||
80 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap | 80 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap |
81 | //#include <qlabel.h> | 81 | //#include <qlabel.h> |
82 | #endif // KAB_EMBEDDED | 82 | #endif // KAB_EMBEDDED |
83 | #include <kcmkabconfig.h> | 83 | #include <kcmkabconfig.h> |
84 | 84 | ||
85 | 85 | ||
86 | #include <kresources/selectdialog.h> | 86 | #include <kresources/selectdialog.h> |
87 | #include <kmessagebox.h> | 87 | #include <kmessagebox.h> |
88 | 88 | ||
89 | #include <picture.h> | 89 | #include <picture.h> |
90 | #include <resource.h> | 90 | #include <resource.h> |
91 | 91 | ||
92 | //US#include <qsplitter.h> | 92 | //US#include <qsplitter.h> |
93 | #include <qvbox.h> | 93 | #include <qvbox.h> |
94 | #include <qlayout.h> | 94 | #include <qlayout.h> |
95 | #include <qclipboard.h> | 95 | #include <qclipboard.h> |
96 | 96 | ||
97 | #include <libkdepim/categoryselectdialog.h> | 97 | #include <libkdepim/categoryselectdialog.h> |
98 | 98 | ||
99 | #include "addresseeutil.h" | 99 | #include "addresseeutil.h" |
100 | #include "undocmds.h" | 100 | #include "undocmds.h" |
101 | #include "addresseeeditordialog.h" | 101 | #include "addresseeeditordialog.h" |
102 | #include "viewmanager.h" | 102 | #include "viewmanager.h" |
103 | #include "details/detailsviewcontainer.h" | 103 | #include "details/detailsviewcontainer.h" |
104 | #include "kabprefs.h" | 104 | #include "kabprefs.h" |
105 | #include "xxportmanager.h" | 105 | #include "xxportmanager.h" |
106 | #include "incsearchwidget.h" | 106 | #include "incsearchwidget.h" |
107 | #include "jumpbuttonbar.h" | 107 | #include "jumpbuttonbar.h" |
108 | #include "extensionmanager.h" | 108 | #include "extensionmanager.h" |
109 | #include "addresseeconfig.h" | 109 | #include "addresseeconfig.h" |
110 | #include <kcmultidialog.h> | 110 | #include <kcmultidialog.h> |
111 | 111 | ||
112 | 112 | ||
113 | #ifdef KAB_EMBEDDED | 113 | #ifdef KAB_EMBEDDED |
114 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 114 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
115 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 115 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
116 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 116 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
117 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 117 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
118 | #else //KAB_EMBEDDED | 118 | #else //KAB_EMBEDDED |
119 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 119 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
120 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 120 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
121 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 121 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
122 | mReadWrite( readWrite ), mModified( false ) | 122 | mReadWrite( readWrite ), mModified( false ) |
123 | #endif //KAB_EMBEDDED | 123 | #endif //KAB_EMBEDDED |
124 | { | 124 | { |
125 | #ifdef KAB_EMBEDDED | 125 | #ifdef KAB_EMBEDDED |
126 | //US we define here our own global actioncollection. | 126 | //US we define here our own global actioncollection. |
127 | //mActionCollection = new KActionCollection(this); | 127 | //mActionCollection = new KActionCollection(this); |
128 | #endif //KAB_EMBEDDED | 128 | #endif //KAB_EMBEDDED |
129 | mExtensionBarSplitter = 0; | 129 | mExtensionBarSplitter = 0; |
130 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 130 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
131 | 131 | ||
132 | mAddressBook = KABC::StdAddressBook::self(); | 132 | mAddressBook = KABC::StdAddressBook::self(); |
133 | KABC::StdAddressBook::setAutomaticSave( true ); | 133 | KABC::StdAddressBook::setAutomaticSave( true ); |
134 | 134 | ||
135 | #ifndef KAB_EMBEDDED | 135 | #ifndef KAB_EMBEDDED |
136 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 136 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
137 | #endif //KAB_EMBEDDED | 137 | #endif //KAB_EMBEDDED |
138 | 138 | ||
139 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 139 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
140 | SLOT( addressBookChanged() ) ); | 140 | SLOT( addressBookChanged() ) ); |
141 | 141 | ||
142 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 142 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
143 | "X-Department", "KADDRESSBOOK" ); | 143 | "X-Department", "KADDRESSBOOK" ); |
144 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 144 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
145 | "X-Profession", "KADDRESSBOOK" ); | 145 | "X-Profession", "KADDRESSBOOK" ); |
146 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 146 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
147 | "X-AssistantsName", "KADDRESSBOOK" ); | 147 | "X-AssistantsName", "KADDRESSBOOK" ); |
148 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 148 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
149 | "X-ManagersName", "KADDRESSBOOK" ); | 149 | "X-ManagersName", "KADDRESSBOOK" ); |
150 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 150 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
151 | "X-SpousesName", "KADDRESSBOOK" ); | 151 | "X-SpousesName", "KADDRESSBOOK" ); |
152 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 152 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
153 | "X-Office", "KADDRESSBOOK" ); | 153 | "X-Office", "KADDRESSBOOK" ); |
154 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 154 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
155 | "X-IMAddress", "KADDRESSBOOK" ); | 155 | "X-IMAddress", "KADDRESSBOOK" ); |
156 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 156 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
157 | "X-Anniversary", "KADDRESSBOOK" ); | 157 | "X-Anniversary", "KADDRESSBOOK" ); |
158 | 158 | ||
159 | //US added this field to become compatible with Opie addressbook | 159 | //US added this field to become compatible with Opie addressbook |
160 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 160 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
161 | "X-Gender", "KADDRESSBOOK" ); | 161 | "X-Gender", "KADDRESSBOOK" ); |
162 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 162 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
163 | "X-Children", "KADDRESSBOOK" ); | 163 | "X-Children", "KADDRESSBOOK" ); |
164 | 164 | ||
165 | initGUI(); | 165 | initGUI(); |
166 | 166 | ||
167 | mIncSearchWidget->setFocus(); | 167 | mIncSearchWidget->setFocus(); |
168 | 168 | ||
169 | 169 | ||
170 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 170 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
171 | SLOT( setContactSelected( const QString& ) ) ); | 171 | SLOT( setContactSelected( const QString& ) ) ); |
172 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 172 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
173 | SLOT( editContact( const QString& ) ) ); | 173 | SLOT( editContact( const QString& ) ) ); |
174 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 174 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
175 | SLOT( deleteContacts( ) ) ); | 175 | SLOT( deleteContacts( ) ) ); |
176 | connect( mViewManager, SIGNAL( modified() ), | 176 | connect( mViewManager, SIGNAL( modified() ), |
177 | SLOT( setModified() ) ); | 177 | SLOT( setModified() ) ); |
178 | 178 | ||
179 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 179 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
180 | 180 | ||
181 | connect( mXXPortManager, SIGNAL( modified() ), | 181 | connect( mXXPortManager, SIGNAL( modified() ), |
182 | SLOT( setModified() ) ); | 182 | SLOT( setModified() ) ); |
183 | 183 | ||
184 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 184 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
185 | SLOT( incrementalSearch( const QString& ) ) ); | 185 | SLOT( incrementalSearch( const QString& ) ) ); |
186 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 186 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
187 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 187 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
188 | 188 | ||
189 | #ifndef KAB_EMBEDDED | 189 | #ifndef KAB_EMBEDDED |
190 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 190 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
191 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 191 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
192 | 192 | ||
193 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 193 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
194 | SLOT( sendMail( const QString& ) ) ); | 194 | SLOT( sendMail( const QString& ) ) ); |
195 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 195 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
196 | SLOT( browse( const QString& ) ) ); | 196 | SLOT( browse( const QString& ) ) ); |
197 | 197 | ||
198 | mAddressBookService = new KAddressBookService( this ); | 198 | mAddressBookService = new KAddressBookService( this ); |
199 | 199 | ||
200 | #endif //KAB_EMBEDDED | 200 | #endif //KAB_EMBEDDED |
201 | 201 | ||
202 | setModified( false ); | 202 | setModified( false ); |
203 | } | 203 | } |
204 | 204 | ||
205 | KABCore::~KABCore() | 205 | KABCore::~KABCore() |
206 | { | 206 | { |
207 | // save(); | 207 | // save(); |
208 | //saveSettings(); | 208 | //saveSettings(); |
209 | //KABPrefs::instance()->writeConfig(); | 209 | //KABPrefs::instance()->writeConfig(); |
210 | delete AddresseeConfig::instance(); | 210 | delete AddresseeConfig::instance(); |
211 | mAddressBook = 0; | 211 | mAddressBook = 0; |
212 | KABC::StdAddressBook::close(); | 212 | KABC::StdAddressBook::close(); |
213 | 213 | ||
214 | #ifdef KAB_EMBEDDED | 214 | #ifdef KAB_EMBEDDED |
215 | //US we define here our own global actioncollection. | 215 | //US we define here our own global actioncollection. |
216 | // delete mActionCollection; | 216 | // delete mActionCollection; |
217 | #endif //KAB_EMBEDDED | 217 | #endif //KAB_EMBEDDED |
218 | 218 | ||
219 | } | 219 | } |
220 | 220 | ||
221 | void KABCore::restoreSettings() | 221 | void KABCore::restoreSettings() |
222 | { | 222 | { |
223 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 223 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
224 | 224 | ||
225 | mActionJumpBar->setChecked( state ); | 225 | mActionJumpBar->setChecked( state ); |
226 | setJumpButtonBarVisible( state ); | 226 | setJumpButtonBarVisible( state ); |
227 | 227 | ||
228 | state = KABPrefs::instance()->mDetailsPageVisible; | 228 | state = KABPrefs::instance()->mDetailsPageVisible; |
229 | 229 | ||
230 | mActionDetails->setChecked( state ); | 230 | mActionDetails->setChecked( state ); |
231 | setDetailsVisible( state ); | 231 | setDetailsVisible( state ); |
232 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 232 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
233 | if ( splitterSize.count() == 0 ) { | 233 | if ( splitterSize.count() == 0 ) { |
234 | splitterSize.append( width() / 2 ); | 234 | splitterSize.append( width() / 2 ); |
235 | splitterSize.append( width() / 2 ); | 235 | splitterSize.append( width() / 2 ); |
236 | } | 236 | } |
237 | mMiniSplitter->setSizes( splitterSize ); | 237 | mMiniSplitter->setSizes( splitterSize ); |
238 | if ( mExtensionBarSplitter ) { | 238 | if ( mExtensionBarSplitter ) { |
239 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 239 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
240 | if ( splitterSize.count() == 0 ) { | 240 | if ( splitterSize.count() == 0 ) { |
241 | splitterSize.append( width() / 2 ); | 241 | splitterSize.append( width() / 2 ); |
242 | splitterSize.append( width() / 2 ); | 242 | splitterSize.append( width() / 2 ); |
243 | } | 243 | } |
244 | mExtensionBarSplitter->setSizes( splitterSize ); | 244 | mExtensionBarSplitter->setSizes( splitterSize ); |
245 | 245 | ||
246 | } | 246 | } |
247 | #ifndef KAB_EMBEDDED | 247 | #ifndef KAB_EMBEDDED |
248 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 248 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
249 | if ( splitterSize.count() == 0 ) { | 249 | if ( splitterSize.count() == 0 ) { |
250 | splitterSize.append( width() / 2 ); | 250 | splitterSize.append( width() / 2 ); |
251 | splitterSize.append( width() / 2 ); | 251 | splitterSize.append( width() / 2 ); |
252 | } | 252 | } |
253 | mExtensionBarSplitter->setSizes( splitterSize ); | 253 | mExtensionBarSplitter->setSizes( splitterSize ); |
254 | 254 | ||
255 | splitterSize = KABPrefs::instance()->mDetailsSplitter; | 255 | splitterSize = KABPrefs::instance()->mDetailsSplitter; |
256 | if ( splitterSize.count() == 0 ) { | 256 | if ( splitterSize.count() == 0 ) { |
257 | splitterSize.append( height() / 2 ); | 257 | splitterSize.append( height() / 2 ); |
258 | splitterSize.append( height() / 2 ); | 258 | splitterSize.append( height() / 2 ); |
259 | } | 259 | } |
260 | mDetailsSplitter->setSizes( splitterSize ); | 260 | mDetailsSplitter->setSizes( splitterSize ); |
261 | 261 | ||
262 | mExtensionManager->restoreSettings(); | 262 | mExtensionManager->restoreSettings(); |
263 | 263 | ||
264 | #endif //KAB_EMBEDDED | 264 | #endif //KAB_EMBEDDED |
265 | 265 | ||
266 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 266 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
267 | 267 | ||
268 | mViewManager->restoreSettings(); | 268 | mViewManager->restoreSettings(); |
269 | mExtensionManager->restoreSettings(); | 269 | mExtensionManager->restoreSettings(); |
270 | } | 270 | } |
271 | 271 | ||
272 | void KABCore::saveSettings() | 272 | void KABCore::saveSettings() |
273 | { | 273 | { |
274 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 274 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
275 | if ( mExtensionBarSplitter ) | 275 | if ( mExtensionBarSplitter ) |
276 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 276 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
277 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 277 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
278 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 278 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
279 | #ifndef KAB_EMBEDDED | 279 | #ifndef KAB_EMBEDDED |
280 | 280 | ||
281 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 281 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
282 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 282 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
283 | #endif //KAB_EMBEDDED | 283 | #endif //KAB_EMBEDDED |
284 | mExtensionManager->saveSettings(); | 284 | mExtensionManager->saveSettings(); |
285 | mViewManager->saveSettings(); | 285 | mViewManager->saveSettings(); |
286 | 286 | ||
287 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 287 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
288 | 288 | ||
289 | } | 289 | } |
290 | 290 | ||
291 | KABC::AddressBook *KABCore::addressBook() const | 291 | KABC::AddressBook *KABCore::addressBook() const |
292 | { | 292 | { |
293 | return mAddressBook; | 293 | return mAddressBook; |
294 | } | 294 | } |
295 | 295 | ||
296 | KConfig *KABCore::config() | 296 | KConfig *KABCore::config() |
297 | { | 297 | { |
298 | #ifndef KAB_EMBEDDED | 298 | #ifndef KAB_EMBEDDED |
299 | return KABPrefs::instance()->config(); | 299 | return KABPrefs::instance()->config(); |
300 | #else //KAB_EMBEDDED | 300 | #else //KAB_EMBEDDED |
301 | return KABPrefs::instance()->getConfig(); | 301 | return KABPrefs::instance()->getConfig(); |
302 | #endif //KAB_EMBEDDED | 302 | #endif //KAB_EMBEDDED |
303 | } | 303 | } |
304 | 304 | ||
305 | KActionCollection *KABCore::actionCollection() const | 305 | KActionCollection *KABCore::actionCollection() const |
306 | { | 306 | { |
307 | return mGUIClient->actionCollection(); | 307 | return mGUIClient->actionCollection(); |
308 | } | 308 | } |
309 | 309 | ||
310 | KABC::Field *KABCore::currentSearchField() const | 310 | KABC::Field *KABCore::currentSearchField() const |
311 | { | 311 | { |
312 | if (mIncSearchWidget) | 312 | if (mIncSearchWidget) |
313 | return mIncSearchWidget->currentField(); | 313 | return mIncSearchWidget->currentField(); |
314 | else | 314 | else |
315 | return 0; | 315 | return 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | QStringList KABCore::selectedUIDs() const | 318 | QStringList KABCore::selectedUIDs() const |
319 | { | 319 | { |
320 | return mViewManager->selectedUids(); | 320 | return mViewManager->selectedUids(); |
321 | } | 321 | } |
322 | 322 | ||
323 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 323 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
324 | { | 324 | { |
325 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 325 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
326 | 326 | ||
327 | QPtrList<KRES::Resource> kresResources; | 327 | QPtrList<KRES::Resource> kresResources; |
328 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 328 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
329 | KABC::Resource *resource; | 329 | KABC::Resource *resource; |
330 | while ( ( resource = resIt.current() ) != 0 ) { | 330 | while ( ( resource = resIt.current() ) != 0 ) { |
331 | ++resIt; | 331 | ++resIt; |
332 | if ( !resource->readOnly() ) { | 332 | if ( !resource->readOnly() ) { |
333 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 333 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
334 | if ( res ) | 334 | if ( res ) |
335 | kresResources.append( res ); | 335 | kresResources.append( res ); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 339 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
340 | return static_cast<KABC::Resource*>( res ); | 340 | return static_cast<KABC::Resource*>( res ); |
341 | } | 341 | } |
342 | 342 | ||
343 | #ifndef KAB_EMBEDDED | 343 | #ifndef KAB_EMBEDDED |
344 | KAboutData *KABCore::createAboutData() | 344 | KAboutData *KABCore::createAboutData() |
345 | #else //KAB_EMBEDDED | 345 | #else //KAB_EMBEDDED |
346 | void KABCore::createAboutData() | 346 | void KABCore::createAboutData() |
347 | #endif //KAB_EMBEDDED | 347 | #endif //KAB_EMBEDDED |
348 | { | 348 | { |
349 | #ifndef KAB_EMBEDDED | 349 | #ifndef KAB_EMBEDDED |
350 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 350 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
351 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 351 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
352 | KAboutData::License_GPL_V2, | 352 | KAboutData::License_GPL_V2, |
353 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 353 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
354 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 354 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
355 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 355 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
356 | about->addAuthor( "Cornelius Schumacher", | 356 | about->addAuthor( "Cornelius Schumacher", |
357 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 357 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
358 | "schumacher@kde.org" ); | 358 | "schumacher@kde.org" ); |
359 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 359 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
360 | "mpilone@slac.com" ); | 360 | "mpilone@slac.com" ); |
361 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 361 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
362 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 362 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
363 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 363 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
364 | "michel@klaralvdalens-datakonsult.se" ); | 364 | "michel@klaralvdalens-datakonsult.se" ); |
365 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 365 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
366 | "hansen@kde.org" ); | 366 | "hansen@kde.org" ); |
367 | 367 | ||
368 | return about; | 368 | return about; |
369 | #endif //KAB_EMBEDDED | 369 | #endif //KAB_EMBEDDED |
370 | 370 | ||
371 | QString version; | 371 | QString version; |
372 | #include <../version> | 372 | #include <../version> |
373 | QMessageBox::about( this, "About KAddressbook/Pi", | 373 | QMessageBox::about( this, "About KAddressbook/Pi", |
374 | "KAddressbook/Platform-independent\n" | 374 | "KAddressbook/Platform-independent\n" |
375 | "(KA/Pi) " +version + " - " + | 375 | "(KA/Pi) " +version + " - " + |
376 | #ifdef DESKTOP_VERSION | 376 | #ifdef DESKTOP_VERSION |
377 | "Desktop Edition\n" | 377 | "Desktop Edition\n" |
378 | #else | 378 | #else |
379 | "PDA-Edition\n" | 379 | "PDA-Edition\n" |
380 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 380 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
381 | #endif | 381 | #endif |
382 | 382 | ||
383 | "(c) 2004 Ulf Schenk\n" | 383 | "(c) 2004 Ulf Schenk\n" |
384 | "(c) 1997-2003, The KDE PIM Team\n" | 384 | "(c) 1997-2003, The KDE PIM Team\n" |
385 | "Tobias Koenig Current maintainer tokoe@kde.org\n" | 385 | "Tobias Koenig Current maintainer tokoe@kde.org\n" |
386 | "Don Sanders Original author\n" | 386 | "Don Sanders Original author\n" |
387 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" | 387 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" |
388 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" | 388 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" |
389 | "Greg Stern DCOP interface\n" | 389 | "Greg Stern DCOP interface\n" |
390 | "Mark Westcot Contact pinning\n" | 390 | "Mark Westcot Contact pinning\n" |
391 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 391 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
392 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" ); | 392 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" ); |
393 | } | 393 | } |
394 | 394 | ||
395 | void KABCore::setContactSelected( const QString &uid ) | 395 | void KABCore::setContactSelected( const QString &uid ) |
396 | { | 396 | { |
397 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 397 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
398 | if ( !mDetails->isHidden() ) | 398 | if ( !mDetails->isHidden() ) |
399 | mDetails->setAddressee( addr ); | 399 | mDetails->setAddressee( addr ); |
400 | 400 | ||
401 | if ( !addr.isEmpty() ) { | 401 | if ( !addr.isEmpty() ) { |
402 | emit contactSelected( addr.formattedName() ); | 402 | emit contactSelected( addr.formattedName() ); |
403 | KABC::Picture pic = addr.photo(); | 403 | KABC::Picture pic = addr.photo(); |
404 | if ( pic.isIntern() ) { | 404 | if ( pic.isIntern() ) { |
405 | //US emit contactSelected( pic.data() ); | 405 | //US emit contactSelected( pic.data() ); |
406 | //US instead use: | 406 | //US instead use: |
407 | QPixmap px; | 407 | QPixmap px; |
408 | if (pic.data().isNull() != true) | 408 | if (pic.data().isNull() != true) |
409 | { | 409 | { |
410 | px.convertFromImage(pic.data()); | 410 | px.convertFromImage(pic.data()); |
411 | } | 411 | } |
412 | 412 | ||
413 | emit contactSelected( px ); | 413 | emit contactSelected( px ); |
414 | } | 414 | } |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | mExtensionManager->setSelectionChanged(); | 418 | mExtensionManager->setSelectionChanged(); |
419 | 419 | ||
420 | // update the actions | 420 | // update the actions |
421 | bool selected = !uid.isEmpty(); | 421 | bool selected = !uid.isEmpty(); |
422 | 422 | ||
423 | if ( mReadWrite ) { | 423 | if ( mReadWrite ) { |
424 | mActionCut->setEnabled( selected ); | 424 | mActionCut->setEnabled( selected ); |
425 | mActionPaste->setEnabled( selected ); | 425 | mActionPaste->setEnabled( selected ); |
426 | } | 426 | } |
427 | 427 | ||
428 | mActionCopy->setEnabled( selected ); | 428 | mActionCopy->setEnabled( selected ); |
429 | mActionDelete->setEnabled( selected ); | 429 | mActionDelete->setEnabled( selected ); |
430 | mActionEditAddressee->setEnabled( selected ); | 430 | mActionEditAddressee->setEnabled( selected ); |
431 | mActionMail->setEnabled( selected ); | 431 | mActionMail->setEnabled( selected ); |
432 | mActionMailVCard->setEnabled( selected ); | 432 | mActionMailVCard->setEnabled( selected ); |
433 | mActionWhoAmI->setEnabled( selected ); | 433 | mActionWhoAmI->setEnabled( selected ); |
434 | mActionCategories->setEnabled( selected ); | 434 | mActionCategories->setEnabled( selected ); |
435 | } | 435 | } |
436 | 436 | ||
437 | void KABCore::sendMail() | 437 | void KABCore::sendMail() |
438 | { | 438 | { |
439 | #ifndef KAB_EMBEDDED | 439 | #ifndef KAB_EMBEDDED |
440 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 440 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
441 | #else //KAB_EMBEDDED | 441 | #else //KAB_EMBEDDED |
442 | qDebug("KABCore::sendMail() ust be fixed"); | 442 | qDebug("KABCore::sendMail() ust be fixed"); |
443 | #endif //KAB_EMBEDDED | 443 | #endif //KAB_EMBEDDED |
444 | } | 444 | } |
445 | 445 | ||
446 | void KABCore::sendMail( const QString& email ) | 446 | void KABCore::sendMail( const QString& email ) |
447 | { | 447 | { |
448 | #ifndef KAB_EMBEDDED | 448 | #ifndef KAB_EMBEDDED |
449 | kapp->invokeMailer( email, "" ); | 449 | kapp->invokeMailer( email, "" ); |
450 | #else //KAB_EMBEDDED | 450 | #else //KAB_EMBEDDED |
451 | qDebug("KABCore::sendMail(const QString& email) ust be fixed"); | 451 | qDebug("KABCore::sendMail(const QString& email) ust be fixed"); |
452 | #endif //KAB_EMBEDDED | 452 | #endif //KAB_EMBEDDED |
453 | } | 453 | } |
454 | 454 | ||
455 | void KABCore::mailVCard() | 455 | void KABCore::mailVCard() |
456 | { | 456 | { |
457 | #ifndef KAB_EMBEDDED | 457 | #ifndef KAB_EMBEDDED |
458 | QStringList uids = mViewManager->selectedUids(); | 458 | QStringList uids = mViewManager->selectedUids(); |
459 | if ( !uids.isEmpty() ) | 459 | if ( !uids.isEmpty() ) |
460 | mailVCard( uids ); | 460 | mailVCard( uids ); |
461 | #else //KAB_EMBEDDED | 461 | #else //KAB_EMBEDDED |
462 | qDebug("KABCore::mailVCard() must be fixed"); | 462 | qDebug("KABCore::mailVCard() must be fixed"); |
463 | #endif //KAB_EMBEDDED | 463 | #endif //KAB_EMBEDDED |
464 | } | 464 | } |
465 | 465 | ||
466 | void KABCore::mailVCard( const QStringList& uids ) | 466 | void KABCore::mailVCard( const QStringList& uids ) |
467 | { | 467 | { |
468 | #ifndef KAB_EMBEDDED | 468 | #ifndef KAB_EMBEDDED |
469 | QStringList urls; | 469 | QStringList urls; |
470 | 470 | ||
471 | // Create a temp dir, so that we can put the files in it with proper names | 471 | // Create a temp dir, so that we can put the files in it with proper names |
472 | KTempFile tempDir; | 472 | KTempFile tempDir; |
473 | if ( tempDir.status() != 0 ) { | 473 | if ( tempDir.status() != 0 ) { |
474 | kdWarning() << strerror( tempDir.status() ) << endl; | 474 | kdWarning() << strerror( tempDir.status() ) << endl; |
475 | return; | 475 | return; |
476 | } | 476 | } |
477 | 477 | ||
478 | QString dirName = tempDir.name(); | 478 | QString dirName = tempDir.name(); |
479 | tempDir.unlink(); | 479 | tempDir.unlink(); |
480 | QDir().mkdir( dirName, true ); | 480 | QDir().mkdir( dirName, true ); |
481 | 481 | ||
482 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 482 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
483 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 483 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
484 | 484 | ||
485 | if ( a.isEmpty() ) | 485 | if ( a.isEmpty() ) |
486 | continue; | 486 | continue; |
487 | 487 | ||
488 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 488 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
489 | 489 | ||
490 | QString fileName = dirName + "/" + name; | 490 | QString fileName = dirName + "/" + name; |
491 | 491 | ||
492 | QFile outFile(fileName); | 492 | QFile outFile(fileName); |
493 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 493 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
494 | KABC::VCardConverter converter; | 494 | KABC::VCardConverter converter; |
495 | QString vcard; | 495 | QString vcard; |
496 | 496 | ||
497 | converter.addresseeToVCard( a, vcard ); | 497 | converter.addresseeToVCard( a, vcard ); |
498 | 498 | ||
499 | QTextStream t( &outFile ); // use a text stream | 499 | QTextStream t( &outFile ); // use a text stream |
500 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 500 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
501 | t << vcard; | 501 | t << vcard; |
502 | 502 | ||
503 | outFile.close(); | 503 | outFile.close(); |
504 | 504 | ||
505 | urls.append( fileName ); | 505 | urls.append( fileName ); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 509 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
510 | QString::null, // subject | 510 | QString::null, // subject |
511 | QString::null, // body | 511 | QString::null, // body |
512 | QString::null, | 512 | QString::null, |
513 | urls ); // attachments | 513 | urls ); // attachments |
514 | #else //KAB_EMBEDDED | 514 | #else //KAB_EMBEDDED |
515 | qDebug("KABCore::mailVCard( must be fixed"); | 515 | qDebug("KABCore::mailVCard( must be fixed"); |
516 | #endif //KAB_EMBEDDED | 516 | #endif //KAB_EMBEDDED |
517 | 517 | ||
518 | } | 518 | } |
519 | 519 | ||
520 | void KABCore::browse( const QString& url ) | 520 | void KABCore::browse( const QString& url ) |
521 | { | 521 | { |
522 | #ifndef KAB_EMBEDDED | 522 | #ifndef KAB_EMBEDDED |
523 | kapp->invokeBrowser( url ); | 523 | kapp->invokeBrowser( url ); |
524 | #else //KAB_EMBEDDED | 524 | #else //KAB_EMBEDDED |
525 | qDebug("KABCore::browse must be fixed"); | 525 | qDebug("KABCore::browse must be fixed"); |
526 | #endif //KAB_EMBEDDED | 526 | #endif //KAB_EMBEDDED |
527 | } | 527 | } |
528 | 528 | ||
529 | void KABCore::selectAllContacts() | 529 | void KABCore::selectAllContacts() |
530 | { | 530 | { |
531 | mViewManager->setSelected( QString::null, true ); | 531 | mViewManager->setSelected( QString::null, true ); |
532 | } | 532 | } |
533 | 533 | ||
534 | void KABCore::deleteContacts() | 534 | void KABCore::deleteContacts() |
535 | { | 535 | { |
536 | QStringList uidList = mViewManager->selectedUids(); | 536 | QStringList uidList = mViewManager->selectedUids(); |
537 | deleteContacts( uidList ); | 537 | deleteContacts( uidList ); |
538 | } | 538 | } |
539 | 539 | ||
540 | void KABCore::deleteContacts( const QStringList &uids ) | 540 | void KABCore::deleteContacts( const QStringList &uids ) |
541 | { | 541 | { |
542 | if ( uids.count() > 0 ) { | 542 | if ( uids.count() > 0 ) { |
543 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 543 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
544 | UndoStack::instance()->push( command ); | 544 | UndoStack::instance()->push( command ); |
545 | RedoStack::instance()->clear(); | 545 | RedoStack::instance()->clear(); |
546 | 546 | ||
547 | // now if we deleted anything, refresh | 547 | // now if we deleted anything, refresh |
548 | setContactSelected( QString::null ); | 548 | setContactSelected( QString::null ); |
549 | setModified( true ); | 549 | setModified( true ); |
550 | } | 550 | } |
551 | } | 551 | } |
552 | 552 | ||
553 | void KABCore::copyContacts() | 553 | void KABCore::copyContacts() |
554 | { | 554 | { |
555 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 555 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
556 | 556 | ||
557 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 557 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
558 | 558 | ||
559 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 559 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
560 | 560 | ||
561 | QClipboard *cb = QApplication::clipboard(); | 561 | QClipboard *cb = QApplication::clipboard(); |
562 | cb->setText( clipText ); | 562 | cb->setText( clipText ); |
563 | } | 563 | } |
564 | 564 | ||
565 | void KABCore::cutContacts() | 565 | void KABCore::cutContacts() |
566 | { | 566 | { |
567 | QStringList uidList = mViewManager->selectedUids(); | 567 | QStringList uidList = mViewManager->selectedUids(); |
568 | 568 | ||
569 | //US if ( uidList.size() > 0 ) { | 569 | //US if ( uidList.size() > 0 ) { |
570 | if ( uidList.count() > 0 ) { | 570 | if ( uidList.count() > 0 ) { |
571 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 571 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
572 | UndoStack::instance()->push( command ); | 572 | UndoStack::instance()->push( command ); |
573 | RedoStack::instance()->clear(); | 573 | RedoStack::instance()->clear(); |
574 | 574 | ||
575 | setModified( true ); | 575 | setModified( true ); |
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
579 | void KABCore::pasteContacts() | 579 | void KABCore::pasteContacts() |
580 | { | 580 | { |
581 | QClipboard *cb = QApplication::clipboard(); | 581 | QClipboard *cb = QApplication::clipboard(); |
582 | 582 | ||
583 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 583 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
584 | 584 | ||
585 | pasteContacts( list ); | 585 | pasteContacts( list ); |
586 | } | 586 | } |
587 | 587 | ||
588 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 588 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
589 | { | 589 | { |
590 | KABC::Resource *resource = requestResource( this ); | 590 | KABC::Resource *resource = requestResource( this ); |
591 | KABC::Addressee::List::Iterator it; | 591 | KABC::Addressee::List::Iterator it; |
592 | for ( it = list.begin(); it != list.end(); ++it ) | 592 | for ( it = list.begin(); it != list.end(); ++it ) |
593 | (*it).setResource( resource ); | 593 | (*it).setResource( resource ); |
594 | 594 | ||
595 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 595 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
596 | UndoStack::instance()->push( command ); | 596 | UndoStack::instance()->push( command ); |
597 | RedoStack::instance()->clear(); | 597 | RedoStack::instance()->clear(); |
598 | 598 | ||
599 | setModified( true ); | 599 | setModified( true ); |
600 | } | 600 | } |
601 | 601 | ||
602 | void KABCore::setWhoAmI() | 602 | void KABCore::setWhoAmI() |
603 | { | 603 | { |
604 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 604 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
605 | 605 | ||
606 | if ( addrList.count() > 1 ) { | 606 | if ( addrList.count() > 1 ) { |
607 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 607 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
608 | return; | 608 | return; |
609 | } | 609 | } |
610 | 610 | ||
611 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 611 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
612 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 612 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
613 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 613 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
614 | } | 614 | } |
615 | 615 | ||
616 | void KABCore::setCategories() | 616 | void KABCore::setCategories() |
617 | { | 617 | { |
618 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 618 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
619 | if ( !dlg.exec() ) | 619 | if ( !dlg.exec() ) |
620 | return; | 620 | return; |
621 | 621 | ||
622 | bool merge = false; | 622 | bool merge = false; |
623 | QString msg = i18n( "Merge with existing categories?" ); | 623 | QString msg = i18n( "Merge with existing categories?" ); |
624 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 624 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
625 | merge = true; | 625 | merge = true; |
626 | 626 | ||
627 | QStringList categories = dlg.selectedCategories(); | 627 | QStringList categories = dlg.selectedCategories(); |
628 | 628 | ||
629 | QStringList uids = mViewManager->selectedUids(); | 629 | QStringList uids = mViewManager->selectedUids(); |
630 | QStringList::Iterator it; | 630 | QStringList::Iterator it; |
631 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 631 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
632 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 632 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
633 | if ( !addr.isEmpty() ) { | 633 | if ( !addr.isEmpty() ) { |
634 | if ( !merge ) | 634 | if ( !merge ) |
635 | addr.setCategories( categories ); | 635 | addr.setCategories( categories ); |
636 | else { | 636 | else { |
637 | QStringList addrCategories = addr.categories(); | 637 | QStringList addrCategories = addr.categories(); |
638 | QStringList::Iterator catIt; | 638 | QStringList::Iterator catIt; |
639 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 639 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
640 | if ( !addrCategories.contains( *catIt ) ) | 640 | if ( !addrCategories.contains( *catIt ) ) |
641 | addrCategories.append( *catIt ); | 641 | addrCategories.append( *catIt ); |
642 | } | 642 | } |
643 | addr.setCategories( addrCategories ); | 643 | addr.setCategories( addrCategories ); |
644 | } | 644 | } |
645 | 645 | ||
646 | mAddressBook->insertAddressee( addr ); | 646 | mAddressBook->insertAddressee( addr ); |
647 | } | 647 | } |
648 | } | 648 | } |
649 | 649 | ||
650 | if ( uids.count() > 0 ) | 650 | if ( uids.count() > 0 ) |
651 | setModified( true ); | 651 | setModified( true ); |
652 | } | 652 | } |
653 | 653 | ||
654 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 654 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
655 | { | 655 | { |
656 | mIncSearchWidget->setFields( fields ); | 656 | mIncSearchWidget->setFields( fields ); |
657 | } | 657 | } |
658 | 658 | ||
659 | void KABCore::incrementalSearch( const QString& text ) | 659 | void KABCore::incrementalSearch( const QString& text ) |
660 | { | 660 | { |
661 | mViewManager->setSelected( QString::null, false ); | 661 | mViewManager->setSelected( QString::null, false ); |
662 | 662 | ||
663 | if ( !text.isEmpty() ) { | 663 | if ( !text.isEmpty() ) { |
664 | KABC::Field *field = mIncSearchWidget->currentField(); | 664 | KABC::Field *field = mIncSearchWidget->currentField(); |
665 | 665 | ||
666 | QString pattern = text.lower(); | 666 | QString pattern = text.lower(); |
667 | 667 | ||
668 | #if KDE_VERSION >= 319 | 668 | #if KDE_VERSION >= 319 |
669 | KABC::AddresseeList list( mAddressBook->allAddressees() ); | 669 | KABC::AddresseeList list( mAddressBook->allAddressees() ); |
670 | if ( field ) { | 670 | if ( field ) { |
671 | list.sortByField( field ); | 671 | list.sortByField( field ); |
672 | KABC::AddresseeList::Iterator it; | 672 | KABC::AddresseeList::Iterator it; |
673 | for ( it = list.begin(); it != list.end(); ++it ) { | 673 | for ( it = list.begin(); it != list.end(); ++it ) { |
674 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 674 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
675 | mViewManager->setSelected( (*it).uid(), true ); | 675 | mViewManager->setSelected( (*it).uid(), true ); |
676 | return; | 676 | return; |
677 | } | 677 | } |
678 | } | 678 | } |
679 | } else { | 679 | } else { |
680 | KABC::AddresseeList::Iterator it; | 680 | KABC::AddresseeList::Iterator it; |
681 | for ( it = list.begin(); it != list.end(); ++it ) { | 681 | for ( it = list.begin(); it != list.end(); ++it ) { |
682 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 682 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
683 | KABC::Field::List::ConstIterator fieldIt; | 683 | KABC::Field::List::ConstIterator fieldIt; |
684 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 684 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
685 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 685 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
686 | mViewManager->setSelected( (*it).uid(), true ); | 686 | mViewManager->setSelected( (*it).uid(), true ); |
687 | return; | 687 | return; |
688 | } | 688 | } |
689 | } | 689 | } |
690 | } | 690 | } |
691 | } | 691 | } |
692 | #else | 692 | #else |
693 | KABC::AddressBook::Iterator it; | 693 | KABC::AddressBook::Iterator it; |
694 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 694 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
695 | if ( field ) { | 695 | if ( field ) { |
696 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 696 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
697 | mViewManager->setSelected( (*it).uid(), true ); | 697 | mViewManager->setSelected( (*it).uid(), true ); |
698 | return; | 698 | return; |
699 | } | 699 | } |
700 | } else { | 700 | } else { |
701 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 701 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
702 | KABC::Field::List::ConstIterator fieldIt; | 702 | KABC::Field::List::ConstIterator fieldIt; |
703 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 703 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
704 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 704 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
705 | mViewManager->setSelected( (*it).uid(), true ); | 705 | mViewManager->setSelected( (*it).uid(), true ); |
706 | return; | 706 | return; |
707 | } | 707 | } |
708 | } | 708 | } |
709 | } | 709 | } |
710 | } | 710 | } |
711 | #endif | 711 | #endif |
712 | } | 712 | } |
713 | } | 713 | } |
714 | 714 | ||
715 | void KABCore::setModified() | 715 | void KABCore::setModified() |
716 | { | 716 | { |
717 | setModified( true ); | 717 | setModified( true ); |
718 | } | 718 | } |
719 | 719 | ||
720 | void KABCore::setModifiedWOrefresh() | 720 | void KABCore::setModifiedWOrefresh() |
721 | { | 721 | { |
722 | // qDebug("KABCore::setModifiedWOrefresh() "); | 722 | // qDebug("KABCore::setModifiedWOrefresh() "); |
723 | mModified = true; | 723 | mModified = true; |
724 | mActionSave->setEnabled( mModified ); | 724 | mActionSave->setEnabled( mModified ); |
725 | #ifdef DESKTOP_VERSION | 725 | #ifdef DESKTOP_VERSION |
726 | mDetails->refreshView(); | 726 | mDetails->refreshView(); |
727 | #endif | 727 | #endif |
728 | 728 | ||
729 | } | 729 | } |
730 | void KABCore::setModified( bool modified ) | 730 | void KABCore::setModified( bool modified ) |
731 | { | 731 | { |
732 | mModified = modified; | 732 | mModified = modified; |
733 | mActionSave->setEnabled( mModified ); | 733 | mActionSave->setEnabled( mModified ); |
734 | 734 | ||
735 | if ( modified ) | 735 | if ( modified ) |
736 | mJumpButtonBar->recreateButtons(); | 736 | mJumpButtonBar->recreateButtons(); |
737 | 737 | ||
738 | mViewManager->refreshView(); | 738 | mViewManager->refreshView(); |
739 | mDetails->refreshView(); | 739 | mDetails->refreshView(); |
740 | 740 | ||
741 | } | 741 | } |
742 | 742 | ||
743 | bool KABCore::modified() const | 743 | bool KABCore::modified() const |
744 | { | 744 | { |
745 | return mModified; | 745 | return mModified; |
746 | } | 746 | } |
747 | 747 | ||
748 | void KABCore::contactModified( const KABC::Addressee &addr ) | 748 | void KABCore::contactModified( const KABC::Addressee &addr ) |
749 | { | 749 | { |
750 | 750 | ||
751 | Command *command = 0; | 751 | Command *command = 0; |
752 | QString uid; | 752 | QString uid; |
753 | 753 | ||
754 | // check if it exists already | 754 | // check if it exists already |
755 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 755 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
756 | if ( origAddr.isEmpty() ) | 756 | if ( origAddr.isEmpty() ) |
757 | command = new PwNewCommand( mAddressBook, addr ); | 757 | command = new PwNewCommand( mAddressBook, addr ); |
758 | else { | 758 | else { |
759 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 759 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
760 | uid = addr.uid(); | 760 | uid = addr.uid(); |
761 | } | 761 | } |
762 | 762 | ||
763 | UndoStack::instance()->push( command ); | 763 | UndoStack::instance()->push( command ); |
764 | RedoStack::instance()->clear(); | 764 | RedoStack::instance()->clear(); |
765 | 765 | ||
766 | setModified( true ); | 766 | setModified( true ); |
767 | } | 767 | } |
768 | 768 | ||
769 | void KABCore::newContact() | 769 | void KABCore::newContact() |
770 | { | 770 | { |
771 | AddresseeEditorDialog *dialog = 0; | 771 | AddresseeEditorDialog *dialog = 0; |
772 | 772 | ||
773 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 773 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
774 | 774 | ||
775 | QPtrList<KRES::Resource> kresResources; | 775 | QPtrList<KRES::Resource> kresResources; |
776 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 776 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
777 | KABC::Resource *resource; | 777 | KABC::Resource *resource; |
778 | while ( ( resource = it.current() ) != 0 ) { | 778 | while ( ( resource = it.current() ) != 0 ) { |
779 | ++it; | 779 | ++it; |
780 | if ( !resource->readOnly() ) { | 780 | if ( !resource->readOnly() ) { |
781 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 781 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
782 | if ( res ) | 782 | if ( res ) |
783 | kresResources.append( res ); | 783 | kresResources.append( res ); |
784 | } | 784 | } |
785 | } | 785 | } |
786 | 786 | ||
787 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 787 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
788 | resource = static_cast<KABC::Resource*>( res ); | 788 | resource = static_cast<KABC::Resource*>( res ); |
789 | 789 | ||
790 | if ( resource ) { | 790 | if ( resource ) { |
791 | KABC::Addressee addr; | 791 | KABC::Addressee addr; |
792 | addr.setResource( resource ); | 792 | addr.setResource( resource ); |
793 | dialog = createAddresseeEditorDialog( this ); | 793 | dialog = createAddresseeEditorDialog( this ); |
794 | dialog->setAddressee( addr ); | 794 | dialog->setAddressee( addr ); |
795 | 795 | ||
796 | } else | 796 | } else |
797 | return; | 797 | return; |
798 | 798 | ||
799 | mEditorDict.insert( dialog->addressee().uid(), dialog ); | 799 | mEditorDict.insert( dialog->addressee().uid(), dialog ); |
800 | 800 | ||
801 | dialog->show(); | 801 | dialog->show(); |
802 | 802 | ||
803 | } | 803 | } |
804 | 804 | ||
805 | void KABCore::addEmail( QString aStr ) | 805 | void KABCore::addEmail( QString aStr ) |
806 | { | 806 | { |
807 | #ifndef KAB_EMBEDDED | 807 | #ifndef KAB_EMBEDDED |
808 | QString fullName, email; | 808 | QString fullName, email; |
809 | 809 | ||
810 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 810 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
811 | 811 | ||
812 | // Try to lookup the addressee matching the email address | 812 | // Try to lookup the addressee matching the email address |
813 | bool found = false; | 813 | bool found = false; |
814 | QStringList emailList; | 814 | QStringList emailList; |
815 | KABC::AddressBook::Iterator it; | 815 | KABC::AddressBook::Iterator it; |
816 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 816 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
817 | emailList = (*it).emails(); | 817 | emailList = (*it).emails(); |
818 | if ( emailList.contains( email ) > 0 ) { | 818 | if ( emailList.contains( email ) > 0 ) { |
819 | found = true; | 819 | found = true; |
820 | (*it).setNameFromString( fullName ); | 820 | (*it).setNameFromString( fullName ); |
821 | editContact( (*it).uid() ); | 821 | editContact( (*it).uid() ); |
822 | } | 822 | } |
823 | } | 823 | } |
824 | 824 | ||
825 | if ( !found ) { | 825 | if ( !found ) { |
826 | KABC::Addressee addr; | 826 | KABC::Addressee addr; |
827 | addr.setNameFromString( fullName ); | 827 | addr.setNameFromString( fullName ); |
828 | addr.insertEmail( email, true ); | 828 | addr.insertEmail( email, true ); |
829 | 829 | ||
830 | mAddressBook->insertAddressee( addr ); | 830 | mAddressBook->insertAddressee( addr ); |
831 | mViewManager->refreshView( addr.uid() ); | 831 | mViewManager->refreshView( addr.uid() ); |
832 | editContact( addr.uid() ); | 832 | editContact( addr.uid() ); |
833 | } | 833 | } |
834 | #else //KAB_EMBEDDED | 834 | #else //KAB_EMBEDDED |
835 | qDebug("KABCore::addEmail finsih method"); | 835 | qDebug("KABCore::addEmail finsih method"); |
836 | #endif //KAB_EMBEDDED | 836 | #endif //KAB_EMBEDDED |
837 | } | 837 | } |
838 | 838 | ||
839 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 839 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
840 | { | 840 | { |
841 | mXXPortManager->importVCard( url, showPreview ); | 841 | mXXPortManager->importVCard( url, showPreview ); |
842 | } | 842 | } |
843 | 843 | ||
844 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 844 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
845 | { | 845 | { |
846 | mXXPortManager->importVCard( vCard, showPreview ); | 846 | mXXPortManager->importVCard( vCard, showPreview ); |
847 | } | 847 | } |
848 | 848 | ||
849 | //US added a second method without defaultparameter | 849 | //US added a second method without defaultparameter |
850 | void KABCore::editContact2() { | 850 | void KABCore::editContact2() { |
851 | editContact( QString::null ); | 851 | editContact( QString::null ); |
852 | } | 852 | } |
853 | 853 | ||
854 | void KABCore::editContact( const QString &uid ) | 854 | void KABCore::editContact( const QString &uid ) |
855 | { | 855 | { |
856 | 856 | ||
857 | if ( mExtensionManager->isQuickEditVisible() ) | 857 | if ( mExtensionManager->isQuickEditVisible() ) |
858 | return; | 858 | return; |
859 | 859 | ||
860 | // First, locate the contact entry | 860 | // First, locate the contact entry |
861 | QString localUID = uid; | 861 | QString localUID = uid; |
862 | if ( localUID.isNull() ) { | 862 | if ( localUID.isNull() ) { |
863 | QStringList uidList = mViewManager->selectedUids(); | 863 | QStringList uidList = mViewManager->selectedUids(); |
864 | if ( uidList.count() > 0 ) | 864 | if ( uidList.count() > 0 ) |
865 | localUID = *( uidList.at( 0 ) ); | 865 | localUID = *( uidList.at( 0 ) ); |
866 | } | 866 | } |
867 | 867 | ||
868 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 868 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
869 | if ( !addr.isEmpty() ) { | 869 | if ( !addr.isEmpty() ) { |
870 | AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); | 870 | AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); |
871 | if ( !dialog ) { | 871 | if ( !dialog ) { |
872 | dialog = createAddresseeEditorDialog( this ); | 872 | dialog = createAddresseeEditorDialog( this ); |
873 | 873 | ||
874 | mEditorDict.insert( addr.uid(), dialog ); | 874 | mEditorDict.insert( addr.uid(), dialog ); |
875 | 875 | ||
876 | dialog->setAddressee( addr ); | 876 | dialog->setAddressee( addr ); |
877 | } | 877 | } |
878 | 878 | ||
879 | dialog->raise(); | 879 | dialog->raise(); |
880 | dialog->show(); | 880 | dialog->show(); |
881 | } | 881 | } |
882 | } | 882 | } |
883 | 883 | ||
884 | void KABCore::save() | 884 | void KABCore::save() |
885 | { | 885 | { |
886 | if ( !mModified ) | 886 | if ( !mModified ) |
887 | return; | 887 | return; |
888 | QString text = i18n( "There was an error while attempting to save\n the " | 888 | QString text = i18n( "There was an error while attempting to save\n the " |
889 | "address book. Please check that some \nother application is " | 889 | "address book. Please check that some \nother application is " |
890 | "not using it. " ); | 890 | "not using it. " ); |
891 | statusMessage(i18n("Saving addressbook ... ")); | 891 | statusMessage(i18n("Saving addressbook ... ")); |
892 | #ifndef KAB_EMBEDDED | 892 | #ifndef KAB_EMBEDDED |
893 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 893 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
894 | if ( !b || !b->save() ) { | 894 | if ( !b || !b->save() ) { |
895 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 895 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
896 | } | 896 | } |
897 | #else //KAB_EMBEDDED | 897 | #else //KAB_EMBEDDED |
898 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 898 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
899 | if ( !b || !b->save() ) { | 899 | if ( !b || !b->save() ) { |
900 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 900 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
901 | } | 901 | } |
902 | #endif //KAB_EMBEDDED | 902 | #endif //KAB_EMBEDDED |
903 | 903 | ||
904 | statusMessage(i18n("Addressbook saved!")); | 904 | statusMessage(i18n("Addressbook saved!")); |
905 | setModified( false ); | 905 | setModified( false ); |
906 | } | 906 | } |
907 | 907 | ||
908 | void KABCore::statusMessage(QString mess , int time ) | 908 | void KABCore::statusMessage(QString mess , int time ) |
909 | { | 909 | { |
910 | //topLevelWidget()->setCaption( mess ); | 910 | //topLevelWidget()->setCaption( mess ); |
911 | // pending setting timer to revome message | 911 | // pending setting timer to revome message |
912 | } | 912 | } |
913 | void KABCore::undo() | 913 | void KABCore::undo() |
914 | { | 914 | { |
915 | UndoStack::instance()->undo(); | 915 | UndoStack::instance()->undo(); |
916 | 916 | ||
917 | // Refresh the view | 917 | // Refresh the view |
918 | mViewManager->refreshView(); | 918 | mViewManager->refreshView(); |
919 | } | 919 | } |
920 | 920 | ||
921 | void KABCore::redo() | 921 | void KABCore::redo() |
922 | { | 922 | { |
923 | RedoStack::instance()->redo(); | 923 | RedoStack::instance()->redo(); |
924 | 924 | ||
925 | // Refresh the view | 925 | // Refresh the view |
926 | mViewManager->refreshView(); | 926 | mViewManager->refreshView(); |
927 | } | 927 | } |
928 | 928 | ||
929 | void KABCore::setJumpButtonBarVisible( bool visible ) | 929 | void KABCore::setJumpButtonBarVisible( bool visible ) |
930 | { | 930 | { |
931 | if ( visible ) | 931 | if ( visible ) |
932 | mJumpButtonBar->show(); | 932 | mJumpButtonBar->show(); |
933 | else | 933 | else |
934 | mJumpButtonBar->hide(); | 934 | mJumpButtonBar->hide(); |
935 | } | 935 | } |
936 | void KABCore::setDetailsToState() | 936 | void KABCore::setDetailsToState() |
937 | { | 937 | { |
938 | setDetailsVisible( mActionDetails->isChecked() ); | 938 | setDetailsVisible( mActionDetails->isChecked() ); |
939 | } | 939 | } |
940 | 940 | ||
941 | void KABCore::setDetailsVisible( bool visible ) | 941 | void KABCore::setDetailsVisible( bool visible ) |
942 | { | 942 | { |
943 | if ( visible ) | 943 | if ( visible ) |
944 | mDetails->show(); | 944 | mDetails->show(); |
945 | else | 945 | else |
946 | mDetails->hide(); | 946 | mDetails->hide(); |
947 | } | 947 | } |
948 | 948 | ||
949 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 949 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
950 | { | 950 | { |
951 | 951 | ||
952 | if ( list.count() != 0 ) { | 952 | if ( list.count() != 0 ) { |
953 | KABC::Addressee::List::ConstIterator it; | 953 | KABC::Addressee::List::ConstIterator it; |
954 | for ( it = list.begin(); it != list.end(); ++it ) | 954 | for ( it = list.begin(); it != list.end(); ++it ) |
955 | mAddressBook->insertAddressee( *it ); | 955 | mAddressBook->insertAddressee( *it ); |
956 | if ( list.count() > 1 ) | 956 | if ( list.count() > 1 ) |
957 | setModified(); | 957 | setModified(); |
958 | else | 958 | else |
959 | setModifiedWOrefresh(); | 959 | setModifiedWOrefresh(); |
960 | } | 960 | } |
961 | if ( list.count() == 0 ) | 961 | if ( list.count() == 0 ) |
962 | mViewManager->refreshView(); | 962 | mViewManager->refreshView(); |
963 | else | 963 | else |
964 | mViewManager->refreshView( list[ 0 ].uid() ); | 964 | mViewManager->refreshView( list[ 0 ].uid() ); |
965 | 965 | ||
966 | 966 | ||
967 | 967 | ||
968 | } | 968 | } |
969 | 969 | ||
970 | QString KABCore::getNameByPhone( const QString &phone ) | 970 | QString KABCore::getNameByPhone( const QString &phone ) |
971 | { | 971 | { |
972 | #ifndef KAB_EMBEDDED | 972 | #ifndef KAB_EMBEDDED |
973 | QRegExp r( "[/*/-/ ]" ); | 973 | QRegExp r( "[/*/-/ ]" ); |
974 | QString localPhone( phone ); | 974 | QString localPhone( phone ); |
975 | 975 | ||
976 | bool found = false; | 976 | bool found = false; |
977 | QString ownerName = ""; | 977 | QString ownerName = ""; |
978 | KABC::AddressBook::Iterator iter; | 978 | KABC::AddressBook::Iterator iter; |
979 | KABC::PhoneNumber::List::Iterator phoneIter; | 979 | KABC::PhoneNumber::List::Iterator phoneIter; |
980 | KABC::PhoneNumber::List phoneList; | 980 | KABC::PhoneNumber::List phoneList; |
981 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 981 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
982 | phoneList = (*iter).phoneNumbers(); | 982 | phoneList = (*iter).phoneNumbers(); |
983 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 983 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
984 | ++phoneIter) { | 984 | ++phoneIter) { |
985 | // Get rid of separator chars so just the numbers are compared. | 985 | // Get rid of separator chars so just the numbers are compared. |
986 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 986 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
987 | ownerName = (*iter).formattedName(); | 987 | ownerName = (*iter).formattedName(); |
988 | found = true; | 988 | found = true; |
989 | } | 989 | } |
990 | } | 990 | } |
991 | } | 991 | } |
992 | 992 | ||
993 | return ownerName; | 993 | return ownerName; |
994 | #else //KAB_EMBEDDED | 994 | #else //KAB_EMBEDDED |
995 | qDebug("KABCore::getNameByPhone finsih method"); | 995 | qDebug("KABCore::getNameByPhone finsih method"); |
996 | return ""; | 996 | return ""; |
997 | #endif //KAB_EMBEDDED | 997 | #endif //KAB_EMBEDDED |
998 | 998 | ||
999 | } | 999 | } |
1000 | 1000 | ||
1001 | void KABCore::openConfigDialog() | 1001 | void KABCore::openConfigDialog() |
1002 | { | 1002 | { |
1003 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1003 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1004 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1004 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1005 | ConfigureDialog->addModule(kabcfg ); | 1005 | ConfigureDialog->addModule(kabcfg ); |
1006 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1006 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1007 | this, SLOT( configurationChanged() ) ); | 1007 | this, SLOT( configurationChanged() ) ); |
1008 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1008 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1009 | this, SLOT( configurationChanged() ) ); | 1009 | this, SLOT( configurationChanged() ) ); |
1010 | saveSettings(); | 1010 | saveSettings(); |
1011 | ConfigureDialog->showMaximized(); | ||
1011 | ConfigureDialog->exec(); | 1012 | ConfigureDialog->exec(); |
1012 | delete ConfigureDialog; | 1013 | delete ConfigureDialog; |
1013 | } | 1014 | } |
1014 | 1015 | ||
1015 | void KABCore::openLDAPDialog() | 1016 | void KABCore::openLDAPDialog() |
1016 | { | 1017 | { |
1017 | #ifndef KAB_EMBEDDED | 1018 | #ifndef KAB_EMBEDDED |
1018 | if ( !mLdapSearchDialog ) { | 1019 | if ( !mLdapSearchDialog ) { |
1019 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1020 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1020 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1021 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1021 | SLOT( refreshView() ) ); | 1022 | SLOT( refreshView() ) ); |
1022 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1023 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1023 | SLOT( setModified() ) ); | 1024 | SLOT( setModified() ) ); |
1024 | } else | 1025 | } else |
1025 | mLdapSearchDialog->restoreSettings(); | 1026 | mLdapSearchDialog->restoreSettings(); |
1026 | 1027 | ||
1027 | if ( mLdapSearchDialog->isOK() ) | 1028 | if ( mLdapSearchDialog->isOK() ) |
1028 | mLdapSearchDialog->exec(); | 1029 | mLdapSearchDialog->exec(); |
1029 | #else //KAB_EMBEDDED | 1030 | #else //KAB_EMBEDDED |
1030 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1031 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1031 | #endif //KAB_EMBEDDED | 1032 | #endif //KAB_EMBEDDED |
1032 | } | 1033 | } |
1033 | 1034 | ||
1034 | void KABCore::print() | 1035 | void KABCore::print() |
1035 | { | 1036 | { |
1036 | #ifndef KAB_EMBEDDED | 1037 | #ifndef KAB_EMBEDDED |
1037 | KPrinter printer; | 1038 | KPrinter printer; |
1038 | if ( !printer.setup( this ) ) | 1039 | if ( !printer.setup( this ) ) |
1039 | return; | 1040 | return; |
1040 | 1041 | ||
1041 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1042 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1042 | mViewManager->selectedUids(), this ); | 1043 | mViewManager->selectedUids(), this ); |
1043 | 1044 | ||
1044 | wizard.exec(); | 1045 | wizard.exec(); |
1045 | #else //KAB_EMBEDDED | 1046 | #else //KAB_EMBEDDED |
1046 | qDebug("KABCore::print() finsih method"); | 1047 | qDebug("KABCore::print() finsih method"); |
1047 | #endif //KAB_EMBEDDED | 1048 | #endif //KAB_EMBEDDED |
1048 | 1049 | ||
1049 | } | 1050 | } |
1050 | 1051 | ||
1051 | 1052 | ||
1052 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1053 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1053 | { | 1054 | { |
1054 | if ( mGUIClient ) | 1055 | if ( mGUIClient ) |
1055 | mGUIClient->insertChildClient( client ); | 1056 | mGUIClient->insertChildClient( client ); |
1056 | else | 1057 | else |
1057 | KMessageBox::error( this, "no KXMLGUICLient"); | 1058 | KMessageBox::error( this, "no KXMLGUICLient"); |
1058 | } | 1059 | } |
1059 | 1060 | ||
1060 | 1061 | ||
1061 | void KABCore::configurationChanged() | 1062 | void KABCore::configurationChanged() |
1062 | { | 1063 | { |
1063 | mExtensionManager->reconfigure(); | 1064 | mExtensionManager->reconfigure(); |
1064 | } | 1065 | } |
1065 | 1066 | ||
1066 | void KABCore::addressBookChanged() | 1067 | void KABCore::addressBookChanged() |
1067 | { | 1068 | { |
1068 | #ifndef KAB_EMBEDDED | 1069 | #ifndef KAB_EMBEDDED |
1069 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1070 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1070 | while ( it.current() ) { | 1071 | while ( it.current() ) { |
1071 | if ( it.current()->dirty() ) { | 1072 | if ( it.current()->dirty() ) { |
1072 | QString text = i18n( "Data has been changed externally. Unsaved " | 1073 | QString text = i18n( "Data has been changed externally. Unsaved " |
1073 | "changes will be lost." ); | 1074 | "changes will be lost." ); |
1074 | KMessageBox::information( this, text ); | 1075 | KMessageBox::information( this, text ); |
1075 | } | 1076 | } |
1076 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1077 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1077 | ++it; | 1078 | ++it; |
1078 | } | 1079 | } |
1079 | 1080 | ||
1080 | mViewManager->refreshView(); | 1081 | mViewManager->refreshView(); |
1081 | #else //KAB_EMBEDDED | 1082 | #else //KAB_EMBEDDED |
1082 | qDebug("KABCore::addressBookChanged() finsih method"); | 1083 | qDebug("KABCore::addressBookChanged() finsih method"); |
1083 | #endif //KAB_EMBEDDED | 1084 | #endif //KAB_EMBEDDED |
1084 | } | 1085 | } |
1085 | 1086 | ||
1086 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1087 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1087 | const char *name ) | 1088 | const char *name ) |
1088 | { | 1089 | { |
1089 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, | 1090 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, |
1090 | name ? name : "editorDialog" ); | 1091 | name ? name : "editorDialog" ); |
1091 | 1092 | ||
1092 | //US | 1093 | //US |
1093 | dialog->setMaximumSize( 640, 480 ); | 1094 | dialog->setMaximumSize( 640, 480 ); |
1094 | dialog->showMaximized(); | 1095 | dialog->showMaximized(); |
1095 | 1096 | ||
1096 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1097 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1097 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1098 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1098 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), | 1099 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), |
1099 | SLOT( slotEditorDestroyed( const QString& ) ) ); | 1100 | SLOT( slotEditorDestroyed( const QString& ) ) ); |
1100 | 1101 | ||
1101 | return dialog; | 1102 | return dialog; |
1102 | } | 1103 | } |
1103 | 1104 | ||
1104 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1105 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1105 | { | 1106 | { |
1106 | mEditorDict.remove( uid ); | 1107 | mEditorDict.remove( uid ); |
1107 | } | 1108 | } |
1108 | 1109 | ||
1109 | void KABCore::initGUI() | 1110 | void KABCore::initGUI() |
1110 | { | 1111 | { |
1111 | #ifndef KAB_EMBEDDED | 1112 | #ifndef KAB_EMBEDDED |
1112 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1113 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1113 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1114 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1114 | 1115 | ||
1115 | mExtensionBarSplitter = new QSplitter( this ); | 1116 | mExtensionBarSplitter = new QSplitter( this ); |
1116 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1117 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1117 | 1118 | ||
1118 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1119 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1119 | 1120 | ||
1120 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1121 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1121 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1122 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1122 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1123 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1123 | SLOT( incrementalSearch( const QString& ) ) ); | 1124 | SLOT( incrementalSearch( const QString& ) ) ); |
1124 | 1125 | ||
1125 | mViewManager = new ViewManager( this, viewSpace ); | 1126 | mViewManager = new ViewManager( this, viewSpace ); |
1126 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1127 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1127 | 1128 | ||
1128 | mDetails = new ViewContainer( mDetailsSplitter ); | 1129 | mDetails = new ViewContainer( mDetailsSplitter ); |
1129 | 1130 | ||
1130 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1131 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1131 | 1132 | ||
1132 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1133 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1133 | 1134 | ||
1134 | topLayout->addWidget( mExtensionBarSplitter ); | 1135 | topLayout->addWidget( mExtensionBarSplitter ); |
1135 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1136 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1136 | topLayout->addWidget( mJumpButtonBar ); | 1137 | topLayout->addWidget( mJumpButtonBar ); |
1137 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1138 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1138 | 1139 | ||
1139 | mXXPortManager = new XXPortManager( this, this ); | 1140 | mXXPortManager = new XXPortManager( this, this ); |
1140 | 1141 | ||
1141 | #else //KAB_EMBEDDED | 1142 | #else //KAB_EMBEDDED |
1142 | //US initialize viewMenu before settingup viewmanager. | 1143 | //US initialize viewMenu before settingup viewmanager. |
1143 | // Viewmanager needs this menu to plugin submenues. | 1144 | // Viewmanager needs this menu to plugin submenues. |
1144 | viewMenu = new QPopupMenu( this ); | 1145 | viewMenu = new QPopupMenu( this ); |
1145 | settingsMenu = new QPopupMenu( this ); | 1146 | settingsMenu = new QPopupMenu( this ); |
1146 | //filterMenu = new QPopupMenu( this ); | 1147 | //filterMenu = new QPopupMenu( this ); |
1147 | ImportMenu = new QPopupMenu( this ); | 1148 | ImportMenu = new QPopupMenu( this ); |
1148 | ExportMenu = new QPopupMenu( this ); | 1149 | ExportMenu = new QPopupMenu( this ); |
1149 | 1150 | ||
1150 | 1151 | ||
1151 | //US since we have no splitter for the embedded system, setup | 1152 | //US since we have no splitter for the embedded system, setup |
1152 | // a layout with two frames. One left and one right. | 1153 | // a layout with two frames. One left and one right. |
1153 | 1154 | ||
1154 | QBoxLayout *topLayout; | 1155 | QBoxLayout *topLayout; |
1155 | 1156 | ||
1156 | // = new QHBoxLayout( this ); | 1157 | // = new QHBoxLayout( this ); |
1157 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1158 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1158 | 1159 | ||
1159 | // QWidget *mainBox = new QWidget( this ); | 1160 | // QWidget *mainBox = new QWidget( this ); |
1160 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1161 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1161 | 1162 | ||
1162 | #ifdef DESKTOP_VERSION | 1163 | #ifdef DESKTOP_VERSION |
1163 | topLayout = new QHBoxLayout( this ); | 1164 | topLayout = new QHBoxLayout( this ); |
1164 | 1165 | ||
1165 | 1166 | ||
1166 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1167 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1167 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1168 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1168 | 1169 | ||
1169 | topLayout->addWidget(mMiniSplitter ); | 1170 | topLayout->addWidget(mMiniSplitter ); |
1170 | 1171 | ||
1171 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1172 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1172 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1173 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1173 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1174 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1174 | mDetails = new ViewContainer( mMiniSplitter ); | 1175 | mDetails = new ViewContainer( mMiniSplitter ); |
1175 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1176 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1176 | #else | 1177 | #else |
1177 | if ( QApplication::desktop()->width() > 480 ) { | 1178 | if ( QApplication::desktop()->width() > 480 ) { |
1178 | topLayout = new QHBoxLayout( this ); | 1179 | topLayout = new QHBoxLayout( this ); |
1179 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1180 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1180 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1181 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1181 | } else { | 1182 | } else { |
1182 | 1183 | ||
1183 | topLayout = new QVBoxLayout( this ); | 1184 | topLayout = new QVBoxLayout( this ); |
1184 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1185 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1185 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1186 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1186 | } | 1187 | } |
1187 | 1188 | ||
1188 | topLayout->addWidget(mMiniSplitter ); | 1189 | topLayout->addWidget(mMiniSplitter ); |
1189 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1190 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1190 | mDetails = new ViewContainer( mMiniSplitter ); | 1191 | mDetails = new ViewContainer( mMiniSplitter ); |
1191 | 1192 | ||
1192 | 1193 | ||
1193 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1194 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1194 | #endif | 1195 | #endif |
1195 | //eh->hide(); | 1196 | //eh->hide(); |
1196 | // topLayout->addWidget(mExtensionManager ); | 1197 | // topLayout->addWidget(mExtensionManager ); |
1197 | 1198 | ||
1198 | 1199 | ||
1199 | /*US | 1200 | /*US |
1200 | #ifndef KAB_NOSPLITTER | 1201 | #ifndef KAB_NOSPLITTER |
1201 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1202 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1202 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1203 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1203 | topLayout->setSpacing( 10 ); | 1204 | topLayout->setSpacing( 10 ); |
1204 | 1205 | ||
1205 | mDetailsSplitter = new QSplitter( this ); | 1206 | mDetailsSplitter = new QSplitter( this ); |
1206 | 1207 | ||
1207 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1208 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1208 | 1209 | ||
1209 | mViewManager = new ViewManager( this, viewSpace ); | 1210 | mViewManager = new ViewManager( this, viewSpace ); |
1210 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1211 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1211 | 1212 | ||
1212 | mDetails = new ViewContainer( mDetailsSplitter ); | 1213 | mDetails = new ViewContainer( mDetailsSplitter ); |
1213 | 1214 | ||
1214 | topLayout->addWidget( mDetailsSplitter ); | 1215 | topLayout->addWidget( mDetailsSplitter ); |
1215 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1216 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1216 | #else //KAB_NOSPLITTER | 1217 | #else //KAB_NOSPLITTER |
1217 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1218 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1218 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1219 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1219 | topLayout->setSpacing( 10 ); | 1220 | topLayout->setSpacing( 10 ); |
1220 | 1221 | ||
1221 | // mDetailsSplitter = new QSplitter( this ); | 1222 | // mDetailsSplitter = new QSplitter( this ); |
1222 | 1223 | ||
1223 | QVBox *viewSpace = new QVBox( this ); | 1224 | QVBox *viewSpace = new QVBox( this ); |
1224 | 1225 | ||
1225 | mViewManager = new ViewManager( this, viewSpace ); | 1226 | mViewManager = new ViewManager( this, viewSpace ); |
1226 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1227 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1227 | 1228 | ||
1228 | mDetails = new ViewContainer( this ); | 1229 | mDetails = new ViewContainer( this ); |
1229 | 1230 | ||
1230 | topLayout->addWidget( viewSpace ); | 1231 | topLayout->addWidget( viewSpace ); |
1231 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1232 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1232 | topLayout->addWidget( mDetails ); | 1233 | topLayout->addWidget( mDetails ); |
1233 | #endif //KAB_NOSPLITTER | 1234 | #endif //KAB_NOSPLITTER |
1234 | */ | 1235 | */ |
1235 | 1236 | ||
1236 | 1237 | ||
1237 | #endif //KAB_EMBEDDED | 1238 | #endif //KAB_EMBEDDED |
1238 | initActions(); | 1239 | initActions(); |
1239 | 1240 | ||
1240 | #ifdef KAB_EMBEDDED | 1241 | #ifdef KAB_EMBEDDED |
1241 | addActionsManually(); | 1242 | addActionsManually(); |
1242 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1243 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1243 | mXXPortManager = new XXPortManager( this, this ); | 1244 | mXXPortManager = new XXPortManager( this, this ); |
1244 | 1245 | ||
1245 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1246 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1246 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1247 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1247 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1248 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1248 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1249 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1249 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1250 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1250 | // mIncSearchWidget->hide(); | 1251 | // mIncSearchWidget->hide(); |
1251 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1252 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1252 | SLOT( incrementalSearch( const QString& ) ) ); | 1253 | SLOT( incrementalSearch( const QString& ) ) ); |
1253 | 1254 | ||
1254 | 1255 | ||
1255 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1256 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1256 | 1257 | ||
1257 | topLayout->addWidget( mJumpButtonBar ); | 1258 | topLayout->addWidget( mJumpButtonBar ); |
1258 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1259 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1259 | 1260 | ||
1260 | // mMainWindow->getIconToolBar()->raise(); | 1261 | // mMainWindow->getIconToolBar()->raise(); |
1261 | 1262 | ||
1262 | #endif //KAB_EMBEDDED | 1263 | #endif //KAB_EMBEDDED |
1263 | 1264 | ||
1264 | } | 1265 | } |
1265 | void KABCore::initActions() | 1266 | void KABCore::initActions() |
1266 | { | 1267 | { |
1267 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1268 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1268 | 1269 | ||
1269 | #ifndef KAB_EMBEDDED | 1270 | #ifndef KAB_EMBEDDED |
1270 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1271 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1271 | SLOT( clipboardDataChanged() ) ); | 1272 | SLOT( clipboardDataChanged() ) ); |
1272 | #endif //KAB_EMBEDDED | 1273 | #endif //KAB_EMBEDDED |
1273 | 1274 | ||
1274 | // file menu | 1275 | // file menu |
1275 | if ( mIsPart ) { | 1276 | if ( mIsPart ) { |
1276 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1277 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1277 | SLOT( sendMail() ), actionCollection(), | 1278 | SLOT( sendMail() ), actionCollection(), |
1278 | "kaddressbook_mail" ); | 1279 | "kaddressbook_mail" ); |
1279 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1280 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1280 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1281 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1281 | 1282 | ||
1282 | } else { | 1283 | } else { |
1283 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1284 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1284 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1285 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1285 | } | 1286 | } |
1286 | 1287 | ||
1287 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1288 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1288 | SLOT( save() ), actionCollection(), "file_sync" ); | 1289 | SLOT( save() ), actionCollection(), "file_sync" ); |
1289 | 1290 | ||
1290 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1291 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1291 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1292 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1292 | 1293 | ||
1293 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1294 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1294 | this, SLOT( mailVCard() ), | 1295 | this, SLOT( mailVCard() ), |
1295 | actionCollection(), "file_mail_vcard"); | 1296 | actionCollection(), "file_mail_vcard"); |
1296 | 1297 | ||
1297 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1298 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1298 | this, SLOT( editContact2() ), | 1299 | this, SLOT( editContact2() ), |
1299 | actionCollection(), "file_properties" ); | 1300 | actionCollection(), "file_properties" ); |
1300 | 1301 | ||
1301 | #ifdef KAB_EMBEDDED | 1302 | #ifdef KAB_EMBEDDED |
1302 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1303 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1303 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1304 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1304 | mMainWindow, SLOT( exit() ), | 1305 | mMainWindow, SLOT( exit() ), |
1305 | actionCollection(), "quit" ); | 1306 | actionCollection(), "quit" ); |
1306 | #endif //KAB_EMBEDDED | 1307 | #endif //KAB_EMBEDDED |
1307 | 1308 | ||
1308 | // edit menu | 1309 | // edit menu |
1309 | if ( mIsPart ) { | 1310 | if ( mIsPart ) { |
1310 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1311 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1311 | SLOT( copyContacts() ), actionCollection(), | 1312 | SLOT( copyContacts() ), actionCollection(), |
1312 | "kaddressbook_copy" ); | 1313 | "kaddressbook_copy" ); |
1313 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1314 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1314 | SLOT( cutContacts() ), actionCollection(), | 1315 | SLOT( cutContacts() ), actionCollection(), |
1315 | "kaddressbook_cut" ); | 1316 | "kaddressbook_cut" ); |
1316 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1317 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1317 | SLOT( pasteContacts() ), actionCollection(), | 1318 | SLOT( pasteContacts() ), actionCollection(), |
1318 | "kaddressbook_paste" ); | 1319 | "kaddressbook_paste" ); |
1319 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1320 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1320 | SLOT( selectAllContacts() ), actionCollection(), | 1321 | SLOT( selectAllContacts() ), actionCollection(), |
1321 | "kaddressbook_select_all" ); | 1322 | "kaddressbook_select_all" ); |
1322 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1323 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1323 | SLOT( undo() ), actionCollection(), | 1324 | SLOT( undo() ), actionCollection(), |
1324 | "kaddressbook_undo" ); | 1325 | "kaddressbook_undo" ); |
1325 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1326 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1326 | this, SLOT( redo() ), actionCollection(), | 1327 | this, SLOT( redo() ), actionCollection(), |
1327 | "kaddressbook_redo" ); | 1328 | "kaddressbook_redo" ); |
1328 | } else { | 1329 | } else { |
1329 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1330 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1330 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1331 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1331 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1332 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1332 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1333 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1333 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1334 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1334 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1335 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1335 | } | 1336 | } |
1336 | 1337 | ||
1337 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1338 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1338 | Key_Delete, this, SLOT( deleteContacts() ), | 1339 | Key_Delete, this, SLOT( deleteContacts() ), |
1339 | actionCollection(), "edit_delete" ); | 1340 | actionCollection(), "edit_delete" ); |
1340 | 1341 | ||
1341 | mActionUndo->setEnabled( false ); | 1342 | mActionUndo->setEnabled( false ); |
1342 | mActionRedo->setEnabled( false ); | 1343 | mActionRedo->setEnabled( false ); |
1343 | 1344 | ||
1344 | // settings menu | 1345 | // settings menu |
1345 | #ifdef KAB_EMBEDDED | 1346 | #ifdef KAB_EMBEDDED |
1346 | //US special menuentry to configure the addressbook resources. On KDE | 1347 | //US special menuentry to configure the addressbook resources. On KDE |
1347 | // you do that through the control center !!! | 1348 | // you do that through the control center !!! |
1348 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1349 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1349 | SLOT( configureResources() ), actionCollection(), | 1350 | SLOT( configureResources() ), actionCollection(), |
1350 | "kaddressbook_configure_resources" ); | 1351 | "kaddressbook_configure_resources" ); |
1351 | #endif //KAB_EMBEDDED | 1352 | #endif //KAB_EMBEDDED |
1352 | 1353 | ||
1353 | if ( mIsPart ) { | 1354 | if ( mIsPart ) { |
1354 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1355 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1355 | SLOT( openConfigDialog() ), actionCollection(), | 1356 | SLOT( openConfigDialog() ), actionCollection(), |
1356 | "kaddressbook_configure" ); | 1357 | "kaddressbook_configure" ); |
1357 | 1358 | ||
1358 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1359 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1359 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1360 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1360 | "kaddressbook_configure_shortcuts" ); | 1361 | "kaddressbook_configure_shortcuts" ); |
1361 | #ifdef KAB_EMBEDDED | 1362 | #ifdef KAB_EMBEDDED |
1362 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1363 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1363 | #endif //KAB_EMBEDDED | 1364 | #endif //KAB_EMBEDDED |
1364 | 1365 | ||
1365 | } else { | 1366 | } else { |
1366 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1367 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1367 | 1368 | ||
1368 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1369 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1369 | } | 1370 | } |
1370 | 1371 | ||
1371 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1372 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1372 | actionCollection(), "options_show_jump_bar" ); | 1373 | actionCollection(), "options_show_jump_bar" ); |
1373 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1374 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1374 | 1375 | ||
1375 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1376 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1376 | actionCollection(), "options_show_details" ); | 1377 | actionCollection(), "options_show_details" ); |
1377 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1378 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1378 | 1379 | ||
1379 | // misc | 1380 | // misc |
1380 | // only enable LDAP lookup if we can handle the protocol | 1381 | // only enable LDAP lookup if we can handle the protocol |
1381 | #ifndef KAB_EMBEDDED | 1382 | #ifndef KAB_EMBEDDED |
1382 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1383 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1383 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1384 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1384 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1385 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1385 | "ldap_lookup" ); | 1386 | "ldap_lookup" ); |
1386 | } | 1387 | } |
1387 | #else //KAB_EMBEDDED | 1388 | #else //KAB_EMBEDDED |
1388 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1389 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1389 | #endif //KAB_EMBEDDED | 1390 | #endif //KAB_EMBEDDED |
1390 | 1391 | ||
1391 | 1392 | ||
1392 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1393 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1393 | SLOT( setWhoAmI() ), actionCollection(), | 1394 | SLOT( setWhoAmI() ), actionCollection(), |
1394 | "set_personal" ); | 1395 | "set_personal" ); |
1395 | 1396 | ||
1396 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1397 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1397 | SLOT( setCategories() ), actionCollection(), | 1398 | SLOT( setCategories() ), actionCollection(), |
1398 | "edit_set_categories" ); | 1399 | "edit_set_categories" ); |
1399 | 1400 | ||
1400 | #ifdef KAB_EMBEDDED | 1401 | #ifdef KAB_EMBEDDED |
1401 | 1402 | ||
1402 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1403 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1403 | this, SLOT( createAboutData() ), actionCollection(), | 1404 | this, SLOT( createAboutData() ), actionCollection(), |
1404 | "kaddressbook_about_data" ); | 1405 | "kaddressbook_about_data" ); |
1405 | #endif //KAB_EMBEDDED | 1406 | #endif //KAB_EMBEDDED |
1406 | 1407 | ||
1407 | clipboardDataChanged(); | 1408 | clipboardDataChanged(); |
1408 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1409 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1409 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1410 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1410 | } | 1411 | } |
1411 | 1412 | ||
1412 | //US we need this function, to plug all actions into the correct menues. | 1413 | //US we need this function, to plug all actions into the correct menues. |
1413 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1414 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1414 | void KABCore::addActionsManually() | 1415 | void KABCore::addActionsManually() |
1415 | { | 1416 | { |
1416 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1417 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1417 | 1418 | ||
1418 | #ifdef KAB_EMBEDDED | 1419 | #ifdef KAB_EMBEDDED |
1419 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1420 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1420 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1421 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1421 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1422 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1422 | 1423 | ||
1423 | KToolBar* tb = mMainWindow->toolBar(); | 1424 | KToolBar* tb = mMainWindow->toolBar(); |
1424 | 1425 | ||
1425 | #ifdef DESKTOP_VERSION | 1426 | #ifdef DESKTOP_VERSION |
1426 | QMenuBar* mb = mMainWindow->menuBar(); | 1427 | QMenuBar* mb = mMainWindow->menuBar(); |
1427 | 1428 | ||
1428 | //US setup menubar. | 1429 | //US setup menubar. |
1429 | //Disable the following block if you do not want to have a menubar. | 1430 | //Disable the following block if you do not want to have a menubar. |
1430 | mb->insertItem( "&File", fileMenu ); | 1431 | mb->insertItem( "&File", fileMenu ); |
1431 | mb->insertItem( "&Edit", editMenu ); | 1432 | mb->insertItem( "&Edit", editMenu ); |
1432 | mb->insertItem( "&View", viewMenu ); | 1433 | mb->insertItem( "&View", viewMenu ); |
1433 | mb->insertItem( "&Settings", settingsMenu ); | 1434 | mb->insertItem( "&Settings", settingsMenu ); |
1434 | mb->insertItem( "&Help", helpMenu ); | 1435 | mb->insertItem( "&Help", helpMenu ); |
1435 | mIncSearchWidget = new IncSearchWidget( tb ); | 1436 | mIncSearchWidget = new IncSearchWidget( tb ); |
1436 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1437 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1437 | 1438 | ||
1438 | #else | 1439 | #else |
1439 | //US setup toolbar | 1440 | //US setup toolbar |
1440 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1441 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1441 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1442 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1442 | menuBarTB->insertItem( "ME", popupBarTB); | 1443 | menuBarTB->insertItem( "ME", popupBarTB); |
1443 | tb->insertWidget(-1, 0, menuBarTB); | 1444 | tb->insertWidget(-1, 0, menuBarTB); |
1444 | mIncSearchWidget = new IncSearchWidget( tb ); | 1445 | mIncSearchWidget = new IncSearchWidget( tb ); |
1445 | 1446 | ||
1446 | tb->enableMoving(false); | 1447 | tb->enableMoving(false); |
1447 | popupBarTB->insertItem( "&File", fileMenu ); | 1448 | popupBarTB->insertItem( "&File", fileMenu ); |
1448 | popupBarTB->insertItem( "&Edit", editMenu ); | 1449 | popupBarTB->insertItem( "&Edit", editMenu ); |
1449 | popupBarTB->insertItem( "&View", viewMenu ); | 1450 | popupBarTB->insertItem( "&View", viewMenu ); |
1450 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1451 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1451 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1452 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1452 | popupBarTB->insertItem( "&Help", helpMenu ); | 1453 | popupBarTB->insertItem( "&Help", helpMenu ); |
1453 | if (QApplication::desktop()->width() > 320 ) { | 1454 | if (QApplication::desktop()->width() > 320 ) { |
1454 | // mViewManager->getFilterAction()->plug ( tb); | 1455 | // mViewManager->getFilterAction()->plug ( tb); |
1455 | } | 1456 | } |
1456 | #endif | 1457 | #endif |
1457 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1458 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1458 | 1459 | ||
1459 | 1460 | ||
1460 | 1461 | ||
1461 | //US Now connect the actions with the menue entries. | 1462 | //US Now connect the actions with the menue entries. |
1462 | mActionPrint->plug( fileMenu ); | 1463 | mActionPrint->plug( fileMenu ); |
1463 | mActionMail->plug( fileMenu ); | 1464 | mActionMail->plug( fileMenu ); |
1464 | fileMenu->insertSeparator(); | 1465 | fileMenu->insertSeparator(); |
1465 | 1466 | ||
1466 | mActionNewContact->plug( fileMenu ); | 1467 | mActionNewContact->plug( fileMenu ); |
1467 | mActionNewContact->plug( tb ); | 1468 | mActionNewContact->plug( tb ); |
1468 | 1469 | ||
1469 | mActionEditAddressee->plug( fileMenu ); | 1470 | mActionEditAddressee->plug( fileMenu ); |
1470 | fileMenu->insertSeparator(); | 1471 | fileMenu->insertSeparator(); |
1471 | mActionSave->plug( fileMenu ); | 1472 | mActionSave->plug( fileMenu ); |
1472 | fileMenu->insertItem( "&Import", ImportMenu ); | 1473 | fileMenu->insertItem( "&Import", ImportMenu ); |
1473 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1474 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1474 | fileMenu->insertSeparator(); | 1475 | fileMenu->insertSeparator(); |
1475 | mActionMailVCard->plug( fileMenu ); | 1476 | mActionMailVCard->plug( fileMenu ); |
1476 | fileMenu->insertSeparator(); | 1477 | fileMenu->insertSeparator(); |
1477 | mActionQuit->plug( fileMenu ); | 1478 | mActionQuit->plug( fileMenu ); |
1478 | 1479 | ||
1479 | 1480 | ||
1480 | // edit menu | 1481 | // edit menu |
1481 | mActionUndo->plug( editMenu ); | 1482 | mActionUndo->plug( editMenu ); |
1482 | mActionRedo->plug( editMenu ); | 1483 | mActionRedo->plug( editMenu ); |
1483 | editMenu->insertSeparator(); | 1484 | editMenu->insertSeparator(); |
1484 | mActionCut->plug( editMenu ); | 1485 | mActionCut->plug( editMenu ); |
1485 | mActionCopy->plug( editMenu ); | 1486 | mActionCopy->plug( editMenu ); |
1486 | mActionPaste->plug( editMenu ); | 1487 | mActionPaste->plug( editMenu ); |
1487 | mActionDelete->plug( editMenu ); | 1488 | mActionDelete->plug( editMenu ); |
1488 | editMenu->insertSeparator(); | 1489 | editMenu->insertSeparator(); |
1489 | mActionSelectAll->plug( editMenu ); | 1490 | mActionSelectAll->plug( editMenu ); |
1490 | 1491 | ||
1491 | 1492 | ||
1492 | // settings menu | 1493 | // settings menu |
1493 | //US special menuentry to configure the addressbook resources. On KDE | 1494 | //US special menuentry to configure the addressbook resources. On KDE |
1494 | // you do that through the control center !!! | 1495 | // you do that through the control center !!! |
1495 | mActionConfigResources->plug( settingsMenu ); | 1496 | mActionConfigResources->plug( settingsMenu ); |
1496 | settingsMenu->insertSeparator(); | 1497 | settingsMenu->insertSeparator(); |
1497 | 1498 | ||
1498 | mActionConfigKAddressbook->plug( settingsMenu ); | 1499 | mActionConfigKAddressbook->plug( settingsMenu ); |
1499 | 1500 | ||
1500 | if ( mIsPart ) { | 1501 | if ( mIsPart ) { |
1501 | mActionConfigShortcuts->plug( settingsMenu ); | 1502 | mActionConfigShortcuts->plug( settingsMenu ); |
1502 | mActionConfigureToolbars->plug( settingsMenu ); | 1503 | mActionConfigureToolbars->plug( settingsMenu ); |
1503 | 1504 | ||
1504 | } else { | 1505 | } else { |
1505 | mActionKeyBindings->plug( settingsMenu ); | 1506 | mActionKeyBindings->plug( settingsMenu ); |
1506 | } | 1507 | } |
1507 | 1508 | ||
1508 | settingsMenu->insertSeparator(); | 1509 | settingsMenu->insertSeparator(); |
1509 | 1510 | ||
1510 | mActionJumpBar->plug( settingsMenu ); | 1511 | mActionJumpBar->plug( settingsMenu ); |
1511 | mActionDetails->plug( settingsMenu ); | 1512 | mActionDetails->plug( settingsMenu ); |
1512 | settingsMenu->insertSeparator(); | 1513 | settingsMenu->insertSeparator(); |
1513 | 1514 | ||
1514 | mActionWhoAmI->plug( settingsMenu ); | 1515 | mActionWhoAmI->plug( settingsMenu ); |
1515 | mActionCategories->plug( settingsMenu ); | 1516 | mActionCategories->plug( settingsMenu ); |
1516 | 1517 | ||
1517 | mActionAboutKAddressbook->plug( helpMenu ); | 1518 | mActionAboutKAddressbook->plug( helpMenu ); |
1518 | 1519 | ||
1519 | 1520 | ||
1520 | if (QApplication::desktop()->width() > 320 ) { | 1521 | if (QApplication::desktop()->width() > 320 ) { |
1521 | 1522 | ||
1522 | mActionEditAddressee->plug( tb ); | 1523 | mActionEditAddressee->plug( tb ); |
1523 | mActionSave->plug( tb ); | 1524 | mActionSave->plug( tb ); |
1524 | mViewManager->getFilterAction()->plug ( tb); | 1525 | mViewManager->getFilterAction()->plug ( tb); |
1525 | if (QApplication::desktop()->width() > 480 ) { | 1526 | if (QApplication::desktop()->width() > 480 ) { |
1526 | mActionUndo->plug( tb ); | 1527 | mActionUndo->plug( tb ); |
1527 | mActionDelete->plug( tb ); | 1528 | mActionDelete->plug( tb ); |
1528 | mActionRedo->plug( tb ); | 1529 | mActionRedo->plug( tb ); |
1529 | } | 1530 | } |
1530 | } | 1531 | } |
1531 | //mActionQuit->plug ( tb ); | 1532 | //mActionQuit->plug ( tb ); |
1532 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1533 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1533 | 1534 | ||
1534 | //US link the searchwidget first to this. | 1535 | //US link the searchwidget first to this. |
1535 | // The real linkage to the toolbar happens later. | 1536 | // The real linkage to the toolbar happens later. |
1536 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1537 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1537 | //US tb->insertItem( mIncSearchWidget ); | 1538 | //US tb->insertItem( mIncSearchWidget ); |
1538 | /*US | 1539 | /*US |
1539 | mIncSearchWidget = new IncSearchWidget( tb ); | 1540 | mIncSearchWidget = new IncSearchWidget( tb ); |
1540 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1541 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1541 | SLOT( incrementalSearch( const QString& ) ) ); | 1542 | SLOT( incrementalSearch( const QString& ) ) ); |
1542 | 1543 | ||
1543 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1544 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1544 | 1545 | ||
1545 | //US topLayout->addWidget( mJumpButtonBar ); | 1546 | //US topLayout->addWidget( mJumpButtonBar ); |
1546 | this->layout()->add( mJumpButtonBar ); | 1547 | this->layout()->add( mJumpButtonBar ); |
1547 | */ | 1548 | */ |
1548 | 1549 | ||
1549 | #endif //KAB_EMBEDDED | 1550 | #endif //KAB_EMBEDDED |
1550 | } | 1551 | } |
1551 | 1552 | ||
1552 | 1553 | ||
1553 | 1554 | ||
1554 | void KABCore::clipboardDataChanged() | 1555 | void KABCore::clipboardDataChanged() |
1555 | { | 1556 | { |
1556 | 1557 | ||
1557 | if ( mReadWrite ) | 1558 | if ( mReadWrite ) |
1558 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1559 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1559 | 1560 | ||
1560 | } | 1561 | } |
1561 | 1562 | ||
1562 | void KABCore::updateActionMenu() | 1563 | void KABCore::updateActionMenu() |
1563 | { | 1564 | { |
1564 | UndoStack *undo = UndoStack::instance(); | 1565 | UndoStack *undo = UndoStack::instance(); |
1565 | RedoStack *redo = RedoStack::instance(); | 1566 | RedoStack *redo = RedoStack::instance(); |
1566 | 1567 | ||
1567 | if ( undo->isEmpty() ) | 1568 | if ( undo->isEmpty() ) |
1568 | mActionUndo->setText( i18n( "Undo" ) ); | 1569 | mActionUndo->setText( i18n( "Undo" ) ); |
1569 | else | 1570 | else |
1570 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1571 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1571 | 1572 | ||
1572 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1573 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1573 | 1574 | ||
1574 | if ( !redo->top() ) | 1575 | if ( !redo->top() ) |
1575 | mActionRedo->setText( i18n( "Redo" ) ); | 1576 | mActionRedo->setText( i18n( "Redo" ) ); |
1576 | else | 1577 | else |
1577 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1578 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1578 | 1579 | ||
1579 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1580 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1580 | } | 1581 | } |
1581 | 1582 | ||
1582 | void KABCore::configureKeyBindings() | 1583 | void KABCore::configureKeyBindings() |
1583 | { | 1584 | { |
1584 | #ifndef KAB_EMBEDDED | 1585 | #ifndef KAB_EMBEDDED |
1585 | KKeyDialog::configure( actionCollection(), true ); | 1586 | KKeyDialog::configure( actionCollection(), true ); |
1586 | #else //KAB_EMBEDDED | 1587 | #else //KAB_EMBEDDED |
1587 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1588 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1588 | #endif //KAB_EMBEDDED | 1589 | #endif //KAB_EMBEDDED |
1589 | } | 1590 | } |
1590 | 1591 | ||
1591 | #ifdef KAB_EMBEDDED | 1592 | #ifdef KAB_EMBEDDED |
1592 | void KABCore::configureResources() | 1593 | void KABCore::configureResources() |
1593 | { | 1594 | { |
1594 | KRES::KCMKResources dlg( this, "" , 0 ); | 1595 | KRES::KCMKResources dlg( this, "" , 0 ); |
1595 | 1596 | ||
1596 | if ( !dlg.exec() ) | 1597 | if ( !dlg.exec() ) |
1597 | return; | 1598 | return; |
1598 | } | 1599 | } |
1599 | #endif //KAB_EMBEDDED | 1600 | #endif //KAB_EMBEDDED |
1600 | 1601 | ||
1601 | 1602 | ||
1602 | 1603 | ||
1603 | #ifndef KAB_EMBEDDED | 1604 | #ifndef KAB_EMBEDDED |
1604 | #include "kabcore.moc" | 1605 | #include "kabcore.moc" |
1605 | #endif //KAB_EMBEDDED | 1606 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp index 0f3c353..f84b2ba 100644 --- a/kaddressbook/kcmconfigs/addresseewidget.cpp +++ b/kaddressbook/kcmconfigs/addresseewidget.cpp | |||
@@ -1,236 +1,242 @@ | |||
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 <qgroupbox.h> | 24 | #include <qgroupbox.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlistbox.h> | 27 | #include <qlistbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | 29 | ||
30 | #include <kbuttonbox.h> | 30 | #include <kbuttonbox.h> |
31 | #include <kcombobox.h> | 31 | #include <kcombobox.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <kdialog.h> | 33 | #include <kdialog.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <klineedit.h> | 36 | #include <klineedit.h> |
37 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | 38 | ||
39 | #include "addresseewidget.h" | 39 | #include "addresseewidget.h" |
40 | 40 | ||
41 | NamePartWidget::NamePartWidget( const QString &title, QWidget *parent, | 41 | NamePartWidget::NamePartWidget( const QString &title, QWidget *parent, |
42 | const char *name ) | 42 | const char *name ) |
43 | : QWidget( parent, name ) | 43 | : QWidget( parent, name ) |
44 | { | 44 | { |
45 | if (KGlobal::getOrientation() == KGlobal::Portrait) | 45 | if (KGlobal::getOrientation() == KGlobal::Portrait) |
46 | { | 46 | { |
47 | QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(), | 47 | QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(), |
48 | KDialog::spacingHintSmall() ); | 48 | KDialog::spacingHintSmall() ); |
49 | 49 | ||
50 | QLabel *label = new QLabel( i18n( title ), this ); | 50 | QLabel *label = new QLabel( i18n( title ), this ); |
51 | layout->addWidget( label, 0, 1 ); | 51 | layout->addWidget( label, 0, 1 ); |
52 | 52 | ||
53 | mBox = new QListBox( this ); | 53 | mBox = new QListBox( this ); |
54 | mBox->setMaximumSize(70, 70); | 54 | mBox->setMaximumSize(70, 70); |
55 | layout->addMultiCellWidget( mBox, 0, 1, 0, 0 ); | 55 | layout->addMultiCellWidget( mBox, 0, 1, 0, 0 ); |
56 | 56 | ||
57 | KButtonBox *bbox = new KButtonBox( this, Qt::Vertical ); | 57 | KButtonBox *bbox = new KButtonBox( this, Qt::Vertical ); |
58 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); | 58 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); |
59 | mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) ); | 59 | mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) ); |
60 | bbox->layout(); | 60 | bbox->layout(); |
61 | layout->addMultiCellWidget( bbox, 0, 2, 2,2); | 61 | layout->addMultiCellWidget( bbox, 0, 1, 2,2); |
62 | 62 | ||
63 | mEdit = new KLineEdit( this ); | 63 | mEdit = new KLineEdit( this ); |
64 | layout->addWidget( mEdit, 1, 1 ); | 64 | layout->addWidget( mEdit, 1, 1 ); |
65 | //mEdit->setMinimumWidth(50); | 65 | //mEdit->setMinimumWidth(50); |
66 | 66 | ||
67 | // layout->addWidget( group ); | 67 | // layout->addWidget( group ); |
68 | 68 | ||
69 | } | 69 | } |
70 | else | 70 | else |
71 | { | 71 | { |
72 | QHBoxLayout *layout = new QHBoxLayout( this ); | 72 | QHBoxLayout *layout = new QHBoxLayout( this ); |
73 | 73 | ||
74 | QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this ); | 74 | QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this ); |
75 | QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2, | 75 | QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2, |
76 | KDialog::spacingHint() ); | 76 | KDialog::spacingHint() ); |
77 | 77 | ||
78 | mBox = new QListBox( group ); | 78 | mBox = new QListBox( group ); |
79 | 79 | ||
80 | groupLayout->addWidget( mBox, 0, 0 ); | 80 | groupLayout->addWidget( mBox, 0, 0 ); |
81 | 81 | ||
82 | KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); | 82 | KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); |
83 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); | 83 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); |
84 | mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); | 84 | mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); |
85 | bbox->layout(); | 85 | bbox->layout(); |
86 | groupLayout->addWidget( bbox, 0, 1 ); | 86 | groupLayout->addWidget( bbox, 0, 1 ); |
87 | 87 | ||
88 | mEdit = new KLineEdit( group ); | 88 | mEdit = new KLineEdit( group ); |
89 | groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); | 89 | groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); |
90 | 90 | ||
91 | layout->addWidget( group ); | 91 | layout->addWidget( group ); |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | mAddButton->setEnabled( false ); | 95 | mAddButton->setEnabled( false ); |
96 | mRemoveButton->setEnabled( false ); | 96 | mRemoveButton->setEnabled( false ); |
97 | 97 | ||
98 | 98 | ||
99 | connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ), | 99 | connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ), |
100 | SLOT( selectionChanged( QListBoxItem* ) ) ); | 100 | SLOT( selectionChanged( QListBoxItem* ) ) ); |
101 | connect( mEdit, SIGNAL( textChanged( const QString& ) ), | 101 | connect( mEdit, SIGNAL( textChanged( const QString& ) ), |
102 | SLOT( textChanged( const QString& ) ) ); | 102 | SLOT( textChanged( const QString& ) ) ); |
103 | connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); | 103 | connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); |
104 | 104 | ||
105 | } | 105 | } |
106 | 106 | ||
107 | NamePartWidget::~NamePartWidget() | 107 | NamePartWidget::~NamePartWidget() |
108 | { | 108 | { |
109 | } | 109 | } |
110 | 110 | ||
111 | void NamePartWidget::setNameParts( const QStringList &list ) | 111 | void NamePartWidget::setNameParts( const QStringList &list ) |
112 | { | 112 | { |
113 | mBox->clear(); | 113 | mBox->clear(); |
114 | mBox->insertStringList( list ); | 114 | mBox->insertStringList( list ); |
115 | } | 115 | } |
116 | 116 | ||
117 | QStringList NamePartWidget::nameParts() const | 117 | QStringList NamePartWidget::nameParts() const |
118 | { | 118 | { |
119 | QStringList parts; | 119 | QStringList parts; |
120 | for ( uint i = 0; i < mBox->count(); ++i ) | 120 | for ( uint i = 0; i < mBox->count(); ++i ) |
121 | parts.append( mBox->text( i ) ); | 121 | parts.append( mBox->text( i ) ); |
122 | 122 | ||
123 | return parts; | 123 | return parts; |
124 | } | 124 | } |
125 | 125 | ||
126 | void NamePartWidget::add() | 126 | void NamePartWidget::add() |
127 | { | 127 | { |
128 | if ( !mEdit->text().isEmpty() ) { | 128 | if ( !mEdit->text().isEmpty() ) { |
129 | mBox->insertItem( mEdit->text() ); | 129 | mBox->insertItem( mEdit->text() ); |
130 | emit modified(); | 130 | emit modified(); |
131 | } | 131 | } |
132 | 132 | ||
133 | mEdit->setText( "" ); | 133 | mEdit->setText( "" ); |
134 | } | 134 | } |
135 | 135 | ||
136 | void NamePartWidget::remove() | 136 | void NamePartWidget::remove() |
137 | { | 137 | { |
138 | mBox->removeItem( mBox->currentItem() ); | 138 | mBox->removeItem( mBox->currentItem() ); |
139 | if ( mBox->count() == 0 ) | 139 | if ( mBox->count() == 0 ) |
140 | selectionChanged( 0 ); | 140 | selectionChanged( 0 ); |
141 | 141 | ||
142 | emit modified(); | 142 | emit modified(); |
143 | } | 143 | } |
144 | 144 | ||
145 | void NamePartWidget::selectionChanged( QListBoxItem *item ) | 145 | void NamePartWidget::selectionChanged( QListBoxItem *item ) |
146 | { | 146 | { |
147 | mRemoveButton->setEnabled( item != 0 ); | 147 | mRemoveButton->setEnabled( item != 0 ); |
148 | } | 148 | } |
149 | 149 | ||
150 | void NamePartWidget::textChanged( const QString& text ) | 150 | void NamePartWidget::textChanged( const QString& text ) |
151 | { | 151 | { |
152 | mAddButton->setEnabled( !text.isEmpty() ); | 152 | mAddButton->setEnabled( !text.isEmpty() ); |
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
156 | AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) | 156 | AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) |
157 | : QWidget( parent, name ) | 157 | : QWidget( parent, name ) |
158 | { | 158 | { |
159 | QGridLayout *layout; | 159 | QGridLayout *layout; |
160 | 160 | ||
161 | mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); | 161 | mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); |
162 | mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); | 162 | mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); |
163 | mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); | 163 | mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); |
164 | QLabel *label = new QLabel( i18n( "Default formatted name:" ), this ); | 164 | QString dfn; |
165 | if (QApplication::desktop()->width() > 320 ) | ||
166 | dfn = i18n( "Default formatted name:" ); | ||
167 | else | ||
168 | dfn = i18n( "Def. formatted name:" ); | ||
169 | |||
170 | QLabel *label = new QLabel( dfn, this ); | ||
165 | 171 | ||
166 | mFormattedNameCombo = new KComboBox( this ); | 172 | mFormattedNameCombo = new KComboBox( this ); |
167 | mFormattedNameCombo->insertItem( i18n( "Empty" ) ); | 173 | mFormattedNameCombo->insertItem( i18n( "Empty" ) ); |
168 | mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); | 174 | mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); |
169 | mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); | 175 | mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); |
170 | mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); | 176 | mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); |
171 | 177 | ||
172 | if (KGlobal::getOrientation() == KGlobal::Portrait) | 178 | if (KGlobal::getOrientation() == KGlobal::Portrait) |
173 | { | 179 | { |
174 | layout = new QGridLayout( this, 4, 2, KDialog::marginHint(), | 180 | layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(), |
175 | KDialog::spacingHint() ); | 181 | KDialog::spacingHintSmall() ); |
176 | 182 | ||
177 | layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); | 183 | layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); |
178 | layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); | 184 | layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); |
179 | layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); | 185 | layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); |
180 | layout->addWidget( label, 3, 0 ); | 186 | layout->addWidget( label, 3, 0 ); |
181 | layout->addWidget( mFormattedNameCombo, 3, 1 ); | 187 | layout->addWidget( mFormattedNameCombo, 3, 1 ); |
182 | 188 | ||
183 | } | 189 | } |
184 | else | 190 | else |
185 | { | 191 | { |
186 | layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), | 192 | layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), |
187 | KDialog::spacingHint() ); | 193 | KDialog::spacingHint() ); |
188 | 194 | ||
189 | layout->addWidget( mPrefix, 0, 0 ); | 195 | layout->addWidget( mPrefix, 0, 0 ); |
190 | layout->addWidget( mInclusion, 0, 1 ); | 196 | layout->addWidget( mInclusion, 0, 1 ); |
191 | layout->addWidget( mSuffix, 0, 2 ); | 197 | layout->addWidget( mSuffix, 0, 2 ); |
192 | layout->addWidget( label, 1, 0 ); | 198 | layout->addWidget( label, 1, 0 ); |
193 | layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); | 199 | layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); |
194 | } | 200 | } |
195 | 201 | ||
196 | connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); | 202 | connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); |
197 | connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); | 203 | connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); |
198 | connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); | 204 | connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); |
199 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) ); | 205 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) ); |
200 | } | 206 | } |
201 | 207 | ||
202 | AddresseeWidget::~AddresseeWidget() | 208 | AddresseeWidget::~AddresseeWidget() |
203 | { | 209 | { |
204 | } | 210 | } |
205 | 211 | ||
206 | void AddresseeWidget::restoreSettings() | 212 | void AddresseeWidget::restoreSettings() |
207 | { | 213 | { |
208 | KConfig config( locateLocal("config", "kabcrc") ); | 214 | KConfig config( locateLocal("config", "kabcrc") ); |
209 | config.setGroup( "General" ); | 215 | config.setGroup( "General" ); |
210 | 216 | ||
211 | mPrefix->setNameParts( config.readListEntry( "Prefixes" ) ); | 217 | mPrefix->setNameParts( config.readListEntry( "Prefixes" ) ); |
212 | mInclusion->setNameParts( config.readListEntry( "Inclusions" ) ); | 218 | mInclusion->setNameParts( config.readListEntry( "Inclusions" ) ); |
213 | mSuffix->setNameParts( config.readListEntry( "Suffixes" ) ); | 219 | mSuffix->setNameParts( config.readListEntry( "Suffixes" ) ); |
214 | 220 | ||
215 | KConfig cfg( locateLocal("config","kaddressbookrc") ); | 221 | KConfig cfg( locateLocal("config","kaddressbookrc") ); |
216 | cfg.setGroup( "General" ); | 222 | cfg.setGroup( "General" ); |
217 | mFormattedNameCombo->setCurrentItem( cfg.readNumEntry( "FormattedNameType", 1 ) ); | 223 | mFormattedNameCombo->setCurrentItem( cfg.readNumEntry( "FormattedNameType", 1 ) ); |
218 | } | 224 | } |
219 | 225 | ||
220 | void AddresseeWidget::saveSettings() | 226 | void AddresseeWidget::saveSettings() |
221 | { | 227 | { |
222 | KConfig config( locateLocal("config","kabcrc") ); | 228 | KConfig config( locateLocal("config","kabcrc") ); |
223 | config.setGroup( "General" ); | 229 | config.setGroup( "General" ); |
224 | 230 | ||
225 | config.writeEntry( "Prefixes", mPrefix->nameParts() ); | 231 | config.writeEntry( "Prefixes", mPrefix->nameParts() ); |
226 | config.writeEntry( "Inclusions", mInclusion->nameParts() ); | 232 | config.writeEntry( "Inclusions", mInclusion->nameParts() ); |
227 | config.writeEntry( "Suffixes", mSuffix->nameParts() ); | 233 | config.writeEntry( "Suffixes", mSuffix->nameParts() ); |
228 | 234 | ||
229 | KConfig cfg( locateLocal("config","kaddressbookrc") ); | 235 | KConfig cfg( locateLocal("config","kaddressbookrc") ); |
230 | cfg.setGroup( "General" ); | 236 | cfg.setGroup( "General" ); |
231 | cfg.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); | 237 | cfg.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); |
232 | } | 238 | } |
233 | 239 | ||
234 | #ifndef KAB_EMBEDDED | 240 | #ifndef KAB_EMBEDDED |
235 | #include "addresseewidget.moc" | 241 | #include "addresseewidget.moc" |
236 | #endif //KAB_EMBEDDED | 242 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 7b3e5c6..38c7946 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -1,357 +1,363 @@ | |||
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 <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | 30 | ||
31 | #include <kconfig.h> | 31 | #include <kconfig.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kdialog.h> | 33 | #include <kdialog.h> |
34 | #include <klistview.h> | 34 | #include <klistview.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
38 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
39 | 39 | ||
40 | #ifndef KAB_EMBEDDED | 40 | #ifndef KAB_EMBEDDED |
41 | #include <ktrader.h> | 41 | #include <ktrader.h> |
42 | #else // KAB_EMBEDDED | 42 | #else // KAB_EMBEDDED |
43 | #include <mergewidget.h> | 43 | #include <mergewidget.h> |
44 | #include <distributionlistwidget.h> | 44 | #include <distributionlistwidget.h> |
45 | #endif // KAB_EMBEDDED | 45 | #endif // KAB_EMBEDDED |
46 | 46 | ||
47 | #include "addresseewidget.h" | 47 | #include "addresseewidget.h" |
48 | #include "extensionconfigdialog.h" | 48 | #include "extensionconfigdialog.h" |
49 | #include "extensionwidget.h" | 49 | #include "extensionwidget.h" |
50 | #include "kabprefs.h" | 50 | #include "kabprefs.h" |
51 | 51 | ||
52 | #include "kabconfigwidget.h" | 52 | #include "kabconfigwidget.h" |
53 | 53 | ||
54 | class ExtensionItem : public QCheckListItem | 54 | class ExtensionItem : public QCheckListItem |
55 | { | 55 | { |
56 | public: | 56 | public: |
57 | 57 | ||
58 | #ifndef KAB_EMBEDDED | 58 | #ifndef KAB_EMBEDDED |
59 | ExtensionItem( QListView *parent, const QString &text ); | 59 | ExtensionItem( QListView *parent, const QString &text ); |
60 | void setService( const KService::Ptr &ptr ); | 60 | void setService( const KService::Ptr &ptr ); |
61 | #else //KAB_EMBEDDED | 61 | #else //KAB_EMBEDDED |
62 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); | 62 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); |
63 | void setFactory( ExtensionFactory* fac ); | 63 | void setFactory( ExtensionFactory* fac ); |
64 | #endif //KAB_EMBEDDED | 64 | #endif //KAB_EMBEDDED |
65 | 65 | ||
66 | bool configWidgetAvailable() const; | 66 | bool configWidgetAvailable() const; |
67 | ExtensionFactory *factory() const; | 67 | ExtensionFactory *factory() const; |
68 | 68 | ||
69 | virtual QString text( int column ) const; | 69 | virtual QString text( int column ) const; |
70 | 70 | ||
71 | private: | 71 | private: |
72 | #ifndef KAB_EMBEDDED | 72 | #ifndef KAB_EMBEDDED |
73 | KService::Ptr mPtr; | 73 | KService::Ptr mPtr; |
74 | #else //KAB_EMBEDDED | 74 | #else //KAB_EMBEDDED |
75 | ExtensionFactory* mFactory; | 75 | ExtensionFactory* mFactory; |
76 | QString mName; | 76 | QString mName; |
77 | QString mComment; | 77 | QString mComment; |
78 | 78 | ||
79 | #endif //KAB_EMBEDDED | 79 | #endif //KAB_EMBEDDED |
80 | 80 | ||
81 | }; | 81 | }; |
82 | 82 | ||
83 | KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | 83 | KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) |
84 | : QWidget( parent, name ) | 84 | : QWidget( parent, name ) |
85 | { | 85 | { |
86 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 86 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
87 | KDialog::spacingHint() ); | 87 | KDialog::spacingHint() ); |
88 | 88 | ||
89 | QTabWidget *tabWidget = new QTabWidget( this ); | 89 | QTabWidget *tabWidget = new QTabWidget( this ); |
90 | topLayout->addWidget( tabWidget ); | 90 | topLayout->addWidget( tabWidget ); |
91 | 91 | ||
92 | // General page | 92 | // General page |
93 | QWidget *generalPage = new QWidget( this ); | 93 | QWidget *generalPage = new QWidget( this ); |
94 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHint(), | 94 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
95 | KDialog::spacingHint() ); | 95 | KDialog::spacingHintSmall() ); |
96 | 96 | ||
97 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); | 97 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); |
98 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); | 98 | QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); |
99 | boxLayout->setAlignment( Qt::AlignTop ); | 99 | boxLayout->setAlignment( Qt::AlignTop ); |
100 | 100 | boxLayout->setMargin(KDialog::marginHintSmall() ); | |
101 | groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; | ||
102 | groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); | ||
103 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | ||
101 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); | 104 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); |
102 | boxLayout->addWidget( mViewsSingleClickBox ); | 105 | boxLayout->addWidget( mViewsSingleClickBox ); |
103 | 106 | ||
104 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); | 107 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); |
105 | boxLayout->addWidget( mNameParsing ); | 108 | boxLayout->addWidget( mNameParsing ); |
106 | 109 | ||
107 | layout->addWidget( groupBox ); | 110 | layout->addWidget( groupBox ); |
108 | 111 | ||
109 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); | 112 | groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); |
110 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 113 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
111 | boxLayout->setAlignment( Qt::AlignTop ); | 114 | boxLayout->setAlignment( Qt::AlignTop ); |
112 | 115 | boxLayout->setMargin(KDialog::marginHintSmall()); | |
116 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | ||
117 | groupBox->layout()->setMargin(1) ; | ||
118 | groupBox->layout()->setSpacing(0); | ||
113 | mExtensionView = new KListView( groupBox ); | 119 | mExtensionView = new KListView( groupBox ); |
114 | mExtensionView->setAllColumnsShowFocus( true ); | 120 | mExtensionView->setAllColumnsShowFocus( true ); |
115 | mExtensionView->addColumn( i18n( "Name" ) ); | 121 | mExtensionView->addColumn( i18n( "Name" ) ); |
116 | mExtensionView->addColumn( i18n( "Description" ) ); | 122 | mExtensionView->addColumn( i18n( "Description" ) ); |
117 | mExtensionView->setMaximumHeight(80); | 123 | mExtensionView->setMaximumHeight(80); |
118 | 124 | ||
119 | boxLayout->addWidget( mExtensionView ); | 125 | boxLayout->addWidget( mExtensionView ); |
120 | 126 | ||
121 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | 127 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); |
122 | mConfigureButton->setEnabled( false ); | 128 | mConfigureButton->setEnabled( false ); |
123 | boxLayout->addWidget( mConfigureButton ); | 129 | boxLayout->addWidget( mConfigureButton ); |
124 | 130 | ||
125 | layout->addWidget( groupBox ); | 131 | layout->addWidget( groupBox ); |
126 | 132 | ||
127 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 133 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
128 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 134 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
129 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 135 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
130 | SLOT( selectionChanged( QListViewItem* ) ) ); | 136 | SLOT( selectionChanged( QListViewItem* ) ) ); |
131 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 137 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
132 | SLOT( itemClicked( QListViewItem* ) ) ); | 138 | SLOT( itemClicked( QListViewItem* ) ) ); |
133 | connect( mConfigureButton, SIGNAL( clicked() ), | 139 | connect( mConfigureButton, SIGNAL( clicked() ), |
134 | SLOT( configureExtension() ) ); | 140 | SLOT( configureExtension() ) ); |
135 | 141 | ||
136 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 142 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
137 | 143 | ||
138 | // Addressee page | 144 | // Addressee page |
139 | mAddresseeWidget = new AddresseeWidget( this ); | 145 | mAddresseeWidget = new AddresseeWidget( this ); |
140 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 146 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
141 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 147 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
142 | } | 148 | } |
143 | 149 | ||
144 | void KABConfigWidget::restoreSettings() | 150 | void KABConfigWidget::restoreSettings() |
145 | { | 151 | { |
146 | bool blocked = signalsBlocked(); | 152 | bool blocked = signalsBlocked(); |
147 | blockSignals( true ); | 153 | blockSignals( true ); |
148 | 154 | ||
149 | mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); | 155 | mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); |
150 | mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); | 156 | mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); |
151 | mAddresseeWidget->restoreSettings(); | 157 | mAddresseeWidget->restoreSettings(); |
152 | 158 | ||
153 | restoreExtensionSettings(); | 159 | restoreExtensionSettings(); |
154 | 160 | ||
155 | blockSignals( blocked ); | 161 | blockSignals( blocked ); |
156 | 162 | ||
157 | emit changed( false ); | 163 | emit changed( false ); |
158 | } | 164 | } |
159 | 165 | ||
160 | void KABConfigWidget::saveSettings() | 166 | void KABConfigWidget::saveSettings() |
161 | { | 167 | { |
162 | KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); | 168 | KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); |
163 | KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 169 | KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
164 | mAddresseeWidget->saveSettings(); | 170 | mAddresseeWidget->saveSettings(); |
165 | 171 | ||
166 | saveExtensionSettings(); | 172 | saveExtensionSettings(); |
167 | KABPrefs::instance()->writeConfig(); | 173 | KABPrefs::instance()->writeConfig(); |
168 | 174 | ||
169 | emit changed( false ); | 175 | emit changed( false ); |
170 | } | 176 | } |
171 | 177 | ||
172 | void KABConfigWidget::defaults() | 178 | void KABConfigWidget::defaults() |
173 | { | 179 | { |
174 | mNameParsing->setChecked( true ); | 180 | mNameParsing->setChecked( true ); |
175 | mViewsSingleClickBox->setChecked( false ); | 181 | mViewsSingleClickBox->setChecked( false ); |
176 | 182 | ||
177 | emit changed( true ); | 183 | emit changed( true ); |
178 | } | 184 | } |
179 | 185 | ||
180 | void KABConfigWidget::modified() | 186 | void KABConfigWidget::modified() |
181 | { | 187 | { |
182 | emit changed( true ); | 188 | emit changed( true ); |
183 | } | 189 | } |
184 | 190 | ||
185 | void KABConfigWidget::restoreExtensionSettings() | 191 | void KABConfigWidget::restoreExtensionSettings() |
186 | { | 192 | { |
187 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 193 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
188 | 194 | ||
189 | mExtensionView->clear(); | 195 | mExtensionView->clear(); |
190 | 196 | ||
191 | #ifndef KAB_EMBEDDED | 197 | #ifndef KAB_EMBEDDED |
192 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 198 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
193 | KTrader::OfferList::ConstIterator it; | 199 | KTrader::OfferList::ConstIterator it; |
194 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 200 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
195 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 201 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
196 | continue; | 202 | continue; |
197 | 203 | ||
198 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); | 204 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); |
199 | item->setService( *it ); | 205 | item->setService( *it ); |
200 | if ( activeExtensions.contains( item->factory()->identifier() ) ) | 206 | if ( activeExtensions.contains( item->factory()->identifier() ) ) |
201 | item->setOn( true ); | 207 | item->setOn( true ); |
202 | } | 208 | } |
203 | #else //KAB_EMBEDDED | 209 | #else //KAB_EMBEDDED |
204 | ExtensionFactory *extensionFactory = new MergeFactory(); | 210 | ExtensionFactory *extensionFactory = new MergeFactory(); |
205 | 211 | ||
206 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); | 212 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); |
207 | 213 | ||
208 | item->setFactory( extensionFactory ); | 214 | item->setFactory( extensionFactory ); |
209 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 215 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
210 | item->setOn( true ); | 216 | item->setOn( true ); |
211 | 217 | ||
212 | 218 | ||
213 | 219 | ||
214 | extensionFactory = new DistributionListFactory(); | 220 | extensionFactory = new DistributionListFactory(); |
215 | 221 | ||
216 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); | 222 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); |
217 | 223 | ||
218 | item->setFactory( extensionFactory ); | 224 | item->setFactory( extensionFactory ); |
219 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 225 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
220 | item->setOn( true ); | 226 | item->setOn( true ); |
221 | 227 | ||
222 | 228 | ||
223 | #endif //KAB_EMBEDDED | 229 | #endif //KAB_EMBEDDED |
224 | 230 | ||
225 | } | 231 | } |
226 | 232 | ||
227 | void KABConfigWidget::saveExtensionSettings() | 233 | void KABConfigWidget::saveExtensionSettings() |
228 | { | 234 | { |
229 | QStringList activeExtensions; | 235 | QStringList activeExtensions; |
230 | 236 | ||
231 | QPtrList<QListViewItem> list; | 237 | QPtrList<QListViewItem> list; |
232 | QListViewItemIterator it( mExtensionView ); | 238 | QListViewItemIterator it( mExtensionView ); |
233 | while ( it.current() ) { | 239 | while ( it.current() ) { |
234 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); | 240 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); |
235 | if ( item ) { | 241 | if ( item ) { |
236 | if ( item->isOn() ) | 242 | if ( item->isOn() ) |
237 | activeExtensions.append( item->factory()->identifier() ); | 243 | activeExtensions.append( item->factory()->identifier() ); |
238 | } | 244 | } |
239 | ++it; | 245 | ++it; |
240 | } | 246 | } |
241 | 247 | ||
242 | KABPrefs::instance()->mActiveExtensions = activeExtensions; | 248 | KABPrefs::instance()->mActiveExtensions = activeExtensions; |
243 | } | 249 | } |
244 | 250 | ||
245 | void KABConfigWidget::configureExtension() | 251 | void KABConfigWidget::configureExtension() |
246 | { | 252 | { |
247 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); | 253 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); |
248 | if ( !item ) | 254 | if ( !item ) |
249 | return; | 255 | return; |
250 | 256 | ||
251 | #ifndef KAB_EMBEDDED | 257 | #ifndef KAB_EMBEDDED |
252 | KConfig config( "kaddressbookrc" ); | 258 | KConfig config( "kaddressbookrc" ); |
253 | #else //KAB_EMBEDDED | 259 | #else //KAB_EMBEDDED |
254 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 260 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
255 | #endif //KAB_EMBEDDED | 261 | #endif //KAB_EMBEDDED |
256 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); | 262 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); |
257 | 263 | ||
258 | ExtensionConfigDialog dlg( item->factory(), &config, this ); | 264 | ExtensionConfigDialog dlg( item->factory(), &config, this ); |
259 | dlg.exec(); | 265 | dlg.exec(); |
260 | 266 | ||
261 | config.sync(); | 267 | config.sync(); |
262 | } | 268 | } |
263 | 269 | ||
264 | void KABConfigWidget::selectionChanged( QListViewItem *i ) | 270 | void KABConfigWidget::selectionChanged( QListViewItem *i ) |
265 | { | 271 | { |
266 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); | 272 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); |
267 | if ( !item ) | 273 | if ( !item ) |
268 | return; | 274 | return; |
269 | 275 | ||
270 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); | 276 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); |
271 | } | 277 | } |
272 | 278 | ||
273 | void KABConfigWidget::itemClicked( QListViewItem *item ) | 279 | void KABConfigWidget::itemClicked( QListViewItem *item ) |
274 | { | 280 | { |
275 | if ( item != 0 ) | 281 | if ( item != 0 ) |
276 | modified(); | 282 | modified(); |
277 | } | 283 | } |
278 | 284 | ||
279 | #ifndef KAB_EMBEDDED | 285 | #ifndef KAB_EMBEDDED |
280 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) | 286 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) |
281 | : QCheckListItem( parent, text, CheckBox ) | 287 | : QCheckListItem( parent, text, CheckBox ) |
282 | { | 288 | { |
283 | } | 289 | } |
284 | 290 | ||
285 | void ExtensionItem::setService( const KService::Ptr &ptr ) | 291 | void ExtensionItem::setService( const KService::Ptr &ptr ) |
286 | { | 292 | { |
287 | mPtr = ptr; | 293 | mPtr = ptr; |
288 | } | 294 | } |
289 | #else //KAB_EMBEDDED | 295 | #else //KAB_EMBEDDED |
290 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) | 296 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) |
291 | : QCheckListItem( parent, text, CheckBox ) | 297 | : QCheckListItem( parent, text, CheckBox ) |
292 | { | 298 | { |
293 | mName = name; | 299 | mName = name; |
294 | mComment = comment; | 300 | mComment = comment; |
295 | } | 301 | } |
296 | 302 | ||
297 | 303 | ||
298 | void ExtensionItem::setFactory( ExtensionFactory* fac ) | 304 | void ExtensionItem::setFactory( ExtensionFactory* fac ) |
299 | { | 305 | { |
300 | mFactory = fac; | 306 | mFactory = fac; |
301 | } | 307 | } |
302 | #endif //KAB_EMBEDDED | 308 | #endif //KAB_EMBEDDED |
303 | 309 | ||
304 | bool ExtensionItem::configWidgetAvailable() const | 310 | bool ExtensionItem::configWidgetAvailable() const |
305 | { | 311 | { |
306 | #ifndef KAB_EMBEDDED | 312 | #ifndef KAB_EMBEDDED |
307 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 313 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
308 | if ( !factory ) | 314 | if ( !factory ) |
309 | return false; | 315 | return false; |
310 | 316 | ||
311 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); | 317 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); |
312 | if ( !extensionFactory ) | 318 | if ( !extensionFactory ) |
313 | return false; | 319 | return false; |
314 | 320 | ||
315 | return extensionFactory->configureWidgetAvailable(); | 321 | return extensionFactory->configureWidgetAvailable(); |
316 | #else //KAB_EMBEDDED | 322 | #else //KAB_EMBEDDED |
317 | return mFactory->configureWidgetAvailable(); | 323 | return mFactory->configureWidgetAvailable(); |
318 | #endif //KAB_EMBEDDED | 324 | #endif //KAB_EMBEDDED |
319 | 325 | ||
320 | } | 326 | } |
321 | 327 | ||
322 | ExtensionFactory *ExtensionItem::factory() const | 328 | ExtensionFactory *ExtensionItem::factory() const |
323 | { | 329 | { |
324 | #ifndef KAB_EMBEDDED | 330 | #ifndef KAB_EMBEDDED |
325 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 331 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
326 | if ( !factory ) | 332 | if ( !factory ) |
327 | return 0; | 333 | return 0; |
328 | 334 | ||
329 | return static_cast<ExtensionFactory*>( factory ); | 335 | return static_cast<ExtensionFactory*>( factory ); |
330 | #else //KAB_EMBEDDED | 336 | #else //KAB_EMBEDDED |
331 | return mFactory; | 337 | return mFactory; |
332 | #endif //KAB_EMBEDDED | 338 | #endif //KAB_EMBEDDED |
333 | } | 339 | } |
334 | 340 | ||
335 | QString ExtensionItem::text( int column ) const | 341 | QString ExtensionItem::text( int column ) const |
336 | { | 342 | { |
337 | #ifndef KAB_EMBEDDED | 343 | #ifndef KAB_EMBEDDED |
338 | if ( column == 0 ) | 344 | if ( column == 0 ) |
339 | return mPtr->name(); | 345 | return mPtr->name(); |
340 | else if ( column == 1 ) | 346 | else if ( column == 1 ) |
341 | return mPtr->comment(); | 347 | return mPtr->comment(); |
342 | else | 348 | else |
343 | return QString::null; | 349 | return QString::null; |
344 | #else //KAB_EMBEDDED | 350 | #else //KAB_EMBEDDED |
345 | if ( column == 0 ) | 351 | if ( column == 0 ) |
346 | return mName; | 352 | return mName; |
347 | else if ( column == 1 ) | 353 | else if ( column == 1 ) |
348 | return mComment; | 354 | return mComment; |
349 | else | 355 | else |
350 | return QString::null; | 356 | return QString::null; |
351 | #endif //KAB_EMBEDDED | 357 | #endif //KAB_EMBEDDED |
352 | } | 358 | } |
353 | 359 | ||
354 | #ifndef KAB_EMBEDDED | 360 | #ifndef KAB_EMBEDDED |
355 | #include "kabconfigwidget.moc" | 361 | #include "kabconfigwidget.moc" |
356 | #endif //KAB_EMBEDDED | 362 | #endif //KAB_EMBEDDED |
357 | 363 | ||
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp index 791a940..a278042 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp +++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp | |||
@@ -1,86 +1,90 @@ | |||
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 <qlayout.h> | 24 | #include <qlayout.h> |
25 | 25 | ||
26 | #ifndef KAB_EMBEDDED | 26 | #ifndef KAB_EMBEDDED |
27 | #include <kaboutdata.h> | 27 | #include <kaboutdata.h> |
28 | #endif //KAB_EMBEDDED | 28 | #endif //KAB_EMBEDDED |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | #include <stdlib.h> | ||
31 | 32 | ||
32 | #include "kabconfigwidget.h" | 33 | #include "kabconfigwidget.h" |
33 | 34 | ||
34 | #include "kcmkabconfig.h" | 35 | #include "kcmkabconfig.h" |
35 | 36 | ||
36 | extern "C" | 37 | extern "C" |
37 | { | 38 | { |
38 | KCModule *create_kabconfig( QWidget *parent, const char * ) { | 39 | KCModule *create_kabconfig( QWidget *parent, const char * ) { |
39 | return new KCMKabConfig( parent, "kcmkabconfig" ); | 40 | return new KCMKabConfig( parent, "kcmkabconfig" ); |
40 | } | 41 | } |
41 | } | 42 | } |
42 | 43 | ||
43 | KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) | 44 | KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) |
44 | : KCModule( parent, name ) | 45 | : KCModule( parent, name ) |
45 | { | 46 | { |
47 | //abort(); | ||
46 | QVBoxLayout *layout = new QVBoxLayout( this ); | 48 | QVBoxLayout *layout = new QVBoxLayout( this ); |
47 | mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); | 49 | mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); |
48 | layout->addWidget( mConfigWidget ); | 50 | layout->addWidget( mConfigWidget ); |
49 | 51 | layout->setSpacing( 0 ); | |
52 | layout->setMargin( 0 ); | ||
53 | |||
50 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 54 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
51 | load(); | 55 | load(); |
52 | } | 56 | } |
53 | 57 | ||
54 | void KCMKabConfig::load() | 58 | void KCMKabConfig::load() |
55 | { | 59 | { |
56 | mConfigWidget->restoreSettings(); | 60 | mConfigWidget->restoreSettings(); |
57 | } | 61 | } |
58 | 62 | ||
59 | void KCMKabConfig::save() | 63 | void KCMKabConfig::save() |
60 | { | 64 | { |
61 | mConfigWidget->saveSettings(); | 65 | mConfigWidget->saveSettings(); |
62 | } | 66 | } |
63 | 67 | ||
64 | void KCMKabConfig::defaults() | 68 | void KCMKabConfig::defaults() |
65 | { | 69 | { |
66 | mConfigWidget->defaults(); | 70 | mConfigWidget->defaults(); |
67 | } | 71 | } |
68 | 72 | ||
69 | #ifndef KAB_EMBEDDED | 73 | #ifndef KAB_EMBEDDED |
70 | const KAboutData* KCMKabConfig::aboutData() const | 74 | const KAboutData* KCMKabConfig::aboutData() const |
71 | { | 75 | { |
72 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), | 76 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), |
73 | I18N_NOOP( "KAddressBook Configure Dialog" ), | 77 | I18N_NOOP( "KAddressBook Configure Dialog" ), |
74 | 0, 0, KAboutData::License_GPL, | 78 | 0, 0, KAboutData::License_GPL, |
75 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); | 79 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); |
76 | 80 | ||
77 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); | 81 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); |
78 | 82 | ||
79 | return about; | 83 | return about; |
80 | 84 | ||
81 | } | 85 | } |
82 | #endif //KAB_EMBEDDED | 86 | #endif //KAB_EMBEDDED |
83 | 87 | ||
84 | #ifndef KAB_EMBEDDED | 88 | #ifndef KAB_EMBEDDED |
85 | #include "kcmkabconfig.moc" | 89 | #include "kcmkabconfig.moc" |
86 | #endif //KAB_EMBEDDED | 90 | #endif //KAB_EMBEDDED |