From 5f48eb0a2daa721ee4fb30f0aca1580480a8e95c Mon Sep 17 00:00:00 2001 From: Till Adam Date: Wed, 29 Jun 2005 15:37:51 +0000 Subject: [PATCH] Port of somewhat gui blooperish addition of two buttons for recent addresses and completion order editing form the config dialog. svn path=/trunk/KDE/kdepim/; revision=429967 --- configuredialog.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ configuredialog_p.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/configuredialog.cpp b/configuredialog.cpp index 70944dd3d..f4c7ec686 100644 --- a/configuredialog.cpp +++ b/configuredialog.cpp @@ -57,6 +57,13 @@ using KMail::ImapAccountBase; #include "folderstorage.h" #include "kmfolder.h" #include "kmmainwidget.h" +#include "recentaddresses.h" +using KRecentAddress::RecentAddresses; +#include "completionordereditor.h" +#include "ldapclient.h" + +using KMail::IdentityListView; +using KMail::IdentityListViewItem; #include "identitydialog.h" using KMail::IdentityDialog; @@ -2533,6 +2540,21 @@ ComposerPageGeneralTab::ComposerPageGeneralTab( QWidget * parent, const char * n connect( mAutoSave, SIGNAL( valueChanged(int) ), this, SLOT( slotEmitChanged( void ) ) ); + 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() ); @@ -2633,6 +2655,26 @@ void ComposerPage::GeneralTab::save() { GlobalSettings::setExternalEditor( mEditorRequester->url() ); } +void ComposerPage::GeneralTab::slotConfigureRecentAddresses( ) +{ + KRecentAddress::RecentAddressDialog dlg( this ); + dlg.setAddresses( RecentAddresses::self( KMKernel::config() )->addresses() ); + if ( dlg.exec() ) { + RecentAddresses::self( KMKernel::config() )->clear(); + const QStringList &addrList = dlg.addresses(); + QStringList::ConstIterator it; + for ( it = addrList.constBegin(); it != addrList.constEnd(); ++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 0d411202a..ad48bd52c 100644 --- a/configuredialog_p.h +++ b/configuredialog_p.h @@ -582,6 +582,9 @@ public: void save(); void installProfile( KConfig * profile ); +protected slots: + void slotConfigureRecentAddresses(); + void slotConfigureCompletionOrder(); private: virtual void doLoadFromGlobalSettings();