Changeset View
Changeset View
Standalone View
Standalone View
src/wizard/pages/success.cpp
Show All 19 Lines | |||||
20 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * | 20 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * | ||
21 | * Boston, MA 02110-1301, USA. * | 21 | * Boston, MA 02110-1301, USA. * | ||
22 | *****************************************************************************/ | 22 | *****************************************************************************/ | ||
23 | 23 | | |||
24 | #include "success.h" | 24 | #include "success.h" | ||
25 | #include "../bluewizard.h" | 25 | #include "../bluewizard.h" | ||
26 | #include "debug_p.h" | 26 | #include "debug_p.h" | ||
27 | 27 | | |||
28 | #include <QIcon> | | |||
29 | | ||||
30 | #include <BluezQt/Device> | 28 | #include <BluezQt/Device> | ||
31 | 29 | | |||
30 | #include <KNotification> | ||||
31 | | ||||
32 | SuccessPage::SuccessPage(BlueWizard *parent) | 32 | SuccessPage::SuccessPage(BlueWizard *parent) | ||
33 | : QWizardPage(parent) | 33 | : QWizardPage(parent) | ||
34 | , m_wizard(parent) | 34 | , m_wizard(parent) | ||
35 | { | 35 | { | ||
36 | setupUi(this); | | |||
37 | 36 | | |||
38 | successIcon->setPixmap(QIcon::fromTheme(QStringLiteral("emblem-success")).pixmap(48)); | | |||
39 | } | 37 | } | ||
40 | 38 | | |||
41 | int SuccessPage::nextId() const | 39 | int SuccessPage::nextId() const | ||
42 | { | 40 | { | ||
43 | return -1; | 41 | return -1; | ||
44 | } | 42 | } | ||
45 | 43 | | |||
46 | void SuccessPage::initializePage() | 44 | void SuccessPage::initializePage() | ||
47 | { | 45 | { | ||
48 | qCDebug(WIZARD) << "Initialize Success Page"; | 46 | qCDebug(WIZARD) << "Sending Success notification"; | ||
49 | | ||||
50 | QList<QWizard::WizardButton> list; | | |||
51 | list << QWizard::Stretch; | | |||
52 | list << QWizard::FinishButton; | | |||
53 | | ||||
54 | m_wizard->setButtonLayout(list); | | |||
55 | | ||||
56 | setFinalPage(true); | | |||
57 | 47 | | |||
58 | BluezQt::DevicePtr device = m_wizard->device(); | 48 | BluezQt::DevicePtr device = m_wizard->device(); | ||
59 | 49 | | |||
50 | KNotification *notification = new KNotification(QStringLiteral("SetupFinished"), | ||||
51 | KNotification::CloseOnTimeout, this); | ||||
52 | notification->setComponentName(QStringLiteral("bluedevil")); | ||||
53 | notification->setTitle(i18n("Setup Finished")); | ||||
60 | if (device->name().isEmpty()) { | 54 | if (device->name().isEmpty()) { | ||
61 | successLbl->setText(i18nc("This string is shown when the wizard succeeds", "The setup of the device has succeeded")); | 55 | notification->setText(i18n("The device has been set up and can now be used.")); | ||
62 | } else { | 56 | } else { | ||
63 | successLbl->setText(i18n("The setup of %1 has succeeded", device->name())); | 57 | notification->setText(i18nc("Placeholder is device name", | ||
58 | "The device '%1' has been set up and can now be used.", device->name())); | ||||
64 | } | 59 | } | ||
60 | // Mark as response to explicit user action ("pairing the device") | ||||
61 | notification->setHint(QStringLiteral("x-kde-user-action-feedback"), true); | ||||
62 | notification->sendEvent(); | ||||
63 | | ||||
64 | setFinalPage(true); | ||||
65 | } | 65 | } |