digiKam
importcontextmenu.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2012-07-13
7  * Description : Modified context menu helper for import tool
8  *
9  * Copyright (C) 2012 by Islam Wazery <wazery at ubuntu dot com>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_IMPORT_CONTEXT_MENU_H
26 #define DIGIKAM_IMPORT_CONTEXT_MENU_H
27 
28 // Qt includes
29 
30 #include <QMenu>
31 
32 // Local includes
33 
34 #include "digikam_config.h"
35 #include "camiteminfo.h"
36 #include "importfiltermodel.h"
37 
38 class QAction;
39 
40 class KActionCollection;
41 
42 namespace Digikam
43 {
44 
45 class ImportContextMenuHelper : public QObject
46 {
47  Q_OBJECT
48 
49 public:
50 
51  typedef const QList<qlonglong> itemIds;
52 
53 Q_SIGNALS:
54 
55 /*
56  void signalAssignTag(int);
57  void signalRemoveTag(int);
58  void signalPopupTagsView();
59 */
62  void signalAssignRating(int);
63  void signalAddNewTagFromABCMenu(const QString&);
64 /*
65  TODO
66  void signalCreateGroup();
67  void signalUngroup();
68  void signalRemoveFromGroup();
69 */
70 public:
71 
79  explicit ImportContextMenuHelper(QMenu* const parent, KActionCollection* const actionCollection = nullptr);
80  ~ImportContextMenuHelper() override;
81 
91  void addAction(const QString& name, bool addDisabled = false);
92 
102  void addAction(QAction* action, bool addDisabled = false);
103 
115  void addAction(QAction* action, QObject* recv, const char* slot, bool addDisabled = false);
116 
126  void addServicesMenu(const QList<QUrl>& selectedItems);
127 
133 /*
134  TODO
135  void addActionNewTag(TagModificationHelper* helper, TAlbum* parentTag = 0);
136  void addActionDeleteTag(TagModificationHelper* helper, TAlbum* tag);
137  void addActionEditTag(TagModificationHelper* helper, TAlbum* tag);
138 */
153  void addAssignTagsMenu(itemIds& ids);
154 
169  void addRemoveTagsMenu(itemIds& ids);
170 
185  void addLabelsAction();
186 
191  void addRotateMenu(itemIds& ids);
192 
200  void addGroupMenu(itemIds& ids);
202 
208 
214  void addSubMenu(QMenu* subMenu);
215 
219  void addSeparator();
220 
231  QAction* exec(const QPoint& pos, QAction* at = nullptr);
232 
233 private Q_SLOTS:
234 
235  void slotOpenWith();
236  void slotOpenWith(QAction* action);
237 /*
238  void slotABCImportContextMenu();
239 */
240  void slotABCMenuTriggered(QAction*);
241 /*
242  void slotOpenGroups();
243  void slotCloseGroups();
244  void slotOpenAllGroups();
245  void slotCloseAllGroups();
246 */
247  void slotRotate();
248 
249 private:
250 
251  void setSelectedIds(itemIds& ids);
252  void setSelectedItems(const QList<QUrl>& urls);
253 /*
254  QList<QAction*> groupMenuActions(itemIds& ids);
255 */
256  void setGroupsOpen(bool open);
257 
258 private:
259 
260  class Private;
261  Private* const d;
262 };
263 
264 } // namespace Digikam
265 
266 #endif // DIGIKAM_IMPORT_CONTEXT_MENU_H
Definition: importcontextmenu.h:46
void addLabelsAction()
Definition: importcontextmenu.cpp:426
void addAction(const QString &name, bool addDisabled=false)
Definition: importcontextmenu.cpp:153
ImportContextMenuHelper(QMenu *const parent, KActionCollection *const actionCollection=nullptr)
Definition: importcontextmenu.cpp:132
void setImportFilterModel(ImportFilterModel *model)
Definition: importcontextmenu.cpp:453
void addGroupActions(itemIds &ids)
const QList< qlonglong > itemIds
Definition: importcontextmenu.h:51
void addRemoveTagsMenu(itemIds &ids)
Definition: importcontextmenu.cpp:411
void signalAddNewTagFromABCMenu(const QString &)
QAction * exec(const QPoint &pos, QAction *at=nullptr)
Definition: importcontextmenu.cpp:458
void addRotateMenu(itemIds &ids)
Definition: importcontextmenu.cpp:351
void addAssignTagsMenu(itemIds &ids)
Definition: importcontextmenu.cpp:393
~ImportContextMenuHelper() override
Definition: importcontextmenu.cpp:148
void addServicesMenu(const QList< QUrl > &selectedItems)
Definition: importcontextmenu.cpp:196
void addSubMenu(QMenu *subMenu)
Definition: importcontextmenu.cpp:172
void addSeparator()
Definition: importcontextmenu.cpp:177
void addGroupMenu(itemIds &ids)
Definition: importfiltermodel.h:101
Definition: datefolderview.cpp:43