2
* Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
3
* Copyright (C) 2008 Daniel Nicoletti <dantti85-pk@yahoo.com.br>
4
* Copyright (C) 2010 Jonathan Thomas <echidnaman@kubuntu.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Library/Lesser General Public License
8
* version 2, or (at your option) any later version, as published by the
9
* Free Software Foundation
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details
16
* You should have received a copy of the GNU Library/Lesser General Public
17
* License along with this program; if not, write to the
18
* Free Software Foundation, Inc.,
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
#ifndef APPLICATIONDELEGATE_H
23
#define APPLICATIONDELEGATE_H
26
#include <KExtendableItemDelegate>
33
class ApplicationBackend;
34
class ApplicationExtender;
37
* Delegate for displaying the applications
39
class ApplicationDelegate: public KExtendableItemDelegate
43
ApplicationDelegate(QAbstractItemView *parent, ApplicationBackend *backend);
45
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
46
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
47
bool editorEvent(QEvent *event,
48
QAbstractItemModel *model,
49
const QStyleOptionViewItem &option,
50
const QModelIndex &index);
51
void setShowInfoButton(bool show);
54
ApplicationBackend *m_appBackend;
57
QPersistentModelIndex m_oldIndex;
58
ApplicationExtender *m_extender;
59
KRatingPainter *m_ratingPainter;
61
bool m_showInfoButton;
63
int calcItemHeight(const QStyleOptionViewItem &option) const;
66
void itemActivated(QModelIndex index);
70
void showExtendItem(const QModelIndex &index);
71
void infoButtonClicked(Application *app);
72
void installButtonClicked(Application *app);
73
void removeButtonClicked(Application *app);
74
void cancelButtonClicked(Application *app);