summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp54
-rw-r--r--kaddressbook/kabcore.h5
2 files changed, 57 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e6bdde9..2c2f1a0 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1855,57 +1855,65 @@ void KABCore::initActions()
1855 1855
1856 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1856 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1857 SLOT( toggleBeamReceive() ), actionCollection(), 1857 SLOT( toggleBeamReceive() ), actionCollection(),
1858 "kaddressbook_beam_rec" ); 1858 "kaddressbook_beam_rec" );
1859 1859
1860 1860
1861 // misc 1861 // misc
1862 // only enable LDAP lookup if we can handle the protocol 1862 // only enable LDAP lookup if we can handle the protocol
1863#ifndef KAB_EMBEDDED 1863#ifndef KAB_EMBEDDED
1864 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1864 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1865 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1865 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1866 this, SLOT( openLDAPDialog() ), actionCollection(), 1866 this, SLOT( openLDAPDialog() ), actionCollection(),
1867 "ldap_lookup" ); 1867 "ldap_lookup" );
1868 } 1868 }
1869#else //KAB_EMBEDDED 1869#else //KAB_EMBEDDED
1870 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1870 //qDebug("KABCore::initActions() LDAP has to be implemented");
1871#endif //KAB_EMBEDDED 1871#endif //KAB_EMBEDDED
1872 1872
1873 1873
1874 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1874 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1875 SLOT( setWhoAmI() ), actionCollection(), 1875 SLOT( setWhoAmI() ), actionCollection(),
1876 "set_personal" ); 1876 "set_personal" );
1877 1877
1878 1878
1879
1880
1881 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1879 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1882 SLOT( setCategories() ), actionCollection(), 1880 SLOT( setCategories() ), actionCollection(),
1883 "edit_set_categories" ); 1881 "edit_set_categories" );
1884 1882
1885 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1883 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1886 SLOT( removeVoice() ), actionCollection(), 1884 SLOT( removeVoice() ), actionCollection(),
1887 "remove_voice" ); 1885 "remove_voice" );
1886
1887 mActionSetCat= new KAction( i18n( "Set categories..." ), 0, this,
1888 SLOT( setCat() ), actionCollection(),
1889 "remove_voice" );
1890
1891
1892 mActionAddCat= new KAction( i18n( "Add categories..." ), 0, this,
1893 SLOT( addCat() ), actionCollection(),
1894 "remove_voice" );
1895
1888 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1896 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1889 SLOT( importFromOL() ), actionCollection(), 1897 SLOT( importFromOL() ), actionCollection(),
1890 "import_OL" ); 1898 "import_OL" );
1891#ifdef KAB_EMBEDDED 1899#ifdef KAB_EMBEDDED
1892 mActionLicence = new KAction( i18n( "Licence" ), 0, 1900 mActionLicence = new KAction( i18n( "Licence" ), 0,
1893 this, SLOT( showLicence() ), actionCollection(), 1901 this, SLOT( showLicence() ), actionCollection(),
1894 "licence_about_data" ); 1902 "licence_about_data" );
1895 mActionFaq = new KAction( i18n( "Faq" ), 0, 1903 mActionFaq = new KAction( i18n( "Faq" ), 0,
1896 this, SLOT( faq() ), actionCollection(), 1904 this, SLOT( faq() ), actionCollection(),
1897 "faq_about_data" ); 1905 "faq_about_data" );
1898 mActionWN = new KAction( i18n( "What's New?" ), 0, 1906 mActionWN = new KAction( i18n( "What's New?" ), 0,
1899 this, SLOT( whatsnew() ), actionCollection(), 1907 this, SLOT( whatsnew() ), actionCollection(),
1900 "wn" ); 1908 "wn" );
1901 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1909 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1902 this, SLOT( synchowto() ), actionCollection(), 1910 this, SLOT( synchowto() ), actionCollection(),
1903 "sync" ); 1911 "sync" );
1904 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 1912 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1905 this, SLOT( kdesynchowto() ), actionCollection(), 1913 this, SLOT( kdesynchowto() ), actionCollection(),
1906 "kdesync" ); 1914 "kdesync" );
1907 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 1915 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1908 this, SLOT( multisynchowto() ), actionCollection(), 1916 this, SLOT( multisynchowto() ), actionCollection(),
1909 "multisync" ); 1917 "multisync" );
1910 1918
1911 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1919 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
@@ -1993,48 +2001,50 @@ void KABCore::addActionsManually()
1993 fileMenu->insertItem( "&Export", ExportMenu ); 2001 fileMenu->insertItem( "&Export", ExportMenu );
1994 fileMenu->insertSeparator(); 2002 fileMenu->insertSeparator();
1995 mActionMailVCard->plug( fileMenu ); 2003 mActionMailVCard->plug( fileMenu );
1996#ifndef DESKTOP_VERSION 2004#ifndef DESKTOP_VERSION
1997 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2005 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1998 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2006 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1999#endif 2007#endif
2000 fileMenu->insertSeparator(); 2008 fileMenu->insertSeparator();
2001 mActionQuit->plug( fileMenu ); 2009 mActionQuit->plug( fileMenu );
2002#ifdef _WIN32_ 2010#ifdef _WIN32_
2003 mActionImportOL->plug( ImportMenu ); 2011 mActionImportOL->plug( ImportMenu );
2004#endif 2012#endif
2005 // edit menu 2013 // edit menu
2006 mActionUndo->plug( editMenu ); 2014 mActionUndo->plug( editMenu );
2007 mActionRedo->plug( editMenu ); 2015 mActionRedo->plug( editMenu );
2008 editMenu->insertSeparator(); 2016 editMenu->insertSeparator();
2009 mActionCut->plug( editMenu ); 2017 mActionCut->plug( editMenu );
2010 mActionCopy->plug( editMenu ); 2018 mActionCopy->plug( editMenu );
2011 mActionPaste->plug( editMenu ); 2019 mActionPaste->plug( editMenu );
2012 mActionDelete->plug( editMenu ); 2020 mActionDelete->plug( editMenu );
2013 editMenu->insertSeparator(); 2021 editMenu->insertSeparator();
2014 mActionSelectAll->plug( editMenu ); 2022 mActionSelectAll->plug( editMenu );
2015 2023
2016 mActionRemoveVoice->plug( changeMenu ); 2024 mActionRemoveVoice->plug( changeMenu );
2025 mActionSetCat->plug( changeMenu );
2026 mActionAddCat->plug( changeMenu );
2017 // settings menu 2027 // settings menu
2018//US special menuentry to configure the addressbook resources. On KDE 2028//US special menuentry to configure the addressbook resources. On KDE
2019// you do that through the control center !!! 2029// you do that through the control center !!!
2020 mActionConfigResources->plug( settingsMenu ); 2030 mActionConfigResources->plug( settingsMenu );
2021 settingsMenu->insertSeparator(); 2031 settingsMenu->insertSeparator();
2022 2032
2023 mActionConfigKAddressbook->plug( settingsMenu ); 2033 mActionConfigKAddressbook->plug( settingsMenu );
2024 2034
2025 if ( mIsPart ) { 2035 if ( mIsPart ) {
2026 //US not implemented yet 2036 //US not implemented yet
2027 //mActionConfigShortcuts->plug( settingsMenu ); 2037 //mActionConfigShortcuts->plug( settingsMenu );
2028 //mActionConfigureToolbars->plug( settingsMenu ); 2038 //mActionConfigureToolbars->plug( settingsMenu );
2029 2039
2030 } else { 2040 } else {
2031 //US not implemented yet 2041 //US not implemented yet
2032 //mActionKeyBindings->plug( settingsMenu ); 2042 //mActionKeyBindings->plug( settingsMenu );
2033 } 2043 }
2034 2044
2035 settingsMenu->insertSeparator(); 2045 settingsMenu->insertSeparator();
2036 2046
2037 mActionJumpBar->plug( settingsMenu ); 2047 mActionJumpBar->plug( settingsMenu );
2038 mActionDetails->plug( settingsMenu ); 2048 mActionDetails->plug( settingsMenu );
2039 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2049 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2040 mActionDetails->plug( tb ); 2050 mActionDetails->plug( tb );
@@ -2075,48 +2085,88 @@ void KABCore::addActionsManually()
2075//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2085//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2076//US tb->insertItem( mIncSearchWidget ); 2086//US tb->insertItem( mIncSearchWidget );
2077/*US 2087/*US
2078 mIncSearchWidget = new IncSearchWidget( tb ); 2088 mIncSearchWidget = new IncSearchWidget( tb );
2079 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2089 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2080 SLOT( incrementalSearch( const QString& ) ) ); 2090 SLOT( incrementalSearch( const QString& ) ) );
2081 2091
2082 mJumpButtonBar = new JumpButtonBar( this, this ); 2092 mJumpButtonBar = new JumpButtonBar( this, this );
2083 2093
2084//US topLayout->addWidget( mJumpButtonBar ); 2094//US topLayout->addWidget( mJumpButtonBar );
2085 this->layout()->add( mJumpButtonBar ); 2095 this->layout()->add( mJumpButtonBar );
2086*/ 2096*/
2087 2097
2088#endif //KAB_EMBEDDED 2098#endif //KAB_EMBEDDED
2089 2099
2090 mActionExport2phone->plug( ExportMenu ); 2100 mActionExport2phone->plug( ExportMenu );
2091 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2101 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2092 syncManager->fillSyncMenu(); 2102 syncManager->fillSyncMenu();
2093 2103
2094} 2104}
2095void KABCore::showLicence() 2105void KABCore::showLicence()
2096{ 2106{
2097 KApplication::showLicence(); 2107 KApplication::showLicence();
2098} 2108}
2109void KABCore::setCat()
2110{
2111 setCategories( true );
2112}
2113void KABCore::addCat()
2114{
2115 setCategories( false );
2116}
2117void KABCore::setCategories( bool removeOld )
2118{
2119 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KABPrefs::instance(), 0 );
2120 if (! csd->exec()) {
2121 message( i18n("Setting categories cancelled") );
2122 delete csd;
2123 return;
2124 }
2125 message( i18n("Setting categories ... please wait!") );
2126 QStringList catList = csd->selectedCategories();
2127 delete csd;
2128 catList.sort();
2129 QStringList newList;
2130 KABC::Addressee::List list = mViewManager->selectedAddressees();
2131 KABC::Addressee::List::Iterator it;
2132 for ( it = list.begin(); it != list.end(); ++it ) {
2133 if ( removeOld ) {
2134 (*it).setCategories( catList );
2135 } else {
2136 newList = (*it).categories();
2137 int i;
2138 for( i = 0; i< catList.count(); ++i ) {
2139 if ( !newList.contains (catList[i]))
2140 newList.append( catList[i] );
2141 }
2142 newList.sort();
2143 (*it).setCategories( newList );
2144 }
2145 contactModified((*it) );
2146 }
2147 message( i18n("Setting categories completed!") );
2148}
2099void KABCore::removeVoice() 2149void KABCore::removeVoice()
2100{ 2150{
2101 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 ) 2151 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 )
2102 return; 2152 return;
2103 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2153 KABC::Addressee::List list = mViewManager->selectedAddressees();
2104 KABC::Addressee::List::Iterator it; 2154 KABC::Addressee::List::Iterator it;
2105 for ( it = list.begin(); it != list.end(); ++it ) { 2155 for ( it = list.begin(); it != list.end(); ++it ) {
2106 2156
2107 if ( (*it).removeVoice() ) 2157 if ( (*it).removeVoice() )
2108 contactModified((*it) ); 2158 contactModified((*it) );
2109 } 2159 }
2110} 2160}
2111 2161
2112 2162
2113 2163
2114void KABCore::clipboardDataChanged() 2164void KABCore::clipboardDataChanged()
2115{ 2165{
2116 2166
2117 if ( mReadWrite ) 2167 if ( mReadWrite )
2118 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2168 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2119 2169
2120} 2170}
2121 2171
2122void KABCore::updateActionMenu() 2172void KABCore::updateActionMenu()
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c01d598..1bdae5f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -349,48 +349,51 @@ class KABCore : public QWidget, public KSyncInterface
349 349
350 signals: 350 signals:
351 void contactSelected( const QString &name ); 351 void contactSelected( const QString &name );
352 void contactSelected( const QPixmap &pixmap ); 352 void contactSelected( const QPixmap &pixmap );
353 public slots: 353 public slots:
354 void recieve(QString cmsg ); 354 void recieve(QString cmsg );
355 void getFile( bool success ); 355 void getFile( bool success );
356 void syncFileRequest(); 356 void syncFileRequest();
357 void setDetailsVisible( bool visible ); 357 void setDetailsVisible( bool visible );
358 void setDetailsToState(); 358 void setDetailsToState();
359 // void slotSyncMenu( int ); 359 // void slotSyncMenu( int );
360 private slots: 360 private slots:
361 void receive( const QCString& cmsg, const QByteArray& data ); 361 void receive( const QCString& cmsg, const QByteArray& data );
362 void toggleBeamReceive( ); 362 void toggleBeamReceive( );
363 void disableBR(bool); 363 void disableBR(bool);
364 void setJumpButtonBarVisible( bool visible ); 364 void setJumpButtonBarVisible( bool visible );
365 void setCaptionBack(); 365 void setCaptionBack();
366 void importFromOL(); 366 void importFromOL();
367 void extensionModified( const KABC::Addressee::List &list ); 367 void extensionModified( const KABC::Addressee::List &list );
368 void extensionChanged( int id ); 368 void extensionChanged( int id );
369 void clipboardDataChanged(); 369 void clipboardDataChanged();
370 void updateActionMenu(); 370 void updateActionMenu();
371 void configureKeyBindings(); 371 void configureKeyBindings();
372 void removeVoice(); 372 void removeVoice();
373 void setCat();
374 void addCat();
375 void setCategories( bool removeOld );
373#ifdef KAB_EMBEDDED 376#ifdef KAB_EMBEDDED
374 void configureResources(); 377 void configureResources();
375#endif //KAB_EMBEDDED 378#endif //KAB_EMBEDDED
376 379
377 void slotEditorDestroyed( const QString &uid ); 380 void slotEditorDestroyed( const QString &uid );
378 void configurationChanged(); 381 void configurationChanged();
379 void addressBookChanged(); 382 void addressBookChanged();
380 383
381 private: 384 private:
382 bool mBRdisabled; 385 bool mBRdisabled;
383#ifndef DESKTOP_VERSION 386#ifndef DESKTOP_VERSION
384 QCopChannel* infrared; 387 QCopChannel* infrared;
385#endif 388#endif
386 QTimer *mMessageTimer; 389 QTimer *mMessageTimer;
387 void initGUI(); 390 void initGUI();
388 void initActions(); 391 void initActions();
389 QString getPhoneFile(); 392 QString getPhoneFile();
390 393
391 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 394 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
392 const char *name = 0 ); 395 const char *name = 0 );
393 396
394 KXMLGUIClient *mGUIClient; 397 KXMLGUIClient *mGUIClient;
395 398
396 KABC::AddressBook *mAddressBook; 399 KABC::AddressBook *mAddressBook;
@@ -449,48 +452,50 @@ class KABCore : public QWidget, public KSyncInterface
449 KAction *mActionKeyBindings; 452 KAction *mActionKeyBindings;
450 KToggleAction *mActionJumpBar; 453 KToggleAction *mActionJumpBar;
451 KToggleAction *mActionDetails; 454 KToggleAction *mActionDetails;
452 KAction *mActionWhoAmI; 455 KAction *mActionWhoAmI;
453 KAction *mActionCategories; 456 KAction *mActionCategories;
454 KAction *mActionAboutKAddressbook; 457 KAction *mActionAboutKAddressbook;
455 KAction *mActionLicence; 458 KAction *mActionLicence;
456 KAction *mActionFaq; 459 KAction *mActionFaq;
457 KAction *mActionWN; 460 KAction *mActionWN;
458 KAction *mActionSyncHowto; 461 KAction *mActionSyncHowto;
459 KAction *mActionKdeSyncHowto; 462 KAction *mActionKdeSyncHowto;
460 KAction *mActionMultiSyncHowto; 463 KAction *mActionMultiSyncHowto;
461 464
462 KAction *mActionDeleteView; 465 KAction *mActionDeleteView;
463 466
464 QPopupMenu *viewMenu; 467 QPopupMenu *viewMenu;
465 QPopupMenu *filterMenu; 468 QPopupMenu *filterMenu;
466 QPopupMenu *settingsMenu; 469 QPopupMenu *settingsMenu;
467 QPopupMenu *changeMenu; 470 QPopupMenu *changeMenu;
468//US QAction *mActionSave; 471//US QAction *mActionSave;
469 QPopupMenu *ImportMenu; 472 QPopupMenu *ImportMenu;
470 QPopupMenu *ExportMenu; 473 QPopupMenu *ExportMenu;
471 //LR additional methods 474 //LR additional methods
472 KAction *mActionRemoveVoice; 475 KAction *mActionRemoveVoice;
476 KAction *mActionSetCat;
477 KAction *mActionAddCat;
473 KAction * mActionImportOL; 478 KAction * mActionImportOL;
474 479
475#ifndef KAB_EMBEDDED 480#ifndef KAB_EMBEDDED
476 KAddressBookService *mAddressBookService; 481 KAddressBookService *mAddressBookService;
477#endif //KAB_EMBEDDED 482#endif //KAB_EMBEDDED
478 483
479 class KABCorePrivate; 484 class KABCorePrivate;
480 KABCorePrivate *d; 485 KABCorePrivate *d;
481 //US bool mBlockSaveFlag; 486 //US bool mBlockSaveFlag;
482 487
483#ifdef KAB_EMBEDDED 488#ifdef KAB_EMBEDDED
484 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 489 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
485#endif //KAB_EMBEDDED 490#endif //KAB_EMBEDDED
486 491
487 //this are the overwritten callbackmethods from the syncinterface 492 //this are the overwritten callbackmethods from the syncinterface
488 virtual bool sync(KSyncManager* manager, QString filename, int mode); 493 virtual bool sync(KSyncManager* manager, QString filename, int mode);
489 virtual bool syncExternal(KSyncManager* manager, QString resource); 494 virtual bool syncExternal(KSyncManager* manager, QString resource);
490 virtual void removeSyncInfo( QString syncProfile); 495 virtual void removeSyncInfo( QString syncProfile);
491 bool syncPhone(); 496 bool syncPhone();
492 void message( QString m ); 497 void message( QString m );
493 498
494 // LR ******************************* 499 // LR *******************************
495 // sync stuff! 500 // sync stuff!
496 QString sentSyncFile(); 501 QString sentSyncFile();