23 #include <config-enterprise.h>
28 #include "ui_accountspagereceivingtab.h"
32 #include "templatesconfiguration_kfg.h"
38 #include "kernel/mailkernel.h"
39 #include "pimcommon/widgets/simplestringlisteditor.h"
41 #include <kpimidentities/identitymanager.h>
42 #include "folderrequester.h"
47 #include "foldertreewidget.h"
51 #include "newmailnotifierinterface.h"
56 #include "messagelist/utils/aggregationcombobox.h"
57 #include "messagelist/utils/aggregationconfigbutton.h"
58 #include "messagelist/utils/themecombobox.h"
59 #include "messagelist/utils/themeconfigbutton.h"
61 #include "messagecomposer/autocorrection/composerautocorrectionwidget.h"
62 #include "messagecomposer/imagescaling/imagescalingwidget.h"
64 #include "messageviewer/utils/autoqpointer.h"
65 #include "messageviewer/viewer/nodehelper.h"
66 #include "messageviewer/widgets/configurewidget.h"
67 #include "messageviewer/settings/globalsettings.h"
68 #include "messageviewer/widgets/invitationsettings.h"
69 #include "messageviewer/header/customheadersettingwidget.h"
70 #include "messageviewer/widgets/printingsettings.h"
71 #include "messageviewer/adblock/adblocksettingwidget.h"
72 #include "messagelist/core/settings.h"
73 #include "messagelist/messagelistutil.h"
74 #include "messagecore/settings/globalsettings.h"
76 #include "templateparser/templatesconfiguration_kfg.h"
77 #include "templateparser/templatesconfiguration.h"
78 #include "templateparser/customtemplates.h"
79 #include "templateparser/globalsettings_base.h"
80 #include "mailcommon/util/mailutil.h"
81 #include "mailcommon/tag/tagwidget.h"
82 #include "mailcommon/tag/tag.h"
83 #include "mailcommon/mailcommonsettings_base.h"
85 #include "messagecomposer/settings/messagecomposersettings.h"
87 #include <soprano/nao.h>
90 #include <kpimidentities/identity.h>
91 #include <kmime/kmime_dateformatter.h>
92 using KMime::DateFormatter;
93 #include "kleo/cryptoconfig.h"
94 #include "kleo/cryptobackendfactory.h"
95 #include "libkleo/ui/keyrequester.h"
96 #include "libkleo/ui/keyselectiondialog.h"
97 #include "libkleo/ui/cryptoconfigdialog.h"
99 #include <mailtransport/transportmanagementwidget.h>
100 using MailTransport::TransportManagementWidget;
103 #include <klineedit.h>
105 #include <kcharsets.h>
107 #include <knuminput.h>
108 #include <kfontchooser.h>
109 #include <kmessagebox.h>
110 #include <kurlrequester.h>
111 #include <kseparator.h>
112 #include <kiconloader.h>
113 #include <kwindowsystem.h>
114 #include <kcmultidialog.h>
115 #include <knotifyconfigwidget.h>
116 #include <kconfiggroup.h>
117 #include <kbuttongroup.h>
118 #include <kcolorcombo.h>
119 #include <kfontrequester.h>
120 #include <kicondialog.h>
121 #include <kkeysequencewidget.h>
122 #include <KColorScheme>
124 #include <Nepomuk2/Tag>
125 #include <KCModuleProxy>
129 #include <QGridLayout>
130 #include <QHBoxLayout>
131 #include <QHideEvent>
133 #include <QRadioButton>
135 #include <QListWidget>
136 #include <QVBoxLayout>
137 #include <QWhatsThis>
138 #include <QDBusConnection>
140 #include <QTextCodec>
148 #include <akonadi/agentfilterproxymodel.h>
149 #include <akonadi/agentinstancemodel.h>
150 #include <akonadi/agenttype.h>
151 #include <akonadi/agentmanager.h>
152 #include <akonadi/agenttypedialog.h>
153 #include <akonadi/agentinstancecreatejob.h>
155 #include <nepomuk2/resourcemanager.h>
158 using namespace MailCommon;
159 using namespace KMail;
162 static const char * lockedDownWarning =
163 I18N_NOOP(
"<qt><p>This setting has been fixed by your administrator.</p>"
164 "<p>If you think this is an error, please contact him.</p></qt>");
166 void checkLockDown(
QWidget * w,
const KConfigSkeletonItem *item ) {
167 if ( item->isImmutable() ) {
168 w->setEnabled(
false );
169 w->setToolTip( i18n( lockedDownWarning ) );
173 void populateButtonGroup( QGroupBox * box, QButtonGroup * group,
int orientation,
174 const KCoreConfigSkeleton::ItemEnum *e ) {
175 box->setTitle( e->label() );
176 if (orientation == Qt::Horizontal) {
177 box->setLayout(
new QHBoxLayout() );
179 box->setLayout(
new QVBoxLayout() );
181 box->layout()->setSpacing( KDialog::spacingHint() );
182 const int numberChoices(e->choices().size());
183 for (
int i = 0; i < numberChoices; ++i) {
184 QRadioButton *button =
new QRadioButton( e->choices().at(i).label, box );
185 group->addButton( button, i );
186 box->layout()->addWidget( button );
190 void populateCheckBox( QCheckBox * b,
const KCoreConfigSkeleton::ItemBool *e ) {
191 b->setText( e->label() );
194 void loadWidget( QCheckBox * b,
const KCoreConfigSkeleton::ItemBool *e ) {
195 checkLockDown( b, e );
196 b->setChecked( e->value() );
199 void loadWidget( QGroupBox * box, QButtonGroup * group,
200 const KCoreConfigSkeleton::ItemEnum *e ) {
201 Q_ASSERT( group->buttons().size() == e->choices().size() );
202 checkLockDown( box, e );
203 group->buttons()[e->value()]->setChecked(
true );
206 void saveCheckBox( QCheckBox * b, KCoreConfigSkeleton::ItemBool *e ) {
207 e->setValue( b->isChecked() );
210 void saveButtonGroup( QButtonGroup * group, KCoreConfigSkeleton::ItemEnum *e ) {
211 Q_ASSERT( group->buttons().size() == e->choices().size() );
212 if ( group->checkedId() != -1 ) {
213 e->setValue( group->checkedId() );
222 setButtons( Help | Default | Cancel | Apply | Ok | Reset );
224 KWindowSystem::setIcons( winId(), qApp->windowIcon().pixmap( IconSize( KIconLoader::Desktop ), IconSize( KIconLoader::Desktop ) ), qApp->windowIcon().pixmap(IconSize( KIconLoader::Small ), IconSize( KIconLoader::Small ) ) );
225 addModule( QLatin1String(
"kmail_config_identity") );
226 addModule( QLatin1String(
"kmail_config_accounts") );
227 addModule( QLatin1String(
"kmail_config_appearance") );
228 addModule( QLatin1String(
"kmail_config_composer") );
229 addModule( QLatin1String(
"kmail_config_security") );
230 addModule( QLatin1String(
"kmail_config_misc") );
232 connect(
this, SIGNAL(okClicked()), SLOT(
slotOk()) );
233 connect(
this, SIGNAL(applyClicked()), SLOT(
slotApply()) );
241 if ( width != 0 && height != 0 ) {
242 resize( width, height );
251 KDialog::hideEvent( ev );
279 return QString::fromLatin1(
"configure-accounts");
289 addTab( mReceivingTab, i18nc(
"@title:tab Tab page where the user configures accounts to receive mail",
"Receiving" ) );
297 addTab( mSendingTab, i18nc(
"@title:tab Tab page where the user configures accounts to send mail",
"Sending" ) );
306 return QString::fromLatin1(
"configure-accounts-sending");
317 vlay =
new QVBoxLayout(
this );
318 vlay->setSpacing( KDialog::spacingHint() );
319 vlay->setMargin( KDialog::marginHint() );
321 vlay->addWidget(
new QLabel( i18n(
"Outgoing accounts (add at least one):"),
this ) );
323 TransportManagementWidget *tmw =
new TransportManagementWidget(
this );
324 tmw->layout()->setContentsMargins( 0, 0, 0, 0 );
325 vlay->addWidget( tmw );
328 group =
new QGroupBox( i18n(
"Common Options"),
this );
329 vlay->addWidget(group);
332 glay =
new QGridLayout();
333 group->setLayout( glay );
334 glay->setSpacing( KDialog::spacingHint() );
335 glay->setColumnStretch( 2, 10 );
338 mConfirmSendCheck =
new QCheckBox( i18n(
"Confirm &before send"), group );
339 glay->addWidget( mConfirmSendCheck, 0, 0, 1, 2 );
340 connect( mConfirmSendCheck, SIGNAL(stateChanged(
int)),
343 mCheckSpellingBeforeSending =
new QCheckBox( i18n(
"Check spelling before sending"), group );
344 glay->addWidget( mCheckSpellingBeforeSending, 1, 0, 1, 2 );
345 connect( mCheckSpellingBeforeSending, SIGNAL(stateChanged(
int)),
349 mSendOnCheckCombo =
new KComboBox( group );
350 mSendOnCheckCombo->setEditable(
false );
351 mSendOnCheckCombo->addItems( QStringList()
352 << i18n(
"Never Automatically")
353 << i18n(
"On Manual Mail Checks")
354 << i18n(
"On All Mail Checks") );
355 glay->addWidget( mSendOnCheckCombo, 2, 1 );
356 connect( mSendOnCheckCombo, SIGNAL(activated(
int)),
360 mSendMethodCombo =
new KComboBox( group );
361 mSendMethodCombo->setEditable(
false );
362 mSendMethodCombo->addItems( QStringList()
364 << i18n(
"Send Later") );
365 glay->addWidget( mSendMethodCombo, 3, 1 );
366 connect( mSendMethodCombo, SIGNAL(activated(
int)),
370 mDefaultDomainEdit =
new KLineEdit( group );
371 glay->addWidget( mDefaultDomainEdit, 4, 1 );
372 connect( mDefaultDomainEdit, SIGNAL(textChanged(QString)),
376 QLabel *l =
new QLabel( i18n(
"Send &messages in outbox folder:"), group );
377 l->setBuddy( mSendOnCheckCombo );
378 glay->addWidget( l, 2, 0 );
381 l->setWhatsThis( msg );
382 mSendOnCheckCombo->setWhatsThis( msg );
384 l =
new QLabel( i18n(
"Defa&ult send method:"), group );
385 l->setBuddy( mSendMethodCombo );
386 glay->addWidget( l, 3, 0 );
387 l =
new QLabel( i18n(
"Defaul&t domain:"), group );
388 l->setBuddy( mDefaultDomainEdit );
389 glay->addWidget( l, 4, 0 );
392 msg = i18n(
"<qt><p>The default domain is used to complete email "
393 "addresses that only consist of the user's name."
395 l->setWhatsThis( msg );
396 mDefaultDomainEdit->setWhatsThis( msg );
399 void AccountsPage::SendingTab::doLoadFromGlobalSettings()
404 void AccountsPage::SendingTab::doLoadOther()
406 mSendMethodCombo->setCurrentIndex( MessageComposer::MessageComposerSettings::self()->sendImmediate() ? 0 : 1 );
409 QString defaultDomain = MessageComposer::MessageComposerSettings::defaultDomain();
410 if( defaultDomain.isEmpty() ) {
411 defaultDomain = QHostInfo::localHostName();
413 mDefaultDomainEdit->setText( defaultDomain );
419 MessageComposer::MessageComposerSettings::self()->setDefaultDomain( mDefaultDomainEdit->text() );
422 MessageComposer::MessageComposerSettings::self()->setSendImmediate( mSendMethodCombo->currentIndex() == 0 );
427 return QString::fromLatin1(
"configure-accounts-receiving");
433 mNewMailNotifierInterface =
new OrgFreedesktopAkonadiNewMailNotifierInterface(QLatin1String(
"org.freedesktop.Akonadi.NewMailNotifierAgent"), QLatin1String(
"/NewMailNotifierAgent"), QDBusConnection::sessionBus(),
this);
434 if (!mNewMailNotifierInterface->isValid()) {
435 kDebug()<<
" org.freedesktop.Akonadi.NewMailNotifierAgent not found. Please verify your installation";
437 mAccountsReceiving.setupUi(
this );
439 mAccountsReceiving.vlay->setSpacing( KDialog::spacingHint() );
440 mAccountsReceiving.vlay->setMargin( KDialog::marginHint() );
442 mAccountsReceiving.mAccountList->agentFilterProxyModel()->addMimeTypeFilter( KMime::Message::mimeType() );
443 #ifdef MERGE_KNODE_IN_KMAIL
444 mAccountsReceiving.mAccountList->agentFilterProxyModel()->addMimeTypeFilter( QString::fromLatin1(
"message/news") );
447 mAccountsReceiving.mAccountList->agentFilterProxyModel()->addCapabilityFilter( QLatin1String(
"Resource") );
448 mAccountsReceiving.mAccountList->agentFilterProxyModel()->excludeCapabilities( QLatin1String(
"MailTransport") );
449 mAccountsReceiving.mAccountList->agentFilterProxyModel()->excludeCapabilities( QLatin1String(
"Notes") );
450 mAccountsReceiving.mAccountList->view()->setSelectionMode( QAbstractItemView::SingleSelection );
452 mAccountsReceiving.mFilterAccount->setProxy( mAccountsReceiving.mAccountList->agentFilterProxyModel() );
453 mAccountsReceiving.mFilterAccount->lineEdit()->setTrapReturnKey(
true );
455 KConfig specialMailCollection(QLatin1String(
"specialmailcollectionsrc"));
456 if(specialMailCollection.hasGroup(QLatin1String(
"SpecialCollections"))) {
457 KConfigGroup grp = specialMailCollection.group(QLatin1String(
"SpecialCollections"));
458 mSpecialMailCollectionIdentifier = grp.readEntry(QLatin1String(
"DefaultResourceId"));
462 mAccountsReceiving.mAccountList->view()->setItemDelegate( configDelegate );
463 connect( configDelegate, SIGNAL(optionsClicked(QString,QPoint)),
this, SLOT(slotShowMailCheckMenu(QString,QPoint)) );
465 connect( mAccountsReceiving.mAccountList, SIGNAL(clicked(Akonadi::AgentInstance)),
466 SLOT(slotAccountSelected(Akonadi::AgentInstance)) );
467 connect( mAccountsReceiving.mAccountList, SIGNAL(doubleClicked(Akonadi::AgentInstance)),
468 this, SLOT(slotModifySelectedAccount()) );
470 mAccountsReceiving.hlay->insertWidget(0, mAccountsReceiving.mAccountList);
472 connect( mAccountsReceiving.mAddAccountButton, SIGNAL(clicked()),
473 this, SLOT(slotAddAccount()) );
475 connect( mAccountsReceiving.mModifyAccountButton, SIGNAL(clicked()),
476 this, SLOT(slotModifySelectedAccount()) );
478 connect( mAccountsReceiving.mRemoveAccountButton, SIGNAL(clicked()),
479 this, SLOT(slotRemoveSelectedAccount()) );
480 connect( mAccountsReceiving.mRestartAccountButton, SIGNAL(clicked()),
481 this, SLOT(slotRestartSelectedAccount()) );
483 mAccountsReceiving.group->layout()->setMargin( KDialog::marginHint() );
484 mAccountsReceiving.group->layout()->setSpacing( KDialog::spacingHint() );
486 connect( mAccountsReceiving.mBeepNewMailCheck, SIGNAL(stateChanged(
int)),
489 connect( mAccountsReceiving.mVerboseNotificationCheck, SIGNAL(stateChanged(
int)),
492 connect( mAccountsReceiving.mOtherNewMailActionsButton, SIGNAL(clicked()),
493 this, SLOT(slotEditNotifications()) );
494 connect( mAccountsReceiving.customizeAccountOrder,SIGNAL(clicked()),
this,SLOT(slotCustomizeAccountOrder()));
496 slotAccountSelected( mAccountsReceiving.mAccountList->currentAgentInstance() );
502 delete mNewMailNotifierInterface;
503 mRetrievalHash.clear();
506 void AccountsPageReceivingTab::slotCustomizeAccountOrder()
512 void AccountsPageReceivingTab::slotShowMailCheckMenu(
const QString &ident,
const QPoint & pos )
516 bool IncludeInManualChecks;
517 bool OfflineOnShutdown;
519 if( !mRetrievalHash.contains( ident ) ) {
521 const QString resourceGroupPattern( QLatin1String(
"Resource %1") );
522 KConfigGroup group(
KMKernel::self()->config(), resourceGroupPattern.arg( ident ) );
524 IncludeInManualChecks = group.readEntry(
"IncludeInManualChecks",
true );
527 OfflineOnShutdown = group.readEntry(
"OfflineOnShutdown",
false );
529 CheckOnStartup = group.readEntry(
"CheckOnStartup",
false );
531 mRetrievalHash.insert( ident, opts );
534 IncludeInManualChecks = opts->IncludeInManualChecks;
535 OfflineOnShutdown = opts->OfflineOnShutdown;
536 CheckOnStartup = opts->CheckOnStartup;
539 if ( !MailCommon::Util::isVirtualCollection( ident ) ) {
540 QAction *manualMailCheck =
new QAction( i18nc(
"Label to a checkbox, so is either checked/unchecked",
"Include in Manual Mail Check" ), menu );
541 manualMailCheck->setCheckable(
true );
542 manualMailCheck->setChecked( IncludeInManualChecks );
543 manualMailCheck->setData( ident );
544 menu->addAction( manualMailCheck );
545 connect( manualMailCheck, SIGNAL(toggled(
bool)),
this, SLOT(slotIncludeInCheckChanged(
bool)) );
548 if( !MailCommon::Util::isLocalCollection( ident ) ) {
549 QAction *switchOffline =
new QAction( i18nc(
"Label to a checkbox, so is either checked/unchecked",
"Switch offline on KMail Shutdown" ), menu );
550 switchOffline->setCheckable(
true );
551 switchOffline->setChecked( OfflineOnShutdown );
552 switchOffline->setData( ident );
553 menu->addAction( switchOffline );
554 connect( switchOffline, SIGNAL(toggled(
bool)),
this, SLOT(slotOfflineOnShutdownChanged(
bool)) );
558 QAction *checkOnStartup =
new QAction( i18n(
"Check mail on startup" ), menu );
559 checkOnStartup->setCheckable(
true );
560 checkOnStartup->setChecked( CheckOnStartup );
561 checkOnStartup->setData( ident );
562 menu->addAction( checkOnStartup );
564 connect( checkOnStartup, SIGNAL(toggled(
bool)),
this, SLOT(slotCheckOnStatupChanged(
bool)) );
566 menu->exec( mAccountsReceiving.mAccountList->view()->mapToGlobal( pos ) );
570 void AccountsPageReceivingTab::slotCheckOnStatupChanged(
bool checked )
572 QAction* action = qobject_cast< QAction* >( sender() );
573 const QString ident = action->data().toString();
576 opts->CheckOnStartup = checked;
581 void AccountsPageReceivingTab::slotIncludeInCheckChanged(
bool checked )
583 QAction* action = qobject_cast< QAction* >( sender() );
584 const QString ident = action->data().toString();
587 opts->IncludeInManualChecks = checked;
591 void AccountsPageReceivingTab::slotOfflineOnShutdownChanged(
bool checked )
593 QAction* action = qobject_cast< QAction* >( sender() );
594 QString ident = action->data().toString();
597 opts->OfflineOnShutdown = checked;
601 void AccountsPage::ReceivingTab::slotAccountSelected(
const Akonadi::AgentInstance& current)
603 if ( !current.isValid() ) {
604 mAccountsReceiving.mModifyAccountButton->setEnabled(
false );
605 mAccountsReceiving.mRemoveAccountButton->setEnabled(
false );
606 mAccountsReceiving.mRestartAccountButton->setEnabled(
false );
608 mAccountsReceiving.mModifyAccountButton->setEnabled( !current.type().capabilities().contains( QLatin1String(
"NoConfig" ) ) );
609 mAccountsReceiving.mRemoveAccountButton->setEnabled( mSpecialMailCollectionIdentifier != current.identifier() );
611 mAccountsReceiving.mRestartAccountButton->setEnabled( ( current.status() != 1 ) );
615 void AccountsPage::ReceivingTab::slotAddAccount()
617 Akonadi::AgentTypeDialog dlg(
this );
618 Akonadi::AgentFilterProxyModel* filter = dlg.agentFilterProxyModel();
619 filter->addMimeTypeFilter( QLatin1String(
"message/rfc822") );
620 filter->addCapabilityFilter( QLatin1String(
"Resource") );
621 filter->excludeCapabilities( QLatin1String(
"MailTransport") );
622 filter->excludeCapabilities( QLatin1String(
"Notes") );
624 const Akonadi::AgentType agentType = dlg.agentType();
626 if ( agentType.isValid() ) {
628 Akonadi::AgentInstanceCreateJob *job =
new Akonadi::AgentInstanceCreateJob( agentType,
this );
629 job->configure(
this );
635 void AccountsPage::ReceivingTab::slotModifySelectedAccount()
637 Akonadi::AgentInstance instance = mAccountsReceiving.mAccountList->currentAgentInstance();
638 if ( instance.isValid() ) {
639 KWindowSystem::allowExternalProcessWindowActivation();
640 instance.configure(
this );
646 void AccountsPage::ReceivingTab::slotRestartSelectedAccount()
648 const Akonadi::AgentInstance instance = mAccountsReceiving.mAccountList->currentAgentInstance();
649 if ( instance.isValid() ) {
654 void AccountsPage::ReceivingTab::slotRemoveSelectedAccount()
656 const Akonadi::AgentInstance instance = mAccountsReceiving.mAccountList->currentAgentInstance();
658 int rc = KMessageBox::questionYesNo(
this,
659 i18n(
"Do you want to remove account '%1'?", instance.name()),
660 i18n(
"Remove account?"));
661 if ( rc == KMessageBox::No ) {
665 if ( instance.isValid() )
666 Akonadi::AgentManager::self()->removeInstance( instance );
668 slotAccountSelected( mAccountsReceiving.mAccountList->currentAgentInstance() );
672 void AccountsPage::ReceivingTab::slotEditNotifications()
674 QDBusInterface interface( QLatin1String(
"org.freedesktop.Akonadi.Agent.akonadi_newmailnotifier_agent"), QLatin1String(
"/NewMailNotifierAgent") );
675 if (interface.isValid()) {
676 interface.call(QLatin1String(
"showConfigureDialog"), (qlonglong)winId());
678 KMessageBox::error(
this, i18n(
"New Mail Notifier Agent not registered. Please contact your administrator."));
682 void AccountsPage::ReceivingTab::doLoadFromGlobalSettings()
684 mAccountsReceiving.mVerboseNotificationCheck->setChecked( mNewMailNotifierInterface->verboseMailNotification() );
687 void AccountsPage::ReceivingTab::doLoadOther()
689 mAccountsReceiving.mBeepNewMailCheck->setChecked( mNewMailNotifierInterface->beepOnNewMails() );
695 mNewMailNotifierInterface->setBeepOnNewMails( mAccountsReceiving.mBeepNewMailCheck->isChecked() );
696 mNewMailNotifierInterface->setVerboseMailNotification( mAccountsReceiving.mVerboseNotificationCheck->isChecked() );
698 const QString resourceGroupPattern( QLatin1String(
"Resource %1") );
699 QHashIterator<QString, QSharedPointer<RetrievalOptions> > it( mRetrievalHash );
700 while( it.hasNext() ) {
702 KConfigGroup group(
KMKernel::self()->config(), resourceGroupPattern.arg( it.key() ) );
704 group.writeEntry(
"IncludeInManualChecks", opts->IncludeInManualChecks);
705 group.writeEntry(
"OfflineOnShutdown", opts->OfflineOnShutdown);
706 group.writeEntry(
"CheckOnStartup", opts->CheckOnStartup);
717 return QString::fromLatin1(
"configure-appearance");
727 addTab( mFontsTab, i18n(
"Fonts") );
733 addTab( mColorsTab, i18n(
"Colors") );
739 addTab( mLayoutTab, i18n(
"Layout") );
745 addTab( mHeadersTab, i18n(
"Message List") );
751 addTab( mReaderTab, i18n(
"Message Window") );
752 addConfig( MessageViewer::GlobalSettings::self(), mReaderTab );
758 addTab( mSystemTrayTab, i18n(
"System Tray") );
764 addTab( mMessageTagTab, i18n(
"Message Tags") );
770 return QString::fromLatin1(
"configure-appearance-fonts");
773 static const struct {
779 {
"body-font", I18N_NOOP(
"Message Body"),
true,
false },
780 {
"MessageListFont", I18N_NOOP(
"Message List"),
true,
false },
781 {
"UnreadMessageFont", I18N_NOOP(
"Message List - Unread Messages"),
true,
false },
782 {
"ImportantMessageFont", I18N_NOOP(
"Message List - Important Messages"),
true,
false },
783 {
"TodoMessageFont", I18N_NOOP(
"Message List - Action Item Messages"),
true,
false },
784 {
"folder-font", I18N_NOOP(
"Folder List"),
true,
false },
785 {
"quote1-font", I18N_NOOP(
"Quoted Text - First Level"),
false,
false },
786 {
"quote2-font", I18N_NOOP(
"Quoted Text - Second Level"),
false,
false },
787 {
"quote3-font", I18N_NOOP(
"Quoted Text - Third Level"),
false,
false },
788 {
"fixed-font", I18N_NOOP(
"Fixed Width Font"),
true,
true },
789 {
"composer-font", I18N_NOOP(
"Composer"),
true,
false },
790 {
"print-font", I18N_NOOP(
"Printing Output"),
true,
false },
804 vlay =
new QVBoxLayout(
this );
805 vlay->setSpacing( KDialog::spacingHint() );
806 vlay->setMargin( KDialog::marginHint() );
807 mCustomFontCheck =
new QCheckBox( i18n(
"&Use custom fonts"),
this );
808 vlay->addWidget( mCustomFontCheck );
809 vlay->addWidget(
new KSeparator( Qt::Horizontal,
this ) );
810 connect ( mCustomFontCheck, SIGNAL(stateChanged(
int)),
814 hlay =
new QHBoxLayout();
815 vlay->addLayout( hlay );
816 mFontLocationCombo =
new KComboBox(
this );
817 mFontLocationCombo->setEditable(
false );
818 mFontLocationCombo->setEnabled(
false );
820 QStringList fontDescriptions;
823 mFontLocationCombo->addItems( fontDescriptions );
825 label =
new QLabel( i18n(
"Apply &to:"),
this );
826 label->setBuddy( mFontLocationCombo );
827 label->setEnabled(
false );
828 hlay->addWidget( label );
830 hlay->addWidget( mFontLocationCombo );
831 hlay->addStretch( 10 );
832 vlay->addSpacing( KDialog::spacingHint() );
833 mFontChooser =
new KFontChooser(
this, KFontChooser::DisplayFrame,
835 mFontChooser->setEnabled(
false );
836 vlay->addWidget( mFontChooser );
837 connect ( mFontChooser, SIGNAL(fontSelected(QFont)),
842 connect( mCustomFontCheck, SIGNAL(toggled(
bool)),
843 label, SLOT(setEnabled(
bool)) );
844 connect( mCustomFontCheck, SIGNAL(toggled(
bool)),
845 mFontLocationCombo, SLOT(setEnabled(
bool)) );
846 connect( mCustomFontCheck, SIGNAL(toggled(
bool)),
847 mFontChooser, SLOT(setEnabled(
bool)) );
849 connect( mFontLocationCombo, SIGNAL(activated(
int)),
850 this, SLOT(slotFontSelectorChanged(
int)) );
854 void AppearancePage::FontsTab::slotFontSelectorChanged(
int index )
856 kDebug() <<
"slotFontSelectorChanged() called";
857 if( index < 0 || index >= mFontLocationCombo->count() )
861 if( mActiveFontIndex == 0 ) {
862 mFont[0] = mFontChooser->font();
869 mFont[i].setFamily( mFont[0].family() );
870 mFont[i].setPointSize( mFont[0].pointSize() );
872 }
else if ( mActiveFontIndex > 0 )
873 mFont[ mActiveFontIndex ] = mFontChooser->font();
874 mActiveFontIndex = index;
877 disconnect ( mFontChooser, SIGNAL(fontSelected(QFont)),
883 connect ( mFontChooser, SIGNAL(fontSelected(QFont)),
887 mFontChooser->enableColumn( KFontChooser::FamilyList|KFontChooser::SizeList,
888 fontNames[ index ].enableFamilyAndSize );
891 void AppearancePage::FontsTab::doLoadOther()
894 KConfigGroup messagelistFont(
KMKernel::self()->config(),
"MessageListView::Fonts" );
896 mFont[0] = KGlobalSettings::generalFont();
897 QFont fixedFont = KGlobalSettings::fixedFont();
901 if ( configName == QLatin1String(
"MessageListFont" ) ||
902 configName == QLatin1String(
"UnreadMessageFont" ) ||
903 configName == QLatin1String(
"ImportantMessageFont" ) ||
904 configName == QLatin1String(
"TodoMessageFont" ) ) {
905 mFont[i] = messagelistFont.readEntry( configName,
906 (
fontNames[i].onlyFixed) ? fixedFont : mFont[0] );
908 mFont[i] = fonts.readEntry( configName,
909 (
fontNames[i].onlyFixed) ? fixedFont : mFont[0] );
912 mCustomFontCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultFonts() );
913 mFontLocationCombo->setCurrentIndex( 0 );
914 slotFontSelectorChanged( 0 );
920 KConfigGroup messagelistFont(
KMKernel::self()->config(),
"MessageListView::Fonts" );
923 if ( mActiveFontIndex >= 0 )
924 mFont[ mActiveFontIndex ] = mFontChooser->font();
926 const bool customFonts = mCustomFontCheck->isChecked();
927 MessageCore::GlobalSettings::self()->setUseDefaultFonts( !customFonts );
930 const QString configName = QLatin1String(
fontNames[i].configName);
931 if ( configName == QLatin1String(
"MessageListFont" ) ||
932 configName == QLatin1String(
"UnreadMessageFont" ) ||
933 configName == QLatin1String(
"ImportantMessageFont" ) ||
934 configName == QLatin1String(
"TodoMessageFont" ) ) {
935 if ( customFonts || messagelistFont.hasKey( configName ) ) {
938 messagelistFont.writeEntry( configName, mFont[i] );
941 if ( customFonts || fonts.hasKey( configName ) )
944 fonts.writeEntry( configName, mFont[i] );
949 void AppearancePage::FontsTab::doResetToDefaultsOther()
951 mCustomFontCheck->setChecked(
false );
957 return QString::fromLatin1(
"configure-appearance-colors");
960 static const struct {
964 {
"QuotedText1", I18N_NOOP(
"Quoted Text - First Level") },
965 {
"QuotedText2", I18N_NOOP(
"Quoted Text - Second Level") },
966 {
"QuotedText3", I18N_NOOP(
"Quoted Text - Third Level") },
967 {
"LinkColor", I18N_NOOP(
"Link") },
968 {
"FollowedColor", I18N_NOOP(
"Followed Link") },
969 {
"MisspelledColor", I18N_NOOP(
"Misspelled Words") },
970 {
"UnreadMessageColor", I18N_NOOP(
"Unread Message") },
971 {
"ImportantMessageColor", I18N_NOOP(
"Important Message") },
972 {
"TodoMessageColor", I18N_NOOP(
"Action Item Message") },
973 {
"PGPMessageEncr", I18N_NOOP(
"OpenPGP Message - Encrypted") },
974 {
"PGPMessageOkKeyOk", I18N_NOOP(
"OpenPGP Message - Valid Signature with Trusted Key") },
975 {
"PGPMessageOkKeyBad", I18N_NOOP(
"OpenPGP Message - Valid Signature with Untrusted Key") },
976 {
"PGPMessageWarn", I18N_NOOP(
"OpenPGP Message - Unchecked Signature") },
977 {
"PGPMessageErr", I18N_NOOP(
"OpenPGP Message - Bad Signature") },
978 {
"HTMLWarningColor", I18N_NOOP(
"Border Around Warning Prepending HTML Messages") },
979 {
"CloseToQuotaColor", I18N_NOOP(
"Folder Name and Size When Close to Quota") },
980 {
"ColorbarBackgroundPlain", I18N_NOOP(
"HTML Status Bar Background - No HTML Message") },
981 {
"ColorbarForegroundPlain", I18N_NOOP(
"HTML Status Bar Foreground - No HTML Message") },
982 {
"ColorbarBackgroundHTML", I18N_NOOP(
"HTML Status Bar Background - HTML Message") },
983 {
"ColorbarForegroundHTML", I18N_NOOP(
"HTML Status Bar Foreground - HTML Message") },
984 {
"BrokenAccountColor", I18N_NOOP(
"Broken Account - Folder Text Color") },
985 {
"BackgroundColor", I18N_NOOP(
"Background Color") },
996 vlay =
new QVBoxLayout(
this );
997 vlay->setSpacing( KDialog::spacingHint() );
998 vlay->setMargin( KDialog::marginHint() );
999 mCustomColorCheck =
new QCheckBox( i18n(
"&Use custom colors"),
this );
1000 vlay->addWidget( mCustomColorCheck );
1001 connect( mCustomColorCheck, SIGNAL(stateChanged(
int)),
1006 mColorList->setEnabled(
false );
1009 vlay->addWidget( mColorList, 1 );
1012 mRecycleColorCheck =
1013 new QCheckBox( i18n(
"Recycle colors on deep "ing"),
this );
1014 mRecycleColorCheck->setEnabled(
false );
1015 vlay->addWidget( mRecycleColorCheck );
1016 connect( mRecycleColorCheck, SIGNAL(stateChanged(
int)),
1020 QHBoxLayout *hbox =
new QHBoxLayout();
1021 vlay->addLayout( hbox );
1022 QLabel *l =
new QLabel( i18n(
"Close to quota threshold:"),
this );
1023 hbox->addWidget( l );
1024 mCloseToQuotaThreshold =
new QSpinBox(
this );
1025 mCloseToQuotaThreshold->setRange( 0, 100 );
1026 mCloseToQuotaThreshold->setSingleStep( 1 );
1027 connect( mCloseToQuotaThreshold, SIGNAL(valueChanged(
int)),
1029 mCloseToQuotaThreshold->setSuffix( i18n(
"%"));
1031 hbox->addWidget( mCloseToQuotaThreshold );
1032 hbox->addWidget(
new QWidget(
this), 2 );
1035 connect( mCustomColorCheck, SIGNAL(toggled(
bool)),
1036 mColorList, SLOT(setEnabled(
bool)) );
1037 connect( mCustomColorCheck, SIGNAL(toggled(
bool)),
1038 mRecycleColorCheck, SLOT(setEnabled(
bool)) );
1039 connect( mCustomColorCheck, SIGNAL(stateChanged(
int)),
1041 connect( mColorList, SIGNAL(
changed()),
1045 void AppearancePage::ColorsTab::doLoadOther()
1047 mCustomColorCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultColors() );
1048 mRecycleColorCheck->setChecked( MessageViewer::GlobalSettings::self()->recycleQuoteColors() );
1053 void AppearancePage::ColorsTab::loadColor(
bool loadFromConfig )
1055 KColorScheme scheme( QPalette::Active, KColorScheme::View );
1059 KConfigGroup messageListView(
KMKernel::self()->config(),
"MessageListView::Colors" );
1061 KConfigGroup collectionFolderView(
KMKernel::self()->config(),
"CollectionFolderView" );
1067 scheme.foreground( KColorScheme::LinkText ).color(),
1068 scheme.foreground( KColorScheme::VisitedText ).color(),
1069 scheme.foreground( KColorScheme::NegativeText ).color(),
1070 MessageList::Util::unreadDefaultMessageColor(),
1071 MessageList::Util::importantDefaultMessageColor(),
1072 MessageList::Util::todoDefaultMessageColor(),
1073 QColor( 0x00, 0x80, 0xFF ),
1074 scheme.background( KColorScheme::PositiveBackground ).color(),
1075 QColor( 0xFF, 0xFF, 0x40 ),
1076 QColor( 0xFF, 0xFF, 0x40 ),
1078 QColor( 0xFF, 0x40, 0x40 ),
1079 MailCommon::Util::defaultQuotaColor(),
1084 scheme.foreground(KColorScheme::NegativeText).color(),
1085 scheme.background().color()
1089 if ( loadFromConfig ) {
1090 const QString configName = QLatin1String(
colorNames[i].configName);
1091 if ( configName == QLatin1String(
"UnreadMessageColor" ) ||
1092 configName == QLatin1String(
"ImportantMessageColor" ) ||
1093 configName == QLatin1String(
"TodoMessageColor" ) ) {
1094 mColorList->
setColorSilently( i, messageListView.readEntry( configName, defaultColor[i] ) );
1095 }
else if( configName == QLatin1String(
"BrokenAccountColor")) {
1096 mColorList->
setColorSilently( i, collectionFolderView.readEntry(configName,defaultColor[i]));
1098 mColorList->
setColorSilently( i, reader.readEntry( configName, defaultColor[i] ) );
1106 void AppearancePage::ColorsTab::doResetToDefaultsOther()
1108 mCustomColorCheck->setChecked(
false );
1109 mRecycleColorCheck->setChecked(
false );
1110 mCloseToQuotaThreshold->setValue( 80 );
1117 KConfigGroup messageListView(
KMKernel::self()->config(),
"MessageListView::Colors" );
1118 KConfigGroup collectionFolderView(
KMKernel::self()->config(),
"CollectionFolderView" );
1119 bool customColors = mCustomColorCheck->isChecked();
1120 MessageCore::GlobalSettings::self()->setUseDefaultColors( !customColors );
1122 KColorScheme scheme( QPalette::Active, KColorScheme::View );
1127 const QString configName = QLatin1String(
colorNames[i].configName);
1128 if ( configName == QLatin1String(
"UnreadMessageColor" ) ||
1129 configName == QLatin1String(
"ImportantMessageColor" ) ||
1130 configName == QLatin1String(
"TodoMessageColor" ) ) {
1131 if ( customColors || messageListView.hasKey( configName ) )
1132 messageListView.writeEntry( configName, mColorList->
color(i) );
1134 }
else if( configName == QLatin1String(
"BrokenAccountColor")) {
1135 if ( customColors || collectionFolderView.hasKey( configName ) )
1136 collectionFolderView.writeEntry(configName,mColorList->
color(i));
1137 }
else if (configName == QLatin1String(
"BackgroundColor")) {
1138 if (customColors && (mColorList->
color(i) != scheme.background().color() ))
1139 reader.writeEntry(configName, mColorList->
color(i));
1141 if ( customColors || reader.hasKey( configName ) )
1142 reader.writeEntry( configName, mColorList->
color(i) );
1145 MessageViewer::GlobalSettings::self()->setRecycleQuoteColors( mRecycleColorCheck->isChecked() );
1151 return QString::fromLatin1(
"configure-appearance-layout");
1160 vlay =
new QVBoxLayout(
this );
1161 vlay->setSpacing( KDialog::spacingHint() );
1162 vlay->setMargin( KDialog::marginHint() );
1165 populateButtonGroup( mFolderListGroupBox =
new QGroupBox(
this ),
1166 mFolderListGroup =
new QButtonGroup(
this ),
1168 vlay->addWidget( mFolderListGroupBox );
1169 connect( mFolderListGroup, SIGNAL (buttonClicked(
int)),
1172 QHBoxLayout* folderCBHLayout =
new QHBoxLayout();
1173 mFolderQuickSearchCB =
new QCheckBox( i18n(
"Show folder quick search field"),
this );
1174 connect( mFolderQuickSearchCB, SIGNAL(toggled(
bool)), SLOT(
slotEmitChanged()) );
1175 folderCBHLayout->addWidget( mFolderQuickSearchCB );
1176 vlay->addLayout( folderCBHLayout );
1177 vlay->addSpacing( KDialog::spacingHint() );
1180 mFavoriteFoldersViewGroupBox =
new QGroupBox(
this );
1181 mFavoriteFoldersViewGroupBox->setTitle( i18n(
"Show Favorite Folders View" ) );
1182 mFavoriteFoldersViewGroupBox->setLayout(
new QHBoxLayout() );
1183 mFavoriteFoldersViewGroupBox->layout()->setSpacing( KDialog::spacingHint() );
1184 mFavoriteFoldersViewGroup =
new QButtonGroup(
this );
1185 connect( mFavoriteFoldersViewGroup, SIGNAL(buttonClicked(
int)),
1188 QRadioButton* favoriteFoldersViewHiddenRadio =
new QRadioButton( i18n(
"Never" ), mFavoriteFoldersViewGroupBox );
1189 mFavoriteFoldersViewGroup->addButton( favoriteFoldersViewHiddenRadio, static_cast<int>( MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::HiddenMode ) );
1190 mFavoriteFoldersViewGroupBox->layout()->addWidget( favoriteFoldersViewHiddenRadio );
1192 QRadioButton* favoriteFoldersViewIconsRadio =
new QRadioButton( i18n(
"As icons" ), mFavoriteFoldersViewGroupBox );
1193 mFavoriteFoldersViewGroup->addButton( favoriteFoldersViewIconsRadio, static_cast<int>( MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::IconMode ) );
1194 mFavoriteFoldersViewGroupBox->layout()->addWidget( favoriteFoldersViewIconsRadio );
1196 QRadioButton* favoriteFoldersViewListRadio =
new QRadioButton( i18n(
"As list" ), mFavoriteFoldersViewGroupBox );
1197 mFavoriteFoldersViewGroup->addButton( favoriteFoldersViewListRadio, static_cast<int>( MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::ListMode ) );
1198 mFavoriteFoldersViewGroupBox->layout()->addWidget( favoriteFoldersViewListRadio );
1200 vlay->addWidget( mFavoriteFoldersViewGroupBox );
1204 mFolderToolTipsGroupBox =
new QGroupBox(
this );
1205 mFolderToolTipsGroupBox->setTitle( i18n(
"Folder Tooltips" ) );
1206 mFolderToolTipsGroupBox->setLayout(
new QHBoxLayout() );
1207 mFolderToolTipsGroupBox->layout()->setSpacing( KDialog::spacingHint() );
1208 mFolderToolTipsGroup =
new QButtonGroup(
this );
1209 connect( mFolderToolTipsGroup, SIGNAL(buttonClicked(
int)),
1212 QRadioButton* folderToolTipsAlwaysRadio =
new QRadioButton( i18n(
"Always" ), mFolderToolTipsGroupBox );
1213 mFolderToolTipsGroup->addButton( folderToolTipsAlwaysRadio, static_cast< int >( FolderTreeWidget::DisplayAlways ) );
1214 mFolderToolTipsGroupBox->layout()->addWidget( folderToolTipsAlwaysRadio );
1216 QRadioButton* folderToolTipsNeverRadio =
new QRadioButton( i18n(
"Never" ), mFolderToolTipsGroupBox );
1217 mFolderToolTipsGroup->addButton( folderToolTipsNeverRadio, static_cast< int >( FolderTreeWidget::DisplayNever ) );
1218 mFolderToolTipsGroupBox->layout()->addWidget( folderToolTipsNeverRadio );
1220 vlay->addWidget( mFolderToolTipsGroupBox );
1223 populateButtonGroup( mReaderWindowModeGroupBox =
new QGroupBox(
this ),
1224 mReaderWindowModeGroup =
new QButtonGroup(
this ),
1226 vlay->addWidget( mReaderWindowModeGroupBox );
1227 connect( mReaderWindowModeGroup, SIGNAL (buttonClicked(
int)),
1230 vlay->addStretch( 10 );
1233 void AppearancePage::LayoutTab::doLoadOther()
1236 loadWidget( mReaderWindowModeGroupBox, mReaderWindowModeGroup,
GlobalSettings::self()->readerWindowModeItem() );
1237 loadWidget( mFavoriteFoldersViewGroupBox, mFavoriteFoldersViewGroup, MailCommon::MailCommonSettings::self()->favoriteCollectionViewModeItem() );
1240 if ( checkedFolderToolTipsPolicy < mFolderToolTipsGroup->buttons().size() && checkedFolderToolTipsPolicy >= 0 )
1241 mFolderToolTipsGroup->buttons()[ checkedFolderToolTipsPolicy ]->setChecked(
true );
1248 saveButtonGroup( mFavoriteFoldersViewGroup, MailCommon::MailCommonSettings::self()->favoriteCollectionViewModeItem() );
1259 return QString::fromLatin1(
"configure-appearance-headers");
1262 static const struct {
1266 { I18N_NOOP(
"Sta&ndard format (%1)"), KMime::DateFormatter::CTime },
1267 { I18N_NOOP(
"Locali&zed format (%1)"), KMime::DateFormatter::Localized },
1268 { I18N_NOOP(
"Smart for&mat (%1)"), KMime::DateFormatter::Fancy },
1269 { I18N_NOOP(
"C&ustom format:"), KMime::DateFormatter::Custom }
1276 mCustomDateFormatEdit( 0 )
1281 QVBoxLayout * vlay =
new QVBoxLayout(
this );
1282 vlay->setSpacing( KDialog::spacingHint() );
1283 vlay->setMargin( KDialog::marginHint() );
1286 group =
new QGroupBox( i18nc(
"General options for the message list.",
"General" ),
this );
1288 QVBoxLayout *gvlay =
new QVBoxLayout( group );
1289 gvlay->setSpacing( KDialog::spacingHint() );
1291 mDisplayMessageToolTips =
new QCheckBox(
1292 MessageList::Core::Settings::self()->messageToolTipEnabledItem()->label(), group );
1293 gvlay->addWidget( mDisplayMessageToolTips );
1295 connect( mDisplayMessageToolTips, SIGNAL(stateChanged(
int)),
1298 mHideTabBarWithSingleTab =
new QCheckBox(
1299 MessageList::Core::Settings::self()->autoHideTabBarWithSingleTabItem()->label(), group );
1300 gvlay->addWidget( mHideTabBarWithSingleTab );
1302 connect( mHideTabBarWithSingleTab, SIGNAL(stateChanged(
int)),
1305 mTabsHaveCloseButton =
new QCheckBox(
1306 MessageList::Core::Settings::self()->tabsHaveCloseButtonItem()->label(), group );
1307 gvlay->addWidget( mTabsHaveCloseButton );
1309 connect( mTabsHaveCloseButton, SIGNAL(stateChanged(
int)),
1313 using MessageList::Utils::AggregationComboBox;
1314 mAggregationComboBox =
new AggregationComboBox( group );
1316 QLabel* aggregationLabel =
new QLabel( i18n(
"Default aggregation:" ), group );
1317 aggregationLabel->setBuddy( mAggregationComboBox );
1319 using MessageList::Utils::AggregationConfigButton;
1320 AggregationConfigButton * aggregationConfigButton =
new AggregationConfigButton( group, mAggregationComboBox );
1322 QHBoxLayout * aggregationLayout =
new QHBoxLayout();
1323 aggregationLayout->addWidget( aggregationLabel, 1 );
1324 aggregationLayout->addWidget( mAggregationComboBox, 1 );
1325 aggregationLayout->addWidget( aggregationConfigButton, 0 );
1326 gvlay->addLayout( aggregationLayout );
1328 connect( aggregationConfigButton, SIGNAL(configureDialogCompleted()),
1329 this, SLOT(slotSelectDefaultAggregation()) );
1330 connect( mAggregationComboBox, SIGNAL(activated(
int)),
1334 using MessageList::Utils::ThemeComboBox;
1335 mThemeComboBox =
new ThemeComboBox( group );
1337 QLabel *themeLabel =
new QLabel( i18n(
"Default theme:" ), group );
1338 themeLabel->setBuddy( mThemeComboBox );
1340 using MessageList::Utils::ThemeConfigButton;
1341 ThemeConfigButton * themeConfigButton =
new ThemeConfigButton( group, mThemeComboBox );
1343 QHBoxLayout * themeLayout =
new QHBoxLayout();
1344 themeLayout->addWidget( themeLabel, 1 );
1345 themeLayout->addWidget( mThemeComboBox, 1 );
1346 themeLayout->addWidget( themeConfigButton, 0 );
1347 gvlay->addLayout( themeLayout );
1349 connect( themeConfigButton, SIGNAL(configureDialogCompleted()),
1350 this, SLOT(slotSelectDefaultTheme()) );
1351 connect( mThemeComboBox, SIGNAL(activated(
int)),
1354 vlay->addWidget( group );
1357 mDateDisplay =
new KButtonGroup(
this );
1358 mDateDisplay->setTitle( i18n(
"Date Display") );
1359 gvlay =
new QVBoxLayout( mDateDisplay );
1360 gvlay->setSpacing( KDialog::spacingHint() );
1364 QString buttonLabel;
1365 if ( QString::fromLatin1(label).contains(QLatin1String(
"%1")) )
1368 buttonLabel = i18n( label );
1369 QRadioButton *radio =
new QRadioButton( buttonLabel, mDateDisplay );
1370 gvlay->addWidget( radio );
1374 hbox->setSpacing( KDialog::spacingHint() );
1376 mCustomDateFormatEdit =
new KLineEdit( hbox );
1377 mCustomDateFormatEdit->setEnabled(
false );
1378 hbox->setStretchFactor( mCustomDateFormatEdit, 1 );
1380 connect( radio, SIGNAL(toggled(
bool)),
1381 mCustomDateFormatEdit, SLOT(setEnabled(
bool)) );
1382 connect( mCustomDateFormatEdit, SIGNAL(textChanged(QString)),
1386 i18n(
"<qt><a href=\"whatsthis1\">Custom format information...</a></qt>"), hbox );
1387 connect( formatHelp, SIGNAL(linkActivated(QString)),
1388 SLOT(slotLinkClicked(QString)) );
1390 mCustomDateWhatsThis =
1391 i18n(
"<qt><p><strong>These expressions may be used for the date:"
1394 "<li>d - the day as a number without a leading zero (1-31)</li>"
1395 "<li>dd - the day as a number with a leading zero (01-31)</li>"
1396 "<li>ddd - the abbreviated day name (Mon - Sun)</li>"
1397 "<li>dddd - the long day name (Monday - Sunday)</li>"
1398 "<li>M - the month as a number without a leading zero (1-12)</li>"
1399 "<li>MM - the month as a number with a leading zero (01-12)</li>"
1400 "<li>MMM - the abbreviated month name (Jan - Dec)</li>"
1401 "<li>MMMM - the long month name (January - December)</li>"
1402 "<li>yy - the year as a two digit number (00-99)</li>"
1403 "<li>yyyy - the year as a four digit number (0000-9999)</li>"
1405 "<p><strong>These expressions may be used for the time:"
1408 "<li>h - the hour without a leading zero (0-23 or 1-12 if AM/PM display)</li>"
1409 "<li>hh - the hour with a leading zero (00-23 or 01-12 if AM/PM display)</li>"
1410 "<li>m - the minutes without a leading zero (0-59)</li>"
1411 "<li>mm - the minutes with a leading zero (00-59)</li>"
1412 "<li>s - the seconds without a leading zero (0-59)</li>"
1413 "<li>ss - the seconds with a leading zero (00-59)</li>"
1414 "<li>z - the milliseconds without leading zeroes (0-999)</li>"
1415 "<li>zzz - the milliseconds with leading zeroes (000-999)</li>"
1416 "<li>AP - switch to AM/PM display. AP will be replaced by either \"AM\" or \"PM\".</li>"
1417 "<li>ap - switch to AM/PM display. ap will be replaced by either \"am\" or \"pm\".</li>"
1418 "<li>Z - time zone in numeric form (-0500)</li>"
1420 "<p><strong>All other input characters will be ignored."
1421 "</strong></p></qt>");
1422 mCustomDateFormatEdit->setWhatsThis( mCustomDateWhatsThis );
1423 radio->setWhatsThis( mCustomDateWhatsThis );
1424 gvlay->addWidget( hbox );
1427 vlay->addWidget( mDateDisplay );
1428 connect( mDateDisplay, SIGNAL(clicked(
int)),
1432 vlay->addStretch( 10 );
1435 void AppearancePageHeadersTab::slotLinkClicked(
const QString & link )
1437 if ( link == QLatin1String(
"whatsthis1" ) )
1438 QWhatsThis::showText( QCursor::pos(), mCustomDateWhatsThis );
1441 void AppearancePage::HeadersTab::slotSelectDefaultAggregation()
1444 mAggregationComboBox->selectDefault();
1447 void AppearancePage::HeadersTab::slotSelectDefaultTheme()
1450 mThemeComboBox->selectDefault();
1453 void AppearancePage::HeadersTab::doLoadOther()
1456 mDisplayMessageToolTips->setChecked(
1457 MessageList::Core::Settings::self()->messageToolTipEnabled() );
1459 mHideTabBarWithSingleTab->setChecked(
1460 MessageList::Core::Settings::self()->autoHideTabBarWithSingleTab() );
1462 mTabsHaveCloseButton->setChecked(
1463 MessageList::Core::Settings::self()->tabsHaveCloseButton() );
1466 slotSelectDefaultAggregation();
1469 slotSelectDefaultTheme();
1472 setDateDisplay( MessageCore::GlobalSettings::self()->dateFormat(),
1473 MessageCore::GlobalSettings::self()->customDateFormat() );
1476 void AppearancePage::HeadersTab::doLoadFromGlobalSettings()
1478 mDisplayMessageToolTips->setChecked(
1479 MessageList::Core::Settings::self()->messageToolTipEnabled() );
1481 mHideTabBarWithSingleTab->setChecked(
1482 MessageList::Core::Settings::self()->autoHideTabBarWithSingleTab() );
1484 mTabsHaveCloseButton->setChecked(
1485 MessageList::Core::Settings::self()->tabsHaveCloseButton() );
1488 slotSelectDefaultAggregation();
1491 slotSelectDefaultTheme();
1493 setDateDisplay( MessageCore::GlobalSettings::self()->dateFormat(),
1494 MessageCore::GlobalSettings::self()->customDateFormat() );
1498 void AppearancePage::HeadersTab::setDateDisplay(
int num,
const QString & format )
1501 static_cast<DateFormatter::FormatType
>( num );
1504 if ( dateDisplay == DateFormatter::Custom )
1505 mCustomDateFormatEdit->setText( format );
1509 mDateDisplay->setSelected( i );
1513 mDateDisplay->setSelected( numDateDisplayConfig - 2 );
1518 MessageList::Core::Settings::self()->
1519 setMessageToolTipEnabled( mDisplayMessageToolTips->isChecked() );
1521 MessageList::Core::Settings::self()->
1522 setAutoHideTabBarWithSingleTab( mHideTabBarWithSingleTab->isChecked() );
1524 MessageList::Core::Settings::self()->
1525 setTabsHaveCloseButton( mTabsHaveCloseButton->isChecked() );
1529 mAggregationComboBox->writeDefaultConfig();
1532 mThemeComboBox->writeDefaultConfig();
1534 const int dateDisplayID = mDateDisplay->selected();
1536 if ( ( dateDisplayID >= 0 ) && ( dateDisplayID < numDateDisplayConfig ) ) {
1537 MessageCore::GlobalSettings::self()->setDateFormat(
1540 MessageCore::GlobalSettings::self()->setCustomDateFormat( mCustomDateFormatEdit->text() );
1550 return QString::fromLatin1(
"configure-appearance-reader");
1556 QVBoxLayout *topLayout =
new QVBoxLayout(
this);
1557 topLayout->setSpacing( KDialog::spacingHint() );
1558 topLayout->setMargin( KDialog::marginHint() );
1561 populateCheckBox( mCloseAfterReplyOrForwardCheck =
new QCheckBox(
this ),
1563 mCloseAfterReplyOrForwardCheck->setToolTip(
1564 i18n(
"Close the standalone message window after replying or forwarding the message" ) );
1565 topLayout->addWidget( mCloseAfterReplyOrForwardCheck );
1566 connect( mCloseAfterReplyOrForwardCheck, SIGNAL (stateChanged(
int)),
1569 mViewerSettings =
new MessageViewer::ConfigureWidget;
1570 connect( mViewerSettings, SIGNAL(settingsChanged()),
1572 topLayout->addWidget( mViewerSettings );
1574 topLayout->addStretch( 100 );
1577 void AppearancePage::ReaderTab::doResetToDefaultsOther()
1581 void AppearancePage::ReaderTab::doLoadOther()
1583 loadWidget( mCloseAfterReplyOrForwardCheck,
GlobalSettings::self()->closeAfterReplyOrForwardItem() );
1584 mViewerSettings->readConfig();
1590 saveCheckBox( mCloseAfterReplyOrForwardCheck,
GlobalSettings::self()->closeAfterReplyOrForwardItem() );
1591 mViewerSettings->writeConfig();
1596 return QString::fromLatin1(
"configure-appearance-systemtray");
1602 QVBoxLayout * vlay =
new QVBoxLayout(
this );
1603 vlay->setSpacing( KDialog::spacingHint() );
1604 vlay->setMargin( KDialog::marginHint() );
1607 mSystemTrayCheck =
new QCheckBox( i18n(
"Enable system tray icon"),
this );
1608 vlay->addWidget( mSystemTrayCheck );
1609 connect( mSystemTrayCheck, SIGNAL(stateChanged(
int)),
1612 mSystemTrayShowUnreadMail =
new QCheckBox( i18n(
"Show unread mail in tray icon"),
this );
1613 vlay->addWidget( mSystemTrayShowUnreadMail );
1614 mSystemTrayShowUnreadMail->setEnabled(
false);
1615 connect( mSystemTrayShowUnreadMail, SIGNAL(stateChanged(
int)),
1617 connect( mSystemTrayCheck, SIGNAL(toggled(
bool)),
1618 mSystemTrayShowUnreadMail, SLOT(setEnabled(
bool)) );
1622 mSystemTrayGroup =
new KButtonGroup(
this );
1623 mSystemTrayGroup->setTitle( i18n(
"System Tray Mode" ) );
1624 QVBoxLayout *gvlay =
new QVBoxLayout( mSystemTrayGroup );
1625 gvlay->setSpacing( KDialog::spacingHint() );
1627 connect( mSystemTrayGroup, SIGNAL(clicked(
int)),
1629 connect( mSystemTrayCheck, SIGNAL(toggled(
bool)),
1630 mSystemTrayGroup, SLOT(setEnabled(
bool)) );
1632 gvlay->addWidget(
new QRadioButton( i18n(
"Always show KMail in system tray"), mSystemTrayGroup ) );
1633 gvlay->addWidget(
new QRadioButton( i18n(
"Only show KMail in system tray if there are unread messages"), mSystemTrayGroup ) );
1635 vlay->addWidget( mSystemTrayGroup );
1636 vlay->addStretch( 10 );
1639 void AppearancePage::SystemTrayTab::doLoadFromGlobalSettings()
1644 mSystemTrayGroup->setEnabled( mSystemTrayCheck->isChecked() );
1657 return QString::fromLatin1(
"configure-appearance-messagetag");
1690 QHBoxLayout *maingrid =
new QHBoxLayout(
this );
1691 maingrid->setMargin( KDialog::marginHint() );
1692 maingrid->setSpacing( KDialog::spacingHint() );
1694 mNepomukActive = Nepomuk2::ResourceManager::instance()->initialized();
1695 if ( mNepomukActive ) {
1700 mTagsGroupBox =
new QGroupBox( i18n(
"A&vailable Tags"),
this );
1701 maingrid->addWidget( mTagsGroupBox );
1702 QVBoxLayout *tageditgrid =
new QVBoxLayout( mTagsGroupBox );
1703 tageditgrid->setMargin( KDialog::marginHint() );
1704 tageditgrid->setSpacing( KDialog::spacingHint() );
1705 tageditgrid->addSpacing( 2 * KDialog::spacingHint() );
1708 QHBoxLayout *addremovegrid =
new QHBoxLayout();
1709 tageditgrid->addLayout( addremovegrid );
1711 mTagAddLineEdit =
new KLineEdit( mTagsGroupBox );
1712 mTagAddLineEdit->setTrapReturnKey(
true );
1713 addremovegrid->addWidget( mTagAddLineEdit );
1715 mTagAddButton =
new KPushButton( mTagsGroupBox );
1716 mTagAddButton->setToolTip( i18n(
"Add new tag") );
1717 mTagAddButton->setIcon( KIcon( QLatin1String(
"list-add") ) );
1718 addremovegrid->addWidget( mTagAddButton );
1720 mTagRemoveButton =
new KPushButton( mTagsGroupBox );
1721 mTagRemoveButton->setToolTip( i18n(
"Remove selected tag") );
1722 mTagRemoveButton->setIcon( KIcon( QLatin1String(
"list-remove") ) );
1723 addremovegrid->addWidget( mTagRemoveButton );
1726 QHBoxLayout *updowngrid =
new QHBoxLayout();
1727 tageditgrid->addLayout( updowngrid );
1729 mTagUpButton =
new KPushButton( mTagsGroupBox );
1730 mTagUpButton->setToolTip( i18n(
"Increase tag priority") );
1731 mTagUpButton->setIcon( KIcon( QLatin1String(
"arrow-up") ) );
1732 mTagUpButton->setAutoRepeat(
true );
1733 updowngrid->addWidget( mTagUpButton );
1735 mTagDownButton =
new KPushButton( mTagsGroupBox );
1736 mTagDownButton->setToolTip( i18n(
"Decrease tag priority") );
1737 mTagDownButton->setIcon( KIcon( QLatin1String(
"arrow-down") ) );
1738 mTagDownButton->setAutoRepeat(
true );
1739 updowngrid->addWidget( mTagDownButton );
1742 QHBoxLayout *listboxgrid =
new QHBoxLayout();
1743 tageditgrid->addLayout( listboxgrid );
1745 mTagListBox->setDragDropMode(QAbstractItemView::InternalMove);
1746 connect( mTagListBox->model(),SIGNAL(rowsMoved(QModelIndex,
int,
int,QModelIndex,
int)),SLOT(slotRowsMoved(QModelIndex,
int,
int,QModelIndex,
int)) );
1748 mTagListBox->setMinimumWidth( 150 );
1749 listboxgrid->addWidget( mTagListBox );
1754 QVBoxLayout *tagsettinggrid =
new QVBoxLayout();
1755 maingrid->addLayout( tagsettinggrid );
1759 mTagSettingGroupBox =
new QGroupBox( i18n(
"Ta&g Settings"),
1761 tagsettinggrid->addWidget( mTagSettingGroupBox );
1764 actionCollections =
kmkernel->getKMMainWidget()->actionCollections();
1766 QHBoxLayout *lay =
new QHBoxLayout(mTagSettingGroupBox);
1767 mTagWidget =
new MailCommon::TagWidget(actionCollections,
this);
1768 lay->addWidget(mTagWidget);
1770 connect(mTagWidget,SIGNAL(
changed()),
this, SLOT(slotEmitChangeCheck()));
1773 connect( mTagAddLineEdit, SIGNAL(textChanged(QString)),
1777 connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1778 this, SLOT(slotNameLineTextChanged(QString)) );
1780 connect( mTagWidget, SIGNAL(iconNameChanged(QString)), SLOT(slotIconNameChanged(QString)) );
1782 connect( mTagAddLineEdit, SIGNAL(returnPressed()),
1786 connect( mTagAddButton, SIGNAL(clicked()),
1789 connect( mTagRemoveButton, SIGNAL(clicked()),
1792 connect( mTagUpButton, SIGNAL(clicked()),
1795 connect( mTagDownButton, SIGNAL(clicked()),
1799 this, SLOT(slotSelectionChanged()) );
1801 maingrid->setStretchFactor( mTagsGroupBox, 1 );
1802 maingrid->setStretchFactor( lay, 1 );
1803 tagsettinggrid->addStretch( 10 );
1808 lab->setText( i18n(
"The Nepomuk semantic search service is not available. We cannot configure tags. You can enable it in \"System Settings\"" ) );
1809 lab->setWordWrap(
true);
1810 maingrid->addWidget( lab );
1818 void AppearancePage::MessageTagTab::slotEmitChangeCheck()
1823 void AppearancePage::MessageTagTab::slotRowsMoved(
const QModelIndex &,
1824 int sourcestart,
int sourceEnd,
1825 const QModelIndex &,
int destinationRow )
1827 Q_UNUSED( sourceEnd );
1828 Q_UNUSED( sourcestart );
1829 Q_UNUSED( destinationRow );
1831 slotEmitChangeCheck();
1835 void AppearancePage::MessageTagTab::updateButtons()
1837 const int currentIndex = mTagListBox->currentRow();
1839 const bool theFirst = ( currentIndex == 0 );
1840 const bool theLast = ( currentIndex >= (int)mTagListBox->count() - 1 );
1841 const bool aFilterIsSelected = ( currentIndex >= 0 );
1843 mTagUpButton->setEnabled( aFilterIsSelected && !theFirst );
1844 mTagDownButton->setEnabled( aFilterIsSelected && !theLast );
1849 const int tmp_index = mTagListBox->currentRow();
1850 if ( tmp_index <= 0 )
1852 swapTagsInListBox( tmp_index, tmp_index - 1 );
1858 const int tmp_index = mTagListBox->currentRow();
1859 if ( ( tmp_index < 0 )
1860 || ( tmp_index >=
int( mTagListBox->count() ) - 1 ) )
1862 swapTagsInListBox( tmp_index, tmp_index + 1 );
1866 void AppearancePage::MessageTagTab::swapTagsInListBox(
const int first,
1870 this, SLOT(slotSelectionChanged()) );
1874 mPreviousTag = second;
1875 mTagListBox->insertItem( second, item );
1876 mTagListBox->setCurrentRow( second );
1878 this, SLOT(slotSelectionChanged()) );
1879 slotEmitChangeCheck();
1882 void AppearancePage::MessageTagTab::slotRecordTagSettings(
int aIndex )
1884 if ( ( aIndex < 0 ) || ( aIndex >=
int( mTagListBox->count() ) ) )
1889 MailCommon::Tag::Ptr tmp_desc = tagItem->
kmailTag();
1891 tmp_desc->tagName = tagItem->text();
1892 mTagWidget->recordTagSettings(tmp_desc);
1895 void AppearancePage::MessageTagTab::slotUpdateTagSettingWidgets(
int aIndex )
1898 if ( ( aIndex < 0 ) || ( mTagListBox->currentRow() < 0 ) ) {
1899 mTagRemoveButton->setEnabled(
false );
1900 mTagUpButton->setEnabled(
false );
1901 mTagDownButton->setEnabled(
false );
1903 mTagWidget->setEnabled(
false);
1906 mTagWidget->setEnabled(
true);
1908 mTagRemoveButton->setEnabled(
true );
1909 mTagUpButton->setEnabled( ( 0 != aIndex ) );
1910 mTagDownButton->setEnabled(( (
int( mTagListBox->count() ) - 1 ) != aIndex ) );
1913 MailCommon::Tag::Ptr tmp_desc = tagItem->
kmailTag();
1915 mTagRemoveButton->setEnabled( !tmp_desc->tagStatus );
1917 disconnect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1918 this, SLOT(slotNameLineTextChanged(QString)) );
1920 mTagWidget->tagNameLineEdit()->setEnabled(!tmp_desc->tagStatus);
1921 mTagWidget->tagNameLineEdit()->setText( tmp_desc->tagName );
1922 connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1923 this, SLOT(slotNameLineTextChanged(QString)) );
1926 mTagWidget->setTagTextColor(tmp_desc->textColor);
1928 mTagWidget->setTagBackgroundColor(tmp_desc->backgroundColor);
1930 mTagWidget->setTagTextFont(tmp_desc->textFont);
1932 mTagWidget->iconButton()->setEnabled( !tmp_desc->tagStatus );
1933 mTagWidget->iconButton()->setIcon( tmp_desc->iconName );
1935 mTagWidget->keySequenceWidget()->setEnabled(
true );
1936 mTagWidget->keySequenceWidget()->setKeySequence( tmp_desc->shortcut.primary(),
1937 KKeySequenceWidget::NoValidate );
1939 mTagWidget->inToolBarCheck()->setEnabled(
true );
1940 mTagWidget->inToolBarCheck()->setChecked( tmp_desc->inToolbar );
1943 void AppearancePage::MessageTagTab::slotSelectionChanged()
1946 slotRecordTagSettings( mPreviousTag );
1947 slotUpdateTagSettingWidgets( mTagListBox->currentRow() );
1948 mPreviousTag = mTagListBox->currentRow();
1954 int tmp_index = mTagListBox->currentRow();
1955 if ( tmp_index >= 0 ) {
1956 QListWidgetItem * item = mTagListBox->takeItem( mTagListBox->currentRow() );
1958 MailCommon::Tag::Ptr tmp_desc = tagItem->
kmailTag();
1959 Nepomuk2::Tag nepomukTag( tmp_desc->nepomukResourceUri );
1960 nepomukTag.remove();
1967 this, SLOT(slotSelectionChanged()) );
1971 this, SLOT(slotSelectionChanged()) );
1973 slotSelectionChanged();
1974 slotEmitChangeCheck();
1978 void AppearancePage::MessageTagTab::slotNameLineTextChanged(
const QString
1983 if ( aText.isEmpty() && !mTagListBox->currentItem())
1986 const int count = mTagListBox->count();
1987 for (
int i=0; i < count; ++i ) {
1988 if(mTagListBox->item(i)->text() == aText) {
1989 KMessageBox::error(
this,i18n(
"We cannot create tag. A tag with same name already exists."));
1990 disconnect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1991 this, SLOT(slotNameLineTextChanged(QString)) );
1992 mTagWidget->tagNameLineEdit()->setText(mTagListBox->currentItem()->text());
1993 connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1994 this, SLOT(slotNameLineTextChanged(QString)) );
2003 this, SLOT(slotSelectionChanged()) );
2005 mTagListBox->currentItem()->setText( aText );
2007 this, SLOT(slotSelectionChanged()) );
2010 void AppearancePage::MessageTagTab::slotIconNameChanged(
const QString &iconName )
2012 mTagListBox->currentItem()->setIcon( KIcon( iconName ) );
2017 mTagAddButton->setEnabled( !aText.isEmpty() );
2022 const QString newTagName = mTagAddLineEdit->text();
2023 const int count = mTagListBox->count();
2024 for (
int i=0; i < count; ++i ) {
2025 if(mTagListBox->item(i)->text() == newTagName) {
2026 KMessageBox::error(
this,i18n(
"We cannot create tag. A tag with same name already exists."));
2032 const int tmp_priority = mTagListBox->count();
2033 Nepomuk2::Tag nepomukTag( newTagName );
2034 nepomukTag.setLabel( newTagName );
2036 MailCommon::Tag::Ptr tag = MailCommon::Tag::fromNepomuk( nepomukTag );
2037 tag->priority = tmp_priority;
2038 slotEmitChangeCheck();
2041 mTagListBox->addItem( newItem );
2042 mTagListBox->setCurrentItem( newItem );
2043 mTagAddLineEdit->setText( QString() );
2046 void AppearancePage::MessageTagTab::doLoadFromGlobalSettings()
2048 if ( !mNepomukActive )
2051 mTagListBox->clear();
2053 foreach(
const Nepomuk2::Tag &nepomukTag, Nepomuk2::Tag::allTags() ) {
2054 MailCommon::Tag::Ptr tag = MailCommon::Tag::fromNepomuk( nepomukTag );
2055 msgTagList.append( tag );
2058 qSort( msgTagList.begin(), msgTagList.end(), MailCommon::Tag::compare );
2060 foreach(
const MailCommon::Tag::Ptr& tag, msgTagList ) {
2063 if ( tag->priority == -1 )
2064 tag->priority = mTagListBox->count() - 1;
2069 this, SLOT(slotSelectionChanged()) );
2072 this, SLOT(slotSelectionChanged()) );
2074 slotUpdateTagSettingWidgets( -1 );
2076 mTagAddButton->setEnabled(
false );
2079 mOriginalMsgTagList.clear();
2087 if ( !mNepomukActive ) {
2091 const int currentRow = mTagListBox->currentRow();
2092 if ( currentRow < 0 ) {
2096 const int count = mTagListBox->count();
2106 slotRecordTagSettings( currentRow );
2107 const int numberOfMsgTagList = count;
2108 for (
int i=0; i < numberOfMsgTagList; ++i ) {
2110 if ( ( i>=mOriginalMsgTagList.count() ) || *(tagItem->
kmailTag()) != *(mOriginalMsgTagList[i]) ) {
2111 MailCommon::Tag::Ptr tag = tagItem->
kmailTag();
2114 MailCommon::Tag::SaveFlags saveFlags = mTagWidget->saveFlags();
2115 tag->saveToNepomuk( saveFlags );
2130 return QString::fromLatin1(
"configure-composer");
2140 addTab( mGeneralTab, i18nc(
"General settings for the composer.",
"General") );
2147 addTab( mTemplatesTab, i18n(
"Standard Templates") );
2153 addTab( mCustomTemplatesTab, i18n(
"Custom Templates") );
2159 addTab( mSubjectTab, i18nc(
"Settings regarding the subject when composing a message.",
"Subject") );
2166 addTab( mCharsetTab, i18n(
"Charset") );
2172 addTab( mHeadersTab, i18n(
"Headers") );
2178 addTab( mAttachmentsTab, i18nc(
"Config->Composer->Attachments",
"Attachments") );
2184 addTab( mAutoCorrectionTab, i18n(
"Autocorrection") );
2190 addTab( mAutoImageResizeTab, i18n(
"Auto Resize Image") );
2195 addTab( mExternalEditorTab, i18n(
"External Editor") );
2200 return QString::fromLatin1(
"configure-composer-general");
2209 QGroupBox *groupBox;
2210 QVBoxLayout *groupVBoxLayout;
2211 QGridLayout *groupGridLayout;
2216 QHBoxLayout *hb1 =
new QHBoxLayout();
2217 QVBoxLayout *vb1 =
new QVBoxLayout();
2218 QVBoxLayout *vb2 =
new QVBoxLayout();
2221 groupBox =
new QGroupBox( i18nc(
"@title:group",
"Signature" ) );
2222 groupVBoxLayout =
new QVBoxLayout();
2225 mAutoAppSignFileCheck =
new QCheckBox(
2226 MessageComposer::MessageComposerSettings::self()->autoTextSignatureItem()->label(),
2229 helpText = i18n(
"Automatically insert the configured signature\n"
2230 "when starting to compose a message" );
2231 mAutoAppSignFileCheck->setToolTip( helpText );
2232 mAutoAppSignFileCheck->setWhatsThis( helpText );
2234 connect( mAutoAppSignFileCheck, SIGNAL(stateChanged(
int)),
2236 groupVBoxLayout->addWidget( mAutoAppSignFileCheck );
2239 mTopQuoteCheck =
new QCheckBox(
2240 MessageComposer::MessageComposerSettings::self()->prependSignatureItem()->label(),
this );
2241 mTopQuoteCheck->setEnabled(
false );
2243 helpText = i18n(
"Insert the signature above any quoted text" );
2244 mTopQuoteCheck->setToolTip( helpText );
2245 mTopQuoteCheck->setWhatsThis( helpText );
2247 connect( mTopQuoteCheck, SIGNAL(stateChanged(
int)),
2249 connect( mAutoAppSignFileCheck, SIGNAL(toggled(
bool)),
2250 mTopQuoteCheck, SLOT(setEnabled(
bool)) );
2251 groupVBoxLayout->addWidget( mTopQuoteCheck );
2254 mDashDashCheck =
new QCheckBox(
2255 MessageComposer::MessageComposerSettings::self()->dashDashSignatureItem()->label(),
this );
2256 mDashDashCheck->setEnabled(
false );
2258 helpText = i18n(
"Insert the RFC-compliant signature separator\n"
2259 "(two dashes and a space on a line) before the signature" );
2260 mDashDashCheck->setToolTip( helpText );
2261 mDashDashCheck->setWhatsThis( helpText );
2263 connect( mDashDashCheck, SIGNAL(stateChanged(
int)),
2265 connect( mAutoAppSignFileCheck, SIGNAL(toggled(
bool)),
2266 mDashDashCheck, SLOT(setEnabled(
bool)) );
2267 groupVBoxLayout->addWidget( mDashDashCheck);
2270 mStripSignatureCheck =
new QCheckBox( TemplateParser::GlobalSettings::self()->stripSignatureItem()->label(),
2273 helpText = i18n(
"When replying, do not quote any existing signature" );
2274 mStripSignatureCheck->setToolTip( helpText );
2275 mStripSignatureCheck->setWhatsThis( helpText );
2277 connect( mStripSignatureCheck, SIGNAL(stateChanged(
int)),
2279 groupVBoxLayout->addWidget( mStripSignatureCheck );
2281 groupBox->setLayout( groupVBoxLayout );
2282 vb1->addWidget( groupBox );
2285 groupBox =
new QGroupBox( i18nc(
"@title:group",
"Format" ) );
2286 groupGridLayout =
new QGridLayout();
2290 mQuoteSelectionOnlyCheck =
new QCheckBox( MessageComposer::MessageComposerSettings::self()->quoteSelectionOnlyItem()->label(),
2292 helpText = i18n(
"When replying, only quote the selected text\n"
2293 "(instead of the complete message), if\n"
2294 "there is text selected in the message window." );
2295 mQuoteSelectionOnlyCheck->setToolTip( helpText );
2296 mQuoteSelectionOnlyCheck->setWhatsThis( helpText );
2298 connect( mQuoteSelectionOnlyCheck, SIGNAL(stateChanged(
int)),
2300 groupGridLayout->addWidget( mQuoteSelectionOnlyCheck, row, 0, 1, -1 );
2304 mSmartQuoteCheck =
new QCheckBox(
2305 TemplateParser::GlobalSettings::self()->smartQuoteItem()->label(),
this );
2306 helpText = i18n(
"When replying, add quote signs in front of all lines of the quoted text,\n"
2307 "even when the line was created by adding an additional line break while\n"
2308 "word-wrapping the text." );
2309 mSmartQuoteCheck->setToolTip( helpText );
2310 mSmartQuoteCheck->setWhatsThis( helpText );
2312 connect( mSmartQuoteCheck, SIGNAL(stateChanged(
int)),
2314 groupGridLayout->addWidget( mSmartQuoteCheck, row, 0, 1, -1 );
2318 mWordWrapCheck =
new QCheckBox(
2319 MessageComposer::MessageComposerSettings::self()->wordWrapItem()->label(),
this);
2321 helpText = i18n(
"Enable automatic word wrapping at the specified width" );
2322 mWordWrapCheck->setToolTip( helpText );
2323 mWordWrapCheck->setWhatsThis( helpText );
2325 mWrapColumnSpin =
new KIntSpinBox( 30, 78, 1,
2327 mWrapColumnSpin->setEnabled(
false );
2329 helpText = i18n(
"Set the text width for automatic word wrapping" );
2330 mWrapColumnSpin->setToolTip( helpText );
2331 mWrapColumnSpin->setWhatsThis( helpText );
2333 connect( mWordWrapCheck, SIGNAL(stateChanged(
int)),
2335 connect( mWrapColumnSpin, SIGNAL(valueChanged(
int)),
2338 connect( mWordWrapCheck, SIGNAL(toggled(
bool)),
2339 mWrapColumnSpin, SLOT(setEnabled(
bool)) );
2341 groupGridLayout->addWidget( mWordWrapCheck, row, 0 );
2342 groupGridLayout->addWidget( mWrapColumnSpin, row, 1 );
2346 groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2350 mReplyUsingHtml =
new QCheckBox( TemplateParser::GlobalSettings::self()->replyUsingHtmlItem()->label(),
this );
2351 helpText = i18n(
"When replying or forwarding, quote the message\n"
2352 "in the original format it was received.\n"
2353 "If unchecked, the reply will be as plain text by default." );
2354 mReplyUsingHtml->setToolTip( helpText );
2355 mReplyUsingHtml->setWhatsThis( helpText );
2357 connect( mReplyUsingHtml, SIGNAL(stateChanged(
int)),
2359 groupGridLayout->addWidget( mReplyUsingHtml, row, 0, 1, -1 );
2363 mImprovePlainTextOfHtmlMessage =
new QCheckBox( MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessageItem()->label(),
this );
2366 helpText = i18n(
"Format the plain text part of a message from the HTML markup.\n"
2367 "Bold, italic and underlined text, lists, and external references\n"
2369 mImprovePlainTextOfHtmlMessage->setToolTip( helpText );
2370 mImprovePlainTextOfHtmlMessage->setWhatsThis( helpText );
2372 connect( mImprovePlainTextOfHtmlMessage, SIGNAL(stateChanged(
int)),
2374 groupGridLayout->addWidget( mImprovePlainTextOfHtmlMessage, row, 0, 1, -1 );
2378 groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2382 mAutoSave =
new KIntSpinBox( 0, 60, 1, 1,
this );
2383 mAutoSave->setObjectName( QLatin1String(
"kcfg_AutosaveInterval") );
2384 mAutoSave->setSpecialValueText( i18n(
"No autosave") );
2385 mAutoSave->setSuffix( ki18ncp(
"Interval suffix",
" minute",
" minutes" ) );
2387 helpText = i18n(
"Automatically save the message at this specified interval" );
2388 mAutoSave->setToolTip( helpText );
2389 mAutoSave->setWhatsThis( helpText );
2392 label->setBuddy( mAutoSave );
2394 connect( mAutoSave, SIGNAL(valueChanged(
int)),
2397 groupGridLayout->addWidget( label, row, 0 );
2398 groupGridLayout->addWidget( mAutoSave, row, 1 );
2401 #ifdef KDEPIM_ENTERPRISE_BUILD
2403 mForwardTypeCombo =
new KComboBox(
false,
this );
2404 mForwardTypeCombo->addItems( QStringList() << i18nc(
"@item:inlistbox Inline mail forwarding",
2406 << i18n(
"As Attachment" ) );
2408 helpText = i18n(
"Set the default forwarded message format" );
2409 mForwardTypeCombo->setToolTip( helpText );
2410 mForwardTypeCombo->setWhatsThis( helpText );
2412 label =
new QLabel( i18n(
"Default forwarding type:" ),
this );
2413 label->setBuddy( mForwardTypeCombo );
2415 connect( mForwardTypeCombo, SIGNAL(activated(
int)),
2418 groupGridLayout->addWidget( label, row, 0 );
2419 groupGridLayout->addWidget( mForwardTypeCombo, row, 1 );
2423 groupBox->setLayout( groupGridLayout );
2424 vb1->addWidget( groupBox );
2427 groupBox =
new QGroupBox( i18nc(
"@title:group",
"Recipients" ) );
2428 groupGridLayout =
new QGridLayout();
2435 helpText = i18n(
"By default, request an MDN when starting to compose a message.\n"
2436 "You can select this on a per-message basis using \"Options - Request Disposition Notification\"" );
2437 mAutoRequestMDNCheck->setToolTip( helpText );
2438 mAutoRequestMDNCheck->setWhatsThis( helpText );
2440 connect( mAutoRequestMDNCheck, SIGNAL(stateChanged(
int)),
2442 groupGridLayout->addWidget( mAutoRequestMDNCheck, row, 0, 1, -1 );
2446 groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2449 #ifdef KDEPIM_ENTERPRISE_BUILD
2451 mRecipientCheck =
new QCheckBox(
2453 mRecipientCheck->setObjectName( QLatin1String(
"kcfg_TooManyRecipients") );
2455 mRecipientCheck->setWhatsThis( helpText );
2456 mRecipientCheck->setToolTip( i18n(
"Warn if too many recipients are specified" ) );
2458 mRecipientSpin =
new KIntSpinBox( 1, 100, 1,
2460 mRecipientSpin->setObjectName( QLatin1String(
"kcfg_RecipientThreshold") );
2461 mRecipientSpin->setEnabled(
false );
2463 mRecipientSpin->setWhatsThis( helpText );
2464 mRecipientSpin->setToolTip( i18n(
"Set the maximum number of recipients for the warning" ) );
2466 connect( mRecipientCheck, SIGNAL(stateChanged(
int)),
2468 connect( mRecipientSpin, SIGNAL(valueChanged(
int)),
2471 connect( mRecipientCheck, SIGNAL(toggled(
bool)),
2472 mRecipientSpin, SLOT(setEnabled(
bool)) );
2474 groupGridLayout->addWidget( mRecipientCheck, row, 0, 1, 2);
2475 groupGridLayout->addWidget( mRecipientSpin, row, 2 );
2480 mMaximumRecipients =
new KIntSpinBox( 0, 9999, 1, 1,
this );
2482 helpText = i18n(
"Only allow this many recipients to be specified for the message.\n"
2483 "This applies to doing a \"Reply to All\", entering recipients manually\n"
2484 "or using the \"Select...\" picker. Setting this limit helps you to\n"
2485 "avoid accidentally sending a message to too many people. Note,\n"
2486 "however, that it does not take account of distribution lists or\n"
2488 mMaximumRecipients->setToolTip( helpText );
2489 mMaximumRecipients->setWhatsThis( helpText );
2491 label =
new QLabel( MessageComposer::MessageComposerSettings::self()->maximumRecipientsItem()->label(),
this );
2492 label->setBuddy(mMaximumRecipients);
2494 connect( mMaximumRecipients, SIGNAL(valueChanged(
int)),
2497 groupGridLayout->addWidget( label, row, 0, 1, 2 );
2498 groupGridLayout->addWidget( mMaximumRecipients, row, 2 );
2502 groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2506 mShowRecentAddressesInComposer =
new QCheckBox(
2507 MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposerItem()->label(),
2510 helpText = i18n(
"Remember recent addresses entered,\n"
2511 "and offer them for recipient completion" );
2512 mShowRecentAddressesInComposer->setToolTip( helpText );
2513 mShowRecentAddressesInComposer->setWhatsThis( helpText );
2515 connect( mShowRecentAddressesInComposer, SIGNAL(stateChanged(
int)),
2517 groupGridLayout->addWidget( mShowRecentAddressesInComposer, row, 0, 1, -1 );
2521 mMaximumRecentAddress =
new KIntNumInput(
this );
2522 mMaximumRecentAddress->setSliderEnabled(
false );
2523 mMaximumRecentAddress->setMinimum( 0 );
2524 mMaximumRecentAddress->setMaximum( 999 );
2525 mMaximumRecentAddress->setSpecialValueText( i18nc(
"No addresses are retained",
"No save" ) );
2526 mMaximumRecentAddress->setEnabled(
false );
2528 label =
new QLabel( i18n(
"Maximum recent addresses retained:" ) );
2529 label->setBuddy( mMaximumRecentAddress );
2530 label->setEnabled(
false );
2532 helpText = i18n(
"The maximum number of recently entered addresses that will\n"
2533 "be remembered for completion" );
2534 mMaximumRecentAddress->setToolTip( helpText );
2535 mMaximumRecentAddress->setWhatsThis( helpText );
2537 connect( mMaximumRecentAddress, SIGNAL(valueChanged(
int)),
2539 connect( mShowRecentAddressesInComposer, SIGNAL(toggled(
bool)),
2540 mMaximumRecentAddress, SLOT(setEnabled(
bool)) );
2541 connect( mShowRecentAddressesInComposer, SIGNAL(toggled(
bool)),
2542 label, SLOT(setEnabled(
bool)) );
2544 groupGridLayout->addWidget( label, row, 0, 1, 2 );
2545 groupGridLayout->addWidget( mMaximumRecentAddress, row, 2 );
2549 QPushButton *recentAddressesBtn =
new QPushButton( i18n(
"Edit Recent Addresses..." ),
this );
2550 helpText = i18n(
"Edit, add or remove recent addresses" );
2551 recentAddressesBtn->setToolTip( helpText );
2552 recentAddressesBtn->setWhatsThis( helpText );
2554 connect( recentAddressesBtn, SIGNAL(clicked()),
2556 groupGridLayout->addWidget( recentAddressesBtn, row, 1, 1, 2 );
2560 groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2564 QPushButton *completionOrderBtn =
new QPushButton( i18n(
"Configure Completion Order..." ),
this );
2565 helpText = i18n(
"Configure the order in which address books\n"
2566 "will be used when doing address completion" );
2567 completionOrderBtn->setToolTip( helpText );
2568 completionOrderBtn->setWhatsThis( helpText );
2570 connect( completionOrderBtn, SIGNAL(clicked()),
2572 groupGridLayout->addWidget( completionOrderBtn, row, 1, 1, 2 );
2574 groupBox->setLayout( groupGridLayout );
2575 vb2->addWidget( groupBox );
2578 vb1->addStretch( 1 );
2579 vb2->addStretch( 1 );
2581 hb1->addLayout( vb1 );
2582 hb1->addLayout( vb2 );
2587 void ComposerPage::GeneralTab::doResetToDefaultsOther()
2589 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
2591 const bool autoAppSignFile = MessageComposer::MessageComposerSettings::self()->autoTextSignature()==QLatin1String(
"auto" );
2592 const bool topQuoteCheck = MessageComposer::MessageComposerSettings::self()->prependSignature();
2593 const bool dashDashSignature = MessageComposer::MessageComposerSettings::self()->dashDashSignature();
2594 const bool smartQuoteCheck = MessageComposer::MessageComposerSettings::self()->quoteSelectionOnly();
2595 const bool wordWrap = MessageComposer::MessageComposerSettings::self()->wordWrap();
2596 const int wrapColumn = MessageComposer::MessageComposerSettings::self()->lineWrapWidth();
2597 const bool showRecentAddress = MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposer();
2598 const int maximumRecipient = MessageComposer::MessageComposerSettings::self()->maximumRecipients();
2599 const bool improvePlainText = MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage();
2601 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
2603 mAutoAppSignFileCheck->setChecked( autoAppSignFile );
2604 mTopQuoteCheck->setChecked( topQuoteCheck );
2605 mDashDashCheck->setChecked( dashDashSignature );
2606 mQuoteSelectionOnlyCheck->setChecked( smartQuoteCheck );
2607 mWordWrapCheck->setChecked( wordWrap );
2608 mWrapColumnSpin->setValue( wrapColumn );
2609 mMaximumRecipients->setValue( maximumRecipient );
2610 mShowRecentAddressesInComposer->setChecked( showRecentAddress );
2611 mImprovePlainTextOfHtmlMessage->setChecked(improvePlainText);
2613 mMaximumRecentAddress->setValue( 40 );
2616 void ComposerPage::GeneralTab::doLoadFromGlobalSettings()
2620 mAutoAppSignFileCheck->setChecked(
2621 MessageComposer::MessageComposerSettings::self()->autoTextSignature()==QLatin1String(
"auto" ) );
2622 mTopQuoteCheck->setChecked( MessageComposer::MessageComposerSettings::self()->prependSignature() );
2623 mDashDashCheck->setChecked( MessageComposer::MessageComposerSettings::self()->dashDashSignature() );
2624 mSmartQuoteCheck->setChecked( TemplateParser::GlobalSettings::self()->smartQuote() );
2625 mQuoteSelectionOnlyCheck->setChecked( MessageComposer::MessageComposerSettings::self()->quoteSelectionOnly() );
2626 mReplyUsingHtml->setChecked( TemplateParser::GlobalSettings::self()->replyUsingHtml() );
2627 mStripSignatureCheck->setChecked( TemplateParser::GlobalSettings::self()->stripSignature() );
2629 mWordWrapCheck->setChecked( MessageComposer::MessageComposerSettings::self()->wordWrap() );
2630 mWrapColumnSpin->setValue( MessageComposer::MessageComposerSettings::self()->lineWrapWidth() );
2631 mMaximumRecipients->setValue( MessageComposer::MessageComposerSettings::self()->maximumRecipients() );
2633 mShowRecentAddressesInComposer->setChecked( MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposer() );
2634 mImprovePlainTextOfHtmlMessage->setChecked(MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage());
2636 #ifdef KDEPIM_ENTERPRISE_BUILD
2640 mForwardTypeCombo->setCurrentIndex( 0 );
2642 mForwardTypeCombo->setCurrentIndex( 1 );
2645 mMaximumRecentAddress->setValue(RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->maxCount());
2649 MessageComposer::MessageComposerSettings::self()->setAutoTextSignature(
2650 mAutoAppSignFileCheck->isChecked() ? QLatin1String(
"auto") : QLatin1String(
"manual") );
2651 MessageComposer::MessageComposerSettings::self()->setPrependSignature( mTopQuoteCheck->isChecked() );
2652 MessageComposer::MessageComposerSettings::self()->setDashDashSignature( mDashDashCheck->isChecked() );
2653 TemplateParser::GlobalSettings::self()->setSmartQuote( mSmartQuoteCheck->isChecked() );
2654 MessageComposer::MessageComposerSettings::self()->setQuoteSelectionOnly( mQuoteSelectionOnlyCheck->isChecked() );
2655 TemplateParser::GlobalSettings::self()->setReplyUsingHtml( mReplyUsingHtml->isChecked() );
2656 TemplateParser::GlobalSettings::self()->setStripSignature( mStripSignatureCheck->isChecked() );
2658 MessageComposer::MessageComposerSettings::self()->setWordWrap( mWordWrapCheck->isChecked() );
2659 MessageComposer::MessageComposerSettings::self()->setLineWrapWidth( mWrapColumnSpin->value() );
2660 MessageComposer::MessageComposerSettings::self()->setMaximumRecipients( mMaximumRecipients->value() );
2662 MessageComposer::MessageComposerSettings::self()->setShowRecentAddressesInComposer( mShowRecentAddressesInComposer->isChecked() );
2663 MessageComposer::MessageComposerSettings::self()->setImprovePlainTextOfHtmlMessage( mImprovePlainTextOfHtmlMessage->isChecked() );
2664 #ifdef KDEPIM_ENTERPRISE_BUILD
2667 GlobalSettings::self()->setForwardingInlineByDefault( mForwardTypeCombo->currentIndex() == 0 );
2670 RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->setMaxCount( mMaximumRecentAddress->value() );
2672 MessageComposer::MessageComposerSettings::self()->
requestSync();
2678 dlg->setAddresses( RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->addresses() );
2679 if ( dlg->exec() && dlg ) {
2680 RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->clear();
2681 const QStringList &addrList = dlg->addresses();
2682 QStringList::ConstIterator it;
2683 QStringList::ConstIterator end( addrList.constEnd() );
2685 for ( it = addrList.constBegin(); it != end; ++it )
2686 RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->add( *it );
2699 return QString::fromLatin1(
"configure-composer-externaleditor");
2705 QVBoxLayout *layout =
new QVBoxLayout(
this );
2707 mExternalEditorCheck =
new QCheckBox(
2709 mExternalEditorCheck->setObjectName( QLatin1String(
"kcfg_UseExternalEditor") );
2710 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
2716 mEditorRequester =
new KUrlRequester( hbox );
2719 connect( mEditorRequester, SIGNAL(urlSelected(KUrl)),
2721 connect( mEditorRequester, SIGNAL(textChanged(QString)),
2724 hbox->setStretchFactor( mEditorRequester, 1 );
2725 label->setBuddy( mEditorRequester );
2726 label->setEnabled(
false );
2728 mEditorRequester->setFilter( QLatin1String(
"application/x-executable "
2729 "application/x-shellscript "
2730 "application/x-desktop") );
2731 mEditorRequester->setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly);
2732 mEditorRequester->setEnabled(
false );
2733 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
2734 label, SLOT(setEnabled(
bool)) );
2735 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
2736 mEditorRequester, SLOT(setEnabled(
bool)) );
2738 label =
new QLabel( i18n(
"<b>%f</b> will be replaced with the "
2739 "filename to edit.<br />"
2740 "<b>%w</b> will be replaced with the window id.<br />"
2741 "<b>%l</b> will be replaced with the line number."),
this );
2742 label->setEnabled(
false );
2743 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
2744 label, SLOT(setEnabled(
bool)) );
2745 layout->addWidget( mExternalEditorCheck );
2746 layout->addWidget( hbox );
2747 layout->addWidget( label );
2748 layout->addStretch();
2751 void ComposerPage::ExternalEditorTab::doLoadFromGlobalSettings()
2765 return QString::fromLatin1(
"configure-composer-templates");
2771 QVBoxLayout* vlay =
new QVBoxLayout(
this );
2772 vlay->setMargin( 0 );
2773 vlay->setSpacing( KDialog::spacingHint() );
2775 mWidget =
new TemplateParser::TemplatesConfiguration(
this );
2776 vlay->addWidget( mWidget );
2778 connect( mWidget, SIGNAL(
changed()),
2782 void ComposerPage::TemplatesTab::doLoadFromGlobalSettings()
2784 mWidget->loadFromGlobal();
2789 mWidget->saveToGlobal();
2792 void ComposerPage::TemplatesTab::doResetToDefaultsOther()
2794 mWidget->resetToDefault();
2799 return QString::fromLatin1(
"configure-composer-custom-templates");
2805 QVBoxLayout* vlay =
new QVBoxLayout(
this );
2806 vlay->setMargin( 0 );
2807 vlay->setSpacing( KDialog::spacingHint() );
2810 vlay->addWidget( mWidget );
2812 connect( mWidget, SIGNAL(
changed()),
2815 connect( mWidget, SIGNAL(templatesUpdated()),
KMKernel::self(), SLOT(updatedTemplates()) );
2818 void ComposerPage::CustomTemplatesTab::doLoadFromGlobalSettings()
2830 return QString::fromLatin1(
"configure-composer-subject");
2842 vlay =
new QVBoxLayout(
this );
2843 vlay->setSpacing( KDialog::spacingHint() );
2844 vlay->setMargin( KDialog::marginHint() );
2846 group =
new QGroupBox( i18n(
"Repl&y Subject Prefixes"),
this );
2847 QLayout *layout =
new QVBoxLayout( group );
2848 group->layout()->setSpacing( KDialog::spacingHint() );
2851 label =
new QLabel( i18n(
"Recognize any sequence of the following prefixes\n"
2852 "(entries are case-insensitive regular expressions):"), group );
2853 label->setWordWrap(
true );
2854 label->setAlignment( Qt::AlignLeft );
2857 PimCommon::SimpleStringListEditor::ButtonCode buttonCode =
2858 static_cast<PimCommon::SimpleStringListEditor::ButtonCode
>( PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify );
2860 new PimCommon::SimpleStringListEditor( group, buttonCode,
2861 i18n(
"A&dd..."), i18n(
"Re&move"),
2863 i18n(
"Enter new reply prefix:") );
2864 connect( mReplyListEditor, SIGNAL(
changed()),
2868 mReplaceReplyPrefixCheck =
new QCheckBox(
2869 MessageComposer::MessageComposerSettings::self()->replaceReplyPrefixItem()->label(),
2871 connect( mReplaceReplyPrefixCheck, SIGNAL(stateChanged(
int)),
2873 layout->addWidget( label );
2874 layout->addWidget( mReplyListEditor );
2875 layout->addWidget( mReplaceReplyPrefixCheck );
2877 vlay->addWidget( group );
2880 group =
new QGroupBox( i18n(
"For&ward Subject Prefixes"),
this );
2881 layout =
new QVBoxLayout( group );
2882 group->layout()->setSpacing( KDialog::marginHint() );
2885 label=
new QLabel( i18n(
"Recognize any sequence of the following prefixes\n"
2886 "(entries are case-insensitive regular expressions):"), group );
2887 label->setAlignment( Qt::AlignLeft );
2888 label->setWordWrap(
true );
2891 mForwardListEditor =
2892 new PimCommon::SimpleStringListEditor( group, buttonCode,
2896 i18n(
"Enter new forward prefix:") );
2897 connect( mForwardListEditor, SIGNAL(
changed()),
2901 mReplaceForwardPrefixCheck =
new QCheckBox(
2902 MessageComposer::MessageComposerSettings::self()->replaceForwardPrefixItem()->label(),
2904 connect( mReplaceForwardPrefixCheck, SIGNAL(stateChanged(
int)),
2906 layout->addWidget( label );
2907 layout->addWidget( mForwardListEditor );
2908 layout->addWidget( mReplaceForwardPrefixCheck );
2909 vlay->addWidget( group );
2912 void ComposerPage::SubjectTab::doLoadFromGlobalSettings()
2914 mReplyListEditor->setStringList( MessageComposer::MessageComposerSettings::self()->replyPrefixes() );
2915 mReplaceReplyPrefixCheck->setChecked( MessageComposer::MessageComposerSettings::self()->replaceReplyPrefix() );
2916 mForwardListEditor->setStringList( MessageComposer::MessageComposerSettings::self()->forwardPrefixes() );
2917 mReplaceForwardPrefixCheck->setChecked( MessageComposer::MessageComposerSettings::self()->replaceForwardPrefix() );
2922 MessageComposer::MessageComposerSettings::self()->setReplyPrefixes( mReplyListEditor->stringList() );
2923 MessageComposer::MessageComposerSettings::self()->setForwardPrefixes( mForwardListEditor->stringList() );
2924 MessageComposer::MessageComposerSettings::self()->setReplaceForwardPrefix( mReplaceForwardPrefixCheck->isChecked() );
2925 MessageComposer::MessageComposerSettings::self()->setReplaceReplyPrefix( mReplaceReplyPrefixCheck->isChecked() );
2928 void ComposerPage::SubjectTab::doResetToDefaultsOther()
2930 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
2931 const QStringList messageReplyPrefixes = MessageComposer::MessageComposerSettings::replyPrefixes();
2932 const bool useMessageReplyPrefixes = MessageComposer::MessageComposerSettings::replaceReplyPrefix();
2934 const QStringList messageForwardPrefixes = MessageComposer::MessageComposerSettings::forwardPrefixes();
2935 const bool useMessageForwardPrefixes = MessageComposer::MessageComposerSettings::replaceForwardPrefix();
2937 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
2938 mReplyListEditor->setStringList( messageReplyPrefixes );
2939 mReplaceReplyPrefixCheck->setChecked( useMessageReplyPrefixes );
2940 mForwardListEditor->setStringList( messageForwardPrefixes );
2941 mReplaceForwardPrefixCheck->setChecked( useMessageForwardPrefixes );
2947 return QString::fromLatin1(
"configure-composer-charset");
2957 vlay =
new QVBoxLayout(
this );
2958 vlay->setSpacing( KDialog::spacingHint() );
2959 vlay->setMargin( KDialog::marginHint() );
2961 label =
new QLabel( i18n(
"This list is checked for every outgoing message "
2962 "from the top to the bottom for a charset that "
2963 "contains all required characters."),
this );
2964 label->setWordWrap(
true);
2965 vlay->addWidget( label );
2967 mCharsetListEditor =
2968 new PimCommon::SimpleStringListEditor(
this, PimCommon::SimpleStringListEditor::All,
2969 i18n(
"A&dd..."), i18n(
"Remo&ve"),
2970 i18n(
"&Modify..."), i18n(
"Enter charset:") );
2971 mCharsetListEditor->setUpDownAutoRepeat(
true);
2972 connect( mCharsetListEditor, SIGNAL(
changed()),
2975 vlay->addWidget( mCharsetListEditor, 1 );
2977 mKeepReplyCharsetCheck =
new QCheckBox( i18n(
"&Keep original charset when "
2978 "replying or forwarding (if "
2979 "possible)"),
this );
2980 connect( mKeepReplyCharsetCheck, SIGNAL (stateChanged(
int)),
2982 vlay->addWidget( mKeepReplyCharsetCheck );
2984 connect( mCharsetListEditor, SIGNAL(aboutToAdd(QString&)),
2985 this, SLOT(slotVerifyCharset(QString&)) );
2988 void ComposerPage::CharsetTab::slotVerifyCharset( QString & charset )
2990 if ( charset.isEmpty() )
return;
2994 if ( charset.toLower() == QString::fromLatin1(
"us-ascii") ) {
2995 charset = QString::fromLatin1(
"us-ascii");
2999 if ( charset.toLower() == QString::fromLatin1(
"locale") ) {
3000 charset = QString::fromLatin1(
"%1 (locale)")
3001 .arg( QString::fromLatin1(
kmkernel->networkCodec()->name() ).toLower() );
3006 QTextCodec *codec = KGlobal::charsets()->codecForName( charset, ok );
3007 if ( ok && codec ) {
3008 charset = QString::fromLatin1( codec->name() ).toLower();
3012 KMessageBox::sorry(
this, i18n(
"This charset is not supported.") );
3016 void ComposerPage::CharsetTab::doLoadOther()
3018 QStringList charsets = MessageComposer::MessageComposerSettings::preferredCharsets();
3019 QStringList::Iterator end( charsets.end() );
3020 for ( QStringList::Iterator it = charsets.begin() ;
3022 if ( (*it) == QString::fromLatin1(
"locale") ) {
3023 QByteArray cset =
kmkernel->networkCodec()->name();
3024 kAsciiToLower( cset.data() );
3025 (*it) = QString::fromLatin1(
"%1 (locale)").arg( QString::fromLatin1( cset ) );
3028 mCharsetListEditor->setStringList( charsets );
3029 mKeepReplyCharsetCheck->setChecked( MessageComposer::MessageComposerSettings::forceReplyCharset() );
3033 void ComposerPage::CharsetTab::doResetToDefaultsOther()
3035 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
3036 const QStringList charsets = MessageComposer::MessageComposerSettings::preferredCharsets();
3037 const bool keepReplyCharsetCheck = MessageComposer::MessageComposerSettings::forceReplyCharset();
3038 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
3039 mCharsetListEditor->setStringList( charsets );
3040 mKeepReplyCharsetCheck->setChecked( keepReplyCharsetCheck );
3046 QStringList charsetList = mCharsetListEditor->stringList();
3047 QStringList::Iterator it = charsetList.begin();
3048 QStringList::Iterator end = charsetList.end();
3050 for ( ; it != end ; ++it )
3051 if ( (*it).endsWith( QLatin1String(
"(locale)") ) )
3052 (*it) = QLatin1String(
"locale");
3053 MessageComposer::MessageComposerSettings::setPreferredCharsets( charsetList );
3054 MessageComposer::MessageComposerSettings::setForceReplyCharset( mKeepReplyCharsetCheck->isChecked() );
3059 return QString::fromLatin1(
"configure-composer-headers");
3070 QPushButton *button;
3072 vlay =
new QVBoxLayout(
this );
3073 vlay->setSpacing( KDialog::spacingHint() );
3074 vlay->setMargin( KDialog::marginHint() );
3077 mCreateOwnMessageIdCheck =
3078 new QCheckBox( i18n(
"&Use custom message-id suffix"),
this );
3079 connect( mCreateOwnMessageIdCheck, SIGNAL (stateChanged(
int)),
3081 vlay->addWidget( mCreateOwnMessageIdCheck );
3084 hlay =
new QHBoxLayout();
3085 vlay->addLayout( hlay );
3086 mMessageIdSuffixEdit =
new KLineEdit(
this );
3087 mMessageIdSuffixEdit->setClearButtonShown(
true );
3089 QRegExpValidator *messageIdSuffixValidator =
3090 new QRegExpValidator( QRegExp( QLatin1String(
"[a-zA-Z0-9+-]+(?:\\.[a-zA-Z0-9+-]+)*") ),
this );
3091 mMessageIdSuffixEdit->setValidator( messageIdSuffixValidator );
3092 label =
new QLabel(i18n(
"Custom message-&id suffix:"),
this );
3093 label->setBuddy( mMessageIdSuffixEdit );
3094 label->setEnabled(
false );
3095 mMessageIdSuffixEdit->setEnabled(
false );
3096 hlay->addWidget( label );
3097 hlay->addWidget( mMessageIdSuffixEdit, 1 );
3098 connect( mCreateOwnMessageIdCheck, SIGNAL(toggled(
bool)),
3099 label, SLOT(setEnabled(
bool)) );
3100 connect( mCreateOwnMessageIdCheck, SIGNAL(toggled(
bool)),
3101 mMessageIdSuffixEdit, SLOT(setEnabled(
bool)) );
3102 connect( mMessageIdSuffixEdit, SIGNAL(textChanged(QString)),
3106 vlay->addWidget(
new KSeparator( Qt::Horizontal,
this ) );
3107 vlay->addWidget(
new QLabel( i18n(
"Define custom mime header fields:"),
this) );
3110 glay =
new QGridLayout();
3111 vlay->addLayout( glay );
3112 glay->setRowStretch( 2, 1 );
3113 glay->setColumnStretch( 1, 1 );
3114 mHeaderList =
new ListView(
this );
3115 mHeaderList->setHeaderLabels( QStringList() << i18nc(
"@title:column Name of the mime header.",
"Name")
3116 << i18nc(
"@title:column Value of the mimeheader.",
"Value") );
3117 mHeaderList->setSortingEnabled(
false );
3119 this, SLOT(slotMimeHeaderSelectionChanged()) );
3120 connect( mHeaderList, SIGNAL(addHeader()), SLOT(slotNewMimeHeader()));
3121 connect( mHeaderList, SIGNAL(removeHeader()), SLOT(slotRemoveMimeHeader()));
3122 glay->addWidget( mHeaderList, 0, 0, 3, 2 );
3125 button =
new QPushButton( i18nc(
"@action:button Add new mime header field.",
"Ne&w"),
this );
3126 connect( button, SIGNAL(clicked()),
this, SLOT(slotNewMimeHeader()) );
3127 button->setAutoDefault(
false );
3128 glay->addWidget( button, 0, 2 );
3129 mRemoveHeaderButton =
new QPushButton( i18n(
"Re&move"),
this );
3130 connect( mRemoveHeaderButton, SIGNAL(clicked()),
3131 this, SLOT(slotRemoveMimeHeader()) );
3132 button->setAutoDefault(
false );
3133 glay->addWidget( mRemoveHeaderButton, 1, 2 );
3137 mTagNameEdit->setClearButtonShown(
true);
3138 mTagNameEdit->setEnabled(
false );
3139 mTagNameLabel =
new QLabel( i18nc(
"@label:textbox Name of the mime header.",
"&Name:"),
this );
3140 mTagNameLabel->setBuddy( mTagNameEdit );
3141 mTagNameLabel->setEnabled(
false );
3142 glay->addWidget( mTagNameLabel, 3, 0 );
3143 glay->addWidget( mTagNameEdit, 3, 1 );
3144 connect( mTagNameEdit, SIGNAL(textChanged(QString)),
3145 this, SLOT(slotMimeHeaderNameChanged(QString)) );
3148 mTagValueEdit->setClearButtonShown(
true);
3149 mTagValueEdit->setEnabled(
false );
3150 mTagValueLabel =
new QLabel( i18n(
"&Value:"),
this );
3151 mTagValueLabel->setBuddy( mTagValueEdit );
3152 mTagValueLabel->setEnabled(
false );
3153 glay->addWidget( mTagValueLabel, 4, 0 );
3154 glay->addWidget( mTagValueEdit, 4, 1 );
3155 connect( mTagValueEdit, SIGNAL(textChanged(QString)),
3156 this, SLOT(slotMimeHeaderValueChanged(QString)) );
3159 void ComposerPage::HeadersTab::slotMimeHeaderSelectionChanged()
3165 mTagNameEdit->setText( item->text( 0 ) );
3166 mTagValueEdit->setText( item->text( 1 ) );
3168 mTagNameEdit->clear();
3169 mTagValueEdit->clear();
3171 mRemoveHeaderButton->setEnabled( item );
3172 mTagNameEdit->setEnabled( item );
3173 mTagValueEdit->setEnabled( item );
3174 mTagNameLabel->setEnabled( item );
3175 mTagValueLabel->setEnabled( item );
3180 void ComposerPage::HeadersTab::slotMimeHeaderNameChanged(
const QString &
text )
3186 item->setText( 0, text );
3191 void ComposerPage::HeadersTab::slotMimeHeaderValueChanged(
const QString & text )
3197 item->setText( 1, text );
3202 void ComposerPage::HeadersTab::slotNewMimeHeader()
3205 mHeaderList->setCurrentItem( listItem );
3210 void ComposerPage::HeadersTab::slotRemoveMimeHeader()
3215 kDebug() <<
"=================================================="
3216 <<
"Error: Remove button was pressed although no custom header was selected\n"
3217 <<
"==================================================\n";
3224 kDebug() <<
"below";
3225 mHeaderList->setCurrentItem( below );
3228 }
else if ( mHeaderList->topLevelItemCount() > 0 ) {
3231 mHeaderList->setCurrentItem(
3232 mHeaderList->topLevelItem( mHeaderList->topLevelItemCount() - 1 )
3239 void ComposerPage::HeadersTab::doLoadOther()
3241 mMessageIdSuffixEdit->setText( MessageComposer::MessageComposerSettings::customMsgIDSuffix() );
3242 const bool state = ( !MessageComposer::MessageComposerSettings::customMsgIDSuffix().isEmpty() &&
3243 MessageComposer::MessageComposerSettings::useCustomMessageIdSuffix() );
3244 mCreateOwnMessageIdCheck->setChecked( state );
3246 mHeaderList->clear();
3247 mTagNameEdit->clear();
3248 mTagValueEdit->clear();
3253 for (
int i = 0 ; i < count ; ++i ) {
3255 QLatin1String(
"Mime #") + QString::number(i) );
3256 const QString name = config.readEntry(
"name" );
3257 const QString value = config.readEntry(
"value" );
3258 if( !name.isEmpty() ) {
3260 item->setText( 0, name );
3261 item->setText( 1, value );
3264 if ( mHeaderList->topLevelItemCount() > 0 ) {
3265 mHeaderList->setCurrentItem( mHeaderList->topLevelItem( 0 ) );
3269 mRemoveHeaderButton->setEnabled(
false );
3275 MessageComposer::MessageComposerSettings::self()->setCustomMsgIDSuffix( mMessageIdSuffixEdit->text() );
3276 MessageComposer::MessageComposerSettings::self()->setUseCustomMessageIdSuffix( mCreateOwnMessageIdCheck->isChecked() );
3280 for (
int i = 0; i < oldHeadersCount; ++i ) {
3281 const QString groupMimeName = QString::fromLatin1(
"Mime #%1" ).arg( i );
3284 config.deleteGroup();
3289 int numValidEntries = 0;
3291 const int numberOfEntry = mHeaderList->topLevelItemCount();
3292 for (
int i = 0; i < numberOfEntry; ++i ) {
3293 item = mHeaderList->topLevelItem( i );
3294 if( !item->text(0).isEmpty() ) {
3295 KConfigGroup config(
KMKernel::self()->config(), QString::fromLatin1(
"Mime #%1").arg( numValidEntries ) );
3296 config.writeEntry(
"name", item->text( 0 ) );
3297 config.writeEntry(
"value", item->text( 1 ) );
3304 void ComposerPage::HeadersTab::doResetToDefaultsOther()
3306 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
3307 const QString messageIdSuffix = MessageComposer::MessageComposerSettings::customMsgIDSuffix();
3308 const bool useCustomMessageIdSuffix = MessageComposer::MessageComposerSettings::useCustomMessageIdSuffix();
3309 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
3311 mMessageIdSuffixEdit->setText( messageIdSuffix );
3312 const bool state = ( !messageIdSuffix.isEmpty() && useCustomMessageIdSuffix );
3313 mCreateOwnMessageIdCheck->setChecked( state );
3315 mHeaderList->clear();
3316 mTagNameEdit->clear();
3317 mTagValueEdit->clear();
3319 mRemoveHeaderButton->setEnabled(
false );
3324 return QString::fromLatin1(
"configure-composer-attachments");
3333 vlay =
new QVBoxLayout(
this );
3334 vlay->setSpacing( KDialog::spacingHint() );
3335 vlay->setMargin( KDialog::marginHint() );
3338 mOutlookCompatibleCheck =
3339 new QCheckBox( i18n(
"Outlook-compatible attachment naming" ),
this );
3340 mOutlookCompatibleCheck->setChecked(
false );
3341 mOutlookCompatibleCheck->setToolTip( i18n(
3342 "Turn this option on to make Outlook(tm) understand attachment names "
3343 "containing non-English characters" ) );
3344 connect( mOutlookCompatibleCheck, SIGNAL(stateChanged(
int)),
3346 connect( mOutlookCompatibleCheck, SIGNAL(clicked()),
3347 this, SLOT(slotOutlookCompatibleClicked()) );
3348 vlay->addWidget( mOutlookCompatibleCheck );
3349 vlay->addSpacing( 5 );
3352 mMissingAttachmentDetectionCheck =
3353 new QCheckBox( i18n(
"E&nable detection of missing attachments"),
this );
3354 mMissingAttachmentDetectionCheck->setChecked(
true );
3355 connect( mMissingAttachmentDetectionCheck, SIGNAL(stateChanged(
int)),
3357 vlay->addWidget( mMissingAttachmentDetectionCheck );
3360 QHBoxLayout * layAttachment =
new QHBoxLayout;
3361 label =
new QLabel( i18n(
"Warn when inserting attachments larger than:"),
this );
3362 label->setAlignment( Qt::AlignLeft );
3363 layAttachment->addWidget(label);
3365 mMaximumAttachmentSize =
new KIntNumInput(
this );
3366 mMaximumAttachmentSize->setRange( -1, 99999 );
3367 mMaximumAttachmentSize->setSingleStep( 100 );
3368 mMaximumAttachmentSize->setSuffix(i18nc(
"spinbox suffix: unit for kilobyte",
" kB"));
3369 connect( mMaximumAttachmentSize, SIGNAL(valueChanged(
int)),
3371 mMaximumAttachmentSize->setSpecialValueText(i18n(
"No limit"));
3372 layAttachment->addWidget(mMaximumAttachmentSize);
3373 vlay->addLayout(layAttachment);
3377 label =
new QLabel( i18n(
"Recognize any of the following key words as "
3378 "intention to attach a file:"),
this );
3379 label->setAlignment( Qt::AlignLeft );
3380 label->setWordWrap(
true );
3382 vlay->addWidget( label );
3384 PimCommon::SimpleStringListEditor::ButtonCode buttonCode =
3385 static_cast<PimCommon::SimpleStringListEditor::ButtonCode
>( PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify );
3386 mAttachWordsListEditor =
3387 new PimCommon::SimpleStringListEditor(
this, buttonCode,
3388 i18n(
"A&dd..."), i18n(
"Re&move"),
3390 i18n(
"Enter new key word:") );
3391 connect( mAttachWordsListEditor, SIGNAL(
changed()),
3393 vlay->addWidget( mAttachWordsListEditor );
3395 connect( mMissingAttachmentDetectionCheck, SIGNAL(toggled(
bool)),
3396 label, SLOT(setEnabled(
bool)) );
3397 connect( mMissingAttachmentDetectionCheck, SIGNAL(toggled(
bool)),
3398 mAttachWordsListEditor, SLOT(setEnabled(
bool)) );
3401 void ComposerPage::AttachmentsTab::doLoadFromGlobalSettings()
3403 mOutlookCompatibleCheck->setChecked(
3404 MessageComposer::MessageComposerSettings::self()->outlookCompatibleAttachments() );
3405 mMissingAttachmentDetectionCheck->setChecked(
3409 mAttachWordsListEditor->setStringList( attachWordsList );
3410 const int maximumAttachmentSize(MessageComposer::MessageComposerSettings::self()->maximumAttachmentSize());
3411 mMaximumAttachmentSize->setValue(maximumAttachmentSize == -1 ? -1 : MessageComposer::MessageComposerSettings::self()->maximumAttachmentSize()/1024);
3416 MessageComposer::MessageComposerSettings::self()->setOutlookCompatibleAttachments(
3417 mOutlookCompatibleCheck->isChecked() );
3419 mMissingAttachmentDetectionCheck->isChecked() );
3421 mAttachWordsListEditor->stringList() );
3423 KMime::setUseOutlookAttachmentEncoding( mOutlookCompatibleCheck->isChecked() );
3424 const int maximumAttachmentSize(mMaximumAttachmentSize->value());
3425 MessageComposer::MessageComposerSettings::self()->setMaximumAttachmentSize(maximumAttachmentSize == -1 ? -1 : maximumAttachmentSize*1024);
3429 void ComposerPageAttachmentsTab::slotOutlookCompatibleClicked()
3431 if (mOutlookCompatibleCheck->isChecked()) {
3432 KMessageBox::information(0,i18n(
"You have chosen to "
3433 "encode attachment names containing non-English characters in a way that "
3434 "is understood by Outlook(tm) and other mail clients that do not "
3435 "support standard-compliant encoded attachment names.\n"
3436 "Note that KMail may create non-standard compliant messages, "
3437 "and consequently it is possible that your messages will not be "
3438 "understood by standard-compliant mail clients; so, unless you have no "
3439 "other choice, you should not enable this option." ) );
3446 QVBoxLayout *vlay =
new QVBoxLayout(
this );
3447 vlay->setSpacing( 0 );
3448 vlay->setMargin( 0 );
3449 autocorrectionWidget =
new MessageComposer::ComposerAutoCorrectionWidget(
this);
3451 autocorrectionWidget->setAutoCorrection(
KMKernel::self()->composerAutoCorrection());
3452 vlay->addWidget(autocorrectionWidget);
3460 return QString::fromLatin1(
"configure-autocorrection");
3465 autocorrectionWidget->writeConfig();
3468 void ComposerPageAutoCorrectionTab::doLoadFromGlobalSettings()
3470 autocorrectionWidget->loadConfig();
3473 void ComposerPageAutoCorrectionTab::doResetToDefaultsOther()
3475 autocorrectionWidget->resetToDefault();
3482 QVBoxLayout *vlay =
new QVBoxLayout(
this );
3483 vlay->setSpacing( 0 );
3484 vlay->setMargin( 0 );
3485 autoResizeWidget =
new MessageComposer::ImageScalingWidget(
this);
3486 vlay->addWidget(autoResizeWidget);
3494 return QString::fromLatin1(
"configure-image-resize");
3499 autoResizeWidget->writeConfig();
3502 void ComposerPageAutoImageResizeTab::doLoadFromGlobalSettings()
3504 autoResizeWidget->loadConfig();
3507 void ComposerPageAutoImageResizeTab::doResetToDefaultsOther()
3509 autoResizeWidget->resetToDefault();
3520 return QString::fromLatin1(
"configure-security");
3530 addTab( mGeneralTab, i18n(
"Reading") );
3532 addTab(
new MDNTab(), i18n(
"Message Disposition Notifications") );
3538 addTab( mComposerCryptoTab, i18n(
"Composing") );
3544 addTab( mWarningTab, i18n(
"Miscellaneous") );
3550 addTab( mSMimeTab, i18n(
"S/MIME Validation") );
3552 #ifndef KDEPIM_NO_WEBKIT
3554 addTab( mSAdBlockTab, i18n(
"Ad block") );
3560 return QString::fromLatin1(
"configure-security-reading");
3566 mSGTab.setupUi(
this );
3568 connect( mSGTab.mHtmlMailCheck, SIGNAL(stateChanged(
int)),
3570 connect( mSGTab.mExternalReferences, SIGNAL(stateChanged(
int)),
3572 connect(mSGTab.labelWarnHTML, SIGNAL(linkActivated(QString)),
3573 SLOT(slotLinkClicked(QString)));
3575 connect( mSGTab.mAlwaysDecrypt, SIGNAL(stateChanged(
int)),
3578 connect( mSGTab.mAutomaticallyImportAttachedKeysCheck, SIGNAL(toggled(
bool)),
3581 connect( mSGTab.mScamDetection, SIGNAL(toggled(
bool)),
3584 connect( mSGTab.scamWhiteList, SIGNAL(
changed()),
3588 void SecurityPageGeneralTab::slotLinkClicked(
const QString & link )
3590 if ( link == QLatin1String(
"whatsthis1" ) )
3591 QWhatsThis::showText( QCursor::pos(), mSGTab.mHtmlMailCheck->whatsThis() );
3592 else if (link == QLatin1String(
"whatsthis2" ) )
3593 QWhatsThis::showText( QCursor::pos(), mSGTab.mExternalReferences->whatsThis() );
3596 void SecurityPage::GeneralTab::doLoadOther()
3598 mSGTab.mHtmlMailCheck->setChecked( MessageViewer::GlobalSettings::self()->htmlMail() );
3599 mSGTab.mExternalReferences->setChecked( MessageViewer::GlobalSettings::self()->htmlLoadExternal() );
3600 mSGTab.mAutomaticallyImportAttachedKeysCheck->setChecked(
3601 MessageViewer::GlobalSettings::self()->autoImportKeys() );
3603 mSGTab.mAlwaysDecrypt->setChecked( MessageViewer::GlobalSettings::self()->alwaysDecrypt() );
3605 mSGTab.mScamDetection->setChecked( MessageViewer::GlobalSettings::self()->scamDetectionEnabled());
3606 mSGTab.scamWhiteList->setStringList( MessageViewer::GlobalSettings::self()->scamDetectionWhiteList() );
3611 if ( MessageViewer::GlobalSettings::self()->htmlMail() != mSGTab.mHtmlMailCheck->isChecked())
3613 if (KMessageBox::warningContinueCancel(
this, i18n(
"Changing the global "
3614 "HTML setting will override all folder specific values."), QString(),
3615 KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QLatin1String(
"htmlMailOverride")) == KMessageBox::Continue)
3617 MessageViewer::GlobalSettings::self()->setHtmlMail( mSGTab.mHtmlMailCheck->isChecked() );
3618 foreach(
const Akonadi::Collection &collection,
kmkernel->allFolders() ) {
3619 KConfigGroup config(
KMKernel::self()->config(), MailCommon::FolderCollection::configGroupName(collection) );
3620 config.writeEntry(
"htmlMailOverride",
false);
3624 MessageViewer::GlobalSettings::self()->setHtmlLoadExternal( mSGTab.mExternalReferences->isChecked() );
3625 MessageViewer::GlobalSettings::self()->setAutoImportKeys(
3626 mSGTab.mAutomaticallyImportAttachedKeysCheck->isChecked() );
3627 MessageViewer::GlobalSettings::self()->setAlwaysDecrypt( mSGTab.mAlwaysDecrypt->isChecked() );
3628 MessageViewer::GlobalSettings::self()->setScamDetectionEnabled( mSGTab.mScamDetection->isChecked() );
3629 MessageViewer::GlobalSettings::self()->setScamDetectionWhiteList( mSGTab.scamWhiteList->stringList() );
3633 #ifndef KDEPIM_NO_WEBKIT
3642 QHBoxLayout *lay =
new QHBoxLayout;
3645 mWidget =
new MessageViewer::AdBlockSettingWidget;
3646 lay->addWidget(mWidget);
3660 void SecurityPageAdBlockTab::doLoadFromGlobalSettings()
3662 mWidget->doLoadFromGlobalSettings();
3665 void SecurityPageAdBlockTab::doLoadOther()
3670 void SecurityPageAdBlockTab::doResetToDefaultsOther()
3672 mWidget->doResetToDefaultsOther();
3679 return QString::fromLatin1(
"configure-security-mdn");
3685 mUi.setupUi(
this );
3688 mMDNGroup =
new QButtonGroup(
this );
3689 connect( mMDNGroup, SIGNAL(buttonClicked(
int)),
3691 mMDNGroup->addButton( mUi.radioIgnore, 0 );
3692 mMDNGroup->addButton( mUi.radioAsk, 1 );
3693 mMDNGroup->addButton( mUi.radioDeny, 2 );
3694 mMDNGroup->addButton( mUi.radioAlways, 3 );
3697 mOrigQuoteGroup =
new QButtonGroup(
this );
3698 connect( mOrigQuoteGroup, SIGNAL(buttonClicked(
int)),
3700 mOrigQuoteGroup->addButton( mUi.radioNothing, 0 );
3701 mOrigQuoteGroup->addButton( mUi.radioFull, 1 );
3702 mOrigQuoteGroup->addButton( mUi.radioHeaders, 2 );
3704 connect( mUi.mNoMDNsWhenEncryptedCheck, SIGNAL(toggled(
bool)), SLOT(
slotEmitChanged()) );
3705 connect( mUi.labelWarning, SIGNAL(linkActivated(QString)),
3706 SLOT(slotLinkClicked(QString)) );
3709 void SecurityPageMDNTab::slotLinkClicked(
const QString & link )
3711 if ( link == QLatin1String(
"whatsthis-mdn" ) )
3712 QWhatsThis::showText( QCursor::pos(), mUi.radioIgnore->whatsThis() );
3715 void SecurityPage::MDNTab::doLoadOther()
3717 int num = MessageViewer::GlobalSettings::self()->defaultPolicy();
3718 if ( num < 0 || num >= mMDNGroup->buttons().count() ) num = 0;
3719 mMDNGroup->button(num)->setChecked(
true);
3720 num = MessageViewer::GlobalSettings::self()->quoteMessage();
3721 if ( num < 0 || num >= mOrigQuoteGroup->buttons().count() ) num = 0;
3722 mOrigQuoteGroup->button(num)->setChecked(
true);
3723 mUi.mNoMDNsWhenEncryptedCheck->setChecked( MessageViewer::GlobalSettings::self()->notSendWhenEncrypted() );
3728 MessageViewer::GlobalSettings::self()->setDefaultPolicy( mMDNGroup->checkedId() );
3729 MessageViewer::GlobalSettings::self()->setQuoteMessage( mOrigQuoteGroup->checkedId() );
3730 MessageViewer::GlobalSettings::self()->setNotSendWhenEncrypted( mUi.mNoMDNsWhenEncryptedCheck->isChecked() );
3735 return QString::fromLatin1(
"configure-security-composing");
3741 mWidget =
new Ui::ComposerCryptoConfiguration;
3742 mWidget->setupUi(
this );
3743 connect( mWidget->mEncToSelf, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3744 connect( mWidget->mShowEncryptionResult, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3745 connect( mWidget->mShowKeyApprovalDlg, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3746 connect( mWidget->mAutoEncrypt, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3747 connect( mWidget->mNeverEncryptWhenSavingInDrafts, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3748 connect( mWidget->mStoreEncrypted, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3756 void SecurityPage::ComposerCryptoTab::doLoadOther()
3760 mWidget->mEncToSelf->setChecked( MessageComposer::MessageComposerSettings::self()->cryptoEncryptToSelf() );
3761 mWidget->mShowEncryptionResult->setChecked(
false );
3762 mWidget->mShowEncryptionResult->hide();
3763 mWidget->mShowKeyApprovalDlg->setChecked( MessageComposer::MessageComposerSettings::self()->cryptoShowKeysForApproval() );
3765 mWidget->mAutoEncrypt->setChecked( MessageComposer::MessageComposerSettings::self()->pgpAutoEncrypt() ) ;
3766 mWidget->mNeverEncryptWhenSavingInDrafts->setChecked(
3774 MessageComposer::MessageComposerSettings::self()->setCryptoEncryptToSelf( mWidget->mEncToSelf->isChecked() );
3775 GlobalSettings::self()->setCryptoShowEncryptionResult( mWidget->mShowEncryptionResult->isChecked() );
3776 MessageComposer::MessageComposerSettings::self()->setCryptoShowKeysForApproval( mWidget->mShowKeyApprovalDlg->isChecked() );
3778 MessageComposer::MessageComposerSettings::self()->setPgpAutoEncrypt( mWidget->mAutoEncrypt->isChecked() );
3779 GlobalSettings::self()->setNeverEncryptDrafts( mWidget->mNeverEncryptWhenSavingInDrafts->isChecked() );
3784 void SecurityPage::ComposerCryptoTab::doLoadFromGlobalSettings()
3786 mWidget->mEncToSelf->setChecked( MessageComposer::MessageComposerSettings::self()->cryptoEncryptToSelf() );
3787 mWidget->mShowEncryptionResult->setChecked(
GlobalSettings::self()->cryptoShowEncryptionResult() );
3788 mWidget->mShowKeyApprovalDlg->setChecked(MessageComposer::MessageComposerSettings::self()->cryptoShowKeysForApproval() );
3790 mWidget->mAutoEncrypt->setChecked(MessageComposer::MessageComposerSettings::self()->pgpAutoEncrypt() );
3791 mWidget->mNeverEncryptWhenSavingInDrafts->setChecked(
GlobalSettings::self()->neverEncryptDrafts() );
3800 return QString::fromLatin1(
"configure-security-warnings");
3806 mWidget =
new Ui::WarningConfiguration;
3807 mWidget->setupUi(
this );
3809 mWidget->chiasmusButton->hide();
3811 connect( mWidget->warnGroupBox, SIGNAL(toggled(
bool)), SLOT(
slotEmitChanged()) );
3812 connect( mWidget->mWarnUnsigned, SIGNAL(toggled(
bool)), SLOT(
slotEmitChanged()) );
3813 connect( mWidget->warnUnencryptedCB, SIGNAL(toggled(
bool)), SLOT(
slotEmitChanged()) );
3814 connect( mWidget->warnReceiverNotInCertificateCB, SIGNAL(toggled(
bool)), SLOT(
slotEmitChanged()) );
3816 connect( mWidget->gnupgButton, SIGNAL(clicked()), SLOT(slotConfigureGnupg()) );
3818 connect( mWidget->enableAllWarningsPB, SIGNAL(clicked()), SLOT(slotReenableAllWarningsClicked()) );
3826 void SecurityPage::WarningTab::doLoadFromGlobalSettings()
3828 mWidget->warnUnencryptedCB->setChecked(
3829 MessageComposer::MessageComposerSettings::self()->cryptoWarningUnencrypted() );
3830 mWidget->mWarnUnsigned->setChecked(
3831 MessageComposer::MessageComposerSettings::self()->cryptoWarningUnsigned() );
3832 mWidget->warnReceiverNotInCertificateCB->setChecked(
3833 MessageComposer::MessageComposerSettings::self()->cryptoWarnRecvNotInCert() );
3837 mWidget->warnGroupBox->setChecked(
3838 MessageComposer::MessageComposerSettings::self()->cryptoWarnWhenNearExpire() );
3839 mWidget->mWarnSignKeyExpiresSB->setValue(
3840 MessageComposer::MessageComposerSettings::self()->cryptoWarnSignKeyNearExpiryThresholdDays() );
3841 mWidget->mWarnSignChainCertExpiresSB->setValue(
3842 MessageComposer::MessageComposerSettings::self()->cryptoWarnSignChaincertNearExpiryThresholdDays() );
3843 mWidget->mWarnSignRootCertExpiresSB->setValue(
3844 MessageComposer::MessageComposerSettings::self()->cryptoWarnSignRootNearExpiryThresholdDays() );
3846 mWidget->mWarnEncrKeyExpiresSB->setValue(
3847 MessageComposer::MessageComposerSettings::self()->cryptoWarnEncrKeyNearExpiryThresholdDays() );
3848 mWidget->mWarnEncrChainCertExpiresSB->setValue(
3849 MessageComposer::MessageComposerSettings::self()->cryptoWarnEncrChaincertNearExpiryThresholdDays() );
3850 mWidget->mWarnEncrRootCertExpiresSB->setValue(
3851 MessageComposer::MessageComposerSettings::self()->cryptoWarnEncrRootNearExpiryThresholdDays() );
3854 void SecurityPage::WarningTab::doLoadOther()
3856 mWidget->warnUnencryptedCB->setChecked(
3857 MessageComposer::MessageComposerSettings::self()->cryptoWarningUnencrypted() );
3858 mWidget->mWarnUnsigned->setChecked(
3859 MessageComposer::MessageComposerSettings::self()->cryptoWarningUnsigned() );
3860 mWidget->warnReceiverNotInCertificateCB->setChecked(
3861 MessageComposer::MessageComposerSettings::self()->cryptoWarnRecvNotInCert() );
3865 mWidget->warnGroupBox->setChecked(
3866 MessageComposer::MessageComposerSettings::self()->cryptoWarnWhenNearExpire() );
3868 mWidget->mWarnSignKeyExpiresSB->setValue(
3869 MessageComposer::MessageComposerSettings::self()->cryptoWarnSignKeyNearExpiryThresholdDays() );
3870 mWidget->mWarnSignKeyExpiresSB->setSuffix(ki18np(
" day",
" days"));
3871 mWidget->mWarnSignChainCertExpiresSB->setValue(
3872 MessageComposer::MessageComposerSettings::self()->cryptoWarnSignChaincertNearExpiryThresholdDays() );
3873 mWidget->mWarnSignChainCertExpiresSB->setSuffix(ki18np(
" day",
" days"));
3874 mWidget->mWarnSignRootCertExpiresSB->setValue(
3875 MessageComposer::MessageComposerSettings::self()->cryptoWarnSignRootNearExpiryThresholdDays() );
3876 mWidget->mWarnSignRootCertExpiresSB->setSuffix(ki18np(
" day",
" days"));
3878 mWidget->mWarnEncrKeyExpiresSB->setValue(
3879 MessageComposer::MessageComposerSettings::self()->cryptoWarnEncrKeyNearExpiryThresholdDays() );
3880 mWidget->mWarnEncrKeyExpiresSB->setSuffix(ki18np(
" day",
" days"));
3881 mWidget->mWarnEncrChainCertExpiresSB->setValue(
3882 MessageComposer::MessageComposerSettings::self()->cryptoWarnEncrChaincertNearExpiryThresholdDays() );
3883 mWidget->mWarnEncrChainCertExpiresSB->setSuffix(ki18np(
" day",
" days"));
3884 mWidget->mWarnEncrRootCertExpiresSB->setValue(
3885 MessageComposer::MessageComposerSettings::self()->cryptoWarnEncrRootNearExpiryThresholdDays() );
3886 mWidget->mWarnEncrRootCertExpiresSB->setSuffix(ki18np(
" day",
" days"));
3888 mWidget->enableAllWarningsPB->setEnabled(
true );
3893 MessageComposer::MessageComposerSettings::self()->setCryptoWarnRecvNotInCert(
3894 mWidget->warnReceiverNotInCertificateCB->isChecked() );
3895 MessageComposer::MessageComposerSettings::self()->setCryptoWarningUnencrypted(
3896 mWidget->warnUnencryptedCB->isChecked() );
3897 MessageComposer::MessageComposerSettings::self()->setCryptoWarningUnsigned(
3898 mWidget->mWarnUnsigned->isChecked() );
3900 MessageComposer::MessageComposerSettings::self()->setCryptoWarnWhenNearExpire(
3901 mWidget->warnGroupBox->isChecked() );
3902 MessageComposer::MessageComposerSettings::self()->setCryptoWarnSignKeyNearExpiryThresholdDays(
3903 mWidget->mWarnSignKeyExpiresSB->value() );
3904 MessageComposer::MessageComposerSettings::self()->setCryptoWarnSignChaincertNearExpiryThresholdDays(
3905 mWidget->mWarnSignChainCertExpiresSB->value() );
3906 MessageComposer::MessageComposerSettings::self()->setCryptoWarnSignRootNearExpiryThresholdDays(
3907 mWidget->mWarnSignRootCertExpiresSB->value() );
3909 MessageComposer::MessageComposerSettings::self()->setCryptoWarnEncrKeyNearExpiryThresholdDays(
3910 mWidget->mWarnEncrKeyExpiresSB->value() );
3911 MessageComposer::MessageComposerSettings::self()->setCryptoWarnEncrChaincertNearExpiryThresholdDays(
3912 mWidget->mWarnEncrChainCertExpiresSB->value() );
3913 MessageComposer::MessageComposerSettings::self()->setCryptoWarnEncrRootNearExpiryThresholdDays(
3914 mWidget->mWarnEncrRootCertExpiresSB->value() );
3917 void SecurityPage::WarningTab::slotReenableAllWarningsClicked()
3919 KMessageBox::enableAllMessages();
3925 cfgGroup.deleteGroup();
3928 mWidget->enableAllWarningsPB->setEnabled(
false );
3931 void SecurityPage::WarningTab::slotConfigureGnupg()
3934 dlg->addModule( QLatin1String(
"kleopatra_config_gnupgsystem") );
3940 void SecurityPage::WarningTab::slotConfigureChiasmus()
3942 using namespace Kleo;
3944 if (
const CryptoBackendFactory *
const bf = Kleo::CryptoBackendFactory::instance() )
3945 for (
unsigned int i = 0 ;
const CryptoBackend *
const b = bf->backend( i ) ; ++i )
3946 if ( b->name() == QLatin1String(
"Chiasmus" ) )
3947 if ( CryptoConfig *
const c = b->config() ) {
3948 QPointer<CryptoConfigDialog> dlg(
new CryptoConfigDialog( c,
this ) );
3953 kWarning() <<
"Found Chiasmus backend, but there doesn't seem to be a config object available from it.";
3956 kDebug() <<
"Skipping" << b->name() <<
"backend (not \"Chiasmus\")";
3958 kDebug() <<
"Kleo::CryptoBackendFactory::instance() returned NULL!";
3965 return QString::fromLatin1(
"configure-security-smime-validation");
3972 mWidget =
new Ui::SMimeConfiguration;
3973 mWidget->setupUi(
this );
3976 QButtonGroup* bg =
new QButtonGroup(
this );
3977 bg->addButton( mWidget->CRLRB );
3978 bg->addButton( mWidget->OCSPRB );
3981 mWidget->OCSPResponderSignature->setAllowedKeys(
3982 Kleo::KeySelectionDialog::SMIMEKeys
3983 | Kleo::KeySelectionDialog::TrustedKeys
3984 | Kleo::KeySelectionDialog::ValidKeys
3985 | Kleo::KeySelectionDialog::SigningKeys
3986 | Kleo::KeySelectionDialog::PublicKeys );
3987 mWidget->OCSPResponderSignature->setMultipleKeysEnabled(
false );
3989 mConfig = Kleo::CryptoBackendFactory::instance()->config();
3991 connect( mWidget->CRLRB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3992 connect( mWidget->OCSPRB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3993 connect( mWidget->OCSPResponderURL, SIGNAL(textChanged(QString)),
this, SLOT(
slotEmitChanged()) );
3995 connect( mWidget->doNotCheckCertPolicyCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3996 connect( mWidget->neverConsultCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3997 connect( mWidget->fetchMissingCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
3999 connect( mWidget->ignoreServiceURLCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
4000 connect( mWidget->ignoreHTTPDPCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
4001 connect( mWidget->disableHTTPCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
4002 connect( mWidget->honorHTTPProxyRB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
4003 connect( mWidget->useCustomHTTPProxyRB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
4004 connect( mWidget->customHTTPProxy, SIGNAL(textChanged(QString)),
this, SLOT(
slotEmitChanged()) );
4005 connect( mWidget->ignoreLDAPDPCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
4006 connect( mWidget->disableLDAPCB, SIGNAL(toggled(
bool)),
this, SLOT(
slotEmitChanged()) );
4007 connect( mWidget->customLDAPProxy, SIGNAL(textChanged(QString)),
this, SLOT(
slotEmitChanged()) );
4009 connect( mWidget->disableHTTPCB, SIGNAL(toggled(
bool)),
4010 this, SLOT(slotUpdateHTTPActions()) );
4011 connect( mWidget->ignoreHTTPDPCB, SIGNAL(toggled(
bool)),
4012 this, SLOT(slotUpdateHTTPActions()) );
4015 QButtonGroup* bgHTTPProxy =
new QButtonGroup(
this );
4016 bgHTTPProxy->addButton( mWidget->honorHTTPProxyRB );
4017 bgHTTPProxy->addButton( mWidget->useCustomHTTPProxyRB );
4019 QDBusConnection::sessionBus().connect(QString(), QString(), QLatin1String(
"org.kde.kleo.CryptoConfig"), QLatin1String(
"changed"),
this, SLOT(
load()) );
4029 w->setEnabled(
false );
4030 w->setWhatsThis( i18n(
"This option requires dirmngr >= 0.9.0" ) );
4036 cb->setChecked( entry->boolValue() );
4041 struct SMIMECryptoConfigEntries {
4042 SMIMECryptoConfigEntries( Kleo::CryptoConfig* config )
4043 : mConfig( config ) {
4046 mCheckUsingOCSPConfigEntry = configEntry( QLatin1String(
"gpgsm"), QLatin1String(
"Security"), QLatin1String(
"enable-ocsp"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4047 mEnableOCSPsendingConfigEntry = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"OCSP"), QLatin1String(
"allow-ocsp"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4048 mDoNotCheckCertPolicyConfigEntry = configEntry( QLatin1String(
"gpgsm"), QLatin1String(
"Security"), QLatin1String(
"disable-policy-checks"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4049 mNeverConsultConfigEntry = configEntry( QLatin1String(
"gpgsm"), QLatin1String(
"Security"), QLatin1String(
"disable-crl-checks"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4050 mFetchMissingConfigEntry = configEntry( QLatin1String(
"gpgsm"), QLatin1String(
"Security"), QLatin1String(
"auto-issuer-key-retrieve"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4052 mIgnoreServiceURLEntry = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"OCSP"), QLatin1String(
"ignore-ocsp-service-url"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4053 mIgnoreHTTPDPEntry = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"HTTP"), QLatin1String(
"ignore-http-dp"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4054 mDisableHTTPEntry = configEntry(QLatin1String(
"dirmngr"), QLatin1String(
"HTTP"), QLatin1String(
"disable-http"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4055 mHonorHTTPProxy = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"HTTP"), QLatin1String(
"honor-http-proxy"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4057 mIgnoreLDAPDPEntry = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"LDAP"), QLatin1String(
"ignore-ldap-dp"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4058 mDisableLDAPEntry = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"LDAP"), QLatin1String(
"disable-ldap"), Kleo::CryptoConfigEntry::ArgType_None,
false );
4060 mOCSPResponderURLConfigEntry = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"OCSP"), QLatin1String(
"ocsp-responder"), Kleo::CryptoConfigEntry::ArgType_String,
false );
4061 mOCSPResponderSignature = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"OCSP"), QLatin1String(
"ocsp-signer"), Kleo::CryptoConfigEntry::ArgType_String,
false );
4062 mCustomHTTPProxy = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"HTTP"), QLatin1String(
"http-proxy"), Kleo::CryptoConfigEntry::ArgType_String,
false );
4063 mCustomLDAPProxy = configEntry( QLatin1String(
"dirmngr"), QLatin1String(
"LDAP"), QLatin1String(
"ldap-proxy"), Kleo::CryptoConfigEntry::ArgType_String,
false );
4066 Kleo::CryptoConfigEntry* configEntry(
const QString &componentName,
4067 const QString &groupName,
4068 const QString &entryName,
4073 Kleo::CryptoConfigEntry* mCheckUsingOCSPConfigEntry;
4074 Kleo::CryptoConfigEntry* mEnableOCSPsendingConfigEntry;
4075 Kleo::CryptoConfigEntry* mDoNotCheckCertPolicyConfigEntry;
4076 Kleo::CryptoConfigEntry* mNeverConsultConfigEntry;
4077 Kleo::CryptoConfigEntry* mFetchMissingConfigEntry;
4078 Kleo::CryptoConfigEntry* mIgnoreServiceURLEntry;
4079 Kleo::CryptoConfigEntry* mIgnoreHTTPDPEntry;
4080 Kleo::CryptoConfigEntry* mDisableHTTPEntry;
4081 Kleo::CryptoConfigEntry* mHonorHTTPProxy;
4082 Kleo::CryptoConfigEntry* mIgnoreLDAPDPEntry;
4083 Kleo::CryptoConfigEntry* mDisableLDAPEntry;
4085 Kleo::CryptoConfigEntry* mOCSPResponderURLConfigEntry;
4086 Kleo::CryptoConfigEntry* mOCSPResponderSignature;
4087 Kleo::CryptoConfigEntry* mCustomHTTPProxy;
4088 Kleo::CryptoConfigEntry* mCustomLDAPProxy;
4090 Kleo::CryptoConfig* mConfig;
4093 void SecurityPage::SMimeTab::doLoadOther()
4096 setEnabled(
false );
4107 SMIMECryptoConfigEntries e( mConfig );
4111 if ( e.mCheckUsingOCSPConfigEntry ) {
4112 bool b = e.mCheckUsingOCSPConfigEntry->boolValue();
4113 mWidget->OCSPRB->setChecked( b );
4114 mWidget->CRLRB->setChecked( !b );
4115 mWidget->OCSPGroupBox->setEnabled( b );
4117 mWidget->OCSPGroupBox->setEnabled(
false );
4119 if ( e.mDoNotCheckCertPolicyConfigEntry )
4120 mWidget->doNotCheckCertPolicyCB->setChecked( e.mDoNotCheckCertPolicyConfigEntry->boolValue() );
4121 if ( e.mNeverConsultConfigEntry )
4122 mWidget->neverConsultCB->setChecked( e.mNeverConsultConfigEntry->boolValue() );
4123 if ( e.mFetchMissingConfigEntry )
4124 mWidget->fetchMissingCB->setChecked( e.mFetchMissingConfigEntry->boolValue() );
4126 if ( e.mOCSPResponderURLConfigEntry )
4127 mWidget->OCSPResponderURL->setText( e.mOCSPResponderURLConfigEntry->stringValue() );
4128 if ( e.mOCSPResponderSignature ) {
4129 mWidget->OCSPResponderSignature->setFingerprint( e.mOCSPResponderSignature->stringValue() );
4138 if ( e.mCustomHTTPProxy ) {
4139 QString systemProxy = QString::fromLocal8Bit( qgetenv(
"http_proxy" ) );
4140 if ( systemProxy.isEmpty() )
4141 systemProxy = i18n(
"no proxy" );
4142 mWidget->systemHTTPProxy->setText( i18n(
"(Current system setting: %1)", systemProxy ) );
4143 bool honor = e.mHonorHTTPProxy && e.mHonorHTTPProxy->boolValue();
4144 mWidget->honorHTTPProxyRB->setChecked( honor );
4145 mWidget->useCustomHTTPProxyRB->setChecked( !honor );
4146 mWidget->customHTTPProxy->setText( e.mCustomHTTPProxy->stringValue() );
4153 if ( e.mCustomLDAPProxy )
4154 mWidget->customLDAPProxy->setText( e.mCustomLDAPProxy->stringValue() );
4159 slotUpdateHTTPActions();
4162 void SecurityPage::SMimeTab::slotUpdateHTTPActions()
4164 mWidget->ignoreHTTPDPCB->setEnabled( !mWidget->disableHTTPCB->isChecked() );
4167 bool enableProxySettings = !mWidget->disableHTTPCB->isChecked()
4168 && mWidget->ignoreHTTPDPCB->isChecked();
4169 mWidget->systemHTTPProxy->setEnabled( enableProxySettings );
4170 mWidget->useCustomHTTPProxyRB->setEnabled( enableProxySettings );
4171 mWidget->honorHTTPProxyRB->setEnabled( enableProxySettings );
4172 mWidget->customHTTPProxy->setEnabled( enableProxySettings && mWidget->useCustomHTTPProxyRB->isChecked());
4174 if ( !mWidget->useCustomHTTPProxyRB->isChecked() &&
4175 !mWidget->honorHTTPProxyRB->isChecked() )
4176 mWidget->honorHTTPProxyRB->setChecked(
true );
4181 const bool b = cb->isChecked();
4182 if ( entry && entry->boolValue() != b )
4183 entry->setBoolValue( b );
4194 SMIMECryptoConfigEntries e( mConfig );
4196 bool b = mWidget->OCSPRB->isChecked();
4197 if ( e.mCheckUsingOCSPConfigEntry && e.mCheckUsingOCSPConfigEntry->boolValue() != b )
4198 e.mCheckUsingOCSPConfigEntry->setBoolValue( b );
4200 if ( e.mEnableOCSPsendingConfigEntry && e.mEnableOCSPsendingConfigEntry->boolValue() != b )
4201 e.mEnableOCSPsendingConfigEntry->setBoolValue( b );
4207 QString txt = mWidget->OCSPResponderURL->text();
4208 if ( e.mOCSPResponderURLConfigEntry && e.mOCSPResponderURLConfigEntry->stringValue() != txt )
4209 e.mOCSPResponderURLConfigEntry->setStringValue( txt );
4211 txt = mWidget->OCSPResponderSignature->fingerprint();
4212 if ( e.mOCSPResponderSignature && e.mOCSPResponderSignature->stringValue() != txt ) {
4213 e.mOCSPResponderSignature->setStringValue( txt );
4222 if ( e.mCustomHTTPProxy ) {
4223 const bool honor = mWidget->honorHTTPProxyRB->isChecked();
4224 if ( e.mHonorHTTPProxy && e.mHonorHTTPProxy->boolValue() != honor )
4225 e.mHonorHTTPProxy->setBoolValue( honor );
4227 QString chosenProxy = mWidget->customHTTPProxy->text();
4228 if ( chosenProxy != e.mCustomHTTPProxy->stringValue() )
4229 e.mCustomHTTPProxy->setStringValue( chosenProxy );
4231 txt = mWidget->customLDAPProxy->text();
4232 if ( e.mCustomLDAPProxy && e.mCustomLDAPProxy->stringValue() != txt )
4233 e.mCustomLDAPProxy->setStringValue( mWidget->customLDAPProxy->text() );
4235 mConfig->sync(
true );
4238 Kleo::CryptoConfigEntry* SMIMECryptoConfigEntries::configEntry(
const QString &componentName,
4239 const QString &groupName,
4240 const QString &entryName,
4244 Kleo::CryptoConfigEntry* entry = mConfig->entry( componentName, groupName, entryName );
4246 kWarning() << QString::fromLatin1(
"Backend error: gpgconf doesn't seem to know the entry for %1/%2/%3" ).arg( componentName, groupName, entryName );
4249 if( entry->argType() != argType || entry->isList() != isList ) {
4250 kWarning() << QString::fromLatin1(
"Backend error: gpgconf has wrong type for %1/%2/%3: %4 %5" ).arg( componentName, groupName, entryName ).arg( entry->argType() ).arg( entry->isList() );
4263 return QString::fromLatin1(
"configure-misc");
4270 addTab( mFolderTab, i18n(
"Folders") );
4273 addTab( mInviteTab, i18n(
"Invitations" ) );
4276 addTab( mProxyTab, i18n(
"Proxy" ) );
4279 addTab( mAgentSettingsTab, i18n(
"Agent Settings" ) );
4282 addTab( mPrintingTab, i18n(
"Printing" ) );
4287 return QString::fromLatin1(
"Sconfigure-misc-folders");
4293 mMMTab.setupUi(
this );
4295 QHBoxLayout* layout =
new QHBoxLayout;
4296 layout->setContentsMargins(0, 0, 0, 0);
4297 mMMTab.mOnStartupOpenFolder->setLayout( layout );
4298 mOnStartupOpenFolder =
new FolderRequester( mMMTab.mOnStartupOpenFolder );
4299 layout->addWidget( mOnStartupOpenFolder );
4301 mMMTab.gridLayout->setSpacing( KDialog::spacingHint() );
4302 mMMTab.gridLayout->setMargin( KDialog::marginHint() );
4303 mMMTab.mExcludeImportantFromExpiry->setWhatsThis(
4306 connect( mMMTab.mEmptyFolderConfirmCheck, SIGNAL(stateChanged(
int)),
4308 connect( mMMTab.mExcludeImportantFromExpiry, SIGNAL(stateChanged(
int)),
4310 connect( mMMTab.mLoopOnGotoUnread, SIGNAL(activated(
int)),
4312 connect( mMMTab.mActionEnterFolder, SIGNAL(activated(
int)),
4314 connect( mMMTab.mDelayedMarkTime, SIGNAL(valueChanged(
int)),
4316 connect( mMMTab.mDelayedMarkAsRead, SIGNAL(toggled(
bool)),
4317 mMMTab.mDelayedMarkTime, SLOT(setEnabled(
bool)));
4318 connect( mMMTab.mDelayedMarkAsRead, SIGNAL(toggled(
bool)),
4320 connect( mMMTab.mShowPopupAfterDnD, SIGNAL(stateChanged(
int)),
4322 connect( mOnStartupOpenFolder, SIGNAL(folderChanged(Akonadi::Collection)),
4324 connect( mMMTab.mEmptyTrashCheck, SIGNAL(stateChanged(
int)),
4326 connect( mMMTab.mStartUpFolderCheck, SIGNAL(toggled(
bool)),
4328 connect( mMMTab.mStartUpFolderCheck, SIGNAL(toggled(
bool)),
4329 mOnStartupOpenFolder, SLOT(setEnabled(
bool)) );
4332 void MiscPage::FolderTab::doLoadFromGlobalSettings()
4334 mMMTab.mExcludeImportantFromExpiry->setChecked(
GlobalSettings::self()->excludeImportantMailFromExpiry() );
4338 mMMTab.mDelayedMarkAsRead->setChecked( MessageViewer::GlobalSettings::self()->delayedMarkAsRead() );
4339 mMMTab.mDelayedMarkTime->setValue( MessageViewer::GlobalSettings::self()->delayedMarkTime() );
4341 mMMTab.mStartUpFolderCheck->setChecked(
GlobalSettings::self()->startSpecificFolderAtStartup() );
4346 void MiscPage::FolderTab::doLoadOther()
4349 mOnStartupOpenFolder->setCollection( Akonadi::Collection(
GlobalSettings::self()->startupFolder() ) );
4359 MessageViewer::GlobalSettings::self()->setDelayedMarkAsRead( mMMTab.mDelayedMarkAsRead->isChecked() );
4360 MessageViewer::GlobalSettings::self()->setDelayedMarkTime( mMMTab.mDelayedMarkTime->value() );
4365 mMMTab.mExcludeImportantFromExpiry->isChecked() );
4366 GlobalSettings::self()->setStartSpecificFolderAtStartup(mMMTab.mStartUpFolderCheck->isChecked() );
4372 QHBoxLayout *l =
new QHBoxLayout(
this );
4373 l->setContentsMargins( 0 , 0, 0, 0 );
4375 l->addWidget( mConfigureAgent );
4380 void MiscPageAgentSettingsTab::doLoadFromGlobalSettings()
4387 mConfigureAgent->
save();
4403 mInvitationUi =
new MessageViewer::InvitationSettings(
this );
4404 QHBoxLayout *l =
new QHBoxLayout(
this );
4405 l->setContentsMargins( 0 , 0, 0, 0 );
4406 l->addWidget( mInvitationUi );
4410 void MiscPage::InviteTab::doLoadFromGlobalSettings()
4412 mInvitationUi->doLoadFromGlobalSettings();
4417 mInvitationUi->save();
4422 mInvitationUi->doResetToDefaultsOther();
4429 KCModuleInfo proxyInfo(QLatin1String(
"proxy.desktop"));
4430 mProxyModule =
new KCModuleProxy(proxyInfo, parent);
4431 QHBoxLayout *l =
new QHBoxLayout(
this );
4432 l->addWidget( mProxyModule );
4438 mProxyModule->save();
4444 mPrintingUi =
new MessageViewer::PrintingSettings(
this );
4445 QHBoxLayout *l =
new QHBoxLayout(
this );
4446 l->setContentsMargins( 0 , 0, 0, 0 );
4447 l->addWidget( mPrintingUi );
4451 void MiscPagePrintingTab::doLoadFromGlobalSettings()
4453 mPrintingUi->doLoadFromGlobalSettings();
4458 mPrintingUi->doResetToDefaultsOther();
4464 mPrintingUi->save();
4468 #include "configuredialog.moc"
void slotRemoveTag()
Removes the currently selected text in the list box.
QString helpAnchor() const
Should return the help anchor for this page or tab.
QString helpAnchor() const
AppearancePageLayoutTab LayoutTab
ComposerPageCharsetTab CharsetTab
ComposerPageTemplatesTab(QWidget *parent=0)
ComposerPageSubjectTab SubjectTab
~AppearancePageMessageTagTab()
AppearancePageColorsTab ColorsTab
void doResetToDefaultsOther()
SecurityPageWarningTab(QWidget *parent=0)
ComposerPageGeneralTab(QWidget *parent=0)
QString helpAnchor() const
QString helpAnchor() const
virtual QByteArray text(quint32 serialNumber) const =0
SecurityPageMDNTab(QWidget *parent=0)
AppearancePageReaderTab ReaderTab
QString helpAnchor() const
Should return the help anchor for this page or tab.
void slotAddLineTextChanged(const QString &aText)
Enables/disables Add button according to whether aText is empty.
MiscPageFolderTab(QWidget *parent=0)
AppearancePageFontsTab FontsTab
ComposerPageSubjectTab(QWidget *parent=0)
ComposerPageCharsetTab(QWidget *parent=0)
QString helpAnchor() const
MiscPageAgentSettingsTab(QWidget *parent=0)
QString helpAnchor() const
QString helpAnchor() const
AccountsPageSendingTab(QWidget *parent=0)
SecurityPageAdBlockTab(QWidget *parent=0)
ComposerPageExternalEditorTab ExternalEditorTab
QString helpAnchor() const
ComposerPageAttachmentsTab AttachmentsTab
void accountListChanged(const QStringList &)
static KMKernel * self()
normal control stuff
MiscPageInviteTab(QWidget *parent=0)
A delegate for listing the accounts in the account list with kmail specific options.
~SecurityPageWarningTab()
ComposerPageAutoCorrectionTab AutoCorrectionTab
ComposerPageCustomTemplatesTab CustomTemplatesTab
SecurityPageGeneralTab GeneralTab
AccountsPage(const KComponentData &instance, QWidget *parent=0)
QString helpAnchor() const
SecurityPageWarningTab WarningTab
QString helpAnchor() const
virtual ~AccountsPageSendingTab()
void slotMoveTagUp()
Increases the currently selected tag's priority and handles related visual changes.
QString helpAnchor() const
MiscPageProxyTab(QWidget *parent=0)
AppearancePageLayoutTab(QWidget *parent=0)
QString helpAnchor() const
QString helpAnchor() const
Should return the help anchor for this page or tab.
void addTab(ConfigModuleTab *tab, const QString &title)
MiscPageFolderTab FolderTab
MiscPagePrintingTab(QWidget *parent=0)
ComposerPageAutoImageResizeTab AutoImageResizeTab
SecurityPageSMimeTab(QWidget *parent=0)
AppearancePageColorsTab(QWidget *parent=0)
SecurityPageSMimeTab SMimeTab
AppearancePageHeadersTab HeadersTab
MiscPageInviteTab InviteTab
static QString nepomukWarningGroupName()
void slotConfigureRecentAddresses()
void slotAddNewTag()
Creates a generic tag with the visible name from the line edit widget for adding tags.
void slotRequestConfigSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes...
AppearancePageMessageTagTab MessageTagTab
ComposerPageAutoImageResizeTab(QWidget *parent=0)
QString helpAnchor() const
QString helpAnchor() const
Should return the help anchor for this page or tab.
QColor color(int index) const
ComposerPageExternalEditorTab(QWidget *parent=0)
QString helpAnchor() const
void requestSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes...
void doResetToDefaultsOther()
void setColorSilently(int index, const QColor &color)
SecurityPageGeneralTab(QWidget *parent=0)
AppearancePage(const KComponentData &instance, QWidget *parent=0)
SecurityPageComposerCryptoTab(QWidget *parent=0)
QString helpAnchor() const
static GlobalSettings * self()
ComposerPageGeneralTab GeneralTab
AppearancePageMessageTagTab(QWidget *parent=0)
QString helpAnchor() const
QString helpAnchor() const
SecurityPageComposerCryptoTab ComposerCryptoTab
void doResetToDefaultsOther()
MiscPage(const KComponentData &instance, QWidget *parent=0)
QString helpAnchor() const
QString helpAnchor() const
~SecurityPageAdBlockTab()
QString helpAnchor() const
ComposerPage(const KComponentData &instance, QWidget *parent=0)
ComposerPageHeadersTab HeadersTab
ComposerPageAttachmentsTab(QWidget *parent=0)
QString helpAnchor() const
MiscPageProxyTab ProxyTab
AppearancePageFontsTab(QWidget *parent=0)
void slotMoveTagDown()
Decreases the currently selected tag's priority and handles related visual changes.
AccountsPageReceivingTab ReceivingTab
AppearancePageSystemTrayTab(QWidget *parent=0)
ComposerPageAutoCorrectionTab(QWidget *parent=0)
SecurityPage(const KComponentData &instance, QWidget *parent=0)
ComposerPageCustomTemplatesTab(QWidget *parent=0)
AppearancePageSystemTrayTab SystemTrayTab
void addColor(const QString &text, const QColor &color=Qt::black)
AccountsPageSendingTab SendingTab
QString helpAnchor() const
QString helpAnchor() const
ComposerPageTemplatesTab TemplatesTab
QString helpAnchor() const
SecurityPageMDNTab MDNTab
void slotConfigureCompletionOrder()
QString helpAnchor() const
Should return the help anchor for this page or tab.
~SecurityPageComposerCryptoTab()