2
* Copyright 2013 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Michał Sawicz <michal.sawicz@canonical.com>
21
#include <Mocks/mocksource.h>
23
#include <Mocks/mockmodel.h>
24
#include <Mocks/mocknotification.h>
26
#include <unity/shell/notifications/notification.h>
28
using namespace unity::shell::notifications;
30
MockSource::MockSource(QObject *parent)
31
: SourceInterface(parent)
37
MockSource::model() const
43
MockSource::setModel(ModelInterface* model)
45
MockModel* mockModel = qobject_cast<MockModel*>(model);
46
if (m_model != mockModel) {
48
Q_EMIT modelChanged(m_model);
53
MockSource::send(QVariantMap data)
55
MockNotification* notification = new MockNotification(this);
56
notification->m_data = data;
58
connect(notification, SIGNAL(completed()), SLOT(onCompleted()));
61
m_model->add(notification);
66
MockSource::onCompleted()
68
sender()->deleteLater();