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

messagelist

  • sources
  • kde-4.14
  • 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 #include "core/widgets/quicksearchwarning.h"
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 ),
66  quickSearchLine( 0 ),
67  mView( 0 ),
68  mSearchTimer( 0 ),
69  mStorageModel( 0 ), mAggregation( 0 ),
70  mTheme( 0 ), mFilter( 0 ),
71  mStorageUsesPrivateTheme( false ),
72  mStorageUsesPrivateAggregation( false ),
73  mStorageUsesPrivateSortOrder( false ),
74  mStatusFilterComboPopulationInProgress( false )
75  { }
76 
77 
83  void switchMessageSorting( SortOrder::MessageSorting messageSorting,
84  SortOrder::SortDirection sortDirection,
85  int logicalHeaderColumnIndex );
86 
94  void checkSortOrder( const StorageModel *storageModel );
95 
96  void setDefaultAggregationForStorageModel( const StorageModel * storageModel );
97  void setDefaultThemeForStorageModel( const StorageModel * storageModel );
98  void setDefaultSortOrderForStorageModel( const StorageModel * storageModel );
99  void applyFilter();
100 
101  Widget * const q;
102 
103  QuickSearchWarning *quickSearchWarning;
104  QuickSearchLine *quickSearchLine;
105  View *mView;
106  QString mLastAggregationId;
107  QString mLastThemeId;
108  QTimer *mSearchTimer;
109  StorageModel * mStorageModel;
110  Aggregation * mAggregation;
112  Theme * mTheme;
113  SortOrder mSortOrder;
114  Filter * mFilter;
115  bool mStorageUsesPrivateTheme;
116  bool mStorageUsesPrivateAggregation;
117  bool mStorageUsesPrivateSortOrder;
118  KUrl mCurrentFolderUrl;
119  Akonadi::Collection mCurrentFolder;
120  int mCurrentStatusFilterIndex;
121  bool mStatusFilterComboPopulationInProgress;
122 };
123 
124 Widget::Widget( QWidget *pParent )
125  : QWidget( pParent ), d( new Private( this ) )
126 {
127  Manager::registerWidget( this );
128  connect( Manager::instance(), SIGNAL(aggregationsChanged()),
129  this, SLOT(aggregationsChanged()) );
130  connect( Manager::instance(), SIGNAL(themesChanged()),
131  this, SLOT(themesChanged()) );
132 
133  setAutoFillBackground( true );
134  setObjectName( QLatin1String( "messagelistwidget" ) );
135 
136  QVBoxLayout * g = new QVBoxLayout( this );
137  g->setMargin( 0 );
138  g->setSpacing( 0 );
139 
140  d->quickSearchLine = new QuickSearchLine;
141  d->quickSearchLine->setObjectName(QLatin1String("quicksearchline"));
142  connect(d->quickSearchLine, SIGNAL(clearButtonClicked()), SLOT(searchEditClearButtonClicked()) );
143 
144  connect(d->quickSearchLine, SIGNAL(searchEditTextEdited(QString)), SLOT(searchEditTextEdited()) );
145  connect(d->quickSearchLine, SIGNAL(searchOptionChanged()), SLOT(searchEditTextEdited()) );
146  connect(d->quickSearchLine, SIGNAL(statusButtonsClicked()), SLOT(slotStatusButtonsClicked()));
147  g->addWidget( d->quickSearchLine, 0 );
148  d->quickSearchWarning = new QuickSearchWarning(this);
149  g->addWidget( d->quickSearchWarning, 0 );
150  d->mView = new View( this );
151  d->mView->setFrameStyle( QFrame::NoFrame );
152  d->mView->setSortOrder( &d->mSortOrder );
153  d->mView->setObjectName( QLatin1String( "messagealistview" ) );
154  g->addWidget( d->mView, 1 );
155 
156  connect( d->mView->header(), SIGNAL(sectionClicked(int)),
157  SLOT(slotViewHeaderSectionClicked(int)) );
158  d->mSearchTimer = 0;
159 }
160 
161 Widget::~Widget()
162 {
163  d->mView->setStorageModel( 0 );
164 
165  Manager::unregisterWidget( this );
166 
167  delete d->mSearchTimer;
168  delete d->mTheme;
169  delete d->mAggregation;
170  delete d->mFilter;
171  delete d->mStorageModel;
172 
173  delete d;
174 }
175 
176 void Widget::changeQuicksearchVisibility(bool show)
177 {
178  KLineEdit * const lineEdit = d->quickSearchLine->searchEdit();
179  if ( !show ) {
180  //if we hide it we do not want to apply the filter,
181  //otherwise someone is maybe stuck with x new emails
182  //and cannot read it because of filter
183  lineEdit->clear();
184 
185  //we focus the message list if we hide the searchbar
186  d->mView->setFocus( Qt::OtherFocusReason );
187  }
188  else {
189  // on show: we focus the lineedit for fast filtering
190  lineEdit->setFocus( Qt::OtherFocusReason );
191  if ( d->mFilter ) {
192  resetFilter();
193  }
194  }
195  d->quickSearchLine->changeQuicksearchVisibility(show);
196  Settings::self()->setShowQuickSearch( show );
197 }
198 
199 void Widget::populateStatusFilterCombo()
200 {
201  if (d->mStatusFilterComboPopulationInProgress) {
202  return;
203  }
204  d->mStatusFilterComboPopulationInProgress = true;
205  KComboBox *tagFilterComboBox = d->quickSearchLine->tagFilterComboBox();
206  d->mCurrentStatusFilterIndex = (tagFilterComboBox->currentIndex() != -1) ? tagFilterComboBox->currentIndex() : 0;
207  disconnect( tagFilterComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(statusSelected(int)) );
208 
209  tagFilterComboBox->clear();
210 
211  fillMessageTagCombo();
212 }
213 
214 void Widget::addMessageTagItem(const QPixmap &icon, const QString &text, const QVariant &data)
215 {
216  d->quickSearchLine->tagFilterComboBox()->addItem(icon, text, data);
217 }
218 
219 void Widget::setCurrentStatusFilterItem()
220 {
221  d->quickSearchLine->updateComboboxVisibility();
222  connect( d->quickSearchLine->tagFilterComboBox(), SIGNAL(currentIndexChanged(int)),
223  this, SLOT(statusSelected(int)) );
224  d->quickSearchLine->tagFilterComboBox()->setCurrentIndex(d->mCurrentStatusFilterIndex>=d->quickSearchLine->tagFilterComboBox()->count() ? 0 : d->mCurrentStatusFilterIndex );
225  d->mStatusFilterComboPopulationInProgress = false;
226 }
227 
228 MessageItem *Widget::currentMessageItem() const
229 {
230  return view()->currentMessageItem();
231 }
232 
233 MessageList::Core::QuickSearchLine::SearchOptions Widget::currentOptions() const
234 {
235  return d->quickSearchLine->searchOptions();
236 }
237 
238 QList<Akonadi::MessageStatus> Widget::currentFilterStatus() const
239 {
240  if ( d->mFilter )
241  return d->mFilter->status();
242  return QList<Akonadi::MessageStatus>();
243 }
244 
245 QString Widget::currentFilterSearchString() const
246 {
247  if ( d->mFilter )
248  return d->mFilter->searchString();
249  return QString();
250 }
251 
252 QString Widget::currentFilterTagId() const
253 {
254  if ( d->mFilter )
255  return d->mFilter->tagId();
256 
257  return QString();
258 }
259 
260 void Widget::Private::setDefaultAggregationForStorageModel( const StorageModel * storageModel )
261 {
262  const Aggregation * opt = Manager::instance()->aggregationForStorageModel( storageModel, &mStorageUsesPrivateAggregation );
263 
264  Q_ASSERT( opt );
265 
266  delete mAggregation;
267  mAggregation = new Aggregation( *opt );
268 
269  mView->setAggregation( mAggregation );
270 
271  mLastAggregationId = opt->id();
272 }
273 
274 void Widget::Private::setDefaultThemeForStorageModel( const StorageModel * storageModel )
275 {
276  const Theme * opt = Manager::instance()->themeForStorageModel( storageModel, &mStorageUsesPrivateTheme );
277 
278  Q_ASSERT( opt );
279 
280  delete mTheme;
281  mTheme = new Theme( *opt );
282 
283  mView->setTheme( mTheme );
284 
285  mLastThemeId = opt->id();
286 }
287 
288 void Widget::Private::checkSortOrder( const StorageModel *storageModel )
289 {
290  if ( storageModel && mAggregation && !mSortOrder.validForAggregation( mAggregation ) ) {
291  kDebug() << "Could not restore sort order for folder" << storageModel->id();
292  mSortOrder = SortOrder::defaultForAggregation( mAggregation, mSortOrder );
293 
294  // Change the global sort order if the sort order didn't fit the global aggregation.
295  // Otherwise, if it is a per-folder aggregation, make the sort order per-folder too.
296  if ( mStorageUsesPrivateAggregation )
297  mStorageUsesPrivateSortOrder = true;
298  if ( mStorageModel ) {
299  Manager::instance()->saveSortOrderForStorageModel( storageModel, mSortOrder,
300  mStorageUsesPrivateSortOrder );
301  }
302  switchMessageSorting( mSortOrder.messageSorting(), mSortOrder.messageSortDirection(), -1 );
303  }
304 
305 }
306 
307 void Widget::Private::setDefaultSortOrderForStorageModel( const StorageModel * storageModel )
308 {
309  // Load the sort order from config and update column headers
310  mSortOrder = Manager::instance()->sortOrderForStorageModel( storageModel, &mStorageUsesPrivateSortOrder );
311  switchMessageSorting( mSortOrder.messageSorting(), mSortOrder.messageSortDirection(), -1 );
312  checkSortOrder( storageModel );
313 }
314 
315 void Widget::saveCurrentSelection()
316 {
317  if ( d->mStorageModel )
318  {
319  // Save the current selection
320  MessageItem * lastSelectedMessageItem = d->mView->currentMessageItem( false );
321  if ( lastSelectedMessageItem ) {
322  d->mStorageModel->savePreSelectedMessage(
323  lastSelectedMessageItem ? lastSelectedMessageItem->uniqueId() : 0
324  );
325  }
326  }
327 }
328 
329 void Widget::setStorageModel( StorageModel * storageModel, PreSelectionMode preSelectionMode )
330 {
331  if ( storageModel == d->mStorageModel )
332  return; // nuthin to do here
333 
334  d->setDefaultAggregationForStorageModel( storageModel );
335  d->setDefaultThemeForStorageModel( storageModel );
336  d->setDefaultSortOrderForStorageModel( storageModel );
337 
338  if(!d->quickSearchLine->lockSearch()->isChecked()) {
339  if ( d->mSearchTimer ) {
340  d->mSearchTimer->stop();
341  delete d->mSearchTimer;
342  d->mSearchTimer = 0;
343  }
344 
345  d->quickSearchLine->searchEdit()->clear();
346 
347  if ( d->mFilter ) {
348  resetFilter();
349  }
350  }
351  StorageModel * oldModel = d->mStorageModel;
352 
353  d->mStorageModel = storageModel;
354  d->mView->setStorageModel( d->mStorageModel, preSelectionMode );
355 
356  delete oldModel;
357 
358  d->quickSearchLine->tagFilterComboBox()->setEnabled( d->mStorageModel );
359  d->quickSearchLine->searchEdit()->setEnabled( d->mStorageModel );
360  d->quickSearchLine->setContainsOutboundMessages( d->mStorageModel->containsOutboundMessages() );
361 }
362 
363 StorageModel *Widget::storageModel() const
364 {
365  return d->mStorageModel;
366 }
367 
368 KLineEdit *Widget::quickSearch() const
369 {
370  return d->quickSearchLine->searchEdit();
371 }
372 
373 View *Widget::view() const
374 {
375  return d->mView;
376 }
377 
378 void Widget::themeMenuAboutToShow()
379 {
380  if ( !d->mStorageModel )
381  return;
382 
383  KMenu * menu = dynamic_cast< KMenu * >( sender() );
384  if ( !menu )
385  return;
386  themeMenuAboutToShow(menu);
387 }
388 
389 void Widget::themeMenuAboutToShow(KMenu *menu)
390 {
391  menu->clear();
392 
393  menu->addTitle( i18n( "Theme" ) );
394 
395  QActionGroup * grp = new QActionGroup( menu );
396 
397  QList< Theme * > sortedThemes = Manager::instance()->themes().values();
398 
399  QAction * act;
400 
401  qSort(sortedThemes.begin(),sortedThemes.end(),MessageList::Core::Theme::compareName);
402 
403  QList< Theme * >::ConstIterator endTheme( sortedThemes.constEnd() );
404  for ( QList< Theme * >::ConstIterator it = sortedThemes.constBegin(); it != endTheme; ++it )
405  {
406  act = menu->addAction( ( *it )->name() );
407  act->setCheckable( true );
408  grp->addAction( act );
409  act->setChecked( d->mLastThemeId == ( *it )->id() );
410  act->setData( QVariant( ( *it )->id() ) );
411  connect( act, SIGNAL(triggered(bool)),
412  SLOT(themeSelected(bool)) );
413  }
414 
415  menu->addSeparator();
416 
417  act = menu->addAction( i18n( "Configure..." ) );
418  connect( act, SIGNAL(triggered(bool)),
419  SLOT(configureThemes()) );
420 }
421 
422 void Widget::setPrivateSortOrderForStorage()
423 {
424  if ( !d->mStorageModel )
425  return;
426 
427  d->mStorageUsesPrivateSortOrder = !d->mStorageUsesPrivateSortOrder;
428 
429  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
430  d->mStorageUsesPrivateSortOrder );
431 }
432 
433 void Widget::configureThemes()
434 {
435  Utils::ConfigureThemesDialog *dialog = new Utils::ConfigureThemesDialog( window() );
436  dialog->selectTheme( d->mLastThemeId );
437  dialog->show();
438 }
439 
440 void Widget::themeSelected( bool )
441 {
442  if ( !d->mStorageModel )
443  return; // nuthin to do
444 
445  QAction * act = dynamic_cast< QAction * >( sender() );
446  if ( !act )
447  return;
448 
449  QVariant v = act->data();
450  const QString id = v.toString();
451 
452  if ( id.isEmpty() )
453  return;
454 
455  const Theme * opt = Manager::instance()->theme( id );
456 
457  delete d->mTheme;
458  d->mTheme = new Theme( *opt );
459 
460  d->mView->setTheme( d->mTheme );
461 
462  d->mLastThemeId = opt->id();
463 
464  //mStorageUsesPrivateTheme = false;
465 
466  Manager::instance()->saveThemeForStorageModel( d->mStorageModel, opt->id(), d->mStorageUsesPrivateTheme );
467 
468  d->mView->reload();
469 
470 }
471 
472 void Widget::aggregationMenuAboutToShow()
473 {
474  KMenu * menu = dynamic_cast< KMenu * >( sender() );
475  if ( !menu )
476  return;
477  aggregationMenuAboutToShow(menu);
478 }
479 
480 void Widget::aggregationMenuAboutToShow(KMenu *menu)
481 {
482  menu->clear();
483 
484  menu->addTitle( i18n( "Aggregation" ) );
485 
486  QActionGroup * grp = new QActionGroup( menu );
487 
488  QList< Aggregation * > sortedAggregations = Manager::instance()->aggregations().values();
489 
490  QAction * act;
491 
492  qSort(sortedAggregations.begin(),sortedAggregations.end(), MessageList::Core::Aggregation::compareName);
493 
494  QList<Aggregation * >::ConstIterator endagg( sortedAggregations.constEnd() );
495 
496  for ( QList< Aggregation * >::ConstIterator it = sortedAggregations.constBegin(); it != endagg; ++it ) {
497  act = menu->addAction( ( *it )->name() );
498  act->setCheckable( true );
499  grp->addAction( act );
500  act->setChecked( d->mLastAggregationId == ( *it )->id() );
501  act->setData( QVariant( ( *it )->id() ) );
502  connect( act, SIGNAL(triggered(bool)),
503  SLOT(aggregationSelected(bool)) );
504  }
505 
506  menu->addSeparator();
507 
508  act = menu->addAction( i18n( "Configure..." ) );
509  act->setData( QVariant( QString() ) );
510  connect( act, SIGNAL(triggered(bool)),
511  SLOT(aggregationSelected(bool)) );
512 }
513 
514 void Widget::aggregationSelected( bool )
515 {
516  QAction * act = dynamic_cast< QAction * >( sender() );
517  if ( !act )
518  return;
519 
520  QVariant v = act->data();
521  QString id = v.toString();
522 
523  if ( id.isEmpty() ) {
524  Utils::ConfigureAggregationsDialog *dialog = new Utils::ConfigureAggregationsDialog( window() );
525  dialog->selectAggregation( d->mLastAggregationId );
526  dialog->show();
527  return;
528  }
529 
530  if ( !d->mStorageModel )
531  return; // nuthin to do
532 
533  const Aggregation * opt = Manager::instance()->aggregation( id );
534 
535  delete d->mAggregation;
536  d->mAggregation = new Aggregation( *opt );
537 
538  d->mView->setAggregation( d->mAggregation );
539 
540  d->mLastAggregationId = opt->id();
541 
542  //mStorageUsesPrivateAggregation = false;
543 
544  Manager::instance()->saveAggregationForStorageModel( d->mStorageModel, opt->id(), d->mStorageUsesPrivateAggregation );
545 
546  // The sort order might not be valid anymore for this aggregation
547  d->checkSortOrder( d->mStorageModel );
548 
549  d->mView->reload();
550 
551 }
552 
553 void Widget::sortOrderMenuAboutToShow()
554 {
555  if ( !d->mAggregation )
556  return;
557 
558  KMenu * menu = dynamic_cast< KMenu * >( sender() );
559  if ( !menu )
560  return;
561  sortOrderMenuAboutToShow(menu);
562 }
563 
564 void Widget::sortOrderMenuAboutToShow(KMenu *menu)
565 {
566  menu->clear();
567 
568  menu->addTitle( i18n( "Message Sort Order" ) );
569 
570  QActionGroup * grp;
571  QAction * act;
572  QList< QPair< QString, int > > options;
573  QList< QPair< QString, int > >::ConstIterator it;
574 
575  grp = new QActionGroup( menu );
576 
577  options = SortOrder::enumerateMessageSortingOptions( d->mAggregation->threading() );
578  QList< QPair< QString, int > >::ConstIterator end( options.constEnd() );
579  for ( it = options.constBegin(); it != end; ++it ) {
580  act = menu->addAction( ( *it ).first );
581  act->setCheckable( true );
582  grp->addAction( act );
583  act->setChecked( d->mSortOrder.messageSorting() == ( *it ).second );
584  act->setData( QVariant( ( *it ).second ) );
585  }
586 
587  connect( grp, SIGNAL(triggered(QAction*)),
588  SLOT(messageSortingSelected(QAction*)) );
589 
590  options = SortOrder::enumerateMessageSortDirectionOptions( d->mSortOrder.messageSorting() );
591 
592  if ( options.size() >= 2 ) {
593  menu->addTitle( i18n( "Message Sort Direction" ) );
594 
595  grp = new QActionGroup( menu );
596  end = options.constEnd();
597  for ( it = options.constBegin(); it != end; ++it ) {
598  act = menu->addAction( ( *it ).first );
599  act->setCheckable( true );
600  grp->addAction( act );
601  act->setChecked( d->mSortOrder.messageSortDirection() == ( *it ).second );
602  act->setData( QVariant( ( *it ).second ) );
603  }
604 
605  connect( grp, SIGNAL(triggered(QAction*)),
606  SLOT(messageSortDirectionSelected(QAction*)) );
607  }
608 
609  options = SortOrder::enumerateGroupSortingOptions( d->mAggregation->grouping() );
610 
611  if ( options.size() >= 2 ) {
612  menu->addTitle( i18n( "Group Sort Order" ) );
613 
614  grp = new QActionGroup( menu );
615 
616  end = options.constEnd();
617  for ( it = options.constBegin(); it != end; ++it ) {
618  act = menu->addAction( ( *it ).first );
619  act->setCheckable( true );
620  grp->addAction( act );
621  act->setChecked( d->mSortOrder.groupSorting() == ( *it ).second );
622  act->setData( QVariant( ( *it ).second ) );
623  }
624 
625  connect( grp, SIGNAL(triggered(QAction*)),
626  SLOT(groupSortingSelected(QAction*)) );
627  }
628 
629  options = SortOrder::enumerateGroupSortDirectionOptions( d->mAggregation->grouping(),
630  d->mSortOrder.groupSorting() );
631 
632  if ( options.size() >= 2 ) {
633  menu->addTitle( i18n( "Group Sort Direction" ) );
634 
635  grp = new QActionGroup( menu );
636  end = options.constEnd();
637  for ( it = options.constBegin(); it != end; ++it ) {
638  act = menu->addAction( ( *it ).first );
639  act->setCheckable( true );
640  grp->addAction( act );
641  act->setChecked( d->mSortOrder.groupSortDirection() == ( *it ).second );
642  act->setData( QVariant( ( *it ).second ) );
643  }
644 
645  connect( grp, SIGNAL(triggered(QAction*)),
646  SLOT(groupSortDirectionSelected(QAction*)) );
647  }
648 
649  menu->addSeparator();
650  act = menu->addAction( i18n( "Folder Always Uses This Sort Order" ) );
651  act->setCheckable( true );
652  act->setChecked( d->mStorageUsesPrivateSortOrder );
653  connect( act, SIGNAL(triggered(bool)),
654  SLOT(setPrivateSortOrderForStorage()) );
655 }
656 
657 void Widget::Private::switchMessageSorting( SortOrder::MessageSorting messageSorting,
658  SortOrder::SortDirection sortDirection,
659  int logicalHeaderColumnIndex )
660 {
661  mSortOrder.setMessageSorting( messageSorting );
662  mSortOrder.setMessageSortDirection( sortDirection );
663 
664  // If the logicalHeaderColumnIndex was specified then we already know which
665  // column we should set the sort indicator to. If it wasn't specified (it's -1)
666  // then we need to find it out in the theme.
667 
668  if ( logicalHeaderColumnIndex == -1 )
669  {
670  // try to find the specified message sorting in the theme columns
671  const QList< Theme::Column * > & columns = mTheme->columns();
672  int idx = 0;
673 
674  // First try with a well defined message sorting.
675 
676  foreach( const Theme::Column* column, columns )
677  {
678  if ( !mView->header()->isSectionHidden( idx ) )
679  {
680  if ( column->messageSorting() == messageSorting )
681  {
682  // found a visible column with this message sorting
683  logicalHeaderColumnIndex = idx;
684  break;
685  }
686  }
687  ++idx;
688  }
689 
690  // if still not found, try again with a wider range
691  if ( logicalHeaderColumnIndex == -1 )
692  {
693  idx = 0;
694  foreach( const Theme::Column* column, columns )
695  {
696  if ( !mView->header()->isSectionHidden( idx ) )
697  {
698  if (
699  (
700  ( column->messageSorting() == SortOrder::SortMessagesBySenderOrReceiver ) ||
701  ( column->messageSorting() == SortOrder::SortMessagesByReceiver ) ||
702  ( column->messageSorting() == SortOrder::SortMessagesBySender )
703  ) &&
704  (
705  ( messageSorting == SortOrder::SortMessagesBySenderOrReceiver ) ||
706  ( messageSorting == SortOrder::SortMessagesByReceiver ) ||
707  ( messageSorting == SortOrder::SortMessagesBySender )
708  )
709  )
710  {
711  // found a visible column with this message sorting
712  logicalHeaderColumnIndex = idx;
713  break;
714  }
715  }
716  ++idx;
717  }
718  }
719  }
720 
721  if ( logicalHeaderColumnIndex == -1 )
722  {
723  // not found: either not a column-based sorting or the related column is hidden
724  mView->header()->setSortIndicatorShown( false );
725  return;
726  }
727 
728  mView->header()->setSortIndicatorShown( true );
729 
730  if ( sortDirection == SortOrder::Ascending )
731  mView->header()->setSortIndicator( logicalHeaderColumnIndex, Qt::AscendingOrder );
732  else
733  mView->header()->setSortIndicator( logicalHeaderColumnIndex, Qt::DescendingOrder );
734 }
735 
736 void Widget::messageSortingSelected( QAction *action )
737 {
738  if ( !d->mAggregation )
739  return;
740  if ( !action )
741  return;
742 
743  if ( !d->mStorageModel )
744  return;
745 
746  bool ok;
747  SortOrder::MessageSorting ord = static_cast< SortOrder::MessageSorting >( action->data().toInt( &ok ) );
748 
749  if ( !ok )
750  return;
751 
752  d->switchMessageSorting( ord, d->mSortOrder.messageSortDirection(), -1 );
753  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
754  d->mStorageUsesPrivateSortOrder );
755 
756  d->mView->reload();
757 
758 }
759 
760 void Widget::messageSortDirectionSelected( QAction *action )
761 {
762  if ( !d->mAggregation )
763  return;
764  if ( !action )
765  return;
766  if ( !d->mStorageModel )
767  return;
768 
769 
770  bool ok;
771  SortOrder::SortDirection ord = static_cast< SortOrder::SortDirection >( action->data().toInt( &ok ) );
772 
773  if ( !ok )
774  return;
775 
776  d->switchMessageSorting( d->mSortOrder.messageSorting(), ord, -1 );
777  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
778  d->mStorageUsesPrivateSortOrder );
779 
780  d->mView->reload();
781 
782 }
783 
784 void Widget::groupSortingSelected( QAction *action )
785 {
786  if ( !d->mAggregation )
787  return;
788  if ( !action )
789  return;
790 
791  if ( !d->mStorageModel )
792  return;
793 
794  bool ok;
795  SortOrder::GroupSorting ord = static_cast< SortOrder::GroupSorting >( action->data().toInt( &ok ) );
796 
797  if ( !ok )
798  return;
799 
800  d->mSortOrder.setGroupSorting( ord );
801  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
802  d->mStorageUsesPrivateSortOrder );
803 
804  d->mView->reload();
805 
806 }
807 
808 void Widget::groupSortDirectionSelected( QAction *action )
809 {
810  if ( !d->mAggregation )
811  return;
812  if ( !action )
813  return;
814  if ( !d->mStorageModel )
815  return;
816 
817 
818  bool ok;
819  SortOrder::SortDirection ord = static_cast< SortOrder::SortDirection >( action->data().toInt( &ok ) );
820 
821  if ( !ok )
822  return;
823 
824  d->mSortOrder.setGroupSortDirection( ord );
825  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
826  d->mStorageUsesPrivateSortOrder );
827 
828  d->mView->reload();
829 
830 }
831 
832 void Widget::resetFilter()
833 {
834  delete d->mFilter;
835  d->mFilter = 0;
836  d->mView->model()->setFilter( 0 );
837  d->quickSearchLine->resetFilter();
838  d->quickSearchWarning->animatedHide();
839 }
840 
841 void Widget::slotViewHeaderSectionClicked( int logicalIndex )
842 {
843  if ( !d->mTheme )
844  return;
845 
846  if ( !d->mAggregation )
847  return;
848 
849  if ( logicalIndex >= d->mTheme->columns().count() )
850  return;
851 
852  if ( !d->mStorageModel )
853  return;
854 
855 
856  const Theme::Column * column = d->mTheme->column( logicalIndex );
857  if ( !column )
858  return; // should never happen...
859 
860  if ( column->messageSorting() == SortOrder::NoMessageSorting )
861  return; // this is a null op.
862 
863 
864  if ( d->mSortOrder.messageSorting() == column->messageSorting() )
865  {
866  // switch sort direction
867  if ( d->mSortOrder.messageSortDirection() == SortOrder::Ascending )
868  d->switchMessageSorting( d->mSortOrder.messageSorting(), SortOrder::Descending, logicalIndex );
869  else
870  d->switchMessageSorting( d->mSortOrder.messageSorting(), SortOrder::Ascending, logicalIndex );
871  } else {
872  // keep sort direction but switch sort order
873  d->switchMessageSorting( column->messageSorting(), d->mSortOrder.messageSortDirection(), logicalIndex );
874  }
875  Manager::instance()->saveSortOrderForStorageModel( d->mStorageModel, d->mSortOrder,
876  d->mStorageUsesPrivateSortOrder );
877 
878  d->mView->reload();
879 
880 }
881 
882 void Widget::themesChanged()
883 {
884  d->setDefaultThemeForStorageModel( d->mStorageModel );
885 
886  d->mView->reload();
887 }
888 
889 void Widget::aggregationsChanged()
890 {
891  d->setDefaultAggregationForStorageModel( d->mStorageModel );
892  d->checkSortOrder( d->mStorageModel );
893 
894  d->mView->reload();
895 }
896 
897 void Widget::fillMessageTagCombo()
898 {
899  // nothing here: must be overridden in derived classes
900  setCurrentStatusFilterItem();
901 }
902 
903 void Widget::tagIdSelected( const QVariant& data )
904 {
905  QString tagId = data.toString();
906 
907 
908  if ( tagId.isEmpty() ) {
909  if ( d->mFilter ){
910  if ( d->mFilter->isEmpty() ) {
911  resetFilter();
912  return;
913  }
914  }
915  } else {
916  if ( !d->mFilter )
917  d->mFilter = new Filter();
918  d->mFilter->setTagId( tagId );
919  }
920 
921  d->mView->model()->setFilter( d->mFilter );
922 }
923 
924 void Widget::statusSelected( int index )
925 {
926  if (index == 0) {
927  resetFilter();
928  return;
929  }
930  tagIdSelected( d->quickSearchLine->tagFilterComboBox()->itemData( index ) );
931  d->mView->model()->setFilter( d->mFilter );
932 }
933 
934 void Widget::searchEditTextEdited()
935 {
936  // This slot is called whenever the user edits the search QLineEdit.
937  // Since the user is likely to type more than one character
938  // so we start the real search after a short delay in order to catch
939  // multiple textEdited() signals.
940 
941  if ( !d->mSearchTimer )
942  {
943  d->mSearchTimer = new QTimer( this );
944  connect( d->mSearchTimer, SIGNAL(timeout()),
945  SLOT(searchTimerFired()) );
946  } else {
947  d->mSearchTimer->stop(); // eventually
948  }
949 
950  d->mSearchTimer->setSingleShot( true );
951  d->mSearchTimer->start( 1000 );
952 }
953 
954 void Widget::slotStatusButtonsClicked()
955 {
956  // We also arbitrairly set tagId to an empty string, though we *could* allow filtering
957  // by status AND tag...
958  if ( d->mFilter )
959  d->mFilter->setTagId( QString() );
960 
961  QList<Akonadi::MessageStatus> lst = d->quickSearchLine->status();
962  if ( lst.isEmpty() ) {
963  if ( d->mFilter ) {
964  d->mFilter->setStatus( lst );
965  if ( d->mFilter->isEmpty() ) {
966  qDebug()<<" RESET FILTER";
967  resetFilter();
968  return;
969  }
970  }
971  } else {
972  // don't have this status bit
973  if ( !d->mFilter )
974  d->mFilter = new Filter();
975  d->mFilter->setStatus( lst );
976  }
977 
978  d->mView->model()->setFilter( d->mFilter );
979 }
980 
981 void Widget::searchTimerFired()
982 {
983  // A search is pending.
984 
985  if ( d->mSearchTimer )
986  d->mSearchTimer->stop();
987 
988  if ( !d->mFilter )
989  d->mFilter = new Filter();
990 
991  const QString text = d->quickSearchLine->searchEdit()->text();
992 
993  if (!text.isEmpty()) {
994  KCompletion *comp = d->quickSearchLine->searchEdit()->completionObject();
995  comp->addItem(text);
996  }
997 
998  d->mFilter->setCurrentFolder( d->mCurrentFolder );
999  d->mFilter->setSearchString( text, d->quickSearchLine->searchOptions() );
1000  d->quickSearchWarning->setSearchText(text);
1001  if ( d->mFilter->isEmpty() ) {
1002  resetFilter();
1003  return;
1004  }
1005 
1006  d->mView->model()->setFilter( d->mFilter );
1007 }
1008 
1009 void Widget::searchEditClearButtonClicked()
1010 {
1011  if ( !d->mFilter )
1012  return;
1013 
1014  resetFilter();
1015 
1016  d->mView->scrollTo( d->mView->currentIndex(), QAbstractItemView::PositionAtCenter );
1017 }
1018 
1019 void Widget::viewMessageSelected( MessageItem * )
1020 {
1021 }
1022 
1023 void Widget::viewMessageActivated( MessageItem * )
1024 {
1025 }
1026 
1027 void Widget::viewSelectionChanged()
1028 {
1029 }
1030 
1031 void Widget::viewMessageListContextPopupRequest( const QList< MessageItem * > &, const QPoint & )
1032 {
1033 }
1034 
1035 void Widget::viewGroupHeaderContextPopupRequest( GroupHeaderItem *, const QPoint & )
1036 {
1037 }
1038 
1039 void Widget::viewDragEnterEvent( QDragEnterEvent * )
1040 {
1041 }
1042 
1043 void Widget::viewDragMoveEvent( QDragMoveEvent * )
1044 {
1045 }
1046 
1047 void Widget::viewDropEvent( QDropEvent * )
1048 {
1049 }
1050 
1051 void Widget::viewStartDragRequest()
1052 {
1053 }
1054 
1055 void Widget::viewJobBatchStarted()
1056 {
1057 }
1058 
1059 void Widget::viewJobBatchTerminated()
1060 {
1061 }
1062 
1063 void Widget::viewMessageStatusChangeRequest( MessageItem *msg, const Akonadi::MessageStatus &set, const Akonadi::MessageStatus &clear )
1064 {
1065  Q_UNUSED( msg );
1066  Q_UNUSED( set );
1067  Q_UNUSED( clear );
1068 }
1069 
1070 void Widget::focusQuickSearch(const QString &selectedText)
1071 {
1072  d->quickSearchLine->focusQuickSearch(selectedText);
1073 }
1074 
1075 bool Widget::isThreaded() const
1076 {
1077  return d->mView->isThreaded();
1078 }
1079 
1080 bool Widget::selectionEmpty() const
1081 {
1082  return d->mView->selectionEmpty();
1083 }
1084 
1085 void Widget::setCurrentFolder( const Akonadi::Collection &collection )
1086 {
1087  d->mCurrentFolder = collection;
1088 }
1089 
1090 bool Widget::searchEditHasFocus() const
1091 {
1092  return d->quickSearchLine->searchEdit()->hasFocus();
1093 }
1094 
MessageList::Core::Widget::aggregationSelected
void aggregationSelected(bool)
Definition: widgetbase.cpp:514
MessageList::Core::Widget::messageSortingSelected
void messageSortingSelected(QAction *action)
Definition: widgetbase.cpp:736
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:1055
QWidget
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::QuickSearchWarning
Definition: quicksearchwarning.h:25
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:1051
MessageList::Core::Widget::currentFilterStatus
QList< Akonadi::MessageStatus > currentFilterStatus() const
Returns the Akonadi::MessageStatus in the current quicksearch field.
Definition: widgetbase.cpp:238
MessageList::Core::Widget::saveCurrentSelection
void saveCurrentSelection()
Definition: widgetbase.cpp:315
MessageList::Core::Widget::viewDropEvent
virtual void viewDropEvent(QDropEvent *e)
This is called by View when a drop event is received.
Definition: widgetbase.cpp:1047
MessageList::Core::Widget::setCurrentStatusFilterItem
void setCurrentStatusFilterItem()
Must be called by fillMessageTagCombo()
Definition: widgetbase.cpp:219
MessageList::Core::Aggregation::compareName
static bool compareName(Aggregation *agg1, Aggregation *agg2)
Definition: aggregation.h:153
QActionGroup
MessageList::Core::QuickSearchLine
Definition: quicksearchline.h:36
QWidget::window
QWidget * window() const
MessageList::Core::MessageItem
Definition: messageitem.h:46
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:732
QDragMoveEvent
filter.h
QObject::sender
QObject * sender() const
QAction::setChecked
void setChecked(bool)
MessageList::Core::Manager::theme
const Theme * theme(const QString &id)
Definition: manager.cpp:483
QAction::data
QVariant data() const
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:440
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:61
MessageList::Core::Widget::quickSearch
KLineEdit * quickSearch() const
Returns the search line of this widget.
Definition: widgetbase.cpp:368
MessageList::Core::Widget::view
View * view() const
Returns the View attached to this Widget.
Definition: widgetbase.cpp:373
QActionGroup::addAction
QAction * addAction(QAction *action)
model.h
theme.h
QPoint
MessageList::Core::View
The MessageList::View is the real display of the message list.
Definition: view.h:65
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
MessageList::Core::View::currentMessageItem
MessageItem * currentMessageItem(bool selectIfNeeded=true) const
Returns the current MessageItem (that is bound to current StorageModel).
Definition: view.cpp:865
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:1075
optionset.h
QList::size
int size() const
MessageList::Core::Widget::groupSortDirectionSelected
void groupSortDirectionSelected(QAction *action)
Definition: widgetbase.cpp:808
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:565
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:245
MessageList::Core::SortOrder::SortMessagesByReceiver
Sort the messages by receiver.
Definition: sortorder.h:85
MessageList::Core::Widget::~Widget
~Widget()
Definition: widgetbase.cpp:161
MessageList::Core::MessageItem::uniqueId
unsigned long uniqueId() const
Definition: messageitem.cpp:534
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
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:57
configurethemesdialog.h
messageitem.h
QTimer
QVariant::toInt
int toInt(bool *ok) const
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:176
view.h
MessageList::Core::Widget::slotViewHeaderSectionClicked
void slotViewHeaderSectionClicked(int logicalIndex)
Handles header section clicks switching the Aggregation MessageSorting on-the-fly.
Definition: widgetbase.cpp:841
MessageList::Core::Widget::searchEditClearButtonClicked
void searchEditClearButtonClicked()
Definition: widgetbase.cpp:1009
QDropEvent
QList::isEmpty
bool isEmpty() const
MessageList::Core::Widget::resetFilter
void resetFilter()
Definition: widgetbase.cpp:832
QObject::setObjectName
void setObjectName(const QString &name)
MessageList::Core::SortOrder::MessageSorting
MessageSorting
The available message sorting options.
Definition: sortorder.h:78
QString::isEmpty
bool isEmpty() const
MessageList::Core::Widget::currentFilterTagId
QString currentFilterTagId() const
Returns the id of the MessageItem::Tag currently set in the quicksearch field.
Definition: widgetbase.cpp:252
MessageList::Core::Widget::aggregationMenuAboutToShow
void aggregationMenuAboutToShow()
Definition: widgetbase.cpp:472
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:329
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:433
MessageList::Core::Widget::fillMessageTagCombo
virtual void fillMessageTagCombo()
Called when the "Message Status/Tag" filter menu is opened by the user.
Definition: widgetbase.cpp:897
QVBoxLayout
QString
aggregation.h
QList< Akonadi::MessageStatus >
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:101
MessageList::Utils::ConfigureAggregationsDialog::selectAggregation
void selectAggregation(const QString &aggregationId)
Definition: configureaggregationsdialog.cpp:182
manager.h
QLayout::setMargin
void setMargin(int margin)
MessageList::Core::SortOrder::Descending
Definition: sortorder.h:70
QPixmap
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:1059
quicksearchwarning.h
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:1035
QAction::setData
void setData(const QVariant &userData)
MessageList::Core::Widget::tagIdSelected
void tagIdSelected(const QVariant &data)
Definition: widgetbase.cpp:903
MessageList::Core::SortOrder::SortMessagesBySender
Sort the messages by sender.
Definition: sortorder.h:84
QList::end
iterator end()
MessageList::Core::Widget::searchEditTextEdited
void searchEditTextEdited()
Definition: widgetbase.cpp:934
MessageList::Core::Widget::focusQuickSearch
void focusQuickSearch(const QString &selectedText)
Sets the focus on the quick search line of the currently active tab.
Definition: widgetbase.cpp:1070
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:1019
QAction::setCheckable
void setCheckable(bool)
MessageList::Core::Manager::registerWidget
static void registerWidget(Widget *pWidget)
Definition: manager.cpp:147
MessageList::Core::Widget::slotStatusButtonsClicked
void slotStatusButtonsClicked()
Definition: widgetbase.cpp:954
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:155
MessageList::Core::Widget::Widget
Widget(QWidget *parent)
Definition: widgetbase.cpp:124
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:1080
MessageList::Core::Widget::currentOptions
MessageList::Core::QuickSearchLine::SearchOptions currentOptions() const
Definition: widgetbase.cpp:233
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
QDragEnterEvent
MessageList::Core::Widget::viewDragEnterEvent
virtual void viewDragEnterEvent(QDragEnterEvent *e)
This is called by View when a drag enter event is received.
Definition: widgetbase.cpp:1039
MessageList::Core::Widget::View
friend class View
Definition: widgetbase.h:63
QLatin1String
MessageList::Core::Widget::sortOrderMenuAboutToShow
void sortOrderMenuAboutToShow()
Definition: widgetbase.cpp:553
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:873
MessageList::Core::Widget::themesChanged
void themesChanged()
This is called by Manager when the option sets stored within have changed.
Definition: widgetbase.cpp:882
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
QAction
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:44
KComboBox
MessageList::Core::Manager::sortOrderForStorageModel
const SortOrder sortOrderForStorageModel(const StorageModel *storageModel, bool *storageUsesPrivateSortOrder)
Definition: manager.cpp:461
widgetbase.h
MessageList::Core::Widget::currentMessageItem
Core::MessageItem * currentMessageItem() const
Returns the current MessageItem in the current folder.
Definition: widgetbase.cpp:228
MessageList::Core::Widget::themeMenuAboutToShow
void themeMenuAboutToShow()
Definition: widgetbase.cpp:378
MessageList::Core::Widget::messageSortDirectionSelected
void messageSortDirectionSelected(QAction *action)
Definition: widgetbase.cpp:760
MessageList::Core::Widget::viewDragMoveEvent
virtual void viewDragMoveEvent(QDragMoveEvent *e)
This is called by View when a drag move event is received.
Definition: widgetbase.cpp:1043
MessageList::Core::Widget::searchEditHasFocus
bool searchEditHasFocus() const
Definition: widgetbase.cpp:1090
QWidget::setAutoFillBackground
void setAutoFillBackground(bool enabled)
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:1027
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:1031
QList::constEnd
const_iterator constEnd() const
QList::constBegin
const_iterator constBegin() const
MessageList::Core::Widget::aggregationsChanged
void aggregationsChanged()
This is called by Manager when the option sets stored within have changed.
Definition: widgetbase.cpp:889
MessageList::Utils::ConfigureThemesDialog::selectTheme
void selectTheme(const QString &themeId)
Definition: configurethemesdialog.cpp:179
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
MessageList::Core::Widget::statusSelected
void statusSelected(int index)
Definition: widgetbase.cpp:924
MessageList::Core::Widget::populateStatusFilterCombo
void populateStatusFilterCombo()
This is called to setup the status filter's KComboBox.
Definition: widgetbase.cpp:199
MessageList::Core::Widget::setPrivateSortOrderForStorage
void setPrivateSortOrderForStorage()
Definition: widgetbase.cpp:422
MessageList::Core::Widget::storageModel
StorageModel * storageModel() const
Returns the StorageModel currently set.
Definition: widgetbase.cpp:363
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:1063
QVariant::toString
QString toString() const
MessageList::Core::Widget::addMessageTagItem
void addMessageTagItem(const QPixmap &, const QString &, const QVariant &)
Definition: widgetbase.cpp:214
storagemodelbase.h
MessageList::Core::Manager::aggregation
const Aggregation * aggregation(const QString &id)
Definition: manager.cpp:172
QList::begin
iterator begin()
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:1023
QBoxLayout::setSpacing
void setSpacing(int spacing)
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:1085
MessageList::Core::Manager::themes
const QHash< QString, Theme * > & themes() const
Definition: manager.h:234
MessageList::Core::Widget::searchTimerFired
void searchTimerFired()
Definition: widgetbase.cpp:981
MessageList::Core::Widget::groupSortingSelected
void groupSortingSelected(QAction *action)
Definition: widgetbase.cpp:784
QVariant
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:79
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:01 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
  • pimprint

Search



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

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