Akonadi

standardactionmanager.h
1 /*
2  Copyright (c) 2008 Volker Krause <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef AKONADI_STANDARDACTIONMANAGER_H
21 #define AKONADI_STANDARDACTIONMANAGER_H
22 
23 #include "akonadiwidgets_export.h"
24 
25 #include <QObject>
26 
27 #include "collection.h"
28 #include "item.h"
29 
30 class QAction;
31 class KActionCollection;
32 class KLocalizedString;
34 class QWidget;
35 class QMenu;
36 
37 namespace Akonadi
38 {
39 
40 class FavoriteCollectionsModel;
41 
127 class AKONADIWIDGETS_EXPORT StandardActionManager : public QObject
128 {
129  Q_OBJECT
130 public:
134  enum Type {
173  LastType
174  };
175 
179  enum TextContext {
186  ErrorMessageText
187  };
188 
195  explicit StandardActionManager(KActionCollection *actionCollection, QWidget *parent = nullptr);
196 
201 
209  void setCollectionSelectionModel(QItemSelectionModel *selectionModel);
210 
217  void setItemSelectionModel(QItemSelectionModel *selectionModel);
218 
227  void setFavoriteCollectionsModel(FavoriteCollectionsModel *favoritesModel);
228 
237  void setFavoriteSelectionModel(QItemSelectionModel *selectionModel);
238 
246  QAction *createAction(Type type);
247 
252  void createAllActions();
253 
258  QAction *action(Type type) const;
259 
273  void setActionText(Type type, const KLocalizedString &text);
274 
285  void interceptAction(Type type, bool intercept = true);
286 
293  Akonadi::Collection::List selectedCollections() const;
294 
301  Akonadi::Item::List selectedItems() const;
302 
311  void setContextText(Type type, TextContext context, const QString &text);
312 
321  void setContextText(Type type, TextContext context, const KLocalizedString &text);
322 
329  void setMimeTypeFilter(const QStringList &mimeTypes);
330 
337  void setCapabilityFilter(const QStringList &capabilities);
338 
346  void setCollectionPropertiesPageNames(const QStringList &names);
347 
355  void createActionFolderMenu(QMenu *menu, Type type);
356 
357 Q_SIGNALS:
363  void actionStateUpdated();
364 
365 private:
366  //@cond PRIVATE
367  class Private;
368  Private *const d;
369 
370  Q_PRIVATE_SLOT(d, void updateActions())
371 #ifndef QT_NO_CLIPBOARD
372  Q_PRIVATE_SLOT(d, void clipboardChanged(QClipboard::Mode))
373 #endif
374  Q_PRIVATE_SLOT(d, void collectionSelectionChanged())
375  Q_PRIVATE_SLOT(d, void favoriteSelectionChanged())
376 
377  Q_PRIVATE_SLOT(d, void slotCreateCollection())
378  Q_PRIVATE_SLOT(d, void slotCopyCollections())
379  Q_PRIVATE_SLOT(d, void slotCutCollections())
380  Q_PRIVATE_SLOT(d, void slotDeleteCollection())
381  Q_PRIVATE_SLOT(d, void slotMoveCollectionToTrash())
382  Q_PRIVATE_SLOT(d, void slotMoveItemToTrash())
383  Q_PRIVATE_SLOT(d, void slotRestoreCollectionFromTrash())
384  Q_PRIVATE_SLOT(d, void slotRestoreItemFromTrash())
385  Q_PRIVATE_SLOT(d, void slotTrashRestoreCollection())
386  Q_PRIVATE_SLOT(d, void slotTrashRestoreItem())
387  Q_PRIVATE_SLOT(d, void slotSynchronizeCollection())
388  Q_PRIVATE_SLOT(d, void slotSynchronizeCollectionRecursive())
389  Q_PRIVATE_SLOT(d, void slotSynchronizeFavoriteCollections())
390  Q_PRIVATE_SLOT(d, void slotCollectionProperties())
391  Q_PRIVATE_SLOT(d, void slotCopyItems())
392  Q_PRIVATE_SLOT(d, void slotCutItems())
393  Q_PRIVATE_SLOT(d, void slotPaste())
394  Q_PRIVATE_SLOT(d, void slotDeleteItems())
395  Q_PRIVATE_SLOT(d, void slotDeleteItemsDeferred(const Akonadi::Item::List &))
396  Q_PRIVATE_SLOT(d, void slotLocalSubscription())
397  Q_PRIVATE_SLOT(d, void slotAddToFavorites())
398  Q_PRIVATE_SLOT(d, void slotRemoveFromFavorites())
399  Q_PRIVATE_SLOT(d, void slotRenameFavorite())
400  Q_PRIVATE_SLOT(d, void slotCopyCollectionTo())
401  Q_PRIVATE_SLOT(d, void slotMoveCollectionTo())
402  Q_PRIVATE_SLOT(d, void slotCopyItemTo())
403  Q_PRIVATE_SLOT(d, void slotMoveItemTo())
404  Q_PRIVATE_SLOT(d, void slotCopyCollectionTo(QAction *))
405  Q_PRIVATE_SLOT(d, void slotMoveCollectionTo(QAction *))
406  Q_PRIVATE_SLOT(d, void slotCopyItemTo(QAction *))
407  Q_PRIVATE_SLOT(d, void slotMoveItemTo(QAction *))
408  Q_PRIVATE_SLOT(d, void slotCreateResource())
409  Q_PRIVATE_SLOT(d, void slotDeleteResource())
410  Q_PRIVATE_SLOT(d, void slotResourceProperties())
411  Q_PRIVATE_SLOT(d, void slotSynchronizeResource())
412  Q_PRIVATE_SLOT(d, void slotToggleWorkOffline(bool))
413  Q_PRIVATE_SLOT(d, void slotSynchronizeCollectionTree())
414  Q_PRIVATE_SLOT(d, void collectionCreationResult(KJob *))
415  Q_PRIVATE_SLOT(d, void moveItemToTrashResult(KJob *))
416  Q_PRIVATE_SLOT(d, void resourceCreationResult(KJob *))
417  Q_PRIVATE_SLOT(d, void pasteResult(KJob *))
418 
419  Q_PRIVATE_SLOT(d, void enableAction(int, bool))
420  Q_PRIVATE_SLOT(d, void updatePluralLabel(int, int))
421  Q_PRIVATE_SLOT(d, void updateAlternatingAction(int))
422  Q_PRIVATE_SLOT(d, bool isFavoriteCollection(const Akonadi::Collection &))
423 
424  Q_PRIVATE_SLOT(d, void aboutToShowMenu())
425  //@endcond
426 };
427 
428 }
429 
430 #endif
Type
Describes the supported actions.
Moves the selected items to trash and marks them as deleted, needs EntityDeletedAttribute.
TextContext
Describes the text context that can be customized.
Helper type for MoveToTrashRestoreItem, do not create directly. Use this to override texts of the res...
Menu allowing to move item into a collection.
Moves the selected collection to trash and marks it as deleted, needs EntityDeletedAttribute.
Manages generic actions for collection and item views.
Copy a collection into another collection, select the target in a dialog.
Represents a collection of PIM items.
Definition: collection.h:76
Restores the selected items from trash, needs EntityDeletedAttribute.
Toggles the work offline state of all resources.
Restores the selected collection from trash, needs EntityDeletedAttribute.
Helper type for MoveToTrashRestoreCollection, do not create directly. Use this to override texts of t...
Remove the collection from the favorite collections model.
Copy an item into a collection, select the target in a dialog.
Add the collection to the favorite collections model.
Menu allowing to quickly copy a collection into another collection.
Menu allowing to quickly copy an item into a collection.
Helper integration between Akonadi and Qt.
Move Item to Trash or Restore it from Trash, needs EntityDeletedAttribute.
Move an item into a collection, select the target in a dialog.
Move a collection into another collection, select the target in a dialog.
Move Collection to Trash or Restore it from Trash, needs EntityDeletedAttribute.
Menu allowing to move a collection into another collection.
A model that lists a set of favorite collections.
Rename the collection of the favorite collections model.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon May 25 2020 22:46:11 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.