2
* Copyright (C) 2009 by Ana Cecília Martins <anaceciliamb@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library/Lesser General Public License
6
* version 2, or (at your option) any later version, as published by the
7
* Free Software Foundation
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details
14
* You should have received a copy of the GNU Library/Lesser General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#ifndef APPLETSFILTERING_H
21
#define APPLETSFILTERING_H
23
#include <Plasma/PushButton>
25
#include "kcategorizeditemsviewmodels_p.h"
26
#include "plasmaappletitemmodel_p.h"
31
class OpenWidgetAssistant;
37
class CategoriesWidget : public Plasma::PushButton
42
explicit CategoriesWidget(QGraphicsWidget *parent = 0);
43
virtual ~CategoriesWidget();
45
void setModel(QStandardItemModel *model);
48
void filterChanged(int index);
51
void mousePressEvent(QGraphicsSceneMouseEvent *event);
54
//uses model to populate the tabs
56
QStandardItem *getItemByProxyIndex(const QModelIndex &index) const;
59
void menuItemTriggered(QAction *);
63
QStandardItemModel *m_model;
67
class FilteringWidget : public QGraphicsWidget
72
explicit FilteringWidget(QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0);
73
explicit FilteringWidget(Qt::Orientation orientation = Qt::Horizontal,
74
Plasma::WidgetExplorer* widgetExplorer = 0,
75
QGraphicsItem * parent = 0,
76
Qt::WindowFlags wFlags = 0);
77
virtual ~FilteringWidget();
79
void setModel(QStandardItemModel *model);
80
void setListOrientation(Qt::Orientation orientation);
81
Plasma::LineEdit *textSearch();
82
void updateActions(const QList<QAction *> actions);
85
void filterChanged(int index);
90
void populateWidgetsMenu();
93
* Launches a download dialog to retrieve new applets from the Internet
95
* @arg type the type of widget to download; an empty string means the default
96
* Plasma widgets will be accessed, any other value should map to a
97
* PackageStructure PluginInfo-Name entry that provides a widget browser.
99
void downloadWidgets(const QString &type = QString());
102
* Opens a file dialog to open a widget from a local file
104
void openWidgetFile();
107
void resizeEvent(QGraphicsSceneResizeEvent *event);
112
QStandardItemModel *m_model;
113
CategoriesWidget *m_categories;
114
Plasma::LineEdit *m_textSearch;
115
Qt::Orientation m_orientation;
116
Plasma::PushButton *m_newWidgetsButton;
117
KMenu *m_newWidgetsMenu;
118
Plasma::WidgetExplorer *m_widgetExplorer;
119
QList<QWeakPointer<Plasma::PushButton> > m_actionButtons;
120
Plasma::ToolButton *m_closeButton;
121
QWeakPointer<Plasma::OpenWidgetAssistant> m_openAssistant;
124
#endif // APPLETSFILTERING_H