From 32c5093dbf3d3d09aca313c5860071bc78abdc6f Mon Sep 17 00:00:00 2001 From: Till Adam Date: Wed, 29 Jun 2005 14:48:20 +0000 Subject: [PATCH] Add buttons for triggering the dialogs for editing recent addresses and configuring the completion order to the General tab of the Composer page of the main configuration dialog. svn path=/branches/kdepim/proko2/kdepim/; revision=429958 --- configuredialog.cpp | 39 +++++++++++++++++++++++++++++++++++++++ configuredialog_p.h | 3 +++ 2 files changed, 42 insertions(+) diff --git a/configuredialog.cpp b/configuredialog.cpp index ee7501acc..65302b64c 100644 --- a/configuredialog.cpp +++ b/configuredialog.cpp @@ -48,6 +48,10 @@ #include "accountcombobox.h" #include "imapaccountbase.h" #include "folderstorage.h" +#include "recentaddresses.h" +using KRecentAddress::RecentAddresses; +#include "completionordereditor.h" +#include "ldapclient.h" using KMail::IdentityListView; using KMail::IdentityListViewItem; @@ -2306,6 +2310,21 @@ ComposerPageGeneralTab::ComposerPageGeneralTab( QWidget * parent, const char * n QWhatsThis::add( mAutoSave, msg ); QWhatsThis::add( label, msg ); + hlay = new QHBoxLayout( vlay ); // inherits spacing + QPushButton *completionOrderBtn = new QPushButton( i18n( "Configure completion order" ), this ); + connect( completionOrderBtn, SIGNAL( clicked() ), + this, SLOT( slotConfigureCompletionOrder() ) ); + hlay->addWidget( completionOrderBtn ); + hlay->addItem( new QSpacerItem(0, 0) ); + + // recent addresses + hlay = new QHBoxLayout( vlay ); // inherits spacing + QPushButton *recentAddressesBtn = new QPushButton( i18n( "Edit recent addresses" ), this ); + connect( recentAddressesBtn, SIGNAL( clicked() ), + this, SLOT( slotConfigureRecentAddresses() ) ); + hlay->addWidget( recentAddressesBtn ); + hlay->addItem( new QSpacerItem(0, 0) ); + // The "external editor" group: group = new QVGroupBox( i18n("External Editor"), this ); group->layout()->setSpacing( KDialog::spacingHint() ); @@ -2430,6 +2449,26 @@ void ComposerPage::GeneralTab::save() { composer.writeEntry( "autosave", mAutoSave->value() ); } +void ComposerPage::GeneralTab::slotConfigureRecentAddresses( ) +{ + KRecentAddress::RecentAddressDialog dlg( this ); + dlg.setAddresses( RecentAddresses::self( KMKernel::config() )->addresses() ); + if ( dlg.exec() ) { + RecentAddresses::self( KMKernel::config() )->clear(); + QStringList addrList = dlg.addresses(); + QStringList::Iterator it; + for ( it = addrList.begin(); it != addrList.end(); ++it ) + RecentAddresses::self( KMKernel::config() )->add( *it ); + } +} + +void ComposerPage::GeneralTab::slotConfigureCompletionOrder( ) +{ + KPIM::LdapSearch search; + KPIM::CompletionOrderEditor editor( &search, this ); + editor.exec(); +} + QString ComposerPage::PhrasesTab::helpAnchor() const { return QString::fromLatin1("configure-composer-phrases"); } diff --git a/configuredialog_p.h b/configuredialog_p.h index 1e9a763c9..62e6c1403 100644 --- a/configuredialog_p.h +++ b/configuredialog_p.h @@ -530,6 +530,9 @@ public: void save(); void defaults(); void installProfile( KConfig * profile ); +protected slots: + void slotConfigureRecentAddresses(); + void slotConfigureCompletionOrder(); protected: QCheckBox *mAutoAppSignFileCheck;