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

akonadi/kmime

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
  • kmime
standardmailactionmanager.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  Copyright (c) 2009 - 2010 Tobias Koenig <tokoe@kde.org>
5  Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
6  Copyright (c) 2010 Andras Mantia <andras@kdab.com>
7 
8  This library is free software; you can redistribute it and/or modify it
9  under the terms of the GNU Library General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or (at your
11  option) any later version.
12 
13  This library is distributed in the hope that it will be useful, but WITHOUT
14  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16  License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to the
20  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 */
23 
24 #include "standardmailactionmanager.h"
25 
26 #include "emptytrashcommand_p.h"
27 #include "markascommand_p.h"
28 #include "movetotrashcommand_p.h"
29 #include "specialmailcollections.h"
30 #include "removeduplicatesjob.h"
31 
32 #include "akonadi/agentfilterproxymodel.h"
33 #include "akonadi/agentinstance.h"
34 #include "akonadi/agentinstancecreatejob.h"
35 #include "akonadi/agentmanager.h"
36 #include "akonadi/agenttypedialog.h"
37 #include "akonadi/collectionstatistics.h"
38 #include "akonadi/entitytreemodel.h"
39 #include "akonadi/kmime/messagestatus.h"
40 #include "util_p.h"
41 #include "akonadi/mimetypechecker.h"
42 #include "akonadi/subscriptiondialog_p.h"
43 
44 #include <kaction.h>
45 #include <kactioncollection.h>
46 #include <kicon.h>
47 #include <klocalizedstring.h>
48 #include <kmessagebox.h>
49 #include <kmime/kmime_message.h>
50 
51 #include <QtCore/QPointer>
52 #include <QItemSelectionModel>
53 
54 using namespace Akonadi;
55 
56 class StandardMailActionManager::Private
57 {
58  public:
59  Private( KActionCollection *actionCollection, QWidget *parentWidget, StandardMailActionManager *parent )
60  : mActionCollection( actionCollection ),
61  mParentWidget( parentWidget ),
62  mCollectionSelectionModel( 0 ),
63  mItemSelectionModel( 0 ),
64  mParent( parent )
65  {
66  mGenericManager = new StandardActionManager( actionCollection, parentWidget );
67 
68  mParent->connect( mGenericManager, SIGNAL(actionStateUpdated()),
69  mParent, SIGNAL(actionStateUpdated()) );
70 
71  mGenericManager->setMimeTypeFilter( QStringList() << KMime::Message::mimeType() );
72  mGenericManager->setCapabilityFilter( QStringList() << QLatin1String( "Resource" ) );
73  }
74 
75  ~Private()
76  {
77  delete mGenericManager;
78  }
79 
80  void updateGenericAllActions()
81  {
82  updateGenericAction(StandardActionManager::CreateCollection);
83  updateGenericAction(StandardActionManager::CopyCollections);
84  updateGenericAction(StandardActionManager::DeleteCollections);
85  updateGenericAction(StandardActionManager::SynchronizeCollections);
86  updateGenericAction(StandardActionManager::CollectionProperties);
87  updateGenericAction(StandardActionManager::CopyItems);
88  updateGenericAction(StandardActionManager::Paste);
89  updateGenericAction(StandardActionManager::DeleteItems);
90  updateGenericAction(StandardActionManager::ManageLocalSubscriptions);
91  updateGenericAction(StandardActionManager::AddToFavoriteCollections);
92  updateGenericAction(StandardActionManager::RemoveFromFavoriteCollections);
93  updateGenericAction(StandardActionManager::RenameFavoriteCollection);
94  updateGenericAction(StandardActionManager::CopyCollectionToMenu);
95  updateGenericAction(StandardActionManager::CopyItemToMenu);
96  updateGenericAction(StandardActionManager::MoveItemToMenu);
97  updateGenericAction(StandardActionManager::MoveCollectionToMenu);
98  updateGenericAction(StandardActionManager::CutItems);
99  updateGenericAction(StandardActionManager::CutCollections);
100  updateGenericAction(StandardActionManager::CreateResource);
101  updateGenericAction(StandardActionManager::DeleteResources);
102  updateGenericAction(StandardActionManager::ResourceProperties);
103  updateGenericAction(StandardActionManager::SynchronizeResources);
104  updateGenericAction(StandardActionManager::ToggleWorkOffline);
105  updateGenericAction(StandardActionManager::CopyCollectionToDialog);
106  updateGenericAction(StandardActionManager::MoveCollectionToDialog);
107  updateGenericAction(StandardActionManager::CopyItemToDialog);
108  updateGenericAction(StandardActionManager::MoveItemToDialog);
109  updateGenericAction(StandardActionManager::SynchronizeCollectionsRecursive);
110  updateGenericAction(StandardActionManager::MoveCollectionsToTrash);
111  updateGenericAction(StandardActionManager::MoveItemsToTrash);
112  updateGenericAction(StandardActionManager::RestoreCollectionsFromTrash);
113  updateGenericAction(StandardActionManager::RestoreItemsFromTrash);
114  updateGenericAction(StandardActionManager::MoveToTrashRestoreCollection);
115  updateGenericAction(StandardActionManager::MoveToTrashRestoreCollectionAlternative);
116  updateGenericAction(StandardActionManager::MoveToTrashRestoreItem);
117  updateGenericAction(StandardActionManager::MoveToTrashRestoreItemAlternative);
118  updateGenericAction(StandardActionManager::SynchronizeFavoriteCollections);
119  }
120  void updateGenericAction(StandardActionManager::Type type)
121  {
122  switch(type) {
123  case Akonadi::StandardActionManager::CreateCollection:
124  mGenericManager->action( Akonadi::StandardActionManager::CreateCollection )->setText(
125  i18n( "Add Folder..." ) );
126  mGenericManager->action( Akonadi::StandardActionManager::CreateCollection )->setWhatsThis(
127  i18n( "Add a new folder to the currently selected account." ) );
128  mGenericManager->action( Akonadi::StandardActionManager::CreateCollection )->setHelpText(
129  i18n( "Add a new folder to the currently selected account." ) );
130 
131  mGenericManager->setContextText(
132  StandardActionManager::CreateCollection, StandardActionManager::DialogTitle,
133  i18nc( "@title:window", "New Folder" ) );
134 
135  mGenericManager->setContextText(
136  StandardActionManager::CreateCollection, StandardActionManager::ErrorMessageText,
137  ki18n( "Could not create folder: %1" ) );
138 
139  mGenericManager->setContextText(
140  StandardActionManager::CreateCollection, StandardActionManager::ErrorMessageTitle,
141  i18n( "Folder creation failed" ) );
142 
143  break;
144  case Akonadi::StandardActionManager::CopyCollections:
145  mGenericManager->setActionText( Akonadi::StandardActionManager::CopyCollections,
146  ki18np( "Copy Folder", "Copy %1 Folders" ) );
147  mGenericManager->action( Akonadi::StandardActionManager::CopyCollections )->setWhatsThis(
148  i18n( "Copy the selected folders to the clipboard." ) );
149  mGenericManager->action( Akonadi::StandardActionManager::CopyCollections )->setHelpText(
150  i18n( "Copy the selected folders to the clipboard." ) );
151  mGenericManager->setContextText(
152  StandardActionManager::CollectionProperties, StandardActionManager::DialogTitle,
153  ki18nc( "@title:window", "Properties of Folder %1" ) );
154 
155  break;
156  case Akonadi::StandardActionManager::DeleteCollections:
157  mGenericManager->setActionText( Akonadi::StandardActionManager::DeleteCollections,
158  ki18np( "Delete Folder", "Delete %1 Folders" ) );
159  mGenericManager->action( Akonadi::StandardActionManager::DeleteCollections )->setWhatsThis(
160  i18n( "Delete the selected folders from the account." ) );
161  mGenericManager->action( Akonadi::StandardActionManager::DeleteCollections )->setHelpText(
162  i18n( "Delete the selected folders from the account." ) );
163  mGenericManager->setContextText(
164  StandardActionManager::DeleteCollections, StandardActionManager::MessageBoxText,
165  ki18np( "Do you really want to delete this folder and all its sub-folders?",
166  "Do you really want to delete %1 folders and all their sub-folders?" ) );
167 
168  mGenericManager->setContextText(
169  StandardActionManager::DeleteCollections, StandardActionManager::MessageBoxTitle,
170  ki18ncp( "@title:window", "Delete folder?", "Delete folders?" ) );
171 
172  mGenericManager->setContextText(
173  StandardActionManager::DeleteCollections, StandardActionManager::ErrorMessageText,
174  ki18n( "Could not delete folder: %1" ) );
175 
176  mGenericManager->setContextText(
177  StandardActionManager::DeleteCollections, StandardActionManager::ErrorMessageTitle,
178  i18n( "Folder deletion failed" ) );
179 
180  break;
181  case Akonadi::StandardActionManager::SynchronizeCollections:
182  mGenericManager->setActionText( Akonadi::StandardActionManager::SynchronizeCollections,
183  ki18np( "Update Folder", "Update Folders" ) );
184 
185  mGenericManager->action( Akonadi::StandardActionManager::SynchronizeCollections )->setWhatsThis(
186  i18n( "Update the contents of the selected folders." ) );
187  mGenericManager->action( Akonadi::StandardActionManager::SynchronizeCollections )->setHelpText(
188  i18n( "Update the contents of the selected folders." ) );
189  break;
190  case Akonadi::StandardActionManager::CutCollections:
191  mGenericManager->setActionText( Akonadi::StandardActionManager::CutCollections,
192  ki18np( "Cut Folder", "Cut %1 Folders" ) );
193  mGenericManager->action( Akonadi::StandardActionManager::CutCollections )->setWhatsThis(
194  i18n( "Cut the selected folders from the account." ) );
195  mGenericManager->action( Akonadi::StandardActionManager::CutCollections )->setHelpText(
196  i18n( "Cut the selected folders from the account." ) );
197  break;
198  case Akonadi::StandardActionManager::CollectionProperties:
199  mGenericManager->action( Akonadi::StandardActionManager::CollectionProperties )->setText(
200  i18n( "Folder Properties..." ) );
201  mGenericManager->action( Akonadi::StandardActionManager::CollectionProperties)->setWhatsThis(
202  i18n( "Open a dialog to edit the properties of the selected folder." ) );
203  mGenericManager->action( Akonadi::StandardActionManager::CollectionProperties)->setHelpText(
204  i18n( "Open a dialog to edit the properties of the selected folder." ) );
205  break;
206  case Akonadi::StandardActionManager::CopyItems:
207  mGenericManager->setActionText( Akonadi::StandardActionManager::CopyItems,
208  ki18np( "Copy Message", "Copy %1 Messages" ) );
209  mGenericManager->action( Akonadi::StandardActionManager::CopyItems )->setWhatsThis(
210  i18n( "Copy the selected messages to the clipboard." ) );
211  mGenericManager->action( Akonadi::StandardActionManager::CopyItems )->setHelpText(
212  i18n( "Copy the selected messages to the clipboard." ) );
213  break;
214  case Akonadi::StandardActionManager::DeleteItems:
215  mGenericManager->setActionText( Akonadi::StandardActionManager::DeleteItems,
216  ki18np( "Delete Message", "Delete %1 Messages" ) );
217  mGenericManager->action( Akonadi::StandardActionManager::DeleteItems )->setWhatsThis(
218  i18n( "Delete the selected messages from the folder." ) );
219  mGenericManager->action( Akonadi::StandardActionManager::DeleteItems )->setHelpText(
220  i18n( "Delete the selected messages from the folder." ) );
221  mGenericManager->setContextText(
222  StandardActionManager::DeleteItems, StandardActionManager::MessageBoxText,
223  ki18np( "Do you really want to delete the selected message?",
224  "Do you really want to delete %1 messages?" ) );
225 
226  mGenericManager->setContextText(
227  StandardActionManager::DeleteItems, StandardActionManager::MessageBoxTitle,
228  ki18ncp( "@title:window", "Delete Message?", "Delete Messages?" ) );
229 
230  mGenericManager->setContextText(
231  StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageText,
232  ki18n( "Could not delete message: %1" ) );
233 
234  mGenericManager->setContextText(
235  StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageTitle,
236  i18n( "Message deletion failed" ) );
237  break;
238  case Akonadi::StandardActionManager::CutItems:
239  mGenericManager->setActionText( Akonadi::StandardActionManager::CutItems,
240  ki18np( "Cut Message", "Cut %1 Messages" ) );
241  mGenericManager->action( Akonadi::StandardActionManager::CutItems )->setWhatsThis(
242  i18n( "Cut the selected message from the folder." ) );
243  mGenericManager->action( Akonadi::StandardActionManager::CutItems )->setHelpText(
244  i18n( "Cut the selected message from the folder." ) );
245  break;
246  case Akonadi::StandardActionManager::CreateResource:
247  mGenericManager->action( Akonadi::StandardActionManager::CreateResource )->setText(
248  i18n( "Add &Account..." ) );
249  mGenericManager->action( Akonadi::StandardActionManager::CreateResource )->setWhatsThis(
250  i18n( "Add a new account<p>"
251  "You will be presented with a dialog where you can select "
252  "the type of the account that shall be added.</p>" ) );
253  mGenericManager->setContextText(
254  StandardActionManager::CreateResource, StandardActionManager::DialogTitle,
255  i18nc( "@title:window", "Add Account" ) );
256 
257  mGenericManager->setContextText(
258  StandardActionManager::CreateResource, StandardActionManager::ErrorMessageText,
259  ki18n( "Could not create account: %1" ) );
260 
261  mGenericManager->setContextText(
262  StandardActionManager::CreateResource, StandardActionManager::ErrorMessageTitle,
263  i18n( "Account creation failed" ) );
264  break;
265  case Akonadi::StandardActionManager::DeleteResources:
266  mGenericManager->setActionText( Akonadi::StandardActionManager::DeleteResources,
267  ki18np( "&Delete Account", "&Delete %1 Accounts" ) );
268  mGenericManager->action( Akonadi::StandardActionManager::DeleteResources )->setWhatsThis(
269  i18n( "Delete the selected accounts<p>"
270  "The currently selected accounts will be deleted, "
271  "along with all the messages they contain.</p>" ) );
272  mGenericManager->setContextText(
273  StandardActionManager::DeleteResources, StandardActionManager::MessageBoxText,
274  ki18np( "Do you really want to delete this account?",
275  "Do you really want to delete %1 accounts?" ) );
276 
277  mGenericManager->setContextText(
278  StandardActionManager::DeleteResources, StandardActionManager::MessageBoxTitle,
279  ki18ncp( "@title:window", "Delete Account?", "Delete Accounts?" ) );
280  break;
281  case Akonadi::StandardActionManager::ResourceProperties:
282  mGenericManager->action( Akonadi::StandardActionManager::ResourceProperties )->setText(
283  i18n( "Account Properties..." ) );
284  mGenericManager->action( Akonadi::StandardActionManager::ResourceProperties )->setWhatsThis(
285  i18n( "Open a dialog to edit properties of the selected account." ) );
286  break;
287  case Akonadi::StandardActionManager::SynchronizeResources:
288  mGenericManager->setActionText( Akonadi::StandardActionManager::SynchronizeResources,
289  ki18np( "Update Account", "Update %1 Accounts" ) );
290  mGenericManager->action( Akonadi::StandardActionManager::SynchronizeResources )->setWhatsThis(
291  i18n( "Updates the content of all folders of the selected accounts." ) );
292 
293  break;
294  case Akonadi::StandardActionManager::SynchronizeCollectionsRecursive:
295 
296  mGenericManager->setActionText( Akonadi::StandardActionManager::SynchronizeCollectionsRecursive,
297  ki18np( "Update This Folder and All Its Subfolders",
298  "Update These Folders and All Their Subfolders" ));
299 
300  mGenericManager->action( Akonadi::StandardActionManager::SynchronizeCollectionsRecursive )->setWhatsThis(
301  i18n( "Update the contents of the selected folders and all their subfolders." ) );
302  mGenericManager->action( Akonadi::StandardActionManager::SynchronizeCollectionsRecursive )->setHelpText(
303  i18n( "Update the contents of the selected folders and all their subfolders." ) );
304  break;
305  case Akonadi::StandardActionManager::Paste:
306  mGenericManager->setContextText(
307  StandardActionManager::Paste, StandardActionManager::ErrorMessageText,
308  ki18n( "Could not paste message: %1" ) );
309 
310  mGenericManager->setContextText(
311  StandardActionManager::Paste, StandardActionManager::ErrorMessageTitle,
312  i18n( "Paste failed" ) );
313  break;
314  default:
315  break;
316  }
317 
318  }
319 
320  void updateActions()
321  {
322  const Akonadi::Item::List selectedItems = mGenericManager->selectedItems();
323  const Akonadi::Collection::List selectedCollections = mGenericManager->selectedCollections();
324 
325  bool itemIsSelected = !selectedItems.isEmpty();
326  bool collectionIsSelected = !selectedCollections.isEmpty();
327 
328  if ( itemIsSelected ) {
329  bool allMarkedAsImportant = true;
330  bool allMarkedAsRead = true;
331  bool allMarkedAsUnread = true;
332  bool allMarkedAsActionItem = true;
333 
334  foreach ( const Akonadi::Item &item, selectedItems ) {
335  Akonadi::MessageStatus status;
336  status.setStatusFromFlags( item.flags() );
337  if ( !status.isImportant() ) {
338  allMarkedAsImportant = false;
339  }
340  if ( !status.isRead() ) {
341  allMarkedAsRead= false;
342  } else {
343  allMarkedAsUnread = false;
344  }
345  if ( !status.isToAct() ) {
346  allMarkedAsActionItem = false;
347  }
348  }
349 
350  QAction *action = mActions.value( Akonadi::StandardMailActionManager::MarkMailAsRead );
351  if ( action ) {
352  updateMarkAction( action, allMarkedAsRead );
353  if ( allMarkedAsRead ) {
354  action->setEnabled( false );
355  } else {
356  action->setEnabled( true );
357  }
358  }
359 
360  action = mActions.value( Akonadi::StandardMailActionManager::MarkMailAsUnread );
361  if ( action ) {
362  updateMarkAction( action, allMarkedAsUnread );
363  if ( allMarkedAsUnread ) {
364  action->setEnabled( false );
365  } else {
366  action->setEnabled( true );
367  }
368  }
369 
370  action = mActions.value( Akonadi::StandardMailActionManager::MarkMailAsImportant );
371  if ( action ) {
372  action->setCheckable(true);
373  updateMarkAction( action, allMarkedAsImportant );
374  if ( allMarkedAsImportant ) {
375  action->setText( i18n( "Remove Important Mark" ) );
376  action->setChecked(true);
377  } else {
378  action->setText( i18n( "&Mark Mail as Important" ) );
379  action->setChecked(false);
380  }
381  action->setEnabled( true );
382  }
383 
384  action = mActions.value( Akonadi::StandardMailActionManager::MarkMailAsActionItem );
385  if ( action ) {
386  action->setCheckable(true);
387  updateMarkAction( action, allMarkedAsActionItem );
388  if ( allMarkedAsActionItem ) {
389  action->setText( i18n( "Remove Action Item Mark" ) );
390  action->setChecked(true);
391  } else {
392  action->setText( i18n( "&Mark Mail as Action Item" ) );
393  action->setChecked(false);
394  }
395  action->setEnabled( true );
396  }
397  } else {
398  QAction *action = mActions.value( Akonadi::StandardMailActionManager::MarkMailAsRead );
399  if ( action ) {
400  action->setEnabled( false );
401  }
402 
403  action = mActions.value( Akonadi::StandardMailActionManager::MarkMailAsImportant );
404  if ( action ) {
405  action->setEnabled( false );
406  }
407 
408  action = mActions.value( Akonadi::StandardMailActionManager::MarkMailAsActionItem );
409  if ( action ) {
410  action->setEnabled( false );
411  }
412  }
413 
414  bool enableMarkAllAsRead = false;
415  bool enableMarkAllAsUnread = false;
416  bool canDeleteItem = true;
417  bool isSystemFolder = false;
418  if ( collectionIsSelected ) {
419  foreach ( const Collection &collection, selectedCollections ) {
420  if ( collection.isValid() ) {
421  const Akonadi::CollectionStatistics stats = collection.statistics();
422  if ( !enableMarkAllAsRead ) {
423  enableMarkAllAsRead = ( stats.unreadCount() > 0 );
424  }
425  if ( !enableMarkAllAsUnread ) {
426  enableMarkAllAsUnread = ( stats.count() != stats.unreadCount() );
427  }
428  if ( canDeleteItem ) {
429  canDeleteItem = collection.rights() & Akonadi::Collection::CanDeleteItem;
430  }
431  if ( !isSystemFolder ) {
432  isSystemFolder = ( collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Inbox ) ||
433  collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox ) ||
434  collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::SentMail ) ||
435  collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Trash ) ||
436  collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Drafts ) ||
437  collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Templates ) );
438  }
439  //We will not change after that.
440  if ( enableMarkAllAsRead && enableMarkAllAsUnread && !canDeleteItem && isSystemFolder ) {
441  break;
442  }
443  }
444  }
445  }
446  if ( isSystemFolder ) {
447  if ( mGenericManager->action( StandardActionManager::DeleteCollections ) ) {
448  mGenericManager->action( StandardActionManager::DeleteCollections )->setEnabled( false );
449  }
450  }
451 
452  if ( mActions.contains( Akonadi::StandardMailActionManager::MoveToTrash ) ) {
453  mActions.value( Akonadi::StandardMailActionManager::MoveToTrash )->setEnabled( itemIsSelected && canDeleteItem );
454  }
455  if ( mActions.contains( Akonadi::StandardMailActionManager::RemoveDuplicates ) ) {
456  mActions.value( Akonadi::StandardMailActionManager::RemoveDuplicates )->setEnabled( canDeleteItem );
457  }
458 
459  QAction *action = mActions.value( Akonadi::StandardMailActionManager::MarkAllMailAsRead );
460  if ( action ) {
461  action->setEnabled( enableMarkAllAsRead );
462  }
463 
464  action = mActions.value( Akonadi::StandardMailActionManager::MarkAllMailAsUnread );
465  if ( action ) {
466  action->setEnabled( enableMarkAllAsUnread );
467  }
468 
469  emit mParent->actionStateUpdated();
470  }
471 
472  void updateMarkAction( QAction* action, bool allMarked )
473  {
474  QByteArray data = action->data().toByteArray();
475  if ( allMarked ) {
476  if ( !data.startsWith( '!' ) ) {
477  data.prepend( '!' );
478  }
479  } else {
480  if ( data.startsWith( '!' ) ) {
481  data = data.mid( 1 );
482  }
483  }
484  action->setData( data );
485  }
486 
487  void slotMarkAs()
488  {
489  const QAction *action = qobject_cast<QAction*>( mParent->sender() );
490  Q_ASSERT( action );
491 
492  const Akonadi::Item::List items = mGenericManager->selectedItems();
493  if ( items.isEmpty() ) {
494  return;
495  }
496 
497  QByteArray typeStr = action->data().toByteArray();
498  kDebug() << "Mark mail as: " << typeStr;
499 
500  bool invert = false;
501  if ( typeStr.startsWith( '!' ) ) {
502  invert = true;
503  typeStr = typeStr.mid( 1 );
504  }
505 
506  Akonadi::MessageStatus targetStatus;
507  targetStatus.setStatusFromStr( QLatin1String( typeStr ) );
508 
509  StandardMailActionManager::Type type = MarkMailAsRead;
510  if ( typeStr == "U" ) {
511  type = MarkMailAsUnread;
512  targetStatus.setRead( true );
513  invert = true;
514  } else if ( typeStr == "K" ) {
515  type = MarkMailAsActionItem;
516  } else if ( typeStr == "G" ) {
517  type = MarkMailAsImportant;
518  }
519 
520  if ( mInterceptedActions.contains( type ) ) {
521  return;
522  }
523 
524  MarkAsCommand *command = new MarkAsCommand( targetStatus, items, invert, mParent );
525  command->execute();
526  }
527 
528  void slotMarkAllAs()
529  {
530  const QAction *action = qobject_cast<QAction*>( mParent->sender() );
531  Q_ASSERT( action );
532 
533  QByteArray typeStr = action->data().toByteArray();
534  kDebug() << "Mark all as: " << typeStr;
535 
536  const Akonadi::Collection::List collections = mGenericManager->selectedCollections();
537  if ( collections.isEmpty() ) {
538  return;
539  }
540 
541  Akonadi::MessageStatus targetStatus;
542  targetStatus.setStatusFromStr( QLatin1String( typeStr ) );
543 
544  bool invert = false;
545  if ( typeStr.startsWith( '!' ) ) {
546  invert = true;
547  typeStr = typeStr.mid( 1 );
548  }
549 
550  StandardMailActionManager::Type type = MarkAllMailAsRead;
551  if ( typeStr == "U" ) {
552  type = MarkAllMailAsUnread;
553  targetStatus.setRead( true );
554  invert = true;
555  } else if ( typeStr == "K" ) {
556  type = MarkAllMailAsActionItem;
557  } else if ( typeStr == "G" ) {
558  type = MarkAllMailAsImportant;
559  }
560 
561  if ( mInterceptedActions.contains( type ) ) {
562  return;
563  }
564 
565  MarkAsCommand *command = new MarkAsCommand( targetStatus, collections, invert, mParent );
566  command->execute();
567  }
568 
569  void slotMoveToTrash()
570  {
571  if ( mInterceptedActions.contains( StandardMailActionManager::MoveToTrash ) ) {
572  return;
573  }
574 
575  if ( mCollectionSelectionModel->selection().indexes().isEmpty() ) {
576  return;
577  }
578 
579  const Item::List items = mGenericManager->selectedItems();
580  if ( items.isEmpty() ) {
581  return;
582  }
583 
584  MoveToTrashCommand *command = new MoveToTrashCommand( mCollectionSelectionModel->model(), items, mParent );
585  command->execute();
586  }
587 
588  void slotMoveAllToTrash()
589  {
590  if ( mInterceptedActions.contains( StandardMailActionManager::MoveAllToTrash ) ) {
591  return;
592  }
593 
594  if ( mCollectionSelectionModel->selection().indexes().isEmpty() ) {
595  return;
596  }
597 
598  const Collection::List collections = mGenericManager->selectedCollections();
599  if ( collections.isEmpty() ) {
600  return;
601  }
602 
603  MoveToTrashCommand *command = new MoveToTrashCommand( mCollectionSelectionModel->model(), collections, mParent );
604  command->execute();
605  }
606 
607  void slotRemoveDuplicates()
608  {
609  if ( mInterceptedActions.contains( StandardMailActionManager::RemoveDuplicates ) ) {
610  return;
611  }
612 
613  const Collection::List collections = mGenericManager->selectedCollections();
614  if ( collections.isEmpty() ) {
615  return;
616  }
617 
618  RemoveDuplicatesJob *job = new RemoveDuplicatesJob( collections, mParent );
619  connect( job, SIGNAL(finished(KJob*)), mParent, SLOT(slotJobFinished(KJob*)) );
620  }
621 
622  void slotJobFinished( KJob *job )
623  {
624  if ( job->error() ) {
625  Util::showJobError( job );
626  }
627  }
628 
629  void slotEmptyAllTrash()
630  {
631  if ( mInterceptedActions.contains( StandardMailActionManager::EmptyAllTrash ) ) {
632  return;
633  }
634 
635  EmptyTrashCommand *command = new EmptyTrashCommand( const_cast<QAbstractItemModel*>( mCollectionSelectionModel->model() ), mParent );
636  command->execute();
637  }
638 
639  void slotEmptyTrash()
640  {
641  if ( mInterceptedActions.contains( StandardMailActionManager::EmptyTrash ) ) {
642  return;
643  }
644 
645  if ( mCollectionSelectionModel->selection().indexes().isEmpty() ) {
646  return;
647  }
648 
649  const Collection::List collections = mGenericManager->selectedCollections();
650  if ( collections.count() != 1 ) {
651  return;
652  }
653 
654  EmptyTrashCommand *command = new EmptyTrashCommand( collections.first(), mParent );
655  command->execute();
656  }
657 
658  KActionCollection *mActionCollection;
659  QWidget *mParentWidget;
660  StandardActionManager *mGenericManager;
661  QItemSelectionModel *mCollectionSelectionModel;
662  QItemSelectionModel *mItemSelectionModel;
663  QHash<StandardMailActionManager::Type, KAction*> mActions;
664  QSet<StandardMailActionManager::Type> mInterceptedActions;
665  StandardMailActionManager *mParent;
666 };
667 
668 StandardMailActionManager::StandardMailActionManager( KActionCollection *actionCollection, QWidget *parent )
669  : QObject( parent ), d( new Private( actionCollection, parent, this ) )
670 {
671 }
672 
673 StandardMailActionManager::~StandardMailActionManager()
674 {
675  delete d;
676 }
677 
678 void StandardMailActionManager::setCollectionSelectionModel( QItemSelectionModel *selectionModel )
679 {
680  d->mCollectionSelectionModel = selectionModel;
681  d->mGenericManager->setCollectionSelectionModel( selectionModel );
682 
683  connect( selectionModel->model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
684  SLOT(updateActions()) );
685  connect( selectionModel->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
686  SLOT(updateActions()) );
687  connect( selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
688  SLOT(updateActions()) );
689 
690  d->updateActions();
691 }
692 
693 void StandardMailActionManager::setItemSelectionModel( QItemSelectionModel* selectionModel )
694 {
695  d->mItemSelectionModel = selectionModel;
696  d->mGenericManager->setItemSelectionModel( selectionModel );
697 
698  connect( selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
699  SLOT(updateActions()) );
700 
701  //to catch item modifications, listen to the model's dataChanged signal as well
702  connect( selectionModel->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
703  SLOT(updateActions()) );
704 
705  d->updateActions();
706 }
707 
708 KAction* StandardMailActionManager::createAction( Type type )
709 {
710  if ( d->mActions.contains( type ) ) {
711  return d->mActions.value( type );
712  }
713 
714  KAction *action = 0;
715 
716  switch ( type ) {
717  case MarkMailAsRead:
718  action = new KAction( d->mParentWidget );
719  action->setIcon( KIcon( QLatin1String( "mail-mark-read" ) ) );
720  action->setText( i18n( "&Mark Message as Read" ) );
721  action->setIconText( i18n( "Mark as Read" ) );
722  action->setHelpText( i18n( "Mark selected messages as read." ) );
723  action->setWhatsThis( i18n( "Mark selected messages as read." ) );
724  d->mActions.insert( MarkMailAsRead, action );
725  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_as_read" ), action );
726  action->setData( QByteArray( "R" ) );
727  action->setShortcut( Qt::CTRL+Qt::Key_R );
728  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAs()) );
729  break;
730  case MarkMailAsUnread:
731  action = new KAction( d->mParentWidget );
732  action->setIcon( KIcon( QLatin1String( "mail-mark-unread" ) ) );
733  action->setText( i18n( "&Mark Message as Unread" ) );
734  action->setIconText( i18n( "Mark as Unread" ) );
735  action->setHelpText( i18n( "Mark selected messages as unread." ) );
736  action->setWhatsThis( i18n( "Mark selected messages as unread." ) );
737  d->mActions.insert( MarkMailAsUnread, action );
738  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_as_unread" ), action );
739  action->setShortcut( Qt::CTRL+Qt::Key_U );
740  action->setData( QByteArray( "U" ) );
741  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAs()) );
742  break;
743  case MarkMailAsImportant:
744  action = new KAction( d->mParentWidget );
745  action->setIcon( KIcon( QLatin1String( "mail-mark-important" ) ) );
746  action->setText( i18n( "&Mark Message as Important" ) );
747  action->setIconText( i18n( "Mark as Important" ) );
748  action->setHelpText( i18n( "Mark selected messages as important." ) );
749 
750  d->mActions.insert( MarkMailAsImportant, action );
751  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_as_important" ), action );
752  action->setData( QByteArray( "G" ) );
753  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAs()) );
754  break;
755  case MarkMailAsActionItem:
756  action = new KAction( d->mParentWidget );
757  action->setIcon( KIcon( QLatin1String( "mail-mark-task" ) ) );
758  action->setText( i18n( "&Mark Message as Action Item" ) );
759  action->setIconText( i18n( "Mark as Action Item" ) );
760  action->setHelpText( i18n( "Mark selected messages as action items." ) );
761  action->setWhatsThis( i18n( "Mark selected messages as action items." ) );
762  d->mActions.insert( MarkMailAsActionItem, action );
763  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_as_action_item" ), action );
764  action->setData( QByteArray( "K" ) );
765  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAs()) );
766  break;
767  case MarkAllMailAsRead:
768  action = new KAction( d->mParentWidget );
769  action->setIcon( KIcon( QLatin1String( "mail-mark-read" ) ) );
770  action->setText( i18n( "Mark &All Messages as Read" ) );
771  action->setIconText( i18n( "Mark All as Read" ) );
772  action->setHelpText( i18n( "Mark all messages as read." ) );
773  action->setWhatsThis( i18n( "Mark all messages as read." ) );
774  d->mActions.insert( MarkAllMailAsRead, action );
775  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_all_as_read" ), action );
776  action->setData( QByteArray( "R" ) );
777  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAllAs()) );
778  break;
779  case MarkAllMailAsUnread:
780  action = new KAction( d->mParentWidget );
781  action->setIcon( KIcon( QLatin1String( "mail-mark-unread" ) ) );
782  action->setText( i18n( "Mark &All Messages as Unread" ) );
783  action->setIconText( i18n( "Mark All as Unread" ) );
784  action->setHelpText( i18n( "Mark all messages as unread." ) );
785  action->setWhatsThis( i18n( "Mark all messages as unread." ) );
786  d->mActions.insert( MarkAllMailAsUnread, action );
787  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_all_as_unread" ), action );
788  action->setData( QByteArray( "U" ) );
789  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAllAs()) );
790  break;
791  case MarkAllMailAsImportant:
792  action = new KAction( d->mParentWidget );
793  action->setIcon( KIcon( QLatin1String( "mail-mark-important" ) ) );
794  action->setText( i18n( "Mark &All Messages as Important" ) );
795  action->setIconText( i18n( "Mark All as Important" ) );
796  action->setHelpText( i18n( "Mark all messages as important." ) );
797  action->setWhatsThis( i18n( "Mark all messages as important." ) );
798  d->mActions.insert( MarkAllMailAsImportant, action );
799  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_all_as_important" ), action );
800  action->setData( QByteArray( "G" ) );
801  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAllAs()) );
802  break;
803  case MarkAllMailAsActionItem:
804  action = new KAction( d->mParentWidget );
805  action->setIconText( i18n( "Mark All as Action Item" ) );
806  action->setText( i18n( "Mark &All Messages as Action Item" ) );
807  action->setIcon( KIcon( QLatin1String( "mail-mark-task" ) ) );
808  action->setHelpText( i18n( "Mark all messages as action items." ) );
809  action->setWhatsThis( i18n( "Mark all messages as action items." ) );
810  d->mActions.insert( MarkAllMailAsActionItem, action );
811  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_mark_all_as_action_item" ), action );
812  action->setData( QByteArray( "K" ) );
813  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMarkAllAs()) );
814  break;
815  case MoveToTrash:
816  action = new KAction( d->mParentWidget );
817  action->setIcon( KIcon( QLatin1String( "user-trash" ) ) );
818  action->setText( i18n( "Move to &Trash" ) );
819  action->setShortcut( QKeySequence( Qt::Key_Delete ) );
820  action->setHelpText( i18n( "Move selected messages to the trash folder." ) );
821  action->setWhatsThis( i18n( "Move selected messages to the trash folder." ) );
822  d->mActions.insert( MoveToTrash, action );
823  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_move_to_trash" ), action );
824  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMoveToTrash()) );
825  break;
826  case MoveAllToTrash:
827  action = new KAction( d->mParentWidget );
828  action->setIcon( KIcon( QLatin1String( "user-trash" ) ) );
829  action->setText( i18n( "Move All to &Trash" ) );
830  action->setHelpText( i18n( "Move all messages to the trash folder." ) );
831  action->setWhatsThis( i18n( "Move all messages to the trash folder." ) );
832  d->mActions.insert( MoveAllToTrash, action );
833  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_move_all_to_trash" ), action );
834  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotMoveAllToTrash()) );
835  break;
836  case RemoveDuplicates:
837  action = new KAction( d->mParentWidget );
838  action->setText( i18n( "Remove &Duplicate Messages" ) );
839  action->setHelpText( i18n( "Remove duplicate messages." ) );
840  action->setWhatsThis( i18n( "Remove duplicate messages." ) );
841  action->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_Asterisk ) );
842  d->mActions.insert( RemoveDuplicates, action );
843  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_remove_duplicates" ), action );
844  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotRemoveDuplicates()) );
845  break;
846  case EmptyAllTrash:
847  action = new KAction( d->mParentWidget );
848  action->setText( i18n( "Empty All &Trash Folders" ) );
849  action->setHelpText( i18n( "Permanently delete all messages from all trash folders." ) );
850  action->setWhatsThis( i18n( "Permanently delete all messages from all trash folders." ) );
851  d->mActions.insert( EmptyAllTrash, action );
852  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_empty_all_trash" ), action );
853  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotEmptyAllTrash()) );
854  break;
855  case EmptyTrash:
856  action = new KAction( d->mParentWidget );
857  action->setText( i18n( "E&mpty Trash" ) );
858  action->setHelpText( i18n( "Permanently delete all messages from the trash folder." ) );
859  action->setWhatsThis( i18n( "Permanently delete all messages from the trash folder." ) );
860  d->mActions.insert( EmptyTrash, action );
861  d->mActionCollection->addAction( QString::fromLatin1( "akonadi_empty_trash" ), action );
862  connect( action, SIGNAL(triggered(bool)), this, SLOT(slotEmptyTrash()) );
863  break;
864  default:
865  Q_ASSERT( false ); // should never happen
866  break;
867  }
868 
869  return action;
870 }
871 
872 KAction* StandardMailActionManager::createAction( StandardActionManager::Type type )
873 {
874  KAction *act = d->mGenericManager->action(type);
875  if (!act )
876  act = d->mGenericManager->createAction( type );
877  d->updateGenericAction(type);
878  return act;
879 }
880 
881 void StandardMailActionManager::createAllActions()
882 {
883  createAction( MarkMailAsRead );
884  createAction( MarkMailAsUnread );
885  createAction( MarkMailAsImportant );
886  createAction( MarkMailAsActionItem );
887  createAction( MarkAllMailAsRead );
888  createAction( MarkAllMailAsUnread );
889  createAction( MarkAllMailAsImportant );
890  createAction( MarkAllMailAsActionItem );
891  createAction( MoveToTrash );
892  createAction( MoveAllToTrash );
893  createAction( RemoveDuplicates );
894  createAction( EmptyAllTrash );
895  createAction( EmptyTrash );
896 
897  d->mGenericManager->createAllActions();
898  d->updateGenericAllActions();
899 
900  d->updateActions();
901 }
902 
903 KAction* StandardMailActionManager::action( Type type ) const
904 {
905  if ( d->mActions.contains( type ) ) {
906  return d->mActions.value( type );
907  }
908 
909  return 0;
910 }
911 
912 KAction* StandardMailActionManager::action( StandardActionManager::Type type ) const
913 {
914  return d->mGenericManager->action( type );
915 }
916 
917 void StandardMailActionManager::setActionText( StandardActionManager::Type type, const KLocalizedString &text )
918 {
919  d->mGenericManager->setActionText( type, text );
920 }
921 
922 void StandardMailActionManager::interceptAction( Type type, bool intercept )
923 {
924  if ( intercept ) {
925  d->mInterceptedActions.insert( type );
926  } else {
927  d->mInterceptedActions.remove( type );
928  }
929 }
930 
931 void StandardMailActionManager::interceptAction( StandardActionManager::Type type, bool intercept )
932 {
933  d->mGenericManager->interceptAction( type, intercept );
934 }
935 
936 Akonadi::Collection::List StandardMailActionManager::selectedCollections() const
937 {
938  return d->mGenericManager->selectedCollections();
939 }
940 
941 Akonadi::Item::List StandardMailActionManager::selectedItems() const
942 {
943  return d->mGenericManager->selectedItems();
944 }
945 
946 void StandardMailActionManager::setFavoriteCollectionsModel( FavoriteCollectionsModel *favoritesModel )
947 {
948  d->mGenericManager->setFavoriteCollectionsModel( favoritesModel );
949 }
950 
951 void StandardMailActionManager::setFavoriteSelectionModel( QItemSelectionModel *selectionModel )
952 {
953  d->mGenericManager->setFavoriteSelectionModel( selectionModel );
954 }
955 
956 void StandardMailActionManager::setCollectionPropertiesPageNames( const QStringList &names )
957 {
958  d->mGenericManager->setCollectionPropertiesPageNames( names );
959 }
960 
961 Akonadi::StandardActionManager* StandardMailActionManager::standardActionManager() const
962 {
963  return d->mGenericManager;
964 }
965 
966 #include "moc_standardmailactionmanager.cpp"
Akonadi::StandardMailActionManager::MarkMailAsActionItem
Marks a mail as action item.
Definition: standardmailactionmanager.h:59
Akonadi::StandardMailActionManager::createAllActions
void createAllActions()
Convenience method to create all standard actions.
Definition: standardmailactionmanager.cpp:881
Akonadi::MessageStatus::setRead
void setRead(bool read=true)
Set the status to read.
Definition: messagestatus.cpp:302
Akonadi::SpecialMailCollections::Trash
The trash collection.
Definition: specialmailcollections.h:85
Akonadi::StandardMailActionManager::MarkMailAsRead
Marks a mail as read.
Definition: standardmailactionmanager.h:56
Akonadi::StandardMailActionManager::MarkMailAsImportant
Marks a mail as important.
Definition: standardmailactionmanager.h:58
Akonadi::SpecialMailCollections::Templates
The templates collection.
Definition: specialmailcollections.h:87
Akonadi::StandardMailActionManager::selectedItems
Akonadi::Item::List selectedItems() const
Returns the list of items that are currently selected.
Definition: standardmailactionmanager.cpp:941
Akonadi::StandardMailActionManager::interceptAction
void interceptAction(Type type, bool intercept=true)
Sets whether the default implementation for the given action type shall be executed when the action i...
Definition: standardmailactionmanager.cpp:922
Akonadi::StandardMailActionManager::MarkAllMailAsUnread
Marks all mails in a folder as unread.
Definition: standardmailactionmanager.h:61
Akonadi::StandardMailActionManager::MoveToTrash
Move all selected messages and folders to trash.
Definition: standardmailactionmanager.h:64
Akonadi::StandardMailActionManager::actionStateUpdated
void actionStateUpdated()
This signal is emitted whenever the action state has been updated.
Akonadi::SpecialMailCollections::Inbox
The inbox collection.
Definition: specialmailcollections.h:82
Akonadi::StandardMailActionManager::createAction
KAction * createAction(Type type)
Creates the action of the given type and adds it to the action collection specified in the constructo...
Definition: standardmailactionmanager.cpp:708
Akonadi::MessageStatus::setStatusFromFlags
void setStatusFromFlags(const QSet< QByteArray > &flags)
Set the status as a whole e.g.
Definition: messagestatus.cpp:619
Akonadi::StandardMailActionManager::setItemSelectionModel
void setItemSelectionModel(QItemSelectionModel *selectionModel)
Sets the item selection model based on which the item related actions should operate.
Definition: standardmailactionmanager.cpp:693
Akonadi::SpecialMailCollections::Outbox
The outbox collection.
Definition: specialmailcollections.h:83
Akonadi::StandardMailActionManager::Type
Type
Describes the supported actions.
Definition: standardmailactionmanager.h:55
Akonadi::SpecialMailCollections::SentMail
The sent-mail collection.
Definition: specialmailcollections.h:84
Akonadi::MessageStatus::isToAct
bool isToAct() const
Check for ToAct status.
Definition: messagestatus.cpp:262
Akonadi::StandardMailActionManager::setFavoriteCollectionsModel
void setFavoriteCollectionsModel(FavoriteCollectionsModel *favoritesModel)
Sets the favorite collections model based on which the collection relatedactions should operate...
Definition: standardmailactionmanager.cpp:946
Akonadi::StandardMailActionManager::selectedCollections
Akonadi::Collection::List selectedCollections() const
Returns the list of collections that are currently selected.
Definition: standardmailactionmanager.cpp:936
Akonadi::SpecialMailCollections::self
static SpecialMailCollections * self()
Returns the global SpecialMailCollections instance.
Definition: specialmailcollections.cpp:97
Akonadi::StandardMailActionManager::EmptyTrash
Empties the trash folder, if a trash folder was selected.
Definition: standardmailactionmanager.h:68
Akonadi::StandardMailActionManager::action
KAction * action(Type type) const
Returns the action of the given type, 0 if it has not been created (yet).
Definition: standardmailactionmanager.cpp:903
Akonadi::StandardMailActionManager::MarkAllMailAsImportant
Marks all mails in a folder as important.
Definition: standardmailactionmanager.h:62
Akonadi::StandardMailActionManager::StandardMailActionManager
StandardMailActionManager(KActionCollection *actionCollection, QWidget *parent=0)
Creates a new standard mail action manager.
Definition: standardmailactionmanager.cpp:668
Akonadi::StandardMailActionManager
Manages emails specific actions for collection and item views.
Definition: standardmailactionmanager.h:47
Akonadi::StandardMailActionManager::MarkAllMailAsActionItem
Marks all mails in a folder as action item.
Definition: standardmailactionmanager.h:63
Akonadi::RemoveDuplicatesJob
Job that finds and removes duplicate messages in given collection.
Definition: removeduplicatesjob.h:41
Akonadi::StandardMailActionManager::setActionText
void setActionText(StandardActionManager::Type type, const KLocalizedString &text)
Sets the label of the action type to text, which is used during updating the action state and substit...
Definition: standardmailactionmanager.cpp:917
Akonadi::SpecialMailCollections::Drafts
The drafts collection.
Definition: specialmailcollections.h:86
Akonadi::MessageStatus
Akonadi KMime Message Status.
Definition: messagestatus.h:51
Akonadi::StandardMailActionManager::~StandardMailActionManager
~StandardMailActionManager()
Destroys the standard mail action manager.
Definition: standardmailactionmanager.cpp:673
Akonadi::StandardMailActionManager::EmptyAllTrash
Empties trash folders on all accounts.
Definition: standardmailactionmanager.h:67
Akonadi::SpecialMailCollections::defaultCollection
Akonadi::Collection defaultCollection(Type type) const
Returns the special mail collection of given type in the default resource, or an invalid collection i...
Definition: specialmailcollections.cpp:131
Akonadi::StandardMailActionManager::setFavoriteSelectionModel
void setFavoriteSelectionModel(QItemSelectionModel *selectionModel)
Sets the favorite collection selection model based on which the favorite collection related actions s...
Definition: standardmailactionmanager.cpp:951
Akonadi::MessageStatus::setStatusFromStr
void setStatusFromStr(const QString &aStr)
Set the status based on a string representation.
Definition: messagestatus.cpp:520
Akonadi::StandardMailActionManager::RemoveDuplicates
Removes all duplicated messages.
Definition: standardmailactionmanager.h:66
Akonadi::StandardMailActionManager::MoveAllToTrash
Move all messages of the current folder to trash.
Definition: standardmailactionmanager.h:65
Akonadi::StandardMailActionManager::MarkAllMailAsRead
Marks all mails in a folder as read.
Definition: standardmailactionmanager.h:60
Akonadi::StandardMailActionManager::setCollectionSelectionModel
void setCollectionSelectionModel(QItemSelectionModel *selectionModel)
Sets the collection selection model based on which the collection related actions should operate...
Definition: standardmailactionmanager.cpp:678
Akonadi::MessageStatus::isRead
bool isRead() const
Check for Read status.
Definition: messagestatus.cpp:217
Akonadi::StandardMailActionManager::MarkMailAsUnread
Marks a mail as unread.
Definition: standardmailactionmanager.h:57
Akonadi::MessageStatus::isImportant
bool isImportant() const
Check for Important status.
Definition: messagestatus.cpp:247
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:55 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi/kmime

Skip menu "akonadi/kmime"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

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