2013-06-19 15:15:25 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
2013-06-19 15:15:25 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2013-06-19 15:15:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "kcm.h"
|
|
|
|
|
2014-06-16 19:02:07 +01:00
|
|
|
#include <KAboutData>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <KColorSchemeManager>
|
2022-12-06 18:44:15 +00:00
|
|
|
#include <KConfigGroup>
|
2014-06-16 19:02:07 +01:00
|
|
|
#include <KLocalizedString>
|
2022-12-06 18:44:15 +00:00
|
|
|
#include <KPluginFactory>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <KPluginMetaData>
|
2018-05-10 17:36:06 +01:00
|
|
|
#include <kcmutils_version.h>
|
2013-09-09 17:29:24 +01:00
|
|
|
|
2024-10-06 22:40:39 +01:00
|
|
|
#include <QQmlContext>
|
|
|
|
#include <QQuickItem>
|
2024-10-18 12:38:57 +01:00
|
|
|
#include <QQuickStyle>
|
2024-10-06 22:40:39 +01:00
|
|
|
|
2023-07-23 15:53:57 +01:00
|
|
|
#include "dbushelpers.h"
|
2020-11-16 00:16:03 +00:00
|
|
|
#include "dbusinterfaces.h"
|
|
|
|
#include "devicesmodel.h"
|
2013-09-09 17:29:24 +01:00
|
|
|
#include "devicessortproxymodel.h"
|
2015-06-20 06:47:40 +01:00
|
|
|
#include "kdeconnect-version.h"
|
2013-06-19 15:15:25 +01:00
|
|
|
|
2021-11-18 09:53:44 +00:00
|
|
|
K_PLUGIN_CLASS_WITH_JSON(KdeConnectKcm, "kcm_kdeconnect.json")
|
2013-06-19 15:15:25 +01:00
|
|
|
|
2024-10-06 22:40:39 +01:00
|
|
|
class QQuickWidgetPaleteChangeWatcher : public QObject
|
|
|
|
{
|
|
|
|
using QObject::QObject;
|
|
|
|
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override
|
|
|
|
{
|
|
|
|
if (event->type() == QEvent::PaletteChange || event->type() == QEvent::ApplicationPaletteChange) {
|
|
|
|
// We know that watched is a QQuickWidget
|
|
|
|
QQuickWidget *w = static_cast<QQuickWidget *>(watched);
|
|
|
|
w->setClearColor(w->palette().color(QPalette::Window));
|
|
|
|
}
|
|
|
|
return QObject::eventFilter(watched, event);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-03-05 18:43:31 +00:00
|
|
|
KdeConnectKcm::KdeConnectKcm(QObject *parent, const KPluginMetaData &md, const QVariantList &args)
|
|
|
|
: KCModule(parent, md)
|
2015-03-02 05:23:05 +00:00
|
|
|
, daemon(new DaemonDbusInterface(this))
|
2013-08-15 23:25:13 +01:00
|
|
|
, devicesModel(new DevicesModel(this))
|
2015-09-08 09:46:59 +01:00
|
|
|
, currentDevice(nullptr)
|
2013-06-19 15:15:25 +01:00
|
|
|
{
|
2021-06-02 22:45:21 +01:00
|
|
|
#ifdef Q_OS_WIN
|
2024-10-09 22:37:29 +01:00
|
|
|
KColorSchemeManager::instance();
|
2021-06-02 22:45:21 +01:00
|
|
|
QApplication::setStyle(QStringLiteral("breeze"));
|
|
|
|
#endif
|
|
|
|
|
2024-10-18 12:38:57 +01:00
|
|
|
// Default to org.kde.desktop style unless the user forces another style
|
|
|
|
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
|
|
|
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
|
|
|
|
}
|
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.setupUi(widget());
|
2015-03-02 05:23:05 +00:00
|
|
|
|
2013-08-15 23:25:13 +01:00
|
|
|
sortProxyModel = new DevicesSortProxyModel(devicesModel);
|
|
|
|
|
2024-10-12 10:48:25 +01:00
|
|
|
kcmUi.list_quick_widget->setMinimumWidth(250);
|
2024-10-06 22:40:39 +01:00
|
|
|
kcmUi.list_quick_widget->rootContext()->setContextObject(new KLocalizedContext(kcmUi.list_quick_widget));
|
|
|
|
kcmUi.list_quick_widget->setClearColor(kcmUi.list_quick_widget->palette().color(QPalette::Window));
|
|
|
|
kcmUi.list_quick_widget->setSource(QUrl(QStringLiteral("qrc:/kdeconnectkcm/list.qml")));
|
|
|
|
kcmUi.list_quick_widget->rootObject()->setProperty("model", QVariant::fromValue(sortProxyModel));
|
|
|
|
connect(kcmUi.list_quick_widget->rootObject(), SIGNAL(clicked(QString)), this, SLOT(deviceSelected(QString)));
|
|
|
|
|
|
|
|
kcmUi.list_quick_widget->installEventFilter(new QQuickWidgetPaleteChangeWatcher(kcmUi.list_quick_widget));
|
2013-06-19 15:15:25 +01:00
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.deviceInfo->setVisible(false);
|
|
|
|
kcmUi.progressBar->setVisible(false);
|
|
|
|
kcmUi.messages->setVisible(false);
|
2013-06-25 17:08:34 +01:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
// Workaround: If we set this directly (or if we set it in the .ui file), the layout breaks
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.noDeviceLinks->setWordWrap(false);
|
2022-09-10 22:23:52 +01:00
|
|
|
QTimer::singleShot(0, this, [this] {
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.noDeviceLinks->setWordWrap(true);
|
2022-09-10 22:23:52 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
setWhenAvailable(
|
|
|
|
daemon->announcedName(),
|
2024-09-09 12:31:31 +01:00
|
|
|
[this](bool error, const QString &announcedName) {
|
|
|
|
kcmUi.renameShow_button->setEnabled(!error);
|
|
|
|
if (error) {
|
|
|
|
kcmUi.rename_label->setText(i18n("Error: KDE Connect is not running"));
|
|
|
|
} else {
|
|
|
|
kcmUi.rename_label->setText(announcedName);
|
|
|
|
kcmUi.rename_edit->setText(announcedName);
|
|
|
|
}
|
2022-09-10 22:23:52 +01:00
|
|
|
},
|
|
|
|
this);
|
2024-10-05 10:19:33 +01:00
|
|
|
|
|
|
|
kcmUi.bluetoothEnabled_checkbox->setChecked(false);
|
|
|
|
|
|
|
|
setWhenAvailable(
|
2024-10-05 11:40:20 +01:00
|
|
|
daemon->linkProviders(),
|
2024-10-05 10:19:33 +01:00
|
|
|
[this](bool error, const QStringList linkProviders) {
|
|
|
|
for (int i = 0; i < linkProviders.size(); ++i) {
|
|
|
|
QString linkProvider = QString(linkProviders.at(i).constData());
|
|
|
|
qDebug() << "link provider: " << linkProvider;
|
|
|
|
|
2024-10-05 11:49:06 +01:00
|
|
|
if (linkProvider == QStringLiteral("BluetoothLinkProvider")) {
|
2024-10-05 10:19:33 +01:00
|
|
|
kcmUi.bluetoothEnabled_checkbox->setChecked(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
this);
|
|
|
|
|
2023-08-08 21:51:30 +01:00
|
|
|
connect(daemon, &DaemonDbusInterface::announcedNameChanged, kcmUi.rename_edit, &QLineEdit::setText);
|
|
|
|
connect(daemon, &DaemonDbusInterface::announcedNameChanged, kcmUi.rename_label, &QLabel::setText);
|
2015-03-02 05:23:05 +00:00
|
|
|
setRenameMode(false);
|
|
|
|
|
2015-10-19 02:25:17 +01:00
|
|
|
setButtons(KCModule::Help | KCModule::NoAdditionalButton);
|
2013-08-13 04:07:32 +01:00
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
connect(kcmUi.accept_button, &QAbstractButton::clicked, this, &KdeConnectKcm::acceptPairing);
|
|
|
|
connect(kcmUi.reject_button, &QAbstractButton::clicked, this, &KdeConnectKcm::cancelPairing);
|
|
|
|
connect(kcmUi.cancel_button, &QAbstractButton::clicked, this, &KdeConnectKcm::cancelPairing);
|
|
|
|
connect(kcmUi.pair_button, &QAbstractButton::clicked, this, &KdeConnectKcm::requestPairing);
|
|
|
|
connect(kcmUi.unpair_button, &QAbstractButton::clicked, this, &KdeConnectKcm::unpair);
|
|
|
|
connect(kcmUi.ping_button, &QAbstractButton::clicked, this, &KdeConnectKcm::sendPing);
|
|
|
|
connect(kcmUi.refresh_button, &QAbstractButton::clicked, this, &KdeConnectKcm::refresh);
|
|
|
|
connect(kcmUi.rename_edit, &QLineEdit::returnPressed, this, &KdeConnectKcm::renameDone);
|
|
|
|
connect(kcmUi.renameDone_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameDone);
|
|
|
|
connect(kcmUi.renameShow_button, &QAbstractButton::clicked, this, &KdeConnectKcm::renameShow);
|
|
|
|
connect(kcmUi.pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged);
|
2015-09-11 15:19:07 +01:00
|
|
|
|
2024-04-21 16:45:08 +01:00
|
|
|
if (!args.isEmpty() && !args.first().isNull() && args.first().canConvert<QString>()) {
|
2018-04-19 01:28:02 +01:00
|
|
|
const QString input = args.first().toString();
|
|
|
|
const auto colonIdx = input.indexOf(QLatin1Char(':'));
|
|
|
|
const QString deviceId = input.left(colonIdx);
|
2022-09-10 22:23:52 +01:00
|
|
|
const QString pluginCM = colonIdx < 0 ? QString() : input.mid(colonIdx + 1);
|
2018-04-19 01:28:02 +01:00
|
|
|
|
|
|
|
connect(devicesModel, &DevicesModel::rowsInserted, this, [this, deviceId, pluginCM]() {
|
2024-10-06 22:40:39 +01:00
|
|
|
kcmUi.list_quick_widget->rootObject()->setProperty("currentDeviceId", deviceId);
|
|
|
|
deviceSelected(deviceId);
|
2018-04-19 01:28:02 +01:00
|
|
|
if (!pluginCM.isEmpty()) {
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.pluginSelector->showConfiguration(pluginCM);
|
2018-04-19 01:28:02 +01:00
|
|
|
}
|
|
|
|
disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr);
|
|
|
|
});
|
|
|
|
}
|
2015-03-02 05:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::renameShow()
|
|
|
|
{
|
|
|
|
setRenameMode(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::renameDone()
|
|
|
|
{
|
2023-07-26 10:51:45 +01:00
|
|
|
QString newName = kcmUi.rename_edit->text();
|
2015-03-02 05:23:05 +00:00
|
|
|
if (newName.isEmpty()) {
|
2022-09-10 22:23:52 +01:00
|
|
|
// Rollback changes
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.rename_edit->setText(kcmUi.rename_label->text());
|
2015-03-02 05:23:05 +00:00
|
|
|
} else {
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.rename_label->setText(newName);
|
2015-03-02 05:23:05 +00:00
|
|
|
daemon->setAnnouncedName(newName);
|
|
|
|
}
|
|
|
|
setRenameMode(false);
|
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void KdeConnectKcm::setRenameMode(bool b)
|
|
|
|
{
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.renameDone_button->setVisible(b);
|
|
|
|
kcmUi.rename_edit->setVisible(b);
|
|
|
|
kcmUi.renameShow_button->setVisible(!b);
|
|
|
|
kcmUi.rename_label->setVisible(!b);
|
2013-06-19 15:15:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
KdeConnectKcm::~KdeConnectKcm()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-11 17:56:11 +01:00
|
|
|
void KdeConnectKcm::refresh()
|
|
|
|
{
|
2015-03-02 05:23:05 +00:00
|
|
|
daemon->forceOnNetworkChange();
|
2014-08-11 17:56:11 +01:00
|
|
|
}
|
|
|
|
|
2024-10-06 22:40:39 +01:00
|
|
|
void KdeConnectKcm::deviceSelected(const QString &deviceId)
|
2013-06-19 15:15:25 +01:00
|
|
|
{
|
2013-09-16 15:52:40 +01:00
|
|
|
if (currentDevice) {
|
2023-07-20 17:25:06 +01:00
|
|
|
disconnect(currentDevice, nullptr, this, nullptr);
|
2013-09-16 15:52:40 +01:00
|
|
|
}
|
|
|
|
|
2024-10-06 22:40:39 +01:00
|
|
|
currentDevice = devicesModel->getDevice(devicesModel->rowForDevice(deviceId));
|
|
|
|
if (!currentDevice) {
|
2015-09-08 09:46:59 +01:00
|
|
|
currentDevice = nullptr;
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.deviceInfo->setVisible(false);
|
2013-08-18 17:22:54 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.noDevicePlaceholder->setVisible(false);
|
2015-09-08 09:46:59 +01:00
|
|
|
bool valid = (currentDevice != nullptr && currentDevice->isValid());
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.deviceInfo->setVisible(valid);
|
2013-08-18 17:22:54 +01:00
|
|
|
if (!valid) {
|
|
|
|
return;
|
|
|
|
}
|
2013-08-15 23:25:13 +01:00
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.messages->setVisible(false);
|
2015-09-12 18:43:15 +01:00
|
|
|
resetDeviceView();
|
|
|
|
|
2023-08-08 21:51:30 +01:00
|
|
|
connect(currentDevice, &DeviceDbusInterface::pluginsChanged, this, &KdeConnectKcm::resetCurrentDevice);
|
|
|
|
connect(currentDevice, &DeviceDbusInterface::pairingFailed, this, &KdeConnectKcm::pairingFailed);
|
2023-08-08 19:23:25 +01:00
|
|
|
connect(currentDevice, &DeviceDbusInterface::pairStateChanged, this, &KdeConnectKcm::setCurrentDevicePairState);
|
2015-09-12 18:43:15 +01:00
|
|
|
}
|
2013-08-30 18:10:43 +01:00
|
|
|
|
2015-09-12 18:43:15 +01:00
|
|
|
void KdeConnectKcm::resetCurrentDevice()
|
|
|
|
{
|
2016-07-06 16:37:22 +01:00
|
|
|
const QStringList supportedPluginNames = currentDevice->supportedPlugins();
|
2013-08-13 04:07:32 +01:00
|
|
|
|
2016-07-06 16:37:22 +01:00
|
|
|
if (m_oldSupportedPluginNames != supportedPluginNames) {
|
2015-09-12 18:43:15 +01:00
|
|
|
resetDeviceView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::resetDeviceView()
|
|
|
|
{
|
2024-05-18 21:26:48 +01:00
|
|
|
kcmUi.verificationKey->setText(i18n("Key: %1", currentDevice->verificationKey()));
|
2015-09-12 18:43:15 +01:00
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.name_label->setText(currentDevice->name());
|
2022-09-10 22:23:52 +01:00
|
|
|
setWhenAvailable(
|
2023-06-01 01:25:37 +01:00
|
|
|
currentDevice->pairStateAsInt(),
|
2024-09-09 12:31:31 +01:00
|
|
|
[this](bool error, int pairStateAsInt) {
|
|
|
|
if (!error) {
|
|
|
|
setCurrentDevicePairState(pairStateAsInt);
|
|
|
|
}
|
2022-09-10 22:23:52 +01:00
|
|
|
},
|
|
|
|
this);
|
2015-09-07 17:50:26 +01:00
|
|
|
|
2023-07-26 09:52:38 +01:00
|
|
|
const QVector<KPluginMetaData> pluginInfo = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect"));
|
2021-11-18 10:05:09 +00:00
|
|
|
QVector<KPluginMetaData> availablePluginInfo;
|
2015-09-12 14:02:59 +01:00
|
|
|
|
2016-07-06 16:37:22 +01:00
|
|
|
m_oldSupportedPluginNames = currentDevice->supportedPlugins();
|
2022-09-10 22:23:52 +01:00
|
|
|
for (auto it = pluginInfo.cbegin(), itEnd = pluginInfo.cend(); it != itEnd; ++it) {
|
2021-11-18 10:05:09 +00:00
|
|
|
if (m_oldSupportedPluginNames.contains(it->pluginId())) {
|
2015-09-12 18:43:15 +01:00
|
|
|
availablePluginInfo.append(*it);
|
|
|
|
}
|
2015-09-12 14:02:59 +01:00
|
|
|
}
|
2013-08-13 04:07:32 +01:00
|
|
|
|
2015-09-12 18:43:15 +01:00
|
|
|
KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(currentDevice->pluginsConfigFile());
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.pluginSelector->clear();
|
|
|
|
kcmUi.pluginSelector->setConfigurationArguments({currentDevice->id()});
|
|
|
|
kcmUi.pluginSelector->addPlugins(availablePluginInfo, i18n("Available plugins"));
|
2023-11-06 19:05:39 +00:00
|
|
|
kcmUi.pluginSelector->setConfig(deviceConfig->group(QStringLiteral("Plugins")));
|
2013-06-19 15:15:25 +01:00
|
|
|
}
|
|
|
|
|
2023-06-01 01:25:37 +01:00
|
|
|
void KdeConnectKcm::requestPairing()
|
2013-06-19 15:15:25 +01:00
|
|
|
{
|
2013-09-16 15:52:40 +01:00
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
2013-08-30 18:10:43 +01:00
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.messages->hide();
|
2013-08-30 18:10:43 +01:00
|
|
|
|
2023-06-01 01:25:37 +01:00
|
|
|
currentDevice->requestPairing();
|
2013-08-30 18:10:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::unpair()
|
|
|
|
{
|
2013-09-16 15:52:40 +01:00
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentDevice->unpair();
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:00:26 +00:00
|
|
|
void KdeConnectKcm::acceptPairing()
|
|
|
|
{
|
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentDevice->acceptPairing();
|
|
|
|
}
|
|
|
|
|
2023-06-01 01:25:37 +01:00
|
|
|
void KdeConnectKcm::cancelPairing()
|
2017-02-20 20:00:26 +00:00
|
|
|
{
|
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-06-01 01:25:37 +01:00
|
|
|
currentDevice->cancelPairing();
|
2017-02-20 20:00:26 +00:00
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void KdeConnectKcm::pairingFailed(const QString &error)
|
2013-08-30 18:10:43 +01:00
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
if (sender() != currentDevice)
|
|
|
|
return;
|
2013-09-16 14:46:28 +01:00
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.messages->setText(i18n("Error trying to pair: %1", error));
|
|
|
|
kcmUi.messages->animatedShow();
|
2013-08-30 18:10:43 +01:00
|
|
|
}
|
|
|
|
|
2023-06-01 01:25:37 +01:00
|
|
|
void KdeConnectKcm::setCurrentDevicePairState(int pairStateAsInt)
|
2017-01-13 16:52:08 +00:00
|
|
|
{
|
2023-06-01 01:25:37 +01:00
|
|
|
PairState state = (PairState)pairStateAsInt; // Hack because qdbus doesn't like enums
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.accept_button->setVisible(state == PairState::RequestedByPeer);
|
|
|
|
kcmUi.reject_button->setVisible(state == PairState::RequestedByPeer);
|
|
|
|
kcmUi.cancel_button->setVisible(state == PairState::Requested);
|
|
|
|
kcmUi.pair_button->setVisible(state == PairState::NotPaired);
|
|
|
|
kcmUi.unpair_button->setVisible(state == PairState::Paired);
|
|
|
|
kcmUi.progressBar->setVisible(state == PairState::Requested);
|
|
|
|
kcmUi.ping_button->setVisible(state == PairState::Paired);
|
2023-06-01 01:25:37 +01:00
|
|
|
switch (state) {
|
|
|
|
case PairState::Paired:
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.status_label->setText(i18n("(paired)"));
|
2022-09-10 22:23:52 +01:00
|
|
|
break;
|
2023-06-01 01:25:37 +01:00
|
|
|
case PairState::NotPaired:
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.status_label->setText(i18n("(not paired)"));
|
2022-09-10 22:23:52 +01:00
|
|
|
break;
|
2023-06-01 01:25:37 +01:00
|
|
|
case PairState::RequestedByPeer:
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.status_label->setText(i18n("(incoming pair request)"));
|
2022-09-10 22:23:52 +01:00
|
|
|
break;
|
2023-06-01 01:25:37 +01:00
|
|
|
case PairState::Requested:
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.status_label->setText(i18n("(pairing requested)"));
|
2022-09-10 22:23:52 +01:00
|
|
|
break;
|
2017-02-20 20:00:26 +00:00
|
|
|
}
|
2013-08-13 04:07:32 +01:00
|
|
|
}
|
|
|
|
|
2023-06-24 18:45:48 +01:00
|
|
|
void KdeConnectKcm::pluginsConfigChanged(bool changed)
|
2013-08-13 04:07:32 +01:00
|
|
|
{
|
2023-06-24 18:45:48 +01:00
|
|
|
if (!changed)
|
|
|
|
return;
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
if (!currentDevice)
|
|
|
|
return;
|
2013-08-13 04:07:32 +01:00
|
|
|
|
2023-07-26 10:51:45 +01:00
|
|
|
kcmUi.pluginSelector->save();
|
2013-08-13 04:07:32 +01:00
|
|
|
currentDevice->reloadPlugins();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::save()
|
|
|
|
{
|
|
|
|
KCModule::save();
|
2013-06-19 15:15:25 +01:00
|
|
|
}
|
|
|
|
|
2013-07-03 02:52:44 +01:00
|
|
|
void KdeConnectKcm::sendPing()
|
2013-06-19 15:15:25 +01:00
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
if (!currentDevice)
|
|
|
|
return;
|
2016-11-26 14:38:08 +00:00
|
|
|
currentDevice->pluginCall(QStringLiteral("ping"), QStringLiteral("sendPing"));
|
2013-06-19 15:15:25 +01:00
|
|
|
}
|
2014-06-16 19:02:07 +01:00
|
|
|
|
|
|
|
#include "kcm.moc"
|
|
|
|
#include "moc_kcm.cpp"
|