From dd5288372eae697552d216fe17f7f98e3d8ca13d Mon Sep 17 00:00:00 2001 From: nhnielsen Date: Tue, 20 Nov 2007 19:56:44 +0000 Subject: [PATCH] Add baseclass for a new CustomActionsCapability that allows custom actions for different meta types to be displayed in the right click menus or other places git-svn-id: svn+ssh://svn.kde.org/home/kde/trunk/extragear/multimedia/amarok@739294 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/meta/Capability.h | 3 ++- src/meta/CustomActionsCapability.cpp | 27 +++++++++++++++++++ src/meta/CustomActionsCapability.h | 50 ++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/meta/CustomActionsCapability.cpp create mode 100644 src/meta/CustomActionsCapability.h diff --git a/src/meta/Capability.h b/src/meta/Capability.h index ee91812e4..ff12c5aff 100644 --- a/src/meta/Capability.h +++ b/src/meta/Capability.h @@ -35,7 +35,8 @@ namespace Meta enum Type { Unknown = 0 , Editable = 1 , LastFm = 2 - , Buyable = 3 }; + , Buyable = 3 + , CustomActions = 4}; virtual ~Capability(); diff --git a/src/meta/CustomActionsCapability.cpp b/src/meta/CustomActionsCapability.cpp new file mode 100644 index 000000000..0a1db0f69 --- /dev/null +++ b/src/meta/CustomActionsCapability.cpp @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (c) 2007 Nikolaj Hald Nielsen * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "CustomActionsCapability.h" + +Meta::CustomActionsCapability::~CustomActionsCapability() +{ + //nothing to do +} + +#include "CustomActionsCapability.moc" diff --git a/src/meta/CustomActionsCapability.h b/src/meta/CustomActionsCapability.h new file mode 100644 index 000000000..a2732e602 --- /dev/null +++ b/src/meta/CustomActionsCapability.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (c) 2007 Nikolaj Hald Nielsen * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef AMAROK_CUSTOMACTIONSCAPABILITY_H +#define AMAROK_CUSTOMACTIONSCAPABILITY_H + +#include "amarok_export.h" +#include "meta/Capability.h" + +#include +#include + + +namespace Meta +{ + + /** + * This capability allows different meta types to display custom actions int the right click menu in the tree view + * or anywhere else where the actions are shown. This is usefull for purchasing from stores, downloading from services + * banning a genre or whatever we can think of in the future + */ + class AMAROK_EXPORT CustomActionsCapability : public Meta::Capability + { + Q_OBJECT + public: + virtual ~CustomActionsCapability(); + + virtual QList< QAction * > customActions() = 0; + + static Type capabilityInterfaceType() { return Meta::Capability::CustomActions; } + }; +} + +#endif -- 2.11.4.GIT