• 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
widgetbase.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/widgetbase.h"
22 
23 #include "core/aggregation.h"
24 #include "core/theme.h"
25 #include "core/filter.h"
26 #include "core/manager.h"
27 #include "core/optionset.h"
28 #include "core/view.h"
29 #include "core/model.h"
30 #include "core/messageitem.h"
31 #include "core/storagemodelbase.h"
32 #include "core/settings.h"
33 
34 #include "utils/configureaggregationsdialog.h"
35 #include "utils/configurethemesdialog.h"
36 
37 #include <QActionGroup>
38 #include <QBoxLayout>
39 #include <QGridLayout>
40 #include <QHeaderView>
41 #include <QTimer>
42 #include <QToolButton>
43 #include <QVariant>
44 
45 #include <KDE/KAction>
46 #include <KDE/KComboBox>
47 #include <KDE/KConfig>
48 #include <KDE/KDebug>
49 #include <KDE/KIcon>
50 #include <KDE/KIconLoader>
51 #include <KDE/KLineEdit>
52 #include <KDE/KLocale>
53 #include <KDE/KMenu>
54 #include <KDE/KStandardDirs>
55 
56 #include <akonadi/collection.h>
57 #include <akonadi/kmime/messagestatus.h>
58 
59 using namespace MessageList::Core;
60 
61 class Widget::Private
62 {
63 public:
64  Private( Widget *owner )
65  : q( owner ), mView( 0 ), mSearchEdit( 0 ),
66  mSearchTimer( 0 ), mStatusFilterCombo( 0 ),
67  mOpenFullSearchButton( 0 ),
68  mLockSearch( 0 ),
69  mStorageModel( 0 ), mAggregation( 0 ),
70  mTheme( 0 ), mFilter( 0 ),
71  mStorageUsesPrivateTheme( false ),
72  mStorageUsesPrivateAggregation( false ),
73  mStorageUsesPrivateSortOrder( false ),
74  mFirstTagInComboIndex( -1 ) { }
75 
76 
82  void switchMessageSorting( SortOrder::MessageSorting messageSorting,
83  SortOrder::SortDirection sortDirection,
84  int logicalHeaderColumnIndex );
85 
93  void checkSortOrder( const StorageModel *storageModel );
94 
95  void setDefaultAggregationForStorageModel( const StorageModel * storageModel );
96  void setDefaultThemeForStorageModel( const StorageModel * storageModel );
97  void setDefaultSortOrderForStorageModel( const StorageModel * storageModel );
98  void applyFilter();
99 
100  Widget * const q;
101 
102  View *mView;
103  QString mLastAggregationId;
104  QString mLastThemeId;
105  KLineEdit *mSearchEdit;
106  QTimer *mSearchTimer;
107  KComboBox *mStatusFilterCombo;
108  QToolButton *mOpenFullSearchButton;
109  QToolButton *mLockSearch;
110  StorageModel * mStorageModel;
111  Aggregation * mAggregation;
113  Theme * mTheme;
114  SortOrder mSortOrder;
115  Filter * mFilter;
116  bool mStorageUsesPrivateTheme;
117  bool mStorageUsesPrivateAggregation;
118  bool mStorageUsesPrivateSortOrder;
119  int mFirstTagInComboIndex;
120  KUrl mCurrentFolderUrl;
121 };
122 
123 Widget::Widget( QWidget *pParent )
124  : QWidget( pParent ), d( new Private( this ) )
125 {
126  Manager::registerWidget( this );
127  connect( Manager::instance(), SIGNAL(aggregationsChanged()),
128  this, SLOT(aggregationsChanged()) );
129  connect( Manager::instance(), SIGNAL(themesChanged()),
130  this, SLOT(themesChanged()) );
131 
132  setAutoFillBackground( true );
133  setObjectName( QLatin1String( "messagelistwidget" ) );
134 
135  QGridLayout * g = new QGridLayout( this );
136  g->setMargin( 0 );
137  g->setSpacing( 0 );
138 
139  d->mLockSearch = new QToolButton( this );
140  d->mLockSearch->setCheckable( true );
141  d->mLockSearch->setText( i18nc( "@action:button", "Lock search" ) );
142  slotLockSearchClicked( false );
143  d->mLockSearch->setWhatsThis(
144  i18nc( "@info:whatsthis",
145  "Toggle this button if you want to keep your quick search "
146  "locked when moving to other folders or when narrowing the search "
147  "by message status." ) );
148 
149  d->mLockSearch->setVisible( Settings::self()->showQuickSearch() );
150  connect( d->mLockSearch, SIGNAL(toggled(bool)),
151  this, SLOT(slotLockSearchClicked(bool)) );
152  g->addWidget( d->mLockSearch, 0, 0 );
153 
154 
155  d->mSearchEdit = new KLineEdit( this );
156  d->mSearchEdit->setClickMessage( i18nc( "Search for messages.", "Search" ) );
157  d->mSearchEdit->setObjectName( QLatin1String( "quicksearch" ) );
158  d->mSearchEdit->setClearButtonShown( true );
159  d->mSearchEdit->setVisible( Settings::self()->showQuickSearch() );
160 
161  connect( d->mSearchEdit, SIGNAL(textEdited(QString)),
162  SLOT(searchEditTextEdited(QString)) );
163 
164  connect( d->mSearchEdit, SIGNAL(clearButtonClicked()),
165  SLOT(searchEditClearButtonClicked()) );
166 
167  g->addWidget( d->mSearchEdit, 0, 1 );
168 
169  // The status filter button. Will be populated later, as populateStatusFilterCombo() is virtual
170  d->mStatusFilterCombo = new KComboBox( this ) ;
171  d->mStatusFilterCombo->setVisible( Settings::self()->showQuickSearch() );
172  d->mStatusFilterCombo->setMaximumWidth(300);
173  defaultFilterStatus();
174  g->addWidget( d->mStatusFilterCombo, 0, 2 );
175 
176  // The "Open Full Search" button
177  d->mOpenFullSearchButton = new QToolButton( this );
178  d->mOpenFullSearchButton->setIcon( KIcon( QLatin1String( "edit-find-mail" ) ) );
179  d->mOpenFullSearchButton->setText( i18n( "Open Full Search" ) );
180  d->mOpenFullSearchButton->setToolTip( d->mOpenFullSearchButton->text() );
181  d->mOpenFullSearchButton->setVisible( Settings::self()->showQuickSearch() );
182  g->addWidget( d->mOpenFullSearchButton, 0, 3 );
183 
184  connect( d->mOpenFullSearchButton, SIGNAL(clicked()),
185  this, SIGNAL(fullSearchRequest()) );
186 
187 
188  d->mView = new View( this );
189  d->mView->setFrameStyle( QFrame::NoFrame );
190  d->mView->setSortOrder( &d->mSortOrder );
191  d->mView->setObjectName( QLatin1String( "messagealistview" ) );
192  g->addWidget( d->mView, 1, 0, 1, 6 );
193 
194  connect( d->mView->header(), SIGNAL(sectionClicked(int)),
195  SLOT(slotViewHeaderSectionClicked(int)) );
196 
197  g->setRowStretch( 1, 1 );
198  g->setColumnStretch( 0, 1 );
199 
200  d->mSearchEdit->setEnabled( false );
201  d->mStatusFilterCombo->setEnabled( false );
202 
203  d->mSearchTimer = 0;
204 }
205 
206 Widget::~Widget()
207 {
208  d->mView->setStorageModel( 0 );
209 
210  Manager::unregisterWidget( this );
211 
212  delete d->mSearchTimer;
213  delete d->mTheme;
214  delete d->mAggregation;
215  delete d->mFilter;
216  delete d->mStorageModel;
217 
218  delete d;
219 }
220 
221 void Widget::changeQuicksearchVisibility(bool show)
222 {
223  KLineEdit * const lineEdit = d->mSearchEdit;
224  QWidget * const comboBox = d->mStatusFilterCombo;
225  QWidget * const fullSearchButton = d->mOpenFullSearchButton;
226  if ( !show ) {
227  //if we hide it we do not want to apply the filter,
228  //otherwise someone is maybe stuck with x new emails
229  //and cannot read it because of filter
230  lineEdit->clear();
231 
232  //we focus the message list if we hide the searchbar
233  d->mView->setFocus( Qt::OtherFocusReason );
234  }
235  else {
236  // on show: we focus the lineedit for fast filtering
237  lineEdit->setFocus( Qt::OtherFocusReason );
238  if ( d->mFilter ) {
239  resetFilter();
240  }
241  }
242  lineEdit->setVisible( show );
243  comboBox->setVisible( show );
244  fullSearchButton->setVisible( show );
245  d->mLockSearch->setVisible( show );
246  Settings::self()->setShowQuickSearch( show );
247 }
248 
249 void Widget::defaultFilterStatus()
250 {
251  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "system-run" )), i18n( "Any Status" ), 0 );
252 
253  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-unread" )),
254  i18nc( "@action:inmenu Status of a message", "Unread" ),
255  Akonadi::MessageStatus::statusUnread().toQInt32() );
256 
257  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-replied" )),
258  i18nc( "@action:inmenu Status of a message", "Replied" ),
259  Akonadi::MessageStatus::statusReplied().toQInt32() );
260 
261  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-forwarded" )),
262  i18nc( "@action:inmenu Status of a message", "Forwarded" ),
263  Akonadi::MessageStatus::statusForwarded().toQInt32() );
264 
265  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "emblem-important" )),
266  i18nc( "@action:inmenu Status of a message", "Important"),
267  Akonadi::MessageStatus::statusImportant().toQInt32() );
268 
269  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-task" )),
270  i18nc( "@action:inmenu Status of a message", "Action Item" ),
271  Akonadi::MessageStatus::statusToAct().toQInt32() );
272 
273  d->mStatusFilterCombo->addItem( QIcon( KStandardDirs::locate( "data", QLatin1String( "messagelist/pics/mail-thread-watch.png" ) ) ),
274  i18nc( "@action:inmenu Status of a message", "Watched" ),
275  Akonadi::MessageStatus::statusWatched().toQInt32() );
276 
277  d->mStatusFilterCombo->addItem( QIcon( KStandardDirs::locate( "data", QLatin1String( "messagelist/pics/mail-thread-ignored.png" ) ) ),
278  i18nc( "@action:inmenu Status of a message", "Ignored" ),
279  Akonadi::MessageStatus::statusIgnored().toQInt32() );
280 
281  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-attachment" )),
282  i18nc( "@action:inmenu Status of a message", "Has Attachment" ),
283  Akonadi::MessageStatus::statusHasAttachment().toQInt32() );
284 
285  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-invitation" )),
286  i18nc( "@action:inmenu Status of a message", "Has Invitation" ),
287  Akonadi::MessageStatus::statusHasInvitation().toQInt32() );
288 
289  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-mark-junk" )),
290  i18nc( "@action:inmenu Status of a message", "Spam" ),
291  Akonadi::MessageStatus::statusSpam().toQInt32() );
292 
293  d->mStatusFilterCombo->addItem( SmallIcon(QLatin1String( "mail-mark-notjunk" )),
294  i18nc( "@action:inmenu Status of a message", "Ham" ),
295  Akonadi::MessageStatus::statusHam().toQInt32() );
296  d->mFirstTagInComboIndex = d->mStatusFilterCombo->count();
297 }
298 
299 void Widget::populateStatusFilterCombo()
300 {
301  const int currentIndex = (d->mStatusFilterCombo->currentIndex() != -1) ? d->mStatusFilterCombo->currentIndex() : 0;
302  disconnect( d->mStatusFilterCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(statusSelected(int)) );
303 
304  for (int i = d->mFirstTagInComboIndex; i < d->mStatusFilterCombo->count(); ++i) {
305  d->mStatusFilterCombo->removeItem(i);
306  }
307 
308  fillMessageTagCombo( d->mStatusFilterCombo );
309 
310  connect( d->mStatusFilterCombo, SIGNAL(currentIndexChanged(int)),
311  this, SLOT(statusSelected(int)) );
312 
313  d->mStatusFilterCombo->setCurrentIndex(currentIndex>=d->mStatusFilterCombo->count() ? 0 : currentIndex );
314 }
315 
316 MessageItem *Widget::currentMessageItem() const
317 {
318  return view()->currentMessageItem();
319 }
320 
321 Akonadi::MessageStatus Widget::currentFilterStatus() const
322 {
323  if ( d->mFilter )
324  return d->mFilter->status();
325  return Akonadi::MessageStatus();
326 }
327 
328 QString Widget::currentFilterSearchString() const
329 {
330  if ( d->mFilter )
331  return d->mFilter->searchString();
332  return QString();
333 }
334 
335 QString Widget::currentFilterTagId() const
336 {
337  if ( d->mFilter )
338  return d->mFilter->tagId();
339 
340  return QString();
341 }
342 
343 void Widget::Private::setDefaultAggregationForStorageModel( const StorageModel * storageModel )
344 {
345  const Aggregation * opt = Manager::instance()->aggregationForStorageModel( storageModel, &mStorageUsesPrivateAggregation );
346 
347  Q_ASSERT( opt );
348 
349  delete mAggregation;
350  mAggregation = new Aggregation( *opt );
351 
352  mView->setAggregation( mAggregation );
353 
354  mLastAggregationId = opt->id();
355 }
356 
357 void Widget::Private::setDefaultThemeForStorageModel( const StorageModel * storageModel )
358 {
359  const Theme * opt = Manager::instance()->themeForStorageModel( storageModel, &mStorageUsesPrivateTheme );
360 
361  Q_ASSERT( opt );
362 
363  delete mTheme;
364  mTheme = new Theme( *opt );
365 
366  mView->setTheme( mTheme );
367 
368  mLastThemeId = opt->id();
369 }
370 
371 void Widget::Private::checkSortOrder( const StorageModel *storageModel )
372 {
373  if ( storageModel && mAggregation && !mSortOrder.validForAggregation( mAggregation ) ) {
374  kDebug() << "Could not restore sort order for folder" << storageModel->id();
375  mSortOrder = SortOrder::defaultForAggregation( mAggregation, mSortOrder );
376 
377  // Change the global sort order if the sort order didn't fit the global aggregation.
378  // Otherwise, if it is a per-folder aggregation, make the sort order per-folder too.
379  if ( mStorageUsesPrivateAggregation )
380  mStorageUsesPrivateSortOrder = true;
381  if ( mStorageModel ) {
382  Manager::instance()->saveSortOrderForStorageModel( storageModel, mSortOrder,
383  mStorageUsesPrivateSortOrder );
384  }
385  switchMessageSorting( mSortOrder.messageSorting(), mSortOrder.messageSortDirection(), -1 );
386  }
387 
388 }
389 
390 void Widget::Private::setDefaultSortOrderForStorageModel( const StorageModel * storageModel )
391 {
392  // Load the sort order from config and update column headers
393  mSortOrder = Manager::instance()->sortOrderForStorageModel( storageModel, &mStorageUsesPrivateSortOrder );
394  switchMessageSorting( mSortOrder.messageSorting(), mSortOrder.messageSortDirection(), -1 );
395  checkSortOrder( storageModel );
396 }
397 
398 void Widget::saveCurrentSelection()
399 {
400  if ( d->mStorageModel )
401  {
402  // Save the current selection
403  MessageItem * lastSelectedMessageItem = d->mView->currentMessageItem( false );
404  if ( lastSelectedMessageItem ) {
405  d->mStorageModel->savePreSelectedMessage(
406  lastSelectedMessageItem ? lastSelectedMessageItem->uniqueId() : 0
407  );
408  }
409  }
410 }
411 
412 void Widget::setStorageModel( StorageModel * storageModel, PreSelectionMode preSelectionMode )
413 {
414  if ( storageModel == d->mStorageModel )
415  return; // nuthin to do here
416 
417  d->setDefaultAggregationForStorageModel( storageModel );
418  d->setDefaultThemeForStorageModel( storageModel );
419  d->setDefaultSortOrderForStorageModel( storageModel );
420 
421  if(!d->mLockSearch->isChecked()) {
422  if ( d->mSearchTimer ) {
423  d->mSearchTimer->stop();
424  delete d->mSearchTimer;
425  d->mSearchTimer = 0;
426  }
427 
428  d->mSearchEdit->clear();
429 
430  if ( d->mFilter ) {
431  resetFilter();
432  }
433  }
434  StorageModel * oldModel = d->mStorageModel;
435 
436  d->mStorageModel = storageModel;
437  d->mView->setStorageModel( d->mStorageModel, preSelectionMode );
438 
439  delete oldModel;
440 
441  d->mStatusFilterCombo->setEnabled( d->mStorageModel );
442  d->mSearchEdit->setEnabled( d->mStorageModel );
443 }
444 
445 StorageModel *Widget::storageModel() const
446 {
447  return d->mStorageModel;
448 }
449 
450 KLineEdit *Widget::quickSearch() const
451 {
452  return d->mSearchEdit;
453 }
454 
455 View *Widget::view() const
456 {
457  return d->mView;
458 }
459 
460 void Widget::themeMenuAboutToShow()
461 {
462  if ( !d->mStorageModel )
463  return;
464 
465  KMenu * menu = dynamic_cast< KMenu * >( sender() );
466  if ( !menu )
467  return;
468  themeMenuAboutToShow(menu);
469 }
470 
471 void Widget::themeMenuAboutToShow(KMenu *menu)
472 {
473  menu->clear();
474 
475  menu->addTitle( i18n( "Theme" ) );
476 
477  QActionGroup * grp = new QActionGroup( menu );
478 
479  QList< Theme * > sortedThemes = Manager::instance()->themes().values();
480 
481  QAction * act;
482 
483  qSort(sortedThemes.begin(),sortedThemes.end(),MessageList::Core::Theme::compareName);
484 
485  QList< Theme * >::ConstIterator endTheme( sortedThemes.constEnd() );
486  for ( QList< Theme * >::ConstIterator it = sortedThemes.constBegin(); it != endTheme; ++it )
487  {
488  act = menu->addAction( ( *it )->name() );
489  act->setCheckable( true );
490  grp->addAction( act );
491  act->setChecked( d->mLastThemeId == ( *it )->id() );
492  act->setData( QVariant( ( *it )->id() ) );
493  connect( act, SIGNAL(triggered(bool)),
494  SLOT(themeSelected(bool)) );
495  }
496 
497  menu->addSeparator();
498 
499  act = menu->addAction( i18n( "Configure..." ) );
500  connect( act, SIGNAL(triggered(bool)),
501  SLOT(configureThemes()) );
502 }
503 
504 void Widget::setPrivateSortOrderForStorage()
505 {
506  if ( !d->mStorageModel )
507  return;
508 
509  d->mStorageUsesPrivateSortOrder = !d->mStorageUsesPrivateSortOrder;
510 
511  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
512  d->mStorageUsesPrivateSortOrder );
513 }
514 
515 void Widget::configureThemes()
516 {
517  Utils::ConfigureThemesDialog *dialog = new Utils::ConfigureThemesDialog( window() );
518  dialog->selectTheme( d->mLastThemeId );
519  dialog->show();
520 }
521 
522 void Widget::themeSelected( bool )
523 {
524  if ( !d->mStorageModel )
525  return; // nuthin to do
526 
527  QAction * act = dynamic_cast< QAction * >( sender() );
528  if ( !act )
529  return;
530 
531  QVariant v = act->data();
532  const QString id = v.toString();
533 
534  if ( id.isEmpty() )
535  return;
536 
537  const Theme * opt = Manager::instance()->theme( id );
538 
539  delete d->mTheme;
540  d->mTheme = new Theme( *opt );
541 
542  d->mView->setTheme( d->mTheme );
543 
544  d->mLastThemeId = opt->id();
545 
546  //mStorageUsesPrivateTheme = false;
547 
548  Manager::instance()->saveThemeForStorageModel( d->mStorageModel, opt->id(), d->mStorageUsesPrivateTheme );
549 
550  d->mView->reload();
551 
552 }
553 
554 void Widget::aggregationMenuAboutToShow()
555 {
556  KMenu * menu = dynamic_cast< KMenu * >( sender() );
557  if ( !menu )
558  return;
559  aggregationMenuAboutToShow(menu);
560 }
561 
562 void Widget::aggregationMenuAboutToShow(KMenu *menu)
563 {
564  menu->clear();
565 
566  menu->addTitle( i18n( "Aggregation" ) );
567 
568  QActionGroup * grp = new QActionGroup( menu );
569 
570  QList< Aggregation * > sortedAggregations = Manager::instance()->aggregations().values();
571 
572  QAction * act;
573 
574  qSort(sortedAggregations.begin(),sortedAggregations.end(), MessageList::Core::Aggregation::compareName);
575 
576  QList<Aggregation * >::ConstIterator endagg( sortedAggregations.constEnd() );
577 
578  for ( QList< Aggregation * >::ConstIterator it = sortedAggregations.constBegin(); it != endagg; ++it ) {
579  act = menu->addAction( ( *it )->name() );
580  act->setCheckable( true );
581  grp->addAction( act );
582  act->setChecked( d->mLastAggregationId == ( *it )->id() );
583  act->setData( QVariant( ( *it )->id() ) );
584  connect( act, SIGNAL(triggered(bool)),
585  SLOT(aggregationSelected(bool)) );
586  }
587 
588  menu->addSeparator();
589 
590  act = menu->addAction( i18n( "Configure..." ) );
591  act->setData( QVariant( QString() ) );
592  connect( act, SIGNAL(triggered(bool)),
593  SLOT(aggregationSelected(bool)) );
594 }
595 
596 void Widget::aggregationSelected( bool )
597 {
598  QAction * act = dynamic_cast< QAction * >( sender() );
599  if ( !act )
600  return;
601 
602  QVariant v = act->data();
603  QString id = v.toString();
604 
605  if ( id.isEmpty() ) {
606  Utils::ConfigureAggregationsDialog *dialog = new Utils::ConfigureAggregationsDialog( window() );
607  dialog->selectAggregation( d->mLastAggregationId );
608  dialog->show();
609  return;
610  }
611 
612  if ( !d->mStorageModel )
613  return; // nuthin to do
614 
615  const Aggregation * opt = Manager::instance()->aggregation( id );
616 
617  delete d->mAggregation;
618  d->mAggregation = new Aggregation( *opt );
619 
620  d->mView->setAggregation( d->mAggregation );
621 
622  d->mLastAggregationId = opt->id();
623 
624  //mStorageUsesPrivateAggregation = false;
625 
626  Manager::instance()->saveAggregationForStorageModel( d->mStorageModel, opt->id(), d->mStorageUsesPrivateAggregation );
627 
628  // The sort order might not be valid anymore for this aggregation
629  d->checkSortOrder( d->mStorageModel );
630 
631  d->mView->reload();
632 
633 }
634 
635 void Widget::sortOrderMenuAboutToShow()
636 {
637  if ( !d->mAggregation )
638  return;
639 
640  KMenu * menu = dynamic_cast< KMenu * >( sender() );
641  if ( !menu )
642  return;
643  sortOrderMenuAboutToShow(menu);
644 }
645 
646 void Widget::sortOrderMenuAboutToShow(KMenu *menu)
647 {
648  menu->clear();
649 
650  menu->addTitle( i18n( "Message Sort Order" ) );
651 
652  QActionGroup * grp;
653  QAction * act;
654  QList< QPair< QString, int > > options;
655  QList< QPair< QString, int > >::ConstIterator it;
656 
657  grp = new QActionGroup( menu );
658 
659  options = SortOrder::enumerateMessageSortingOptions( d->mAggregation->threading() );
660  QList< QPair< QString, int > >::ConstIterator end( options.constEnd() );
661  for ( it = options.constBegin(); it != end; ++it ) {
662  act = menu->addAction( ( *it ).first );
663  act->setCheckable( true );
664  grp->addAction( act );
665  act->setChecked( d->mSortOrder.messageSorting() == ( *it ).second );
666  act->setData( QVariant( ( *it ).second ) );
667  }
668 
669  connect( grp, SIGNAL(triggered(QAction*)),
670  SLOT(messageSortingSelected(QAction*)) );
671 
672  options = SortOrder::enumerateMessageSortDirectionOptions( d->mSortOrder.messageSorting() );
673 
674  if ( options.size() >= 2 ) {
675  menu->addTitle( i18n( "Message Sort Direction" ) );
676 
677  grp = new QActionGroup( menu );
678  end = options.constEnd();
679  for ( it = options.constBegin(); it != end; ++it ) {
680  act = menu->addAction( ( *it ).first );
681  act->setCheckable( true );
682  grp->addAction( act );
683  act->setChecked( d->mSortOrder.messageSortDirection() == ( *it ).second );
684  act->setData( QVariant( ( *it ).second ) );
685  }
686 
687  connect( grp, SIGNAL(triggered(QAction*)),
688  SLOT(messageSortDirectionSelected(QAction*)) );
689  }
690 
691  options = SortOrder::enumerateGroupSortingOptions( d->mAggregation->grouping() );
692 
693  if ( options.size() >= 2 ) {
694  menu->addTitle( i18n( "Group Sort Order" ) );
695 
696  grp = new QActionGroup( menu );
697 
698  end = options.constEnd();
699  for ( it = options.constBegin(); it != end; ++it ) {
700  act = menu->addAction( ( *it ).first );
701  act->setCheckable( true );
702  grp->addAction( act );
703  act->setChecked( d->mSortOrder.groupSorting() == ( *it ).second );
704  act->setData( QVariant( ( *it ).second ) );
705  }
706 
707  connect( grp, SIGNAL(triggered(QAction*)),
708  SLOT(groupSortingSelected(QAction*)) );
709  }
710 
711  options = SortOrder::enumerateGroupSortDirectionOptions( d->mAggregation->grouping(),
712  d->mSortOrder.groupSorting() );
713 
714  if ( options.size() >= 2 ) {
715  menu->addTitle( i18n( "Group Sort Direction" ) );
716 
717  grp = new QActionGroup( menu );
718  end = options.constEnd();
719  for ( it = options.constBegin(); it != end; ++it ) {
720  act = menu->addAction( ( *it ).first );
721  act->setCheckable( true );
722  grp->addAction( act );
723  act->setChecked( d->mSortOrder.groupSortDirection() == ( *it ).second );
724  act->setData( QVariant( ( *it ).second ) );
725  }
726 
727  connect( grp, SIGNAL(triggered(QAction*)),
728  SLOT(groupSortDirectionSelected(QAction*)) );
729  }
730 
731  menu->addSeparator();
732  act = menu->addAction( i18n( "Folder Always Uses This Sort Order" ) );
733  act->setCheckable( true );
734  act->setChecked( d->mStorageUsesPrivateSortOrder );
735  connect( act, SIGNAL(triggered(bool)),
736  SLOT(setPrivateSortOrderForStorage()) );
737 }
738 
739 void Widget::Private::switchMessageSorting( SortOrder::MessageSorting messageSorting,
740  SortOrder::SortDirection sortDirection,
741  int logicalHeaderColumnIndex )
742 {
743  mSortOrder.setMessageSorting( messageSorting );
744  mSortOrder.setMessageSortDirection( sortDirection );
745 
746  // If the logicalHeaderColumnIndex was specified then we already know which
747  // column we should set the sort indicator to. If it wasn't specified (it's -1)
748  // then we need to find it out in the theme.
749 
750  if ( logicalHeaderColumnIndex == -1 )
751  {
752  // try to find the specified message sorting in the theme columns
753  const QList< Theme::Column * > & columns = mTheme->columns();
754  int idx = 0;
755 
756  // First try with a well defined message sorting.
757 
758  foreach( const Theme::Column* column, columns )
759  {
760  if ( !mView->header()->isSectionHidden( idx ) )
761  {
762  if ( column->messageSorting() == messageSorting )
763  {
764  // found a visible column with this message sorting
765  logicalHeaderColumnIndex = idx;
766  break;
767  }
768  }
769  ++idx;
770  }
771 
772  // if still not found, try again with a wider range
773  if ( logicalHeaderColumnIndex == -1 )
774  {
775  idx = 0;
776  foreach( const Theme::Column* column, columns )
777  {
778  if ( !mView->header()->isSectionHidden( idx ) )
779  {
780  if (
781  (
782  ( column->messageSorting() == SortOrder::SortMessagesBySenderOrReceiver ) ||
783  ( column->messageSorting() == SortOrder::SortMessagesByReceiver ) ||
784  ( column->messageSorting() == SortOrder::SortMessagesBySender )
785  ) &&
786  (
787  ( messageSorting == SortOrder::SortMessagesBySenderOrReceiver ) ||
788  ( messageSorting == SortOrder::SortMessagesByReceiver ) ||
789  ( messageSorting == SortOrder::SortMessagesBySender )
790  )
791  )
792  {
793  // found a visible column with this message sorting
794  logicalHeaderColumnIndex = idx;
795  break;
796  }
797  }
798  ++idx;
799  }
800  }
801  }
802 
803  if ( logicalHeaderColumnIndex == -1 )
804  {
805  // not found: either not a column-based sorting or the related column is hidden
806  mView->header()->setSortIndicatorShown( false );
807  return;
808  }
809 
810  mView->header()->setSortIndicatorShown( true );
811 
812  if ( sortDirection == SortOrder::Ascending )
813  mView->header()->setSortIndicator( logicalHeaderColumnIndex, Qt::AscendingOrder );
814  else
815  mView->header()->setSortIndicator( logicalHeaderColumnIndex, Qt::DescendingOrder );
816 }
817 
818 void Widget::messageSortingSelected( QAction *action )
819 {
820  if ( !d->mAggregation )
821  return;
822  if ( !action )
823  return;
824 
825  if ( !d->mStorageModel )
826  return;
827 
828  bool ok;
829  SortOrder::MessageSorting ord = static_cast< SortOrder::MessageSorting >( action->data().toInt( &ok ) );
830 
831  if ( !ok )
832  return;
833 
834  d->switchMessageSorting( ord, d->mSortOrder.messageSortDirection(), -1 );
835  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
836  d->mStorageUsesPrivateSortOrder );
837 
838  d->mView->reload();
839 
840 }
841 
842 void Widget::messageSortDirectionSelected( QAction *action )
843 {
844  if ( !d->mAggregation )
845  return;
846  if ( !action )
847  return;
848  if ( !d->mStorageModel )
849  return;
850 
851 
852  bool ok;
853  SortOrder::SortDirection ord = static_cast< SortOrder::SortDirection >( action->data().toInt( &ok ) );
854 
855  if ( !ok )
856  return;
857 
858  d->switchMessageSorting( d->mSortOrder.messageSorting(), ord, -1 );
859  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
860  d->mStorageUsesPrivateSortOrder );
861 
862  d->mView->reload();
863 
864 }
865 
866 void Widget::groupSortingSelected( QAction *action )
867 {
868  if ( !d->mAggregation )
869  return;
870  if ( !action )
871  return;
872 
873  if ( !d->mStorageModel )
874  return;
875 
876  bool ok;
877  SortOrder::GroupSorting ord = static_cast< SortOrder::GroupSorting >( action->data().toInt( &ok ) );
878 
879  if ( !ok )
880  return;
881 
882  d->mSortOrder.setGroupSorting( ord );
883  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
884  d->mStorageUsesPrivateSortOrder );
885 
886  d->mView->reload();
887 
888 }
889 
890 void Widget::groupSortDirectionSelected( QAction *action )
891 {
892  if ( !d->mAggregation )
893  return;
894  if ( !action )
895  return;
896  if ( !d->mStorageModel )
897  return;
898 
899 
900  bool ok;
901  SortOrder::SortDirection ord = static_cast< SortOrder::SortDirection >( action->data().toInt( &ok ) );
902 
903  if ( !ok )
904  return;
905 
906  d->mSortOrder.setGroupSortDirection( ord );
907  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
908  d->mStorageUsesPrivateSortOrder );
909 
910  d->mView->reload();
911 
912 }
913 
914 void Widget::resetFilter()
915 {
916  delete d->mFilter;
917  d->mFilter = 0;
918  d->mView->model()->setFilter( 0 );
919  d->mStatusFilterCombo->setCurrentIndex( 0 );
920  d->mLockSearch->setChecked(false);
921 }
922 
923 void Widget::slotLockSearchClicked( bool locked )
924 {
925  if ( locked ) {
926  d->mLockSearch->setIcon( KIcon( QLatin1String( "object-locked" ) ) );
927  d->mLockSearch->setToolTip( i18nc( "@info:tooltip", "Clear the quick search field when changing folders" ) );
928  } else {
929  d->mLockSearch->setIcon( KIcon( QLatin1String( "object-unlocked" ) ) );
930  d->mLockSearch->setToolTip( i18nc( "@info:tooltip",
931  "Prevent the quick search field from being cleared when changing folders" ) );
932  }
933 }
934 
935 void Widget::slotViewHeaderSectionClicked( int logicalIndex )
936 {
937  if ( !d->mTheme )
938  return;
939 
940  if ( !d->mAggregation )
941  return;
942 
943  if ( logicalIndex >= d->mTheme->columns().count() )
944  return;
945 
946  if ( !d->mStorageModel )
947  return;
948 
949 
950  const Theme::Column * column = d->mTheme->column( logicalIndex );
951  if ( !column )
952  return; // should never happen...
953 
954  if ( column->messageSorting() == SortOrder::NoMessageSorting )
955  return; // this is a null op.
956 
957 
958  if ( d->mSortOrder.messageSorting() == column->messageSorting() )
959  {
960  // switch sort direction
961  if ( d->mSortOrder.messageSortDirection() == SortOrder::Ascending )
962  d->switchMessageSorting( d->mSortOrder.messageSorting(), SortOrder::Descending, logicalIndex );
963  else
964  d->switchMessageSorting( d->mSortOrder.messageSorting(), SortOrder::Ascending, logicalIndex );
965  } else {
966  // keep sort direction but switch sort order
967  d->switchMessageSorting( column->messageSorting(), d->mSortOrder.messageSortDirection(), logicalIndex );
968  }
969  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
970  d->mStorageUsesPrivateSortOrder );
971 
972  d->mView->reload();
973 
974 }
975 
976 void Widget::themesChanged()
977 {
978  d->setDefaultThemeForStorageModel( d->mStorageModel );
979 
980  d->mView->reload();
981 }
982 
983 void Widget::aggregationsChanged()
984 {
985  d->setDefaultAggregationForStorageModel( d->mStorageModel );
986  d->checkSortOrder( d->mStorageModel );
987 
988  d->mView->reload();
989 }
990 
991 void Widget::fillMessageTagCombo( KComboBox* /*combo*/ )
992 {
993  // nothing here: must be overridden in derived classes
994 }
995 
996 void Widget::tagIdSelected( const QVariant& data )
997 {
998  QString tagId = data.toString();
999 
1000  // Here we arbitrairly set the status to 0, though we *could* allow filtering
1001  // by status AND tag...
1002 
1003  if ( d->mFilter )
1004  d->mFilter->setStatus( Akonadi::MessageStatus() );
1005 
1006  if ( tagId.isEmpty() )
1007  {
1008  if ( d->mFilter )
1009  {
1010  if ( d->mFilter->isEmpty() ) {
1011  resetFilter();
1012  return;
1013  }
1014  }
1015  } else {
1016  if ( !d->mFilter )
1017  d->mFilter = new Filter();
1018  d->mFilter->setTagId( tagId );
1019  }
1020 
1021  d->mView->model()->setFilter( d->mFilter );
1022 }
1023 
1024 void Widget::statusSelected( int index )
1025 {
1026  if ( index >= d->mFirstTagInComboIndex ) {
1027  tagIdSelected( d->mStatusFilterCombo->itemData( index ) );
1028  return;
1029  }
1030 
1031  bool ok;
1032 
1033  Akonadi::MessageStatus status;
1034  status.fromQInt32( static_cast< qint32 >( d->mStatusFilterCombo->itemData( index ).toInt( &ok ) ) );
1035 
1036  if ( !ok )
1037  return;
1038 
1039  // We also arbitrairly set tagId to an empty string, though we *could* allow filtering
1040  // by status AND tag...
1041  if ( d->mFilter )
1042  d->mFilter->setTagId( QString() );
1043 
1044  if ( status.isOfUnknownStatus() )
1045  {
1046  if ( d->mFilter )
1047  {
1048  d->mFilter->setStatus( Akonadi::MessageStatus() );
1049  if ( d->mFilter->isEmpty() ) {
1050  resetFilter();
1051  return;
1052  }
1053  }
1054  } else {
1055  // don't have this status bit
1056  if ( !d->mFilter )
1057  d->mFilter = new Filter();
1058  d->mFilter->setStatus( status );
1059  }
1060 
1061  d->mView->model()->setFilter( d->mFilter );
1062 }
1063 
1064 void Widget::searchEditTextEdited( const QString & )
1065 {
1066  // This slot is called whenever the user edits the search QLineEdit.
1067  // Since the user is likely to type more than one character
1068  // so we start the real search after a short delay in order to catch
1069  // multiple textEdited() signals.
1070 
1071  if ( !d->mSearchTimer )
1072  {
1073  d->mSearchTimer = new QTimer( this );
1074  connect( d->mSearchTimer, SIGNAL(timeout()),
1075  SLOT(searchTimerFired()) );
1076  } else {
1077  d->mSearchTimer->stop(); // eventually
1078  }
1079 
1080  d->mSearchTimer->setSingleShot( true );
1081  d->mSearchTimer->start( 1000 );
1082 
1083 }
1084 
1085 void Widget::searchTimerFired()
1086 {
1087  // A search is pending.
1088 
1089  if ( d->mSearchTimer )
1090  d->mSearchTimer->stop();
1091 
1092  if ( !d->mFilter )
1093  d->mFilter = new Filter();
1094 
1095  const QString text = d->mSearchEdit->text();
1096 
1097  d->mFilter->setCurrentFolder( d->mCurrentFolderUrl );
1098  d->mFilter->setSearchString( text );
1099  if ( d->mFilter->isEmpty() ) {
1100  resetFilter();
1101  return;
1102  }
1103 
1104  d->mView->model()->setFilter( d->mFilter );
1105 }
1106 
1107 void Widget::searchEditClearButtonClicked()
1108 {
1109  if ( !d->mFilter )
1110  return;
1111 
1112  resetFilter();
1113 
1114  d->mView->scrollTo( d->mView->currentIndex(), QAbstractItemView::PositionAtCenter );
1115 }
1116 
1117 void Widget::viewMessageSelected( MessageItem * )
1118 {
1119 }
1120 
1121 void Widget::viewMessageActivated( MessageItem * )
1122 {
1123 }
1124 
1125 void Widget::viewSelectionChanged()
1126 {
1127 }
1128 
1129 void Widget::viewMessageListContextPopupRequest( const QList< MessageItem * > &, const QPoint & )
1130 {
1131 }
1132 
1133 void Widget::viewGroupHeaderContextPopupRequest( GroupHeaderItem *, const QPoint & )
1134 {
1135 }
1136 
1137 void Widget::viewDragEnterEvent( QDragEnterEvent * )
1138 {
1139 }
1140 
1141 void Widget::viewDragMoveEvent( QDragMoveEvent * )
1142 {
1143 }
1144 
1145 void Widget::viewDropEvent( QDropEvent * )
1146 {
1147 }
1148 
1149 void Widget::viewStartDragRequest()
1150 {
1151 }
1152 
1153 void Widget::viewJobBatchStarted()
1154 {
1155 }
1156 
1157 void Widget::viewJobBatchTerminated()
1158 {
1159 }
1160 
1161 void Widget::viewMessageStatusChangeRequest( MessageItem *msg, const Akonadi::MessageStatus &set, const Akonadi::MessageStatus &clear )
1162 {
1163  Q_UNUSED( msg );
1164  Q_UNUSED( set );
1165  Q_UNUSED( clear );
1166 }
1167 
1168 void Widget::focusQuickSearch()
1169 {
1170  d->mSearchEdit->setFocus();
1171 }
1172 
1173 bool Widget::isThreaded() const
1174 {
1175  return d->mView->isThreaded();
1176 }
1177 
1178 bool Widget::selectionEmpty() const
1179 {
1180  return d->mView->selectionEmpty();
1181 }
1182 
1183 void Widget::setCurrentFolder( const Akonadi::Collection &collection )
1184 {
1185  d->mCurrentFolderUrl = collection.url( Akonadi::Collection::UrlShort );
1186 }
1187 
1188 bool Widget::searchEditHasFocus() const
1189 {
1190  return d->mSearchEdit->hasFocus();
1191 }
1192 
1193 #include "widgetbase.moc"
MessageList::Core::Widget::aggregationSelected
void aggregationSelected(bool)
Definition: widgetbase.cpp:596
MessageList::Core::Widget::messageSortingSelected
void messageSortingSelected(QAction *action)
Definition: widgetbase.cpp:818
MessageList::Core::Widget::viewJobBatchStarted
virtual void viewJobBatchStarted()
This is called by View to signal a start of a (possibly lengthy) job batch.
Definition: widgetbase.cpp:1153
MessageList::Core::SortOrder
A class which holds information about sorting, e.g.
Definition: sortorder.h:37
MessageList::Core::Manager::aggregations
const QHash< QString, Aggregation * > & aggregations() const
Definition: manager.h:204
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::GroupHeaderItem
Definition: groupheaderitem.h:34
MessageList::Core::OptionSet::id
const QString & id() const
Returns the unique id of this OptionSet.
Definition: optionset.h:66
MessageList::Core::Widget::viewStartDragRequest
virtual void viewStartDragRequest()
This is called by View when a drag can possibly be started.
Definition: widgetbase.cpp:1149
MessageList::Core::Widget::saveCurrentSelection
void saveCurrentSelection()
Definition: widgetbase.cpp:398
MessageList::Core::Widget::viewDropEvent
virtual void viewDropEvent(QDropEvent *e)
This is called by View when a drop event is received.
Definition: widgetbase.cpp:1145
MessageList::Core::Aggregation::compareName
static bool compareName(Aggregation *agg1, Aggregation *agg2)
Definition: aggregation.h:153
MessageList::Core::MessageItem
Definition: messageitem.h:50
MessageList::Utils::ConfigureAggregationsDialog
The dialog used for configuring MessageList::Aggregation sets.
Definition: configureaggregationsdialog.h:51
MessageList::Core::Theme::Column::messageSorting
SortOrder::MessageSorting messageSorting() const
Returns the sort order for messages that we should switch to when clicking on this column's header (i...
Definition: theme.h:731
filter.h
MessageList::Core::Manager::theme
const Theme * theme(const QString &id)
Definition: manager.cpp:483
MessageList::Core::StorageModel::id
virtual QString id() const =0
Returns an unique id for this Storage collection.
MessageList::Core::Widget::themeSelected
void themeSelected(bool)
Definition: widgetbase.cpp:522
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
QWidget
MessageList::Core::Widget::quickSearch
KLineEdit * quickSearch() const
Returns the search line of this widget.
Definition: widgetbase.cpp:450
MessageList::Core::Widget::view
View * view() const
Returns the View attached to this Widget.
Definition: widgetbase.cpp:455
model.h
theme.h
MessageList::Core::Widget::focusQuickSearch
void focusQuickSearch()
Sets the focus on the quick search line of the currently active tab.
Definition: widgetbase.cpp:1168
MessageList::Core::View
The MessageList::View is the real display of the message list.
Definition: view.h:64
MessageList::Core::View::currentMessageItem
MessageItem * currentMessageItem(bool selectIfNeeded=true) const
Returns the current MessageItem (that is bound to current StorageModel).
Definition: view.cpp:866
MessageList::Core::Widget::isThreaded
bool isThreaded() const
Returns true if the current Aggregation is threaded, false otherwise (or if there is no current Aggre...
Definition: widgetbase.cpp:1173
optionset.h
MessageList::Core::Widget::groupSortDirectionSelected
void groupSortDirectionSelected(QAction *action)
Definition: widgetbase.cpp:890
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::SortOrder::SortDirection
SortDirection
The "generic" sort direction: used for groups and for messages If you add values here please look at ...
Definition: sortorder.h:67
MessageList::Core::Widget::currentFilterSearchString
QString currentFilterSearchString() const
Returns the search term in the current quicksearch field.
Definition: widgetbase.cpp:328
MessageList::Core::SortOrder::SortMessagesByReceiver
Sort the messages by receiver.
Definition: sortorder.h:85
MessageList::Core::Widget::~Widget
~Widget()
Definition: widgetbase.cpp:206
MessageList::Core::MessageItem::uniqueId
unsigned long uniqueId() const
Definition: messageitem.cpp:560
MessageList::Core::SortOrder::enumerateMessageSortDirectionOptions
static QList< QPair< QString, int > > enumerateMessageSortDirectionOptions(MessageSorting ms)
Enumerates the available message sorting directions for the specified MessageSorting option...
Definition: sortorder.cpp:56
configurethemesdialog.h
messageitem.h
MessageList::Core::Widget::changeQuicksearchVisibility
void changeQuicksearchVisibility(bool)
Shows or hides the quicksearch field, the filter combobox and the toolbutton for advanced search...
Definition: widgetbase.cpp:221
view.h
MessageList::Core::Widget::slotViewHeaderSectionClicked
void slotViewHeaderSectionClicked(int logicalIndex)
Handles header section clicks switching the Aggregation MessageSorting on-the-fly.
Definition: widgetbase.cpp:935
MessageList::Core::Widget::searchEditClearButtonClicked
void searchEditClearButtonClicked()
Definition: widgetbase.cpp:1107
MessageList::Core::Widget::resetFilter
void resetFilter()
Definition: widgetbase.cpp:914
MessageList::Core::SortOrder::MessageSorting
MessageSorting
The available message sorting options.
Definition: sortorder.h:78
MessageList::Core::Widget::currentFilterTagId
QString currentFilterTagId() const
Returns the id of the MessageItem::Tag currently set in the quicksearch field.
Definition: widgetbase.cpp:335
MessageList::Core::Settings::self
static Settings * self()
Definition: settings.cpp:70
MessageList::Core::Widget::aggregationMenuAboutToShow
void aggregationMenuAboutToShow()
Definition: widgetbase.cpp:554
MessageList::Core::Manager::unregisterWidget
static void unregisterWidget(Widget *pWidget)
Definition: manager.cpp:155
MessageList::Core::Widget::setStorageModel
void setStorageModel(StorageModel *storageModel, PreSelectionMode preSelectionMode=PreSelectLastSelected)
Sets the storage model for this Widget.
Definition: widgetbase.cpp:412
MessageList::Core::PreSelectionMode
PreSelectionMode
Pre-selection is the action of automatically selecting a message just after the folder has finished l...
Definition: enums.h:44
MessageList::Core::Widget::configureThemes
void configureThemes()
Definition: widgetbase.cpp:515
aggregation.h
MessageList::Core::Manager::instance
static Manager * instance()
Definition: manager.h:111
MessageList::Core::SortOrder::enumerateGroupSortDirectionOptions
static QList< QPair< QString, int > > enumerateGroupSortDirectionOptions(Aggregation::Grouping g, GroupSorting groupSorting)
Enumerates the group sort direction options compatible with the specified Grouping and GroupSorting...
Definition: sortorder.cpp:100
MessageList::Utils::ConfigureAggregationsDialog::selectAggregation
void selectAggregation(const QString &aggregationId)
Definition: configureaggregationsdialog.cpp:182
manager.h
MessageList::Core::SortOrder::Descending
Definition: sortorder.h:70
MessageList::Core::Widget::currentFilterStatus
Akonadi::MessageStatus currentFilterStatus() const
Returns the Akonadi::MessageStatus in the current quicksearch field.
Definition: widgetbase.cpp:321
MessageList::Core::Widget::viewJobBatchTerminated
virtual void viewJobBatchTerminated()
This is called by View to signal the end of a (possibly lengthy) job batch.
Definition: widgetbase.cpp:1157
MessageList::Core::Widget::viewGroupHeaderContextPopupRequest
virtual void viewGroupHeaderContextPopupRequest(GroupHeaderItem *group, const QPoint &globalPos)
This is called by View when a group header is right clicked.
Definition: widgetbase.cpp:1133
MessageList::Core::Widget::tagIdSelected
void tagIdSelected(const QVariant &data)
Definition: widgetbase.cpp:996
MessageList::Core::SortOrder::SortMessagesBySender
Sort the messages by sender.
Definition: sortorder.h:84
MessageList::Core::Widget::fullSearchRequest
void fullSearchRequest()
Emitted when a full search is requested.
MessageList::Core::Widget::viewMessageSelected
virtual void viewMessageSelected(MessageItem *msg)
This is called by View when a message is single-clicked (thus selected and made current) ...
Definition: widgetbase.cpp:1117
MessageList::Core::Manager::registerWidget
static void registerWidget(Widget *pWidget)
Definition: manager.cpp:147
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::defaultForAggregation
static SortOrder defaultForAggregation(const Aggregation *aggregation, const SortOrder &oldSortOrder)
Returns the default sort order for the given aggregation.
Definition: sortorder.cpp:154
MessageList::Core::Widget::Widget
Widget(QWidget *parent)
Definition: widgetbase.cpp:123
MessageList::Core::SortOrder::NoMessageSorting
Don't sort the messages at all.
Definition: sortorder.h:80
MessageList::Core::Widget::selectionEmpty
bool selectionEmpty() const
Fast function that determines if the selection is empty.
Definition: widgetbase.cpp:1178
MessageList::Core::SortOrder::GroupSorting
GroupSorting
How to sort the groups If you add values here please look at the implementations of the enumerate* fu...
Definition: sortorder.h:51
MessageList::Core::SortOrder::SortMessagesBySenderOrReceiver
Sort the messages by sender or receiver.
Definition: sortorder.h:83
settings.h
MessageList::Core::Widget::viewDragEnterEvent
virtual void viewDragEnterEvent(QDragEnterEvent *e)
This is called by View when a drag enter event is received.
Definition: widgetbase.cpp:1137
MessageList::Core::Widget::View
friend class View
Definition: widgetbase.h:62
MessageList::Core::Widget::sortOrderMenuAboutToShow
void sortOrderMenuAboutToShow()
Definition: widgetbase.cpp:635
MessageList::Core::Manager::themeForStorageModel
const Theme * themeForStorageModel(const Akonadi::Collection &col, bool *storageUsesPrivateTheme)
Definition: manager.cpp:545
MessageList::Core::SortOrder::Ascending
Definition: sortorder.h:69
configureaggregationsdialog.h
MessageList::Core::Theme::compareName
static bool compareName(Theme *theme1, Theme *theme2)
Definition: theme.h:872
MessageList::Core::Widget::themesChanged
void themesChanged()
This is called by Manager when the option sets stored within have changed.
Definition: widgetbase.cpp:976
MessageList::Core::SortOrder::enumerateMessageSortingOptions
static QList< QPair< QString, int > > enumerateMessageSortingOptions(Aggregation::Threading t)
Enumerates the message sorting options compatible with the specified Threading setting.
Definition: sortorder.cpp:38
MessageList::Core::Manager::saveThemeForStorageModel
void saveThemeForStorageModel(const StorageModel *storageModel, const QString &id, bool storageUsesPrivateTheme)
Definition: manager.cpp:526
MessageList::StorageModel
The Akonadi specific implementation of the Core::StorageModel.
Definition: storagemodel.h:48
MessageList::Core::Filter
This class is responsable of matching messages that should be displayed in the View.
Definition: filter.h:51
KComboBox
MessageList::Core::Manager::sortOrderForStorageModel
const SortOrder sortOrderForStorageModel(const StorageModel *storageModel, bool *storageUsesPrivateSortOrder)
Definition: manager.cpp:461
widgetbase.h
MessageList::Core::Widget::searchEditTextEdited
void searchEditTextEdited(const QString &text)
Definition: widgetbase.cpp:1064
MessageList::Core::Widget::currentMessageItem
Core::MessageItem * currentMessageItem() const
Returns the current MessageItem in the current folder.
Definition: widgetbase.cpp:316
MessageList::Core::Widget::slotLockSearchClicked
void slotLockSearchClicked(bool b)
Definition: widgetbase.cpp:923
MessageList::Core::Widget::themeMenuAboutToShow
void themeMenuAboutToShow()
Definition: widgetbase.cpp:460
MessageList::Core::Widget::messageSortDirectionSelected
void messageSortDirectionSelected(QAction *action)
Definition: widgetbase.cpp:842
MessageList::Core::Widget::viewDragMoveEvent
virtual void viewDragMoveEvent(QDragMoveEvent *e)
This is called by View when a drag move event is received.
Definition: widgetbase.cpp:1141
MessageList::Core::Widget::searchEditHasFocus
bool searchEditHasFocus() const
Definition: widgetbase.cpp:1188
MessageList::Core::Theme
The Theme class defines the visual appearance of the MessageList.
Definition: theme.h:65
MessageList::Utils::ConfigureThemesDialog
Definition: configurethemesdialog.h:45
MessageList::Core::Widget::viewSelectionChanged
virtual void viewSelectionChanged()
This is called by View when selection changes.
Definition: widgetbase.cpp:1125
MessageList::Core::Manager::aggregationForStorageModel
const Aggregation * aggregationForStorageModel(const StorageModel *storageModel, bool *storageUsesPrivateAggregation)
Definition: manager.cpp:245
MessageList::Core::Widget::viewMessageListContextPopupRequest
virtual void viewMessageListContextPopupRequest(const QList< MessageItem * > &selectedItems, const QPoint &globalPos)
This is called by View when a message is right clicked.
Definition: widgetbase.cpp:1129
MessageList::Core::Widget::aggregationsChanged
void aggregationsChanged()
This is called by Manager when the option sets stored within have changed.
Definition: widgetbase.cpp:983
MessageList::Utils::ConfigureThemesDialog::selectTheme
void selectTheme(const QString &themeId)
Definition: configurethemesdialog.cpp:179
MessageList::Core::Widget::statusSelected
void statusSelected(int index)
Definition: widgetbase.cpp:1024
MessageList::Core::Widget::populateStatusFilterCombo
void populateStatusFilterCombo()
This is called to setup the status filter's KComboBox.
Definition: widgetbase.cpp:299
MessageList::Core::Widget::setPrivateSortOrderForStorage
void setPrivateSortOrderForStorage()
Definition: widgetbase.cpp:504
MessageList::Core::Widget::storageModel
StorageModel * storageModel() const
Returns the StorageModel currently set.
Definition: widgetbase.cpp:445
MessageList::Core::Widget::viewMessageStatusChangeRequest
virtual void viewMessageStatusChangeRequest(MessageItem *msg, const Akonadi::MessageStatus &set, const Akonadi::MessageStatus &clear)
This is called by View when a message item is manipulated by the user in a way that it's status shoul...
Definition: widgetbase.cpp:1161
storagemodelbase.h
MessageList::Core::Manager::aggregation
const Aggregation * aggregation(const QString &id)
Definition: manager.cpp:172
MessageList::Core::Settings::setShowQuickSearch
static void setShowQuickSearch(bool v)
Set ShowQuickSearch.
Definition: settings.cpp:186
MessageList::Core::Widget::viewMessageActivated
virtual void viewMessageActivated(MessageItem *msg)
This is called by View when a message is double-clicked or activated by other input means...
Definition: widgetbase.cpp:1121
MessageList::Core::Manager::saveSortOrderForStorageModel
void saveSortOrderForStorageModel(const StorageModel *storageModel, const SortOrder &order, bool storageUsesPrivateSortOrder)
Definition: manager.cpp:476
MessageList::Core::Widget::setCurrentFolder
void setCurrentFolder(const Akonadi::Collection &collection)
Sets the current folder.
Definition: widgetbase.cpp:1183
MessageList::Core::Manager::themes
const QHash< QString, Theme * > & themes() const
Definition: manager.h:234
MessageList::Core::Widget::searchTimerFired
void searchTimerFired()
Definition: widgetbase.cpp:1085
MessageList::Core::Widget::groupSortingSelected
void groupSortingSelected(QAction *action)
Definition: widgetbase.cpp:866
MessageList::Core::SortOrder::enumerateGroupSortingOptions
static QList< QPair< QString, int > > enumerateGroupSortingOptions(Aggregation::Grouping g)
Enumerates the group sorting options compatible with the specified Grouping.
Definition: sortorder.cpp:78
MessageList::Core::Widget::fillMessageTagCombo
virtual void fillMessageTagCombo(KComboBox *combo)
Called when the "Message Status/Tag" filter menu is opened by the user.
Definition: widgetbase.cpp:991
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