• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.12
  • kdepim
  • kmail
  • configuredialog
configuredialog.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2  * kmail: KDE mail client
3  * Copyright (C) 2000 Espen Sand, espen@kde.org
4  * Copyright (C) 2001-2003 Marc Mutz, mutz@kde.org
5  * Contains code segments and ideas from earlier kmail dialog code.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include <config-enterprise.h>
24 
25 // my headers:
26 #include "configuredialog.h"
27 #include "configuredialog_p.h"
28 #include "ui_accountspagereceivingtab.h"
29 #include "identity/identitypage.h"
30 
31 #include "settings/globalsettings.h"
32 #include "templatesconfiguration_kfg.h"
33 #include "configuredialoglistview.h"
34 #include "configagentdelegate.h"
35 
36 // other KMail headers:
37 #include "kmkernel.h"
38 #include "kernel/mailkernel.h"
39 #include "pimcommon/widgets/simplestringlisteditor.h"
40 #include "colorlistbox.h"
41 #include <kpimidentities/identitymanager.h>
42 #include "folderrequester.h"
43 #include "kmmainwidget.h"
44 #include "accountconfigorderdialog.h"
45 #include "util.h"
46 
47 #include "foldertreewidget.h"
48 
49 #include "dialog/kmknotify.h"
50 
51 #include "newmailnotifierinterface.h"
52 
53 #include "addressline/recentaddresses.h"
54 using KPIM::RecentAddresses;
55 #include "addressline/completionordereditor.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"
60 
61 #include "messagecomposer/autocorrection/composerautocorrectionwidget.h"
62 #include "messagecomposer/imagescaling/imagescalingwidget.h"
63 
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"
75 
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"
84 
85 #include "messagecomposer/settings/messagecomposersettings.h"
86 #include "configureagentswidget.h"
87 #include <soprano/nao.h>
88 
89 // other kdenetwork headers:
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"
98 
99 #include <mailtransport/transportmanagementwidget.h>
100 using MailTransport::TransportManagementWidget;
101 // other KDE headers:
102 #include <libkdepim/ldap/ldapclientsearch.h>
103 #include <klineedit.h>
104 #include <klocale.h>
105 #include <kcharsets.h>
106 #include <kascii.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>
123 #include <KComboBox>
124 #include <Nepomuk2/Tag>
125 #include <KCModuleProxy>
126 
127 // Qt headers:
128 #include <QCheckBox>
129 #include <QGridLayout>
130 #include <QHBoxLayout>
131 #include <QHideEvent>
132 #include <QLabel>
133 #include <QRadioButton>
134 #include <QGroupBox>
135 #include <QListWidget>
136 #include <QVBoxLayout>
137 #include <QWhatsThis>
138 #include <QDBusConnection>
139 #include <QHostInfo>
140 #include <QTextCodec>
141 #include <QMenu>
142 
143 // other headers:
144 #include <assert.h>
145 #include <stdlib.h>
146 
147 
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>
154 
155 #include <nepomuk2/resourcemanager.h>
156 
157 #include <libkdepim/widgets/nepomukwarning.h>
158 using namespace MailCommon;
159 using namespace KMail;
160 namespace {
161 
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>");
165 
166 void checkLockDown( QWidget * w, const KConfigSkeletonItem *item ) {
167  if ( item->isImmutable() ) {
168  w->setEnabled( false );
169  w->setToolTip( i18n( lockedDownWarning ) );
170  }
171 }
172 
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() );
178  } else {
179  box->setLayout( new QVBoxLayout() );
180  }
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 );
187  }
188 }
189 
190 void populateCheckBox( QCheckBox * b, const KCoreConfigSkeleton::ItemBool *e ) {
191  b->setText( e->label() );
192 }
193 
194 void loadWidget( QCheckBox * b, const KCoreConfigSkeleton::ItemBool *e ) {
195  checkLockDown( b, e );
196  b->setChecked( e->value() );
197 }
198 
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 );
204 }
205 
206 void saveCheckBox( QCheckBox * b, KCoreConfigSkeleton::ItemBool *e ) {
207  e->setValue( b->isChecked() );
208 }
209 
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() );
214  }
215 }
216 }
217 
218 ConfigureDialog::ConfigureDialog( QWidget *parent, bool modal )
219  : KCMultiDialog( parent )
220 {
221  setFaceType( List );
222  setButtons( Help | Default | Cancel | Apply | Ok | Reset );
223  setModal( modal );
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") );
231 
232  connect( this, SIGNAL(okClicked()), SLOT(slotOk()) );
233  connect( this, SIGNAL(applyClicked()), SLOT(slotApply()) );
234 
235  // We store the size of the dialog on hide, because otherwise
236  // the KCMultiDialog starts with the size of the first kcm, not
237  // the largest one. This way at least after the first showing of
238  // the largest kcm the size is kept.
239  const int width = GlobalSettings::self()->configureDialogWidth();
240  const int height = GlobalSettings::self()->configureDialogHeight();
241  if ( width != 0 && height != 0 ) {
242  resize( width, height );
243  }
244 
245 }
246 
247 void ConfigureDialog::hideEvent( QHideEvent *ev )
248 {
249  GlobalSettings::self()->setConfigureDialogWidth( width() );
250  GlobalSettings::self()->setConfigureDialogHeight( height() );
251  KDialog::hideEvent( ev );
252 }
253 
254 ConfigureDialog::~ConfigureDialog()
255 {
256 }
257 
258 void ConfigureDialog::slotApply()
259 {
260  slotApplyClicked();
261  KMKernel::self()->slotRequestConfigSync();
262  emit configChanged();
263 }
264 
265 void ConfigureDialog::slotOk()
266 {
267  slotOkClicked();
268  KMKernel::self()->slotRequestConfigSync();
269  emit configChanged();
270 }
271 
272 // *************************************************************
273 // * *
274 // * AccountsPage *
275 // * *
276 // *************************************************************
277 QString AccountsPage::helpAnchor() const
278 {
279  return QString::fromLatin1("configure-accounts");
280 }
281 
282 AccountsPage::AccountsPage( const KComponentData &instance, QWidget *parent )
283  : ConfigModuleWithTabs( instance, parent )
284 {
285  //
286  // "Receiving" tab:
287  //
288  mReceivingTab = new ReceivingTab();
289  addTab( mReceivingTab, i18nc( "@title:tab Tab page where the user configures accounts to receive mail", "Receiving" ) );
290  connect( mReceivingTab, SIGNAL(accountListChanged(QStringList)),
291  this, SIGNAL(accountListChanged(QStringList)) );
292 
293  //
294  // "Sending" tab:
295  //
296  mSendingTab = new SendingTab();
297  addTab( mSendingTab, i18nc( "@title:tab Tab page where the user configures accounts to send mail", "Sending" ) );
298 }
299 
300 AccountsPageSendingTab::~AccountsPageSendingTab()
301 {
302 }
303 
304 QString AccountsPage::SendingTab::helpAnchor() const
305 {
306  return QString::fromLatin1("configure-accounts-sending");
307 }
308 
309 AccountsPageSendingTab::AccountsPageSendingTab( QWidget * parent )
310  : ConfigModuleTab( parent )
311 {
312  // temp. vars:
313  QVBoxLayout *vlay;
314  QGridLayout *glay;
315  QGroupBox *group;
316 
317  vlay = new QVBoxLayout( this );
318  vlay->setSpacing( KDialog::spacingHint() );
319  vlay->setMargin( KDialog::marginHint() );
320  // label: zero stretch ### FIXME more
321  vlay->addWidget( new QLabel( i18n("Outgoing accounts (add at least one):"), this ) );
322 
323  TransportManagementWidget *tmw = new TransportManagementWidget( this );
324  tmw->layout()->setContentsMargins( 0, 0, 0, 0 );
325  vlay->addWidget( tmw );
326 
327  // "Common options" groupbox:
328  group = new QGroupBox( i18n("Common Options"), this );
329  vlay->addWidget(group);
330 
331  // a grid layout for the contents of the "common options" group box
332  glay = new QGridLayout();
333  group->setLayout( glay );
334  glay->setSpacing( KDialog::spacingHint() );
335  glay->setColumnStretch( 2, 10 );
336 
337  // "confirm before send" check box:
338  mConfirmSendCheck = new QCheckBox( i18n("Confirm &before send"), group );
339  glay->addWidget( mConfirmSendCheck, 0, 0, 1, 2 );
340  connect( mConfirmSendCheck, SIGNAL(stateChanged(int)),
341  this, SLOT(slotEmitChanged()) );
342 
343  mCheckSpellingBeforeSending = new QCheckBox( i18n("Check spelling before sending"), group );
344  glay->addWidget( mCheckSpellingBeforeSending, 1, 0, 1, 2 );
345  connect( mCheckSpellingBeforeSending, SIGNAL(stateChanged(int)),
346  this, SLOT(slotEmitChanged()) );
347 
348  // "send on check" combo:
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)),
357  this, SLOT(slotEmitChanged()) );
358 
359  // "default send method" combo:
360  mSendMethodCombo = new KComboBox( group );
361  mSendMethodCombo->setEditable( false );
362  mSendMethodCombo->addItems( QStringList()
363  << i18n("Send Now")
364  << i18n("Send Later") );
365  glay->addWidget( mSendMethodCombo, 3, 1 );
366  connect( mSendMethodCombo, SIGNAL(activated(int)),
367  this, SLOT(slotEmitChanged()) );
368 
369  // "default domain" input field:
370  mDefaultDomainEdit = new KLineEdit( group );
371  glay->addWidget( mDefaultDomainEdit, 4, 1 );
372  connect( mDefaultDomainEdit, SIGNAL(textChanged(QString)),
373  this, SLOT(slotEmitChanged()) );
374 
375  // labels:
376  QLabel *l = new QLabel( i18n("Send &messages in outbox folder:"), group );
377  l->setBuddy( mSendOnCheckCombo );
378  glay->addWidget( l, 2, 0 );
379 
380  QString msg = i18n( GlobalSettings::self()->sendOnCheckItem()->whatsThis().toUtf8() );
381  l->setWhatsThis( msg );
382  mSendOnCheckCombo->setWhatsThis( msg );
383 
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 );
390 
391  // and now: add QWhatsThis:
392  msg = i18n( "<qt><p>The default domain is used to complete email "
393  "addresses that only consist of the user's name."
394  "</p></qt>" );
395  l->setWhatsThis( msg );
396  mDefaultDomainEdit->setWhatsThis( msg );
397 }
398 
399 void AccountsPage::SendingTab::doLoadFromGlobalSettings()
400 {
401  mSendOnCheckCombo->setCurrentIndex( GlobalSettings::self()->sendOnCheck() );
402 }
403 
404 void AccountsPage::SendingTab::doLoadOther()
405 {
406  mSendMethodCombo->setCurrentIndex( MessageComposer::MessageComposerSettings::self()->sendImmediate() ? 0 : 1 );
407  mConfirmSendCheck->setChecked( GlobalSettings::self()->confirmBeforeSend() );
408  mCheckSpellingBeforeSending->setChecked(GlobalSettings::self()->checkSpellingBeforeSend());
409  QString defaultDomain = MessageComposer::MessageComposerSettings::defaultDomain();
410  if( defaultDomain.isEmpty() ) {
411  defaultDomain = QHostInfo::localHostName();
412  }
413  mDefaultDomainEdit->setText( defaultDomain );
414 }
415 
416 void AccountsPage::SendingTab::save()
417 {
418  GlobalSettings::self()->setSendOnCheck( mSendOnCheckCombo->currentIndex() );
419  MessageComposer::MessageComposerSettings::self()->setDefaultDomain( mDefaultDomainEdit->text() );
420  GlobalSettings::self()->setConfirmBeforeSend( mConfirmSendCheck->isChecked() );
421  GlobalSettings::self()->setCheckSpellingBeforeSend(mCheckSpellingBeforeSending->isChecked());
422  MessageComposer::MessageComposerSettings::self()->setSendImmediate( mSendMethodCombo->currentIndex() == 0 );
423 }
424 
425 QString AccountsPage::ReceivingTab::helpAnchor() const
426 {
427  return QString::fromLatin1("configure-accounts-receiving");
428 }
429 
430 AccountsPageReceivingTab::AccountsPageReceivingTab( QWidget * parent )
431  : ConfigModuleTab( parent )
432 {
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";
436  }
437  mAccountsReceiving.setupUi( this );
438 
439  mAccountsReceiving.vlay->setSpacing( KDialog::spacingHint() );
440  mAccountsReceiving.vlay->setMargin( KDialog::marginHint() );
441 
442  mAccountsReceiving.mAccountList->agentFilterProxyModel()->addMimeTypeFilter( KMime::Message::mimeType() );
443 #ifdef MERGE_KNODE_IN_KMAIL
444  mAccountsReceiving.mAccountList->agentFilterProxyModel()->addMimeTypeFilter( QString::fromLatin1("message/news") );
445 #endif
446 
447  mAccountsReceiving.mAccountList->agentFilterProxyModel()->addCapabilityFilter( QLatin1String("Resource") ); // show only resources, no agents
448  mAccountsReceiving.mAccountList->agentFilterProxyModel()->excludeCapabilities( QLatin1String("MailTransport") );
449  mAccountsReceiving.mAccountList->agentFilterProxyModel()->excludeCapabilities( QLatin1String("Notes") );
450  mAccountsReceiving.mAccountList->view()->setSelectionMode( QAbstractItemView::SingleSelection );
451 
452  mAccountsReceiving.mFilterAccount->setProxy( mAccountsReceiving.mAccountList->agentFilterProxyModel() );
453  mAccountsReceiving.mFilterAccount->lineEdit()->setTrapReturnKey( true );
454 
455  KConfig specialMailCollection(QLatin1String("specialmailcollectionsrc"));
456  if(specialMailCollection.hasGroup(QLatin1String("SpecialCollections"))) {
457  KConfigGroup grp = specialMailCollection.group(QLatin1String("SpecialCollections"));
458  mSpecialMailCollectionIdentifier = grp.readEntry(QLatin1String("DefaultResourceId"));
459  }
460 
461  ConfigAgentDelegate *configDelegate = new ConfigAgentDelegate( mAccountsReceiving.mAccountList->view() );
462  mAccountsReceiving.mAccountList->view()->setItemDelegate( configDelegate );
463  connect( configDelegate, SIGNAL(optionsClicked(QString,QPoint)), this, SLOT(slotShowMailCheckMenu(QString,QPoint)) );
464 
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()) );
469 
470  mAccountsReceiving.hlay->insertWidget(0, mAccountsReceiving.mAccountList);
471 
472  connect( mAccountsReceiving.mAddAccountButton, SIGNAL(clicked()),
473  this, SLOT(slotAddAccount()) );
474 
475  connect( mAccountsReceiving.mModifyAccountButton, SIGNAL(clicked()),
476  this, SLOT(slotModifySelectedAccount()) );
477 
478  connect( mAccountsReceiving.mRemoveAccountButton, SIGNAL(clicked()),
479  this, SLOT(slotRemoveSelectedAccount()) );
480  connect( mAccountsReceiving.mRestartAccountButton, SIGNAL(clicked()),
481  this, SLOT(slotRestartSelectedAccount()) );
482 
483  mAccountsReceiving.group->layout()->setMargin( KDialog::marginHint() );
484  mAccountsReceiving.group->layout()->setSpacing( KDialog::spacingHint() );
485 
486  connect( mAccountsReceiving.mBeepNewMailCheck, SIGNAL(stateChanged(int)),
487  this, SLOT(slotEmitChanged()) );
488 
489  connect( mAccountsReceiving.mVerboseNotificationCheck, SIGNAL(stateChanged(int)),
490  this, SLOT(slotEmitChanged()) );
491 
492  connect( mAccountsReceiving.mOtherNewMailActionsButton, SIGNAL(clicked()),
493  this, SLOT(slotEditNotifications()) );
494  connect( mAccountsReceiving.customizeAccountOrder,SIGNAL(clicked()),this,SLOT(slotCustomizeAccountOrder()));
495 
496  slotAccountSelected( mAccountsReceiving.mAccountList->currentAgentInstance() );
497 
498 }
499 
500 AccountsPageReceivingTab::~AccountsPageReceivingTab()
501 {
502  delete mNewMailNotifierInterface;
503  mRetrievalHash.clear();
504 }
505 
506 void AccountsPageReceivingTab::slotCustomizeAccountOrder()
507 {
508  AccountConfigOrderDialog dlg(this);
509  dlg.exec();
510 }
511 
512 void AccountsPageReceivingTab::slotShowMailCheckMenu( const QString &ident, const QPoint & pos )
513 {
514  QMenu *menu = new QMenu( this );
515 
516  bool IncludeInManualChecks;
517  bool OfflineOnShutdown;
518  bool CheckOnStartup;
519  if( !mRetrievalHash.contains( ident ) ) {
520 
521  const QString resourceGroupPattern( QLatin1String("Resource %1") );
522  KConfigGroup group( KMKernel::self()->config(), resourceGroupPattern.arg( ident ) );
523 
524  IncludeInManualChecks = group.readEntry( "IncludeInManualChecks", true );
525 
526  // "false" is also hardcoded in kmkernel, don't forget to change there.
527  OfflineOnShutdown = group.readEntry( "OfflineOnShutdown", false );
528 
529  CheckOnStartup = group.readEntry( "CheckOnStartup", false );
530  QSharedPointer<RetrievalOptions> opts( new RetrievalOptions( IncludeInManualChecks, OfflineOnShutdown, CheckOnStartup ) );
531  mRetrievalHash.insert( ident, opts );
532  } else {
533  QSharedPointer<RetrievalOptions> opts = mRetrievalHash.value( ident );
534  IncludeInManualChecks = opts->IncludeInManualChecks;
535  OfflineOnShutdown = opts->OfflineOnShutdown;
536  CheckOnStartup = opts->CheckOnStartup;
537  }
538 
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)) );
546  }
547 
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)) );
555  }
556 
557 
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 );
563 
564  connect( checkOnStartup, SIGNAL(toggled(bool)), this, SLOT(slotCheckOnStatupChanged(bool)) );
565 
566  menu->exec( mAccountsReceiving.mAccountList->view()->mapToGlobal( pos ) );
567  delete menu;
568 }
569 
570 void AccountsPageReceivingTab::slotCheckOnStatupChanged( bool checked )
571 {
572  QAction* action = qobject_cast< QAction* >( sender() );
573  const QString ident = action->data().toString();
574 
575  QSharedPointer<RetrievalOptions> opts = mRetrievalHash.value( ident );
576  opts->CheckOnStartup = checked;
577  slotEmitChanged();
578 }
579 
580 
581 void AccountsPageReceivingTab::slotIncludeInCheckChanged( bool checked )
582 {
583  QAction* action = qobject_cast< QAction* >( sender() );
584  const QString ident = action->data().toString();
585 
586  QSharedPointer<RetrievalOptions> opts = mRetrievalHash.value( ident );
587  opts->IncludeInManualChecks = checked;
588  slotEmitChanged();
589 }
590 
591 void AccountsPageReceivingTab::slotOfflineOnShutdownChanged( bool checked )
592 {
593  QAction* action = qobject_cast< QAction* >( sender() );
594  QString ident = action->data().toString();
595 
596  QSharedPointer<RetrievalOptions> opts = mRetrievalHash.value( ident );
597  opts->OfflineOnShutdown = checked;
598  slotEmitChanged();
599 }
600 
601 void AccountsPage::ReceivingTab::slotAccountSelected(const Akonadi::AgentInstance& current)
602 {
603  if ( !current.isValid() ) {
604  mAccountsReceiving.mModifyAccountButton->setEnabled( false );
605  mAccountsReceiving.mRemoveAccountButton->setEnabled( false );
606  mAccountsReceiving.mRestartAccountButton->setEnabled( false );
607  } else {
608  mAccountsReceiving.mModifyAccountButton->setEnabled( !current.type().capabilities().contains( QLatin1String( "NoConfig" ) ) );
609  mAccountsReceiving.mRemoveAccountButton->setEnabled( mSpecialMailCollectionIdentifier != current.identifier() );
610  // Restarting an agent is not possible if it's in Running status... (see AgentProcessInstance::restartWhenIdle)
611  mAccountsReceiving.mRestartAccountButton->setEnabled( ( current.status() != 1 ) );
612  }
613 }
614 
615 void AccountsPage::ReceivingTab::slotAddAccount()
616 {
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") );
623  if ( dlg.exec() ) {
624  const Akonadi::AgentType agentType = dlg.agentType();
625 
626  if ( agentType.isValid() ) {
627 
628  Akonadi::AgentInstanceCreateJob *job = new Akonadi::AgentInstanceCreateJob( agentType, this );
629  job->configure( this );
630  job->start();
631  }
632  }
633 }
634 
635 void AccountsPage::ReceivingTab::slotModifySelectedAccount()
636 {
637  Akonadi::AgentInstance instance = mAccountsReceiving.mAccountList->currentAgentInstance();
638  if ( instance.isValid() ) {
639  KWindowSystem::allowExternalProcessWindowActivation();
640  instance.configure( this );
641  }
642 }
643 
644 
645 
646 void AccountsPage::ReceivingTab::slotRestartSelectedAccount()
647 {
648  const Akonadi::AgentInstance instance = mAccountsReceiving.mAccountList->currentAgentInstance();
649  if ( instance.isValid() ) {
650  instance.restart();
651  }
652 }
653 
654 void AccountsPage::ReceivingTab::slotRemoveSelectedAccount()
655 {
656  const Akonadi::AgentInstance instance = mAccountsReceiving.mAccountList->currentAgentInstance();
657 
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 ) {
662  return;
663  }
664 
665  if ( instance.isValid() )
666  Akonadi::AgentManager::self()->removeInstance( instance );
667 
668  slotAccountSelected( mAccountsReceiving.mAccountList->currentAgentInstance() );
669 
670 }
671 
672 void AccountsPage::ReceivingTab::slotEditNotifications()
673 {
674  QDBusInterface interface( QLatin1String("org.freedesktop.Akonadi.Agent.akonadi_newmailnotifier_agent"), QLatin1String("/NewMailNotifierAgent") );
675  if (interface.isValid()) {
676  interface.call(QLatin1String("showConfigureDialog"), (qlonglong)winId());
677  } else {
678  KMessageBox::error(this, i18n("New Mail Notifier Agent not registered. Please contact your administrator."));
679  }
680 }
681 
682 void AccountsPage::ReceivingTab::doLoadFromGlobalSettings()
683 {
684  mAccountsReceiving.mVerboseNotificationCheck->setChecked( mNewMailNotifierInterface->verboseMailNotification() );
685 }
686 
687 void AccountsPage::ReceivingTab::doLoadOther()
688 {
689  mAccountsReceiving.mBeepNewMailCheck->setChecked( mNewMailNotifierInterface->beepOnNewMails() );
690 }
691 
692 void AccountsPage::ReceivingTab::save()
693 {
694  // Save Mail notification settings
695  mNewMailNotifierInterface->setBeepOnNewMails( mAccountsReceiving.mBeepNewMailCheck->isChecked() );
696  mNewMailNotifierInterface->setVerboseMailNotification( mAccountsReceiving.mVerboseNotificationCheck->isChecked() );
697 
698  const QString resourceGroupPattern( QLatin1String("Resource %1") );
699  QHashIterator<QString, QSharedPointer<RetrievalOptions> > it( mRetrievalHash );
700  while( it.hasNext() ) {
701  it.next();
702  KConfigGroup group( KMKernel::self()->config(), resourceGroupPattern.arg( it.key() ) );
703  QSharedPointer<RetrievalOptions> opts = it.value();
704  group.writeEntry( "IncludeInManualChecks", opts->IncludeInManualChecks);
705  group.writeEntry( "OfflineOnShutdown", opts->OfflineOnShutdown);
706  group.writeEntry( "CheckOnStartup", opts->CheckOnStartup);
707  }
708 }
709 
710 // *************************************************************
711 // * *
712 // * AppearancePage *
713 // * *
714 // *************************************************************
715 QString AppearancePage::helpAnchor() const
716 {
717  return QString::fromLatin1("configure-appearance");
718 }
719 
720 AppearancePage::AppearancePage( const KComponentData &instance, QWidget *parent )
721  : ConfigModuleWithTabs( instance, parent )
722 {
723  //
724  // "Fonts" tab:
725  //
726  mFontsTab = new FontsTab();
727  addTab( mFontsTab, i18n("Fonts") );
728 
729  //
730  // "Colors" tab:
731  //
732  mColorsTab = new ColorsTab();
733  addTab( mColorsTab, i18n("Colors") );
734 
735  //
736  // "Layout" tab:
737  //
738  mLayoutTab = new LayoutTab();
739  addTab( mLayoutTab, i18n("Layout") );
740 
741  //
742  // "Headers" tab:
743  //
744  mHeadersTab = new HeadersTab();
745  addTab( mHeadersTab, i18n("Message List") );
746 
747  //
748  // "Reader window" tab:
749  //
750  mReaderTab = new ReaderTab();
751  addTab( mReaderTab, i18n("Message Window") );
752  addConfig( MessageViewer::GlobalSettings::self(), mReaderTab );
753 
754  //
755  // "System Tray" tab:
756  //
757  mSystemTrayTab = new SystemTrayTab();
758  addTab( mSystemTrayTab, i18n("System Tray") );
759 
760  //
761  // "Message Tag" tab:
762  //
763  mMessageTagTab = new MessageTagTab();
764  addTab( mMessageTagTab, i18n("Message Tags") );
765 }
766 
767 
768 QString AppearancePage::FontsTab::helpAnchor() const
769 {
770  return QString::fromLatin1("configure-appearance-fonts");
771 }
772 
773 static const struct {
774  const char * configName;
775  const char * displayName;
776  bool enableFamilyAndSize;
777  bool onlyFixed;
778 } fontNames[] = {
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 },
791 };
792 static const int numFontNames = sizeof fontNames / sizeof *fontNames;
793 
794 AppearancePageFontsTab::AppearancePageFontsTab( QWidget * parent )
795  : ConfigModuleTab( parent ), mActiveFontIndex( -1 )
796 {
797  assert( numFontNames == sizeof mFont / sizeof *mFont );
798  // tmp. vars:
799  QVBoxLayout *vlay;
800  QHBoxLayout *hlay;
801  QLabel *label;
802 
803  // "Use custom fonts" checkbox, followed by <hr>
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)),
811  this, SLOT(slotEmitChanged()) );
812 
813  // "font location" combo box and label:
814  hlay = new QHBoxLayout(); // inherites spacing
815  vlay->addLayout( hlay );
816  mFontLocationCombo = new KComboBox( this );
817  mFontLocationCombo->setEditable( false );
818  mFontLocationCombo->setEnabled( false ); // !mCustomFontCheck->isChecked()
819 
820  QStringList fontDescriptions;
821  for ( int i = 0 ; i < numFontNames ; ++i )
822  fontDescriptions << i18n( fontNames[i].displayName );
823  mFontLocationCombo->addItems( fontDescriptions );
824 
825  label = new QLabel( i18n("Apply &to:"), this );
826  label->setBuddy( mFontLocationCombo );
827  label->setEnabled( false ); // since !mCustomFontCheck->isChecked()
828  hlay->addWidget( label );
829 
830  hlay->addWidget( mFontLocationCombo );
831  hlay->addStretch( 10 );
832  vlay->addSpacing( KDialog::spacingHint() );
833  mFontChooser = new KFontChooser( this, KFontChooser::DisplayFrame,
834  QStringList(), 4 );
835  mFontChooser->setEnabled( false ); // since !mCustomFontCheck->isChecked()
836  vlay->addWidget( mFontChooser );
837  connect ( mFontChooser, SIGNAL(fontSelected(QFont)),
838  this, SLOT(slotEmitChanged()) );
839 
840 
841  // {en,dis}able widgets depending on the state of mCustomFontCheck:
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)) );
848  // load the right font settings into mFontChooser:
849  connect( mFontLocationCombo, SIGNAL(activated(int)),
850  this, SLOT(slotFontSelectorChanged(int)) );
851 }
852 
853 
854 void AppearancePage::FontsTab::slotFontSelectorChanged( int index )
855 {
856  kDebug() << "slotFontSelectorChanged() called";
857  if( index < 0 || index >= mFontLocationCombo->count() )
858  return; // Should never happen, but it is better to check.
859 
860  // Save current fontselector setting before we install the new:
861  if( mActiveFontIndex == 0 ) {
862  mFont[0] = mFontChooser->font();
863  // hardcode the family and size of "message body" dependant fonts:
864  for ( int i = 0 ; i < numFontNames ; ++i )
865  if ( !fontNames[i].enableFamilyAndSize ) {
866  // ### shall we copy the font and set the save and re-set
867  // {regular,italic,bold,bold italic} property or should we
868  // copy only family and pointSize?
869  mFont[i].setFamily( mFont[0].family() );
870  mFont[i].setPointSize/*Float?*/( mFont[0].pointSize/*Float?*/() );
871  }
872  } else if ( mActiveFontIndex > 0 )
873  mFont[ mActiveFontIndex ] = mFontChooser->font();
874  mActiveFontIndex = index;
875 
876  // Disonnect so the "Apply" button is not activated by the change
877  disconnect ( mFontChooser, SIGNAL(fontSelected(QFont)),
878  this, SLOT(slotEmitChanged()) );
879 
880  // Display the new setting:
881  mFontChooser->setFont( mFont[index], fontNames[index].onlyFixed );
882 
883  connect ( mFontChooser, SIGNAL(fontSelected(QFont)),
884  this, SLOT(slotEmitChanged()) );
885 
886  // Disable Family and Size list if we have selected a quote font:
887  mFontChooser->enableColumn( KFontChooser::FamilyList|KFontChooser::SizeList,
888  fontNames[ index ].enableFamilyAndSize );
889 }
890 
891 void AppearancePage::FontsTab::doLoadOther()
892 {
893  KConfigGroup fonts( KMKernel::self()->config(), "Fonts" );
894  KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" );
895 
896  mFont[0] = KGlobalSettings::generalFont();
897  QFont fixedFont = KGlobalSettings::fixedFont();
898 
899  for ( int i = 0 ; i < numFontNames ; ++i ) {
900  const QString configName = QLatin1String(fontNames[i].configName);
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] );
907  } else {
908  mFont[i] = fonts.readEntry( configName,
909  (fontNames[i].onlyFixed) ? fixedFont : mFont[0] );
910  }
911  }
912  mCustomFontCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultFonts() );
913  mFontLocationCombo->setCurrentIndex( 0 );
914  slotFontSelectorChanged( 0 );
915 }
916 
917 void AppearancePage::FontsTab::save()
918 {
919  KConfigGroup fonts( KMKernel::self()->config(), "Fonts" );
920  KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" );
921 
922  // read the current font (might have been modified)
923  if ( mActiveFontIndex >= 0 )
924  mFont[ mActiveFontIndex ] = mFontChooser->font();
925 
926  const bool customFonts = mCustomFontCheck->isChecked();
927  MessageCore::GlobalSettings::self()->setUseDefaultFonts( !customFonts );
928 
929  for ( int i = 0 ; i < numFontNames ; ++i ) {
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 ) ) {
936  // Don't write font info when we use default fonts, but write
937  // if it's already there:
938  messagelistFont.writeEntry( configName, mFont[i] );
939  }
940  } else {
941  if ( customFonts || fonts.hasKey( configName ) )
942  // Don't write font info when we use default fonts, but write
943  // if it's already there:
944  fonts.writeEntry( configName, mFont[i] );
945  }
946  }
947 }
948 
949 void AppearancePage::FontsTab::doResetToDefaultsOther()
950 {
951  mCustomFontCheck->setChecked( false );
952 }
953 
954 
955 QString AppearancePage::ColorsTab::helpAnchor() const
956 {
957  return QString::fromLatin1("configure-appearance-colors");
958 }
959 
960 static const struct {
961  const char * configName;
962  const char * displayName;
963 } colorNames[] = { // adjust doLoadOther if you change this:
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") },
986  };
987 static const int numColorNames = sizeof colorNames / sizeof *colorNames;
988 
989 AppearancePageColorsTab::AppearancePageColorsTab( QWidget * parent )
990  : ConfigModuleTab( parent )
991 {
992  // tmp. vars:
993  QVBoxLayout *vlay;
994 
995  // "use custom colors" check box
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)),
1002  this, SLOT(slotEmitChanged()) );
1003 
1004  // color list box:
1005  mColorList = new ColorListBox( this );
1006  mColorList->setEnabled( false ); // since !mCustomColorCheck->isChecked()
1007  for ( int i = 0 ; i < numColorNames ; ++i )
1008  mColorList->addColor( i18n(colorNames[i].displayName) );
1009  vlay->addWidget( mColorList, 1 );
1010 
1011  // "recycle colors" check box:
1012  mRecycleColorCheck =
1013  new QCheckBox( i18n("Recycle colors on deep &quoting"), this );
1014  mRecycleColorCheck->setEnabled( false );
1015  vlay->addWidget( mRecycleColorCheck );
1016  connect( mRecycleColorCheck, SIGNAL(stateChanged(int)),
1017  this, SLOT(slotEmitChanged()) );
1018 
1019  // close to quota threshold
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)),
1028  this, SLOT(slotEmitChanged()) );
1029  mCloseToQuotaThreshold->setSuffix( i18n("%"));
1030 
1031  hbox->addWidget( mCloseToQuotaThreshold );
1032  hbox->addWidget( new QWidget(this), 2 );
1033 
1034  // {en,dir}able widgets depending on the state of mCustomColorCheck:
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)),
1040  this, SLOT(slotEmitChanged()) );
1041  connect( mColorList, SIGNAL(changed()),
1042  this, SLOT(slotEmitChanged()) );
1043 }
1044 
1045 void AppearancePage::ColorsTab::doLoadOther()
1046 {
1047  mCustomColorCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultColors() );
1048  mRecycleColorCheck->setChecked( MessageViewer::GlobalSettings::self()->recycleQuoteColors() );
1049  mCloseToQuotaThreshold->setValue( GlobalSettings::self()->closeToQuotaThreshold() );
1050  loadColor( true );
1051 }
1052 
1053 void AppearancePage::ColorsTab::loadColor( bool loadFromConfig )
1054 {
1055  KColorScheme scheme( QPalette::Active, KColorScheme::View );
1056 
1057  KConfigGroup reader( KMKernel::self()->config(), "Reader" );
1058 
1059  KConfigGroup messageListView( KMKernel::self()->config(), "MessageListView::Colors" );
1060 
1061  KConfigGroup collectionFolderView( KMKernel::self()->config(), "CollectionFolderView" );
1062 
1063  static const QColor defaultColor[ numColorNames ] = {
1064  KMail::Util::quoteL1Color(),
1065  KMail::Util::quoteL2Color(),
1066  KMail::Util::quoteL3Color(),
1067  scheme.foreground( KColorScheme::LinkText ).color(), // link
1068  scheme.foreground( KColorScheme::VisitedText ).color(),// visited link
1069  scheme.foreground( KColorScheme::NegativeText ).color(), // misspelled words
1070  MessageList::Util::unreadDefaultMessageColor(), // unread mgs
1071  MessageList::Util::importantDefaultMessageColor(), // important msg
1072  MessageList::Util::todoDefaultMessageColor(), // action item mgs
1073  QColor( 0x00, 0x80, 0xFF ), // pgp encrypted
1074  scheme.background( KColorScheme::PositiveBackground ).color(), // pgp ok, trusted key
1075  QColor( 0xFF, 0xFF, 0x40 ), // pgp ok, untrusted key
1076  QColor( 0xFF, 0xFF, 0x40 ), // pgp unchk
1077  Qt::red, // pgp bad
1078  QColor( 0xFF, 0x40, 0x40 ), // warning text color
1079  MailCommon::Util::defaultQuotaColor(), // close to quota
1080  Qt::lightGray, // colorbar plain bg
1081  Qt::black, // colorbar plain fg
1082  Qt::black, // colorbar html bg
1083  Qt::white, // colorbar html fg
1084  scheme.foreground(KColorScheme::NegativeText).color(), //Broken Account Color
1085  scheme.background().color() // reader background color
1086  };
1087 
1088  for ( int i = 0 ; i < numColorNames ; ++i ) {
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]));
1097  } else {
1098  mColorList->setColorSilently( i, reader.readEntry( configName, defaultColor[i] ) );
1099  }
1100  } else {
1101  mColorList->setColorSilently( i, defaultColor[i] );
1102  }
1103  }
1104 }
1105 
1106 void AppearancePage::ColorsTab::doResetToDefaultsOther()
1107 {
1108  mCustomColorCheck->setChecked( false );
1109  mRecycleColorCheck->setChecked( false );
1110  mCloseToQuotaThreshold->setValue( 80 );
1111  loadColor( false );
1112 }
1113 
1114 void AppearancePage::ColorsTab::save()
1115 {
1116  KConfigGroup reader( KMKernel::self()->config(), "Reader" );
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 );
1121 
1122  KColorScheme scheme( QPalette::Active, KColorScheme::View );
1123 
1124  for ( int i = 0 ; i < numColorNames ; ++i ) {
1125  // Don't write color info when we use default colors, but write
1126  // if it's already there:
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) );
1133 
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));
1140  } else {
1141  if ( customColors || reader.hasKey( configName ) )
1142  reader.writeEntry( configName, mColorList->color(i) );
1143  }
1144  }
1145  MessageViewer::GlobalSettings::self()->setRecycleQuoteColors( mRecycleColorCheck->isChecked() );
1146  GlobalSettings::self()->setCloseToQuotaThreshold( mCloseToQuotaThreshold->value() );
1147 }
1148 
1149 QString AppearancePage::LayoutTab::helpAnchor() const
1150 {
1151  return QString::fromLatin1("configure-appearance-layout");
1152 }
1153 
1154 AppearancePageLayoutTab::AppearancePageLayoutTab( QWidget * parent )
1155  : ConfigModuleTab( parent )
1156 {
1157  // tmp. vars:
1158  QVBoxLayout * vlay;
1159 
1160  vlay = new QVBoxLayout( this );
1161  vlay->setSpacing( KDialog::spacingHint() );
1162  vlay->setMargin( KDialog::marginHint() );
1163 
1164  // "folder list" radio buttons:
1165  populateButtonGroup( mFolderListGroupBox = new QGroupBox( this ),
1166  mFolderListGroup = new QButtonGroup( this ),
1167  Qt::Horizontal, GlobalSettings::self()->folderListItem() );
1168  vlay->addWidget( mFolderListGroupBox );
1169  connect( mFolderListGroup, SIGNAL (buttonClicked(int)),
1170  this, SLOT(slotEmitChanged()) );
1171 
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() ); // space before next box
1178 
1179  // "favorite folders view mode" radio buttons:
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)),
1186  this, SLOT(slotEmitChanged()) );
1187 
1188  QRadioButton* favoriteFoldersViewHiddenRadio = new QRadioButton( i18n( "Never" ), mFavoriteFoldersViewGroupBox );
1189  mFavoriteFoldersViewGroup->addButton( favoriteFoldersViewHiddenRadio, static_cast<int>( MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::HiddenMode ) );
1190  mFavoriteFoldersViewGroupBox->layout()->addWidget( favoriteFoldersViewHiddenRadio );
1191 
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 );
1195 
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 );
1199 
1200  vlay->addWidget( mFavoriteFoldersViewGroupBox );
1201 
1202 
1203  // "folder tooltips" radio buttons:
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)),
1210  this, SLOT(slotEmitChanged()) );
1211 
1212  QRadioButton* folderToolTipsAlwaysRadio = new QRadioButton( i18n( "Always" ), mFolderToolTipsGroupBox );
1213  mFolderToolTipsGroup->addButton( folderToolTipsAlwaysRadio, static_cast< int >( FolderTreeWidget::DisplayAlways ) );
1214  mFolderToolTipsGroupBox->layout()->addWidget( folderToolTipsAlwaysRadio );
1215 
1216  QRadioButton* folderToolTipsNeverRadio = new QRadioButton( i18n( "Never" ), mFolderToolTipsGroupBox );
1217  mFolderToolTipsGroup->addButton( folderToolTipsNeverRadio, static_cast< int >( FolderTreeWidget::DisplayNever ) );
1218  mFolderToolTipsGroupBox->layout()->addWidget( folderToolTipsNeverRadio );
1219 
1220  vlay->addWidget( mFolderToolTipsGroupBox );
1221 
1222  // "show reader window" radio buttons:
1223  populateButtonGroup( mReaderWindowModeGroupBox = new QGroupBox( this ),
1224  mReaderWindowModeGroup = new QButtonGroup( this ),
1225  Qt::Vertical, GlobalSettings::self()->readerWindowModeItem() );
1226  vlay->addWidget( mReaderWindowModeGroupBox );
1227  connect( mReaderWindowModeGroup, SIGNAL (buttonClicked(int)),
1228  this, SLOT(slotEmitChanged()) );
1229 
1230  vlay->addStretch( 10 ); // spacer
1231 }
1232 
1233 void AppearancePage::LayoutTab::doLoadOther()
1234 {
1235  loadWidget( mFolderListGroupBox, mFolderListGroup, GlobalSettings::self()->folderListItem() );
1236  loadWidget( mReaderWindowModeGroupBox, mReaderWindowModeGroup, GlobalSettings::self()->readerWindowModeItem() );
1237  loadWidget( mFavoriteFoldersViewGroupBox, mFavoriteFoldersViewGroup, MailCommon::MailCommonSettings::self()->favoriteCollectionViewModeItem() );
1238  mFolderQuickSearchCB->setChecked( GlobalSettings::self()->enableFolderQuickSearch() );
1239  const int checkedFolderToolTipsPolicy = GlobalSettings::self()->toolTipDisplayPolicy();
1240  if ( checkedFolderToolTipsPolicy < mFolderToolTipsGroup->buttons().size() && checkedFolderToolTipsPolicy >= 0 )
1241  mFolderToolTipsGroup->buttons()[ checkedFolderToolTipsPolicy ]->setChecked( true );
1242 }
1243 
1244 void AppearancePage::LayoutTab::save()
1245 {
1246  saveButtonGroup( mFolderListGroup, GlobalSettings::self()->folderListItem() );
1247  saveButtonGroup( mReaderWindowModeGroup, GlobalSettings::self()->readerWindowModeItem() );
1248  saveButtonGroup( mFavoriteFoldersViewGroup, MailCommon::MailCommonSettings::self()->favoriteCollectionViewModeItem() );
1249  GlobalSettings::self()->setEnableFolderQuickSearch( mFolderQuickSearchCB->isChecked() );
1250  GlobalSettings::self()->setToolTipDisplayPolicy( mFolderToolTipsGroup->checkedId() );
1251 }
1252 
1253 //
1254 // Appearance Message List
1255 //
1256 
1257 QString AppearancePage::HeadersTab::helpAnchor() const
1258 {
1259  return QString::fromLatin1("configure-appearance-headers");
1260 }
1261 
1262 static const struct {
1263  const char * displayName;
1264  DateFormatter::FormatType dateDisplay;
1265 } dateDisplayConfig[] = {
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 }
1270 };
1271 static const int numDateDisplayConfig =
1272  sizeof dateDisplayConfig / sizeof *dateDisplayConfig;
1273 
1274 AppearancePageHeadersTab::AppearancePageHeadersTab( QWidget * parent )
1275  : ConfigModuleTab( parent ),
1276  mCustomDateFormatEdit( 0 )
1277 {
1278  // tmp. vars:
1279  QGroupBox * group;
1280 
1281  QVBoxLayout * vlay = new QVBoxLayout( this );
1282  vlay->setSpacing( KDialog::spacingHint() );
1283  vlay->setMargin( KDialog::marginHint() );
1284 
1285  // "General Options" group:
1286  group = new QGroupBox( i18nc( "General options for the message list.", "General" ), this );
1287  // group->layout()->setSpacing( KDialog::spacingHint() );
1288  QVBoxLayout *gvlay = new QVBoxLayout( group );
1289  gvlay->setSpacing( KDialog::spacingHint() );
1290 
1291  mDisplayMessageToolTips = new QCheckBox(
1292  MessageList::Core::Settings::self()->messageToolTipEnabledItem()->label(), group );
1293  gvlay->addWidget( mDisplayMessageToolTips );
1294 
1295  connect( mDisplayMessageToolTips, SIGNAL(stateChanged(int)),
1296  this, SLOT(slotEmitChanged()) );
1297 
1298  mHideTabBarWithSingleTab = new QCheckBox(
1299  MessageList::Core::Settings::self()->autoHideTabBarWithSingleTabItem()->label(), group );
1300  gvlay->addWidget( mHideTabBarWithSingleTab );
1301 
1302  connect( mHideTabBarWithSingleTab, SIGNAL(stateChanged(int)),
1303  this, SLOT(slotEmitChanged()) );
1304 
1305  mTabsHaveCloseButton = new QCheckBox(
1306  MessageList::Core::Settings::self()->tabsHaveCloseButtonItem()->label(), group );
1307  gvlay->addWidget( mTabsHaveCloseButton );
1308 
1309  connect( mTabsHaveCloseButton, SIGNAL(stateChanged(int)),
1310  this, SLOT(slotEmitChanged()) );
1311 
1312  // "Aggregation"
1313  using MessageList::Utils::AggregationComboBox;
1314  mAggregationComboBox = new AggregationComboBox( group );
1315 
1316  QLabel* aggregationLabel = new QLabel( i18n( "Default aggregation:" ), group );
1317  aggregationLabel->setBuddy( mAggregationComboBox );
1318 
1319  using MessageList::Utils::AggregationConfigButton;
1320  AggregationConfigButton * aggregationConfigButton = new AggregationConfigButton( group, mAggregationComboBox );
1321 
1322  QHBoxLayout * aggregationLayout = new QHBoxLayout();
1323  aggregationLayout->addWidget( aggregationLabel, 1 );
1324  aggregationLayout->addWidget( mAggregationComboBox, 1 );
1325  aggregationLayout->addWidget( aggregationConfigButton, 0 );
1326  gvlay->addLayout( aggregationLayout );
1327 
1328  connect( aggregationConfigButton, SIGNAL(configureDialogCompleted()),
1329  this, SLOT(slotSelectDefaultAggregation()) );
1330  connect( mAggregationComboBox, SIGNAL(activated(int)),
1331  this, SLOT(slotEmitChanged()) );
1332 
1333  // "Theme"
1334  using MessageList::Utils::ThemeComboBox;
1335  mThemeComboBox = new ThemeComboBox( group );
1336 
1337  QLabel *themeLabel = new QLabel( i18n( "Default theme:" ), group );
1338  themeLabel->setBuddy( mThemeComboBox );
1339 
1340  using MessageList::Utils::ThemeConfigButton;
1341  ThemeConfigButton * themeConfigButton = new ThemeConfigButton( group, mThemeComboBox );
1342 
1343  QHBoxLayout * themeLayout = new QHBoxLayout();
1344  themeLayout->addWidget( themeLabel, 1 );
1345  themeLayout->addWidget( mThemeComboBox, 1 );
1346  themeLayout->addWidget( themeConfigButton, 0 );
1347  gvlay->addLayout( themeLayout );
1348 
1349  connect( themeConfigButton, SIGNAL(configureDialogCompleted()),
1350  this, SLOT(slotSelectDefaultTheme()) );
1351  connect( mThemeComboBox, SIGNAL(activated(int)),
1352  this, SLOT(slotEmitChanged()) );
1353 
1354  vlay->addWidget( group );
1355 
1356  // "Date Display" group:
1357  mDateDisplay = new KButtonGroup( this );
1358  mDateDisplay->setTitle( i18n("Date Display") );
1359  gvlay = new QVBoxLayout( mDateDisplay );
1360  gvlay->setSpacing( KDialog::spacingHint() );
1361 
1362  for ( int i = 0 ; i < numDateDisplayConfig ; ++i ) {
1363  const char *label = dateDisplayConfig[i].displayName;
1364  QString buttonLabel;
1365  if ( QString::fromLatin1(label).contains(QLatin1String("%1")) )
1366  buttonLabel = i18n( label, DateFormatter::formatCurrentDate( dateDisplayConfig[i].dateDisplay) );
1367  else
1368  buttonLabel = i18n( label );
1369  QRadioButton *radio = new QRadioButton( buttonLabel, mDateDisplay );
1370  gvlay->addWidget( radio );
1371 
1372  if ( dateDisplayConfig[i].dateDisplay == DateFormatter::Custom ) {
1373  KHBox *hbox = new KHBox( mDateDisplay );
1374  hbox->setSpacing( KDialog::spacingHint() );
1375 
1376  mCustomDateFormatEdit = new KLineEdit( hbox );
1377  mCustomDateFormatEdit->setEnabled( false );
1378  hbox->setStretchFactor( mCustomDateFormatEdit, 1 );
1379 
1380  connect( radio, SIGNAL(toggled(bool)),
1381  mCustomDateFormatEdit, SLOT(setEnabled(bool)) );
1382  connect( mCustomDateFormatEdit, SIGNAL(textChanged(QString)),
1383  this, SLOT(slotEmitChanged()) );
1384 
1385  QLabel *formatHelp = new QLabel(
1386  i18n( "<qt><a href=\"whatsthis1\">Custom format information...</a></qt>"), hbox );
1387  connect( formatHelp, SIGNAL(linkActivated(QString)),
1388  SLOT(slotLinkClicked(QString)) );
1389 
1390  mCustomDateWhatsThis =
1391  i18n("<qt><p><strong>These expressions may be used for the date:"
1392  "</strong></p>"
1393  "<ul>"
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>"
1404  "</ul>"
1405  "<p><strong>These expressions may be used for the time:"
1406  "</strong></p> "
1407  "<ul>"
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>"
1419  "</ul>"
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 );
1425  } } // end for loop populating mDateDisplay
1426 
1427  vlay->addWidget( mDateDisplay );
1428  connect( mDateDisplay, SIGNAL(clicked(int)),
1429  this, SLOT(slotEmitChanged()) );
1430 
1431 
1432  vlay->addStretch( 10 ); // spacer
1433 }
1434 
1435 void AppearancePageHeadersTab::slotLinkClicked( const QString & link )
1436 {
1437  if ( link == QLatin1String( "whatsthis1" ) )
1438  QWhatsThis::showText( QCursor::pos(), mCustomDateWhatsThis );
1439 }
1440 
1441 void AppearancePage::HeadersTab::slotSelectDefaultAggregation()
1442 {
1443  // Select current default aggregation.
1444  mAggregationComboBox->selectDefault();
1445 }
1446 
1447 void AppearancePage::HeadersTab::slotSelectDefaultTheme()
1448 {
1449  // Select current default theme.
1450  mThemeComboBox->selectDefault();
1451 }
1452 
1453 void AppearancePage::HeadersTab::doLoadOther()
1454 {
1455  // "General Options":
1456  mDisplayMessageToolTips->setChecked(
1457  MessageList::Core::Settings::self()->messageToolTipEnabled() );
1458 
1459  mHideTabBarWithSingleTab->setChecked(
1460  MessageList::Core::Settings::self()->autoHideTabBarWithSingleTab() );
1461 
1462  mTabsHaveCloseButton->setChecked(
1463  MessageList::Core::Settings::self()->tabsHaveCloseButton() );
1464 
1465  // "Aggregation":
1466  slotSelectDefaultAggregation();
1467 
1468  // "Theme":
1469  slotSelectDefaultTheme();
1470 
1471  // "Date Display":
1472  setDateDisplay( MessageCore::GlobalSettings::self()->dateFormat(),
1473  MessageCore::GlobalSettings::self()->customDateFormat() );
1474 }
1475 
1476 void AppearancePage::HeadersTab::doLoadFromGlobalSettings()
1477 {
1478  mDisplayMessageToolTips->setChecked(
1479  MessageList::Core::Settings::self()->messageToolTipEnabled() );
1480 
1481  mHideTabBarWithSingleTab->setChecked(
1482  MessageList::Core::Settings::self()->autoHideTabBarWithSingleTab() );
1483 
1484  mTabsHaveCloseButton->setChecked(
1485  MessageList::Core::Settings::self()->tabsHaveCloseButton() );
1486 
1487  // "Aggregation":
1488  slotSelectDefaultAggregation();
1489 
1490  // "Theme":
1491  slotSelectDefaultTheme();
1492 
1493  setDateDisplay( MessageCore::GlobalSettings::self()->dateFormat(),
1494  MessageCore::GlobalSettings::self()->customDateFormat() );
1495 }
1496 
1497 
1498 void AppearancePage::HeadersTab::setDateDisplay( int num, const QString & format )
1499 {
1500  DateFormatter::FormatType dateDisplay =
1501  static_cast<DateFormatter::FormatType>( num );
1502 
1503  // special case: needs text for the line edit:
1504  if ( dateDisplay == DateFormatter::Custom )
1505  mCustomDateFormatEdit->setText( format );
1506 
1507  for ( int i = 0 ; i < numDateDisplayConfig ; ++i )
1508  if ( dateDisplay == dateDisplayConfig[i].dateDisplay ) {
1509  mDateDisplay->setSelected( i );
1510  return;
1511  }
1512  // fell through since none found:
1513  mDateDisplay->setSelected( numDateDisplayConfig - 2 ); // default
1514 }
1515 
1516 void AppearancePage::HeadersTab::save()
1517 {
1518  MessageList::Core::Settings::self()->
1519  setMessageToolTipEnabled( mDisplayMessageToolTips->isChecked() );
1520 
1521  MessageList::Core::Settings::self()->
1522  setAutoHideTabBarWithSingleTab( mHideTabBarWithSingleTab->isChecked() );
1523 
1524  MessageList::Core::Settings::self()->
1525  setTabsHaveCloseButton( mTabsHaveCloseButton->isChecked() );
1526 
1527  KMKernel::self()->savePaneSelection();
1528  // "Aggregation"
1529  mAggregationComboBox->writeDefaultConfig();
1530 
1531  // "Theme"
1532  mThemeComboBox->writeDefaultConfig();
1533 
1534  const int dateDisplayID = mDateDisplay->selected();
1535  // check bounds:
1536  if ( ( dateDisplayID >= 0 ) && ( dateDisplayID < numDateDisplayConfig ) ) {
1537  MessageCore::GlobalSettings::self()->setDateFormat(
1538  static_cast<int>( dateDisplayConfig[ dateDisplayID ].dateDisplay ) );
1539  }
1540  MessageCore::GlobalSettings::self()->setCustomDateFormat( mCustomDateFormatEdit->text() );
1541 }
1542 
1543 
1544 //
1545 // Message Window
1546 //
1547 
1548 QString AppearancePage::ReaderTab::helpAnchor() const
1549 {
1550  return QString::fromLatin1("configure-appearance-reader");
1551 }
1552 
1553 AppearancePageReaderTab::AppearancePageReaderTab( QWidget * parent )
1554  : ConfigModuleTab( parent )
1555 {
1556  QVBoxLayout *topLayout = new QVBoxLayout(this);
1557  topLayout->setSpacing( KDialog::spacingHint() );
1558  topLayout->setMargin( KDialog::marginHint() );
1559 
1560  // "Close message window after replying or forwarding" check box:
1561  populateCheckBox( mCloseAfterReplyOrForwardCheck = new QCheckBox( this ),
1562  GlobalSettings::self()->closeAfterReplyOrForwardItem() );
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)),
1567  this, SLOT(slotEmitChanged()) );
1568 
1569  mViewerSettings = new MessageViewer::ConfigureWidget;
1570  connect( mViewerSettings, SIGNAL(settingsChanged()),
1571  this, SLOT(slotEmitChanged()) );
1572  topLayout->addWidget( mViewerSettings );
1573 
1574  topLayout->addStretch( 100 ); // spacer
1575 }
1576 
1577 void AppearancePage::ReaderTab::doResetToDefaultsOther()
1578 {
1579 }
1580 
1581 void AppearancePage::ReaderTab::doLoadOther()
1582 {
1583  loadWidget( mCloseAfterReplyOrForwardCheck, GlobalSettings::self()->closeAfterReplyOrForwardItem() );
1584  mViewerSettings->readConfig();
1585 }
1586 
1587 
1588 void AppearancePage::ReaderTab::save()
1589 {
1590  saveCheckBox( mCloseAfterReplyOrForwardCheck, GlobalSettings::self()->closeAfterReplyOrForwardItem() );
1591  mViewerSettings->writeConfig();
1592 }
1593 
1594 QString AppearancePage::SystemTrayTab::helpAnchor() const
1595 {
1596  return QString::fromLatin1("configure-appearance-systemtray");
1597 }
1598 
1599 AppearancePageSystemTrayTab::AppearancePageSystemTrayTab( QWidget * parent )
1600  : ConfigModuleTab( parent )
1601 {
1602  QVBoxLayout * vlay = new QVBoxLayout( this );
1603  vlay->setSpacing( KDialog::spacingHint() );
1604  vlay->setMargin( KDialog::marginHint() );
1605 
1606  // "Enable system tray applet" check box
1607  mSystemTrayCheck = new QCheckBox( i18n("Enable system tray icon"), this );
1608  vlay->addWidget( mSystemTrayCheck );
1609  connect( mSystemTrayCheck, SIGNAL(stateChanged(int)),
1610  this, SLOT(slotEmitChanged()) );
1611 
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)),
1616  this, SLOT(slotEmitChanged()) );
1617  connect( mSystemTrayCheck, SIGNAL(toggled(bool)),
1618  mSystemTrayShowUnreadMail, SLOT(setEnabled(bool)) );
1619 
1620 
1621  // System tray modes
1622  mSystemTrayGroup = new KButtonGroup( this );
1623  mSystemTrayGroup->setTitle( i18n("System Tray Mode" ) );
1624  QVBoxLayout *gvlay = new QVBoxLayout( mSystemTrayGroup );
1625  gvlay->setSpacing( KDialog::spacingHint() );
1626 
1627  connect( mSystemTrayGroup, SIGNAL(clicked(int)),
1628  this, SLOT(slotEmitChanged()) );
1629  connect( mSystemTrayCheck, SIGNAL(toggled(bool)),
1630  mSystemTrayGroup, SLOT(setEnabled(bool)) );
1631 
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 ) );
1634 
1635  vlay->addWidget( mSystemTrayGroup );
1636  vlay->addStretch( 10 ); // spacer
1637 }
1638 
1639 void AppearancePage::SystemTrayTab::doLoadFromGlobalSettings()
1640 {
1641  mSystemTrayCheck->setChecked( GlobalSettings::self()->systemTrayEnabled() );
1642  mSystemTrayShowUnreadMail->setChecked( GlobalSettings::self()->systemTrayShowUnread() );
1643  mSystemTrayGroup->setSelected( GlobalSettings::self()->systemTrayPolicy() );
1644  mSystemTrayGroup->setEnabled( mSystemTrayCheck->isChecked() );
1645 }
1646 
1647 void AppearancePage::SystemTrayTab::save()
1648 {
1649  GlobalSettings::self()->setSystemTrayEnabled( mSystemTrayCheck->isChecked() );
1650  GlobalSettings::self()->setSystemTrayPolicy( mSystemTrayGroup->selected() );
1651  GlobalSettings::self()->setSystemTrayShowUnread( mSystemTrayShowUnreadMail->isChecked() );
1652  GlobalSettings::self()->writeConfig();
1653 }
1654 
1655 QString AppearancePage::MessageTagTab::helpAnchor() const
1656 {
1657  return QString::fromLatin1("configure-appearance-messagetag");
1658 }
1659 
1660 
1661 TagListWidgetItem::TagListWidgetItem(QListWidget *parent)
1662  : QListWidgetItem(parent), mTag( 0 )
1663 {
1664 }
1665 
1666 TagListWidgetItem::TagListWidgetItem(const QIcon & icon, const QString & text, QListWidget * parent )
1667  : QListWidgetItem(icon, text, parent), mTag( 0 )
1668 {
1669 }
1670 
1671 TagListWidgetItem::~TagListWidgetItem()
1672 {
1673 }
1674 
1675 void TagListWidgetItem::setKMailTag( const MailCommon::Tag::Ptr& tag )
1676 {
1677  mTag = tag;
1678 }
1679 
1680 MailCommon::Tag::Ptr TagListWidgetItem::kmailTag() const
1681 {
1682  return mTag;
1683 }
1684 
1685 
1686 AppearancePageMessageTagTab::AppearancePageMessageTagTab( QWidget * parent )
1687  : ConfigModuleTab( parent )
1688 {
1689  mPreviousTag = -1;
1690  QHBoxLayout *maingrid = new QHBoxLayout( this );
1691  maingrid->setMargin( KDialog::marginHint() );
1692  maingrid->setSpacing( KDialog::spacingHint() );
1693 
1694  mNepomukActive = Nepomuk2::ResourceManager::instance()->initialized();
1695  if ( mNepomukActive ) {
1696 
1697  //Lefthand side Listbox and friends
1698 
1699  //Groupbox frame
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() );
1706 
1707  //Listbox, add, remove row
1708  QHBoxLayout *addremovegrid = new QHBoxLayout();
1709  tageditgrid->addLayout( addremovegrid );
1710 
1711  mTagAddLineEdit = new KLineEdit( mTagsGroupBox );
1712  mTagAddLineEdit->setTrapReturnKey( true );
1713  addremovegrid->addWidget( mTagAddLineEdit );
1714 
1715  mTagAddButton = new KPushButton( mTagsGroupBox );
1716  mTagAddButton->setToolTip( i18n("Add new tag") );
1717  mTagAddButton->setIcon( KIcon( QLatin1String("list-add") ) );
1718  addremovegrid->addWidget( mTagAddButton );
1719 
1720  mTagRemoveButton = new KPushButton( mTagsGroupBox );
1721  mTagRemoveButton->setToolTip( i18n("Remove selected tag") );
1722  mTagRemoveButton->setIcon( KIcon( QLatin1String("list-remove") ) );
1723  addremovegrid->addWidget( mTagRemoveButton );
1724 
1725  //Up and down buttons
1726  QHBoxLayout *updowngrid = new QHBoxLayout();
1727  tageditgrid->addLayout( updowngrid );
1728 
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 );
1734 
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 );
1740 
1741  //Listbox for tag names
1742  QHBoxLayout *listboxgrid = new QHBoxLayout();
1743  tageditgrid->addLayout( listboxgrid );
1744  mTagListBox = new QListWidget( mTagsGroupBox );
1745  mTagListBox->setDragDropMode(QAbstractItemView::InternalMove);
1746  connect( mTagListBox->model(),SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),SLOT(slotRowsMoved(QModelIndex,int,int,QModelIndex,int)) );
1747 
1748  mTagListBox->setMinimumWidth( 150 );
1749  listboxgrid->addWidget( mTagListBox );
1750 
1751  //RHS for individual tag settings
1752 
1753  //Extra VBoxLayout for stretchers around settings
1754  QVBoxLayout *tagsettinggrid = new QVBoxLayout();
1755  maingrid->addLayout( tagsettinggrid );
1756  //tagsettinggrid->addStretch( 10 );
1757 
1758  //Groupbox frame
1759  mTagSettingGroupBox = new QGroupBox( i18n("Ta&g Settings"),
1760  this );
1761  tagsettinggrid->addWidget( mTagSettingGroupBox );
1762  QList<KActionCollection *> actionCollections;
1763  if( kmkernel->getKMMainWidget() )
1764  actionCollections = kmkernel->getKMMainWidget()->actionCollections();
1765 
1766  QHBoxLayout *lay = new QHBoxLayout(mTagSettingGroupBox);
1767  mTagWidget = new MailCommon::TagWidget(actionCollections,this);
1768  lay->addWidget(mTagWidget);
1769 
1770  connect(mTagWidget,SIGNAL(changed()),this, SLOT(slotEmitChangeCheck()));
1771 
1772  //For enabling the add button in case box is non-empty
1773  connect( mTagAddLineEdit, SIGNAL(textChanged(QString)),
1774  this, SLOT(slotAddLineTextChanged(QString)) );
1775 
1776  //For on-the-fly updating of tag name in editbox
1777  connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1778  this, SLOT(slotNameLineTextChanged(QString)) );
1779 
1780  connect( mTagWidget, SIGNAL(iconNameChanged(QString)), SLOT(slotIconNameChanged(QString)) );
1781 
1782  connect( mTagAddLineEdit, SIGNAL(returnPressed()),
1783  this, SLOT(slotAddNewTag()) );
1784 
1785 
1786  connect( mTagAddButton, SIGNAL(clicked()),
1787  this, SLOT(slotAddNewTag()) );
1788 
1789  connect( mTagRemoveButton, SIGNAL(clicked()),
1790  this, SLOT(slotRemoveTag()) );
1791 
1792  connect( mTagUpButton, SIGNAL(clicked()),
1793  this, SLOT(slotMoveTagUp()) );
1794 
1795  connect( mTagDownButton, SIGNAL(clicked()),
1796  this, SLOT(slotMoveTagDown()) );
1797 
1798  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1799  this, SLOT(slotSelectionChanged()) );
1800  //Adjust widths for columns
1801  maingrid->setStretchFactor( mTagsGroupBox, 1 );
1802  maingrid->setStretchFactor( lay, 1 );
1803  tagsettinggrid->addStretch( 10 );
1804 
1805 
1806  } else {
1807  QLabel *lab = new QLabel;
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 );
1811  }
1812 }
1813 
1814 AppearancePageMessageTagTab::~AppearancePageMessageTagTab()
1815 {
1816 }
1817 
1818 void AppearancePage::MessageTagTab::slotEmitChangeCheck()
1819 {
1820  slotEmitChanged();
1821 }
1822 
1823 void AppearancePage::MessageTagTab::slotRowsMoved( const QModelIndex &,
1824  int sourcestart, int sourceEnd,
1825  const QModelIndex &, int destinationRow )
1826 {
1827  Q_UNUSED( sourceEnd );
1828  Q_UNUSED( sourcestart );
1829  Q_UNUSED( destinationRow );
1830  updateButtons();
1831  slotEmitChangeCheck();
1832 }
1833 
1834 
1835 void AppearancePage::MessageTagTab::updateButtons()
1836 {
1837  const int currentIndex = mTagListBox->currentRow();
1838 
1839  const bool theFirst = ( currentIndex == 0 );
1840  const bool theLast = ( currentIndex >= (int)mTagListBox->count() - 1 );
1841  const bool aFilterIsSelected = ( currentIndex >= 0 );
1842 
1843  mTagUpButton->setEnabled( aFilterIsSelected && !theFirst );
1844  mTagDownButton->setEnabled( aFilterIsSelected && !theLast );
1845 }
1846 
1847 void AppearancePage::MessageTagTab::slotMoveTagUp()
1848 {
1849  const int tmp_index = mTagListBox->currentRow();
1850  if ( tmp_index <= 0 )
1851  return;
1852  swapTagsInListBox( tmp_index, tmp_index - 1 );
1853  updateButtons();
1854 }
1855 
1856 void AppearancePage::MessageTagTab::slotMoveTagDown()
1857 {
1858  const int tmp_index = mTagListBox->currentRow();
1859  if ( ( tmp_index < 0 )
1860  || ( tmp_index >= int( mTagListBox->count() ) - 1 ) )
1861  return;
1862  swapTagsInListBox( tmp_index, tmp_index + 1 );
1863  updateButtons();
1864 }
1865 
1866 void AppearancePage::MessageTagTab::swapTagsInListBox( const int first,
1867  const int second )
1868 {
1869  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1870  this, SLOT(slotSelectionChanged()) );
1871  QListWidgetItem *item = mTagListBox->takeItem( first );
1872  // now selected item is at idx(idx-1), so
1873  // insert the other item at idx, ie. above(below).
1874  mPreviousTag = second;
1875  mTagListBox->insertItem( second, item );
1876  mTagListBox->setCurrentRow( second );
1877  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1878  this, SLOT(slotSelectionChanged()) );
1879  slotEmitChangeCheck();
1880 }
1881 
1882 void AppearancePage::MessageTagTab::slotRecordTagSettings( int aIndex )
1883 {
1884  if ( ( aIndex < 0 ) || ( aIndex >= int( mTagListBox->count() ) ) )
1885  return;
1886  QListWidgetItem *item = mTagListBox->item( aIndex );
1887  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
1888 
1889  MailCommon::Tag::Ptr tmp_desc = tagItem->kmailTag();
1890 
1891  tmp_desc->tagName = tagItem->text();
1892  mTagWidget->recordTagSettings(tmp_desc);
1893 }
1894 
1895 void AppearancePage::MessageTagTab::slotUpdateTagSettingWidgets( int aIndex )
1896 {
1897  //Check if selection is valid
1898  if ( ( aIndex < 0 ) || ( mTagListBox->currentRow() < 0 ) ) {
1899  mTagRemoveButton->setEnabled( false );
1900  mTagUpButton->setEnabled( false );
1901  mTagDownButton->setEnabled( false );
1902 
1903  mTagWidget->setEnabled(false);
1904  return;
1905  }
1906  mTagWidget->setEnabled(true);
1907 
1908  mTagRemoveButton->setEnabled( true );
1909  mTagUpButton->setEnabled( ( 0 != aIndex ) );
1910  mTagDownButton->setEnabled(( ( int( mTagListBox->count() ) - 1 ) != aIndex ) );
1911  QListWidgetItem * item = mTagListBox->currentItem();
1912  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
1913  MailCommon::Tag::Ptr tmp_desc = tagItem->kmailTag();
1914 
1915  mTagRemoveButton->setEnabled( !tmp_desc->tagStatus );
1916 
1917  disconnect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1918  this, SLOT(slotNameLineTextChanged(QString)) );
1919 
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)) );
1924 
1925 
1926  mTagWidget->setTagTextColor(tmp_desc->textColor);
1927 
1928  mTagWidget->setTagBackgroundColor(tmp_desc->backgroundColor);
1929 
1930  mTagWidget->setTagTextFont(tmp_desc->textFont);
1931 
1932  mTagWidget->iconButton()->setEnabled( !tmp_desc->tagStatus );
1933  mTagWidget->iconButton()->setIcon( tmp_desc->iconName );
1934 
1935  mTagWidget->keySequenceWidget()->setEnabled( true );
1936  mTagWidget->keySequenceWidget()->setKeySequence( tmp_desc->shortcut.primary(),
1937  KKeySequenceWidget::NoValidate );
1938 
1939  mTagWidget->inToolBarCheck()->setEnabled( true );
1940  mTagWidget->inToolBarCheck()->setChecked( tmp_desc->inToolbar );
1941 }
1942 
1943 void AppearancePage::MessageTagTab::slotSelectionChanged()
1944 {
1945  mEmitChanges = false;
1946  slotRecordTagSettings( mPreviousTag );
1947  slotUpdateTagSettingWidgets( mTagListBox->currentRow() );
1948  mPreviousTag = mTagListBox->currentRow();
1949  mEmitChanges = true;
1950 }
1951 
1952 void AppearancePage::MessageTagTab::slotRemoveTag()
1953 {
1954  int tmp_index = mTagListBox->currentRow();
1955  if ( tmp_index >= 0 ) {
1956  QListWidgetItem * item = mTagListBox->takeItem( mTagListBox->currentRow() );
1957  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
1958  MailCommon::Tag::Ptr tmp_desc = tagItem->kmailTag();
1959  Nepomuk2::Tag nepomukTag( tmp_desc->nepomukResourceUri );
1960  nepomukTag.remove();
1961  mPreviousTag = -1;
1962 
1963  //Before deleting the current item, make sure the selectionChanged signal
1964  //is disconnected, so that the widgets will not get updated while the
1965  //deletion takes place.
1966  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1967  this, SLOT(slotSelectionChanged()) );
1968 
1969  delete item;
1970  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1971  this, SLOT(slotSelectionChanged()) );
1972 
1973  slotSelectionChanged();
1974  slotEmitChangeCheck();
1975  }
1976 }
1977 
1978 void AppearancePage::MessageTagTab::slotNameLineTextChanged( const QString
1979  &aText )
1980 {
1981  //If deleted all, leave the first character for the sake of not having an
1982  //empty tag name
1983  if ( aText.isEmpty() && !mTagListBox->currentItem())
1984  return;
1985 
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)) );
1995  return;
1996  }
1997  }
1998 
1999 
2000  //Disconnect so the tag information is not saved and reloaded with every
2001  //letter
2002  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
2003  this, SLOT(slotSelectionChanged()) );
2004 
2005  mTagListBox->currentItem()->setText( aText );
2006  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
2007  this, SLOT(slotSelectionChanged()) );
2008 }
2009 
2010 void AppearancePage::MessageTagTab::slotIconNameChanged( const QString &iconName )
2011 {
2012  mTagListBox->currentItem()->setIcon( KIcon( iconName ) );
2013 }
2014 
2015 void AppearancePage::MessageTagTab::slotAddLineTextChanged( const QString &aText )
2016 {
2017  mTagAddButton->setEnabled( !aText.isEmpty() );
2018 }
2019 
2020 void AppearancePage::MessageTagTab::slotAddNewTag()
2021 {
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."));
2027  return;
2028  }
2029  }
2030 
2031 
2032  const int tmp_priority = mTagListBox->count();
2033  Nepomuk2::Tag nepomukTag( newTagName );
2034  nepomukTag.setLabel( newTagName );
2035 
2036  MailCommon::Tag::Ptr tag = MailCommon::Tag::fromNepomuk( nepomukTag );
2037  tag->priority = tmp_priority;
2038  slotEmitChangeCheck();
2039  TagListWidgetItem *newItem = new TagListWidgetItem( KIcon( tag->iconName ), newTagName, mTagListBox );
2040  newItem->setKMailTag( tag );
2041  mTagListBox->addItem( newItem );
2042  mTagListBox->setCurrentItem( newItem );
2043  mTagAddLineEdit->setText( QString() );
2044 }
2045 
2046 void AppearancePage::MessageTagTab::doLoadFromGlobalSettings()
2047 {
2048  if ( !mNepomukActive )
2049  return;
2050 
2051  mTagListBox->clear();
2052  QList<MailCommon::TagPtr> msgTagList;
2053  foreach( const Nepomuk2::Tag &nepomukTag, Nepomuk2::Tag::allTags() ) {
2054  MailCommon::Tag::Ptr tag = MailCommon::Tag::fromNepomuk( nepomukTag );
2055  msgTagList.append( tag );
2056  }
2057 
2058  qSort( msgTagList.begin(), msgTagList.end(), MailCommon::Tag::compare );
2059 
2060  foreach( const MailCommon::Tag::Ptr& tag, msgTagList ) {
2061  TagListWidgetItem *newItem = new TagListWidgetItem( KIcon( tag->iconName ), tag->tagName, mTagListBox );
2062  newItem->setKMailTag( tag );
2063  if ( tag->priority == -1 )
2064  tag->priority = mTagListBox->count() - 1;
2065  }
2066 
2067  //Disconnect so that insertItem's do not trigger an update procedure
2068  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
2069  this, SLOT(slotSelectionChanged()) );
2070 
2071  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
2072  this, SLOT(slotSelectionChanged()) );
2073 
2074  slotUpdateTagSettingWidgets( -1 );
2075  //Needed since the previous function doesn't affect add button
2076  mTagAddButton->setEnabled( false );
2077 
2078  // Save the original list
2079  mOriginalMsgTagList.clear();
2080  foreach( const MailCommon::TagPtr &tag, msgTagList ) {
2081  mOriginalMsgTagList.append( MailCommon::TagPtr( new MailCommon::Tag( *tag ) ) );
2082  }
2083 }
2084 
2085 void AppearancePage::MessageTagTab::save()
2086 {
2087  if ( !mNepomukActive ) {
2088  return;
2089  }
2090 
2091  const int currentRow = mTagListBox->currentRow();
2092  if ( currentRow < 0 ) {
2093  return;
2094  }
2095 
2096  const int count = mTagListBox->count();
2097  if ( !count ) {
2098  return;
2099  }
2100 
2101  QListWidgetItem *item = mTagListBox->currentItem();
2102  if ( !item ) {
2103  return;
2104  }
2105 
2106  slotRecordTagSettings( currentRow );
2107  const int numberOfMsgTagList = count;
2108  for ( int i=0; i < numberOfMsgTagList; ++i ) {
2109  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( mTagListBox->item(i) );
2110  if ( ( i>=mOriginalMsgTagList.count() ) || *(tagItem->kmailTag()) != *(mOriginalMsgTagList[i]) ) {
2111  MailCommon::Tag::Ptr tag = tagItem->kmailTag();
2112  tag->priority = i;
2113 
2114  MailCommon::Tag::SaveFlags saveFlags = mTagWidget->saveFlags();
2115  tag->saveToNepomuk( saveFlags );
2116  }
2117  }
2118 
2119 }
2120 
2121 
2122 // *************************************************************
2123 // * *
2124 // * ComposerPage *
2125 // * *
2126 // *************************************************************
2127 
2128 QString ComposerPage::helpAnchor() const
2129 {
2130  return QString::fromLatin1("configure-composer");
2131 }
2132 
2133 ComposerPage::ComposerPage( const KComponentData &instance, QWidget *parent )
2134  : ConfigModuleWithTabs( instance, parent )
2135 {
2136  //
2137  // "General" tab:
2138  //
2139  mGeneralTab = new GeneralTab();
2140  addTab( mGeneralTab, i18nc("General settings for the composer.", "General") );
2141  addConfig( GlobalSettings::self(), mGeneralTab );
2142 
2143  //
2144  // "Templates" tab:
2145  //
2146  mTemplatesTab = new TemplatesTab();
2147  addTab( mTemplatesTab, i18n("Standard Templates") );
2148 
2149  //
2150  // "Custom Templates" tab:
2151  //
2152  mCustomTemplatesTab = new CustomTemplatesTab();
2153  addTab( mCustomTemplatesTab, i18n("Custom Templates") );
2154 
2155  //
2156  // "Subject" tab:
2157  //
2158  mSubjectTab = new SubjectTab();
2159  addTab( mSubjectTab, i18nc("Settings regarding the subject when composing a message.","Subject") );
2160  addConfig( GlobalSettings::self(), mSubjectTab );
2161 
2162  //
2163  // "Charset" tab:
2164  //
2165  mCharsetTab = new CharsetTab();
2166  addTab( mCharsetTab, i18n("Charset") );
2167 
2168  //
2169  // "Headers" tab:
2170  //
2171  mHeadersTab = new HeadersTab();
2172  addTab( mHeadersTab, i18n("Headers") );
2173 
2174  //
2175  // "Attachments" tab:
2176  //
2177  mAttachmentsTab = new AttachmentsTab();
2178  addTab( mAttachmentsTab, i18nc("Config->Composer->Attachments", "Attachments") );
2179 
2180  //
2181  // "autocorrection" tab:
2182  //
2183  mAutoCorrectionTab = new AutoCorrectionTab();
2184  addTab( mAutoCorrectionTab, i18n("Autocorrection") );
2185 
2186  //
2187  // "autoresize" tab:
2188  //
2189  mAutoImageResizeTab = new AutoImageResizeTab();
2190  addTab( mAutoImageResizeTab, i18n("Auto Resize Image") );
2191 
2192  //
2193  // "external editor" tab:
2194  mExternalEditorTab = new ExternalEditorTab();
2195  addTab( mExternalEditorTab, i18n("External Editor") );
2196 }
2197 
2198 QString ComposerPage::GeneralTab::helpAnchor() const
2199 {
2200  return QString::fromLatin1("configure-composer-general");
2201 }
2202 
2203 
2204 ComposerPageGeneralTab::ComposerPageGeneralTab( QWidget * parent )
2205  : ConfigModuleTab( parent )
2206 {
2207  // Temporary variables
2208  QLabel *label;
2209  QGroupBox *groupBox;
2210  QVBoxLayout *groupVBoxLayout;
2211  QGridLayout *groupGridLayout;
2212  QString helpText;
2213  int row;
2214 
2215  // Main layout
2216  QHBoxLayout *hb1 = new QHBoxLayout(); // box with 2 columns
2217  QVBoxLayout *vb1 = new QVBoxLayout(); // first with 2 groupboxes
2218  QVBoxLayout *vb2 = new QVBoxLayout(); // second with 1 groupbox
2219 
2220  // "Signature" group
2221  groupBox = new QGroupBox( i18nc( "@title:group", "Signature" ) );
2222  groupVBoxLayout = new QVBoxLayout();
2223 
2224  // "Automatically insert signature" checkbox
2225  mAutoAppSignFileCheck = new QCheckBox(
2226  MessageComposer::MessageComposerSettings::self()->autoTextSignatureItem()->label(),
2227  this );
2228 
2229  helpText = i18n( "Automatically insert the configured signature\n"
2230  "when starting to compose a message" );
2231  mAutoAppSignFileCheck->setToolTip( helpText );
2232  mAutoAppSignFileCheck->setWhatsThis( helpText );
2233 
2234  connect( mAutoAppSignFileCheck, SIGNAL(stateChanged(int)),
2235  this, SLOT(slotEmitChanged()) );
2236  groupVBoxLayout->addWidget( mAutoAppSignFileCheck );
2237 
2238  // "Insert signature above quoted text" checkbox
2239  mTopQuoteCheck = new QCheckBox(
2240  MessageComposer::MessageComposerSettings::self()->prependSignatureItem()->label(), this );
2241  mTopQuoteCheck->setEnabled( false );
2242 
2243  helpText = i18n( "Insert the signature above any quoted text" );
2244  mTopQuoteCheck->setToolTip( helpText );
2245  mTopQuoteCheck->setWhatsThis( helpText );
2246 
2247  connect( mTopQuoteCheck, SIGNAL(stateChanged(int)),
2248  this, SLOT(slotEmitChanged()) );
2249  connect( mAutoAppSignFileCheck, SIGNAL(toggled(bool)),
2250  mTopQuoteCheck, SLOT(setEnabled(bool)) );
2251  groupVBoxLayout->addWidget( mTopQuoteCheck );
2252 
2253  // "Prepend separator to signature" checkbox
2254  mDashDashCheck = new QCheckBox(
2255  MessageComposer::MessageComposerSettings::self()->dashDashSignatureItem()->label(), this );
2256  mDashDashCheck->setEnabled( false );
2257 
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 );
2262 
2263  connect( mDashDashCheck, SIGNAL(stateChanged(int)),
2264  this, SLOT(slotEmitChanged()) );
2265  connect( mAutoAppSignFileCheck, SIGNAL(toggled(bool)),
2266  mDashDashCheck, SLOT(setEnabled(bool)) );
2267  groupVBoxLayout->addWidget( mDashDashCheck);
2268 
2269  // "Remove signature when replying" checkbox
2270  mStripSignatureCheck = new QCheckBox( TemplateParser::GlobalSettings::self()->stripSignatureItem()->label(),
2271  this );
2272 
2273  helpText = i18n( "When replying, do not quote any existing signature" );
2274  mStripSignatureCheck->setToolTip( helpText );
2275  mStripSignatureCheck->setWhatsThis( helpText );
2276 
2277  connect( mStripSignatureCheck, SIGNAL(stateChanged(int)),
2278  this, SLOT(slotEmitChanged()) );
2279  groupVBoxLayout->addWidget( mStripSignatureCheck );
2280 
2281  groupBox->setLayout( groupVBoxLayout );
2282  vb1->addWidget( groupBox );
2283 
2284  // "Format" group
2285  groupBox = new QGroupBox( i18nc( "@title:group", "Format" ) );
2286  groupGridLayout = new QGridLayout();
2287  row = 0;
2288 
2289  // "Only quote selected text when replying" checkbox
2290  mQuoteSelectionOnlyCheck = new QCheckBox( MessageComposer::MessageComposerSettings::self()->quoteSelectionOnlyItem()->label(),
2291  this );
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 );
2297 
2298  connect( mQuoteSelectionOnlyCheck, SIGNAL(stateChanged(int)),
2299  this, SLOT(slotEmitChanged()) );
2300  groupGridLayout->addWidget( mQuoteSelectionOnlyCheck, row, 0, 1, -1 );
2301  ++row;
2302 
2303  // "Use smart quoting" checkbox
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 );
2311 
2312  connect( mSmartQuoteCheck, SIGNAL(stateChanged(int)),
2313  this, SLOT(slotEmitChanged()) );
2314  groupGridLayout->addWidget( mSmartQuoteCheck, row, 0, 1, -1 );
2315  ++row;
2316 
2317  // "Word wrap at column" checkbox/spinbox
2318  mWordWrapCheck = new QCheckBox(
2319  MessageComposer::MessageComposerSettings::self()->wordWrapItem()->label(), this);
2320 
2321  helpText = i18n( "Enable automatic word wrapping at the specified width" );
2322  mWordWrapCheck->setToolTip( helpText );
2323  mWordWrapCheck->setWhatsThis( helpText );
2324 
2325  mWrapColumnSpin = new KIntSpinBox( 30/*min*/, 78/*max*/, 1/*step*/,
2326  78/*init*/, this );
2327  mWrapColumnSpin->setEnabled( false ); // since !mWordWrapCheck->isChecked()
2328 
2329  helpText = i18n( "Set the text width for automatic word wrapping" );
2330  mWrapColumnSpin->setToolTip( helpText );
2331  mWrapColumnSpin->setWhatsThis( helpText );
2332 
2333  connect( mWordWrapCheck, SIGNAL(stateChanged(int)),
2334  this, SLOT(slotEmitChanged()) );
2335  connect( mWrapColumnSpin, SIGNAL(valueChanged(int)),
2336  this, SLOT(slotEmitChanged()) );
2337  // only enable the spinbox if the checkbox is checked
2338  connect( mWordWrapCheck, SIGNAL(toggled(bool)),
2339  mWrapColumnSpin, SLOT(setEnabled(bool)) );
2340 
2341  groupGridLayout->addWidget( mWordWrapCheck, row, 0 );
2342  groupGridLayout->addWidget( mWrapColumnSpin, row, 1 );
2343  ++row;
2344 
2345  // Spacing
2346  groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2347  ++row;
2348 
2349  // "Reply/Forward using HTML if present" checkbox
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 );
2356 
2357  connect( mReplyUsingHtml, SIGNAL(stateChanged(int)),
2358  this, SLOT(slotEmitChanged()) );
2359  groupGridLayout->addWidget( mReplyUsingHtml, row, 0, 1, -1 );
2360  ++row;
2361 
2362  // "Improve plain text of HTML" checkbox
2363  mImprovePlainTextOfHtmlMessage = new QCheckBox( MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessageItem()->label(), this );
2364 
2365  // For what is supported see http://www.grantlee.org/apidox/classGrantlee_1_1PlainTextMarkupBuilder.html
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"
2368  "are supported." );
2369  mImprovePlainTextOfHtmlMessage->setToolTip( helpText );
2370  mImprovePlainTextOfHtmlMessage->setWhatsThis( helpText );
2371 
2372  connect( mImprovePlainTextOfHtmlMessage, SIGNAL(stateChanged(int)),
2373  this, SLOT(slotEmitChanged()) );
2374  groupGridLayout->addWidget( mImprovePlainTextOfHtmlMessage, row, 0, 1, -1 );
2375  ++row;
2376 
2377  // Spacing
2378  groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2379  ++row;
2380 
2381  // "Autosave interval" spinbox
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" ) );
2386 
2387  helpText = i18n( "Automatically save the message at this specified interval" );
2388  mAutoSave->setToolTip( helpText );
2389  mAutoSave->setWhatsThis( helpText );
2390 
2391  label = new QLabel( GlobalSettings::self()->autosaveIntervalItem()->label(), this );
2392  label->setBuddy( mAutoSave );
2393 
2394  connect( mAutoSave, SIGNAL(valueChanged(int)),
2395  this, SLOT(slotEmitChanged()) );
2396 
2397  groupGridLayout->addWidget( label, row, 0 );
2398  groupGridLayout->addWidget( mAutoSave, row, 1 );
2399  ++row;
2400 
2401 #ifdef KDEPIM_ENTERPRISE_BUILD
2402  // "Default forwarding type" combobox
2403  mForwardTypeCombo = new KComboBox( false, this );
2404  mForwardTypeCombo->addItems( QStringList() << i18nc( "@item:inlistbox Inline mail forwarding",
2405  "Inline" )
2406  << i18n( "As Attachment" ) );
2407 
2408  helpText = i18n( "Set the default forwarded message format" );
2409  mForwardTypeCombo->setToolTip( helpText );
2410  mForwardTypeCombo->setWhatsThis( helpText );
2411 
2412  label = new QLabel( i18n( "Default forwarding type:" ), this );
2413  label->setBuddy( mForwardTypeCombo );
2414 
2415  connect( mForwardTypeCombo, SIGNAL(activated(int)),
2416  this, SLOT(slotEmitChanged()) );
2417 
2418  groupGridLayout->addWidget( label, row, 0 );
2419  groupGridLayout->addWidget( mForwardTypeCombo, row, 1 );
2420  ++row;
2421 #endif
2422 
2423  groupBox->setLayout( groupGridLayout );
2424  vb1->addWidget( groupBox );
2425 
2426  // "Recipients" group
2427  groupBox = new QGroupBox( i18nc( "@title:group", "Recipients" ) );
2428  groupGridLayout = new QGridLayout();
2429  row = 0;
2430 
2431  // "Automatically request MDNs" checkbox
2432  mAutoRequestMDNCheck = new QCheckBox( GlobalSettings::self()->requestMDNItem()->label(),
2433  this);
2434 
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 );
2439 
2440  connect( mAutoRequestMDNCheck, SIGNAL(stateChanged(int)),
2441  this, SLOT(slotEmitChanged()) );
2442  groupGridLayout->addWidget( mAutoRequestMDNCheck, row, 0, 1, -1 );
2443  ++row;
2444 
2445  // Spacing
2446  groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2447  ++row;
2448 
2449 #ifdef KDEPIM_ENTERPRISE_BUILD
2450  // "Warn if too many recipients" checkbox/spinbox
2451  mRecipientCheck = new QCheckBox(
2452  GlobalSettings::self()->tooManyRecipientsItem()->label(), this);
2453  mRecipientCheck->setObjectName( QLatin1String("kcfg_TooManyRecipients") );
2454  helpText = i18n( GlobalSettings::self()->tooManyRecipientsItem()->whatsThis().toUtf8() );
2455  mRecipientCheck->setWhatsThis( helpText );
2456  mRecipientCheck->setToolTip( i18n( "Warn if too many recipients are specified" ) );
2457 
2458  mRecipientSpin = new KIntSpinBox( 1/*min*/, 100/*max*/, 1/*step*/,
2459  5/*init*/, this );
2460  mRecipientSpin->setObjectName( QLatin1String("kcfg_RecipientThreshold") );
2461  mRecipientSpin->setEnabled( false );
2462  helpText = i18n( GlobalSettings::self()->recipientThresholdItem()->whatsThis().toUtf8() );
2463  mRecipientSpin->setWhatsThis( helpText );
2464  mRecipientSpin->setToolTip( i18n( "Set the maximum number of recipients for the warning" ) );
2465 
2466  connect( mRecipientCheck, SIGNAL(stateChanged(int)),
2467  this, SLOT(slotEmitChanged()) );
2468  connect( mRecipientSpin, SIGNAL(valueChanged(int)),
2469  this, SLOT(slotEmitChanged()) );
2470  // only enable the spinbox if the checkbox is checked
2471  connect( mRecipientCheck, SIGNAL(toggled(bool)),
2472  mRecipientSpin, SLOT(setEnabled(bool)) );
2473 
2474  groupGridLayout->addWidget( mRecipientCheck, row, 0, 1, 2);
2475  groupGridLayout->addWidget( mRecipientSpin, row, 2 );
2476  ++row;
2477 #endif
2478 
2479  // "Maximum Reply-to-All recipients" spinbox
2480  mMaximumRecipients = new KIntSpinBox( 0, 9999, 1, 1, this );
2481 
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"
2487  "mailing lists." );
2488  mMaximumRecipients->setToolTip( helpText );
2489  mMaximumRecipients->setWhatsThis( helpText );
2490 
2491  label = new QLabel( MessageComposer::MessageComposerSettings::self()->maximumRecipientsItem()->label(), this );
2492  label->setBuddy(mMaximumRecipients);
2493 
2494  connect( mMaximumRecipients, SIGNAL(valueChanged(int)),
2495  this, SLOT(slotEmitChanged()) );
2496 
2497  groupGridLayout->addWidget( label, row, 0, 1, 2 );
2498  groupGridLayout->addWidget( mMaximumRecipients, row, 2 );
2499  ++row;
2500 
2501  // Spacing
2502  groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2503  ++row;
2504 
2505  // "Use recent addresses for autocompletion" checkbox
2506  mShowRecentAddressesInComposer = new QCheckBox(
2507  MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposerItem()->label(),
2508  this);
2509 
2510  helpText = i18n( "Remember recent addresses entered,\n"
2511  "and offer them for recipient completion" );
2512  mShowRecentAddressesInComposer->setToolTip( helpText );
2513  mShowRecentAddressesInComposer->setWhatsThis( helpText );
2514 
2515  connect( mShowRecentAddressesInComposer, SIGNAL(stateChanged(int)),
2516  this, SLOT(slotEmitChanged()) );
2517  groupGridLayout->addWidget( mShowRecentAddressesInComposer, row, 0, 1, -1 );
2518  ++row;
2519 
2520  // "Maximum recent addresses retained" spinbox
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 );
2527 
2528  label = new QLabel( i18n( "Maximum recent addresses retained:" ) );
2529  label->setBuddy( mMaximumRecentAddress );
2530  label->setEnabled( false );
2531 
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 );
2536 
2537  connect( mMaximumRecentAddress, SIGNAL(valueChanged(int)),
2538  this, SLOT(slotEmitChanged()) );
2539  connect( mShowRecentAddressesInComposer, SIGNAL(toggled(bool)),
2540  mMaximumRecentAddress, SLOT(setEnabled(bool)) );
2541  connect( mShowRecentAddressesInComposer, SIGNAL(toggled(bool)),
2542  label, SLOT(setEnabled(bool)) );
2543 
2544  groupGridLayout->addWidget( label, row, 0, 1, 2 );
2545  groupGridLayout->addWidget( mMaximumRecentAddress, row, 2 );
2546  ++row;
2547 
2548  // "Edit Recent Addresses" button
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 );
2553 
2554  connect( recentAddressesBtn, SIGNAL(clicked()),
2555  this, SLOT(slotConfigureRecentAddresses()) );
2556  groupGridLayout->addWidget( recentAddressesBtn, row, 1, 1, 2 );
2557  ++row;
2558 
2559  // Spacing
2560  groupGridLayout->setRowMinimumHeight( row, KDialog::spacingHint() );
2561  ++row;
2562 
2563  // "Configure Completion Order" button
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 );
2569 
2570  connect( completionOrderBtn, SIGNAL(clicked()),
2571  this, SLOT(slotConfigureCompletionOrder()) );
2572  groupGridLayout->addWidget( completionOrderBtn, row, 1, 1, 2 );
2573 
2574  groupBox->setLayout( groupGridLayout );
2575  vb2->addWidget( groupBox );
2576 
2577  // Finish up main layout
2578  vb1->addStretch( 1 );
2579  vb2->addStretch( 1 );
2580 
2581  hb1->addLayout( vb1 );
2582  hb1->addLayout( vb2 );
2583  setLayout( hb1 );
2584 }
2585 
2586 
2587 void ComposerPage::GeneralTab::doResetToDefaultsOther()
2588 {
2589  const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults( true );
2590 
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();
2600 
2601  MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
2602 
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);
2612 
2613  mMaximumRecentAddress->setValue( 40 );
2614 }
2615 
2616 void ComposerPage::GeneralTab::doLoadFromGlobalSettings()
2617 {
2618  // various check boxes:
2619 
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() );
2628  mAutoRequestMDNCheck->setChecked( GlobalSettings::self()->requestMDN() );
2629  mWordWrapCheck->setChecked( MessageComposer::MessageComposerSettings::self()->wordWrap() );
2630  mWrapColumnSpin->setValue( MessageComposer::MessageComposerSettings::self()->lineWrapWidth() );
2631  mMaximumRecipients->setValue( MessageComposer::MessageComposerSettings::self()->maximumRecipients() );
2632  mAutoSave->setValue( GlobalSettings::self()->autosaveInterval() );
2633  mShowRecentAddressesInComposer->setChecked( MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposer() );
2634  mImprovePlainTextOfHtmlMessage->setChecked(MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage());
2635 
2636 #ifdef KDEPIM_ENTERPRISE_BUILD
2637  mRecipientCheck->setChecked( GlobalSettings::self()->tooManyRecipients() );
2638  mRecipientSpin->setValue( GlobalSettings::self()->recipientThreshold() );
2639  if ( GlobalSettings::self()->forwardingInlineByDefault() )
2640  mForwardTypeCombo->setCurrentIndex( 0 );
2641  else
2642  mForwardTypeCombo->setCurrentIndex( 1 );
2643 #endif
2644 
2645  mMaximumRecentAddress->setValue(RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->maxCount());
2646 }
2647 
2648 void ComposerPage::GeneralTab::save() {
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() );
2657  GlobalSettings::self()->setRequestMDN( mAutoRequestMDNCheck->isChecked() );
2658  MessageComposer::MessageComposerSettings::self()->setWordWrap( mWordWrapCheck->isChecked() );
2659  MessageComposer::MessageComposerSettings::self()->setLineWrapWidth( mWrapColumnSpin->value() );
2660  MessageComposer::MessageComposerSettings::self()->setMaximumRecipients( mMaximumRecipients->value() );
2661  GlobalSettings::self()->setAutosaveInterval( mAutoSave->value() );
2662  MessageComposer::MessageComposerSettings::self()->setShowRecentAddressesInComposer( mShowRecentAddressesInComposer->isChecked() );
2663  MessageComposer::MessageComposerSettings::self()->setImprovePlainTextOfHtmlMessage( mImprovePlainTextOfHtmlMessage->isChecked() );
2664 #ifdef KDEPIM_ENTERPRISE_BUILD
2665  GlobalSettings::self()->setTooManyRecipients( mRecipientCheck->isChecked() );
2666  GlobalSettings::self()->setRecipientThreshold( mRecipientSpin->value() );
2667  GlobalSettings::self()->setForwardingInlineByDefault( mForwardTypeCombo->currentIndex() == 0 );
2668 #endif
2669 
2670  RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->setMaxCount( mMaximumRecentAddress->value() );
2671 
2672  MessageComposer::MessageComposerSettings::self()->requestSync();
2673 }
2674 
2675 void ComposerPage::GeneralTab::slotConfigureRecentAddresses()
2676 {
2677  MessageViewer::AutoQPointer<KPIM::RecentAddressDialog> dlg( new KPIM::RecentAddressDialog( this ) );
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() );
2684 
2685  for ( it = addrList.constBegin(); it != end; ++it )
2686  RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->add( *it );
2687  }
2688 }
2689 
2690 void ComposerPage::GeneralTab::slotConfigureCompletionOrder()
2691 {
2692  KLDAP::LdapClientSearch search;
2693  KPIM::CompletionOrderEditor editor( &search, this );
2694  editor.exec();
2695 }
2696 
2697 QString ComposerPage::ExternalEditorTab::helpAnchor() const
2698 {
2699  return QString::fromLatin1("configure-composer-externaleditor");
2700 }
2701 
2702 ComposerPageExternalEditorTab::ComposerPageExternalEditorTab( QWidget * parent )
2703  : ConfigModuleTab( parent )
2704 {
2705  QVBoxLayout *layout = new QVBoxLayout( this );
2706 
2707  mExternalEditorCheck = new QCheckBox(
2708  GlobalSettings::self()->useExternalEditorItem()->label(), this);
2709  mExternalEditorCheck->setObjectName( QLatin1String("kcfg_UseExternalEditor") );
2710  connect( mExternalEditorCheck, SIGNAL(toggled(bool)),
2711  this, SLOT(slotEmitChanged()) );
2712 
2713  KHBox *hbox = new KHBox( this );
2714  QLabel *label = new QLabel( GlobalSettings::self()->externalEditorItem()->label(),
2715  hbox );
2716  mEditorRequester = new KUrlRequester( hbox );
2717  //Laurent 25/10/2011 fix #Bug 256655 - A "save changes?" dialog appears ALWAYS when leaving composer settings, even when unchanged.
2718  //mEditorRequester->setObjectName( "kcfg_ExternalEditor" );
2719  connect( mEditorRequester, SIGNAL(urlSelected(KUrl)),
2720  this, SLOT(slotEmitChanged()) );
2721  connect( mEditorRequester, SIGNAL(textChanged(QString)),
2722  this, SLOT(slotEmitChanged()) );
2723 
2724  hbox->setStretchFactor( mEditorRequester, 1 );
2725  label->setBuddy( mEditorRequester );
2726  label->setEnabled( false ); // since !mExternalEditorCheck->isChecked()
2727  // ### FIXME: allow only executables (x-bit when available..)
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 ); // !mExternalEditorCheck->isChecked()
2733  connect( mExternalEditorCheck, SIGNAL(toggled(bool)),
2734  label, SLOT(setEnabled(bool)) );
2735  connect( mExternalEditorCheck, SIGNAL(toggled(bool)),
2736  mEditorRequester, SLOT(setEnabled(bool)) );
2737 
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 ); // see above
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();
2749 }
2750 
2751 void ComposerPage::ExternalEditorTab::doLoadFromGlobalSettings()
2752 {
2753  mExternalEditorCheck->setChecked( GlobalSettings::self()->useExternalEditor() );
2754  mEditorRequester->setText( GlobalSettings::self()->externalEditor() );
2755 }
2756 
2757 void ComposerPage::ExternalEditorTab::save()
2758 {
2759  GlobalSettings::self()->setUseExternalEditor( mExternalEditorCheck->isChecked() );
2760  GlobalSettings::self()->setExternalEditor( mEditorRequester->text() );
2761 }
2762 
2763 QString ComposerPage::TemplatesTab::helpAnchor() const
2764 {
2765  return QString::fromLatin1("configure-composer-templates");
2766 }
2767 
2768 ComposerPageTemplatesTab::ComposerPageTemplatesTab( QWidget * parent )
2769  : ConfigModuleTab ( parent )
2770 {
2771  QVBoxLayout* vlay = new QVBoxLayout( this );
2772  vlay->setMargin( 0 );
2773  vlay->setSpacing( KDialog::spacingHint() );
2774 
2775  mWidget = new TemplateParser::TemplatesConfiguration( this );
2776  vlay->addWidget( mWidget );
2777 
2778  connect( mWidget, SIGNAL(changed()),
2779  this, SLOT(slotEmitChanged()) );
2780 }
2781 
2782 void ComposerPage::TemplatesTab::doLoadFromGlobalSettings()
2783 {
2784  mWidget->loadFromGlobal();
2785 }
2786 
2787 void ComposerPage::TemplatesTab::save()
2788 {
2789  mWidget->saveToGlobal();
2790 }
2791 
2792 void ComposerPage::TemplatesTab::doResetToDefaultsOther()
2793 {
2794  mWidget->resetToDefault();
2795 }
2796 
2797 QString ComposerPage::CustomTemplatesTab::helpAnchor() const
2798 {
2799  return QString::fromLatin1("configure-composer-custom-templates");
2800 }
2801 
2802 ComposerPageCustomTemplatesTab::ComposerPageCustomTemplatesTab( QWidget * parent )
2803  : ConfigModuleTab ( parent )
2804 {
2805  QVBoxLayout* vlay = new QVBoxLayout( this );
2806  vlay->setMargin( 0 );
2807  vlay->setSpacing( KDialog::spacingHint() );
2808 
2809  mWidget = new TemplateParser::CustomTemplates( kmkernel->getKMMainWidget() ? kmkernel->getKMMainWidget()->actionCollections() : QList<KActionCollection*>(), this );
2810  vlay->addWidget( mWidget );
2811 
2812  connect( mWidget, SIGNAL(changed()),
2813  this, SLOT(slotEmitChanged()) );
2814  if( KMKernel::self() )
2815  connect( mWidget, SIGNAL(templatesUpdated()), KMKernel::self(), SLOT(updatedTemplates()) );
2816 }
2817 
2818 void ComposerPage::CustomTemplatesTab::doLoadFromGlobalSettings()
2819 {
2820  mWidget->load();
2821 }
2822 
2823 void ComposerPage::CustomTemplatesTab::save()
2824 {
2825  mWidget->save();
2826 }
2827 
2828 QString ComposerPage::SubjectTab::helpAnchor() const
2829 {
2830  return QString::fromLatin1("configure-composer-subject");
2831 }
2832 
2833 ComposerPageSubjectTab::ComposerPageSubjectTab( QWidget * parent )
2834  : ConfigModuleTab( parent )
2835 {
2836  // tmp. vars:
2837  QVBoxLayout *vlay;
2838  QGroupBox *group;
2839  QLabel *label;
2840 
2841 
2842  vlay = new QVBoxLayout( this );
2843  vlay->setSpacing( KDialog::spacingHint() );
2844  vlay->setMargin( KDialog::marginHint() );
2845 
2846  group = new QGroupBox( i18n("Repl&y Subject Prefixes"), this );
2847  QLayout *layout = new QVBoxLayout( group );
2848  group->layout()->setSpacing( KDialog::spacingHint() );
2849 
2850  // row 0: help text:
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 );
2855 
2856  // row 1, string list editor:
2857  PimCommon::SimpleStringListEditor::ButtonCode buttonCode =
2858  static_cast<PimCommon::SimpleStringListEditor::ButtonCode>( PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify );
2859  mReplyListEditor =
2860  new PimCommon::SimpleStringListEditor( group, buttonCode,
2861  i18n("A&dd..."), i18n("Re&move"),
2862  i18n("Mod&ify..."),
2863  i18n("Enter new reply prefix:") );
2864  connect( mReplyListEditor, SIGNAL(changed()),
2865  this, SLOT(slotEmitChanged()) );
2866 
2867  // row 2: "replace [...]" check box:
2868  mReplaceReplyPrefixCheck = new QCheckBox(
2869  MessageComposer::MessageComposerSettings::self()->replaceReplyPrefixItem()->label(),
2870  group);
2871  connect( mReplaceReplyPrefixCheck, SIGNAL(stateChanged(int)),
2872  this, SLOT(slotEmitChanged()) );
2873  layout->addWidget( label );
2874  layout->addWidget( mReplyListEditor );
2875  layout->addWidget( mReplaceReplyPrefixCheck );
2876 
2877  vlay->addWidget( group );
2878 
2879 
2880  group = new QGroupBox( i18n("For&ward Subject Prefixes"), this );
2881  layout = new QVBoxLayout( group );
2882  group->layout()->setSpacing( KDialog::marginHint() );
2883 
2884  // row 0: help text:
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 );
2889 
2890  // row 1: string list editor
2891  mForwardListEditor =
2892  new PimCommon::SimpleStringListEditor( group, buttonCode,
2893  i18n("Add..."),
2894  i18n("Remo&ve"),
2895  i18n("Modify..."),
2896  i18n("Enter new forward prefix:") );
2897  connect( mForwardListEditor, SIGNAL(changed()),
2898  this, SLOT(slotEmitChanged()) );
2899 
2900  // row 3: "replace [...]" check box:
2901  mReplaceForwardPrefixCheck = new QCheckBox(
2902  MessageComposer::MessageComposerSettings::self()->replaceForwardPrefixItem()->label(),
2903  group);
2904  connect( mReplaceForwardPrefixCheck, SIGNAL(stateChanged(int)),
2905  this, SLOT(slotEmitChanged()) );
2906  layout->addWidget( label );
2907  layout->addWidget( mForwardListEditor );
2908  layout->addWidget( mReplaceForwardPrefixCheck );
2909  vlay->addWidget( group );
2910 }
2911 
2912 void ComposerPage::SubjectTab::doLoadFromGlobalSettings()
2913 {
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() );
2918 }
2919 
2920 void ComposerPage::SubjectTab::save()
2921 {
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() );
2926 }
2927 
2928 void ComposerPage::SubjectTab::doResetToDefaultsOther()
2929 {
2930  const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults( true );
2931  const QStringList messageReplyPrefixes = MessageComposer::MessageComposerSettings::replyPrefixes();
2932  const bool useMessageReplyPrefixes = MessageComposer::MessageComposerSettings::replaceReplyPrefix();
2933 
2934  const QStringList messageForwardPrefixes = MessageComposer::MessageComposerSettings::forwardPrefixes();
2935  const bool useMessageForwardPrefixes = MessageComposer::MessageComposerSettings::replaceForwardPrefix();
2936 
2937  MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
2938  mReplyListEditor->setStringList( messageReplyPrefixes );
2939  mReplaceReplyPrefixCheck->setChecked( useMessageReplyPrefixes );
2940  mForwardListEditor->setStringList( messageForwardPrefixes );
2941  mReplaceForwardPrefixCheck->setChecked( useMessageForwardPrefixes );
2942 }
2943 
2944 
2945 QString ComposerPage::CharsetTab::helpAnchor() const
2946 {
2947  return QString::fromLatin1("configure-composer-charset");
2948 }
2949 
2950 ComposerPageCharsetTab::ComposerPageCharsetTab( QWidget * parent )
2951  : ConfigModuleTab( parent )
2952 {
2953  // tmp. vars:
2954  QVBoxLayout *vlay;
2955  QLabel *label;
2956 
2957  vlay = new QVBoxLayout( this );
2958  vlay->setSpacing( KDialog::spacingHint() );
2959  vlay->setMargin( KDialog::marginHint() );
2960 
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 );
2966 
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()),
2973  this, SLOT(slotEmitChanged()) );
2974 
2975  vlay->addWidget( mCharsetListEditor, 1 );
2976 
2977  mKeepReplyCharsetCheck = new QCheckBox( i18n("&Keep original charset when "
2978  "replying or forwarding (if "
2979  "possible)"), this );
2980  connect( mKeepReplyCharsetCheck, SIGNAL (stateChanged(int)),
2981  this, SLOT(slotEmitChanged()) );
2982  vlay->addWidget( mKeepReplyCharsetCheck );
2983 
2984  connect( mCharsetListEditor, SIGNAL(aboutToAdd(QString&)),
2985  this, SLOT(slotVerifyCharset(QString&)) );
2986 }
2987 
2988 void ComposerPage::CharsetTab::slotVerifyCharset( QString & charset )
2989 {
2990  if ( charset.isEmpty() ) return;
2991 
2992  // KCharsets::codecForName("us-ascii") returns "iso-8859-1" (cf. Bug #49812)
2993  // therefore we have to treat this case specially
2994  if ( charset.toLower() == QString::fromLatin1("us-ascii") ) {
2995  charset = QString::fromLatin1("us-ascii");
2996  return;
2997  }
2998 
2999  if ( charset.toLower() == QString::fromLatin1("locale") ) {
3000  charset = QString::fromLatin1("%1 (locale)")
3001  .arg( QString::fromLatin1(kmkernel->networkCodec()->name() ).toLower() );
3002  return;
3003  }
3004 
3005  bool ok = false;
3006  QTextCodec *codec = KGlobal::charsets()->codecForName( charset, ok );
3007  if ( ok && codec ) {
3008  charset = QString::fromLatin1( codec->name() ).toLower();
3009  return;
3010  }
3011 
3012  KMessageBox::sorry( this, i18n("This charset is not supported.") );
3013  charset.clear();
3014 }
3015 
3016 void ComposerPage::CharsetTab::doLoadOther()
3017 {
3018  QStringList charsets = MessageComposer::MessageComposerSettings::preferredCharsets();
3019  QStringList::Iterator end( charsets.end() );
3020  for ( QStringList::Iterator it = charsets.begin() ;
3021  it != end ; ++it )
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 ) );
3026  }
3027 
3028  mCharsetListEditor->setStringList( charsets );
3029  mKeepReplyCharsetCheck->setChecked( MessageComposer::MessageComposerSettings::forceReplyCharset() );
3030 }
3031 
3032 
3033 void ComposerPage::CharsetTab::doResetToDefaultsOther()
3034 {
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 );
3041  slotEmitChanged();
3042 }
3043 
3044 void ComposerPage::CharsetTab::save()
3045 {
3046  QStringList charsetList = mCharsetListEditor->stringList();
3047  QStringList::Iterator it = charsetList.begin();
3048  QStringList::Iterator end = charsetList.end();
3049 
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() );
3055 }
3056 
3057 QString ComposerPage::HeadersTab::helpAnchor() const
3058 {
3059  return QString::fromLatin1("configure-composer-headers");
3060 }
3061 
3062 ComposerPageHeadersTab::ComposerPageHeadersTab( QWidget * parent )
3063  : ConfigModuleTab( parent )
3064 {
3065  // tmp. vars:
3066  QVBoxLayout *vlay;
3067  QHBoxLayout *hlay;
3068  QGridLayout *glay;
3069  QLabel *label;
3070  QPushButton *button;
3071 
3072  vlay = new QVBoxLayout( this );
3073  vlay->setSpacing( KDialog::spacingHint() );
3074  vlay->setMargin( KDialog::marginHint() );
3075 
3076  // "Use custom Message-Id suffix" checkbox:
3077  mCreateOwnMessageIdCheck =
3078  new QCheckBox( i18n("&Use custom message-id suffix"), this );
3079  connect( mCreateOwnMessageIdCheck, SIGNAL (stateChanged(int)),
3080  this, SLOT(slotEmitChanged()) );
3081  vlay->addWidget( mCreateOwnMessageIdCheck );
3082 
3083  // "Message-Id suffix" line edit and label:
3084  hlay = new QHBoxLayout(); // inherits spacing
3085  vlay->addLayout( hlay );
3086  mMessageIdSuffixEdit = new KLineEdit( this );
3087  mMessageIdSuffixEdit->setClearButtonShown( true );
3088  // only ASCII letters, digits, plus, minus and dots are allowed
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 ); // since !mCreateOwnMessageIdCheck->isChecked()
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)),
3103  this, SLOT(slotEmitChanged()) );
3104 
3105  // horizontal rule and "custom header fields" label:
3106  vlay->addWidget( new KSeparator( Qt::Horizontal, this ) );
3107  vlay->addWidget( new QLabel( i18n("Define custom mime header fields:"), this) );
3108 
3109  // "custom header fields" listbox:
3110  glay = new QGridLayout(); // inherits spacing
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 );
3118  connect( mHeaderList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
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 );
3123 
3124  // "new" and "remove" buttons:
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 );
3134 
3135  // "name" and "value" line edits and labels:
3136  mTagNameEdit = new KLineEdit( this );
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)) );
3146 
3147  mTagValueEdit = new KLineEdit( this );
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)) );
3157 }
3158 
3159 void ComposerPage::HeadersTab::slotMimeHeaderSelectionChanged()
3160 {
3161  mEmitChanges = false;
3162  QTreeWidgetItem * item = mHeaderList->currentItem();
3163 
3164  if ( item ) {
3165  mTagNameEdit->setText( item->text( 0 ) );
3166  mTagValueEdit->setText( item->text( 1 ) );
3167  } else {
3168  mTagNameEdit->clear();
3169  mTagValueEdit->clear();
3170  }
3171  mRemoveHeaderButton->setEnabled( item );
3172  mTagNameEdit->setEnabled( item );
3173  mTagValueEdit->setEnabled( item );
3174  mTagNameLabel->setEnabled( item );
3175  mTagValueLabel->setEnabled( item );
3176  mEmitChanges = true;
3177 }
3178 
3179 
3180 void ComposerPage::HeadersTab::slotMimeHeaderNameChanged( const QString & text )
3181 {
3182  // is called on ::setup(), when clearing the line edits. So be
3183  // prepared to not find a selection:
3184  QTreeWidgetItem * item = mHeaderList->currentItem();
3185  if ( item )
3186  item->setText( 0, text );
3187  slotEmitChanged();
3188 }
3189 
3190 
3191 void ComposerPage::HeadersTab::slotMimeHeaderValueChanged( const QString & text )
3192 {
3193  // is called on ::setup(), when clearing the line edits. So be
3194  // prepared to not find a selection:
3195  QTreeWidgetItem * item = mHeaderList->currentItem();
3196  if ( item )
3197  item->setText( 1, text );
3198  slotEmitChanged();
3199 }
3200 
3201 
3202 void ComposerPage::HeadersTab::slotNewMimeHeader()
3203 {
3204  QTreeWidgetItem *listItem = new QTreeWidgetItem( mHeaderList );
3205  mHeaderList->setCurrentItem( listItem );
3206  slotEmitChanged();
3207 }
3208 
3209 
3210 void ComposerPage::HeadersTab::slotRemoveMimeHeader()
3211 {
3212  // calling this w/o selection is a programming error:
3213  QTreeWidgetItem *item = mHeaderList->currentItem();
3214  if ( !item ) {
3215  kDebug() << "=================================================="
3216  << "Error: Remove button was pressed although no custom header was selected\n"
3217  << "==================================================\n";
3218  return;
3219  }
3220 
3221  QTreeWidgetItem *below = mHeaderList->itemBelow( item );
3222 
3223  if ( below ) {
3224  kDebug() << "below";
3225  mHeaderList->setCurrentItem( below );
3226  delete item;
3227  item = 0;
3228  } else if ( mHeaderList->topLevelItemCount() > 0 ) {
3229  delete item;
3230  item = 0;
3231  mHeaderList->setCurrentItem(
3232  mHeaderList->topLevelItem( mHeaderList->topLevelItemCount() - 1 )
3233  );
3234  }
3235 
3236  slotEmitChanged();
3237 }
3238 
3239 void ComposerPage::HeadersTab::doLoadOther()
3240 {
3241  mMessageIdSuffixEdit->setText( MessageComposer::MessageComposerSettings::customMsgIDSuffix() );
3242  const bool state = ( !MessageComposer::MessageComposerSettings::customMsgIDSuffix().isEmpty() &&
3243  MessageComposer::MessageComposerSettings::useCustomMessageIdSuffix() );
3244  mCreateOwnMessageIdCheck->setChecked( state );
3245 
3246  mHeaderList->clear();
3247  mTagNameEdit->clear();
3248  mTagValueEdit->clear();
3249 
3250  QTreeWidgetItem * item = 0;
3251 
3252  const int count = GlobalSettings::self()->customMessageHeadersCount();
3253  for ( int i = 0 ; i < count ; ++i ) {
3254  KConfigGroup config( KMKernel::self()->config(),
3255  QLatin1String("Mime #") + QString::number(i) );
3256  const QString name = config.readEntry( "name" );
3257  const QString value = config.readEntry( "value" );
3258  if( !name.isEmpty() ) {
3259  item = new QTreeWidgetItem( mHeaderList, item );
3260  item->setText( 0, name );
3261  item->setText( 1, value );
3262  }
3263  }
3264  if ( mHeaderList->topLevelItemCount() > 0 ) {
3265  mHeaderList->setCurrentItem( mHeaderList->topLevelItem( 0 ) );
3266  }
3267  else {
3268  // disable the "Remove" button
3269  mRemoveHeaderButton->setEnabled( false );
3270  }
3271 }
3272 
3273 void ComposerPage::HeadersTab::save()
3274 {
3275  MessageComposer::MessageComposerSettings::self()->setCustomMsgIDSuffix( mMessageIdSuffixEdit->text() );
3276  MessageComposer::MessageComposerSettings::self()->setUseCustomMessageIdSuffix( mCreateOwnMessageIdCheck->isChecked() );
3277 
3278  //Clean config
3279  const int oldHeadersCount = GlobalSettings::self()->customMessageHeadersCount();
3280  for ( int i = 0; i < oldHeadersCount; ++i ) {
3281  const QString groupMimeName = QString::fromLatin1( "Mime #%1" ).arg( i );
3282  if ( KMKernel::self()->config()->hasGroup( groupMimeName ) ) {
3283  KConfigGroup config( KMKernel::self()->config(), groupMimeName);
3284  config.deleteGroup();
3285  }
3286  }
3287 
3288 
3289  int numValidEntries = 0;
3290  QTreeWidgetItem *item = 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 ) );
3298  numValidEntries++;
3299  }
3300  }
3301  GlobalSettings::self()->setCustomMessageHeadersCount( numValidEntries );
3302 }
3303 
3304 void ComposerPage::HeadersTab::doResetToDefaultsOther()
3305 {
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 );
3310 
3311  mMessageIdSuffixEdit->setText( messageIdSuffix );
3312  const bool state = ( !messageIdSuffix.isEmpty() && useCustomMessageIdSuffix );
3313  mCreateOwnMessageIdCheck->setChecked( state );
3314 
3315  mHeaderList->clear();
3316  mTagNameEdit->clear();
3317  mTagValueEdit->clear();
3318  // disable the "Remove" button
3319  mRemoveHeaderButton->setEnabled( false );
3320 }
3321 
3322 QString ComposerPage::AttachmentsTab::helpAnchor() const
3323 {
3324  return QString::fromLatin1("configure-composer-attachments");
3325 }
3326 
3327 ComposerPageAttachmentsTab::ComposerPageAttachmentsTab( QWidget * parent )
3328  : ConfigModuleTab( parent ) {
3329  // tmp. vars:
3330  QVBoxLayout *vlay;
3331  QLabel *label;
3332 
3333  vlay = new QVBoxLayout( this );
3334  vlay->setSpacing( KDialog::spacingHint() );
3335  vlay->setMargin( KDialog::marginHint() );
3336 
3337  // "Outlook compatible attachment naming" check box
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)),
3345  this, SLOT(slotEmitChanged()) );
3346  connect( mOutlookCompatibleCheck, SIGNAL(clicked()),
3347  this, SLOT(slotOutlookCompatibleClicked()) );
3348  vlay->addWidget( mOutlookCompatibleCheck );
3349  vlay->addSpacing( 5 );
3350 
3351  // "Enable detection of missing attachments" check box
3352  mMissingAttachmentDetectionCheck =
3353  new QCheckBox( i18n("E&nable detection of missing attachments"), this );
3354  mMissingAttachmentDetectionCheck->setChecked( true );
3355  connect( mMissingAttachmentDetectionCheck, SIGNAL(stateChanged(int)),
3356  this, SLOT(slotEmitChanged()) );
3357  vlay->addWidget( mMissingAttachmentDetectionCheck );
3358 
3359 
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);
3364 
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)),
3370  this, SLOT(slotEmitChanged()) );
3371  mMaximumAttachmentSize->setSpecialValueText(i18n("No limit"));
3372  layAttachment->addWidget(mMaximumAttachmentSize);
3373  vlay->addLayout(layAttachment);
3374 
3375 
3376  // "Attachment key words" label and string list editor
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 );
3381 
3382  vlay->addWidget( label );
3383 
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"),
3389  i18n("Mod&ify..."),
3390  i18n("Enter new key word:") );
3391  connect( mAttachWordsListEditor, SIGNAL(changed()),
3392  this, SLOT(slotEmitChanged()) );
3393  vlay->addWidget( mAttachWordsListEditor );
3394 
3395  connect( mMissingAttachmentDetectionCheck, SIGNAL(toggled(bool)),
3396  label, SLOT(setEnabled(bool)) );
3397  connect( mMissingAttachmentDetectionCheck, SIGNAL(toggled(bool)),
3398  mAttachWordsListEditor, SLOT(setEnabled(bool)) );
3399 }
3400 
3401 void ComposerPage::AttachmentsTab::doLoadFromGlobalSettings()
3402 {
3403  mOutlookCompatibleCheck->setChecked(
3404  MessageComposer::MessageComposerSettings::self()->outlookCompatibleAttachments() );
3405  mMissingAttachmentDetectionCheck->setChecked(
3406  GlobalSettings::self()->showForgottenAttachmentWarning() );
3407 
3408  const QStringList attachWordsList = GlobalSettings::self()->attachmentKeywords();
3409  mAttachWordsListEditor->setStringList( attachWordsList );
3410  const int maximumAttachmentSize(MessageComposer::MessageComposerSettings::self()->maximumAttachmentSize());
3411  mMaximumAttachmentSize->setValue(maximumAttachmentSize == -1 ? -1 : MessageComposer::MessageComposerSettings::self()->maximumAttachmentSize()/1024);
3412 }
3413 
3414 void ComposerPage::AttachmentsTab::save()
3415 {
3416  MessageComposer::MessageComposerSettings::self()->setOutlookCompatibleAttachments(
3417  mOutlookCompatibleCheck->isChecked() );
3418  GlobalSettings::self()->setShowForgottenAttachmentWarning(
3419  mMissingAttachmentDetectionCheck->isChecked() );
3420  GlobalSettings::self()->setAttachmentKeywords(
3421  mAttachWordsListEditor->stringList() );
3422 
3423  KMime::setUseOutlookAttachmentEncoding( mOutlookCompatibleCheck->isChecked() );
3424  const int maximumAttachmentSize(mMaximumAttachmentSize->value());
3425  MessageComposer::MessageComposerSettings::self()->setMaximumAttachmentSize(maximumAttachmentSize == -1 ? -1 : maximumAttachmentSize*1024);
3426 
3427 }
3428 
3429 void ComposerPageAttachmentsTab::slotOutlookCompatibleClicked()
3430 {
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." ) );
3440  }
3441 }
3442 
3443 ComposerPageAutoCorrectionTab::ComposerPageAutoCorrectionTab(QWidget *parent)
3444  : ConfigModuleTab(parent)
3445 {
3446  QVBoxLayout *vlay = new QVBoxLayout( this );
3447  vlay->setSpacing( 0 );
3448  vlay->setMargin( 0 );
3449  autocorrectionWidget = new MessageComposer::ComposerAutoCorrectionWidget(this);
3450  if(KMKernel::self())
3451  autocorrectionWidget->setAutoCorrection(KMKernel::self()->composerAutoCorrection());
3452  vlay->addWidget(autocorrectionWidget);
3453  setLayout(vlay);
3454  connect( autocorrectionWidget, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
3455 
3456 }
3457 
3458 QString ComposerPageAutoCorrectionTab::helpAnchor() const
3459 {
3460  return QString::fromLatin1("configure-autocorrection");
3461 }
3462 
3463 void ComposerPageAutoCorrectionTab::save()
3464 {
3465  autocorrectionWidget->writeConfig();
3466 }
3467 
3468 void ComposerPageAutoCorrectionTab::doLoadFromGlobalSettings()
3469 {
3470  autocorrectionWidget->loadConfig();
3471 }
3472 
3473 void ComposerPageAutoCorrectionTab::doResetToDefaultsOther()
3474 {
3475  autocorrectionWidget->resetToDefault();
3476 }
3477 
3478 
3479 ComposerPageAutoImageResizeTab::ComposerPageAutoImageResizeTab(QWidget *parent)
3480  : ConfigModuleTab(parent)
3481 {
3482  QVBoxLayout *vlay = new QVBoxLayout( this );
3483  vlay->setSpacing( 0 );
3484  vlay->setMargin( 0 );
3485  autoResizeWidget = new MessageComposer::ImageScalingWidget(this);
3486  vlay->addWidget(autoResizeWidget);
3487  setLayout(vlay);
3488  connect( autoResizeWidget, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
3489 
3490 }
3491 
3492 QString ComposerPageAutoImageResizeTab::helpAnchor() const
3493 {
3494  return QString::fromLatin1("configure-image-resize");
3495 }
3496 
3497 void ComposerPageAutoImageResizeTab::save()
3498 {
3499  autoResizeWidget->writeConfig();
3500 }
3501 
3502 void ComposerPageAutoImageResizeTab::doLoadFromGlobalSettings()
3503 {
3504  autoResizeWidget->loadConfig();
3505 }
3506 
3507 void ComposerPageAutoImageResizeTab::doResetToDefaultsOther()
3508 {
3509  autoResizeWidget->resetToDefault();
3510 }
3511 
3512 
3513 // *************************************************************
3514 // * *
3515 // * SecurityPage *
3516 // * *
3517 // *************************************************************
3518 QString SecurityPage::helpAnchor() const
3519 {
3520  return QString::fromLatin1("configure-security");
3521 }
3522 
3523 SecurityPage::SecurityPage( const KComponentData &instance, QWidget *parent )
3524  : ConfigModuleWithTabs( instance, parent )
3525 {
3526  //
3527  // "Reading" tab:
3528  //
3529  mGeneralTab = new GeneralTab(); // @TODO: rename
3530  addTab( mGeneralTab, i18n("Reading") );
3531 
3532  addTab( new MDNTab(), i18n("Message Disposition Notifications") );
3533 
3534  //
3535  // "Composing" tab:
3536  //
3537  mComposerCryptoTab = new ComposerCryptoTab();
3538  addTab( mComposerCryptoTab, i18n("Composing") );
3539 
3540  //
3541  // "Warnings" tab:
3542  //
3543  mWarningTab = new WarningTab();
3544  addTab( mWarningTab, i18n("Miscellaneous") );
3545 
3546  //
3547  // "S/MIME Validation" tab:
3548  //
3549  mSMimeTab = new SMimeTab();
3550  addTab( mSMimeTab, i18n("S/MIME Validation") );
3551 
3552 #ifndef KDEPIM_NO_WEBKIT
3553  mSAdBlockTab = new SecurityPageAdBlockTab;
3554  addTab( mSAdBlockTab, i18n("Ad block") );
3555 #endif
3556 }
3557 
3558 QString SecurityPage::GeneralTab::helpAnchor() const
3559 {
3560  return QString::fromLatin1("configure-security-reading");
3561 }
3562 
3563 SecurityPageGeneralTab::SecurityPageGeneralTab( QWidget * parent )
3564  : ConfigModuleTab( parent )
3565 {
3566  mSGTab.setupUi( this );
3567 
3568  connect( mSGTab.mHtmlMailCheck, SIGNAL(stateChanged(int)),
3569  this, SLOT(slotEmitChanged()) );
3570  connect( mSGTab.mExternalReferences, SIGNAL(stateChanged(int)),
3571  this, SLOT(slotEmitChanged()) );
3572  connect(mSGTab.labelWarnHTML, SIGNAL(linkActivated(QString)),
3573  SLOT(slotLinkClicked(QString)));
3574 
3575  connect( mSGTab.mAlwaysDecrypt, SIGNAL(stateChanged(int)),
3576  this, SLOT(slotEmitChanged()) );
3577 
3578  connect( mSGTab.mAutomaticallyImportAttachedKeysCheck, SIGNAL(toggled(bool)),
3579  SLOT(slotEmitChanged()) );
3580 
3581  connect( mSGTab.mScamDetection, SIGNAL(toggled(bool)),
3582  SLOT(slotEmitChanged()) );
3583 
3584  connect( mSGTab.scamWhiteList, SIGNAL(changed()),
3585  SLOT(slotEmitChanged()) );
3586 }
3587 
3588 void SecurityPageGeneralTab::slotLinkClicked( const QString & link )
3589 {
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() );
3594 }
3595 
3596 void SecurityPage::GeneralTab::doLoadOther()
3597 {
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() );
3602 
3603  mSGTab.mAlwaysDecrypt->setChecked( MessageViewer::GlobalSettings::self()->alwaysDecrypt() );
3604 
3605  mSGTab.mScamDetection->setChecked( MessageViewer::GlobalSettings::self()->scamDetectionEnabled());
3606  mSGTab.scamWhiteList->setStringList( MessageViewer::GlobalSettings::self()->scamDetectionWhiteList() );
3607 }
3608 
3609 void SecurityPage::GeneralTab::save()
3610 {
3611  if ( MessageViewer::GlobalSettings::self()->htmlMail() != mSGTab.mHtmlMailCheck->isChecked())
3612  {
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)
3616  {
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);
3621  }
3622  }
3623  }
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() );
3630 }
3631 
3632 //Adblock
3633 #ifndef KDEPIM_NO_WEBKIT
3634 QString SecurityPageAdBlockTab::helpAnchor() const
3635 {
3636  return QString();
3637 }
3638 
3639 SecurityPageAdBlockTab::SecurityPageAdBlockTab( QWidget * parent )
3640  : ConfigModuleTab( parent )
3641 {
3642  QHBoxLayout *lay = new QHBoxLayout;
3643  lay->setMargin(0);
3644 
3645  mWidget = new MessageViewer::AdBlockSettingWidget;
3646  lay->addWidget(mWidget);
3647  connect(mWidget, SIGNAL(changed(bool)), SLOT(slotEmitChanged()));
3648  setLayout(lay);
3649 }
3650 
3651 SecurityPageAdBlockTab::~SecurityPageAdBlockTab()
3652 {
3653 }
3654 
3655 void SecurityPageAdBlockTab::save()
3656 {
3657  mWidget->save();
3658 }
3659 
3660 void SecurityPageAdBlockTab::doLoadFromGlobalSettings()
3661 {
3662  mWidget->doLoadFromGlobalSettings();
3663 }
3664 
3665 void SecurityPageAdBlockTab::doLoadOther()
3666 {
3667 
3668 }
3669 
3670 void SecurityPageAdBlockTab::doResetToDefaultsOther()
3671 {
3672  mWidget->doResetToDefaultsOther();
3673 }
3674 #endif
3675 
3676 
3677 QString SecurityPage::MDNTab::helpAnchor() const
3678 {
3679  return QString::fromLatin1("configure-security-mdn");
3680 }
3681 
3682 SecurityPageMDNTab::SecurityPageMDNTab( QWidget * parent )
3683  : ConfigModuleTab( parent )
3684 {
3685  mUi.setupUi( this );
3686 
3687  // "ignore", "ask", "deny", "always send" radiobuttons
3688  mMDNGroup = new QButtonGroup( this );
3689  connect( mMDNGroup, SIGNAL(buttonClicked(int)),
3690  this, SLOT(slotEmitChanged()) );
3691  mMDNGroup->addButton( mUi.radioIgnore, 0 );
3692  mMDNGroup->addButton( mUi.radioAsk, 1 );
3693  mMDNGroup->addButton( mUi.radioDeny, 2 );
3694  mMDNGroup->addButton( mUi.radioAlways, 3 );
3695 
3696  // "Original Message quote" radiobuttons
3697  mOrigQuoteGroup = new QButtonGroup( this );
3698  connect( mOrigQuoteGroup, SIGNAL(buttonClicked(int)),
3699  this, SLOT(slotEmitChanged()) );
3700  mOrigQuoteGroup->addButton( mUi.radioNothing, 0 );
3701  mOrigQuoteGroup->addButton( mUi.radioFull, 1 );
3702  mOrigQuoteGroup->addButton( mUi.radioHeaders, 2 );
3703 
3704  connect( mUi.mNoMDNsWhenEncryptedCheck, SIGNAL(toggled(bool)), SLOT(slotEmitChanged()) );
3705  connect( mUi.labelWarning, SIGNAL(linkActivated(QString)),
3706  SLOT(slotLinkClicked(QString)) );
3707 }
3708 
3709 void SecurityPageMDNTab::slotLinkClicked( const QString & link )
3710 {
3711  if ( link == QLatin1String( "whatsthis-mdn" ) )
3712  QWhatsThis::showText( QCursor::pos(), mUi.radioIgnore->whatsThis() );
3713 }
3714 
3715 void SecurityPage::MDNTab::doLoadOther()
3716 {
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() );
3724 }
3725 
3726 void SecurityPage::MDNTab::save()
3727 {
3728  MessageViewer::GlobalSettings::self()->setDefaultPolicy( mMDNGroup->checkedId() );
3729  MessageViewer::GlobalSettings::self()->setQuoteMessage( mOrigQuoteGroup->checkedId() );
3730  MessageViewer::GlobalSettings::self()->setNotSendWhenEncrypted( mUi.mNoMDNsWhenEncryptedCheck->isChecked() );
3731 }
3732 
3733 QString SecurityPage::ComposerCryptoTab::helpAnchor() const
3734 {
3735  return QString::fromLatin1("configure-security-composing");
3736 }
3737 
3738 SecurityPageComposerCryptoTab::SecurityPageComposerCryptoTab( QWidget * parent )
3739  : ConfigModuleTab( parent )
3740 {
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()) );
3749 }
3750 
3751 SecurityPageComposerCryptoTab::~SecurityPageComposerCryptoTab()
3752 {
3753  delete mWidget;
3754 }
3755 
3756 void SecurityPage::ComposerCryptoTab::doLoadOther()
3757 {
3758  // If you change default values, sync messagecomposer.cpp too
3759 
3760  mWidget->mEncToSelf->setChecked( MessageComposer::MessageComposerSettings::self()->cryptoEncryptToSelf() );
3761  mWidget->mShowEncryptionResult->setChecked( false ); //composer.readBoolEntry( "crypto-show-encryption-result", true ) );
3762  mWidget->mShowEncryptionResult->hide();
3763  mWidget->mShowKeyApprovalDlg->setChecked( MessageComposer::MessageComposerSettings::self()->cryptoShowKeysForApproval() );
3764 
3765  mWidget->mAutoEncrypt->setChecked( MessageComposer::MessageComposerSettings::self()->pgpAutoEncrypt() ) ;
3766  mWidget->mNeverEncryptWhenSavingInDrafts->setChecked(
3767  GlobalSettings::self()->neverEncryptDrafts() );
3768 
3769  mWidget->mStoreEncrypted->setChecked( GlobalSettings::self()->cryptoStoreEncrypted() );
3770 }
3771 
3772 void SecurityPage::ComposerCryptoTab::save()
3773 {
3774  MessageComposer::MessageComposerSettings::self()->setCryptoEncryptToSelf( mWidget->mEncToSelf->isChecked() );
3775  GlobalSettings::self()->setCryptoShowEncryptionResult( mWidget->mShowEncryptionResult->isChecked() );
3776  MessageComposer::MessageComposerSettings::self()->setCryptoShowKeysForApproval( mWidget->mShowKeyApprovalDlg->isChecked() );
3777 
3778  MessageComposer::MessageComposerSettings::self()->setPgpAutoEncrypt( mWidget->mAutoEncrypt->isChecked() );
3779  GlobalSettings::self()->setNeverEncryptDrafts( mWidget->mNeverEncryptWhenSavingInDrafts->isChecked() );
3780 
3781  GlobalSettings::self()->setCryptoStoreEncrypted( mWidget->mStoreEncrypted->isChecked() );
3782 }
3783 
3784 void SecurityPage::ComposerCryptoTab::doLoadFromGlobalSettings()
3785 {
3786  mWidget->mEncToSelf->setChecked( MessageComposer::MessageComposerSettings::self()->cryptoEncryptToSelf() );
3787  mWidget->mShowEncryptionResult->setChecked( GlobalSettings::self()->cryptoShowEncryptionResult() );
3788  mWidget->mShowKeyApprovalDlg->setChecked(MessageComposer::MessageComposerSettings::self()->cryptoShowKeysForApproval() );
3789 
3790  mWidget->mAutoEncrypt->setChecked(MessageComposer::MessageComposerSettings::self()->pgpAutoEncrypt() );
3791  mWidget->mNeverEncryptWhenSavingInDrafts->setChecked( GlobalSettings::self()->neverEncryptDrafts() );
3792 
3793  mWidget->mStoreEncrypted->setChecked(GlobalSettings::self()->cryptoStoreEncrypted() );
3794 
3795 }
3796 
3797 
3798 QString SecurityPage::WarningTab::helpAnchor() const
3799 {
3800  return QString::fromLatin1("configure-security-warnings");
3801 }
3802 
3803 SecurityPageWarningTab::SecurityPageWarningTab( QWidget * parent )
3804  : ConfigModuleTab( parent )
3805 {
3806  mWidget = new Ui::WarningConfiguration;
3807  mWidget->setupUi( this );
3808 
3809  mWidget->chiasmusButton->hide();
3810 
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()) );
3815 
3816  connect( mWidget->gnupgButton, SIGNAL(clicked()), SLOT(slotConfigureGnupg()) );
3817  //connect( mWidget->chiasmusButton, SIGNAL(clicked()), SLOT(slotConfigureChiasmus()) );
3818  connect( mWidget->enableAllWarningsPB, SIGNAL(clicked()), SLOT(slotReenableAllWarningsClicked()) );
3819 }
3820 
3821 SecurityPageWarningTab::~SecurityPageWarningTab()
3822 {
3823  delete mWidget;
3824 }
3825 
3826 void SecurityPage::WarningTab::doLoadFromGlobalSettings()
3827 {
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() );
3834 
3835  // The "-int" part of the key name is because there used to be a separate boolean
3836  // config entry for enabling/disabling. This is done with the single bool value now.
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() );
3845 
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() );
3852 }
3853 
3854 void SecurityPage::WarningTab::doLoadOther()
3855 {
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() );
3862 
3863  // The "-int" part of the key name is because there used to be a separate boolean
3864  // config entry for enabling/disabling. This is done with the single bool value now.
3865  mWidget->warnGroupBox->setChecked(
3866  MessageComposer::MessageComposerSettings::self()->cryptoWarnWhenNearExpire() );
3867 
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"));
3877 
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"));
3887 
3888  mWidget->enableAllWarningsPB->setEnabled( true );
3889 }
3890 
3891 void SecurityPage::WarningTab::save()
3892 {
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() );
3899 
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() );
3908 
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() );
3915 }
3916 
3917 void SecurityPage::WarningTab::slotReenableAllWarningsClicked()
3918 {
3919  KMessageBox::enableAllMessages();
3920 
3921  //Nepomuk composer.
3922  const QString groupName = KPIM::NepomukWarning::nepomukWarningGroupName();
3923  if ( KMKernel::self()->config()->hasGroup( groupName ) ) {
3924  KConfigGroup cfgGroup( KMKernel::self()->config(), groupName );
3925  cfgGroup.deleteGroup();
3926  }
3927 
3928  mWidget->enableAllWarningsPB->setEnabled( false );
3929 }
3930 
3931 void SecurityPage::WarningTab::slotConfigureGnupg()
3932 {
3933  QPointer<KCMultiDialog> dlg( new KCMultiDialog( this ) );
3934  dlg->addModule( QLatin1String("kleopatra_config_gnupgsystem") );
3935  dlg->exec();
3936  delete dlg;
3937 }
3938 
3939 #if 0
3940 void SecurityPage::WarningTab::slotConfigureChiasmus()
3941 {
3942  using namespace Kleo;
3943  // Find Chiasmus backend:
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 ) );
3949  dlg->exec();
3950  delete dlg;
3951  break;
3952  } else {
3953  kWarning() << "Found Chiasmus backend, but there doesn't seem to be a config object available from it.";
3954  }
3955  else
3956  kDebug() << "Skipping" << b->name() << "backend (not \"Chiasmus\")";
3957  else
3958  kDebug() << "Kleo::CryptoBackendFactory::instance() returned NULL!";
3959 }
3960 #endif
3961 
3963 QString SecurityPage::SMimeTab::helpAnchor() const
3964 {
3965  return QString::fromLatin1("configure-security-smime-validation");
3966 }
3967 
3968 SecurityPageSMimeTab::SecurityPageSMimeTab( QWidget * parent )
3969  : ConfigModuleTab( parent )
3970 {
3971 
3972  mWidget = new Ui::SMimeConfiguration;
3973  mWidget->setupUi( this );
3974 
3975  // Button-group for exclusive radiobuttons
3976  QButtonGroup* bg = new QButtonGroup( this );
3977  bg->addButton( mWidget->CRLRB );
3978  bg->addButton( mWidget->OCSPRB );
3979 
3980  // Settings for the keyrequester custom widget
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 );
3988 
3989  mConfig = Kleo::CryptoBackendFactory::instance()->config();
3990 
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()) );
3994  connect( mWidget->OCSPResponderSignature, SIGNAL(changed()), 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()) );
3998 
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()) );
4008 
4009  connect( mWidget->disableHTTPCB, SIGNAL(toggled(bool)),
4010  this, SLOT(slotUpdateHTTPActions()) );
4011  connect( mWidget->ignoreHTTPDPCB, SIGNAL(toggled(bool)),
4012  this, SLOT(slotUpdateHTTPActions()) );
4013 
4014  // Button-group for exclusive radiobuttons
4015  QButtonGroup* bgHTTPProxy = new QButtonGroup( this );
4016  bgHTTPProxy->addButton( mWidget->honorHTTPProxyRB );
4017  bgHTTPProxy->addButton( mWidget->useCustomHTTPProxyRB );
4018 
4019  QDBusConnection::sessionBus().connect(QString(), QString(), QLatin1String("org.kde.kleo.CryptoConfig"), QLatin1String("changed"),this, SLOT(load()) );
4020 }
4021 
4022 SecurityPageSMimeTab::~SecurityPageSMimeTab()
4023 {
4024  delete mWidget;
4025 }
4026 
4027 static void disableDirmngrWidget( QWidget* w )
4028 {
4029  w->setEnabled( false );
4030  w->setWhatsThis( i18n( "This option requires dirmngr >= 0.9.0" ) );
4031 }
4032 
4033 static void initializeDirmngrCheckbox( QCheckBox* cb, Kleo::CryptoConfigEntry* entry )
4034 {
4035  if ( entry )
4036  cb->setChecked( entry->boolValue() );
4037  else
4038  disableDirmngrWidget( cb );
4039 }
4040 
4041 struct SMIMECryptoConfigEntries {
4042  SMIMECryptoConfigEntries( Kleo::CryptoConfig* config )
4043  : mConfig( config ) {
4044 
4045  // Checkboxes
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 );
4051  // dirmngr-0.9.0 options
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 );
4056 
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 );
4059  // Other widgets
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 );
4064  }
4065 
4066  Kleo::CryptoConfigEntry* configEntry(const QString &componentName,
4067  const QString &groupName,
4068  const QString &entryName,
4069  int argType,
4070  bool isList );
4071 
4072  // Checkboxes
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;
4084  // Other widgets
4085  Kleo::CryptoConfigEntry* mOCSPResponderURLConfigEntry;
4086  Kleo::CryptoConfigEntry* mOCSPResponderSignature;
4087  Kleo::CryptoConfigEntry* mCustomHTTPProxy;
4088  Kleo::CryptoConfigEntry* mCustomLDAPProxy;
4089 
4090  Kleo::CryptoConfig* mConfig;
4091 };
4092 
4093 void SecurityPage::SMimeTab::doLoadOther()
4094 {
4095  if ( !mConfig ) {
4096  setEnabled( false );
4097  return;
4098  }
4099 
4100  // Force re-parsing gpgconf data, in case e.g. kleopatra or "configure backend" was used
4101  // (which ends up calling us via D-Bus)
4102  mConfig->clear();
4103 
4104  // Create config entries
4105  // Don't keep them around, they'll get deleted by clear(), which could be
4106  // done by the "configure backend" button even before we save().
4107  SMIMECryptoConfigEntries e( mConfig );
4108 
4109  // Initialize GUI items from the config entries
4110 
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 );
4116  } else {
4117  mWidget->OCSPGroupBox->setEnabled( false );
4118  }
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() );
4125 
4126  if ( e.mOCSPResponderURLConfigEntry )
4127  mWidget->OCSPResponderURL->setText( e.mOCSPResponderURLConfigEntry->stringValue() );
4128  if ( e.mOCSPResponderSignature ) {
4129  mWidget->OCSPResponderSignature->setFingerprint( e.mOCSPResponderSignature->stringValue() );
4130  }
4131 
4132  // dirmngr-0.9.0 options
4133  initializeDirmngrCheckbox( mWidget->ignoreServiceURLCB, e.mIgnoreServiceURLEntry );
4134  initializeDirmngrCheckbox( mWidget->ignoreHTTPDPCB, e.mIgnoreHTTPDPEntry );
4135  initializeDirmngrCheckbox( mWidget->disableHTTPCB, e.mDisableHTTPEntry );
4136  initializeDirmngrCheckbox( mWidget->ignoreLDAPDPCB, e.mIgnoreLDAPDPEntry );
4137  initializeDirmngrCheckbox( mWidget->disableLDAPCB, e.mDisableLDAPEntry );
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() );
4147  } else {
4148  disableDirmngrWidget( mWidget->honorHTTPProxyRB );
4149  disableDirmngrWidget( mWidget->useCustomHTTPProxyRB );
4150  disableDirmngrWidget( mWidget->systemHTTPProxy );
4151  disableDirmngrWidget( mWidget->customHTTPProxy );
4152  }
4153  if ( e.mCustomLDAPProxy )
4154  mWidget->customLDAPProxy->setText( e.mCustomLDAPProxy->stringValue() );
4155  else {
4156  disableDirmngrWidget( mWidget->customLDAPProxy );
4157  disableDirmngrWidget( mWidget->customLDAPLabel );
4158  }
4159  slotUpdateHTTPActions();
4160 }
4161 
4162 void SecurityPage::SMimeTab::slotUpdateHTTPActions()
4163 {
4164  mWidget->ignoreHTTPDPCB->setEnabled( !mWidget->disableHTTPCB->isChecked() );
4165 
4166  // The proxy settings only make sense when "Ignore HTTP CRL DPs of certificate" is checked.
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());
4173 
4174  if ( !mWidget->useCustomHTTPProxyRB->isChecked() &&
4175  !mWidget->honorHTTPProxyRB->isChecked() )
4176  mWidget->honorHTTPProxyRB->setChecked( true );
4177 }
4178 
4179 static void saveCheckBoxToKleoEntry( QCheckBox* cb, Kleo::CryptoConfigEntry* entry )
4180 {
4181  const bool b = cb->isChecked();
4182  if ( entry && entry->boolValue() != b )
4183  entry->setBoolValue( b );
4184 }
4185 
4186 void SecurityPage::SMimeTab::save()
4187 {
4188  if ( !mConfig ) {
4189  return;
4190  }
4191  // Create config entries
4192  // Don't keep them around, they'll get deleted by clear(), which could be done by the
4193  // "configure backend" button.
4194  SMIMECryptoConfigEntries e( mConfig );
4195 
4196  bool b = mWidget->OCSPRB->isChecked();
4197  if ( e.mCheckUsingOCSPConfigEntry && e.mCheckUsingOCSPConfigEntry->boolValue() != b )
4198  e.mCheckUsingOCSPConfigEntry->setBoolValue( b );
4199  // Set allow-ocsp together with enable-ocsp
4200  if ( e.mEnableOCSPsendingConfigEntry && e.mEnableOCSPsendingConfigEntry->boolValue() != b )
4201  e.mEnableOCSPsendingConfigEntry->setBoolValue( b );
4202 
4203  saveCheckBoxToKleoEntry( mWidget->doNotCheckCertPolicyCB, e.mDoNotCheckCertPolicyConfigEntry );
4204  saveCheckBoxToKleoEntry( mWidget->neverConsultCB, e.mNeverConsultConfigEntry );
4205  saveCheckBoxToKleoEntry( mWidget->fetchMissingCB, e.mFetchMissingConfigEntry );
4206 
4207  QString txt = mWidget->OCSPResponderURL->text();
4208  if ( e.mOCSPResponderURLConfigEntry && e.mOCSPResponderURLConfigEntry->stringValue() != txt )
4209  e.mOCSPResponderURLConfigEntry->setStringValue( txt );
4210 
4211  txt = mWidget->OCSPResponderSignature->fingerprint();
4212  if ( e.mOCSPResponderSignature && e.mOCSPResponderSignature->stringValue() != txt ) {
4213  e.mOCSPResponderSignature->setStringValue( txt );
4214  }
4215 
4216  //dirmngr-0.9.0 options
4217  saveCheckBoxToKleoEntry( mWidget->ignoreServiceURLCB, e.mIgnoreServiceURLEntry );
4218  saveCheckBoxToKleoEntry( mWidget->ignoreHTTPDPCB, e.mIgnoreHTTPDPEntry );
4219  saveCheckBoxToKleoEntry( mWidget->disableHTTPCB, e.mDisableHTTPEntry );
4220  saveCheckBoxToKleoEntry( mWidget->ignoreLDAPDPCB, e.mIgnoreLDAPDPEntry );
4221  saveCheckBoxToKleoEntry( mWidget->disableLDAPCB, e.mDisableLDAPEntry );
4222  if ( e.mCustomHTTPProxy ) {
4223  const bool honor = mWidget->honorHTTPProxyRB->isChecked();
4224  if ( e.mHonorHTTPProxy && e.mHonorHTTPProxy->boolValue() != honor )
4225  e.mHonorHTTPProxy->setBoolValue( honor );
4226 
4227  QString chosenProxy = mWidget->customHTTPProxy->text();
4228  if ( chosenProxy != e.mCustomHTTPProxy->stringValue() )
4229  e.mCustomHTTPProxy->setStringValue( chosenProxy );
4230  }
4231  txt = mWidget->customLDAPProxy->text();
4232  if ( e.mCustomLDAPProxy && e.mCustomLDAPProxy->stringValue() != txt )
4233  e.mCustomLDAPProxy->setStringValue( mWidget->customLDAPProxy->text() );
4234 
4235  mConfig->sync( true );
4236 }
4237 
4238 Kleo::CryptoConfigEntry* SMIMECryptoConfigEntries::configEntry( const QString &componentName,
4239  const QString &groupName,
4240  const QString &entryName,
4241  int /*Kleo::CryptoConfigEntry::ArgType*/ argType,
4242  bool isList )
4243 {
4244  Kleo::CryptoConfigEntry* entry = mConfig->entry( componentName, groupName, entryName );
4245  if ( !entry ) {
4246  kWarning() << QString::fromLatin1("Backend error: gpgconf doesn't seem to know the entry for %1/%2/%3" ).arg( componentName, groupName, entryName );
4247  return 0;
4248  }
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() );
4251  return 0;
4252  }
4253  return entry;
4254 }
4255 
4256 // *************************************************************
4257 // * *
4258 // * MiscPage *
4259 // * *
4260 // *************************************************************
4261 QString MiscPage::helpAnchor() const
4262 {
4263  return QString::fromLatin1("configure-misc");
4264 }
4265 
4266 MiscPage::MiscPage( const KComponentData &instance, QWidget *parent )
4267  : ConfigModuleWithTabs( instance, parent )
4268 {
4269  mFolderTab = new FolderTab();
4270  addTab( mFolderTab, i18n("Folders") );
4271 
4272  mInviteTab = new InviteTab();
4273  addTab( mInviteTab, i18n("Invitations" ) );
4274 
4275  mProxyTab = new ProxyTab();
4276  addTab( mProxyTab, i18n("Proxy" ) );
4277 
4278  mAgentSettingsTab = new MiscPageAgentSettingsTab();
4279  addTab( mAgentSettingsTab, i18n("Agent Settings" ) );
4280 
4281  mPrintingTab = new MiscPagePrintingTab();
4282  addTab( mPrintingTab, i18n("Printing" ) );
4283 }
4284 
4285 QString MiscPageFolderTab::helpAnchor() const
4286 {
4287  return QString::fromLatin1("Sconfigure-misc-folders");
4288 }
4289 
4290 MiscPageFolderTab::MiscPageFolderTab( QWidget * parent )
4291  : ConfigModuleTab( parent )
4292 {
4293  mMMTab.setupUi( this );
4294  //replace QWidget with FolderRequester. Promote to doesn't work due to the custom constructor
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 );
4300 
4301  mMMTab.gridLayout->setSpacing( KDialog::spacingHint() );
4302  mMMTab.gridLayout->setMargin( KDialog::marginHint() );
4303  mMMTab.mExcludeImportantFromExpiry->setWhatsThis(
4304  i18n( GlobalSettings::self()->excludeImportantMailFromExpiryItem()->whatsThis().toUtf8() ) );
4305 
4306  connect( mMMTab.mEmptyFolderConfirmCheck, SIGNAL(stateChanged(int)),
4307  this, SLOT(slotEmitChanged()) );
4308  connect( mMMTab.mExcludeImportantFromExpiry, SIGNAL(stateChanged(int)),
4309  this, SLOT(slotEmitChanged()) );
4310  connect( mMMTab.mLoopOnGotoUnread, SIGNAL(activated(int)),
4311  this, SLOT(slotEmitChanged()) );
4312  connect( mMMTab.mActionEnterFolder, SIGNAL(activated(int)),
4313  this, SLOT(slotEmitChanged()) );
4314  connect( mMMTab.mDelayedMarkTime, SIGNAL(valueChanged(int)),
4315  this, SLOT(slotEmitChanged()) );
4316  connect( mMMTab.mDelayedMarkAsRead, SIGNAL(toggled(bool)),
4317  mMMTab.mDelayedMarkTime, SLOT(setEnabled(bool)));
4318  connect( mMMTab.mDelayedMarkAsRead, SIGNAL(toggled(bool)),
4319  this , SLOT(slotEmitChanged()) );
4320  connect( mMMTab.mShowPopupAfterDnD, SIGNAL(stateChanged(int)),
4321  this, SLOT(slotEmitChanged()) );
4322  connect( mOnStartupOpenFolder, SIGNAL(folderChanged(Akonadi::Collection)),
4323  this, SLOT(slotEmitChanged()) );
4324  connect( mMMTab.mEmptyTrashCheck, SIGNAL(stateChanged(int)),
4325  this, SLOT(slotEmitChanged()) );
4326  connect( mMMTab.mStartUpFolderCheck, SIGNAL(toggled(bool)),
4327  this, SLOT(slotEmitChanged()) );
4328  connect( mMMTab.mStartUpFolderCheck, SIGNAL(toggled(bool)),
4329  mOnStartupOpenFolder, SLOT(setEnabled(bool)) );
4330 }
4331 
4332 void MiscPage::FolderTab::doLoadFromGlobalSettings()
4333 {
4334  mMMTab.mExcludeImportantFromExpiry->setChecked( GlobalSettings::self()->excludeImportantMailFromExpiry() );
4335  // default = "Loop in current folder"
4336  mMMTab.mLoopOnGotoUnread->setCurrentIndex( GlobalSettings::self()->loopOnGotoUnread() );
4337  mMMTab.mActionEnterFolder->setCurrentIndex( GlobalSettings::self()->actionEnterFolder() );
4338  mMMTab.mDelayedMarkAsRead->setChecked( MessageViewer::GlobalSettings::self()->delayedMarkAsRead() );
4339  mMMTab.mDelayedMarkTime->setValue( MessageViewer::GlobalSettings::self()->delayedMarkTime() );
4340  mMMTab.mShowPopupAfterDnD->setChecked( GlobalSettings::self()->showPopupAfterDnD() );
4341  mMMTab.mStartUpFolderCheck->setChecked( GlobalSettings::self()->startSpecificFolderAtStartup() );
4342  mOnStartupOpenFolder->setEnabled(GlobalSettings::self()->startSpecificFolderAtStartup());
4343  doLoadOther();
4344 }
4345 
4346 void MiscPage::FolderTab::doLoadOther()
4347 {
4348  mMMTab.mEmptyTrashCheck->setChecked( GlobalSettings::self()->emptyTrashOnExit() );
4349  mOnStartupOpenFolder->setCollection( Akonadi::Collection( GlobalSettings::self()->startupFolder() ) );
4350  mMMTab.mEmptyFolderConfirmCheck->setChecked( GlobalSettings::self()->confirmBeforeEmpty() );
4351 }
4352 
4353 void MiscPage::FolderTab::save()
4354 {
4355  GlobalSettings::self()->setEmptyTrashOnExit( mMMTab.mEmptyTrashCheck->isChecked() );
4356  GlobalSettings::self()->setConfirmBeforeEmpty( mMMTab.mEmptyFolderConfirmCheck->isChecked() );
4357  GlobalSettings::self()->setStartupFolder( mOnStartupOpenFolder->collection().id() );
4358 
4359  MessageViewer::GlobalSettings::self()->setDelayedMarkAsRead( mMMTab.mDelayedMarkAsRead->isChecked() );
4360  MessageViewer::GlobalSettings::self()->setDelayedMarkTime( mMMTab.mDelayedMarkTime->value() );
4361  GlobalSettings::self()->setActionEnterFolder( mMMTab.mActionEnterFolder->currentIndex() );
4362  GlobalSettings::self()->setLoopOnGotoUnread( mMMTab.mLoopOnGotoUnread->currentIndex() );
4363  GlobalSettings::self()->setShowPopupAfterDnD( mMMTab.mShowPopupAfterDnD->isChecked() );
4364  GlobalSettings::self()->setExcludeImportantMailFromExpiry(
4365  mMMTab.mExcludeImportantFromExpiry->isChecked() );
4366  GlobalSettings::self()->setStartSpecificFolderAtStartup(mMMTab.mStartUpFolderCheck->isChecked() );
4367 }
4368 
4369 MiscPageAgentSettingsTab::MiscPageAgentSettingsTab( QWidget* parent )
4370  : ConfigModuleTab( parent )
4371 {
4372  QHBoxLayout *l = new QHBoxLayout( this );
4373  l->setContentsMargins( 0 , 0, 0, 0 );
4374  mConfigureAgent = new ConfigureAgentsWidget;
4375  l->addWidget( mConfigureAgent );
4376 
4377  connect( mConfigureAgent, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
4378 }
4379 
4380 void MiscPageAgentSettingsTab::doLoadFromGlobalSettings()
4381 {
4382  mConfigureAgent->doLoadFromGlobalSettings();
4383 }
4384 
4385 void MiscPageAgentSettingsTab::save()
4386 {
4387  mConfigureAgent->save();
4388 }
4389 
4390 void MiscPageAgentSettingsTab::doResetToDefaultsOther()
4391 {
4392  mConfigureAgent->doResetToDefaultsOther();
4393 }
4394 
4395 QString MiscPageAgentSettingsTab::helpAnchor() const
4396 {
4397  return mConfigureAgent->helpAnchor();
4398 }
4399 
4400 MiscPageInviteTab::MiscPageInviteTab( QWidget* parent )
4401  : ConfigModuleTab( parent )
4402 {
4403  mInvitationUi = new MessageViewer::InvitationSettings( this );
4404  QHBoxLayout *l = new QHBoxLayout( this );
4405  l->setContentsMargins( 0 , 0, 0, 0 );
4406  l->addWidget( mInvitationUi );
4407  connect( mInvitationUi, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
4408 }
4409 
4410 void MiscPage::InviteTab::doLoadFromGlobalSettings()
4411 {
4412  mInvitationUi->doLoadFromGlobalSettings();
4413 }
4414 
4415 void MiscPage::InviteTab::save()
4416 {
4417  mInvitationUi->save();
4418 }
4419 
4420 void MiscPage::InviteTab::doResetToDefaultsOther()
4421 {
4422  mInvitationUi->doResetToDefaultsOther();
4423 }
4424 
4425 
4426 MiscPageProxyTab::MiscPageProxyTab( QWidget* parent )
4427  : ConfigModuleTab( parent )
4428 {
4429  KCModuleInfo proxyInfo(QLatin1String("proxy.desktop"));
4430  mProxyModule = new KCModuleProxy(proxyInfo, parent);
4431  QHBoxLayout *l = new QHBoxLayout( this );
4432  l->addWidget( mProxyModule );
4433  connect(mProxyModule,SIGNAL(changed(bool)), this, SLOT(slotEmitChanged()));
4434 }
4435 
4436 void MiscPage::ProxyTab::save()
4437 {
4438  mProxyModule->save();
4439 }
4440 
4441 MiscPagePrintingTab::MiscPagePrintingTab( QWidget * parent )
4442  : ConfigModuleTab( parent )
4443 {
4444  mPrintingUi = new MessageViewer::PrintingSettings( this );
4445  QHBoxLayout *l = new QHBoxLayout( this );
4446  l->setContentsMargins( 0 , 0, 0, 0 );
4447  l->addWidget( mPrintingUi );
4448  connect( mPrintingUi, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
4449 }
4450 
4451 void MiscPagePrintingTab::doLoadFromGlobalSettings()
4452 {
4453  mPrintingUi->doLoadFromGlobalSettings();
4454 }
4455 
4456 void MiscPagePrintingTab::doResetToDefaultsOther()
4457 {
4458  mPrintingUi->doResetToDefaultsOther();
4459 }
4460 
4461 
4462 void MiscPagePrintingTab::save()
4463 {
4464  mPrintingUi->save();
4465 }
4466 
4467 //----------------------------
4468 #include "configuredialog.moc"
AppearancePageMessageTagTab::slotRemoveTag
void slotRemoveTag()
Removes the currently selected text in the list box.
Definition: configuredialog.cpp:1952
AppearancePage::helpAnchor
QString helpAnchor() const
Should return the help anchor for this page or tab.
Definition: configuredialog.cpp:715
AppearancePageLayoutTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:1149
AppearancePage::LayoutTab
AppearancePageLayoutTab LayoutTab
Definition: configuredialog_p.h:497
ComposerPage::CharsetTab
ComposerPageCharsetTab CharsetTab
Definition: configuredialog_p.h:745
globalsettings.h
KPIM::CompletionOrderEditor
QSharedPointer
Definition: collectionmailinglistpage.h:34
ComposerPageTemplatesTab::ComposerPageTemplatesTab
ComposerPageTemplatesTab(QWidget *parent=0)
Definition: configuredialog.cpp:2768
ComposerPage::SubjectTab
ComposerPageSubjectTab SubjectTab
Definition: configuredialog_p.h:744
AppearancePageMessageTagTab::~AppearancePageMessageTagTab
~AppearancePageMessageTagTab()
Definition: configuredialog.cpp:1814
AppearancePage::ColorsTab
AppearancePageColorsTab ColorsTab
Definition: configuredialog_p.h:496
MiscPagePrintingTab::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configuredialog.cpp:4456
kmmainwidget.h
SecurityPageWarningTab::save
void save()
Definition: configuredialog.cpp:3891
SecurityPageWarningTab::SecurityPageWarningTab
SecurityPageWarningTab(QWidget *parent=0)
Definition: configuredialog.cpp:3803
ConfigModuleTab
Definition: configuredialog_p.h:98
ComposerPageGeneralTab::ComposerPageGeneralTab
ComposerPageGeneralTab(QWidget *parent=0)
Definition: configuredialog.cpp:2204
ldapclientsearch.h
AppearancePageHeadersTab::AppearancePageHeadersTab
AppearancePageHeadersTab(QWidget *parent=0)
Definition: configuredialog.cpp:1274
ConfigureAgentsWidget::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configureagentswidget.cpp:220
dateDisplayConfig
static const struct @2 dateDisplayConfig[]
SecurityPageMDNTab::save
void save()
Definition: configuredialog.cpp:3726
SecurityPageSMimeTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3963
SecurityPageAdBlockTab
Definition: configuredialog_p.h:877
SecurityPageMDNTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3677
ComposerPageHeadersTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3057
TagListWidgetItem::setKMailTag
void setKMailTag(const MailCommon::Tag::Ptr &tag)
Definition: configuredialog.cpp:1675
text
virtual QByteArray text(quint32 serialNumber) const =0
SecurityPageMDNTab::SecurityPageMDNTab
SecurityPageMDNTab(QWidget *parent=0)
Definition: configuredialog.cpp:3682
ComposerPageAutoCorrectionTab::save
void save()
Definition: configuredialog.cpp:3463
KLDAP::LdapClientSearch
AppearancePage::ReaderTab
AppearancePageReaderTab ReaderTab
Definition: configuredialog_p.h:499
configuredialoglistview.h
ComposerPage::helpAnchor
QString helpAnchor() const
Should return the help anchor for this page or tab.
Definition: configuredialog.cpp:2128
AppearancePageMessageTagTab::slotAddLineTextChanged
void slotAddLineTextChanged(const QString &aText)
Enables/disables Add button according to whether aText is empty.
Definition: configuredialog.cpp:2015
MiscPageFolderTab::MiscPageFolderTab
MiscPageFolderTab(QWidget *parent=0)
Definition: configuredialog.cpp:4290
AppearancePage::FontsTab
AppearancePageFontsTab FontsTab
Definition: configuredialog_p.h:495
ComposerPageSubjectTab::ComposerPageSubjectTab
ComposerPageSubjectTab(QWidget *parent=0)
Definition: configuredialog.cpp:2833
QWidget
ComposerPageCharsetTab::ComposerPageCharsetTab
ComposerPageCharsetTab(QWidget *parent=0)
Definition: configuredialog.cpp:2950
identitypage.h
MiscPageFolderTab::save
void save()
Definition: configuredialog.cpp:4353
QListWidget
ComposerPageGeneralTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:2198
AppearancePageReaderTab::save
void save()
Definition: configuredialog.cpp:1588
ComposerPageAttachmentsTab::save
void save()
Definition: configuredialog.cpp:3414
kmknotify.h
ComposerPageHeadersTab::ComposerPageHeadersTab
ComposerPageHeadersTab(QWidget *parent=0)
Definition: configuredialog.cpp:3062
MiscPageAgentSettingsTab::MiscPageAgentSettingsTab
MiscPageAgentSettingsTab(QWidget *parent=0)
Definition: configuredialog.cpp:4369
configuredialog.h
AppearancePageReaderTab::AppearancePageReaderTab
AppearancePageReaderTab(QWidget *parent=0)
Definition: configuredialog.cpp:1553
ComposerPageCharsetTab::save
void save()
Definition: configuredialog.cpp:3044
ComposerPageSubjectTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:2828
SecurityPageGeneralTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3558
ConfigureDialog::ConfigureDialog
ConfigureDialog(QWidget *parent=0, bool modal=true)
Definition: configuredialog.cpp:218
AccountsPageSendingTab::AccountsPageSendingTab
AccountsPageSendingTab(QWidget *parent=0)
Definition: configuredialog.cpp:309
TagListWidgetItem::kmailTag
MailCommon::Tag::Ptr kmailTag() const
Definition: configuredialog.cpp:1680
SecurityPageAdBlockTab::SecurityPageAdBlockTab
SecurityPageAdBlockTab(QWidget *parent=0)
Definition: configuredialog.cpp:3639
TagListWidgetItem::~TagListWidgetItem
~TagListWidgetItem()
Definition: configuredialog.cpp:1671
ComposerPageAutoImageResizeTab::save
void save()
Definition: configuredialog.cpp:3497
ComposerPage::ExternalEditorTab
ComposerPageExternalEditorTab ExternalEditorTab
Definition: configuredialog_p.h:750
ComposerPageCustomTemplatesTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:2797
nepomukwarning.h
ComposerPage::AttachmentsTab
ComposerPageAttachmentsTab AttachmentsTab
Definition: configuredialog_p.h:747
ConfigureAgentsWidget::doLoadFromGlobalSettings
void doLoadFromGlobalSettings()
Definition: configureagentswidget.cpp:205
AppearancePageHeadersTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:1257
AccountsPage::accountListChanged
void accountListChanged(const QStringList &)
KMKernel::self
static KMKernel * self()
normal control stuff
Definition: kmkernel.cpp:1451
MiscPageInviteTab::MiscPageInviteTab
MiscPageInviteTab(QWidget *parent=0)
Definition: configuredialog.cpp:4400
numFontNames
static const int numFontNames
Definition: configuredialog.cpp:792
ConfigureAgentsWidget::helpAnchor
QString helpAnchor() const
Definition: configureagentswidget.cpp:200
KMKernel::savePaneSelection
void savePaneSelection()
Definition: kmkernel.cpp:1963
accountconfigorderdialog.h
ConfigAgentDelegate
A delegate for listing the accounts in the account list with kmail specific options.
Definition: configagentdelegate.h:35
AccountsPageReceivingTab::save
void save()
Definition: configuredialog.cpp:692
TagListWidgetItem::TagListWidgetItem
TagListWidgetItem(QListWidget *parent=0)
Definition: configuredialog.cpp:1661
SecurityPageWarningTab::~SecurityPageWarningTab
~SecurityPageWarningTab()
Definition: configuredialog.cpp:3821
ComposerPage::AutoCorrectionTab
ComposerPageAutoCorrectionTab AutoCorrectionTab
Definition: configuredialog_p.h:748
ComposerPage::CustomTemplatesTab
ComposerPageCustomTemplatesTab CustomTemplatesTab
Definition: configuredialog_p.h:743
fontNames
static const struct @0 fontNames[]
SecurityPage::GeneralTab
SecurityPageGeneralTab GeneralTab
Definition: configuredialog_p.h:905
AccountsPage::AccountsPage
AccountsPage(const KComponentData &instance, QWidget *parent=0)
Definition: configuredialog.cpp:282
ConfigModuleTab::load
void load()
MiscPageFolderTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:4285
AppearancePageHeadersTab::save
void save()
Definition: configuredialog.cpp:1516
KMail::Util::quoteL3Color
QColor quoteL3Color()
Definition: util.cpp:221
SecurityPage::WarningTab
SecurityPageWarningTab WarningTab
Definition: configuredialog_p.h:908
dateDisplay
DateFormatter::FormatType dateDisplay
Definition: configuredialog.cpp:1264
ComposerPageAutoImageResizeTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3492
MiscPagePrintingTab::save
void save()
Definition: configuredialog.cpp:4462
ComposerPageGeneralTab::save
void save()
Definition: configuredialog.cpp:2648
AccountsPageSendingTab::~AccountsPageSendingTab
virtual ~AccountsPageSendingTab()
Definition: configuredialog.cpp:300
TagListWidgetItem
Definition: configuredialog_p.h:395
MiscPageInviteTab::save
void save()
Definition: configuredialog.cpp:4415
KMail::Util::quoteL1Color
QColor quoteL1Color()
Definition: util.cpp:211
AppearancePageMessageTagTab::slotMoveTagUp
void slotMoveTagUp()
Increases the currently selected tag's priority and handles related visual changes.
Definition: configuredialog.cpp:1847
AppearancePageSystemTrayTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:1594
configuredialog_p.h
configureagentswidget.h
ConfigModuleTab::slotEmitChanged
void slotEmitChanged()
colorNames
static const struct @1 colorNames[]
MiscPageProxyTab::MiscPageProxyTab
MiscPageProxyTab(QWidget *parent=0)
Definition: configuredialog.cpp:4426
AppearancePageLayoutTab::AppearancePageLayoutTab
AppearancePageLayoutTab(QWidget *parent=0)
Definition: configuredialog.cpp:1154
AppearancePageColorsTab::save
void save()
Definition: configuredialog.cpp:1114
SecurityPageAdBlockTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3634
AccountsPage::helpAnchor
QString helpAnchor() const
Should return the help anchor for this page or tab.
Definition: configuredialog.cpp:277
ConfigModuleWithTabs::addTab
void addTab(ConfigModuleTab *tab, const QString &title)
MiscPage::FolderTab
MiscPageFolderTab FolderTab
Definition: configuredialog_p.h:1008
ComposerPageTemplatesTab::save
void save()
Definition: configuredialog.cpp:2787
MiscPagePrintingTab::MiscPagePrintingTab
MiscPagePrintingTab(QWidget *parent=0)
Definition: configuredialog.cpp:4441
saveCheckBoxToKleoEntry
static void saveCheckBoxToKleoEntry(QCheckBox *cb, Kleo::CryptoConfigEntry *entry)
Definition: configuredialog.cpp:4179
ConfigureAgentsWidget::save
void save()
Definition: configureagentswidget.cpp:188
ComposerPage::AutoImageResizeTab
ComposerPageAutoImageResizeTab AutoImageResizeTab
Definition: configuredialog_p.h:749
SecurityPageSMimeTab::SecurityPageSMimeTab
SecurityPageSMimeTab(QWidget *parent=0)
Definition: configuredialog.cpp:3968
AppearancePageColorsTab::AppearancePageColorsTab
AppearancePageColorsTab(QWidget *parent=0)
Definition: configuredialog.cpp:989
AccountsPageReceivingTab::~AccountsPageReceivingTab
~AccountsPageReceivingTab()
Definition: configuredialog.cpp:500
SecurityPage::SMimeTab
SecurityPageSMimeTab SMimeTab
Definition: configuredialog_p.h:909
displayName
const char * displayName
Definition: configuredialog.cpp:775
util.h
MiscPageAgentSettingsTab
Definition: configuredialog_p.h:971
ConfigureDialog::configChanged
void configChanged()
AppearancePage::HeadersTab
AppearancePageHeadersTab HeadersTab
Definition: configuredialog_p.h:498
MiscPage::InviteTab
MiscPageInviteTab InviteTab
Definition: configuredialog_p.h:1009
KPIM::NepomukWarning::nepomukWarningGroupName
static QString nepomukWarningGroupName()
ComposerPageGeneralTab::slotConfigureRecentAddresses
void slotConfigureRecentAddresses()
Definition: configuredialog.cpp:2675
numDateDisplayConfig
static const int numDateDisplayConfig
Definition: configuredialog.cpp:1271
MiscPageProxyTab::save
void save()
Definition: configuredialog.cpp:4436
AccountsPageReceivingTab::AccountsPageReceivingTab
AccountsPageReceivingTab(QWidget *parent=0)
Definition: configuredialog.cpp:430
AppearancePageMessageTagTab::slotAddNewTag
void slotAddNewTag()
Creates a generic tag with the visible name from the line edit widget for adding tags.
Definition: configuredialog.cpp:2020
KMKernel::slotRequestConfigSync
void slotRequestConfigSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes...
Definition: kmkernel.cpp:1338
AppearancePage::MessageTagTab
AppearancePageMessageTagTab MessageTagTab
Definition: configuredialog_p.h:501
SecurityPageGeneralTab::save
void save()
Definition: configuredialog.cpp:3609
kmkernel
#define kmkernel
Definition: kmkernel.h:22
completionordereditor.h
ComposerPageSubjectTab::save
void save()
Definition: configuredialog.cpp:2920
QListWidgetItem
ComposerPageAutoImageResizeTab::ComposerPageAutoImageResizeTab
ComposerPageAutoImageResizeTab(QWidget *parent=0)
Definition: configuredialog.cpp:3479
ConfigureDialog::slotOk
void slotOk()
Saves the GlobalSettings stuff before passing on to KCMultiDialog.
Definition: configuredialog.cpp:265
ComposerPageAttachmentsTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3322
MiscPage::helpAnchor
QString helpAnchor() const
Should return the help anchor for this page or tab.
Definition: configuredialog.cpp:4261
ColorListBox::color
QColor color(int index) const
Definition: colorlistbox.cpp:67
KPIM::RecentAddressDialog
QTreeWidgetItem
ConfigModuleTab::changed
void changed(bool)
colorlistbox.h
ListView
Definition: configuredialoglistview.h:9
ComposerPageExternalEditorTab::ComposerPageExternalEditorTab
ComposerPageExternalEditorTab(QWidget *parent=0)
Definition: configuredialog.cpp:2702
AppearancePageColorsTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:955
GlobalSettings::requestSync
void requestSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes...
Definition: globalsettings.cpp:47
MiscPageAgentSettingsTab::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configuredialog.cpp:4390
ColorListBox::setColorSilently
void setColorSilently(int index, const QColor &color)
Definition: colorlistbox.cpp:52
SecurityPageGeneralTab::SecurityPageGeneralTab
SecurityPageGeneralTab(QWidget *parent=0)
Definition: configuredialog.cpp:3563
AppearancePage::AppearancePage
AppearancePage(const KComponentData &instance, QWidget *parent=0)
Definition: configuredialog.cpp:720
SecurityPageComposerCryptoTab::SecurityPageComposerCryptoTab
SecurityPageComposerCryptoTab(QWidget *parent=0)
Definition: configuredialog.cpp:3738
ComposerPageTemplatesTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:2763
SecurityPageAdBlockTab::save
void save()
Definition: configuredialog.cpp:3655
QMenu
ConfigureDialog::slotApply
void slotApply()
Saves the GlobalSettings stuff before passing on to KCMultiDialog.
Definition: configuredialog.cpp:258
GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:30
ComposerPage::GeneralTab
ComposerPageGeneralTab GeneralTab
Definition: configuredialog_p.h:741
kmkernel.h
ConfigureAgentsWidget
Definition: configureagentswidget.h:28
KLineEdit
AppearancePageMessageTagTab::AppearancePageMessageTagTab
AppearancePageMessageTagTab(QWidget *parent=0)
Definition: configuredialog.cpp:1686
SecurityPageComposerCryptoTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3733
disableDirmngrWidget
static void disableDirmngrWidget(QWidget *w)
Definition: configuredialog.cpp:4027
ConfigModuleTab::mEmitChanges
bool mEmitChanges
Definition: configuredialog_p.h:115
SecurityPageWarningTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3798
SecurityPage::ComposerCryptoTab
SecurityPageComposerCryptoTab ComposerCryptoTab
Definition: configuredialog_p.h:907
MiscPageInviteTab::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configuredialog.cpp:4420
ComposerPageHeadersTab::save
void save()
Definition: configuredialog.cpp:3273
MiscPage::MiscPage
MiscPage(const KComponentData &instance, QWidget *parent=0)
Definition: configuredialog.cpp:4266
MiscPageAgentSettingsTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:4395
SecurityPageComposerCryptoTab::save
void save()
Definition: configuredialog.cpp:3772
MiscPageAgentSettingsTab::save
void save()
Definition: configuredialog.cpp:4385
AccountsPageSendingTab::save
void save()
Definition: configuredialog.cpp:416
ComposerPageAutoCorrectionTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:3458
SecurityPageAdBlockTab::~SecurityPageAdBlockTab
~SecurityPageAdBlockTab()
Definition: configuredialog.cpp:3651
ConfigureDialog::~ConfigureDialog
~ConfigureDialog()
Definition: configuredialog.cpp:254
ComposerPageCustomTemplatesTab::save
void save()
Definition: configuredialog.cpp:2823
configagentdelegate.h
QLabel
AccountsPageSendingTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:304
KComboBox
ComposerPage::ComposerPage
ComposerPage(const KComponentData &instance, QWidget *parent=0)
Definition: configuredialog.cpp:2133
ComposerPage::HeadersTab
ComposerPageHeadersTab HeadersTab
Definition: configuredialog_p.h:746
initializeDirmngrCheckbox
static void initializeDirmngrCheckbox(QCheckBox *cb, Kleo::CryptoConfigEntry *entry)
Definition: configuredialog.cpp:4033
KMail::Util::quoteL2Color
QColor quoteL2Color()
Definition: util.cpp:216
ComposerPageAttachmentsTab::ComposerPageAttachmentsTab
ComposerPageAttachmentsTab(QWidget *parent=0)
Definition: configuredialog.cpp:3327
MiscPagePrintingTab
Definition: configuredialog_p.h:987
KHBox
numColorNames
static const int numColorNames
Definition: configuredialog.cpp:987
ComposerPageExternalEditorTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:2697
AppearancePageFontsTab::save
void save()
Definition: configuredialog.cpp:917
MiscPage::ProxyTab
MiscPageProxyTab ProxyTab
Definition: configuredialog_p.h:1010
KCMultiDialog
ConfigModuleWithTabs
Definition: configuredialog_p.h:133
SecurityPageSMimeTab::~SecurityPageSMimeTab
~SecurityPageSMimeTab()
Definition: configuredialog.cpp:4022
configName
const char * configName
Definition: configuredialog.cpp:774
AppearancePageFontsTab::AppearancePageFontsTab
AppearancePageFontsTab(QWidget *parent=0)
Definition: configuredialog.cpp:794
AppearancePageMessageTagTab::slotMoveTagDown
void slotMoveTagDown()
Decreases the currently selected tag's priority and handles related visual changes.
Definition: configuredialog.cpp:1856
ColorListBox
Definition: colorlistbox.h:33
AccountsPage::ReceivingTab
AccountsPageReceivingTab ReceivingTab
Definition: configuredialog_p.h:239
AppearancePageSystemTrayTab::AppearancePageSystemTrayTab
AppearancePageSystemTrayTab(QWidget *parent=0)
Definition: configuredialog.cpp:1599
ComposerPageAutoCorrectionTab::ComposerPageAutoCorrectionTab
ComposerPageAutoCorrectionTab(QWidget *parent=0)
Definition: configuredialog.cpp:3443
ComposerPageExternalEditorTab::save
void save()
Definition: configuredialog.cpp:2757
SecurityPage::SecurityPage
SecurityPage(const KComponentData &instance, QWidget *parent=0)
Definition: configuredialog.cpp:3523
ComposerPageCustomTemplatesTab::ComposerPageCustomTemplatesTab
ComposerPageCustomTemplatesTab(QWidget *parent=0)
Definition: configuredialog.cpp:2802
AppearancePage::SystemTrayTab
AppearancePageSystemTrayTab SystemTrayTab
Definition: configuredialog_p.h:500
AccountsPageReceivingTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:425
ColorListBox::addColor
void addColor(const QString &text, const QColor &color=Qt::black)
Definition: colorlistbox.cpp:45
AccountsPage::SendingTab
AccountsPageSendingTab SendingTab
Definition: configuredialog_p.h:238
AppearancePageFontsTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:768
KPIM::RecentAddresses
ConfigureDialog::hideEvent
void hideEvent(QHideEvent *i)
Definition: configuredialog.cpp:247
ComposerPageCharsetTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:2945
AppearancePageMessageTagTab::save
void save()
Definition: configuredialog.cpp:2085
AppearancePageLayoutTab::save
void save()
Definition: configuredialog.cpp:1244
ComposerPage::TemplatesTab
ComposerPageTemplatesTab TemplatesTab
Definition: configuredialog_p.h:742
AppearancePageMessageTagTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:1655
SecurityPage::MDNTab
SecurityPageMDNTab MDNTab
Definition: configuredialog_p.h:906
AppearancePageReaderTab::helpAnchor
QString helpAnchor() const
Definition: configuredialog.cpp:1548
ComposerPageGeneralTab::slotConfigureCompletionOrder
void slotConfigureCompletionOrder()
Definition: configuredialog.cpp:2690
onlyFixed
bool onlyFixed
Definition: configuredialog.cpp:777
AppearancePageSystemTrayTab::save
void save()
Definition: configuredialog.cpp:1647
KMail::AccountConfigOrderDialog
Definition: accountconfigorderdialog.h:28
SecurityPageSMimeTab::save
void save()
Definition: configuredialog.cpp:4186
QList
SecurityPage::helpAnchor
QString helpAnchor() const
Should return the help anchor for this page or tab.
Definition: configuredialog.cpp:3518
enableFamilyAndSize
bool enableFamilyAndSize
Definition: configuredialog.cpp:776
SecurityPageComposerCryptoTab::~SecurityPageComposerCryptoTab
~SecurityPageComposerCryptoTab()
Definition: configuredialog.cpp:3751
recentaddresses.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal