2
* Copyright (C) 2011 Canonical, Ltd.
5
* Aurélien Gâteau <aurelien.gateau@canonical.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
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 General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
#include <unity2dtr.h>
30
: m_active(false), m_view(NULL)
38
bool BfbItem::active() const
43
bool BfbItem::running() const
48
int BfbItem::windowCount() const
53
bool BfbItem::urgent() const
58
QString BfbItem::name() const
60
return u2dTr("Dash home");
63
QString BfbItem::icon() const
65
return QString(UNITY_DIR) + "5/launcher_bfb.png";
68
bool BfbItem::launching() const
73
QObject* BfbItem::dashView() const
78
void BfbItem::setDashView(QObject* view)
85
connect(view, SIGNAL(dashActiveChanged(bool)), this, SLOT(slotDashActiveChanged(bool)));
89
void BfbItem::activate()
91
Q_ASSERT(m_view != NULL);
93
QMetaObject::invokeMethod(m_view, "toggleDash");
97
void BfbItem::createMenuActions()
101
void BfbItem::slotDashActiveChanged(bool active)
103
if (m_active != active) {
105
Q_EMIT activeChanged(m_active);
109
////////////////////////////////////////////////////////////
110
BfbModel::BfbModel(QObject* parent)
111
: QAbstractListModel(parent)
112
, m_bfbItem(new BfbItem)
116
BfbModel::~BfbModel()
121
int BfbModel::rowCount(const QModelIndex& /*parent*/) const
126
QVariant BfbModel::data(const QModelIndex& index, int /*role*/) const
128
if (!index.isValid()) {
132
return QVariant::fromValue(m_bfbItem);
135
QObject* BfbModel::dashView() const
137
return m_bfbItem->dashView();
140
void BfbModel::setDashView(QObject* view)
142
m_bfbItem->setDashView(view);