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