File indexing completed on 2024-05-05 04:48:13

0001 /****************************************************************************************
0002  * Copyright (c) 2009 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016  
0017 #ifndef METABOOKMARKTHISCAPABILITY_H
0018 #define METABOOKMARKTHISCAPABILITY_H
0019 
0020 #include "core/amarokcore_export.h"
0021 #include "core/capabilities/Capability.h"
0022 
0023 #include <QAction>
0024 
0025 namespace Capabilities {
0026 
0027 /**
0028   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.
0029 
0030     @author Nikolaj Hald Nielsen <nhn@kde.org>
0031 */
0032 class AMAROKCORE_EXPORT BookmarkThisCapability : public Capability {
0033     Q_OBJECT
0034 public:
0035     explicit BookmarkThisCapability( QAction* action );
0036     ~BookmarkThisCapability() override;
0037 
0038     virtual bool isBookmarkable() { return true; }
0039     virtual QString browserName() { return QStringLiteral("collections"); }
0040     virtual QString collectionName() { return QString(); }
0041     virtual bool simpleFiltering() { return false; }
0042 
0043     /**
0044        The caller must free actions that have no parent after use.
0045        Actions with a parent are freed by the parent (obviously)
0046        @return the bookmarkAction itself (or 0).
0047     */
0048     virtual QAction * bookmarkAction() const { return m_action; }
0049 
0050     /**
0051      * Get the capabilityInterfaceType of this capability
0052      * @return The capabilityInterfaceType ( always Capabilities::Capability::BookmarkThis; )
0053     */
0054     static Type capabilityInterfaceType() { return Capabilities::Capability::BookmarkThis; }
0055 
0056 protected:
0057     QAction* m_action;
0058 
0059 };
0060 
0061 }
0062 
0063 #endif