Changeset View
Changeset View
Standalone View
Standalone View
libs/handler.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
52 | 52 | | |||
53 | #include <KNotification> | 53 | #include <KNotification> | ||
54 | #include <KLocalizedString> | 54 | #include <KLocalizedString> | ||
55 | #include <KUser> | 55 | #include <KUser> | ||
56 | #include <KProcess> | 56 | #include <KProcess> | ||
57 | #include <KService> | 57 | #include <KService> | ||
58 | #include <KServiceTypeTrader> | 58 | #include <KServiceTypeTrader> | ||
59 | #include <KWindowSystem> | 59 | #include <KWindowSystem> | ||
60 | #include <KIconLoader> | | |||
61 | #include <KWallet> | 60 | #include <KWallet> | ||
62 | 61 | | |||
63 | #define AGENT_SERVICE "org.kde.kded5" | 62 | #define AGENT_SERVICE "org.kde.kded5" | ||
64 | #define AGENT_PATH "/modules/networkmanagement" | 63 | #define AGENT_PATH "/modules/networkmanagement" | ||
65 | #define AGENT_IFACE "org.kde.plasmanetworkmanagement" | 64 | #define AGENT_IFACE "org.kde.plasmanetworkmanagement" | ||
66 | 65 | | |||
67 | // 10 seconds | 66 | // 10 seconds | ||
68 | #define NM_REQUESTSCAN_LIMIT_RATE 10000 | 67 | #define NM_REQUESTSCAN_LIMIT_RATE 10000 | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 103 | if (vpnSetting) { | |||
121 | } | 120 | } | ||
122 | 121 | | |||
123 | if (pluginMissing) { | 122 | if (pluginMissing) { | ||
124 | qCWarning(PLASMA_NM) << "VPN" << vpnSetting->serviceType() << "not found, skipping"; | 123 | qCWarning(PLASMA_NM) << "VPN" << vpnSetting->serviceType() << "not found, skipping"; | ||
125 | KNotification *notification = new KNotification("MissingVpnPlugin", KNotification::CloseOnTimeout, this); | 124 | KNotification *notification = new KNotification("MissingVpnPlugin", KNotification::CloseOnTimeout, this); | ||
126 | notification->setComponentName("networkmanagement"); | 125 | notification->setComponentName("networkmanagement"); | ||
127 | notification->setTitle(con->name()); | 126 | notification->setTitle(con->name()); | ||
128 | notification->setText(i18n("Missing VPN plugin")); | 127 | notification->setText(i18n("Missing VPN plugin")); | ||
129 | notification->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(KIconLoader::SizeHuge)); | 128 | notification->setIconName(QStringLiteral("dialog-warning")); | ||
130 | notification->sendEvent(); | 129 | notification->sendEvent(); | ||
131 | return; | 130 | return; | ||
132 | } | 131 | } | ||
133 | 132 | | |||
134 | } | 133 | } | ||
135 | } | 134 | } | ||
136 | 135 | | |||
137 | #if WITH_MODEMMANAGER_SUPPORT | 136 | #if WITH_MODEMMANAGER_SUPPORT | ||
▲ Show 20 Lines • Show All 498 Lines • ▼ Show 20 Line(s) | 604 | switch (action) { | |||
636 | } | 635 | } | ||
637 | default: | 636 | default: | ||
638 | break; | 637 | break; | ||
639 | } | 638 | } | ||
640 | 639 | | |||
641 | if (notification) { | 640 | if (notification) { | ||
642 | notification->setComponentName("networkmanagement"); | 641 | notification->setComponentName("networkmanagement"); | ||
643 | notification->setText(error); | 642 | notification->setText(error); | ||
644 | notification->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(KIconLoader::SizeHuge)); | 643 | notification->setIconName(QStringLiteral("dialog-warning")); | ||
645 | notification->sendEvent(); | 644 | notification->sendEvent(); | ||
646 | } | 645 | } | ||
647 | } else { | 646 | } else { | ||
648 | KNotification *notification = nullptr; | 647 | KNotification *notification = nullptr; | ||
649 | Handler::HandlerAction action = (Handler::HandlerAction)watcher->property("action").toUInt(); | 648 | Handler::HandlerAction action = (Handler::HandlerAction)watcher->property("action").toUInt(); | ||
650 | 649 | | |||
651 | switch (action) { | 650 | switch (action) { | ||
652 | case Handler::AddConnection: | 651 | case Handler::AddConnection: | ||
Show All 13 Lines | 663 | case Handler::RequestScan: | |||
666 | break; | 665 | break; | ||
667 | default: | 666 | default: | ||
668 | break; | 667 | break; | ||
669 | } | 668 | } | ||
670 | 669 | | |||
671 | if (notification) { | 670 | if (notification) { | ||
672 | notification->setComponentName("networkmanagement"); | 671 | notification->setComponentName("networkmanagement"); | ||
673 | notification->setTitle(watcher->property("connection").toString()); | 672 | notification->setTitle(watcher->property("connection").toString()); | ||
674 | notification->setPixmap(QIcon::fromTheme("dialog-information").pixmap(KIconLoader::SizeHuge)); | 673 | notification->setIconName(QStringLiteral("dialog-information")); | ||
675 | notification->sendEvent(); | 674 | notification->sendEvent(); | ||
676 | } | 675 | } | ||
677 | } | 676 | } | ||
678 | 677 | | |||
679 | watcher->deleteLater(); | 678 | watcher->deleteLater(); | ||
680 | } | 679 | } | ||
681 | 680 | | |||
682 | #if WITH_MODEMMANAGER_SUPPORT | 681 | #if WITH_MODEMMANAGER_SUPPORT | ||
683 | void Handler::unlockRequiredChanged(MMModemLock modemLock) | 682 | void Handler::unlockRequiredChanged(MMModemLock modemLock) | ||
684 | { | 683 | { | ||
685 | if (modemLock == MM_MODEM_LOCK_NONE) { | 684 | if (modemLock == MM_MODEM_LOCK_NONE) { | ||
686 | activateConnection(m_tmpConnectionPath, m_tmpDevicePath, m_tmpSpecificPath); | 685 | activateConnection(m_tmpConnectionPath, m_tmpDevicePath, m_tmpSpecificPath); | ||
687 | } | 686 | } | ||
688 | } | 687 | } | ||
689 | #endif | 688 | #endif | ||
690 | 689 | |