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

messagelist

  • sources
  • kde-4.12
  • kdepim
  • messagelist
  • core
manager.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  *******************************************************************************/
20 
21 #include "core/manager.h"
22 
23 #include "core/aggregation.h"
24 #include "core/theme.h"
25 #include "core/view.h"
26 #include "core/widgetbase.h"
27 #include "core/storagemodelbase.h"
28 #include "core/model.h"
29 #include "core/model_p.h"
30 #include "core/settings.h"
31 
32 #include "utils/configureaggregationsdialog.h"
33 #include "utils/configureaggregationsdialog_p.h"
34 #include "utils/configurethemesdialog.h"
35 #include "utils/configurethemesdialog_p.h"
36 
37 #include "messagecore/settings/globalsettings.h"
38 
39 #include "messagelistutil.h"
40 
41 #include <QPixmap>
42 
43 #include <kmime/kmime_dateformatter.h> // kdepimlibs
44 
45 #include <KConfig>
46 #include <KDebug>
47 #include <KIconLoader>
48 #include <KGlobalSettings>
49 #include <KApplication>
50 #include <KLocale>
51 #include <KStandardDirs>
52 
53 using namespace MessageList::Core;
54 
55 Manager * Manager::mInstance = 0;
56 
57 Manager::Manager()
58  : QObject()
59 {
60  mInstance = this;
61 
62  mDateFormatter = new KMime::DateFormatter();
63 
64  mPixmapMessageNew = new QPixmap( SmallIcon( QLatin1String( "mail-unread-new" ) ) );
65  mPixmapMessageUnread = new QPixmap( SmallIcon( QLatin1String( "mail-unread" ) ) );
66  mPixmapMessageRead = new QPixmap( SmallIcon( QLatin1String( "mail-read" ) ) );
67  mPixmapMessageDeleted = new QPixmap( SmallIcon( QLatin1String( "mail-deleted" ) ) );
68  mPixmapMessageReplied = new QPixmap( SmallIcon( QLatin1String( "mail-replied" ) ) );
69  mPixmapMessageRepliedAndForwarded = new QPixmap( SmallIcon( QLatin1String( "mail-forwarded-replied" ) ) );
70  mPixmapMessageQueued = new QPixmap( SmallIcon( QLatin1String( "mail-queued" ) ) ); // mail-queue ?
71  mPixmapMessageActionItem = new QPixmap( SmallIcon( QLatin1String( "mail-task" ) ) );
72  mPixmapMessageSent = new QPixmap( SmallIcon( QLatin1String( "mail-sent" ) ) );
73  mPixmapMessageForwarded = new QPixmap( SmallIcon( QLatin1String( "mail-forwarded" ) ) );
74  mPixmapMessageImportant = new QPixmap( SmallIcon( QLatin1String( "emblem-important" ) ) ); // "flag"
75  mPixmapMessageWatched = new QPixmap( KStandardDirs::locate( "data", QLatin1String( "messagelist/pics/mail-thread-watch.png" ) ) );
76  mPixmapMessageIgnored = new QPixmap( KStandardDirs::locate( "data", QLatin1String( "messagelist/pics/mail-thread-ignored.png" ) ) );
77  mPixmapMessageSpam = new QPixmap( SmallIcon( QLatin1String( "mail-mark-junk" ) ) );
78  mPixmapMessageHam = new QPixmap( SmallIcon( QLatin1String( "mail-mark-notjunk" ) ) );
79  mPixmapMessageFullySigned = new QPixmap( SmallIcon( QLatin1String( "mail-signed-verified" ) ) );
80  mPixmapMessagePartiallySigned = new QPixmap( SmallIcon( QLatin1String( "mail-signed-part" ) ) );
81  mPixmapMessageUndefinedSigned = new QPixmap( SmallIcon( QLatin1String( "mail-signed" ) ) );
82  mPixmapMessageNotSigned = new QPixmap( SmallIcon( QLatin1String( "text-plain" ) ) );
83  mPixmapMessageFullyEncrypted = new QPixmap( SmallIcon( QLatin1String( "mail-encrypted-full" ) ) );
84  mPixmapMessagePartiallyEncrypted = new QPixmap( SmallIcon( QLatin1String( "mail-encrypted-part" ) ) );
85  mPixmapMessageUndefinedEncrypted = new QPixmap( SmallIcon( QLatin1String( "mail-encrypted" ) ) );
86  mPixmapMessageNotEncrypted = new QPixmap( SmallIcon( QLatin1String( "text-plain" ) ) );
87  mPixmapMessageAttachment = new QPixmap( SmallIcon( QLatin1String( "mail-attachment" ) ) );
88  mPixmapMessageAnnotation = new QPixmap( SmallIcon( QLatin1String( "view-pim-notes" ) ) );
89  mPixmapMessageInvitation = new QPixmap( SmallIcon( QLatin1String( "mail-invitation" ) ) );
90  if ( KApplication::isRightToLeft() )
91  mPixmapShowMore = new QPixmap( SmallIcon( QLatin1String( "arrow-left" ) ) );
92  else
93  mPixmapShowMore = new QPixmap( SmallIcon( QLatin1String( "arrow-right" ) ) );
94  mPixmapShowLess = new QPixmap( SmallIcon( QLatin1String( "arrow-down" ) ) );
95  mPixmapVerticalLine = new QPixmap( KStandardDirs::locate( "data", QLatin1String( "messagelist/pics/mail-vertical-separator-line.png" ) ) );
96  mPixmapHorizontalSpacer = new QPixmap( KStandardDirs::locate( "data", QLatin1String( "messagelist/pics/mail-horizontal-space.png" ) ) );
97 
98  mCachedLocalizedUnknownText = i18nc( "Unknown date", "Unknown" ) ;
99 
100  loadConfiguration();
101  connect( Settings::self(), SIGNAL(configChanged()),
102  this, SLOT(reloadGlobalConfiguration()) );
103 }
104 
105 Manager::~Manager()
106 {
107  saveConfiguration();
108  removeAllAggregations();
109  removeAllThemes();
110 
111  delete mPixmapMessageNew;
112  delete mPixmapMessageUnread;
113  delete mPixmapMessageRead;
114  delete mPixmapMessageDeleted;
115  delete mPixmapMessageReplied;
116  delete mPixmapMessageRepliedAndForwarded;
117  delete mPixmapMessageQueued;
118  delete mPixmapMessageActionItem;
119  delete mPixmapMessageSent;
120  delete mPixmapMessageForwarded;
121  delete mPixmapMessageImportant; // "flag"
122  delete mPixmapMessageWatched;
123  delete mPixmapMessageIgnored;
124  delete mPixmapMessageSpam;
125  delete mPixmapMessageHam;
126  delete mPixmapMessageFullySigned;
127  delete mPixmapMessagePartiallySigned;
128  delete mPixmapMessageUndefinedSigned;
129  delete mPixmapMessageNotSigned;
130  delete mPixmapMessageFullyEncrypted;
131  delete mPixmapMessagePartiallyEncrypted;
132  delete mPixmapMessageUndefinedEncrypted;
133  delete mPixmapMessageNotEncrypted;
134  delete mPixmapMessageAttachment;
135  delete mPixmapMessageAnnotation;
136  delete mPixmapMessageInvitation;
137  delete mPixmapShowMore;
138  delete mPixmapShowLess;
139  delete mPixmapVerticalLine;
140  delete mPixmapHorizontalSpacer;
141 
142  delete mDateFormatter;
143 
144  mInstance = 0;
145 }
146 
147 void Manager::registerWidget( Widget *pWidget )
148 {
149  if ( !mInstance )
150  mInstance = new Manager();
151 
152  mInstance->mWidgetList.append( pWidget );
153 }
154 
155 void Manager::unregisterWidget( Widget *pWidget )
156 {
157  if ( !mInstance )
158  {
159  qWarning("ERROR: MessageList::Manager::unregisterWidget() called when Manager::mInstance is 0");
160  return;
161  }
162 
163  mInstance->mWidgetList.removeAll( pWidget );
164 
165  if ( mInstance->mWidgetList.isEmpty() )
166  {
167  delete mInstance;
168  mInstance = 0;
169  }
170 }
171 
172 const Aggregation * Manager::aggregation( const QString &id )
173 {
174  Aggregation * opt = mAggregations.value( id );
175  if ( opt )
176  return opt;
177 
178  return defaultAggregation();
179 }
180 
181 const Aggregation * Manager::defaultAggregation()
182 {
183  KConfigGroup conf( Settings::self()->config(),
184  MessageList::Util::storageModelAggregationsGroup() );
185 
186  const QString aggregationId = conf.readEntry( QLatin1String( "DefaultSet" ), "" );
187 
188  Aggregation * opt = 0;
189 
190  if ( !aggregationId.isEmpty() )
191  opt = mAggregations.value( aggregationId );
192 
193  if ( opt )
194  return opt;
195 
196  // try just the first one
197  QHash< QString, Aggregation * >::ConstIterator it = mAggregations.constBegin();
198  if ( it != mAggregations.constEnd() )
199  return *it;
200 
201  // aargh
202  createDefaultAggregations();
203 
204  return *( mAggregations.constBegin() );
205 }
206 
207 void Manager::saveAggregationForStorageModel( const Akonadi::Collection &col, const QString &id, bool storageUsesPrivateAggregation )
208 {
209  if ( !col.isValid() )
210  return;
211  saveAggregationForStorageModel( QString::number( col.id() ), id, storageUsesPrivateAggregation );
212 }
213 
214 void Manager::saveAggregationForStorageModel( const StorageModel *storageModel, const QString &id, bool storageUsesPrivateAggregation )
215 {
216  saveAggregationForStorageModel( storageModel->id(), id, storageUsesPrivateAggregation );
217 }
218 
219 void Manager::saveAggregationForStorageModel( const QString &modelId, const QString &id, bool storageUsesPrivateAggregation )
220 {
221  KConfigGroup conf( Settings::self()->config(),
222  MessageList::Util::storageModelAggregationsGroup() );
223 
224  if ( storageUsesPrivateAggregation )
225  conf.writeEntry( MessageList::Util::setForStorageModelConfigName().arg( modelId ), id );
226  else
227  conf.deleteEntry( MessageList::Util::setForStorageModelConfigName().arg( modelId ) );
228 
229  if ( !storageUsesPrivateAggregation )
230  conf.writeEntry( QLatin1String( "DefaultSet" ), id );
231 }
232 
233 const Aggregation * Manager::aggregationForStorageModel( const Akonadi::Collection &col, bool *storageUsesPrivateAggregation )
234 {
235  Q_ASSERT( storageUsesPrivateAggregation );
236 
237  *storageUsesPrivateAggregation = false; // this is by default
238 
239  if ( !col.isValid() )
240  return defaultAggregation();
241  return Manager::aggregationForStorageModel( QString::number( col.id() ), storageUsesPrivateAggregation );
242 }
243 
244 
245 const Aggregation * Manager::aggregationForStorageModel( const StorageModel *storageModel, bool *storageUsesPrivateAggregation )
246 {
247  Q_ASSERT( storageUsesPrivateAggregation );
248 
249  *storageUsesPrivateAggregation = false; // this is by default
250 
251  if ( !storageModel )
252  return defaultAggregation();
253  return Manager::aggregationForStorageModel( storageModel->id(), storageUsesPrivateAggregation );
254 }
255 
256 const Aggregation * Manager::aggregationForStorageModel( const QString &storageId, bool *storageUsesPrivateAggregation )
257 {
258  KConfigGroup conf( Settings::self()->config(),
259  MessageList::Util::storageModelAggregationsGroup() );
260 
261  const QString aggregationId = conf.readEntry( MessageList::Util::setForStorageModelConfigName().arg( storageId ), "" );
262 
263  Aggregation * opt = 0;
264 
265  if ( !aggregationId.isEmpty() )
266  {
267  // a private aggregation was stored
268  opt = mAggregations.value( aggregationId );
269  *storageUsesPrivateAggregation = ( opt != 0 );
270  }
271 
272  if ( opt )
273  return opt;
274 
275  // FIXME: If the storageModel is a mailing list, maybe suggest a mailing-list like preset...
276  // We could even try to guess if the storageModel is a mailing list
277 
278  return defaultAggregation();
279 }
280 
281 void Manager::addAggregation( Aggregation *set )
282 {
283  Aggregation * old = mAggregations.value( set->id() );
284  delete old;
285  mAggregations.insert( set->id(), set );
286 }
287 
288 void Manager::createDefaultAggregations()
289 {
290  addAggregation(
291  new Aggregation(
292  i18n( "Current Activity, Threaded" ),
293  i18n( "This view uses smart date range groups. " \
294  "Messages are threaded. " \
295  "So for example, in \"Today\" you will find all the messages arrived today " \
296  "and all the threads that have been active today."
297  ),
298  Aggregation::GroupByDateRange,
299  Aggregation::ExpandRecentGroups,
300  Aggregation::PerfectReferencesAndSubject,
301  Aggregation::MostRecentMessage,
302  Aggregation::ExpandThreadsWithUnreadOrImportantMessages,
303  Aggregation::FavorInteractivity,
304  true
305  )
306  );
307 
308  addAggregation(
309  new Aggregation(
310  i18n( "Current Activity, Flat" ),
311  i18n( "This view uses smart date range groups. " \
312  "Messages are not threaded. " \
313  "So for example, in \"Today\" you will simply find all the messages arrived today."
314  ),
315  Aggregation::GroupByDateRange,
316  Aggregation::ExpandRecentGroups,
317  Aggregation::NoThreading,
318  Aggregation::MostRecentMessage,
319  Aggregation::NeverExpandThreads,
320  Aggregation::FavorInteractivity,
321  true
322  )
323  );
324 
325  addAggregation(
326  new Aggregation(
327  i18n( "Activity by Date, Threaded" ),
328  i18n( "This view uses day-by-day groups. " \
329  "Messages are threaded. " \
330  "So for example, in \"Today\" you will find all the messages arrived today " \
331  "and all the threads that have been active today."
332  ),
333  Aggregation::GroupByDate,
334  Aggregation::ExpandRecentGroups,
335  Aggregation::PerfectReferencesAndSubject,
336  Aggregation::MostRecentMessage,
337  Aggregation::ExpandThreadsWithUnreadOrImportantMessages,
338  Aggregation::FavorInteractivity,
339  true
340  )
341  );
342 
343  addAggregation(
344  new Aggregation(
345  i18n( "Activity by Date, Flat" ),
346  i18n( "This view uses day-by-day groups. " \
347  "Messages are not threaded. " \
348  "So for example, in \"Today\" you will simply find all the messages arrived today."
349  ),
350  Aggregation::GroupByDate,
351  Aggregation::ExpandRecentGroups,
352  Aggregation::NoThreading,
353  Aggregation::MostRecentMessage,
354  Aggregation::NeverExpandThreads,
355  Aggregation::FavorInteractivity,
356  true
357  )
358  );
359 
360  addAggregation(
361  new Aggregation(
362  i18n( "Standard Mailing List" ),
363  i18n( "This is a plain and old mailing list view: no groups and heavy threading." ),
364  Aggregation::NoGrouping,
365  Aggregation::NeverExpandGroups,
366  Aggregation::PerfectReferencesAndSubject,
367  Aggregation::TopmostMessage,
368  Aggregation::ExpandThreadsWithUnreadOrImportantMessages,
369  Aggregation::FavorInteractivity,
370  true
371  )
372  );
373 
374  addAggregation(
375  new Aggregation(
376  i18n( "Flat Date View" ),
377  i18n( "This is a plain and old list of messages sorted by date: no groups and no threading." \
378  ),
379  Aggregation::NoGrouping,
380  Aggregation::NeverExpandGroups,
381  Aggregation::NoThreading,
382  Aggregation::TopmostMessage,
383  Aggregation::NeverExpandThreads,
384  Aggregation::FavorInteractivity,
385  true
386 
387  )
388  );
389 
390  addAggregation(
391  new Aggregation(
392  i18n( "Senders/Receivers, Flat" ),
393  i18n( "This view groups the messages by senders or receivers (depending on the folder " \
394  "type). " \
395  "Messages are not threaded."
396  ),
397  Aggregation::GroupBySenderOrReceiver,
398  Aggregation::NeverExpandGroups,
399  Aggregation::NoThreading,
400  Aggregation::TopmostMessage,
401  Aggregation::NeverExpandThreads,
402  Aggregation::FavorSpeed,
403  true
404  )
405  );
406 
407  addAggregation(
408  new Aggregation(
409  i18n( "Thread Starters" ),
410  i18n( "This view groups the messages in threads and then groups the threads by the starting user." ),
411  Aggregation::GroupBySenderOrReceiver,
412  Aggregation::NeverExpandGroups,
413  Aggregation::PerfectReferencesAndSubject,
414  Aggregation::TopmostMessage,
415  Aggregation::NeverExpandThreads,
416  Aggregation::FavorSpeed,
417  true
418  )
419  );
420 
421 /*
422  FIX THIS
423  addAggregation(
424  new Aggregation(
425  i18n( "Recent Thread Starters" ),
426  i18n( "This view groups the messages in threads and then groups the threads by the starting user. " \
427  "Groups are sorted by the date of the first thread start. "
428  ),
429  Aggregation::GroupBySenderOrReceiver,
430  Aggregation::SortGroupsByDateTimeOfMostRecent,
431  Aggregation::Descending,
432  Aggregation::PerfectReferencesAndSubject,
433  Aggregation::TopmostMessage,
434  Aggregation::SortMessagesByDateTime,
435  Aggregation::Descending
436  )
437  );
438 */
439 }
440 
441 void Manager::removeAllAggregations()
442 {
443  QHash< QString, Aggregation * >::ConstIterator end( mAggregations.constEnd() );
444  for( QHash< QString, Aggregation * >::ConstIterator it = mAggregations.constBegin(); it != end; ++it )
445  delete ( *it );
446 
447  mAggregations.clear();
448 }
449 
450 void Manager::aggregationsConfigurationCompleted()
451 {
452  if ( mAggregations.isEmpty() )
453  createDefaultAggregations(); // panic
454 
455  saveConfiguration(); // just to be sure :)
456 
457  // notify all the widgets that they should reload the option set combos
458  emit aggregationsChanged();
459 }
460 
461 const SortOrder Manager::sortOrderForStorageModel( const StorageModel *storageModel, bool *storageUsesPrivateSortOrder )
462 {
463  Q_ASSERT( storageUsesPrivateSortOrder );
464 
465  *storageUsesPrivateSortOrder = false; // this is by default
466 
467  if ( !storageModel )
468  return SortOrder();
469 
470  KConfigGroup conf( Settings::self()->config(), MessageList::Util::storageModelSortOrderGroup() );
471  SortOrder ret;
472  ret.readConfig( conf, storageModel->id(), storageUsesPrivateSortOrder );
473  return ret;
474 }
475 
476 void Manager::saveSortOrderForStorageModel( const StorageModel *storageModel,
477  const SortOrder& order, bool storageUsesPrivateSortOrder )
478 {
479  KConfigGroup conf( Settings::self()->config(), MessageList::Util::storageModelSortOrderGroup() );
480  order.writeConfig( conf, storageModel->id(), storageUsesPrivateSortOrder );
481 }
482 
483 const Theme * Manager::theme( const QString &id )
484 {
485  Theme * opt = mThemes.value( id );
486  if ( opt )
487  return opt;
488 
489  return defaultTheme();
490 }
491 
492 const Theme * Manager::defaultTheme()
493 {
494  KConfigGroup conf( Settings::self()->config(), MessageList::Util::storageModelThemesGroup() );
495 
496  const QString themeId = conf.readEntry( QLatin1String( "DefaultSet" ), "" );
497 
498  Theme * opt = 0;
499 
500  if ( !themeId.isEmpty() )
501  opt = mThemes.value( themeId );
502 
503  if ( opt )
504  return opt;
505 
506  // try just the first one
507  QHash< QString, Theme * >::ConstIterator it = mThemes.constBegin();
508  if ( it != mThemes.constEnd() )
509  return *it;
510 
511  // aargh
512  createDefaultThemes();
513 
514  it = mThemes.constBegin();
515 
516  Q_ASSERT( it != mThemes.constEnd() );
517 
518  return *it;
519 }
520 
521 void Manager::saveThemeForStorageModel( int index, const QString &id, bool storageUsesPrivateTheme )
522 {
523  saveThemeForStorageModel( QString::number( index ), id, storageUsesPrivateTheme );
524 }
525 
526 void Manager::saveThemeForStorageModel( const StorageModel *storageModel, const QString &id, bool storageUsesPrivateTheme )
527 {
528  saveThemeForStorageModel( storageModel->id(), id, storageUsesPrivateTheme );
529 }
530 
531 void Manager::saveThemeForStorageModel( const QString &storageModelIndex, const QString &id, bool storageUsesPrivateTheme )
532 {
533  KConfigGroup conf( Settings::self()->config(), MessageList::Util::storageModelThemesGroup() );
534 
535  if ( storageUsesPrivateTheme )
536  conf.writeEntry( MessageList::Util::setForStorageModelConfigName().arg( storageModelIndex ), id );
537  else
538  conf.deleteEntry( MessageList::Util::setForStorageModelConfigName().arg( storageModelIndex ) );
539 
540  if ( !storageUsesPrivateTheme )
541  conf.writeEntry( QLatin1String( "DefaultSet" ), id );
542 }
543 
544 
545 const Theme * Manager::themeForStorageModel( const Akonadi::Collection & col, bool * storageUsesPrivateTheme )
546 {
547  Q_ASSERT( storageUsesPrivateTheme );
548 
549  *storageUsesPrivateTheme = false; // this is by default
550 
551  if ( !col.isValid() )
552  return defaultTheme();
553  return Manager::themeForStorageModel( QString::number( col.id() ), storageUsesPrivateTheme );
554 
555 }
556 
557 const Theme * Manager::themeForStorageModel( const StorageModel *storageModel, bool *storageUsesPrivateTheme )
558 {
559 
560 
561  Q_ASSERT( storageUsesPrivateTheme );
562 
563  *storageUsesPrivateTheme = false; // this is by default
564 
565  if ( !storageModel )
566  return defaultTheme();
567  return Manager::themeForStorageModel( storageModel->id(), storageUsesPrivateTheme );
568 }
569 
570 const Theme * Manager::themeForStorageModel( const QString &id, bool *storageUsesPrivateTheme )
571 {
572  KConfigGroup conf( Settings::self()->config(), MessageList::Util::storageModelThemesGroup() );
573  const QString themeId = conf.readEntry( MessageList::Util::setForStorageModelConfigName().arg( id ), "" );
574 
575  Theme * opt = 0;
576 
577  if ( !themeId.isEmpty() )
578  {
579  // a private theme was stored
580  opt = mThemes.value( themeId );
581  *storageUsesPrivateTheme = (opt != 0);
582  }
583 
584  if ( opt )
585  return opt;
586 
587  // FIXME: If the storageModel is a mailing list, maybe suggest a mailing-list like preset...
588  // We could even try to guess if the storageModel is a mailing list
589 
590  // FIXME: Prefer right-to-left themes when application layout is RTL.
591 
592  return defaultTheme();
593 }
594 
595 void Manager::addTheme( Theme *set )
596 {
597  Theme * old = mThemes.value( set->id() );
598  delete old;
599  mThemes.insert( set->id(), set );
600 }
601 
602 static Theme::Column * add_theme_simple_text_column( Theme * s, const QString &name, Theme::ContentItem::Type type, bool visibleByDefault, SortOrder::MessageSorting messageSorting, bool alignRight, bool addGroupHeaderItem )
603 {
604  Theme::Column * c = new Theme::Column();
605  c->setLabel( name );
606  c->setVisibleByDefault( visibleByDefault );
607  c->setMessageSorting( messageSorting );
608 
609  Theme::Row * r = new Theme::Row();
610 
611  Theme::ContentItem * i = new Theme::ContentItem( type );
612  i->setFont( KGlobalSettings::generalFont() );
613 
614  if ( alignRight )
615  r->addRightItem( i );
616  else
617  r->addLeftItem( i );
618 
619  c->addMessageRow( r );
620 
621  if ( addGroupHeaderItem )
622  {
623  Theme::Row * r = new Theme::Row();
624 
625  Theme::ContentItem * i = new Theme::ContentItem( type );
626  i->setFont( KGlobalSettings::generalFont() );
627 
628  if ( alignRight )
629  r->addRightItem( i );
630  else
631  r->addLeftItem( i );
632 
633  c->addGroupHeaderRow( r );
634  }
635 
636 
637  s->addColumn( c );
638 
639  return c;
640 }
641 
642 static Theme::Column * add_theme_simple_icon_column( Theme * s, const QString &name, const QString &pixmapName, Theme::ContentItem::Type type, bool visibleByDefault, SortOrder::MessageSorting messageSorting )
643 {
644  Theme::Column * c = new Theme::Column();
645  c->setLabel( name );
646  c->setPixmapName( pixmapName );
647  c->setVisibleByDefault( visibleByDefault );
648  c->setMessageSorting( messageSorting );
649 
650  Theme::Row * r = new Theme::Row();
651 
652  Theme::ContentItem * i = new Theme::ContentItem( type );
653  i->setSoftenByBlendingWhenDisabled( true );
654 
655  r->addLeftItem( i );
656 
657  c->addMessageRow( r );
658 
659  s->addColumn( c );
660 
661  return c;
662 }
663 
664 
665 void Manager::createDefaultThemes()
666 {
667  Theme * s;
668  Theme::Column * c;
669  Theme::Row * r;
670  Theme::ContentItem * i;
671 
672  // The "Classic" backward compatible theme
673 
674  s = new Theme(
675  i18nc( "Default theme name", "Classic" ),
676  i18n( "A simple, backward compatible, single row theme" ), true /*readOnly*/
677  );
678 
679  c = new Theme::Column();
680  c->setLabel( i18nc( "@title:column Subject of messages", "Subject" ) );
681  c->setMessageSorting( SortOrder::SortMessagesBySubject );
682 
683  r = new Theme::Row();
684  i = new Theme::ContentItem( Theme::ContentItem::ExpandedStateIcon );
685  r->addLeftItem( i );
686  i = new Theme::ContentItem( Theme::ContentItem::GroupHeaderLabel );
687  QFont bigFont = KGlobalSettings::generalFont();
688  bigFont.setBold( true );
689  i->setFont( bigFont );
690  i->setUseCustomFont( true );
691  r->addLeftItem( i );
692  c->addGroupHeaderRow( r );
693 
694  r = new Theme::Row();
695  i = new Theme::ContentItem( Theme::ContentItem::CombinedReadRepliedStateIcon );
696  r->addLeftItem( i );
697  i = new Theme::ContentItem( Theme::ContentItem::AttachmentStateIcon );
698  i->setHideWhenDisabled( true );
699  r->addLeftItem( i );
700  i = new Theme::ContentItem( Theme::ContentItem::AnnotationIcon );
701  i->setHideWhenDisabled( true );
702  r->addLeftItem( i );
703  i = new Theme::ContentItem( Theme::ContentItem::InvitationIcon );
704  i->setHideWhenDisabled( true );
705  r->addLeftItem( i );
706  i = new Theme::ContentItem( Theme::ContentItem::SignatureStateIcon );
707  i->setHideWhenDisabled( true );
708  r->addLeftItem( i );
709  i = new Theme::ContentItem( Theme::ContentItem::EncryptionStateIcon );
710  i->setHideWhenDisabled( true );
711  r->addLeftItem( i );
712  i = new Theme::ContentItem( Theme::ContentItem::Subject );
713  r->addLeftItem( i );
714  c->addMessageRow( r );
715 
716  s->addColumn( c );
717 
718  c = add_theme_simple_text_column( s, i18n( "Sender/Receiver" ), Theme::ContentItem::SenderOrReceiver, true, SortOrder::SortMessagesBySenderOrReceiver, false, false);
719  c->setIsSenderOrReceiver( true );
720  add_theme_simple_text_column( s, i18nc( "Sender of a message", "Sender" ), Theme::ContentItem::Sender, false, SortOrder::SortMessagesBySender, false, false );
721  add_theme_simple_text_column( s, i18nc( "Receiver of a message", "Receiver" ), Theme::ContentItem::Receiver, false, SortOrder::SortMessagesByReceiver, false, false );
722  add_theme_simple_text_column( s, i18nc( "Date of a message", "Date" ), Theme::ContentItem::Date, true, SortOrder::SortMessagesByDateTime, false, false );
723  add_theme_simple_text_column( s, i18n( "Most Recent Date" ), Theme::ContentItem::MostRecentDate, false, SortOrder::SortMessagesByDateTimeOfMostRecent, false, true );
724  add_theme_simple_text_column( s, i18nc( "Size of a message", "Size" ), Theme::ContentItem::Size, false, SortOrder::SortMessagesBySize, false, false );
725  add_theme_simple_icon_column( s, i18nc( "Attachement indication", "Attachment" ), QLatin1String( "mail-attachment" ), Theme::ContentItem::AttachmentStateIcon, false, SortOrder::NoMessageSorting );
726  add_theme_simple_icon_column( s, i18n( "Read/Unread" ), QLatin1String( "mail-unread-new" ), Theme::ContentItem::ReadStateIcon, false, SortOrder::SortMessagesByUnreadStatus );
727  add_theme_simple_icon_column( s, i18n( "Replied" ), QLatin1String( "mail-replied" ), Theme::ContentItem::RepliedStateIcon, false, SortOrder::NoMessageSorting );
728  add_theme_simple_icon_column( s, i18nc( "Message importance indication", "Important" ), QLatin1String( "emblem-important" ), Theme::ContentItem::ImportantStateIcon, false, SortOrder::SortMessagesByImportantStatus );
729  add_theme_simple_icon_column( s, i18n( "Action Item" ), QLatin1String( "mail-task" ), Theme::ContentItem::ActionItemStateIcon, false, SortOrder::SortMessagesByActionItemStatus );
730  add_theme_simple_icon_column( s, i18n( "Spam/Ham" ), QLatin1String( "mail-mark-junk" ), Theme::ContentItem::SpamHamStateIcon, false, SortOrder::NoMessageSorting );
731  add_theme_simple_icon_column( s, i18n( "Watched/Ignored" ), QLatin1String( "mail-thread-watch" ), Theme::ContentItem::WatchedIgnoredStateIcon, false, SortOrder::NoMessageSorting );
732  add_theme_simple_icon_column( s, i18n( "Encryption" ), QLatin1String( "mail-encrypted-full" ), Theme::ContentItem::EncryptionStateIcon, false, SortOrder::NoMessageSorting );
733  add_theme_simple_icon_column( s, i18n( "Signature" ), QLatin1String( "mail-signed-verified" ), Theme::ContentItem::SignatureStateIcon, false, SortOrder::NoMessageSorting );
734  add_theme_simple_icon_column( s, i18n( "Tag List" ), QLatin1String( "feed-subscribe" ), Theme::ContentItem::TagList, false, SortOrder::NoMessageSorting );
735 
736  s->resetColumnState(); // so it's initially set from defaults
737 
738  addTheme( s );
739 
740  // The Fancy theme
741 
742  s = new Theme(
743  i18n( "Smart" ),
744  i18n( "A smart multiline and multi item theme" ), true /*readOnly*/
745  );
746 
747  c = new Theme::Column();
748  c->setLabel( i18n( "Message" ) );
749 
750  r = new Theme::Row();
751  i = new Theme::ContentItem( Theme::ContentItem::ExpandedStateIcon );
752  r->addLeftItem( i );
753  i = new Theme::ContentItem( Theme::ContentItem::GroupHeaderLabel );
754  QFont aBigFont = KGlobalSettings::generalFont();
755  aBigFont.setBold( true );
756  i->setFont( aBigFont );
757  i->setUseCustomFont( true );
758  r->addLeftItem( i );
759  c->addGroupHeaderRow( r );
760 
761  r = new Theme::Row();
762  i = new Theme::ContentItem( Theme::ContentItem::Subject );
763  r->addLeftItem( i );
764  i = new Theme::ContentItem( Theme::ContentItem::ReadStateIcon );
765  r->addRightItem( i );
766  i = new Theme::ContentItem( Theme::ContentItem::RepliedStateIcon );
767  i->setHideWhenDisabled( true );
768  r->addRightItem( i );
769  i = new Theme::ContentItem( Theme::ContentItem::AttachmentStateIcon );
770  i->setHideWhenDisabled( true );
771  r->addRightItem( i );
772  i = new Theme::ContentItem( Theme::ContentItem::AnnotationIcon );
773  i->setHideWhenDisabled( true );
774  r->addRightItem( i );
775  i = new Theme::ContentItem( Theme::ContentItem::InvitationIcon );
776  i->setHideWhenDisabled( true );
777  r->addRightItem( i );
778  i = new Theme::ContentItem( Theme::ContentItem::EncryptionStateIcon );
779  i->setHideWhenDisabled( true );
780  r->addRightItem( i );
781  i = new Theme::ContentItem( Theme::ContentItem::SignatureStateIcon );
782  i->setHideWhenDisabled( true );
783  r->addRightItem( i );
784  i = new Theme::ContentItem( Theme::ContentItem::TagList );
785  i->setHideWhenDisabled( true );
786  r->addRightItem( i );
787  c->addMessageRow( r );
788 
789  Theme::Row * firstFancyRow = r; // save it so we can continue adding stuff below (after cloning the theme)
790 
791  r = new Theme::Row();
792  i = new Theme::ContentItem( Theme::ContentItem::SenderOrReceiver );
793  i->setSoftenByBlending( true );
794  QFont aItalicFont = KGlobalSettings::generalFont();
795  aItalicFont.setItalic( true );
796  i->setFont( aItalicFont );
797  i->setUseCustomFont( true );
798  r->addLeftItem( i );
799  i = new Theme::ContentItem( Theme::ContentItem::Date );
800  i->setSoftenByBlending( true );
801  i->setFont( aItalicFont );
802  i->setUseCustomFont( true );
803  r->addRightItem( i );
804  c->addMessageRow( r );
805 
806  s->addColumn( c );
807 
808  // clone the "Fancy theme" here so we'll use it as starting point for the "Fancy with clickable status"
809  Theme * fancyWithClickableStatus = new Theme( *s );
810  fancyWithClickableStatus->detach();
811  fancyWithClickableStatus->generateUniqueId();
812 
813  // and continue the "Fancy" specific settings
814  r = firstFancyRow;
815 
816  i = new Theme::ContentItem( Theme::ContentItem::ActionItemStateIcon );
817  i->setHideWhenDisabled( true );
818  r->addRightItem( i );
819  i = new Theme::ContentItem( Theme::ContentItem::ImportantStateIcon );
820  i->setHideWhenDisabled( true );
821  r->addRightItem( i );
822  i = new Theme::ContentItem( Theme::ContentItem::SpamHamStateIcon );
823  i->setHideWhenDisabled( true );
824  r->addRightItem( i );
825  i = new Theme::ContentItem( Theme::ContentItem::WatchedIgnoredStateIcon );
826  i->setHideWhenDisabled( true );
827  r->addRightItem( i );
828 
829  s->setViewHeaderPolicy( Theme::NeverShowHeader );
830 
831  s->resetColumnState(); // so it's initially set from defaults
832 
833  addTheme( s );
834 
835 
836  // The "Fancy with Clickable Status" theme
837 
838  s = fancyWithClickableStatus;
839 
840  s->setName( i18n( "Smart with Clickable Status" ) );
841  s->setDescription( i18n( "A smart multiline and multi item theme with a clickable status column" ) );
842  s->setReadOnly( true );
843 
844  c = new Theme::Column();
845  c->setLabel( i18n( "Status" ) );
846  c->setVisibleByDefault( true );
847 
848  r = new Theme::Row();
849  i = new Theme::ContentItem( Theme::ContentItem::ActionItemStateIcon );
850  i->setSoftenByBlendingWhenDisabled( true );
851  r->addLeftItem( i );
852  i = new Theme::ContentItem( Theme::ContentItem::ImportantStateIcon );
853  i->setSoftenByBlendingWhenDisabled( true );
854  r->addLeftItem( i );
855  c->addMessageRow( r );
856 
857  r = new Theme::Row();
858  i = new Theme::ContentItem( Theme::ContentItem::SpamHamStateIcon );
859  i->setSoftenByBlendingWhenDisabled( true );
860  r->addLeftItem( i );
861  i = new Theme::ContentItem( Theme::ContentItem::WatchedIgnoredStateIcon );
862  i->setSoftenByBlendingWhenDisabled( true );
863  r->addLeftItem( i );
864  c->addMessageRow( r );
865 
866  s->addColumn( c );
867 
868  s->resetColumnState(); // so it's initially set from defaults
869 
870  addTheme( s );
871 }
872 
873 void Manager::removeAllThemes()
874 {
875  QHash< QString, Theme * >::ConstIterator end( mThemes.constEnd() );
876  for( QHash< QString, Theme * >::ConstIterator it = mThemes.constBegin(); it != end; ++it )
877  delete ( *it );
878 
879  mThemes.clear();
880 }
881 
882 void Manager::themesConfigurationCompleted()
883 {
884  if ( mThemes.isEmpty() )
885  createDefaultThemes(); // panic
886 
887  saveConfiguration(); // just to be sure :)
888 
889  // notify all the widgets that they should reload the option set combos
890  emit themesChanged();
891 }
892 
893 void Manager::reloadAllWidgets()
894 {
895 
896  QList< Widget * >::ConstIterator end( mWidgetList.constEnd() );
897  for( QList< Widget * >::ConstIterator it = mWidgetList.constBegin(); it != end; ++it )
898  {
899  if ( ( *it )->view() )
900  ( *it )->view()->reload();
901  }
902 }
903 
904 
905 void Manager::reloadGlobalConfiguration()
906 {
907  // This is called when configuration changes (probably edited by the options dialog)
908  const int oldDateFormat = (int)mDateFormatter->format();
909  const QString oldDateCustomFormat = mDateFormatter->customFormat();
910 
911  loadGlobalConfiguration();
912 
913  if (
914  ( oldDateFormat != (int)mDateFormatter->format() ) ||
915  ( oldDateCustomFormat != mDateFormatter->customFormat() )
916  )
917  reloadAllWidgets();
918 }
919 
920 
921 void Manager::loadGlobalConfiguration()
922 {
923  // Load the date format
924  const KMime::DateFormatter::FormatType type = static_cast<KMime::DateFormatter::FormatType>(
925  MessageCore::GlobalSettings::self()->dateFormat() );
926  mDateFormatter->setCustomFormat( MessageCore::GlobalSettings::self()->customDateFormat() );
927  mDateFormatter->setFormat( type );
928 }
929 
930 void Manager::loadConfiguration()
931 {
932  loadGlobalConfiguration();
933 
934  {
935  // load Aggregations
936 
937  KConfigGroup conf( Settings::self()->config(), "MessageListView::Aggregations" );
938 
939  mAggregations.clear();
940 
941  const int cnt = conf.readEntry( "Count", 0 );
942 
943  int idx = 0;
944  while ( idx < cnt )
945  {
946  const QString data = conf.readEntry( QString::fromLatin1( "Set%1" ).arg( idx ), QString() );
947  if ( !data.isEmpty() )
948  {
949  Aggregation * set = new Aggregation();
950  if ( set->loadFromString( data ) )
951  {
952  if ( Aggregation * old = mAggregations.value( set->id() ) )
953  delete old;
954  mAggregations.insert( set->id(), set );
955  } else {
956  delete set; // b0rken
957  }
958  }
959  idx++;
960  }
961 
962  if ( mAggregations.isEmpty() )
963  {
964  // don't allow zero configuration, create some presets
965  createDefaultAggregations();
966  }
967  }
968 
969  {
970  // load Themes
971 
972  KConfigGroup conf( Settings::self()->config(), "MessageListView::Themes" );
973 
974  mThemes.clear();
975 
976  const int cnt = conf.readEntry( "Count", 0 );
977 
978  int idx = 0;
979  while ( idx < cnt )
980  {
981  const QString data = conf.readEntry( QString::fromLatin1( "Set%1" ).arg( idx ), QString() );
982  if ( !data.isEmpty() )
983  {
984  Theme * set = new Theme();
985  if ( set->loadFromString( data ) )
986  {
987  if ( Theme * old = mThemes.value( set->id() ) )
988  delete old;
989  mThemes.insert( set->id(), set );
990  } else {
991  kWarning() << "Saved theme loading failed";
992  delete set; // b0rken
993  }
994  }
995  ++idx;
996  }
997 
998  if ( mThemes.isEmpty() )
999  {
1000  // don't allow zero configuration, create some presets
1001  createDefaultThemes();
1002  }
1003  }
1004 
1005 }
1006 
1007 void Manager::saveGlobalConfiguration()
1008 {
1009  Settings::self()->writeConfig();
1010 }
1011 
1012 void Manager::saveConfiguration()
1013 {
1014  saveGlobalConfiguration();
1015 
1016  {
1017  // store aggregations
1018 
1019  KConfigGroup conf( Settings::self()->config(), "MessageListView::Aggregations" );
1020  //conf.clear();
1021 
1022  conf.writeEntry( "Count", mAggregations.count() );
1023 
1024  int idx = 0;
1025  QHash< QString, Aggregation * >::ConstIterator end( mAggregations.end() );
1026  for( QHash< QString, Aggregation * >::ConstIterator it = mAggregations.constBegin(); it != end; ++it )
1027  {
1028  conf.writeEntry( QString::fromLatin1( "Set%1" ).arg( idx ), ( *it )->saveToString() );
1029  ++idx;
1030  }
1031  }
1032 
1033  {
1034  // store themes
1035 
1036  KConfigGroup conf( Settings::self()->config(), "MessageListView::Themes" );
1037  //conf.clear();
1038 
1039  conf.writeEntry( "Count", mThemes.count() );
1040 
1041  int idx = 0;
1042  QHash< QString, Theme * >::ConstIterator end( mThemes.constEnd() );
1043  for( QHash< QString, Theme * >::ConstIterator it = mThemes.constBegin(); it != end; ++it )
1044  {
1045  conf.writeEntry( QString::fromLatin1( "Set%1" ).arg( idx ), ( *it )->saveToString() );
1046  ++idx;
1047  }
1048  }
1049 
1050  Settings::self()->config()->sync();
1051 }
1052 
1053 
1054 #include "manager.moc"
MessageList::Core::Theme::ContentItem
The ContentItem class defines a content item inside a Row.
Definition: theme.h:73
MessageList::Core::Theme::ContentItem::InvitationIcon
Whether the message is an invitation.
Definition: theme.h:223
MessageList::Core::SortOrder::SortMessagesByDateTimeOfMostRecent
Sort the messages by date and time of the most recent message in subtree.
Definition: sortorder.h:82
MessageList::Core::Theme::ContentItem::ExpandedStateIcon
The Expanded state icon for group headers.
Definition: theme.h:186
MessageList::Core::SortOrder
A class which holds information about sorting, e.g.
Definition: sortorder.h:37
MessageList::Core::SortOrder::SortMessagesBySubject
Sort the messages by subject.
Definition: sortorder.h:86
MessageList::Core::Aggregation
A set of aggregation options that can be applied to the MessageList::Model in a single shot...
Definition: aggregation.h:43
MessageList::Core::Theme::ContentItem::ReadStateIcon
The icon that displays the unread/read state (never disabled)
Definition: theme.h:154
MessageList::Core::OptionSet::id
const QString & id() const
Returns the unique id of this OptionSet.
Definition: optionset.h:66
MessageList::Core::OptionSet::setDescription
void setDescription(const QString &description)
Sets the description for this option set.
Definition: optionset.h:94
MessageList::Core::Aggregation::PerfectReferencesAndSubject
Thread by all of the above and try to match subjects too.
Definition: aggregation.h:88
MessageList::Core::Aggregation::NoThreading
Perform no threading at all.
Definition: aggregation.h:85
MessageList::Core::Theme::Column::addMessageRow
void addMessageRow(Row *row)
Appends a message row to this theme column.
Definition: theme.h:785
MessageList::Core::Manager::reloadGlobalConfiguration
void reloadGlobalConfiguration()
Reloads the global configuration from the config files (so we assume it has changed) The settings pri...
Definition: manager.cpp:905
MessageList::Core::Theme::ContentItem::CombinedReadRepliedStateIcon
The combined icon that displays the unread/read/replied/forwarded state (never disabled) ...
Definition: theme.h:210
MessageList::Core::Manager::theme
const Theme * theme(const QString &id)
Definition: manager.cpp:483
MessageList::Core::Aggregation::ExpandRecentGroups
Makes sense only with GroupByDate or GroupByDateRange.
Definition: aggregation.h:73
MessageList::Core::StorageModel::id
virtual QString id() const =0
Returns an unique id for this Storage collection.
MessageList::Core::Manager::themesChanged
void themesChanged()
MessageList::Core::Widget
Provides a widget which has the messagelist and the most important helper widgets, like the search line and the comboboxes for changing status filtering, aggregation etc.
Definition: widgetbase.h:60
MessageList::Core::Theme::Row
The Row class defines a row of items inside a Column.
Definition: theme.h:466
MessageList::Core::Aggregation::GroupByDate
Group the messages by the date of the thread leader.
Definition: aggregation.h:55
MessageList::Core::Theme::Row::addRightItem
void addRightItem(ContentItem *item)
Adds a right aligned item to this row.
Definition: theme.h:525
MessageList::Core::Theme::ContentItem::AttachmentStateIcon
The icon that displays the atachment state (may be disabled)
Definition: theme.h:158
MessageList::Core::Theme::ContentItem::setSoftenByBlendingWhenDisabled
void setSoftenByBlendingWhenDisabled(bool softenByBlendingWhenDisabled)
Sets the flag that causes this item to be painted "softly" when disabled.
Definition: theme.h:389
MessageList::Util::storageModelSortOrderGroup
MESSAGELIST_EXPORT QString storageModelSortOrderGroup()
Definition: messagelistutil.cpp:58
MessageList::Core::Manager::removeAllThemes
void removeAllThemes()
Definition: manager.cpp:873
MessageList::Core::Aggregation::NeverExpandGroups
Never expand groups during a view fill algorithm.
Definition: aggregation.h:72
MessageList::Core::Aggregation::GroupByDateRange
Use smart (thread leader) date ranges ("Today","Yesterday","Last Week"...)
Definition: aggregation.h:56
model.h
theme.h
MessageList::Core::Theme::ContentItem::Sender
From: strip, always.
Definition: theme.h:142
MessageList::Core::Manager::addTheme
void addTheme(Theme *set)
Definition: manager.cpp:595
MessageList::Core::OptionSet::setReadOnly
void setReadOnly(bool b)
Definition: optionset.h:119
QObject
MessageList::Core::Theme::Row::addLeftItem
void addLeftItem(ContentItem *item)
Adds a left aligned item to this row.
Definition: theme.h:493
MessageList::Core::Theme::ContentItem::ImportantStateIcon
The Important tag icon.
Definition: theme.h:174
MessageList::Core::Theme::ContentItem::AnnotationIcon
Whether the message has a annotation/note.
Definition: theme.h:218
MessageList::Core::Theme::Column::setVisibleByDefault
void setVisibleByDefault(bool vbd)
Sets the "visible by default" tag for this column.
Definition: theme.h:718
MessageList::Core::Aggregation::NoGrouping
Don't group messages at all.
Definition: aggregation.h:54
MessageList::Core::Aggregation::TopmostMessage
The thread grouping is computed from the topmost message (very similar to least recent, but might be different if timezones or machine clocks are screwed)
Definition: aggregation.h:99
add_theme_simple_text_column
static Theme::Column * add_theme_simple_text_column(Theme *s, const QString &name, Theme::ContentItem::Type type, bool visibleByDefault, SortOrder::MessageSorting messageSorting, bool alignRight, bool addGroupHeaderItem)
Definition: manager.cpp:602
MessageList::Core::Manager::reloadAllWidgets
void reloadAllWidgets()
Explicitly reloads the contents of all the widgets.
Definition: manager.cpp:893
MessageList::Core::Manager::saveAggregationForStorageModel
void saveAggregationForStorageModel(const StorageModel *storageModel, const QString &id, bool storageUsesPrivateAggregation)
Definition: manager.cpp:214
MessageList::Core::Theme::Column
The Column class defines a view column available inside this theme.
Definition: theme.h:564
MessageList::Core::Theme::ContentItem::setFont
void setFont(const QFont &font)
Sets the custom font to be used with this item.
Definition: theme.cpp:166
MessageList::Core::Theme::ContentItem::RepliedStateIcon
The icon that displays the replied/forwarded state (may be disabled)
Definition: theme.h:162
MessageList::Core::SortOrder::SortMessagesByReceiver
Sort the messages by receiver.
Definition: sortorder.h:85
MessageList::Core::Theme::Column::setLabel
void setLabel(const QString &label)
Sets the label for this column.
Definition: theme.h:680
MessageList::Core::SortOrder::writeConfig
void writeConfig(KConfigGroup &conf, const QString &storageId, bool storageUsesPrivateSortOrder) const
Writes the sort order to a config group.
Definition: sortorder.cpp:243
MessageList::Core::Manager::defaultAggregation
const Aggregation * defaultAggregation()
Definition: manager.cpp:181
configurethemesdialog.h
MessageList::Core::Manager::themesConfigurationCompleted
void themesConfigurationCompleted()
This is called by the theme configuration dialog once the sets have been changed. ...
Definition: manager.cpp:882
view.h
MessageList::Core::Manager
: The manager for all the existing MessageList::Widget objects.
Definition: manager.h:61
MessageList::Core::Theme::ContentItem::Subject
Display the subject of the message item.
Definition: theme.h:130
MessageList::Core::SortOrder::MessageSorting
MessageSorting
The available message sorting options.
Definition: sortorder.h:78
MessageList::Core::Manager::defaultTheme
const Theme * defaultTheme()
Definition: manager.cpp:492
MessageList::Core::Settings::self
static Settings * self()
Definition: settings.cpp:70
MessageList::Core::Manager::unregisterWidget
static void unregisterWidget(Widget *pWidget)
Definition: manager.cpp:155
MessageList::Util::storageModelThemesGroup
MESSAGELIST_EXPORT QString storageModelThemesGroup()
Definition: messagelistutil.cpp:63
MessageList::Util::storageModelAggregationsGroup
MESSAGELIST_EXPORT QString storageModelAggregationsGroup()
Definition: messagelistutil.cpp:68
MessageList::Core::OptionSet::generateUniqueId
void generateUniqueId()
(Re)generates a (hopefully) unique identifier for this option set.
Definition: optionset.cpp:57
add_theme_simple_icon_column
static Theme::Column * add_theme_simple_icon_column(Theme *s, const QString &name, const QString &pixmapName, Theme::ContentItem::Type type, bool visibleByDefault, SortOrder::MessageSorting messageSorting)
Definition: manager.cpp:642
MessageList::Core::Theme::resetColumnState
void resetColumnState()
Resets the column state (visibility and width) to their default values (the "visible by default" ones...
Definition: theme.cpp:725
MessageList::Core::Manager::addAggregation
void addAggregation(Aggregation *set)
Definition: manager.cpp:281
MessageList::Core::Theme::ContentItem::Date
Formatted date time of the message/group.
Definition: theme.h:134
aggregation.h
MessageList::Core::Theme::ContentItem::Type
Type
The available ContentItem types.
Definition: theme.h:125
MessageList::Core::Theme::ContentItem::TagList
The list of MessageItem::Tag entries.
Definition: theme.h:214
MessageList::Core::Theme::NeverShowHeader
Definition: theme.h:909
MessageList::Core::OptionSet::loadFromString
bool loadFromString(const QString &data)
Attempts to unpack this configuration object from a string (that is likely to come out from a config ...
Definition: optionset.cpp:86
manager.h
MessageList::Util::setForStorageModelConfigName
MESSAGELIST_EXPORT QString setForStorageModelConfigName()
Definition: messagelistutil.cpp:74
MessageList::Core::Theme::ContentItem::Receiver
To: strip, always.
Definition: theme.h:146
MessageList::Core::Aggregation::FavorSpeed
Do larger chunks of work, zero intervals between chunks.
Definition: aggregation.h:127
MessageList::Core::Theme::ContentItem::Size
Formatted size of the message.
Definition: theme.h:150
MessageList::Core::SortOrder::SortMessagesBySender
Sort the messages by sender.
Definition: sortorder.h:84
MessageList::Core::OptionSet::setName
void setName(const QString &name)
Sets the name of this OptionSet.
Definition: optionset.h:80
MessageList::Core::Theme::ContentItem::SenderOrReceiver
From: or To: strip, depending on the folder settings.
Definition: theme.h:138
MessageList::Core::Aggregation::ExpandThreadsWithUnreadOrImportantMessages
Expand threads with "hot" messages (this includes new, unread, important, todo)
Definition: aggregation.h:115
MessageList::Core::Manager::registerWidget
static void registerWidget(Widget *pWidget)
Definition: manager.cpp:147
MessageList::Core::Aggregation::NeverExpandThreads
Never expand any thread, this is fast.
Definition: aggregation.h:111
MessageList::Core::StorageModel
The QAbstractItemModel based interface that you need to provide for your storage to work with Message...
Definition: storagemodelbase.h:45
MessageList::Core::SortOrder::readConfig
void readConfig(KConfigGroup &conf, const QString &storageId, bool *storageUsesPrivateSortOrder)
Reads the sort order from a config group.
Definition: sortorder.cpp:230
MessageList::Core::SortOrder::NoMessageSorting
Don't sort the messages at all.
Definition: sortorder.h:80
MessageList::Core::Aggregation::MostRecentMessage
The thread grouping is computed from the most recent message.
Definition: aggregation.h:100
configureaggregationsdialog_p.h
MessageList::Core::Theme::ContentItem::SpamHamStateIcon
The Spam/Ham state icon.
Definition: theme.h:178
MessageList::Core::Aggregation::FavorInteractivity
Do small chunks of work, small intervals between chunks to allow for UI event processing.
Definition: aggregation.h:126
MessageList::Core::SortOrder::SortMessagesBySenderOrReceiver
Sort the messages by sender or receiver.
Definition: sortorder.h:83
settings.h
messagelistutil.h
MessageList::Core::Theme::Column::setMessageSorting
void setMessageSorting(SortOrder::MessageSorting ms)
Sets the sort order for messages that we should switch to when clicking on this column's header (if v...
Definition: theme.h:738
MessageList::Core::Manager::aggregationsConfigurationCompleted
void aggregationsConfigurationCompleted()
This is called by the aggregation configuration dialog once the sets have been changed.
Definition: manager.cpp:450
MessageList::Core::Manager::themeForStorageModel
const Theme * themeForStorageModel(const Akonadi::Collection &col, bool *storageUsesPrivateTheme)
Definition: manager.cpp:545
MessageList::Core::Manager::aggregationsChanged
void aggregationsChanged()
configureaggregationsdialog.h
MessageList::Core::Theme::ContentItem::ActionItemStateIcon
The ActionItem state icon.
Definition: theme.h:170
MessageList::Core::SortOrder::SortMessagesByImportantStatus
Sort the messages By "Important" flags of status.
Definition: sortorder.h:90
MessageList::Core::Theme::ContentItem::setUseCustomFont
void setUseCustomFont(bool useCustomFont)
Makes this item use the custom font that can be set by setCustomFont().
Definition: theme.h:355
configurethemesdialog_p.h
MessageList::Core::Manager::saveThemeForStorageModel
void saveThemeForStorageModel(const StorageModel *storageModel, const QString &id, bool storageUsesPrivateTheme)
Definition: manager.cpp:526
MessageList::Core::Theme::ContentItem::setSoftenByBlending
void setSoftenByBlending(bool softenByBlending)
Sets the flag that causes this item to be painted "softly".
Definition: theme.h:403
MessageList::Core::Manager::sortOrderForStorageModel
const SortOrder sortOrderForStorageModel(const StorageModel *storageModel, bool *storageUsesPrivateSortOrder)
Definition: manager.cpp:461
widgetbase.h
MessageList::Core::SortOrder::SortMessagesByUnreadStatus
Sort the messages by the "Unread" flags of status.
Definition: sortorder.h:89
MessageList::Core::SortOrder::SortMessagesBySize
Sort the messages by size.
Definition: sortorder.h:87
MessageList::Core::SortOrder::SortMessagesByDateTime
Sort the messages by date and time.
Definition: sortorder.h:81
MessageList::Core::Theme::detach
void detach()
Detaches this object from the shared runtime data for columns.
Definition: theme.cpp:718
model_p.h
MessageList::Core::Theme::ContentItem::SignatureStateIcon
The Signature state icon for messages.
Definition: theme.h:194
MessageList::Core::Manager::~Manager
~Manager()
Definition: manager.cpp:105
MessageList::Core::Manager::removeAllAggregations
void removeAllAggregations()
Definition: manager.cpp:441
MessageList::Core::Theme
The Theme class defines the visual appearance of the MessageList.
Definition: theme.h:65
MessageList::Core::Manager::Manager
Manager()
Definition: manager.cpp:57
MessageList::Core::Manager::aggregationForStorageModel
const Aggregation * aggregationForStorageModel(const StorageModel *storageModel, bool *storageUsesPrivateAggregation)
Definition: manager.cpp:245
MessageList::Core::Theme::Column::setIsSenderOrReceiver
void setIsSenderOrReceiver(bool sor)
Marks this column as containing the "sender/receiver" field.
Definition: theme.h:706
MessageList::Core::Theme::ContentItem::GroupHeaderLabel
The group header label.
Definition: theme.h:166
MessageList::Core::Theme::addColumn
void addColumn(Column *column)
Appends a column to this theme.
Definition: theme.h:959
MessageList::Core::Theme::ContentItem::WatchedIgnoredStateIcon
The Watched/Ignored state icon.
Definition: theme.h:182
MessageList::Core::Theme::ContentItem::EncryptionStateIcon
The Encryption state icon for messages.
Definition: theme.h:190
MessageList::Core::Theme::ContentItem::MostRecentDate
The date of the most recent message in subtree.
Definition: theme.h:206
MessageList::Core::Aggregation::GroupBySenderOrReceiver
Group by sender (incoming) or receiver (outgoing) field.
Definition: aggregation.h:57
MessageList::Core::Theme::Column::addGroupHeaderRow
void addGroupHeaderRow(Row *row)
Appends a group header row to this theme.
Definition: theme.h:815
MessageList::Core::Theme::setViewHeaderPolicy
void setViewHeaderPolicy(ViewHeaderPolicy vhp)
Sets the ViewHeaderPolicy for this theme.
Definition: theme.h:1031
storagemodelbase.h
MessageList::Core::Manager::aggregation
const Aggregation * aggregation(const QString &id)
Definition: manager.cpp:172
MessageList::Core::SortOrder::SortMessagesByActionItemStatus
Sort the messages by the "Action Item" flag of status.
Definition: sortorder.h:88
MessageList::Core::Manager::saveSortOrderForStorageModel
void saveSortOrderForStorageModel(const StorageModel *storageModel, const SortOrder &order, bool storageUsesPrivateSortOrder)
Definition: manager.cpp:476
MessageList::Core::Theme::ContentItem::setHideWhenDisabled
void setHideWhenDisabled(bool hideWhenDisabled)
Sets the flag that causes this item to be hidden when disabled.
Definition: theme.h:372
MessageList::Core::Theme::Column::setPixmapName
void setPixmapName(const QString &pixmapName)
Sets the icon's name (used in SmallIcon) for this column.
Definition: theme.h:692
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messagelist

Skip menu "messagelist"
  • 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