File indexing completed on 2025-03-16 13:53:34
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * SPDX-FileCopyrightText: 2010 Alejandro Fiestas Olivares <afiestas@kde.org> 0005 * SPDX-FileCopyrightText: 2010-2011 UFO Coders <info@ufocoders.com> 0006 * SPDX-FileCopyrightText: 2014 David Rosca <nowrep@gmail.com> 0007 * 0008 * SPDX-License-Identifier: LGPL-2.0-or-later 0009 */ 0010 0011 #include "success.h" 0012 #include "../bluewizard.h" 0013 #include "bluedevil_wizard.h" 0014 0015 #include <QIcon> 0016 0017 #include <BluezQt/Device> 0018 0019 #include <KNotification> 0020 0021 SuccessPage::SuccessPage(BlueWizard *parent) 0022 : QWizardPage(parent) 0023 , m_wizard(parent) 0024 { 0025 } 0026 0027 int SuccessPage::nextId() const 0028 { 0029 return -1; 0030 } 0031 0032 void SuccessPage::initializePage() 0033 { 0034 qCDebug(BLUEDEVIL_WIZARD_LOG) << "Sending Success notification"; 0035 0036 BluezQt::DevicePtr device = m_wizard->device(); 0037 0038 KNotification *notification = new KNotification(QStringLiteral("SetupFinished"), KNotification::CloseOnTimeout, this); 0039 notification->setComponentName(QStringLiteral("bluedevil")); 0040 notification->setTitle(i18n("Setup Finished")); 0041 if (device->name().isEmpty()) { 0042 notification->setText(i18n("The device has been set up and can now be used.")); 0043 } else { 0044 notification->setText(i18nc("Placeholder is device name", "The device '%1' has been set up and can now be used.", device->name())); 0045 } 0046 // Mark as response to explicit user action ("pairing the device") 0047 notification->setHint(QStringLiteral("x-kde-user-action-feedback"), true); 0048 notification->sendEvent(); 0049 0050 setFinalPage(true); 0051 }