Debian Codegraph @

src/core/capabilities/BookmarkThisCapability.h

raw
1 /****************************************************************************************
2 * Copyright (c) 2009 Nikolaj Hald Nielsen <[email protected]> *
3 * *
4 * This program is free software; you can redistribute it and/or modify it under *
5 * the terms of the GNU General Public License as published by the Free Software *
6 * Foundation; either version 2 of the License, or (at your option) any later *
7 * version. *
8 * *
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU General Public License along with *
14 * this program. If not, see <http://www.gnu.org/licenses/>. *
15 ****************************************************************************************/
16
17 #ifndef METABOOKMARKTHISCAPABILITY_H
18 #define METABOOKMARKTHISCAPABILITY_H
19
20 #include "core/amarokcore_export.h"
21 #include "core/capabilities/Capability.h"
22
23 #include <QAction>
24
25 namespace Capabilities {
26
27 /**
28 This capability determines whether a meta item in a collection can be directly bookmarked. Not all collections/services supports bookmarks on all levels, and some might not support Item level bookmarks at all as they have no query field and some might only support simple queries.
29
30 @author Nikolaj Hald Nielsen <[email protected]>
31 */
32 class AMAROKCORE_EXPORT BookmarkThisCapability : public Capability {
33 Q_OBJECT
34 public:
35 explicit BookmarkThisCapability( QAction* action );
36 ~BookmarkThisCapability() override;
37
38 virtual bool isBookmarkable() { return true; }
39 virtual QString browserName() { return QStringLiteral("collections"); }
40 virtual QString collectionName() { return QString(); }
41 virtual bool simpleFiltering() { return false; }
42
43 /**
44 The caller must free actions that have no parent after use.
45 Actions with a parent are freed by the parent (obviously)
46 @return the bookmarkAction itself (or 0).
47 */
48 virtual QAction * bookmarkAction() const { return m_action; }
49
50 /**
51 * Get the capabilityInterfaceType of this capability
52 * @return The capabilityInterfaceType ( always Capabilities::Capability::BookmarkThis; )
53 */
54 static Type capabilityInterfaceType() { return Capabilities::Capability::BookmarkThis; }
55
56 protected:
57 QAction* m_action;
58
59 };
60
61 }
62
63 #endif