2007-09-26 09:44:06 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-10-12 10:44:02 +02:00
|
|
|
* it under the terms of the GNU Library/Lesser General Public License
|
|
|
|
* version 2, or (at your option) any later version, as published by the
|
|
|
|
* Free Software Foundation
|
2007-09-26 09:44:06 +02:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
2007-10-12 10:44:02 +02:00
|
|
|
* You should have received a copy of the GNU Library/Lesser General Public
|
2007-09-26 09:44:06 +02:00
|
|
|
* 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 PLASMAAPPLETSMODEL_H_
|
|
|
|
#define PLASMAAPPLETSMODEL_H_
|
|
|
|
|
|
|
|
#include <KPluginInfo>
|
2007-09-27 20:51:31 +02:00
|
|
|
|
|
|
|
#include <plasma/applet.h>
|
|
|
|
|
|
|
|
#include "kcategorizeditemsview_p.h"
|
2007-09-26 09:44:06 +02:00
|
|
|
|
2007-10-09 11:51:55 +02:00
|
|
|
class PlasmaAppletItemModel;
|
|
|
|
|
2007-09-26 09:44:06 +02:00
|
|
|
/**
|
|
|
|
* Implementation of the KCategorizedItemsViewModels::AbstractItem
|
|
|
|
*/
|
|
|
|
class PlasmaAppletItem : public KCategorizedItemsViewModels::AbstractItem,
|
|
|
|
QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum FilterFlag {NoFilter = 0,
|
|
|
|
Favorite = 1,
|
2007-10-08 23:50:38 +02:00
|
|
|
Used = 2};
|
2007-09-26 09:44:06 +02:00
|
|
|
|
|
|
|
Q_DECLARE_FLAGS(FilterFlags, FilterFlag)
|
|
|
|
|
2007-10-12 19:30:30 +02:00
|
|
|
PlasmaAppletItem(PlasmaAppletItemModel * model, const QMap<QString, QVariant>& info,
|
2007-10-08 23:50:38 +02:00
|
|
|
FilterFlags flags = NoFilter, QMap<QString, QVariant> * extraAttrs = NULL);
|
2007-09-26 09:44:06 +02:00
|
|
|
|
|
|
|
virtual QString name() const;
|
|
|
|
QString pluginName() const;
|
|
|
|
virtual QString description() const;
|
|
|
|
virtual void setFavorite(bool favorite);
|
|
|
|
virtual bool passesFiltering(
|
|
|
|
const KCategorizedItemsViewModels::Filter & filter) const;
|
2007-10-12 19:30:30 +02:00
|
|
|
virtual QVariantList arguments() const;
|
|
|
|
|
2007-10-09 11:51:55 +02:00
|
|
|
private:
|
|
|
|
PlasmaAppletItemModel * m_model;
|
2007-09-26 09:44:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class PlasmaAppletItemModel :
|
|
|
|
public KCategorizedItemsViewModels::DefaultItemModel
|
|
|
|
{
|
|
|
|
public:
|
2007-10-09 11:51:55 +02:00
|
|
|
PlasmaAppletItemModel(KConfigGroup configGroup, QObject * parent = 0);
|
2007-09-26 09:44:06 +02:00
|
|
|
|
|
|
|
QStringList mimeTypes() const;
|
|
|
|
|
|
|
|
QMimeData* mimeData(const QModelIndexList & indexes) const;
|
2007-10-09 11:51:55 +02:00
|
|
|
|
|
|
|
void setFavorite(QString plugin, bool favorite);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QStringList m_favorites;
|
2007-10-12 19:30:30 +02:00
|
|
|
QStringList m_used;
|
2007-10-09 11:51:55 +02:00
|
|
|
KConfigGroup m_configGroup;
|
2007-10-12 19:30:30 +02:00
|
|
|
|
|
|
|
void loadSuperKarambaThemes(const KPluginInfo &info);
|
2007-09-26 09:44:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(PlasmaAppletItem::FilterFlags)
|
|
|
|
|
|
|
|
#endif /*PLASMAAPPLETSMODEL_H_*/
|