summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp138
-rw-r--r--kaddressbook/kabcore.h7
2 files changed, 100 insertions, 45 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 96603e6..6807bed 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -144,206 +144,199 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
144{ 144{
145 145
146 mExtensionBarSplitter = 0; 146 mExtensionBarSplitter = 0;
147 mIsPart = !parent->inherits( "KAddressBookMain" ); 147 mIsPart = !parent->inherits( "KAddressBookMain" );
148 148
149 mAddressBook = KABC::StdAddressBook::self(); 149 mAddressBook = KABC::StdAddressBook::self();
150 KABC::StdAddressBook::setAutomaticSave( false ); 150 KABC::StdAddressBook::setAutomaticSave( false );
151 151
152#ifndef KAB_EMBEDDED 152#ifndef KAB_EMBEDDED
153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 153 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
154#endif //KAB_EMBEDDED 154#endif //KAB_EMBEDDED
155 155
156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 156 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
157 SLOT( addressBookChanged() ) ); 157 SLOT( addressBookChanged() ) );
158 158
159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 159 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
160 "X-Department", "KADDRESSBOOK" ); 160 "X-Department", "KADDRESSBOOK" );
161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 161 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
162 "X-Profession", "KADDRESSBOOK" ); 162 "X-Profession", "KADDRESSBOOK" );
163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 163 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
164 "X-AssistantsName", "KADDRESSBOOK" ); 164 "X-AssistantsName", "KADDRESSBOOK" );
165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 165 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
166 "X-ManagersName", "KADDRESSBOOK" ); 166 "X-ManagersName", "KADDRESSBOOK" );
167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 167 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
168 "X-SpousesName", "KADDRESSBOOK" ); 168 "X-SpousesName", "KADDRESSBOOK" );
169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
170 "X-Office", "KADDRESSBOOK" ); 170 "X-Office", "KADDRESSBOOK" );
171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
172 "X-IMAddress", "KADDRESSBOOK" ); 172 "X-IMAddress", "KADDRESSBOOK" );
173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
174 "X-Anniversary", "KADDRESSBOOK" ); 174 "X-Anniversary", "KADDRESSBOOK" );
175 175
176 //US added this field to become compatible with Opie/qtopia addressbook 176 //US added this field to become compatible with Opie/qtopia addressbook
177 // values can be "female" or "male" or "". An empty field represents undefined. 177 // values can be "female" or "male" or "". An empty field represents undefined.
178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
179 "X-Gender", "KADDRESSBOOK" ); 179 "X-Gender", "KADDRESSBOOK" );
180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
181 "X-Children", "KADDRESSBOOK" ); 181 "X-Children", "KADDRESSBOOK" );
182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
183 "X-FreeBusyUrl", "KADDRESSBOOK" ); 183 "X-FreeBusyUrl", "KADDRESSBOOK" );
184 184
185 initGUI(); 185 initGUI();
186 186
187 mIncSearchWidget->setFocus(); 187 mIncSearchWidget->setFocus();
188 188
189 189
190 connect( mViewManager, SIGNAL( selected( const QString& ) ), 190 connect( mViewManager, SIGNAL( selected( const QString& ) ),
191 SLOT( setContactSelected( const QString& ) ) ); 191 SLOT( setContactSelected( const QString& ) ) );
192 192 connect( mViewManager, SIGNAL( executed( const QString& ) ),
193 //small devices show only the details view. bigger devices can edit the entry 193 SLOT( executeContact( const QString& ) ) );
194 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
195 connect( mViewManager, SIGNAL( executed( const QString& ) ),
196 SLOT( editContact( const QString& ) ) );
197 }
198 else
199 {
200 connect( mViewManager, SIGNAL( executed( const QString& ) ),
201 SLOT( showContact( const QString& ) ) );
202 }
203 194
204 connect( mViewManager, SIGNAL( deleteRequest( ) ), 195 connect( mViewManager, SIGNAL( deleteRequest( ) ),
205 SLOT( deleteContacts( ) ) ); 196 SLOT( deleteContacts( ) ) );
206 connect( mViewManager, SIGNAL( modified() ), 197 connect( mViewManager, SIGNAL( modified() ),
207 SLOT( setModified() ) ); 198 SLOT( setModified() ) );
208 199
209 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 200 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
201 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
210 202
211 connect( mXXPortManager, SIGNAL( modified() ), 203 connect( mXXPortManager, SIGNAL( modified() ),
212 SLOT( setModified() ) ); 204 SLOT( setModified() ) );
213 205
214 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 206 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
215 SLOT( incrementalSearch( const QString& ) ) ); 207 SLOT( incrementalSearch( const QString& ) ) );
216 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 208 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
217 mJumpButtonBar, SLOT( recreateButtons() ) ); 209 mJumpButtonBar, SLOT( recreateButtons() ) );
218 210
219 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 211 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
220 SLOT( sendMail( const QString& ) ) ); 212 SLOT( sendMail( const QString& ) ) );
221 213
222#ifndef KAB_EMBEDDED 214#ifndef KAB_EMBEDDED
223 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 215 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
224 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 216 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
225 217
226 connect( mDetails, SIGNAL( browse( const QString& ) ), 218 connect( mDetails, SIGNAL( browse( const QString& ) ),
227 SLOT( browse( const QString& ) ) ); 219 SLOT( browse( const QString& ) ) );
228 220
229 mAddressBookService = new KAddressBookService( this ); 221 mAddressBookService = new KAddressBookService( this );
230 222
231#endif //KAB_EMBEDDED 223#endif //KAB_EMBEDDED
232 mEditorDialog = 0; 224 mEditorDialog = 0;
233 createAddresseeEditorDialog( this ); 225 createAddresseeEditorDialog( this );
234 setModified( false ); 226 setModified( false );
235} 227}
236 228
237KABCore::~KABCore() 229KABCore::~KABCore()
238{ 230{
239 // save(); 231 // save();
240 //saveSettings(); 232 //saveSettings();
241 //KABPrefs::instance()->writeConfig(); 233 //KABPrefs::instance()->writeConfig();
242 delete AddresseeConfig::instance(); 234 delete AddresseeConfig::instance();
243 mAddressBook = 0; 235 mAddressBook = 0;
244 KABC::StdAddressBook::close(); 236 KABC::StdAddressBook::close();
245} 237}
246 238
247void KABCore::restoreSettings() 239void KABCore::restoreSettings()
248{ 240{
241 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
242
249 bool state; 243 bool state;
250 244
251 //small devices have at startup the details view disabled 245 if (mMultipleViewsAtOnce)
252 if (KGlobal::getDesktopSize() > KGlobal::Small )
253 state = KABPrefs::instance()->mDetailsPageVisible; 246 state = KABPrefs::instance()->mDetailsPageVisible;
254 else 247 else
255 state = false; 248 state = false;
256 249
257 mActionDetails->setChecked( state ); 250 mActionDetails->setChecked( state );
258 setDetailsVisible( state ); 251 setDetailsVisible( state );
259 252
260 state = KABPrefs::instance()->mJumpButtonBarVisible; 253 state = KABPrefs::instance()->mJumpButtonBarVisible;
261 254
262 mActionJumpBar->setChecked( state ); 255 mActionJumpBar->setChecked( state );
263 setJumpButtonBarVisible( state ); 256 setJumpButtonBarVisible( state );
264 257/*US
265 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 258 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
266 if ( splitterSize.count() == 0 ) { 259 if ( splitterSize.count() == 0 ) {
267 splitterSize.append( width() / 2 ); 260 splitterSize.append( width() / 2 );
268 splitterSize.append( width() / 2 ); 261 splitterSize.append( width() / 2 );
269 } 262 }
270 mMiniSplitter->setSizes( splitterSize ); 263 mMiniSplitter->setSizes( splitterSize );
271 if ( mExtensionBarSplitter ) { 264 if ( mExtensionBarSplitter ) {
272 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 265 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
273 if ( splitterSize.count() == 0 ) { 266 if ( splitterSize.count() == 0 ) {
274 splitterSize.append( width() / 2 ); 267 splitterSize.append( width() / 2 );
275 splitterSize.append( width() / 2 ); 268 splitterSize.append( width() / 2 );
276 } 269 }
277 mExtensionBarSplitter->setSizes( splitterSize ); 270 mExtensionBarSplitter->setSizes( splitterSize );
278 271
279 } 272 }
280#ifndef KAB_EMBEDDED 273*/
281 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 274 mViewManager->restoreSettings();
275 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
276 mExtensionManager->restoreSettings();
277
278 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
282 if ( splitterSize.count() == 0 ) { 279 if ( splitterSize.count() == 0 ) {
283 splitterSize.append( width() / 2 ); 280 splitterSize.append( width() / 2 );
284 splitterSize.append( width() / 2 ); 281 splitterSize.append( width() / 2 );
285 } 282 }
286 mExtensionBarSplitter->setSizes( splitterSize ); 283 mMiniSplitter->setSizes( splitterSize );
287 284 if ( mExtensionBarSplitter ) {
288 splitterSize = KABPrefs::instance()->mDetailsSplitter; 285 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
289 if ( splitterSize.count() == 0 ) { 286 if ( splitterSize.count() == 0 ) {
290 splitterSize.append( height() / 2 ); 287 splitterSize.append( width() / 2 );
291 splitterSize.append( height() / 2 ); 288 splitterSize.append( width() / 2 );
292 } 289 }
293 mDetailsSplitter->setSizes( splitterSize ); 290 mExtensionBarSplitter->setSizes( splitterSize );
294 291
295 mExtensionManager->restoreSettings(); 292 }
296 293
297#endif //KAB_EMBEDDED
298 294
299 mViewManager->restoreSettings();
300 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
301 mExtensionManager->restoreSettings();
302} 295}
303 296
304void KABCore::saveSettings() 297void KABCore::saveSettings()
305{ 298{
306 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 299 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
307 if ( mExtensionBarSplitter ) 300 if ( mExtensionBarSplitter )
308 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 301 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
309 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 302 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
310 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 303 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
311#ifndef KAB_EMBEDDED 304#ifndef KAB_EMBEDDED
312 305
313 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 306 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
314 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 307 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
315#endif //KAB_EMBEDDED 308#endif //KAB_EMBEDDED
316 mExtensionManager->saveSettings(); 309 mExtensionManager->saveSettings();
317 mViewManager->saveSettings(); 310 mViewManager->saveSettings();
318 311
319 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 312 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
320} 313}
321 314
322KABC::AddressBook *KABCore::addressBook() const 315KABC::AddressBook *KABCore::addressBook() const
323{ 316{
324 return mAddressBook; 317 return mAddressBook;
325} 318}
326 319
327KConfig *KABCore::config() 320KConfig *KABCore::config()
328{ 321{
329#ifndef KAB_EMBEDDED 322#ifndef KAB_EMBEDDED
330 return KABPrefs::instance()->config(); 323 return KABPrefs::instance()->config();
331#else //KAB_EMBEDDED 324#else //KAB_EMBEDDED
332 return KABPrefs::instance()->getConfig(); 325 return KABPrefs::instance()->getConfig();
333#endif //KAB_EMBEDDED 326#endif //KAB_EMBEDDED
334} 327}
335 328
336KActionCollection *KABCore::actionCollection() const 329KActionCollection *KABCore::actionCollection() const
337{ 330{
338 return mGUIClient->actionCollection(); 331 return mGUIClient->actionCollection();
339} 332}
340 333
341KABC::Field *KABCore::currentSearchField() const 334KABC::Field *KABCore::currentSearchField() const
342{ 335{
343 if (mIncSearchWidget) 336 if (mIncSearchWidget)
344 return mIncSearchWidget->currentField(); 337 return mIncSearchWidget->currentField();
345 else 338 else
346 return 0; 339 return 0;
347} 340}
348 341
349QStringList KABCore::selectedUIDs() const 342QStringList KABCore::selectedUIDs() const
@@ -385,97 +378,97 @@ void KABCore::createAboutData()
385 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 378 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
386 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 379 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
387 about->addAuthor( "Cornelius Schumacher", 380 about->addAuthor( "Cornelius Schumacher",
388 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 381 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
389 "schumacher@kde.org" ); 382 "schumacher@kde.org" );
390 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 383 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
391 "mpilone@slac.com" ); 384 "mpilone@slac.com" );
392 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 385 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
393 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 386 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
394 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 387 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
395 "michel@klaralvdalens-datakonsult.se" ); 388 "michel@klaralvdalens-datakonsult.se" );
396 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 389 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
397 "hansen@kde.org" ); 390 "hansen@kde.org" );
398 391
399 return about; 392 return about;
400#endif //KAB_EMBEDDED 393#endif //KAB_EMBEDDED
401 394
402 QString version; 395 QString version;
403#include <../version> 396#include <../version>
404 QMessageBox::about( this, "About KAddressbook/Pi", 397 QMessageBox::about( this, "About KAddressbook/Pi",
405 "KAddressbook/Platform-independent\n" 398 "KAddressbook/Platform-independent\n"
406 "(KA/Pi) " +version + " - " + 399 "(KA/Pi) " +version + " - " +
407#ifdef DESKTOP_VERSION 400#ifdef DESKTOP_VERSION
408 "Desktop Edition\n" 401 "Desktop Edition\n"
409#else 402#else
410 "PDA-Edition\n" 403 "PDA-Edition\n"
411 "for: Zaurus 5500 / 7x0 / 8x0\n" 404 "for: Zaurus 5500 / 7x0 / 8x0\n"
412#endif 405#endif
413 406
414 "(c) 2004 Ulf Schenk\n" 407 "(c) 2004 Ulf Schenk\n"
415 "(c) 1997-2003, The KDE PIM Team\n" 408 "(c) 1997-2003, The KDE PIM Team\n"
416 "Tobias Koenig Current maintainer tokoe@kde.org\n" 409 "Tobias Koenig Current maintainer tokoe@kde.org\n"
417 "Don Sanders Original author\n" 410 "Don Sanders Original author\n"
418 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 411 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
419 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 412 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
420 "Greg Stern DCOP interface\n" 413 "Greg Stern DCOP interface\n"
421 "Mark Westcot Contact pinning\n" 414 "Mark Westcot Contact pinning\n"
422 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 415 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
423 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 416 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
424#ifdef _WIN32_ 417#ifdef _WIN32_
425 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 418 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
426#endif 419#endif
427 ); 420 );
428} 421}
429 422
430void KABCore::setContactSelected( const QString &uid ) 423void KABCore::setContactSelected( const QString &uid )
431{ 424{
432 KABC::Addressee addr = mAddressBook->findByUid( uid ); 425 KABC::Addressee addr = mAddressBook->findByUid( uid );
433//US if ( !mDetails->isHidden() ) 426 if ( !mDetails->isHidden() )
434 mDetails->setAddressee( addr ); 427 mDetails->setAddressee( addr );
435 428
436 if ( !addr.isEmpty() ) { 429 if ( !addr.isEmpty() ) {
437 emit contactSelected( addr.formattedName() ); 430 emit contactSelected( addr.formattedName() );
438 KABC::Picture pic = addr.photo(); 431 KABC::Picture pic = addr.photo();
439 if ( pic.isIntern() ) { 432 if ( pic.isIntern() ) {
440//US emit contactSelected( pic.data() ); 433//US emit contactSelected( pic.data() );
441//US instead use: 434//US instead use:
442 QPixmap px; 435 QPixmap px;
443 if (pic.data().isNull() != true) 436 if (pic.data().isNull() != true)
444 { 437 {
445 px.convertFromImage(pic.data()); 438 px.convertFromImage(pic.data());
446 } 439 }
447 440
448 emit contactSelected( px ); 441 emit contactSelected( px );
449 } 442 }
450 } 443 }
451 444
452 445
453 mExtensionManager->setSelectionChanged(); 446 mExtensionManager->setSelectionChanged();
454 447
455 // update the actions 448 // update the actions
456 bool selected = !uid.isEmpty(); 449 bool selected = !uid.isEmpty();
457 450
458 if ( mReadWrite ) { 451 if ( mReadWrite ) {
459 mActionCut->setEnabled( selected ); 452 mActionCut->setEnabled( selected );
460 mActionPaste->setEnabled( selected ); 453 mActionPaste->setEnabled( selected );
461 } 454 }
462 455
463 mActionCopy->setEnabled( selected ); 456 mActionCopy->setEnabled( selected );
464 mActionDelete->setEnabled( selected ); 457 mActionDelete->setEnabled( selected );
465 mActionEditAddressee->setEnabled( selected ); 458 mActionEditAddressee->setEnabled( selected );
466 mActionMail->setEnabled( selected ); 459 mActionMail->setEnabled( selected );
467 mActionMailVCard->setEnabled( selected ); 460 mActionMailVCard->setEnabled( selected );
468 //if (mActionBeam) 461 //if (mActionBeam)
469 //mActionBeam->setEnabled( selected ); 462 //mActionBeam->setEnabled( selected );
470 463
471 if (mActionBeamVCard) 464 if (mActionBeamVCard)
472 mActionBeamVCard->setEnabled( selected ); 465 mActionBeamVCard->setEnabled( selected );
473 466
474 mActionWhoAmI->setEnabled( selected ); 467 mActionWhoAmI->setEnabled( selected );
475 mActionCategories->setEnabled( selected ); 468 mActionCategories->setEnabled( selected );
476} 469}
477 470
478void KABCore::sendMail() 471void KABCore::sendMail()
479{ 472{
480 sendMail( mViewManager->selectedEmails().join( ", " ) ); 473 sendMail( mViewManager->selectedEmails().join( ", " ) );
481} 474}
@@ -1012,284 +1005,340 @@ void KABCore::importFromOL()
1012 listNew.append( (*it) ); 1005 listNew.append( (*it) );
1013 else 1006 else
1014 listExisting.append( (*it) ); 1007 listExisting.append( (*it) );
1015 } 1008 }
1016 if ( listExisting.count() > 0 ) 1009 if ( listExisting.count() > 0 )
1017 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1010 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1018 if ( listNew.count() > 0 ) { 1011 if ( listNew.count() > 0 ) {
1019 pasteWithNewUid = false; 1012 pasteWithNewUid = false;
1020 pasteContacts( listNew ); 1013 pasteContacts( listNew );
1021 pasteWithNewUid = true; 1014 pasteWithNewUid = true;
1022 } 1015 }
1023 } 1016 }
1024 delete idgl; 1017 delete idgl;
1025#endif 1018#endif
1026} 1019}
1027 1020
1028void KABCore::importVCard( const QString &vCard, bool showPreview ) 1021void KABCore::importVCard( const QString &vCard, bool showPreview )
1029{ 1022{
1030 mXXPortManager->importVCard( vCard, showPreview ); 1023 mXXPortManager->importVCard( vCard, showPreview );
1031} 1024}
1032 1025
1033//US added a second method without defaultparameter 1026//US added a second method without defaultparameter
1034void KABCore::editContact2() { 1027void KABCore::editContact2() {
1035 editContact( QString::null ); 1028 editContact( QString::null );
1036} 1029}
1037 1030
1038void KABCore::editContact( const QString &uid ) 1031void KABCore::editContact( const QString &uid )
1039{ 1032{
1040 1033
1041 if ( mExtensionManager->isQuickEditVisible() ) 1034 if ( mExtensionManager->isQuickEditVisible() )
1042 return; 1035 return;
1043 1036
1044 // First, locate the contact entry 1037 // First, locate the contact entry
1045 QString localUID = uid; 1038 QString localUID = uid;
1046 if ( localUID.isNull() ) { 1039 if ( localUID.isNull() ) {
1047 QStringList uidList = mViewManager->selectedUids(); 1040 QStringList uidList = mViewManager->selectedUids();
1048 if ( uidList.count() > 0 ) 1041 if ( uidList.count() > 0 )
1049 localUID = *( uidList.at( 0 ) ); 1042 localUID = *( uidList.at( 0 ) );
1050 } 1043 }
1051 1044
1052 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1045 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1053 if ( !addr.isEmpty() ) { 1046 if ( !addr.isEmpty() ) {
1054 mEditorDialog->setAddressee( addr ); 1047 mEditorDialog->setAddressee( addr );
1055 KApplication::execDialog ( mEditorDialog ); 1048 KApplication::execDialog ( mEditorDialog );
1056 } 1049 }
1057} 1050}
1058 1051
1059/** 1052/**
1060 Shows the detail view for the given uid. If the uid is QString::null, 1053 Shows or edits the detail view for the given uid. If the uid is QString::null,
1061 the method will try to find a selected addressee in the view. 1054 the method will try to find a selected addressee in the view.
1062 We call this method only if we use a small device. Bigger devices are calling editContact instead
1063 */ 1055 */
1064void KABCore::showContact( const QString &uid /*US = QString::null*/ ) 1056void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1065{ 1057{
1066 setDetailsVisible( true ); 1058 if ( mMultipleViewsAtOnce )
1067 mActionDetails->setChecked(true); 1059 {
1060 editContact( uid );
1061 }
1062 else
1063 {
1064 setDetailsVisible( true );
1065 mActionDetails->setChecked(true);
1066 }
1067
1068} 1068}
1069 1069
1070void KABCore::save() 1070void KABCore::save()
1071{ 1071{
1072 if ( !mModified ) 1072 if ( !mModified )
1073 return; 1073 return;
1074 QString text = i18n( "There was an error while attempting to save\n the " 1074 QString text = i18n( "There was an error while attempting to save\n the "
1075 "address book. Please check that some \nother application is " 1075 "address book. Please check that some \nother application is "
1076 "not using it. " ); 1076 "not using it. " );
1077 statusMessage(i18n("Saving addressbook ... ")); 1077 statusMessage(i18n("Saving addressbook ... "));
1078#ifndef KAB_EMBEDDED 1078#ifndef KAB_EMBEDDED
1079 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1079 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1080 if ( !b || !b->save() ) { 1080 if ( !b || !b->save() ) {
1081 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1081 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1082 } 1082 }
1083#else //KAB_EMBEDDED 1083#else //KAB_EMBEDDED
1084 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1084 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1085 if ( !b || !b->save() ) { 1085 if ( !b || !b->save() ) {
1086 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1086 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1087 } 1087 }
1088#endif //KAB_EMBEDDED 1088#endif //KAB_EMBEDDED
1089 1089
1090 statusMessage(i18n("Addressbook saved!")); 1090 statusMessage(i18n("Addressbook saved!"));
1091 setModified( false ); 1091 setModified( false );
1092} 1092}
1093 1093
1094void KABCore::statusMessage(QString mess , int time ) 1094void KABCore::statusMessage(QString mess , int time )
1095{ 1095{
1096 //topLevelWidget()->setCaption( mess ); 1096 //topLevelWidget()->setCaption( mess );
1097 // pending setting timer to revome message 1097 // pending setting timer to revome message
1098} 1098}
1099void KABCore::undo() 1099void KABCore::undo()
1100{ 1100{
1101 UndoStack::instance()->undo(); 1101 UndoStack::instance()->undo();
1102 1102
1103 // Refresh the view 1103 // Refresh the view
1104 mViewManager->refreshView(); 1104 mViewManager->refreshView();
1105} 1105}
1106 1106
1107void KABCore::redo() 1107void KABCore::redo()
1108{ 1108{
1109 RedoStack::instance()->redo(); 1109 RedoStack::instance()->redo();
1110 1110
1111 // Refresh the view 1111 // Refresh the view
1112 mViewManager->refreshView(); 1112 mViewManager->refreshView();
1113} 1113}
1114 1114
1115void KABCore::setJumpButtonBarVisible( bool visible ) 1115void KABCore::setJumpButtonBarVisible( bool visible )
1116{ 1116{
1117 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1117 if (mMultipleViewsAtOnce)
1118 {
1118 if ( visible ) 1119 if ( visible )
1119 mJumpButtonBar->show(); 1120 mJumpButtonBar->show();
1120 else 1121 else
1121 mJumpButtonBar->hide(); 1122 mJumpButtonBar->hide();
1122 } 1123 }
1123 else 1124 else
1124 { 1125 {
1125 // for the Z5500, show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1126 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1126 if (mViewManager->isVisible()) 1127 if (mViewManager->isVisible())
1127 { 1128 {
1128 if ( visible ) 1129 if ( visible )
1129 mJumpButtonBar->show(); 1130 mJumpButtonBar->show();
1130 else 1131 else
1131 mJumpButtonBar->hide(); 1132 mJumpButtonBar->hide();
1132 } 1133 }
1133 else 1134 else
1134 { 1135 {
1135 mJumpButtonBar->hide(); 1136 mJumpButtonBar->hide();
1136 } 1137 }
1137 } 1138 }
1138} 1139}
1140
1141
1139void KABCore::setDetailsToState() 1142void KABCore::setDetailsToState()
1140{ 1143{
1141 setDetailsVisible( mActionDetails->isChecked() ); 1144 setDetailsVisible( mActionDetails->isChecked() );
1142} 1145}
1143 1146
1144 1147
1145 1148
1146void KABCore::setDetailsVisible( bool visible ) 1149void KABCore::setDetailsVisible( bool visible )
1147{ 1150{
1148 //US "details visible" has two different meanings for small devices like the 5500 1151 if (visible && mDetails->isHidden())
1149 // compared with large devices like the c series. 1152 {
1153 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1154 if ( addrList.count() > 0 )
1155 mDetails->setAddressee( addrList[ 0 ] );
1156 }
1150 1157
1151 // small devices: mDetails is always visible. But we switch between 1158 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1152 // the listview and the detailview. We do that by changing the splitbar size. 1159 // the listview and the detailview. We do that by changing the splitbar size.
1153 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1160 if (mMultipleViewsAtOnce)
1161 {
1154 if ( visible ) 1162 if ( visible )
1155 mDetails->show(); 1163 mDetails->show();
1156 else 1164 else
1157 mDetails->hide(); 1165 mDetails->hide();
1158 } 1166 }
1159 else 1167 else
1160 { 1168 {
1161 if ( visible ) { 1169 if ( visible ) {
1162 mViewManager->hide(); 1170 mViewManager->hide();
1163 mDetails->show(); 1171 mDetails->show();
1164// mDetails->show();
1165 } 1172 }
1166 else { 1173 else {
1167 mViewManager->show(); 1174 mViewManager->show();
1168 mDetails->hide(); 1175 mDetails->hide();
1169 } 1176 }
1170 setJumpButtonBarVisible( !visible ); 1177 setJumpButtonBarVisible( !visible );
1178 }
1179
1180}
1181
1182void KABCore::extensionChanged( int id )
1183{
1184 //change the details view only for non desktop systems
1185#ifndef DESKTOP_VERSION
1186
1187 if (id == 0)
1188 {
1189 //the user disabled the extension.
1190
1191 if (mMultipleViewsAtOnce)
1192 { // enable detailsview again
1193 setDetailsVisible( true );
1194 mActionDetails->setChecked( true );
1195 }
1196 else
1197 { //go back to the listview
1198 setDetailsVisible( false );
1199 mActionDetails->setChecked( false );
1200 mActionDetails->setEnabled(true);
1201 }
1171 1202
1172 } 1203 }
1204 else
1205 {
1206 //the user enabled the extension.
1207 setDetailsVisible( false );
1208 mActionDetails->setChecked( false );
1209
1210 if (!mMultipleViewsAtOnce)
1211 {
1212 mActionDetails->setEnabled(false);
1213 }
1214
1215 mExtensionManager->setSelectionChanged();
1216
1217 }
1218
1219#endif// DESKTOP_VERSION
1220
1173} 1221}
1174 1222
1223
1175void KABCore::extensionModified( const KABC::Addressee::List &list ) 1224void KABCore::extensionModified( const KABC::Addressee::List &list )
1176{ 1225{
1177 1226
1178 if ( list.count() != 0 ) { 1227 if ( list.count() != 0 ) {
1179 KABC::Addressee::List::ConstIterator it; 1228 KABC::Addressee::List::ConstIterator it;
1180 for ( it = list.begin(); it != list.end(); ++it ) 1229 for ( it = list.begin(); it != list.end(); ++it )
1181 mAddressBook->insertAddressee( *it ); 1230 mAddressBook->insertAddressee( *it );
1182 if ( list.count() > 1 ) 1231 if ( list.count() > 1 )
1183 setModified(); 1232 setModified();
1184 else 1233 else
1185 setModifiedWOrefresh(); 1234 setModifiedWOrefresh();
1186 } 1235 }
1187 if ( list.count() == 0 ) 1236 if ( list.count() == 0 )
1188 mViewManager->refreshView(); 1237 mViewManager->refreshView();
1189 else 1238 else
1190 mViewManager->refreshView( list[ 0 ].uid() ); 1239 mViewManager->refreshView( list[ 0 ].uid() );
1191 1240
1192 1241
1193 1242
1194} 1243}
1195 1244
1196QString KABCore::getNameByPhone( const QString &phone ) 1245QString KABCore::getNameByPhone( const QString &phone )
1197{ 1246{
1198#ifndef KAB_EMBEDDED 1247#ifndef KAB_EMBEDDED
1199 QRegExp r( "[/*/-/ ]" ); 1248 QRegExp r( "[/*/-/ ]" );
1200 QString localPhone( phone ); 1249 QString localPhone( phone );
1201 1250
1202 bool found = false; 1251 bool found = false;
1203 QString ownerName = ""; 1252 QString ownerName = "";
1204 KABC::AddressBook::Iterator iter; 1253 KABC::AddressBook::Iterator iter;
1205 KABC::PhoneNumber::List::Iterator phoneIter; 1254 KABC::PhoneNumber::List::Iterator phoneIter;
1206 KABC::PhoneNumber::List phoneList; 1255 KABC::PhoneNumber::List phoneList;
1207 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1256 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1208 phoneList = (*iter).phoneNumbers(); 1257 phoneList = (*iter).phoneNumbers();
1209 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1258 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1210 ++phoneIter) { 1259 ++phoneIter) {
1211 // Get rid of separator chars so just the numbers are compared. 1260 // Get rid of separator chars so just the numbers are compared.
1212 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1261 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1213 ownerName = (*iter).formattedName(); 1262 ownerName = (*iter).formattedName();
1214 found = true; 1263 found = true;
1215 } 1264 }
1216 } 1265 }
1217 } 1266 }
1218 1267
1219 return ownerName; 1268 return ownerName;
1220#else //KAB_EMBEDDED 1269#else //KAB_EMBEDDED
1221 qDebug("KABCore::getNameByPhone finsih method"); 1270 qDebug("KABCore::getNameByPhone finsih method");
1222 return ""; 1271 return "";
1223#endif //KAB_EMBEDDED 1272#endif //KAB_EMBEDDED
1224 1273
1225} 1274}
1226 1275
1227void KABCore::openConfigDialog() 1276void KABCore::openConfigDialog()
1228{ 1277{
1229 KABPrefs* kab_prefs = KABPrefs::instance(); 1278 KABPrefs* kab_prefs = KABPrefs::instance();
1230 KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); 1279 KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance();
1231 1280
1232 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1281 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1233 KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1282 KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1234 ConfigureDialog->addModule(kabcfg ); 1283 ConfigureDialog->addModule(kabcfg );
1235 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1284 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1236 ConfigureDialog->addModule(kdelibcfg ); 1285 ConfigureDialog->addModule(kdelibcfg );
1237 1286
1238 1287
1239 1288
1240 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1289 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1241 this, SLOT( configurationChanged() ) ); 1290 this, SLOT( configurationChanged() ) );
1242 connect( ConfigureDialog, SIGNAL( okClicked() ), 1291 connect( ConfigureDialog, SIGNAL( okClicked() ),
1243 this, SLOT( configurationChanged() ) ); 1292 this, SLOT( configurationChanged() ) );
1244 saveSettings(); 1293 saveSettings();
1245 ConfigureDialog->showMaximized(); 1294 ConfigureDialog->showMaximized();
1246 if ( ConfigureDialog->exec() ) 1295 if ( ConfigureDialog->exec() )
1247 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1296 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1248 delete ConfigureDialog; 1297 delete ConfigureDialog;
1249} 1298}
1250 1299
1251void KABCore::openLDAPDialog() 1300void KABCore::openLDAPDialog()
1252{ 1301{
1253#ifndef KAB_EMBEDDED 1302#ifndef KAB_EMBEDDED
1254 if ( !mLdapSearchDialog ) { 1303 if ( !mLdapSearchDialog ) {
1255 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1304 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1256 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1305 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1257 SLOT( refreshView() ) ); 1306 SLOT( refreshView() ) );
1258 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1307 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1259 SLOT( setModified() ) ); 1308 SLOT( setModified() ) );
1260 } else 1309 } else
1261 mLdapSearchDialog->restoreSettings(); 1310 mLdapSearchDialog->restoreSettings();
1262 1311
1263 if ( mLdapSearchDialog->isOK() ) 1312 if ( mLdapSearchDialog->isOK() )
1264 mLdapSearchDialog->exec(); 1313 mLdapSearchDialog->exec();
1265#else //KAB_EMBEDDED 1314#else //KAB_EMBEDDED
1266 qDebug("KABCore::openLDAPDialog() finsih method"); 1315 qDebug("KABCore::openLDAPDialog() finsih method");
1267#endif //KAB_EMBEDDED 1316#endif //KAB_EMBEDDED
1268} 1317}
1269 1318
1270void KABCore::print() 1319void KABCore::print()
1271{ 1320{
1272#ifndef KAB_EMBEDDED 1321#ifndef KAB_EMBEDDED
1273 KPrinter printer; 1322 KPrinter printer;
1274 if ( !printer.setup( this ) ) 1323 if ( !printer.setup( this ) )
1275 return; 1324 return;
1276 1325
1277 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1326 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1278 mViewManager->selectedUids(), this ); 1327 mViewManager->selectedUids(), this );
1279 1328
1280 wizard.exec(); 1329 wizard.exec();
1281#else //KAB_EMBEDDED 1330#else //KAB_EMBEDDED
1282 qDebug("KABCore::print() finsih method"); 1331 qDebug("KABCore::print() finsih method");
1283#endif //KAB_EMBEDDED 1332#endif //KAB_EMBEDDED
1284 1333
1285} 1334}
1286 1335
1287 1336
1288void KABCore::addGUIClient( KXMLGUIClient *client ) 1337void KABCore::addGUIClient( KXMLGUIClient *client )
1289{ 1338{
1290 if ( mGUIClient ) 1339 if ( mGUIClient )
1291 mGUIClient->insertChildClient( client ); 1340 mGUIClient->insertChildClient( client );
1292 else 1341 else
1293 KMessageBox::error( this, "no KXMLGUICLient"); 1342 KMessageBox::error( this, "no KXMLGUICLient");
1294} 1343}
1295 1344
@@ -1700,145 +1749,148 @@ void KABCore::addActionsManually()
1700 1749
1701#ifdef DESKTOP_VERSION 1750#ifdef DESKTOP_VERSION
1702 QMenuBar* mb = mMainWindow->menuBar(); 1751 QMenuBar* mb = mMainWindow->menuBar();
1703 1752
1704 //US setup menubar. 1753 //US setup menubar.
1705 //Disable the following block if you do not want to have a menubar. 1754 //Disable the following block if you do not want to have a menubar.
1706 mb->insertItem( "&File", fileMenu ); 1755 mb->insertItem( "&File", fileMenu );
1707 mb->insertItem( "&Edit", editMenu ); 1756 mb->insertItem( "&Edit", editMenu );
1708 mb->insertItem( "&View", viewMenu ); 1757 mb->insertItem( "&View", viewMenu );
1709 mb->insertItem( "&Settings", settingsMenu ); 1758 mb->insertItem( "&Settings", settingsMenu );
1710 mb->insertItem( "&Change selected", changeMenu ); 1759 mb->insertItem( "&Change selected", changeMenu );
1711 mb->insertItem( "&Help", helpMenu ); 1760 mb->insertItem( "&Help", helpMenu );
1712 mIncSearchWidget = new IncSearchWidget( tb ); 1761 mIncSearchWidget = new IncSearchWidget( tb );
1713 // tb->insertWidget(-1, 0, mIncSearchWidget); 1762 // tb->insertWidget(-1, 0, mIncSearchWidget);
1714 1763
1715#else 1764#else
1716 //US setup toolbar 1765 //US setup toolbar
1717 QMenuBar *menuBarTB = new QMenuBar( tb ); 1766 QMenuBar *menuBarTB = new QMenuBar( tb );
1718 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1767 QPopupMenu *popupBarTB = new QPopupMenu( this );
1719 menuBarTB->insertItem( "ME", popupBarTB); 1768 menuBarTB->insertItem( "ME", popupBarTB);
1720 tb->insertWidget(-1, 0, menuBarTB); 1769 tb->insertWidget(-1, 0, menuBarTB);
1721 mIncSearchWidget = new IncSearchWidget( tb ); 1770 mIncSearchWidget = new IncSearchWidget( tb );
1722 1771
1723 tb->enableMoving(false); 1772 tb->enableMoving(false);
1724 popupBarTB->insertItem( "&File", fileMenu ); 1773 popupBarTB->insertItem( "&File", fileMenu );
1725 popupBarTB->insertItem( "&Edit", editMenu ); 1774 popupBarTB->insertItem( "&Edit", editMenu );
1726 popupBarTB->insertItem( "&View", viewMenu ); 1775 popupBarTB->insertItem( "&View", viewMenu );
1727 popupBarTB->insertItem( "&Settings", settingsMenu ); 1776 popupBarTB->insertItem( "&Settings", settingsMenu );
1728 mViewManager->getFilterAction()->plug ( popupBarTB); 1777 mViewManager->getFilterAction()->plug ( popupBarTB);
1729 popupBarTB->insertItem( "&Change selected", changeMenu ); 1778 popupBarTB->insertItem( "&Change selected", changeMenu );
1730 popupBarTB->insertItem( "&Help", helpMenu ); 1779 popupBarTB->insertItem( "&Help", helpMenu );
1731 if (QApplication::desktop()->width() > 320 ) { 1780 if (QApplication::desktop()->width() > 320 ) {
1732 // mViewManager->getFilterAction()->plug ( tb); 1781 // mViewManager->getFilterAction()->plug ( tb);
1733 } 1782 }
1734#endif 1783#endif
1735 // mActionQuit->plug ( mMainWindow->toolBar()); 1784 // mActionQuit->plug ( mMainWindow->toolBar());
1736 1785
1737 1786
1738 1787
1739 //US Now connect the actions with the menue entries. 1788 //US Now connect the actions with the menue entries.
1740 mActionPrint->plug( fileMenu ); 1789 mActionPrint->plug( fileMenu );
1741 mActionMail->plug( fileMenu ); 1790 mActionMail->plug( fileMenu );
1742 fileMenu->insertSeparator(); 1791 fileMenu->insertSeparator();
1743 1792
1744 mActionNewContact->plug( fileMenu ); 1793 mActionNewContact->plug( fileMenu );
1745 mActionNewContact->plug( tb ); 1794 mActionNewContact->plug( tb );
1746 1795
1747 mActionEditAddressee->plug( fileMenu ); 1796 mActionEditAddressee->plug( fileMenu );
1748 mActionEditAddressee->plug( tb ); 1797 if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1798 (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1799 mActionEditAddressee->plug( tb );
1800
1749 fileMenu->insertSeparator(); 1801 fileMenu->insertSeparator();
1750 mActionSave->plug( fileMenu ); 1802 mActionSave->plug( fileMenu );
1751 fileMenu->insertItem( "&Import", ImportMenu ); 1803 fileMenu->insertItem( "&Import", ImportMenu );
1752 fileMenu->insertItem( "&Emport", ExportMenu ); 1804 fileMenu->insertItem( "&Emport", ExportMenu );
1753 fileMenu->insertSeparator(); 1805 fileMenu->insertSeparator();
1754 mActionMailVCard->plug( fileMenu ); 1806 mActionMailVCard->plug( fileMenu );
1755#ifndef DESKTOP_VERSION 1807#ifndef DESKTOP_VERSION
1756 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1808 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1757 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1809 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1758#endif 1810#endif
1759 fileMenu->insertSeparator(); 1811 fileMenu->insertSeparator();
1760 mActionQuit->plug( fileMenu ); 1812 mActionQuit->plug( fileMenu );
1761#ifdef _WIN32_ 1813#ifdef _WIN32_
1762 mActionImportOL->plug( ImportMenu ); 1814 mActionImportOL->plug( ImportMenu );
1763#endif 1815#endif
1764 // edit menu 1816 // edit menu
1765 mActionUndo->plug( editMenu ); 1817 mActionUndo->plug( editMenu );
1766 mActionRedo->plug( editMenu ); 1818 mActionRedo->plug( editMenu );
1767 editMenu->insertSeparator(); 1819 editMenu->insertSeparator();
1768 mActionCut->plug( editMenu ); 1820 mActionCut->plug( editMenu );
1769 mActionCopy->plug( editMenu ); 1821 mActionCopy->plug( editMenu );
1770 mActionPaste->plug( editMenu ); 1822 mActionPaste->plug( editMenu );
1771 mActionDelete->plug( editMenu ); 1823 mActionDelete->plug( editMenu );
1772 editMenu->insertSeparator(); 1824 editMenu->insertSeparator();
1773 mActionSelectAll->plug( editMenu ); 1825 mActionSelectAll->plug( editMenu );
1774 1826
1775 mActionRemoveVoice->plug( changeMenu ); 1827 mActionRemoveVoice->plug( changeMenu );
1776 // settings menu 1828 // settings menu
1777//US special menuentry to configure the addressbook resources. On KDE 1829//US special menuentry to configure the addressbook resources. On KDE
1778// you do that through the control center !!! 1830// you do that through the control center !!!
1779 mActionConfigResources->plug( settingsMenu ); 1831 mActionConfigResources->plug( settingsMenu );
1780 settingsMenu->insertSeparator(); 1832 settingsMenu->insertSeparator();
1781 1833
1782 mActionConfigKAddressbook->plug( settingsMenu ); 1834 mActionConfigKAddressbook->plug( settingsMenu );
1783 1835
1784 if ( mIsPart ) { 1836 if ( mIsPart ) {
1785 mActionConfigShortcuts->plug( settingsMenu ); 1837 mActionConfigShortcuts->plug( settingsMenu );
1786 mActionConfigureToolbars->plug( settingsMenu ); 1838 mActionConfigureToolbars->plug( settingsMenu );
1787 1839
1788 } else { 1840 } else {
1789 mActionKeyBindings->plug( settingsMenu ); 1841 mActionKeyBindings->plug( settingsMenu );
1790 } 1842 }
1791 1843
1792 settingsMenu->insertSeparator(); 1844 settingsMenu->insertSeparator();
1793 1845
1794 mActionJumpBar->plug( settingsMenu ); 1846 mActionJumpBar->plug( settingsMenu );
1795 mActionDetails->plug( settingsMenu ); 1847 mActionDetails->plug( settingsMenu );
1796 if (KGlobal::getDesktopSize() == KGlobal::Small ) 1848 if (!KABPrefs::instance()->mMultipleViewsAtOnce )
1797 mActionDetails->plug( tb ); 1849 mActionDetails->plug( tb );
1798 settingsMenu->insertSeparator(); 1850 settingsMenu->insertSeparator();
1799 1851
1800 mActionWhoAmI->plug( settingsMenu ); 1852 mActionWhoAmI->plug( settingsMenu );
1801 mActionCategories->plug( settingsMenu ); 1853 mActionCategories->plug( settingsMenu );
1802 1854
1803 mActionAboutKAddressbook->plug( helpMenu ); 1855 mActionAboutKAddressbook->plug( helpMenu );
1804 mActionLicence->plug( helpMenu ); 1856 mActionLicence->plug( helpMenu );
1805 1857
1806 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1858 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1807 1859
1808 mActionSave->plug( tb ); 1860 mActionSave->plug( tb );
1809 mViewManager->getFilterAction()->plug ( tb); 1861 mViewManager->getFilterAction()->plug ( tb);
1810 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 1862 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1811 mActionUndo->plug( tb ); 1863 mActionUndo->plug( tb );
1812 mActionDelete->plug( tb ); 1864 mActionDelete->plug( tb );
1813 mActionRedo->plug( tb ); 1865 mActionRedo->plug( tb );
1814 } 1866 }
1815 } 1867 }
1816 //mActionQuit->plug ( tb ); 1868 //mActionQuit->plug ( tb );
1817 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1869 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1818 1870
1819 //US link the searchwidget first to this. 1871 //US link the searchwidget first to this.
1820 // The real linkage to the toolbar happens later. 1872 // The real linkage to the toolbar happens later.
1821//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1873//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1822//US tb->insertItem( mIncSearchWidget ); 1874//US tb->insertItem( mIncSearchWidget );
1823/*US 1875/*US
1824 mIncSearchWidget = new IncSearchWidget( tb ); 1876 mIncSearchWidget = new IncSearchWidget( tb );
1825 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1877 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1826 SLOT( incrementalSearch( const QString& ) ) ); 1878 SLOT( incrementalSearch( const QString& ) ) );
1827 1879
1828 mJumpButtonBar = new JumpButtonBar( this, this ); 1880 mJumpButtonBar = new JumpButtonBar( this, this );
1829 1881
1830//US topLayout->addWidget( mJumpButtonBar ); 1882//US topLayout->addWidget( mJumpButtonBar );
1831 this->layout()->add( mJumpButtonBar ); 1883 this->layout()->add( mJumpButtonBar );
1832*/ 1884*/
1833 1885
1834#endif //KAB_EMBEDDED 1886#endif //KAB_EMBEDDED
1835} 1887}
1836void KABCore::showLicence() 1888void KABCore::showLicence()
1837{ 1889{
1838 KApplication::showLicence(); 1890 KApplication::showLicence();
1839} 1891}
1840void KABCore::removeVoice() 1892void KABCore::removeVoice()
1841{ 1893{
1842 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 ) 1894 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 )
1843 return; 1895 return;
1844 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1896 KABC::Addressee::List list = mViewManager->selectedAddressees();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index a45c4c6..d4d28f1 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -257,175 +257,178 @@ class KABCore : public QWidget
257 257
258 /** 258 /**
259 Returns whether the address book is modified. 259 Returns whether the address book is modified.
260 */ 260 */
261 bool modified() const; 261 bool modified() const;
262 262
263 /** 263 /**
264 Called whenever an contact is modified in the contact editor 264 Called whenever an contact is modified in the contact editor
265 dialog or the quick edit. 265 dialog or the quick edit.
266 */ 266 */
267 void contactModified( const KABC::Addressee &addr ); 267 void contactModified( const KABC::Addressee &addr );
268 268
269 /** 269 /**
270 DCOP METHODS. 270 DCOP METHODS.
271 */ 271 */
272 void addEmail( QString addr ); 272 void addEmail( QString addr );
273 void importVCard( const KURL& url, bool showPreview ); 273 void importVCard( const KURL& url, bool showPreview );
274 void importVCard( const QString& vCard, bool showPreview ); 274 void importVCard( const QString& vCard, bool showPreview );
275 void newContact(); 275 void newContact();
276 QString getNameByPhone( const QString& phone ); 276 QString getNameByPhone( const QString& phone );
277 /** 277 /**
278 END DCOP METHODS 278 END DCOP METHODS
279 */ 279 */
280 280
281 /** 281 /**
282 Saves the contents of the AddressBook back to disk. 282 Saves the contents of the AddressBook back to disk.
283 */ 283 */
284 void save(); 284 void save();
285 285
286 /** 286 /**
287 Undos the last command using the undo stack. 287 Undos the last command using the undo stack.
288 */ 288 */
289 void undo(); 289 void undo();
290 290
291 /** 291 /**
292 Redos the last command that was undone, using the redo stack. 292 Redos the last command that was undone, using the redo stack.
293 */ 293 */
294 void redo(); 294 void redo();
295 295
296 /** 296 /**
297 Shows the edit dialog for the given uid. If the uid is QString::null, 297 Shows the edit dialog for the given uid. If the uid is QString::null,
298 the method will try to find a selected addressee in the view. 298 the method will try to find a selected addressee in the view.
299 */ 299 */
300 void editContact( const QString &uid /*US = QString::null*/ ); 300 void editContact( const QString &uid /*US = QString::null*/ );
301//US added a second method without defaultparameter 301//US added a second method without defaultparameter
302 void editContact2(); 302 void editContact2();
303 303
304 /** 304 /**
305 Shows the detail view for the given uid. If the uid is QString::null, 305 Shows or edits the detail view for the given uid. If the uid is QString::null,
306 the method will try to find a selected addressee in the view. 306 the method will try to find a selected addressee in the view.
307 */ 307 */
308 void showContact( const QString &uid /*US = QString::null*/ ); 308 void executeContact( const QString &uid /*US = QString::null*/ );
309 309
310 /** 310 /**
311 Launches the configuration dialog. 311 Launches the configuration dialog.
312 */ 312 */
313 void openConfigDialog(); 313 void openConfigDialog();
314 314
315 /** 315 /**
316 Launches the ldap search dialog. 316 Launches the ldap search dialog.
317 */ 317 */
318 void openLDAPDialog(); 318 void openLDAPDialog();
319 319
320 /** 320 /**
321 Creates a KAddressBookPrinter, which will display the print 321 Creates a KAddressBookPrinter, which will display the print
322 dialog and do the printing. 322 dialog and do the printing.
323 */ 323 */
324 void print(); 324 void print();
325 325
326 /** 326 /**
327 Registers a new GUI client, so plugins can register its actions. 327 Registers a new GUI client, so plugins can register its actions.
328 */ 328 */
329 void addGUIClient( KXMLGUIClient *client ); 329 void addGUIClient( KXMLGUIClient *client );
330 330
331 signals: 331 signals:
332 void contactSelected( const QString &name ); 332 void contactSelected( const QString &name );
333 void contactSelected( const QPixmap &pixmap ); 333 void contactSelected( const QPixmap &pixmap );
334 public slots: 334 public slots:
335 void setDetailsVisible( bool visible ); 335 void setDetailsVisible( bool visible );
336 void setDetailsToState(); 336 void setDetailsToState();
337 private slots: 337 private slots:
338 void setJumpButtonBarVisible( bool visible ); 338 void setJumpButtonBarVisible( bool visible );
339 void importFromOL(); 339 void importFromOL();
340 void extensionModified( const KABC::Addressee::List &list ); 340 void extensionModified( const KABC::Addressee::List &list );
341 void extensionChanged( int id );
341 void clipboardDataChanged(); 342 void clipboardDataChanged();
342 void updateActionMenu(); 343 void updateActionMenu();
343 void configureKeyBindings(); 344 void configureKeyBindings();
344 void removeVoice(); 345 void removeVoice();
345#ifdef KAB_EMBEDDED 346#ifdef KAB_EMBEDDED
346 void configureResources(); 347 void configureResources();
347#endif //KAB_EMBEDDED 348#endif //KAB_EMBEDDED
348 349
349 void slotEditorDestroyed( const QString &uid ); 350 void slotEditorDestroyed( const QString &uid );
350 void configurationChanged(); 351 void configurationChanged();
351 void addressBookChanged(); 352 void addressBookChanged();
352 353
353 private: 354 private:
354 void initGUI(); 355 void initGUI();
355 void initActions(); 356 void initActions();
356 357
357 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 358 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
358 const char *name = 0 ); 359 const char *name = 0 );
359 360
360 KXMLGUIClient *mGUIClient; 361 KXMLGUIClient *mGUIClient;
361 362
362 KABC::AddressBook *mAddressBook; 363 KABC::AddressBook *mAddressBook;
363 364
364 ViewManager *mViewManager; 365 ViewManager *mViewManager;
365 // QSplitter *mDetailsSplitter; 366 // QSplitter *mDetailsSplitter;
366 KDGanttMinimizeSplitter *mExtensionBarSplitter; 367 KDGanttMinimizeSplitter *mExtensionBarSplitter;
367 ViewContainer *mDetails; 368 ViewContainer *mDetails;
368 KDGanttMinimizeSplitter* mMiniSplitter; 369 KDGanttMinimizeSplitter* mMiniSplitter;
369 XXPortManager *mXXPortManager; 370 XXPortManager *mXXPortManager;
370 JumpButtonBar *mJumpButtonBar; 371 JumpButtonBar *mJumpButtonBar;
371 IncSearchWidget *mIncSearchWidget; 372 IncSearchWidget *mIncSearchWidget;
372 ExtensionManager *mExtensionManager; 373 ExtensionManager *mExtensionManager;
373 374
374 KCMultiDialog *mConfigureDialog; 375 KCMultiDialog *mConfigureDialog;
375 376
376#ifndef KAB_EMBEDDED 377#ifndef KAB_EMBEDDED
377 LDAPSearchDialog *mLdapSearchDialog; 378 LDAPSearchDialog *mLdapSearchDialog;
378#endif //KAB_EMBEDDED 379#endif //KAB_EMBEDDED
379 // QDict<AddresseeEditorDialog> mEditorDict; 380 // QDict<AddresseeEditorDialog> mEditorDict;
380 AddresseeEditorDialog *mEditorDialog; 381 AddresseeEditorDialog *mEditorDialog;
381 bool mReadWrite; 382 bool mReadWrite;
382 bool mModified; 383 bool mModified;
383 bool mIsPart; 384 bool mIsPart;
385 bool mMultipleViewsAtOnce;
386
384 387
385 //US file menu 388 //US file menu
386 KAction *mActionMail; 389 KAction *mActionMail;
387 KAction *mActionBeam; 390 KAction *mActionBeam;
388 KAction* mActionPrint; 391 KAction* mActionPrint;
389 KAction* mActionNewContact; 392 KAction* mActionNewContact;
390 KAction *mActionSave; 393 KAction *mActionSave;
391 KAction *mActionEditAddressee; 394 KAction *mActionEditAddressee;
392 KAction *mActionMailVCard; 395 KAction *mActionMailVCard;
393 KAction *mActionBeamVCard; 396 KAction *mActionBeamVCard;
394 397
395 KAction *mActionQuit; 398 KAction *mActionQuit;
396 399
397 //US edit menu 400 //US edit menu
398 KAction *mActionCopy; 401 KAction *mActionCopy;
399 KAction *mActionCut; 402 KAction *mActionCut;
400 KAction *mActionPaste; 403 KAction *mActionPaste;
401 KAction *mActionSelectAll; 404 KAction *mActionSelectAll;
402 KAction *mActionUndo; 405 KAction *mActionUndo;
403 KAction *mActionRedo; 406 KAction *mActionRedo;
404 KAction *mActionDelete; 407 KAction *mActionDelete;
405 408
406 //US settings menu 409 //US settings menu
407 KAction *mActionConfigResources; 410 KAction *mActionConfigResources;
408 KAction *mActionConfigKAddressbook; 411 KAction *mActionConfigKAddressbook;
409 KAction *mActionConfigShortcuts; 412 KAction *mActionConfigShortcuts;
410 KAction *mActionConfigureToolbars; 413 KAction *mActionConfigureToolbars;
411 KAction *mActionKeyBindings; 414 KAction *mActionKeyBindings;
412 KToggleAction *mActionJumpBar; 415 KToggleAction *mActionJumpBar;
413 KToggleAction *mActionDetails; 416 KToggleAction *mActionDetails;
414 KAction *mActionWhoAmI; 417 KAction *mActionWhoAmI;
415 KAction *mActionCategories; 418 KAction *mActionCategories;
416 KAction *mActionAboutKAddressbook; 419 KAction *mActionAboutKAddressbook;
417 KAction *mActionLicence; 420 KAction *mActionLicence;
418 421
419 KAction *mActionDeleteView; 422 KAction *mActionDeleteView;
420 423
421 QPopupMenu *viewMenu; 424 QPopupMenu *viewMenu;
422 QPopupMenu *filterMenu; 425 QPopupMenu *filterMenu;
423 QPopupMenu *settingsMenu; 426 QPopupMenu *settingsMenu;
424 QPopupMenu *changeMenu; 427 QPopupMenu *changeMenu;
425 428
426//US QAction *mActionSave; 429//US QAction *mActionSave;
427 QPopupMenu *ImportMenu; 430 QPopupMenu *ImportMenu;
428 QPopupMenu *ExportMenu; 431 QPopupMenu *ExportMenu;
429 //LR additional methods 432 //LR additional methods
430 KAction *mActionRemoveVoice; 433 KAction *mActionRemoveVoice;
431 KAction * mActionImportOL; 434 KAction * mActionImportOL;