summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-30 01:00:42 (UTC)
committer zautrix <zautrix>2004-10-30 01:00:42 (UTC)
commitc477fa8ba7eacfaba3d154a72153acc7bc46abdc (patch) (side-by-side diff)
tree0ba938ac70b5f878515432a7ba36525f6167be3f
parentaf857a738da80e9eb68cf311832d44ecb9caf1dd (diff)
downloadkdepimpi-c477fa8ba7eacfaba3d154a72153acc7bc46abdc.zip
kdepimpi-c477fa8ba7eacfaba3d154a72153acc7bc46abdc.tar.gz
kdepimpi-c477fa8ba7eacfaba3d154a72153acc7bc46abdc.tar.bz2
AARGG. I just noticed, that set categories was alreday there. removed my second implementation
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp59
-rw-r--r--kaddressbook/kabcore.h7
2 files changed, 13 insertions, 53 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2c2f1a0..83027ac 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -951,32 +951,34 @@ void KABCore::setWhoAmI()
KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
return;
}
QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
}
void KABCore::setCategories()
{
KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
- if ( !dlg.exec() )
+ if ( !dlg.exec() ) {
+ message( i18n("Setting categories cancelled") );
return;
-
+ }
bool merge = false;
QString msg = i18n( "Merge with existing categories?" );
if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
merge = true;
+ message( i18n("Setting categories ... please wait!") );
QStringList categories = dlg.selectedCategories();
QStringList uids = mViewManager->selectedUids();
QStringList::Iterator it;
for ( it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee addr = mAddressBook->findByUid( *it );
if ( !addr.isEmpty() ) {
if ( !merge )
addr.setCategories( categories );
else {
QStringList addrCategories = addr.categories();
QStringList::Iterator catIt;
@@ -984,24 +986,25 @@ void KABCore::setCategories()
if ( !addrCategories.contains( *catIt ) )
addrCategories.append( *catIt );
}
addr.setCategories( addrCategories );
}
mAddressBook->insertAddressee( addr );
}
}
if ( uids.count() > 0 )
setModified( true );
+ message( i18n("Setting categories completed!") );
}
void KABCore::setSearchFields( const KABC::Field::List &fields )
{
mIncSearchWidget->setFields( fields );
}
void KABCore::incrementalSearch( const QString& text )
{
mViewManager->doSearch( text, mIncSearchWidget->currentField() );
}
@@ -1875,33 +1878,29 @@ void KABCore::initActions()
SLOT( setWhoAmI() ), actionCollection(),
"set_personal" );
mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
SLOT( setCategories() ), actionCollection(),
"edit_set_categories" );
mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
SLOT( removeVoice() ), actionCollection(),
"remove_voice" );
- mActionSetCat= new KAction( i18n( "Set categories..." ), 0, this,
- SLOT( setCat() ), actionCollection(),
+ mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
+ SLOT( manageCategories() ), actionCollection(),
"remove_voice" );
- mActionAddCat= new KAction( i18n( "Add categories..." ), 0, this,
- SLOT( addCat() ), actionCollection(),
- "remove_voice" );
-
mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
SLOT( importFromOL() ), actionCollection(),
"import_OL" );
#ifdef KAB_EMBEDDED
mActionLicence = new KAction( i18n( "Licence" ), 0,
this, SLOT( showLicence() ), actionCollection(),
"licence_about_data" );
mActionFaq = new KAction( i18n( "Faq" ), 0,
this, SLOT( faq() ), actionCollection(),
"faq_about_data" );
mActionWN = new KAction( i18n( "What's New?" ), 0,
this, SLOT( whatsnew() ), actionCollection(),
@@ -2013,26 +2012,24 @@ void KABCore::addActionsManually()
// edit menu
mActionUndo->plug( editMenu );
mActionRedo->plug( editMenu );
editMenu->insertSeparator();
mActionCut->plug( editMenu );
mActionCopy->plug( editMenu );
mActionPaste->plug( editMenu );
mActionDelete->plug( editMenu );
editMenu->insertSeparator();
mActionSelectAll->plug( editMenu );
mActionRemoveVoice->plug( changeMenu );
- mActionSetCat->plug( changeMenu );
- mActionAddCat->plug( changeMenu );
// settings menu
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
mActionConfigResources->plug( settingsMenu );
settingsMenu->insertSeparator();
mActionConfigKAddressbook->plug( settingsMenu );
if ( mIsPart ) {
//US not implemented yet
//mActionConfigShortcuts->plug( settingsMenu );
//mActionConfigureToolbars->plug( settingsMenu );
@@ -2045,24 +2042,25 @@ void KABCore::addActionsManually()
settingsMenu->insertSeparator();
mActionJumpBar->plug( settingsMenu );
mActionDetails->plug( settingsMenu );
//if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
mActionDetails->plug( tb );
settingsMenu->insertSeparator();
mActionBR->plug(settingsMenu );
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
mActionCategories->plug( settingsMenu );
+ mActionManageCategories->plug( settingsMenu );
mActionWN->plug( helpMenu );
mActionSyncHowto->plug( helpMenu );
mActionKdeSyncHowto->plug( helpMenu );
mActionMultiSyncHowto->plug( helpMenu );
mActionFaq->plug( helpMenu );
mActionLicence->plug( helpMenu );
mActionAboutKAddressbook->plug( helpMenu );
if (KGlobal::getDesktopSize() > KGlobal::Small ) {
@@ -2097,63 +2095,28 @@ void KABCore::addActionsManually()
#endif //KAB_EMBEDDED
mActionExport2phone->plug( ExportMenu );
connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
}
void KABCore::showLicence()
{
KApplication::showLicence();
}
-void KABCore::setCat()
-{
- setCategories( true );
-}
-void KABCore::addCat()
-{
- setCategories( false );
-}
-void KABCore::setCategories( bool removeOld )
+
+void KABCore::manageCategories( )
{
- KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KABPrefs::instance(), 0 );
- if (! csd->exec()) {
- message( i18n("Setting categories cancelled") );
- delete csd;
- return;
- }
- message( i18n("Setting categories ... please wait!") );
- QStringList catList = csd->selectedCategories();
- delete csd;
- catList.sort();
- QStringList newList;
- KABC::Addressee::List list = mViewManager->selectedAddressees();
- KABC::Addressee::List::Iterator it;
- for ( it = list.begin(); it != list.end(); ++it ) {
- if ( removeOld ) {
- (*it).setCategories( catList );
- } else {
- newList = (*it).categories();
- int i;
- for( i = 0; i< catList.count(); ++i ) {
- if ( !newList.contains (catList[i]))
- newList.append( catList[i] );
- }
- newList.sort();
- (*it).setCategories( newList );
- }
- contactModified((*it) );
- }
- message( i18n("Setting categories completed!") );
+
}
void KABCore::removeVoice()
{
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 )
return;
KABC::Addressee::List list = mViewManager->selectedAddressees();
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( (*it).removeVoice() )
contactModified((*it) );
}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 1bdae5f..bf5398b 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -234,24 +234,25 @@ class KABCore : public QWidget, public KSyncInterface
/**
Sets the whoAmI contact, that is used by many other programs to
get personal information about the current user.
*/
void setWhoAmI();
/**
Displays the category dialog and applies the result to all
selected contacts.
*/
void setCategories();
+ void manageCategories();
/**
Sets the field list of the Incremental Search Widget.
*/
void setSearchFields( const KABC::Field::List &fields );
/**
Search with the current search field for a contact, that matches
the given text, and selects it in the view.
*/
void incrementalSearch( const QString& text );
@@ -361,27 +362,24 @@ class KABCore : public QWidget, public KSyncInterface
void receive( const QCString& cmsg, const QByteArray& data );
void toggleBeamReceive( );
void disableBR(bool);
void setJumpButtonBarVisible( bool visible );
void setCaptionBack();
void importFromOL();
void extensionModified( const KABC::Addressee::List &list );
void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
- void setCat();
- void addCat();
- void setCategories( bool removeOld );
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
@@ -445,45 +443,44 @@ class KABCore : public QWidget, public KSyncInterface
KAction *mActionDelete;
//US settings menu
KAction *mActionConfigResources;
KAction *mActionConfigKAddressbook;
KAction *mActionConfigShortcuts;
KAction *mActionConfigureToolbars;
KAction *mActionKeyBindings;
KToggleAction *mActionJumpBar;
KToggleAction *mActionDetails;
KAction *mActionWhoAmI;
KAction *mActionCategories;
+ KAction *mActionManageCategories;
KAction *mActionAboutKAddressbook;
KAction *mActionLicence;
KAction *mActionFaq;
KAction *mActionWN;
KAction *mActionSyncHowto;
KAction *mActionKdeSyncHowto;
KAction *mActionMultiSyncHowto;
KAction *mActionDeleteView;
QPopupMenu *viewMenu;
QPopupMenu *filterMenu;
QPopupMenu *settingsMenu;
QPopupMenu *changeMenu;
//US QAction *mActionSave;
QPopupMenu *ImportMenu;
QPopupMenu *ExportMenu;
//LR additional methods
KAction *mActionRemoveVoice;
- KAction *mActionSetCat;
- KAction *mActionAddCat;
KAction * mActionImportOL;
#ifndef KAB_EMBEDDED
KAddressBookService *mAddressBookService;
#endif //KAB_EMBEDDED
class KABCorePrivate;
KABCorePrivate *d;
//US bool mBlockSaveFlag;
#ifdef KAB_EMBEDDED
KAddressBookMain *mMainWindow; // should be the same like mGUIClient