Changeset View
Changeset View
Standalone View
Standalone View
src/notificationmanager.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2017 by Atul Sharma <atulsharma406@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
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 Library General Public License for more details | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library 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. | ||||
18 | */ | ||||
19 | | ||||
20 | #include "notificationmanager.h" | ||||
21 | | ||||
22 | NotificationManager::NotificationManager(QObject* parent) | ||||
23 | { | ||||
24 | Q_UNUSED(parent) | ||||
25 | m_sharingSuccess = new KNotification( "sharingSuccess", KNotification::Persistent); | ||||
26 | | ||||
27 | m_sharingFailed = new KNotification( "sharingFailed", KNotification::CloseOnTimeout); | ||||
28 | m_sharingFailed->setText("Sharing failed"); | ||||
29 | } | ||||
30 | | ||||
31 | NotificationManager::~NotificationManager() | ||||
32 | { | ||||
33 | delete m_sharingFailed; | ||||
34 | delete m_sharingSuccess; | ||||
35 | } | ||||
36 | | ||||
37 | void NotificationManager::showNotification(bool valid, QVariant url) | ||||
38 | { | ||||
39 | if (valid) { | ||||
40 | m_sharingSuccess->setText("Shared url for image is " + url.toString()); | ||||
41 | m_sharingSuccess->sendEvent(); | ||||
42 | } else { | ||||
43 | m_sharingFailed->sendEvent(); | ||||
44 | } | ||||
45 | } | ||||
46 | | ||||
47 | #include "moc_notificationmanager.cpp" |