Changeset View
Changeset View
Standalone View
Standalone View
kcm/kcm.cpp
Show All 29 Lines | |||||
30 | #include <QDBusInterface> | 30 | #include <QDBusInterface> | ||
31 | 31 | | |||
32 | #include <KServiceTypeTrader> | 32 | #include <KServiceTypeTrader> | ||
33 | #include <KPluginInfo> | 33 | #include <KPluginInfo> | ||
34 | #include <KPluginMetaData> | 34 | #include <KPluginMetaData> | ||
35 | #include <KPluginFactory> | 35 | #include <KPluginFactory> | ||
36 | #include <KAboutData> | 36 | #include <KAboutData> | ||
37 | #include <KLocalizedString> | 37 | #include <KLocalizedString> | ||
38 | #include <kcmutils_version.h> | ||||
38 | 39 | | |||
39 | #include "ui_kcm.h" | 40 | #include "ui_kcm.h" | ||
40 | #include "interfaces/dbusinterfaces.h" | 41 | #include "interfaces/dbusinterfaces.h" | ||
41 | #include "interfaces/devicesmodel.h" | 42 | #include "interfaces/devicesmodel.h" | ||
42 | #include "devicessortproxymodel.h" | 43 | #include "devicessortproxymodel.h" | ||
43 | #include "kdeconnect-version.h" | 44 | #include "kdeconnect-version.h" | ||
44 | 45 | | |||
45 | K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin<KdeConnectKcm>();) | 46 | K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin<KdeConnectKcm>();) | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 111 | connect(kcmUi->rename_edit,&QLineEdit::returnPressed, | |||
111 | this, &KdeConnectKcm::renameDone); | 112 | this, &KdeConnectKcm::renameDone); | ||
112 | connect(kcmUi->renameDone_button,&QAbstractButton::clicked, | 113 | connect(kcmUi->renameDone_button,&QAbstractButton::clicked, | ||
113 | this, &KdeConnectKcm::renameDone); | 114 | this, &KdeConnectKcm::renameDone); | ||
114 | connect(kcmUi->renameShow_button,&QAbstractButton::clicked, | 115 | connect(kcmUi->renameShow_button,&QAbstractButton::clicked, | ||
115 | this, &KdeConnectKcm::renameShow); | 116 | this, &KdeConnectKcm::renameShow); | ||
116 | 117 | | |||
117 | daemon->acquireDiscoveryMode(createId()); | 118 | daemon->acquireDiscoveryMode(createId()); | ||
118 | 119 | | |||
120 | #if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0) | ||||
121 | | ||||
119 | if (!args.isEmpty() && args.first().type() == QVariant::String) { | 122 | if (!args.isEmpty() && args.first().type() == QVariant::String) { | ||
120 | const QString input = args.first().toString(); | 123 | const QString input = args.first().toString(); | ||
121 | const auto colonIdx = input.indexOf(QLatin1Char(':')); | 124 | const auto colonIdx = input.indexOf(QLatin1Char(':')); | ||
122 | const QString deviceId = input.left(colonIdx); | 125 | const QString deviceId = input.left(colonIdx); | ||
123 | const QString pluginCM = colonIdx < 0 ? QString() : input.mid(colonIdx+1); | 126 | const QString pluginCM = colonIdx < 0 ? QString() : input.mid(colonIdx+1); | ||
124 | 127 | | |||
125 | connect(devicesModel, &DevicesModel::rowsInserted, this, [this, deviceId, pluginCM]() { | 128 | connect(devicesModel, &DevicesModel::rowsInserted, this, [this, deviceId, pluginCM]() { | ||
126 | auto row = devicesModel->rowForDevice(deviceId); | 129 | auto row = devicesModel->rowForDevice(deviceId); | ||
127 | if (row >= 0) { | 130 | if (row >= 0) { | ||
128 | const QModelIndex idx = sortProxyModel->mapFromSource(devicesModel->index(row)); | 131 | const QModelIndex idx = sortProxyModel->mapFromSource(devicesModel->index(row)); | ||
129 | kcmUi->deviceList->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect); | 132 | kcmUi->deviceList->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect); | ||
130 | } | 133 | } | ||
131 | if (!pluginCM.isEmpty()) { | 134 | if (!pluginCM.isEmpty()) { | ||
132 | kcmUi->pluginSelector->showConfiguration(pluginCM); | 135 | kcmUi->pluginSelector->showConfiguration(pluginCM); | ||
133 | } | 136 | } | ||
134 | disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr); | 137 | disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr); | ||
135 | }); | 138 | }); | ||
136 | } | 139 | } | ||
140 | | ||||
141 | #endif | ||||
137 | } | 142 | } | ||
138 | 143 | | |||
139 | void KdeConnectKcm::renameShow() | 144 | void KdeConnectKcm::renameShow() | ||
140 | { | 145 | { | ||
141 | setRenameMode(true); | 146 | setRenameMode(true); | ||
142 | } | 147 | } | ||
143 | 148 | | |||
144 | void KdeConnectKcm::renameDone() | 149 | void KdeConnectKcm::renameDone() | ||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |