File indexing completed on 2024-05-05 04:48:13
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 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 AMAROK_ACTIONSCAPABILITY_H 0018 #define AMAROK_ACTIONSCAPABILITY_H 0019 0020 #include "core/amarokcore_export.h" 0021 #include "core/capabilities/Capability.h" 0022 0023 #include <QAction> 0024 #include <QList> 0025 0026 namespace Capabilities 0027 { 0028 /** 0029 * This capability allows different meta types to display custom actions in the right click menu in the tree view 0030 * or anywhere else where the actions are shown. This is useful for purchasing from stores, downloading from services 0031 * banning a genre or whatever we can think of in the future. 0032 * 0033 * If you want to provide this capability for an album, consider using 0034 * @see AlbumActionsCapability that provides you with common album actions such as 0035 * show cover etc. for free. 0036 * 0037 * @author Nikolaj Hald Nielsen <nhn@kde.org> 0038 */ 0039 class AMAROKCORE_EXPORT ActionsCapability : public Capabilities::Capability 0040 { 0041 Q_OBJECT 0042 public: 0043 /** 0044 * Constructor 0045 * Note: The actions are not freed after usage 0046 * @param actions A list of actions to use. 0047 */ 0048 explicit ActionsCapability( const QList< QAction* > &actions ); 0049 0050 /** 0051 * Destructor 0052 */ 0053 ~ActionsCapability() override; 0054 0055 /** 0056 * Get the custom actions for this capability 0057 * The caller must free actions that have no parent after use. 0058 * Actions with a parent are freed by the parent (obviously) 0059 * @return The list of actions 0060 */ 0061 virtual QList<QAction *> actions() const; 0062 0063 /** 0064 * Get the capabilityInterfaceType of this capability 0065 * @return The capabilityInterfaceType ( always Capabilities::Capability::Actions; ) 0066 */ 0067 static Type capabilityInterfaceType() { return Capabilities::Capability::Actions; } 0068 0069 protected: 0070 /** 0071 * No-action constructor has sense only for subclasses. 0072 */ 0073 ActionsCapability(); 0074 0075 QList< QAction* > m_actions; 0076 }; 0077 } 0078 0079 #endif