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

kmail

  • sources
  • kde-4.14
  • kdepim
  • kmail
  • configuredialog
configureappearancepage.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "configureappearancepage.h"
19 #include "pimcommon/widgets/configureimmutablewidgetutils.h"
20 using namespace PimCommon::ConfigureImmutableWidgetUtils;
21 #include "configuredialog/colorlistbox.h"
22 #include "messagelist/utils/aggregationcombobox.h"
23 #include "messagelist/utils/aggregationconfigbutton.h"
24 #include "messagelist/utils/themecombobox.h"
25 #include "messagelist/utils/themeconfigbutton.h"
26 #include "mailcommon/tag/tagwidget.h"
27 #include "mailcommon/tag/tag.h"
28 #include "kmkernel.h"
29 #include "util.h"
30 #include "foldertreewidget.h"
31 
32 #include "kmmainwidget.h"
33 
34 #include "foldertreewidget.h"
35 
36 #include "mailcommon/mailcommonsettings_base.h"
37 
38 #include "messageviewer/widgets/configurewidget.h"
39 #include "messageviewer/settings/globalsettings.h"
40 
41 #include "messagelist/core/settings.h"
42 #include "messagelist/messagelistutil.h"
43 #include "messagecore/settings/globalsettings.h"
44 #include "settings/globalsettings.h"
45 
46 #include "mailcommon/util/mailutil.h"
47 
48 #include <Akonadi/Tag>
49 #include <Akonadi/TagFetchJob>
50 #include <Akonadi/TagFetchScope>
51 #include <Akonadi/TagDeleteJob>
52 #include <Akonadi/TagCreateJob>
53 #include <Akonadi/TagAttribute>
54 #include <Akonadi/TagModifyJob>
55 
56 #include <KIconButton>
57 #include <KButtonGroup>
58 #include <KLocalizedString>
59 #include <KColorScheme>
60 #include <KSeparator>
61 #include <KFontChooser>
62 #include <KHBox>
63 #include <KMessageBox>
64 #include <KKeySequenceWidget>
65 #include <KLineEdit>
66 #include <KDialog>
67 
68 #include <kmime/kmime_dateformatter.h>
69 using KMime::DateFormatter;
70 
71 #include <QWhatsThis>
72 #include <QButtonGroup>
73 #include <QSpinBox>
74 #include <QLabel>
75 
76 #include <widgets/gravatarconfigwidget.h>
77 using namespace MailCommon;
78 
79 QString AppearancePage::helpAnchor() const
80 {
81  return QString::fromLatin1("configure-appearance");
82 }
83 
84 AppearancePage::AppearancePage( const KComponentData &instance, QWidget *parent )
85  : ConfigModuleWithTabs( instance, parent )
86 {
87  //
88  // "Fonts" tab:
89  //
90  mFontsTab = new FontsTab();
91  addTab( mFontsTab, i18n("Fonts") );
92 
93  //
94  // "Colors" tab:
95  //
96  mColorsTab = new ColorsTab();
97  addTab( mColorsTab, i18n("Colors") );
98 
99  //
100  // "Layout" tab:
101  //
102  mLayoutTab = new LayoutTab();
103  addTab( mLayoutTab, i18n("Layout") );
104 
105  //
106  // "Headers" tab:
107  //
108  mHeadersTab = new HeadersTab();
109  addTab( mHeadersTab, i18n("Message List") );
110 
111  //
112  // "Reader window" tab:
113  //
114  mReaderTab = new ReaderTab();
115  addTab( mReaderTab, i18n("Message Window") );
116  addConfig( MessageViewer::GlobalSettings::self(), mReaderTab );
117 
118  //
119  // "System Tray" tab:
120  //
121  mSystemTrayTab = new SystemTrayTab();
122  addTab( mSystemTrayTab, i18n("System Tray") );
123 
124  //
125  // "Message Tag" tab:
126  //
127  mMessageTagTab = new MessageTagTab();
128  addTab( mMessageTagTab, i18n("Message Tags") );
129 }
130 
131 
132 QString AppearancePage::FontsTab::helpAnchor() const
133 {
134  return QString::fromLatin1("configure-appearance-fonts");
135 }
136 
137 static const struct {
138  const char * configName;
139  const char * displayName;
140  bool enableFamilyAndSize;
141  bool onlyFixed;
142 } fontNames[] = {
143  { "body-font", I18N_NOOP("Message Body"), true, false },
144  { "MessageListFont", I18N_NOOP("Message List"), true, false },
145  { "UnreadMessageFont", I18N_NOOP("Message List - Unread Messages"), true, false },
146  { "ImportantMessageFont", I18N_NOOP("Message List - Important Messages"), true, false },
147  { "TodoMessageFont", I18N_NOOP("Message List - Action Item Messages"), true, false },
148  { "folder-font", I18N_NOOP("Folder List"), true, false },
149  { "quote1-font", I18N_NOOP("Quoted Text - First Level"), false, false },
150  { "quote2-font", I18N_NOOP("Quoted Text - Second Level"), false, false },
151  { "quote3-font", I18N_NOOP("Quoted Text - Third Level"), false, false },
152  { "fixed-font", I18N_NOOP("Fixed Width Font"), true, true },
153  { "composer-font", I18N_NOOP("Composer"), true, false },
154  { "print-font", I18N_NOOP("Printing Output"), true, false },
155 };
156 static const int numFontNames = sizeof fontNames / sizeof *fontNames;
157 
158 AppearancePageFontsTab::AppearancePageFontsTab( QWidget * parent )
159  : ConfigModuleTab( parent ), mActiveFontIndex( -1 )
160 {
161  assert( numFontNames == sizeof mFont / sizeof *mFont );
162 
163  // "Use custom fonts" checkbox, followed by <hr>
164  QVBoxLayout *vlay = new QVBoxLayout( this );
165  vlay->setSpacing( KDialog::spacingHint() );
166  vlay->setMargin( KDialog::marginHint() );
167  mCustomFontCheck = new QCheckBox( i18n("&Use custom fonts"), this );
168  vlay->addWidget( mCustomFontCheck );
169  vlay->addWidget( new KSeparator( Qt::Horizontal, this ) );
170  connect ( mCustomFontCheck, SIGNAL(stateChanged(int)),
171  this, SLOT(slotEmitChanged()) );
172 
173  // "font location" combo box and label:
174  QHBoxLayout *hlay = new QHBoxLayout(); // inherites spacing
175  vlay->addLayout( hlay );
176  mFontLocationCombo = new KComboBox( this );
177  mFontLocationCombo->setEditable( false );
178  mFontLocationCombo->setEnabled( false ); // !mCustomFontCheck->isChecked()
179 
180  QStringList fontDescriptions;
181  for ( int i = 0 ; i < numFontNames ; ++i )
182  fontDescriptions << i18n( fontNames[i].displayName );
183  mFontLocationCombo->addItems( fontDescriptions );
184 
185  QLabel *label = new QLabel( i18n("Apply &to:"), this );
186  label->setBuddy( mFontLocationCombo );
187  label->setEnabled( false ); // since !mCustomFontCheck->isChecked()
188  hlay->addWidget( label );
189 
190  hlay->addWidget( mFontLocationCombo );
191  hlay->addStretch( 10 );
192  vlay->addSpacing( KDialog::spacingHint() );
193  mFontChooser = new KFontChooser( this, KFontChooser::DisplayFrame,
194  QStringList(), 4 );
195  mFontChooser->setEnabled( false ); // since !mCustomFontCheck->isChecked()
196  vlay->addWidget( mFontChooser );
197  connect ( mFontChooser, SIGNAL(fontSelected(QFont)),
198  this, SLOT(slotEmitChanged()) );
199 
200 
201  // {en,dis}able widgets depending on the state of mCustomFontCheck:
202  connect( mCustomFontCheck, SIGNAL(toggled(bool)),
203  label, SLOT(setEnabled(bool)) );
204  connect( mCustomFontCheck, SIGNAL(toggled(bool)),
205  mFontLocationCombo, SLOT(setEnabled(bool)) );
206  connect( mCustomFontCheck, SIGNAL(toggled(bool)),
207  mFontChooser, SLOT(setEnabled(bool)) );
208  // load the right font settings into mFontChooser:
209  connect( mFontLocationCombo, SIGNAL(activated(int)),
210  this, SLOT(slotFontSelectorChanged(int)) );
211 }
212 
213 
214 void AppearancePage::FontsTab::slotFontSelectorChanged( int index )
215 {
216  kDebug() << "slotFontSelectorChanged() called";
217  if( index < 0 || index >= mFontLocationCombo->count() )
218  return; // Should never happen, but it is better to check.
219 
220  // Save current fontselector setting before we install the new:
221  if( mActiveFontIndex == 0 ) {
222  mFont[0] = mFontChooser->font();
223  // hardcode the family and size of "message body" dependant fonts:
224  for ( int i = 0 ; i < numFontNames ; ++i )
225  if ( !fontNames[i].enableFamilyAndSize ) {
226  // ### shall we copy the font and set the save and re-set
227  // {regular,italic,bold,bold italic} property or should we
228  // copy only family and pointSize?
229  mFont[i].setFamily( mFont[0].family() );
230  mFont[i].setPointSize/*Float?*/( mFont[0].pointSize/*Float?*/() );
231  }
232  } else if ( mActiveFontIndex > 0 )
233  mFont[ mActiveFontIndex ] = mFontChooser->font();
234  mActiveFontIndex = index;
235 
236  // Disonnect so the "Apply" button is not activated by the change
237  disconnect ( mFontChooser, SIGNAL(fontSelected(QFont)),
238  this, SLOT(slotEmitChanged()) );
239 
240  // Display the new setting:
241  mFontChooser->setFont( mFont[index], fontNames[index].onlyFixed );
242 
243  connect ( mFontChooser, SIGNAL(fontSelected(QFont)),
244  this, SLOT(slotEmitChanged()) );
245 
246  // Disable Family and Size list if we have selected a quote font:
247  mFontChooser->enableColumn( KFontChooser::FamilyList|KFontChooser::SizeList,
248  fontNames[ index ].enableFamilyAndSize );
249 }
250 
251 void AppearancePage::FontsTab::doLoadOther()
252 {
253  if (KMKernel::self()) {
254  KConfigGroup fonts( KMKernel::self()->config(), "Fonts" );
255  KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" );
256 
257  mFont[0] = KGlobalSettings::generalFont();
258  QFont fixedFont = KGlobalSettings::fixedFont();
259 
260  for ( int i = 0 ; i < numFontNames ; ++i ) {
261  const QString configName = QLatin1String(fontNames[i].configName);
262  if ( configName == QLatin1String( "MessageListFont" ) ||
263  configName == QLatin1String( "UnreadMessageFont" ) ||
264  configName == QLatin1String( "ImportantMessageFont" ) ||
265  configName == QLatin1String( "TodoMessageFont" ) ) {
266  mFont[i] = messagelistFont.readEntry( configName,
267  (fontNames[i].onlyFixed) ? fixedFont : mFont[0] );
268  } else {
269  mFont[i] = fonts.readEntry( configName,
270  (fontNames[i].onlyFixed) ? fixedFont : mFont[0] );
271  }
272  }
273  mCustomFontCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultFonts() );
274  mFontLocationCombo->setCurrentIndex( 0 );
275  slotFontSelectorChanged( 0 );
276  } else {
277  setEnabled(false);
278  }
279 }
280 
281 void AppearancePage::FontsTab::save()
282 {
283  if (KMKernel::self()) {
284  KConfigGroup fonts( KMKernel::self()->config(), "Fonts" );
285  KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" );
286 
287  // read the current font (might have been modified)
288  if ( mActiveFontIndex >= 0 )
289  mFont[ mActiveFontIndex ] = mFontChooser->font();
290 
291  const bool customFonts = mCustomFontCheck->isChecked();
292  MessageCore::GlobalSettings::self()->setUseDefaultFonts( !customFonts );
293 
294  for ( int i = 0 ; i < numFontNames ; ++i ) {
295  const QString configName = QLatin1String(fontNames[i].configName);
296  if ( configName == QLatin1String( "MessageListFont" ) ||
297  configName == QLatin1String( "UnreadMessageFont" ) ||
298  configName == QLatin1String( "ImportantMessageFont" ) ||
299  configName == QLatin1String( "TodoMessageFont" ) ) {
300  if ( customFonts || messagelistFont.hasKey( configName ) ) {
301  // Don't write font info when we use default fonts, but write
302  // if it's already there:
303  messagelistFont.writeEntry( configName, mFont[i] );
304  }
305  } else {
306  if ( customFonts || fonts.hasKey( configName ) )
307  // Don't write font info when we use default fonts, but write
308  // if it's already there:
309  fonts.writeEntry( configName, mFont[i] );
310  }
311  }
312  }
313 }
314 
315 void AppearancePage::FontsTab::doResetToDefaultsOther()
316 {
317  mCustomFontCheck->setChecked( false );
318 }
319 
320 
321 QString AppearancePage::ColorsTab::helpAnchor() const
322 {
323  return QString::fromLatin1("configure-appearance-colors");
324 }
325 
326 static const struct {
327  const char * configName;
328  const char * displayName;
329 } colorNames[] = { // adjust doLoadOther if you change this:
330  { "QuotedText1", I18N_NOOP("Quoted Text - First Level") },
331  { "QuotedText2", I18N_NOOP("Quoted Text - Second Level") },
332  { "QuotedText3", I18N_NOOP("Quoted Text - Third Level") },
333  { "LinkColor", I18N_NOOP("Link") },
334  { "FollowedColor", I18N_NOOP("Followed Link") },
335  { "MisspelledColor", I18N_NOOP("Misspelled Words") },
336  { "UnreadMessageColor", I18N_NOOP("Unread Message") },
337  { "ImportantMessageColor", I18N_NOOP("Important Message") },
338  { "TodoMessageColor", I18N_NOOP("Action Item Message") },
339  { "PGPMessageEncr", I18N_NOOP("OpenPGP Message - Encrypted") },
340  { "PGPMessageOkKeyOk", I18N_NOOP("OpenPGP Message - Valid Signature with Trusted Key") },
341  { "PGPMessageOkKeyBad", I18N_NOOP("OpenPGP Message - Valid Signature with Untrusted Key") },
342  { "PGPMessageWarn", I18N_NOOP("OpenPGP Message - Unchecked Signature") },
343  { "PGPMessageErr", I18N_NOOP("OpenPGP Message - Bad Signature") },
344  { "HTMLWarningColor", I18N_NOOP("Border Around Warning Prepending HTML Messages") },
345  { "CloseToQuotaColor", I18N_NOOP("Folder Name and Size When Close to Quota") },
346  { "ColorbarBackgroundPlain", I18N_NOOP("HTML Status Bar Background - No HTML Message") },
347  { "ColorbarForegroundPlain", I18N_NOOP("HTML Status Bar Foreground - No HTML Message") },
348  { "ColorbarBackgroundHTML", I18N_NOOP("HTML Status Bar Background - HTML Message") },
349  { "ColorbarForegroundHTML", I18N_NOOP("HTML Status Bar Foreground - HTML Message") },
350  { "BrokenAccountColor", I18N_NOOP("Broken Account - Folder Text Color") },
351  { "BackgroundColor", I18N_NOOP("Background Color") },
352  };
353 static const int numColorNames = sizeof colorNames / sizeof *colorNames;
354 
355 AppearancePageColorsTab::AppearancePageColorsTab( QWidget * parent )
356  : ConfigModuleTab( parent )
357 {
358  // "use custom colors" check box
359  QVBoxLayout *vlay = new QVBoxLayout( this );
360  vlay->setSpacing( KDialog::spacingHint() );
361  vlay->setMargin( KDialog::marginHint() );
362  mCustomColorCheck = new QCheckBox( i18n("&Use custom colors"), this );
363  vlay->addWidget( mCustomColorCheck );
364  connect( mCustomColorCheck, SIGNAL(stateChanged(int)),
365  this, SLOT(slotEmitChanged()) );
366 
367  // color list box:
368  mColorList = new ColorListBox( this );
369  mColorList->setEnabled( false ); // since !mCustomColorCheck->isChecked()
370  for ( int i = 0 ; i < numColorNames ; ++i )
371  mColorList->addColor( i18n(colorNames[i].displayName) );
372  vlay->addWidget( mColorList, 1 );
373 
374  // "recycle colors" check box:
375  mRecycleColorCheck =
376  new QCheckBox( i18n("Recycle colors on deep &quoting"), this );
377  mRecycleColorCheck->setEnabled( false );
378  vlay->addWidget( mRecycleColorCheck );
379  connect( mRecycleColorCheck, SIGNAL(stateChanged(int)),
380  this, SLOT(slotEmitChanged()) );
381 
382  // close to quota threshold
383  QHBoxLayout *hbox = new QHBoxLayout();
384  vlay->addLayout( hbox );
385  QLabel *l = new QLabel( i18n("Close to quota threshold:"), this );
386  hbox->addWidget( l );
387  mCloseToQuotaThreshold = new QSpinBox( this );
388  mCloseToQuotaThreshold->setRange( 0, 100 );
389  mCloseToQuotaThreshold->setSingleStep( 1 );
390  connect( mCloseToQuotaThreshold, SIGNAL(valueChanged(int)),
391  this, SLOT(slotEmitChanged()) );
392  mCloseToQuotaThreshold->setSuffix( i18n("%"));
393 
394  hbox->addWidget( mCloseToQuotaThreshold );
395  hbox->addWidget( new QWidget(this), 2 );
396 
397  // {en,dir}able widgets depending on the state of mCustomColorCheck:
398  connect( mCustomColorCheck, SIGNAL(toggled(bool)),
399  mColorList, SLOT(setEnabled(bool)) );
400  connect( mCustomColorCheck, SIGNAL(toggled(bool)),
401  mRecycleColorCheck, SLOT(setEnabled(bool)) );
402  connect( mCustomColorCheck, SIGNAL(stateChanged(int)),
403  this, SLOT(slotEmitChanged()) );
404  connect( mColorList, SIGNAL(changed()),
405  this, SLOT(slotEmitChanged()) );
406 }
407 
408 void AppearancePage::ColorsTab::doLoadOther()
409 {
410  mCustomColorCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultColors() );
411  mRecycleColorCheck->setChecked( MessageViewer::GlobalSettings::self()->recycleQuoteColors() );
412  mCloseToQuotaThreshold->setValue( GlobalSettings::self()->closeToQuotaThreshold() );
413  loadColor( true );
414 }
415 
416 void AppearancePage::ColorsTab::loadColor( bool loadFromConfig )
417 {
418  if (KMKernel::self()) {
419  KColorScheme scheme( QPalette::Active, KColorScheme::View );
420 
421  KConfigGroup reader( KMKernel::self()->config(), "Reader" );
422 
423  KConfigGroup messageListView( KMKernel::self()->config(), "MessageListView::Colors" );
424 
425  KConfigGroup collectionFolderView( KMKernel::self()->config(), "CollectionFolderView" );
426 
427  static const QColor defaultColor[ numColorNames ] = {
428  KMail::Util::quoteL1Color(),
429  KMail::Util::quoteL2Color(),
430  KMail::Util::quoteL3Color(),
431  scheme.foreground( KColorScheme::LinkText ).color(), // link
432  scheme.foreground( KColorScheme::VisitedText ).color(),// visited link
433  scheme.foreground( KColorScheme::NegativeText ).color(), // misspelled words
434  MessageList::Util::unreadDefaultMessageColor(), // unread mgs
435  MessageList::Util::importantDefaultMessageColor(), // important msg
436  MessageList::Util::todoDefaultMessageColor(), // action item mgs
437  QColor( 0x00, 0x80, 0xFF ), // pgp encrypted
438  scheme.background( KColorScheme::PositiveBackground ).color(), // pgp ok, trusted key
439  QColor( 0xFF, 0xFF, 0x40 ), // pgp ok, untrusted key
440  QColor( 0xFF, 0xFF, 0x40 ), // pgp unchk
441  Qt::red, // pgp bad
442  QColor( 0xFF, 0x40, 0x40 ), // warning text color
443  MailCommon::Util::defaultQuotaColor(), // close to quota
444  Qt::lightGray, // colorbar plain bg
445  Qt::black, // colorbar plain fg
446  Qt::black, // colorbar html bg
447  Qt::white, // colorbar html fg
448  scheme.foreground(KColorScheme::NegativeText).color(), //Broken Account Color
449  scheme.background().color() // reader background color
450  };
451 
452  for ( int i = 0 ; i < numColorNames ; ++i ) {
453  if ( loadFromConfig ) {
454  const QString configName = QLatin1String(colorNames[i].configName);
455  if ( configName == QLatin1String( "UnreadMessageColor" ) ||
456  configName == QLatin1String( "ImportantMessageColor" ) ||
457  configName == QLatin1String( "TodoMessageColor" ) ) {
458  mColorList->setColorSilently( i, messageListView.readEntry( configName, defaultColor[i] ) );
459  } else if( configName == QLatin1String("BrokenAccountColor")) {
460  mColorList->setColorSilently( i, collectionFolderView.readEntry(configName,defaultColor[i]));
461  } else {
462  mColorList->setColorSilently( i, reader.readEntry( configName, defaultColor[i] ) );
463  }
464  } else {
465  mColorList->setColorSilently( i, defaultColor[i] );
466  }
467  }
468  } else {
469  setEnabled(false);
470  }
471 }
472 
473 void AppearancePage::ColorsTab::doResetToDefaultsOther()
474 {
475  mCustomColorCheck->setChecked( false );
476  mRecycleColorCheck->setChecked( false );
477  mCloseToQuotaThreshold->setValue( 80 );
478  loadColor( false );
479 }
480 
481 void AppearancePage::ColorsTab::save()
482 {
483  if (!KMKernel::self())
484  return;
485  KConfigGroup reader( KMKernel::self()->config(), "Reader" );
486  KConfigGroup messageListView( KMKernel::self()->config(), "MessageListView::Colors" );
487  KConfigGroup collectionFolderView( KMKernel::self()->config(), "CollectionFolderView" );
488  bool customColors = mCustomColorCheck->isChecked();
489  MessageCore::GlobalSettings::self()->setUseDefaultColors( !customColors );
490 
491  KColorScheme scheme( QPalette::Active, KColorScheme::View );
492 
493  for ( int i = 0 ; i < numColorNames ; ++i ) {
494  // Don't write color info when we use default colors, but write
495  // if it's already there:
496  const QString configName = QLatin1String(colorNames[i].configName);
497  if ( configName == QLatin1String( "UnreadMessageColor" ) ||
498  configName == QLatin1String( "ImportantMessageColor" ) ||
499  configName == QLatin1String( "TodoMessageColor" ) ) {
500  if ( customColors || messageListView.hasKey( configName ) )
501  messageListView.writeEntry( configName, mColorList->color(i) );
502 
503  } else if( configName == QLatin1String("BrokenAccountColor")) {
504  if ( customColors || collectionFolderView.hasKey( configName ) )
505  collectionFolderView.writeEntry(configName,mColorList->color(i));
506  } else if (configName == QLatin1String("BackgroundColor")) {
507  if (customColors && (mColorList->color(i) != scheme.background().color() ))
508  reader.writeEntry(configName, mColorList->color(i));
509  } else {
510  if ( customColors || reader.hasKey( configName ) )
511  reader.writeEntry( configName, mColorList->color(i) );
512  }
513  }
514  MessageViewer::GlobalSettings::self()->setRecycleQuoteColors( mRecycleColorCheck->isChecked() );
515  GlobalSettings::self()->setCloseToQuotaThreshold( mCloseToQuotaThreshold->value() );
516 }
517 
518 QString AppearancePage::LayoutTab::helpAnchor() const
519 {
520  return QString::fromLatin1("configure-appearance-layout");
521 }
522 
523 AppearancePageLayoutTab::AppearancePageLayoutTab( QWidget * parent )
524  : ConfigModuleTab( parent )
525 {
526  QVBoxLayout *vlay = new QVBoxLayout( this );
527  vlay->setSpacing( KDialog::spacingHint() );
528  vlay->setMargin( KDialog::marginHint() );
529 
530  // "folder list" radio buttons:
531  populateButtonGroup( mFolderListGroupBox = new QGroupBox( this ),
532  mFolderListGroup = new QButtonGroup( this ),
533  Qt::Vertical, GlobalSettings::self()->folderListItem() );
534  vlay->addWidget( mFolderListGroupBox );
535  connect( mFolderListGroup, SIGNAL (buttonClicked(int)),
536  this, SLOT(slotEmitChanged()) );
537 
538  QHBoxLayout* folderCBHLayout = new QHBoxLayout();
539  mFolderQuickSearchCB = new QCheckBox( i18n("Show folder quick search field"), this );
540  connect( mFolderQuickSearchCB, SIGNAL(toggled(bool)), SLOT(slotEmitChanged()) );
541  folderCBHLayout->addWidget( mFolderQuickSearchCB );
542  vlay->addLayout( folderCBHLayout );
543  vlay->addSpacing( KDialog::spacingHint() ); // space before next box
544 
545  // "favorite folders view mode" radio buttons:
546  mFavoriteFoldersViewGroupBox = new QGroupBox( this );
547  mFavoriteFoldersViewGroupBox->setTitle( i18n( "Show Favorite Folders View" ) );
548  mFavoriteFoldersViewGroupBox->setLayout( new QVBoxLayout() );
549  mFavoriteFoldersViewGroupBox->layout()->setSpacing( KDialog::spacingHint() );
550  mFavoriteFoldersViewGroup = new QButtonGroup( this );
551  connect( mFavoriteFoldersViewGroup, SIGNAL(buttonClicked(int)),
552  this, SLOT(slotEmitChanged()) );
553 
554  QRadioButton* favoriteFoldersViewHiddenRadio = new QRadioButton( i18n( "Never" ), mFavoriteFoldersViewGroupBox );
555  mFavoriteFoldersViewGroup->addButton( favoriteFoldersViewHiddenRadio, static_cast<int>( MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::HiddenMode ) );
556  mFavoriteFoldersViewGroupBox->layout()->addWidget( favoriteFoldersViewHiddenRadio );
557 
558  QRadioButton* favoriteFoldersViewIconsRadio = new QRadioButton( i18n( "As icons" ), mFavoriteFoldersViewGroupBox );
559  mFavoriteFoldersViewGroup->addButton( favoriteFoldersViewIconsRadio, static_cast<int>( MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::IconMode ) );
560  mFavoriteFoldersViewGroupBox->layout()->addWidget( favoriteFoldersViewIconsRadio );
561 
562  QRadioButton* favoriteFoldersViewListRadio = new QRadioButton( i18n( "As list" ), mFavoriteFoldersViewGroupBox );
563  mFavoriteFoldersViewGroup->addButton( favoriteFoldersViewListRadio, static_cast<int>( MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::ListMode ) );
564  mFavoriteFoldersViewGroupBox->layout()->addWidget( favoriteFoldersViewListRadio );
565 
566  vlay->addWidget( mFavoriteFoldersViewGroupBox );
567 
568 
569  // "folder tooltips" radio buttons:
570  mFolderToolTipsGroupBox = new QGroupBox( this );
571  mFolderToolTipsGroupBox->setTitle( i18n( "Folder Tooltips" ) );
572  mFolderToolTipsGroupBox->setLayout( new QVBoxLayout() );
573  mFolderToolTipsGroupBox->layout()->setSpacing( KDialog::spacingHint() );
574  mFolderToolTipsGroup = new QButtonGroup( this );
575  connect( mFolderToolTipsGroup, SIGNAL(buttonClicked(int)),
576  this, SLOT(slotEmitChanged()) );
577 
578  QRadioButton* folderToolTipsAlwaysRadio = new QRadioButton( i18n( "Always" ), mFolderToolTipsGroupBox );
579  mFolderToolTipsGroup->addButton( folderToolTipsAlwaysRadio, static_cast< int >( FolderTreeWidget::DisplayAlways ) );
580  mFolderToolTipsGroupBox->layout()->addWidget( folderToolTipsAlwaysRadio );
581 
582  QRadioButton* folderToolTipsNeverRadio = new QRadioButton( i18n( "Never" ), mFolderToolTipsGroupBox );
583  mFolderToolTipsGroup->addButton( folderToolTipsNeverRadio, static_cast< int >( FolderTreeWidget::DisplayNever ) );
584  mFolderToolTipsGroupBox->layout()->addWidget( folderToolTipsNeverRadio );
585 
586  vlay->addWidget( mFolderToolTipsGroupBox );
587 
588  // "show reader window" radio buttons:
589  populateButtonGroup( mReaderWindowModeGroupBox = new QGroupBox( this ),
590  mReaderWindowModeGroup = new QButtonGroup( this ),
591  Qt::Vertical, GlobalSettings::self()->readerWindowModeItem() );
592  vlay->addWidget( mReaderWindowModeGroupBox );
593  connect( mReaderWindowModeGroup, SIGNAL (buttonClicked(int)),
594  this, SLOT(slotEmitChanged()) );
595 
596  vlay->addStretch( 10 ); // spacer
597 }
598 
599 void AppearancePage::LayoutTab::doLoadOther()
600 {
601  loadWidget( mFolderListGroupBox, mFolderListGroup, GlobalSettings::self()->folderListItem() );
602  loadWidget( mReaderWindowModeGroupBox, mReaderWindowModeGroup, GlobalSettings::self()->readerWindowModeItem() );
603  loadWidget( mFavoriteFoldersViewGroupBox, mFavoriteFoldersViewGroup, MailCommon::MailCommonSettings::self()->favoriteCollectionViewModeItem() );
604  loadWidget( mFolderQuickSearchCB, GlobalSettings::self()->enableFolderQuickSearchItem() );
605  const int checkedFolderToolTipsPolicy = GlobalSettings::self()->toolTipDisplayPolicy();
606  if ( checkedFolderToolTipsPolicy >= 0 )
607  mFolderToolTipsGroup->button(checkedFolderToolTipsPolicy)->setChecked( true );
608 }
609 
610 void AppearancePage::LayoutTab::save()
611 {
612  saveButtonGroup( mFolderListGroup, GlobalSettings::self()->folderListItem() );
613  saveButtonGroup( mReaderWindowModeGroup, GlobalSettings::self()->readerWindowModeItem() );
614  saveButtonGroup( mFavoriteFoldersViewGroup, MailCommon::MailCommonSettings::self()->favoriteCollectionViewModeItem() );
615  saveCheckBox( mFolderQuickSearchCB, GlobalSettings::self()->enableFolderQuickSearchItem() );
616  GlobalSettings::self()->setToolTipDisplayPolicy( mFolderToolTipsGroup->checkedId() );
617 }
618 
619 //
620 // Appearance Message List
621 //
622 
623 QString AppearancePage::HeadersTab::helpAnchor() const
624 {
625  return QString::fromLatin1("configure-appearance-headers");
626 }
627 
628 static const struct {
629  const char * displayName;
630  DateFormatter::FormatType dateDisplay;
631 } dateDisplayConfig[] = {
632  { I18N_NOOP("Sta&ndard format (%1)"), KMime::DateFormatter::CTime },
633  { I18N_NOOP("Locali&zed format (%1)"), KMime::DateFormatter::Localized },
634  { I18N_NOOP("Smart for&mat (%1)"), KMime::DateFormatter::Fancy },
635  { I18N_NOOP("C&ustom format:"), KMime::DateFormatter::Custom }
636 };
637 static const int numDateDisplayConfig =
638  sizeof dateDisplayConfig / sizeof *dateDisplayConfig;
639 
640 AppearancePageHeadersTab::AppearancePageHeadersTab( QWidget * parent )
641  : ConfigModuleTab( parent ),
642  mCustomDateFormatEdit( 0 )
643 {
644  QVBoxLayout *vlay = new QVBoxLayout( this );
645  vlay->setSpacing( KDialog::spacingHint() );
646  vlay->setMargin( KDialog::marginHint() );
647 
648  // "General Options" group:
649  QGroupBox *group = new QGroupBox( i18nc( "General options for the message list.", "General" ), this );
650  // group->layout()->setSpacing( KDialog::spacingHint() );
651  QVBoxLayout *gvlay = new QVBoxLayout( group );
652  gvlay->setSpacing( KDialog::spacingHint() );
653 
654  mDisplayMessageToolTips = new QCheckBox(
655  MessageList::Core::Settings::self()->messageToolTipEnabledItem()->label(), group );
656  gvlay->addWidget( mDisplayMessageToolTips );
657 
658  connect( mDisplayMessageToolTips, SIGNAL(stateChanged(int)),
659  this, SLOT(slotEmitChanged()) );
660 
661  mHideTabBarWithSingleTab = new QCheckBox(
662  MessageList::Core::Settings::self()->autoHideTabBarWithSingleTabItem()->label(), group );
663  gvlay->addWidget( mHideTabBarWithSingleTab );
664 
665  connect( mHideTabBarWithSingleTab, SIGNAL(stateChanged(int)),
666  this, SLOT(slotEmitChanged()) );
667 
668  mTabsHaveCloseButton = new QCheckBox(
669  MessageList::Core::Settings::self()->tabsHaveCloseButtonItem()->label(), group );
670  gvlay->addWidget( mTabsHaveCloseButton );
671 
672  connect( mTabsHaveCloseButton, SIGNAL(stateChanged(int)),
673  this, SLOT(slotEmitChanged()) );
674 
675  // "Aggregation"
676  using MessageList::Utils::AggregationComboBox;
677  mAggregationComboBox = new AggregationComboBox( group );
678 
679  QLabel* aggregationLabel = new QLabel( i18n( "Default aggregation:" ), group );
680  aggregationLabel->setBuddy( mAggregationComboBox );
681 
682  using MessageList::Utils::AggregationConfigButton;
683  AggregationConfigButton * aggregationConfigButton = new AggregationConfigButton( group, mAggregationComboBox );
684 
685  QHBoxLayout * aggregationLayout = new QHBoxLayout();
686  aggregationLayout->addWidget( aggregationLabel, 1 );
687  aggregationLayout->addWidget( mAggregationComboBox, 1 );
688  aggregationLayout->addWidget( aggregationConfigButton, 0 );
689  gvlay->addLayout( aggregationLayout );
690 
691  connect( aggregationConfigButton, SIGNAL(configureDialogCompleted()),
692  this, SLOT(slotSelectDefaultAggregation()) );
693  connect( mAggregationComboBox, SIGNAL(activated(int)),
694  this, SLOT(slotEmitChanged()) );
695 
696  // "Theme"
697  using MessageList::Utils::ThemeComboBox;
698  mThemeComboBox = new ThemeComboBox( group );
699 
700  QLabel *themeLabel = new QLabel( i18n( "Default theme:" ), group );
701  themeLabel->setBuddy( mThemeComboBox );
702 
703  using MessageList::Utils::ThemeConfigButton;
704  ThemeConfigButton * themeConfigButton = new ThemeConfigButton( group, mThemeComboBox );
705 
706  QHBoxLayout * themeLayout = new QHBoxLayout();
707  themeLayout->addWidget( themeLabel, 1 );
708  themeLayout->addWidget( mThemeComboBox, 1 );
709  themeLayout->addWidget( themeConfigButton, 0 );
710  gvlay->addLayout( themeLayout );
711 
712  connect( themeConfigButton, SIGNAL(configureDialogCompleted()),
713  this, SLOT(slotSelectDefaultTheme()) );
714  connect( mThemeComboBox, SIGNAL(activated(int)),
715  this, SLOT(slotEmitChanged()) );
716 
717  vlay->addWidget( group );
718 
719  // "Date Display" group:
720  mDateDisplay = new KButtonGroup( this );
721  mDateDisplay->setTitle( i18n("Date Display") );
722  gvlay = new QVBoxLayout( mDateDisplay );
723  gvlay->setSpacing( KDialog::spacingHint() );
724 
725  for ( int i = 0 ; i < numDateDisplayConfig ; ++i ) {
726  const char *label = dateDisplayConfig[i].displayName;
727  QString buttonLabel;
728  if ( QString::fromLatin1(label).contains(QLatin1String("%1")) )
729  buttonLabel = i18n( label, DateFormatter::formatCurrentDate( dateDisplayConfig[i].dateDisplay) );
730  else
731  buttonLabel = i18n( label );
732  QRadioButton *radio = new QRadioButton( buttonLabel, mDateDisplay );
733  gvlay->addWidget( radio );
734 
735  if ( dateDisplayConfig[i].dateDisplay == DateFormatter::Custom ) {
736  KHBox *hbox = new KHBox( mDateDisplay );
737  hbox->setSpacing( KDialog::spacingHint() );
738 
739  mCustomDateFormatEdit = new KLineEdit( hbox );
740  mCustomDateFormatEdit->setEnabled( false );
741  hbox->setStretchFactor( mCustomDateFormatEdit, 1 );
742 
743  connect( radio, SIGNAL(toggled(bool)),
744  mCustomDateFormatEdit, SLOT(setEnabled(bool)) );
745  connect( mCustomDateFormatEdit, SIGNAL(textChanged(QString)),
746  this, SLOT(slotEmitChanged()) );
747 
748  QLabel *formatHelp = new QLabel(
749  i18n( "<qt><a href=\"whatsthis1\">Custom format information...</a></qt>"), hbox );
750  formatHelp->setContextMenuPolicy(Qt::NoContextMenu);
751  connect( formatHelp, SIGNAL(linkActivated(QString)),
752  SLOT(slotLinkClicked(QString)) );
753 
754  mCustomDateWhatsThis =
755  i18n("<qt><p><strong>These expressions may be used for the date:"
756  "</strong></p>"
757  "<ul>"
758  "<li>d - the day as a number without a leading zero (1-31)</li>"
759  "<li>dd - the day as a number with a leading zero (01-31)</li>"
760  "<li>ddd - the abbreviated day name (Mon - Sun)</li>"
761  "<li>dddd - the long day name (Monday - Sunday)</li>"
762  "<li>M - the month as a number without a leading zero (1-12)</li>"
763  "<li>MM - the month as a number with a leading zero (01-12)</li>"
764  "<li>MMM - the abbreviated month name (Jan - Dec)</li>"
765  "<li>MMMM - the long month name (January - December)</li>"
766  "<li>yy - the year as a two digit number (00-99)</li>"
767  "<li>yyyy - the year as a four digit number (0000-9999)</li>"
768  "</ul>"
769  "<p><strong>These expressions may be used for the time:"
770  "</strong></p> "
771  "<ul>"
772  "<li>h - the hour without a leading zero (0-23 or 1-12 if AM/PM display)</li>"
773  "<li>hh - the hour with a leading zero (00-23 or 01-12 if AM/PM display)</li>"
774  "<li>m - the minutes without a leading zero (0-59)</li>"
775  "<li>mm - the minutes with a leading zero (00-59)</li>"
776  "<li>s - the seconds without a leading zero (0-59)</li>"
777  "<li>ss - the seconds with a leading zero (00-59)</li>"
778  "<li>z - the milliseconds without leading zeroes (0-999)</li>"
779  "<li>zzz - the milliseconds with leading zeroes (000-999)</li>"
780  "<li>AP - switch to AM/PM display. AP will be replaced by either \"AM\" or \"PM\".</li>"
781  "<li>ap - switch to AM/PM display. ap will be replaced by either \"am\" or \"pm\".</li>"
782  "<li>Z - time zone in numeric form (-0500)</li>"
783  "</ul>"
784  "<p><strong>All other input characters will be ignored."
785  "</strong></p></qt>");
786  mCustomDateFormatEdit->setWhatsThis( mCustomDateWhatsThis );
787  radio->setWhatsThis( mCustomDateWhatsThis );
788  gvlay->addWidget( hbox );
789  } } // end for loop populating mDateDisplay
790 
791  vlay->addWidget( mDateDisplay );
792  connect( mDateDisplay, SIGNAL(clicked(int)),
793  this, SLOT(slotEmitChanged()) );
794 
795 
796  vlay->addStretch( 10 ); // spacer
797 }
798 
799 void AppearancePageHeadersTab::slotLinkClicked( const QString & link )
800 {
801  if ( link == QLatin1String( "whatsthis1" ) )
802  QWhatsThis::showText( QCursor::pos(), mCustomDateWhatsThis );
803 }
804 
805 void AppearancePage::HeadersTab::slotSelectDefaultAggregation()
806 {
807  // Select current default aggregation.
808  mAggregationComboBox->selectDefault();
809 }
810 
811 void AppearancePage::HeadersTab::slotSelectDefaultTheme()
812 {
813  // Select current default theme.
814  mThemeComboBox->selectDefault();
815 }
816 
817 void AppearancePage::HeadersTab::doLoadOther()
818 {
819  // "General Options":
820  loadWidget(mDisplayMessageToolTips, MessageList::Core::Settings::self()->messageToolTipEnabledItem());
821  loadWidget(mHideTabBarWithSingleTab, MessageList::Core::Settings::self()->autoHideTabBarWithSingleTabItem() );
822  loadWidget(mTabsHaveCloseButton, MessageList::Core::Settings::self()->tabsHaveCloseButtonItem() );
823 
824  // "Aggregation":
825  slotSelectDefaultAggregation();
826 
827  // "Theme":
828  slotSelectDefaultTheme();
829 
830  // "Date Display":
831  setDateDisplay( MessageCore::GlobalSettings::self()->dateFormat(),
832  MessageCore::GlobalSettings::self()->customDateFormat() );
833 }
834 
835 void AppearancePage::HeadersTab::doLoadFromGlobalSettings()
836 {
837  loadWidget(mDisplayMessageToolTips, MessageList::Core::Settings::self()->messageToolTipEnabledItem());
838  loadWidget(mHideTabBarWithSingleTab, MessageList::Core::Settings::self()->autoHideTabBarWithSingleTabItem() );
839  loadWidget(mTabsHaveCloseButton, MessageList::Core::Settings::self()->tabsHaveCloseButtonItem() );
840  // "Aggregation":
841  slotSelectDefaultAggregation();
842 
843  // "Theme":
844  slotSelectDefaultTheme();
845 
846  setDateDisplay( MessageCore::GlobalSettings::self()->dateFormat(),
847  MessageCore::GlobalSettings::self()->customDateFormat() );
848 }
849 
850 
851 void AppearancePage::HeadersTab::setDateDisplay( int num, const QString & format )
852 {
853  DateFormatter::FormatType dateDisplay =
854  static_cast<DateFormatter::FormatType>( num );
855 
856  // special case: needs text for the line edit:
857  if ( dateDisplay == DateFormatter::Custom )
858  mCustomDateFormatEdit->setText( format );
859 
860  for ( int i = 0 ; i < numDateDisplayConfig ; ++i )
861  if ( dateDisplay == dateDisplayConfig[i].dateDisplay ) {
862  mDateDisplay->setSelected( i );
863  return;
864  }
865  // fell through since none found:
866  mDateDisplay->setSelected( numDateDisplayConfig - 2 ); // default
867 }
868 
869 void AppearancePage::HeadersTab::save()
870 {
871  saveCheckBox(mDisplayMessageToolTips, MessageList::Core::Settings::self()->messageToolTipEnabledItem());
872  saveCheckBox(mHideTabBarWithSingleTab, MessageList::Core::Settings::self()->autoHideTabBarWithSingleTabItem() );
873  saveCheckBox(mTabsHaveCloseButton, MessageList::Core::Settings::self()->tabsHaveCloseButtonItem() );
874 
875  KMKernel::self()->savePaneSelection();
876  // "Aggregation"
877  mAggregationComboBox->writeDefaultConfig();
878 
879  // "Theme"
880  mThemeComboBox->writeDefaultConfig();
881 
882  const int dateDisplayID = mDateDisplay->selected();
883  // check bounds:
884  if ( ( dateDisplayID >= 0 ) && ( dateDisplayID < numDateDisplayConfig ) ) {
885  MessageCore::GlobalSettings::self()->setDateFormat(
886  static_cast<int>( dateDisplayConfig[ dateDisplayID ].dateDisplay ) );
887  }
888  MessageCore::GlobalSettings::self()->setCustomDateFormat( mCustomDateFormatEdit->text() );
889 }
890 
891 
892 //
893 // Message Window
894 //
895 
896 QString AppearancePage::ReaderTab::helpAnchor() const
897 {
898  return QString::fromLatin1("configure-appearance-reader");
899 }
900 
901 AppearancePageReaderTab::AppearancePageReaderTab( QWidget * parent )
902  : ConfigModuleTab( parent )
903 {
904  QVBoxLayout *topLayout = new QVBoxLayout(this);
905  topLayout->setSpacing( KDialog::spacingHint() );
906  topLayout->setMargin( KDialog::marginHint() );
907 
908  // "Close message window after replying or forwarding" check box:
909  populateCheckBox( mCloseAfterReplyOrForwardCheck = new QCheckBox( this ),
910  GlobalSettings::self()->closeAfterReplyOrForwardItem() );
911  mCloseAfterReplyOrForwardCheck->setToolTip(
912  i18n( "Close the standalone message window after replying or forwarding the message" ) );
913  topLayout->addWidget( mCloseAfterReplyOrForwardCheck );
914  connect( mCloseAfterReplyOrForwardCheck, SIGNAL (stateChanged(int)),
915  this, SLOT(slotEmitChanged()) );
916 
917  mViewerSettings = new MessageViewer::ConfigureWidget;
918  connect( mViewerSettings, SIGNAL(settingsChanged()),
919  this, SLOT(slotEmitChanged()) );
920  topLayout->addWidget( mViewerSettings );
921 
922  mGravatarConfigWidget = new MessageViewer::GravatarConfigWidget;
923  connect(mGravatarConfigWidget, SIGNAL(configChanged(bool)), this, SLOT(slotEmitChanged()));
924  topLayout->addWidget( mGravatarConfigWidget );
925  topLayout->addStretch( 100 ); // spacer
926 }
927 
928 void AppearancePage::ReaderTab::doResetToDefaultsOther()
929 {
930  mGravatarConfigWidget->doResetToDefaultsOther();
931 }
932 
933 void AppearancePage::ReaderTab::doLoadOther()
934 {
935  loadWidget( mCloseAfterReplyOrForwardCheck, GlobalSettings::self()->closeAfterReplyOrForwardItem() );
936  mViewerSettings->readConfig();
937  mGravatarConfigWidget->doLoadFromGlobalSettings();
938 }
939 
940 
941 void AppearancePage::ReaderTab::save()
942 {
943  saveCheckBox( mCloseAfterReplyOrForwardCheck, GlobalSettings::self()->closeAfterReplyOrForwardItem() );
944  mViewerSettings->writeConfig();
945  mGravatarConfigWidget->save();
946 }
947 
948 QString AppearancePage::SystemTrayTab::helpAnchor() const
949 {
950  return QString::fromLatin1("configure-appearance-systemtray");
951 }
952 
953 AppearancePageSystemTrayTab::AppearancePageSystemTrayTab( QWidget * parent )
954  : ConfigModuleTab( parent )
955 {
956  QVBoxLayout * vlay = new QVBoxLayout( this );
957  vlay->setSpacing( KDialog::spacingHint() );
958  vlay->setMargin( KDialog::marginHint() );
959 
960  // "Enable system tray applet" check box
961  mSystemTrayCheck = new QCheckBox( i18n("Enable system tray icon"), this );
962  vlay->addWidget( mSystemTrayCheck );
963  connect( mSystemTrayCheck, SIGNAL(stateChanged(int)),
964  this, SLOT(slotEmitChanged()) );
965 
966  mSystemTrayShowUnreadMail = new QCheckBox( i18n("Show unread mail in tray icon"), this );
967  vlay->addWidget( mSystemTrayShowUnreadMail );
968  mSystemTrayShowUnreadMail->setEnabled(false);
969  connect( mSystemTrayShowUnreadMail, SIGNAL(stateChanged(int)),
970  this, SLOT(slotEmitChanged()) );
971  connect( mSystemTrayCheck, SIGNAL(toggled(bool)),
972  mSystemTrayShowUnreadMail, SLOT(setEnabled(bool)) );
973 
974 
975  // System tray modes
976  mSystemTrayGroup = new KButtonGroup( this );
977  mSystemTrayGroup->setTitle( i18n("System Tray Mode" ) );
978  QVBoxLayout *gvlay = new QVBoxLayout( mSystemTrayGroup );
979  gvlay->setSpacing( KDialog::spacingHint() );
980 
981  connect( mSystemTrayGroup, SIGNAL(clicked(int)),
982  this, SLOT(slotEmitChanged()) );
983  connect( mSystemTrayCheck, SIGNAL(toggled(bool)),
984  mSystemTrayGroup, SLOT(setEnabled(bool)) );
985 
986  gvlay->addWidget( new QRadioButton( i18n("Always show KMail in system tray"), mSystemTrayGroup ) );
987  gvlay->addWidget( new QRadioButton( i18n("Only show KMail in system tray if there are unread messages"), mSystemTrayGroup ) );
988 
989  vlay->addWidget( mSystemTrayGroup );
990  vlay->addStretch( 10 ); // spacer
991 }
992 
993 void AppearancePage::SystemTrayTab::doLoadFromGlobalSettings()
994 {
995  loadWidget(mSystemTrayCheck, GlobalSettings::self()->systemTrayEnabledItem() );
996  loadWidget(mSystemTrayShowUnreadMail, GlobalSettings::self()->systemTrayShowUnreadItem() );
997  mSystemTrayGroup->setSelected( GlobalSettings::self()->systemTrayPolicy() );
998  mSystemTrayGroup->setEnabled( mSystemTrayCheck->isChecked() );
999 }
1000 
1001 void AppearancePage::SystemTrayTab::save()
1002 {
1003  saveCheckBox(mSystemTrayCheck, GlobalSettings::self()->systemTrayEnabledItem() );
1004  GlobalSettings::self()->setSystemTrayPolicy( mSystemTrayGroup->selected() );
1005  saveCheckBox(mSystemTrayShowUnreadMail,GlobalSettings::self()->systemTrayShowUnreadItem());
1006  GlobalSettings::self()->writeConfig();
1007 }
1008 
1009 QString AppearancePage::MessageTagTab::helpAnchor() const
1010 {
1011  return QString::fromLatin1("configure-appearance-messagetag");
1012 }
1013 
1014 
1015 TagListWidgetItem::TagListWidgetItem(QListWidget *parent)
1016  : QListWidgetItem(parent), mTag( 0 )
1017 {
1018 }
1019 
1020 TagListWidgetItem::TagListWidgetItem(const QIcon & icon, const QString & text, QListWidget * parent )
1021  : QListWidgetItem(icon, text, parent), mTag( 0 )
1022 {
1023 }
1024 
1025 TagListWidgetItem::~TagListWidgetItem()
1026 {
1027 }
1028 
1029 void TagListWidgetItem::setKMailTag( const MailCommon::Tag::Ptr& tag )
1030 {
1031  mTag = tag;
1032 }
1033 
1034 MailCommon::Tag::Ptr TagListWidgetItem::kmailTag() const
1035 {
1036  return mTag;
1037 }
1038 
1039 
1040 AppearancePageMessageTagTab::AppearancePageMessageTagTab( QWidget * parent )
1041  : ConfigModuleTab( parent )
1042 {
1043  mPreviousTag = -1;
1044  QHBoxLayout *maingrid = new QHBoxLayout( this );
1045  maingrid->setMargin( KDialog::marginHint() );
1046  maingrid->setSpacing( KDialog::spacingHint() );
1047 
1048 
1049  //Lefthand side Listbox and friends
1050 
1051  //Groupbox frame
1052  mTagsGroupBox = new QGroupBox( i18n("A&vailable Tags"), this );
1053  maingrid->addWidget( mTagsGroupBox );
1054  QVBoxLayout *tageditgrid = new QVBoxLayout( mTagsGroupBox );
1055  tageditgrid->setMargin( KDialog::marginHint() );
1056  tageditgrid->setSpacing( KDialog::spacingHint() );
1057  tageditgrid->addSpacing( 2 * KDialog::spacingHint() );
1058 
1059  //Listbox, add, remove row
1060  QHBoxLayout *addremovegrid = new QHBoxLayout();
1061  tageditgrid->addLayout( addremovegrid );
1062 
1063  mTagAddLineEdit = new KLineEdit( mTagsGroupBox );
1064  mTagAddLineEdit->setTrapReturnKey( true );
1065  addremovegrid->addWidget( mTagAddLineEdit );
1066 
1067  mTagAddButton = new KPushButton( mTagsGroupBox );
1068  mTagAddButton->setToolTip( i18n("Add new tag") );
1069  mTagAddButton->setIcon( KIcon( QLatin1String("list-add") ) );
1070  addremovegrid->addWidget( mTagAddButton );
1071 
1072  mTagRemoveButton = new KPushButton( mTagsGroupBox );
1073  mTagRemoveButton->setToolTip( i18n("Remove selected tag") );
1074  mTagRemoveButton->setIcon( KIcon( QLatin1String("list-remove") ) );
1075  addremovegrid->addWidget( mTagRemoveButton );
1076 
1077  //Up and down buttons
1078  QHBoxLayout *updowngrid = new QHBoxLayout();
1079  tageditgrid->addLayout( updowngrid );
1080 
1081  mTagUpButton = new KPushButton( mTagsGroupBox );
1082  mTagUpButton->setToolTip( i18n("Increase tag priority") );
1083  mTagUpButton->setIcon( KIcon( QLatin1String("arrow-up") ) );
1084  mTagUpButton->setAutoRepeat( true );
1085  updowngrid->addWidget( mTagUpButton );
1086 
1087  mTagDownButton = new KPushButton( mTagsGroupBox );
1088  mTagDownButton->setToolTip( i18n("Decrease tag priority") );
1089  mTagDownButton->setIcon( KIcon( QLatin1String("arrow-down") ) );
1090  mTagDownButton->setAutoRepeat( true );
1091  updowngrid->addWidget( mTagDownButton );
1092 
1093  //Listbox for tag names
1094  QHBoxLayout *listboxgrid = new QHBoxLayout();
1095  tageditgrid->addLayout( listboxgrid );
1096  mTagListBox = new QListWidget( mTagsGroupBox );
1097  mTagListBox->setDragDropMode(QAbstractItemView::InternalMove);
1098  connect( mTagListBox->model(),SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),SLOT(slotRowsMoved(QModelIndex,int,int,QModelIndex,int)) );
1099 
1100  mTagListBox->setMinimumWidth( 150 );
1101  listboxgrid->addWidget( mTagListBox );
1102 
1103  //RHS for individual tag settings
1104 
1105  //Extra VBoxLayout for stretchers around settings
1106  QVBoxLayout *tagsettinggrid = new QVBoxLayout();
1107  maingrid->addLayout( tagsettinggrid );
1108  //tagsettinggrid->addStretch( 10 );
1109 
1110  //Groupbox frame
1111  mTagSettingGroupBox = new QGroupBox( i18n("Ta&g Settings"),
1112  this );
1113  tagsettinggrid->addWidget( mTagSettingGroupBox );
1114  QList<KActionCollection *> actionCollections;
1115  if( kmkernel->getKMMainWidget() )
1116  actionCollections = kmkernel->getKMMainWidget()->actionCollections();
1117 
1118  QHBoxLayout *lay = new QHBoxLayout(mTagSettingGroupBox);
1119  mTagWidget = new MailCommon::TagWidget(actionCollections,this);
1120  lay->addWidget(mTagWidget);
1121 
1122  connect(mTagWidget,SIGNAL(changed()),this, SLOT(slotEmitChangeCheck()));
1123 
1124  //For enabling the add button in case box is non-empty
1125  connect( mTagAddLineEdit, SIGNAL(textChanged(QString)),
1126  this, SLOT(slotAddLineTextChanged(QString)) );
1127 
1128  //For on-the-fly updating of tag name in editbox
1129  connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1130  this, SLOT(slotNameLineTextChanged(QString)) );
1131 
1132  connect( mTagWidget, SIGNAL(iconNameChanged(QString)), SLOT(slotIconNameChanged(QString)) );
1133 
1134  connect( mTagAddLineEdit, SIGNAL(returnPressed()),
1135  this, SLOT(slotAddNewTag()) );
1136 
1137 
1138  connect( mTagAddButton, SIGNAL(clicked()),
1139  this, SLOT(slotAddNewTag()) );
1140 
1141  connect( mTagRemoveButton, SIGNAL(clicked()),
1142  this, SLOT(slotRemoveTag()) );
1143 
1144  connect( mTagUpButton, SIGNAL(clicked()),
1145  this, SLOT(slotMoveTagUp()) );
1146 
1147  connect( mTagDownButton, SIGNAL(clicked()),
1148  this, SLOT(slotMoveTagDown()) );
1149 
1150  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1151  this, SLOT(slotSelectionChanged()) );
1152  //Adjust widths for columns
1153  maingrid->setStretchFactor( mTagsGroupBox, 1 );
1154  maingrid->setStretchFactor( lay, 1 );
1155  tagsettinggrid->addStretch( 10 );
1156 }
1157 
1158 AppearancePageMessageTagTab::~AppearancePageMessageTagTab()
1159 {
1160 }
1161 
1162 void AppearancePage::MessageTagTab::slotEmitChangeCheck()
1163 {
1164  slotEmitChanged();
1165 }
1166 
1167 void AppearancePage::MessageTagTab::slotRowsMoved( const QModelIndex &,
1168  int sourcestart, int sourceEnd,
1169  const QModelIndex &, int destinationRow )
1170 {
1171  Q_UNUSED( sourceEnd );
1172  Q_UNUSED( sourcestart );
1173  Q_UNUSED( destinationRow );
1174  updateButtons();
1175  slotEmitChangeCheck();
1176 }
1177 
1178 
1179 void AppearancePage::MessageTagTab::updateButtons()
1180 {
1181  const int currentIndex = mTagListBox->currentRow();
1182 
1183  const bool theFirst = ( currentIndex == 0 );
1184  const bool theLast = ( currentIndex >= (int)mTagListBox->count() - 1 );
1185  const bool aFilterIsSelected = ( currentIndex >= 0 );
1186 
1187  mTagUpButton->setEnabled( aFilterIsSelected && !theFirst );
1188  mTagDownButton->setEnabled( aFilterIsSelected && !theLast );
1189 }
1190 
1191 void AppearancePage::MessageTagTab::slotMoveTagUp()
1192 {
1193  const int tmp_index = mTagListBox->currentRow();
1194  if ( tmp_index <= 0 )
1195  return;
1196  swapTagsInListBox( tmp_index, tmp_index - 1 );
1197  updateButtons();
1198 }
1199 
1200 void AppearancePage::MessageTagTab::slotMoveTagDown()
1201 {
1202  const int tmp_index = mTagListBox->currentRow();
1203  if ( ( tmp_index < 0 )
1204  || ( tmp_index >= int( mTagListBox->count() ) - 1 ) )
1205  return;
1206  swapTagsInListBox( tmp_index, tmp_index + 1 );
1207  updateButtons();
1208 }
1209 
1210 void AppearancePage::MessageTagTab::swapTagsInListBox( const int first,
1211  const int second )
1212 {
1213  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1214  this, SLOT(slotSelectionChanged()) );
1215  QListWidgetItem *item = mTagListBox->takeItem( first );
1216  // now selected item is at idx(idx-1), so
1217  // insert the other item at idx, ie. above(below).
1218  mPreviousTag = second;
1219  mTagListBox->insertItem( second, item );
1220  mTagListBox->setCurrentRow( second );
1221  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1222  this, SLOT(slotSelectionChanged()) );
1223  slotEmitChangeCheck();
1224 }
1225 
1226 void AppearancePage::MessageTagTab::slotRecordTagSettings( int aIndex )
1227 {
1228  if ( ( aIndex < 0 ) || ( aIndex >= int( mTagListBox->count() ) ) )
1229  return;
1230  QListWidgetItem *item = mTagListBox->item( aIndex );
1231  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
1232 
1233  MailCommon::Tag::Ptr tmp_desc = tagItem->kmailTag();
1234 
1235  tmp_desc->tagName = tagItem->text();
1236  mTagWidget->recordTagSettings(tmp_desc);
1237 }
1238 
1239 void AppearancePage::MessageTagTab::slotUpdateTagSettingWidgets( int aIndex )
1240 {
1241  //Check if selection is valid
1242  if ( ( aIndex < 0 ) || ( mTagListBox->currentRow() < 0 ) ) {
1243  mTagRemoveButton->setEnabled( false );
1244  mTagUpButton->setEnabled( false );
1245  mTagDownButton->setEnabled( false );
1246 
1247  mTagWidget->setEnabled(false);
1248  return;
1249  }
1250  mTagWidget->setEnabled(true);
1251 
1252  mTagRemoveButton->setEnabled( true );
1253  mTagUpButton->setEnabled( ( 0 != aIndex ) );
1254  mTagDownButton->setEnabled(( ( int( mTagListBox->count() ) - 1 ) != aIndex ) );
1255  QListWidgetItem * item = mTagListBox->currentItem();
1256  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
1257  MailCommon::Tag::Ptr tmp_desc = tagItem->kmailTag();
1258 
1259  disconnect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1260  this, SLOT(slotNameLineTextChanged(QString)) );
1261 
1262  mTagWidget->tagNameLineEdit()->setEnabled( !tmp_desc->isImmutable );
1263  mTagWidget->tagNameLineEdit()->setText( tmp_desc->tagName );
1264  connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1265  this, SLOT(slotNameLineTextChanged(QString)) );
1266 
1267 
1268  mTagWidget->setTagTextColor(tmp_desc->textColor);
1269 
1270  mTagWidget->setTagBackgroundColor(tmp_desc->backgroundColor);
1271 
1272  mTagWidget->setTagTextFont(tmp_desc->textFont);
1273 
1274  mTagWidget->iconButton()->setEnabled( !tmp_desc->isImmutable );
1275  mTagWidget->iconButton()->setIcon( tmp_desc->iconName );
1276 
1277  mTagWidget->keySequenceWidget()->setEnabled( true );
1278  mTagWidget->keySequenceWidget()->setKeySequence( tmp_desc->shortcut.primary(),
1279  KKeySequenceWidget::NoValidate );
1280 
1281  mTagWidget->inToolBarCheck()->setEnabled( true );
1282  mTagWidget->inToolBarCheck()->setChecked( tmp_desc->inToolbar );
1283 }
1284 
1285 void AppearancePage::MessageTagTab::slotSelectionChanged()
1286 {
1287  mEmitChanges = false;
1288  slotRecordTagSettings( mPreviousTag );
1289  slotUpdateTagSettingWidgets( mTagListBox->currentRow() );
1290  mPreviousTag = mTagListBox->currentRow();
1291  mEmitChanges = true;
1292 }
1293 
1294 void AppearancePage::MessageTagTab::slotRemoveTag()
1295 {
1296  const int tmp_index = mTagListBox->currentRow();
1297  if ( tmp_index >= 0 ) {
1298  if (KMessageBox::Yes == KMessageBox::questionYesNo(this,i18n("Do you want to remove tag \'%1\'?", mTagListBox->item(mTagListBox->currentRow())->text()))) {
1299  QListWidgetItem * item = mTagListBox->takeItem( mTagListBox->currentRow() );
1300  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
1301  MailCommon::Tag::Ptr tmp_desc = tagItem->kmailTag();
1302  if ( tmp_desc->tag().isValid() ) {
1303  new Akonadi::TagDeleteJob(tmp_desc->tag());
1304  } else {
1305  kWarning() << "Can't remove tag with invalid akonadi tag";
1306  }
1307  mPreviousTag = -1;
1308 
1309  //Before deleting the current item, make sure the selectionChanged signal
1310  //is disconnected, so that the widgets will not get updated while the
1311  //deletion takes place.
1312  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1313  this, SLOT(slotSelectionChanged()) );
1314 
1315  delete item;
1316  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1317  this, SLOT(slotSelectionChanged()) );
1318 
1319  slotSelectionChanged();
1320  slotEmitChangeCheck();
1321  }
1322  }
1323 }
1324 
1325 void AppearancePage::MessageTagTab::slotDeleteTagJob(KJob* job)
1326 {
1327  if (job->error()) {
1328  kWarning() << "Failed to delete tag " << job->errorString();
1329  }
1330 }
1331 
1332 void AppearancePage::MessageTagTab::slotNameLineTextChanged( const QString
1333  &aText )
1334 {
1335  //If deleted all, leave the first character for the sake of not having an
1336  //empty tag name
1337  if ( aText.isEmpty() && !mTagListBox->currentItem())
1338  return;
1339 
1340  const int count = mTagListBox->count();
1341  for ( int i=0; i < count; ++i ) {
1342  if(mTagListBox->item(i)->text() == aText) {
1343  KMessageBox::error(this,i18n("We cannot create tag. A tag with same name already exists."));
1344  disconnect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1345  this, SLOT(slotNameLineTextChanged(QString)) );
1346  mTagWidget->tagNameLineEdit()->setText(mTagListBox->currentItem()->text());
1347  connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1348  this, SLOT(slotNameLineTextChanged(QString)) );
1349  return;
1350  }
1351  }
1352 
1353 
1354  //Disconnect so the tag information is not saved and reloaded with every
1355  //letter
1356  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1357  this, SLOT(slotSelectionChanged()) );
1358 
1359  mTagListBox->currentItem()->setText( aText );
1360  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1361  this, SLOT(slotSelectionChanged()) );
1362 }
1363 
1364 void AppearancePage::MessageTagTab::slotIconNameChanged( const QString &iconName )
1365 {
1366  mTagListBox->currentItem()->setIcon( KIcon( iconName ) );
1367 }
1368 
1369 void AppearancePage::MessageTagTab::slotAddLineTextChanged( const QString &aText )
1370 {
1371  mTagAddButton->setEnabled( !aText.trimmed().isEmpty() );
1372 }
1373 
1374 void AppearancePage::MessageTagTab::slotAddNewTag()
1375 {
1376  const QString newTagName = mTagAddLineEdit->text();
1377  const int count = mTagListBox->count();
1378  for ( int i=0; i < count; ++i ) {
1379  if(mTagListBox->item(i)->text() == newTagName) {
1380  KMessageBox::error(this,i18n("We cannot create tag. A tag with same name already exists."));
1381  return;
1382  }
1383  }
1384 
1385  const int tmp_priority = mTagListBox->count();
1386 
1387  MailCommon::Tag::Ptr tag( Tag::createDefaultTag( newTagName ) );
1388  tag->priority = tmp_priority;
1389 
1390  slotEmitChangeCheck();
1391  TagListWidgetItem *newItem = new TagListWidgetItem( KIcon( tag->iconName ), newTagName, mTagListBox );
1392  newItem->setKMailTag( tag );
1393  mTagListBox->addItem( newItem );
1394  mTagListBox->setCurrentItem( newItem );
1395  mTagAddLineEdit->setText( QString() );
1396 }
1397 
1398 void AppearancePage::MessageTagTab::doLoadFromGlobalSettings()
1399 {
1400  mTagListBox->clear();
1401 
1402  Akonadi::TagFetchJob *fetchJob = new Akonadi::TagFetchJob(this);
1403  fetchJob->fetchScope().fetchAttribute<Akonadi::TagAttribute>();
1404  connect(fetchJob, SIGNAL(result(KJob*)), this, SLOT(slotTagsFetched(KJob*)));
1405 }
1406 
1407 void AppearancePage::MessageTagTab::slotTagsFetched(KJob *job)
1408 {
1409  if (job->error()) {
1410  kWarning() << "Failed to load tags " << job->errorString();
1411  return;
1412  }
1413  Akonadi::TagFetchJob *fetchJob = static_cast<Akonadi::TagFetchJob*>(job);
1414 
1415  QList<MailCommon::TagPtr> msgTagList;
1416  foreach( const Akonadi::Tag &akonadiTag, fetchJob->tags() ) {
1417  MailCommon::Tag::Ptr tag = MailCommon::Tag::fromAkonadi( akonadiTag );
1418  msgTagList.append( tag );
1419  }
1420 
1421  qSort( msgTagList.begin(), msgTagList.end(), MailCommon::Tag::compare );
1422 
1423  foreach( const MailCommon::Tag::Ptr& tag, msgTagList ) {
1424  TagListWidgetItem *newItem = new TagListWidgetItem( KIcon( tag->iconName ), tag->tagName, mTagListBox );
1425  newItem->setKMailTag( tag );
1426  if ( tag->priority == -1 )
1427  tag->priority = mTagListBox->count() - 1;
1428  }
1429 
1430  //Disconnect so that insertItem's do not trigger an update procedure
1431  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1432  this, SLOT(slotSelectionChanged()) );
1433 
1434  connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1435  this, SLOT(slotSelectionChanged()) );
1436 
1437  slotUpdateTagSettingWidgets( -1 );
1438  //Needed since the previous function doesn't affect add button
1439  mTagAddButton->setEnabled( false );
1440 
1441  // Save the original list
1442  mOriginalMsgTagList.clear();
1443  foreach( const MailCommon::TagPtr &tag, msgTagList ) {
1444  mOriginalMsgTagList.append( MailCommon::TagPtr( new MailCommon::Tag( *tag ) ) );
1445  }
1446 
1447 }
1448 
1449 void AppearancePage::MessageTagTab::save()
1450 {
1451  const int currentRow = mTagListBox->currentRow();
1452  if ( currentRow < 0 ) {
1453  return;
1454  }
1455 
1456  const int count = mTagListBox->count();
1457  if ( !count ) {
1458  return;
1459  }
1460 
1461  QListWidgetItem *item = mTagListBox->currentItem();
1462  if ( !item ) {
1463  return;
1464  }
1465  slotRecordTagSettings( currentRow );
1466  const int numberOfMsgTagList = count;
1467  for ( int i=0; i < numberOfMsgTagList; ++i ) {
1468  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( mTagListBox->item(i) );
1469  if ( ( i>=mOriginalMsgTagList.count() ) || *(tagItem->kmailTag()) != *(mOriginalMsgTagList[i]) ) {
1470  MailCommon::Tag::Ptr tag = tagItem->kmailTag();
1471  tag->priority = i;
1472 
1473  MailCommon::Tag::SaveFlags saveFlags = mTagWidget->saveFlags();
1474  Akonadi::Tag akonadiTag = tag->saveToAkonadi( saveFlags );
1475  if ((*tag).id()> 0) {
1476  akonadiTag.setId((*tag).id());
1477  }
1478  if (akonadiTag.isValid()) {
1479  new Akonadi::TagModifyJob(akonadiTag);
1480  } else {
1481  new Akonadi::TagCreateJob(akonadiTag);
1482  }
1483  }
1484  }
1485 }
1486 
1487 
QWidget::layout
QLayout * layout() const
QAbstractButton::setAutoRepeat
void setAutoRepeat(bool)
AppearancePageMessageTagTab::slotRemoveTag
void slotRemoveTag()
Removes the currently selected text in the list box.
Definition: configureappearancepage.cpp:1294
QList::clear
void clear()
QWhatsThis::showText
void showText(const QPoint &pos, const QString &text, QWidget *w)
dateDisplay
DateFormatter::FormatType dateDisplay
Definition: configureappearancepage.cpp:630
AppearancePage::helpAnchor
QString helpAnchor() const
Should return the help anchor for this page or tab.
Definition: configureappearancepage.cpp:79
QModelIndex
numFontNames
static const int numFontNames
Definition: configureappearancepage.cpp:156
AppearancePageLayoutTab::helpAnchor
QString helpAnchor() const
Definition: configureappearancepage.cpp:518
AppearancePage::LayoutTab
AppearancePageLayoutTab LayoutTab
Definition: configureappearancepage.h:301
globalsettings.h
QWidget
QFont::setPointSize
void setPointSize(int pointSize)
QListWidget::currentItem
QListWidgetItem * currentItem() const
AppearancePageMessageTagTab::~AppearancePageMessageTagTab
~AppearancePageMessageTagTab()
Definition: configureappearancepage.cpp:1158
AppearancePage::ColorsTab
AppearancePageColorsTab ColorsTab
Definition: configureappearancepage.h:300
kmmainwidget.h
ConfigModuleTab
Definition: configuredialog_p.h:19
AppearancePageHeadersTab::AppearancePageHeadersTab
AppearancePageHeadersTab(QWidget *parent=0)
Definition: configureappearancepage.cpp:640
colorNames
static const struct @1 colorNames[]
QSpinBox::setSuffix
void setSuffix(const QString &suffix)
numDateDisplayConfig
static const int numDateDisplayConfig
Definition: configureappearancepage.cpp:637
QButtonGroup::addButton
void addButton(QAbstractButton *button)
TagListWidgetItem::setKMailTag
void setKMailTag(const MailCommon::Tag::Ptr &tag)
Definition: configureappearancepage.cpp:1029
onlyFixed
bool onlyFixed
Definition: configureappearancepage.cpp:141
text
virtual QByteArray text(quint32 serialNumber) const =0
AppearancePage::ReaderTab
AppearancePageReaderTab ReaderTab
Definition: configureappearancepage.h:303
displayName
const char * displayName
Definition: configureappearancepage.cpp:139
QFont
AppearancePageMessageTagTab::slotAddLineTextChanged
void slotAddLineTextChanged(const QString &aText)
Enables/disables Add button according to whether aText is empty.
Definition: configureappearancepage.cpp:1369
QWidget::setMinimumWidth
void setMinimumWidth(int minw)
AppearancePage::FontsTab
AppearancePageFontsTab FontsTab
Definition: configureappearancepage.h:299
QAbstractItemView::setDragDropMode
void setDragDropMode(DragDropMode behavior)
QListWidgetItem
QHBoxLayout
AppearancePageReaderTab::save
void save()
Definition: configureappearancepage.cpp:941
AppearancePageReaderTab::AppearancePageReaderTab
AppearancePageReaderTab(QWidget *parent=0)
Definition: configureappearancepage.cpp:901
QListWidget::insertItem
void insertItem(int row, QListWidgetItem *item)
QButtonGroup::button
QAbstractButton * button(int id) const
TagListWidgetItem::kmailTag
MailCommon::Tag::Ptr kmailTag() const
Definition: configureappearancepage.cpp:1034
QBoxLayout::addSpacing
void addSpacing(int size)
QListWidget
TagListWidgetItem::~TagListWidgetItem
~TagListWidgetItem()
Definition: configureappearancepage.cpp:1025
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QAbstractButton::setIcon
void setIcon(const QIcon &icon)
numColorNames
static const int numColorNames
Definition: configureappearancepage.cpp:353
QListWidget::addItem
void addItem(const QString &label)
AppearancePageHeadersTab::helpAnchor
QString helpAnchor() const
Definition: configureappearancepage.cpp:623
KMKernel::self
static KMKernel * self()
normal control stuff
Definition: kmkernel.cpp:1471
QSpinBox::setRange
void setRange(int minimum, int maximum)
QButtonGroup
KMKernel::savePaneSelection
void savePaneSelection()
Definition: kmkernel.cpp:1985
TagListWidgetItem::TagListWidgetItem
TagListWidgetItem(QListWidget *parent=0)
Definition: configureappearancepage.cpp:1015
QLabel::setBuddy
void setBuddy(QWidget *buddy)
enableFamilyAndSize
bool enableFamilyAndSize
Definition: configureappearancepage.cpp:140
QWidget::setEnabled
void setEnabled(bool)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
QWidget::setLayout
void setLayout(QLayout *layout)
QGroupBox
QListWidget::clear
void clear()
QSharedPointer
Definition: collectionmailinglistpage.h:34
QListWidget::takeItem
QListWidgetItem * takeItem(int row)
AppearancePageHeadersTab::save
void save()
Definition: configureappearancepage.cpp:869
QCheckBox
KMail::Util::quoteL3Color
QColor quoteL3Color()
Definition: util.cpp:206
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
TagListWidgetItem
Definition: configureappearancepage.h:197
KMail::Util::quoteL1Color
QColor quoteL1Color()
Definition: util.cpp:196
AppearancePageMessageTagTab::slotMoveTagUp
void slotMoveTagUp()
Increases the currently selected tag's priority and handles related visual changes.
Definition: configureappearancepage.cpp:1191
AppearancePageSystemTrayTab::helpAnchor
QString helpAnchor() const
Definition: configureappearancepage.cpp:948
ConfigModuleTab::slotEmitChanged
void slotEmitChanged()
QVBoxLayout
AppearancePageLayoutTab::AppearancePageLayoutTab
AppearancePageLayoutTab(QWidget *parent=0)
Definition: configureappearancepage.cpp:523
AppearancePageColorsTab::save
void save()
Definition: configureappearancepage.cpp:481
ConfigModuleWithTabs::addTab
void addTab(ConfigModuleTab *tab, const QString &title)
QListWidget::setCurrentItem
void setCurrentItem(QListWidgetItem *item)
QString
QList< KActionCollection * >
QColor
AppearancePageColorsTab::AppearancePageColorsTab
AppearancePageColorsTab(QWidget *parent=0)
Definition: configureappearancepage.cpp:355
QListWidget::item
QListWidgetItem * item(int row) const
QListWidget::count
count
util.h
AppearancePage::HeadersTab
AppearancePageHeadersTab HeadersTab
Definition: configureappearancepage.h:302
QLayout::setMargin
void setMargin(int margin)
AppearancePageMessageTagTab::slotAddNewTag
void slotAddNewTag()
Creates a generic tag with the visible name from the line edit widget for adding tags.
Definition: configureappearancepage.cpp:1374
AppearancePage::MessageTagTab
AppearancePageMessageTagTab MessageTagTab
Definition: configureappearancepage.h:305
QLayout::addWidget
void addWidget(QWidget *w)
QListWidget::currentRow
currentRow
kmkernel
#define kmkernel
Definition: kmkernel.h:24
QStringList
QSpinBox::setSingleStep
void setSingleStep(int val)
QSpinBox
QList::end
iterator end()
fontNames
static const struct @0 fontNames[]
ColorListBox::color
QColor color(int index) const
Definition: colorlistbox.cpp:67
QListWidgetItem::setIcon
void setIcon(const QIcon &icon)
ConfigModuleTab::changed
void changed(bool)
colorlistbox.h
QWidget::setContextMenuPolicy
void setContextMenuPolicy(Qt::ContextMenuPolicy policy)
AppearancePageColorsTab::helpAnchor
QString helpAnchor() const
Definition: configureappearancepage.cpp:321
ColorListBox::setColorSilently
void setColorSilently(int index, const QColor &color)
Definition: colorlistbox.cpp:52
AppearancePage::AppearancePage
AppearancePage(const KComponentData &instance, QWidget *parent=0)
Definition: configureappearancepage.cpp:84
QAbstractButton::setChecked
void setChecked(bool)
configName
const char * configName
Definition: configureappearancepage.cpp:138
QButtonGroup::checkedId
int checkedId() const
GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:30
kmkernel.h
KLineEdit
AppearancePageMessageTagTab::AppearancePageMessageTagTab
AppearancePageMessageTagTab(QWidget *parent=0)
Definition: configureappearancepage.cpp:1040
QWidget::setWhatsThis
void setWhatsThis(const QString &)
ConfigModuleTab::mEmitChanges
bool mEmitChanges
Definition: configuredialog_p.h:36
QCursor::pos
QPoint pos()
QLatin1String
QBoxLayout::addStretch
void addStretch(int stretch)
QRadioButton
QGroupBox::setTitle
void setTitle(const QString &title)
QSpinBox::setValue
void setValue(int val)
QFont::setFamily
void setFamily(const QString &family)
configureappearancepage.h
QWidget::QWidget
QWidget(QWidget *parent, QFlags< Qt::WindowType > f)
KComboBox
dateDisplayConfig
static const struct @2 dateDisplayConfig[]
QString::fromLatin1
QString fromLatin1(const char *str, int size)
KMail::Util::quoteL2Color
QColor quoteL2Color()
Definition: util.cpp:201
QLayout::setSpacing
void setSpacing(int)
KHBox
AppearancePageFontsTab::save
void save()
Definition: configureappearancepage.cpp:281
ConfigModuleWithTabs
Definition: configuredialog_p.h:54
QWidget::setToolTip
void setToolTip(const QString &)
AppearancePageFontsTab::AppearancePageFontsTab
AppearancePageFontsTab(QWidget *parent=0)
Definition: configureappearancepage.cpp:158
AppearancePageMessageTagTab::slotMoveTagDown
void slotMoveTagDown()
Decreases the currently selected tag's priority and handles related visual changes.
Definition: configureappearancepage.cpp:1200
ColorListBox
Definition: colorlistbox.h:33
AppearancePageSystemTrayTab::AppearancePageSystemTrayTab
AppearancePageSystemTrayTab(QWidget *parent=0)
Definition: configureappearancepage.cpp:953
QAbstractItemView::model
QAbstractItemModel * model() const
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
AppearancePage::SystemTrayTab
AppearancePageSystemTrayTab SystemTrayTab
Definition: configureappearancepage.h:304
QLabel
ColorListBox::addColor
void addColor(const QString &text, const QColor &color=Qt::black)
Definition: colorlistbox.cpp:45
AppearancePageFontsTab::helpAnchor
QString helpAnchor() const
Definition: configureappearancepage.cpp:132
AppearancePageMessageTagTab::save
void save()
Definition: configureappearancepage.cpp:1449
AppearancePageLayoutTab::save
void save()
Definition: configureappearancepage.cpp:610
KJob
AppearancePageMessageTagTab::helpAnchor
QString helpAnchor() const
Definition: configureappearancepage.cpp:1009
AppearancePageReaderTab::helpAnchor
QString helpAnchor() const
Definition: configureappearancepage.cpp:896
QList::begin
iterator begin()
QBoxLayout::setStretchFactor
bool setStretchFactor(QWidget *widget, int stretch)
QListWidgetItem::text
QString text() const
AppearancePageSystemTrayTab::save
void save()
Definition: configureappearancepage.cpp:1001
QBoxLayout::setSpacing
void setSpacing(int spacing)
QFont::pointSize
int pointSize() const
QIcon
QListWidgetItem::setText
void setText(const QString &text)
QBoxLayout::addLayout
void addLayout(QLayout *layout, int stretch)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:32 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
  • pimprint

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