1
/***************************************************************************
2
* Copyright (C) 2010 Alejandro Fiestas Olivares <alex@eyeos.org> *
3
* Copyright (C) 2010 Eduardo Robles Elvira <edulix@gmail.com> *
4
* Copyright (C) 2010 UFO Coders <info@ufocoders.com> *
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation; either version 2 of the License, or *
9
* (at your option) any later version. *
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, write to the *
18
* Free Software Foundation, Inc., *
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20
***************************************************************************/
22
#include "confirmmodechange.h"
24
#include <QtCore/QDebug>
25
#include <QtCore/QCoreApplication>
26
#include <QtCore/QTimer>
29
#include <kiconloader.h>
30
#include <knotification.h>
33
ConfirmModeChange::ConfirmModeChange()
36
KNotification *notification = new KNotification("bluedevilConfirmModechange",
37
KNotification::Persistent, this);
39
notification->setText(i18nc(
40
"Showed in a notification when the Bluetooth mode is going to be changed (for example to flight mode), the %1 is the name of the mode",
41
"Change bluetooth mode to %1 ?", qApp->arguments()[1])
45
actions.append(i18nc("Confirm the bluetooth mode change, showed in a notification button", "Confirm"));
46
actions.append(i18nc("Deny the bluetooth mdoe change, showed in a notification", "Deny"));
48
notification->setActions(actions);
50
connect(notification, SIGNAL(action1Activated()),this, SLOT(confirm()));
51
connect(notification, SIGNAL(action2Activated()),this, SLOT(deny()));
52
connect(notification, SIGNAL(closed()), this, SLOT(deny()));
53
connect(notification, SIGNAL(ignored()), this, SLOT(deny()));
55
// We're using persistent notifications so we have to use our own timeout (10s)
56
QTimer::singleShot(10000, notification, SLOT(close()));
57
notification->setPixmap(KIcon("preferences-system-bluetooth").pixmap(42, 42));
58
notification->sendEvent();
61
void ConfirmModeChange::confirm()
63
qDebug() << "confirmed";
67
void ConfirmModeChange::deny()