1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2008-01-14
7  * Description : Basic search tree view with editing functionality
8  *
9  * Copyright (C) 2008-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2009-2010 by Johannes Wienke <languitar at semipol dot de>
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_EDITABLE_SEARCH_TREE_VIEW_H
26 #define DIGIKAM_EDITABLE_SEARCH_TREE_VIEW_H
27 
28 // Local includes
29 
30 #include "searchtreeview.h"
31 #include "searchmodificationhelper.h"
32 
33 namespace Digikam
34 {
35 
36 /**
37  * This tree view for searches adds basic editing functionality via the context
38  * menu. This is in detail deleting and renaming existing searches.
39  *
40  * @author jwienke
41  */
42 class EditableSearchTreeView: public SearchTreeView
43 {
44     Q_OBJECT
45 
46 public:
47 
48     /**
49      * Constructor.
50      *
51      * @param parent qt parent
52      * @param searchModel the model this view should act on
53      * @param searchModificationHelper the modification helper object used to
54      *                                 perform operations on the displayed
55      *                                 searches
56      */
57     EditableSearchTreeView(QWidget* const parent, SearchModel* const searchModel,
58                            SearchModificationHelper* const searchModificationHelper);
59 
60     /**
61      * Destructor.
62      */
63     ~EditableSearchTreeView() override;
64 
65 protected:
66 
67     /**
68      * implemented hook methods for context menus.
69      */
70     QString contextMenuTitle() const override;
71 
72     /**
73      * Adds actions to delete or rename existing searches.
74      */
75     void addCustomContextMenuActions(ContextMenuHelper& cmh, Album* album) override;
76 
77     /**
78      * Handles deletion and renaming actions.
79      */
80     void handleCustomContextMenuAction(QAction* action, const AlbumPointer<Album>& album) override;
81 
82 private:
83 
84     class Private;
85     Private* const d;
86 };
87 
88 } // namespace Digikam
89 
90 #endif // DIGIKAM_EDITABLE_SEARCH_TREE_VIEW_H
91