diff options
Diffstat (limited to 'kaddressbook/kabcore.cpp')
-rw-r--r-- | kaddressbook/kabcore.cpp | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 0702ce04e..449357d16 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -226,7 +226,7 @@ void KABCore::restoreSettings() mDetailsSplitter->setSizes( splitterSize ); const QValueList<int> leftSplitterSizes = KABPrefs::instance()->leftSplitter(); - if ( !leftSplitterSizes.isEmpty() ) + if ( !leftSplitterSizes.isEmpty() ) mLeftSplitter->setSizes( leftSplitterSizes ); } @@ -236,7 +236,7 @@ void KABCore::saveSettings() KABPrefs::instance()->setDetailsPageVisible( mActionDetails->isChecked() ); KABPrefs::instance()->setDetailsSplitter( mDetailsSplitter->sizes() ); KABPrefs::instance()->setLeftSplitter( mLeftSplitter->sizes() ); - + mExtensionManager->saveSettings(); mViewManager->saveSettings(); @@ -295,10 +295,11 @@ QWidget *KABCore::widget() const KAboutData *KABCore::createAboutData() { KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), - "3.5.10", I18N_NOOP( "The KDE Address Book" ), + "3.5.11", I18N_NOOP( "The KDE Address Book" ), KAboutData::License_GPL_V2, - I18N_NOOP( "(c) 1997-2005, The KDE PIM Team" ) ); - about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer" ), "[email protected]" ); + I18N_NOOP( "(c) 2008-2010, The Trinity Team\n(c) 1997-2005, The KDE PIM Team" ) ); + about->addAuthor( "Timothy Pearson", I18N_NOOP( "Current maintainer" ), "[email protected]" ); + about->addAuthor( "Tobias Koenig", I18N_NOOP( "Previous maintainer" ), "[email protected]" ); about->addAuthor( "Don Sanders", I18N_NOOP( "Original author" ) ); about->addAuthor( "Cornelius Schumacher", I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export" ), @@ -327,10 +328,15 @@ KStatusBar *KABCore::statusBar() const void KABCore::setContactSelected( const QString &uid ) { + // Avoid crash on exit + if ( !mAddressBook ) { + return; + } + KABC::Addressee addr = mAddressBook->findByUid( uid ); if ( !mDetailsViewer->isHidden() ) mDetailsViewer->setAddressee( addr ); -#ifdef KDEPIM_NEW_DISTRLISTS +#ifdef KDEPIM_NEW_DISTRLISTS if ( !mSelectedDistributionList.isNull() && mDistListEntryView->isShown() ) { showDistributionListEntry( uid ); } @@ -470,10 +476,10 @@ void KABCore::deleteDistributionLists( const QStringList & names ) QStringList uids; for ( QStringList::ConstIterator it = names.begin(); it != names.end(); ++it ) { - uids.append( KPIM::DistributionList::findByName( mAddressBook, *it ).uid() ); + uids.append( KPIM::DistributionList::findByName( mAddressBook, *it ).uid() ); } DeleteCommand *command = new DeleteCommand( mAddressBook, uids ); - mCommandHistory->addCommand( command ); + mCommandHistory->addCommand( command ); setModified( true ); } @@ -667,7 +673,7 @@ void KABCore::newDistributionList() bool foundUnused = false; int i = 1; while ( !foundUnused ) { - name = i18n( "New Distribution List (%1)" ).arg( i++ ); + name = i18n( "New Distribution List (%1)" ).arg( i++ ); foundUnused = KPIM::DistributionList::findByName( addressBook(), name ).isEmpty(); } } @@ -1158,14 +1164,14 @@ void KABCore::initGUI() topLayout->addWidget( searchTB ); topLayout->addWidget( mDetailsSplitter ); - + mDetailsStack = new QWidgetStack( mDetailsSplitter ); mExtensionManager = new ExtensionManager( new QWidget( mLeftSplitter ), mDetailsStack, this, this ); - connect( mExtensionManager, SIGNAL( detailsWidgetDeactivated( QWidget* ) ), + connect( mExtensionManager, SIGNAL( detailsWidgetDeactivated( QWidget* ) ), this, SLOT( deactivateDetailsWidget( QWidget* ) ) ); - connect( mExtensionManager, SIGNAL( detailsWidgetActivated( QWidget* ) ), + connect( mExtensionManager, SIGNAL( detailsWidgetActivated( QWidget* ) ), this, SLOT( activateDetailsWidget( QWidget* ) ) ); - + QWidget *viewWidget = new QWidget( mLeftSplitter ); if ( KABPrefs::instance()->contactListAboveExtensions() ) mLeftSplitter->moveToFirst( viewWidget ); @@ -1187,7 +1193,7 @@ void KABCore::initGUI() KPushButton *addDistListButton = new KPushButton( mDistListButtonWidget ); addDistListButton->setText( i18n( "Add" ) ); - connect( addDistListButton, SIGNAL( clicked() ), + connect( addDistListButton, SIGNAL( clicked() ), this, SLOT( editSelectedDistributionList() ) ); buttonLayout->addWidget( addDistListButton ); mDistListButtonWidget->setShown( false ); @@ -1195,7 +1201,7 @@ void KABCore::initGUI() KPushButton *removeDistListButton = new KPushButton( mDistListButtonWidget ); removeDistListButton->setText( i18n( "Remove" ) ); - connect( removeDistListButton, SIGNAL( clicked() ), + connect( removeDistListButton, SIGNAL( clicked() ), this, SLOT( removeSelectedContactsFromDistList() ) ); buttonLayout->addWidget( removeDistListButton ); #endif @@ -1404,6 +1410,11 @@ QStringList KABCore::allCategories() const QStringList categories, allCategories; QStringList::ConstIterator catIt; + // Avoid crash on exit + if ( !mAddressBook ) { + return allCategories; + } + KABC::AddressBook::ConstIterator it; const KABC::AddressBook::ConstIterator endIt( mAddressBook->end() ); for ( it = mAddressBook->begin(); it != endIt; ++it ) { @@ -1559,12 +1570,12 @@ void KABCore::sendMailToDistributionList( const QString &name ) KPIM::DistributionList dist = KPIM::DistributionList::findByName( addressBook(), name ); if ( dist.isEmpty() ) return; - typedef KPIM::DistributionList::Entry::List EntryList; + typedef KPIM::DistributionList::Entry::List EntryList; QStringList mails; const EntryList entries = dist.entries( addressBook() ); for ( EntryList::ConstIterator it = entries.begin(); it != entries.end(); ++it ) mails += (*it).addressee.fullEmail( (*it).email ); - sendMail( mails.join( ", " ) ); + sendMail( mails.join( ", " ) ); #endif } @@ -1590,8 +1601,8 @@ void KABCore::showDistributionListEntry( const QString& uid ) KPIM::DistributionList dist = KPIM::DistributionList::findByName( addressBook(), mSelectedDistributionList ); if ( !dist.isEmpty() ) { mDistListEntryView->clear(); - typedef KPIM::DistributionList::Entry::List EntryList; - const EntryList entries = dist.entries( addressBook() ); + typedef KPIM::DistributionList::Entry::List EntryList; + const EntryList entries = dist.entries( addressBook() ); for (EntryList::ConstIterator it = entries.begin(); it != entries.end(); ++it ) { if ( (*it).addressee.uid() == uid ) { mDistListEntryView->setEntry( dist, *it ); |