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>
|
2014-06-16 19:02:07 +01:00
|
|
|
#include <KLocalizedString>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <KPluginInfo>
|
|
|
|
#include <KPluginMetaData>
|
2018-05-10 17:36:06 +01:00
|
|
|
#include <kcmutils_version.h>
|
2013-09-09 17:29:24 +01:00
|
|
|
|
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"
|
2022-09-10 22:23:52 +01:00
|
|
|
#include "ui_kcm.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
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
static QString createId()
|
|
|
|
{
|
|
|
|
return QStringLiteral("kcm") + QString::number(QCoreApplication::applicationPid());
|
|
|
|
}
|
2015-09-11 15:19:07 +01:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList &args)
|
2020-10-21 17:36:33 +01:00
|
|
|
: KCModule(parent)
|
2013-06-27 01:13:16 +01:00
|
|
|
, kcmUi(new Ui::KdeConnectKcmUi())
|
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
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
KAboutData *about = new KAboutData(QStringLiteral("kdeconnect-kcm"),
|
2015-06-20 06:47:40 +01:00
|
|
|
i18n("KDE Connect Settings"),
|
2016-11-26 14:38:08 +00:00
|
|
|
QStringLiteral(KDECONNECT_VERSION_STRING),
|
2015-06-20 06:47:40 +01:00
|
|
|
i18n("KDE Connect Settings module"),
|
|
|
|
KAboutLicense::KAboutLicense::GPL_V2,
|
|
|
|
i18n("(C) 2015 Albert Vaca Cintora"),
|
|
|
|
QString(),
|
2022-09-10 22:23:52 +01:00
|
|
|
QStringLiteral("https://community.kde.org/KDEConnect"));
|
2015-06-20 06:47:40 +01:00
|
|
|
about->addAuthor(i18n("Albert Vaca Cintora"));
|
2021-06-11 19:15:14 +01:00
|
|
|
about->setProgramLogo(QIcon(QStringLiteral(":/icons/kdeconnect/kdeconnect.svg")));
|
|
|
|
|
2015-06-20 06:47:40 +01:00
|
|
|
setAboutData(about);
|
2013-06-19 15:15:25 +01:00
|
|
|
|
2021-06-02 22:45:21 +01:00
|
|
|
#ifdef Q_OS_WIN
|
2021-06-13 09:19:12 +01:00
|
|
|
KColorSchemeManager manager;
|
2021-06-02 22:45:21 +01:00
|
|
|
QApplication::setStyle(QStringLiteral("breeze"));
|
|
|
|
#endif
|
|
|
|
|
2015-06-20 06:47:40 +01:00
|
|
|
kcmUi->setupUi(this);
|
2015-03-02 05:23:05 +00:00
|
|
|
|
2013-08-15 23:25:13 +01:00
|
|
|
sortProxyModel = new DevicesSortProxyModel(devicesModel);
|
|
|
|
|
|
|
|
kcmUi->deviceList->setModel(sortProxyModel);
|
2013-06-19 15:15:25 +01:00
|
|
|
|
2013-07-03 02:52:44 +01:00
|
|
|
kcmUi->deviceInfo->setVisible(false);
|
2013-08-30 18:10:43 +01:00
|
|
|
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
|
2015-03-23 07:39:36 +00:00
|
|
|
kcmUi->noDeviceLinks->setWordWrap(false);
|
2022-09-10 22:23:52 +01:00
|
|
|
QTimer::singleShot(0, this, [this] {
|
|
|
|
kcmUi->noDeviceLinks->setWordWrap(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
setWhenAvailable(
|
|
|
|
daemon->announcedName(),
|
|
|
|
[this](const QString &announcedName) {
|
|
|
|
kcmUi->rename_label->setText(announcedName);
|
|
|
|
kcmUi->rename_edit->setText(announcedName);
|
|
|
|
},
|
|
|
|
this);
|
|
|
|
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi->rename_edit, SLOT(setText(QString)));
|
|
|
|
connect(daemon, SIGNAL(announcedNameChanged(QString)), kcmUi->rename_label, SLOT(setText(QString)));
|
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
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
connect(devicesModel, &QAbstractItemModel::dataChanged, this, &KdeConnectKcm::resetSelection);
|
|
|
|
connect(kcmUi->deviceList->selectionModel(), &QItemSelectionModel::currentChanged, this, &KdeConnectKcm::deviceSelected);
|
|
|
|
connect(kcmUi->accept_button, &QAbstractButton::clicked, this, &KdeConnectKcm::acceptPairing);
|
|
|
|
connect(kcmUi->reject_button, &QAbstractButton::clicked, this, &KdeConnectKcm::rejectPairing);
|
|
|
|
connect(kcmUi->pair_button, &QAbstractButton::clicked, this, &KdeConnectKcm::requestPair);
|
|
|
|
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);
|
2015-09-11 15:19:07 +01:00
|
|
|
|
|
|
|
daemon->acquireDiscoveryMode(createId());
|
2018-04-19 01:28:02 +01:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 45, 0)
|
2018-05-10 17:36:06 +01:00
|
|
|
|
2018-04-19 01:28:02 +01:00
|
|
|
if (!args.isEmpty() && args.first().type() == QVariant::String) {
|
|
|
|
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]() {
|
|
|
|
auto row = devicesModel->rowForDevice(deviceId);
|
|
|
|
if (row >= 0) {
|
|
|
|
const QModelIndex idx = sortProxyModel->mapFromSource(devicesModel->index(row));
|
|
|
|
kcmUi->deviceList->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect);
|
|
|
|
}
|
|
|
|
if (!pluginCM.isEmpty()) {
|
|
|
|
kcmUi->pluginSelector->showConfiguration(pluginCM);
|
|
|
|
}
|
|
|
|
disconnect(devicesModel, &DevicesModel::rowsInserted, this, nullptr);
|
|
|
|
});
|
|
|
|
}
|
2018-05-10 17:36:06 +01:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
#endif
|
2015-03-02 05:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::renameShow()
|
|
|
|
{
|
|
|
|
setRenameMode(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::renameDone()
|
|
|
|
{
|
|
|
|
QString newName = kcmUi->rename_edit->text();
|
|
|
|
if (newName.isEmpty()) {
|
2022-09-10 22:23:52 +01:00
|
|
|
// Rollback changes
|
2015-03-02 05:23:05 +00:00
|
|
|
kcmUi->rename_edit->setText(kcmUi->rename_label->text());
|
|
|
|
} else {
|
|
|
|
kcmUi->rename_label->setText(newName);
|
|
|
|
daemon->setAnnouncedName(newName);
|
|
|
|
}
|
|
|
|
setRenameMode(false);
|
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void KdeConnectKcm::setRenameMode(bool b)
|
|
|
|
{
|
2015-03-02 05:23:05 +00: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()
|
|
|
|
{
|
2015-09-11 15:19:07 +01:00
|
|
|
daemon->releaseDiscoveryMode(createId());
|
2014-11-10 19:36:12 +00:00
|
|
|
delete kcmUi;
|
2013-06-19 15:15:25 +01:00
|
|
|
}
|
|
|
|
|
2014-08-11 17:56:11 +01:00
|
|
|
void KdeConnectKcm::refresh()
|
|
|
|
{
|
2015-09-11 15:19:07 +01:00
|
|
|
daemon->acquireDiscoveryMode(createId());
|
2015-03-02 05:23:05 +00:00
|
|
|
daemon->forceOnNetworkChange();
|
2014-08-11 17:56:11 +01:00
|
|
|
}
|
|
|
|
|
2013-08-15 23:25:13 +01:00
|
|
|
void KdeConnectKcm::resetSelection()
|
|
|
|
{
|
2015-06-22 03:43:21 +01:00
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
2013-08-15 23:25:13 +01:00
|
|
|
kcmUi->deviceList->selectionModel()->setCurrentIndex(sortProxyModel->mapFromSource(currentIndex), QItemSelectionModel::ClearAndSelect);
|
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void KdeConnectKcm::deviceSelected(const QModelIndex ¤t)
|
2013-06-19 15:15:25 +01:00
|
|
|
{
|
2013-09-16 15:52:40 +01:00
|
|
|
if (currentDevice) {
|
2015-09-08 19:03:44 +01:00
|
|
|
disconnect(currentDevice, 0, this, 0);
|
2013-09-16 15:52:40 +01:00
|
|
|
}
|
|
|
|
|
2013-08-18 17:22:54 +01:00
|
|
|
if (!current.isValid()) {
|
2015-09-08 09:46:59 +01:00
|
|
|
currentDevice = nullptr;
|
2013-08-18 17:22:54 +01:00
|
|
|
kcmUi->deviceInfo->setVisible(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-15 23:25:13 +01:00
|
|
|
currentIndex = sortProxyModel->mapToSource(current);
|
2015-04-15 12:00:23 +01:00
|
|
|
currentDevice = devicesModel->getDevice(currentIndex.row());
|
2013-08-15 23:25:13 +01:00
|
|
|
|
2015-09-08 19:03:44 +01:00
|
|
|
kcmUi->noDevicePlaceholder->setVisible(false);
|
2015-09-08 09:46:59 +01:00
|
|
|
bool valid = (currentDevice != nullptr && currentDevice->isValid());
|
2013-08-15 23:25:13 +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
|
|
|
|
2013-08-30 18:10:43 +01:00
|
|
|
kcmUi->messages->setVisible(false);
|
2015-09-12 18:43:15 +01:00
|
|
|
resetDeviceView();
|
|
|
|
|
|
|
|
connect(currentDevice, SIGNAL(pluginsChanged()), this, SLOT(resetCurrentDevice()));
|
2015-12-17 13:54:37 +00:00
|
|
|
connect(currentDevice, SIGNAL(trustedChanged(bool)), this, SLOT(trustedChanged(bool)));
|
|
|
|
connect(currentDevice, SIGNAL(pairingError(QString)), this, SLOT(pairingFailed(QString)));
|
2017-02-20 20:00:26 +00:00
|
|
|
connect(currentDevice, &DeviceDbusInterface::hasPairingRequestsChangedProxy, this, &KdeConnectKcm::currentDevicePairingChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::currentDevicePairingChanged(bool pairing)
|
|
|
|
{
|
|
|
|
if (pairing) {
|
|
|
|
setCurrentDeviceTrusted(RequestedByPeer);
|
|
|
|
} else {
|
2022-09-10 22:23:52 +01:00
|
|
|
setWhenAvailable(
|
|
|
|
currentDevice->isTrusted(),
|
|
|
|
[this](bool trusted) {
|
|
|
|
setCurrentDeviceTrusted(trusted ? Trusted : NotTrusted);
|
|
|
|
},
|
|
|
|
this);
|
2017-02-20 20:00:26 +00:00
|
|
|
}
|
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()
|
|
|
|
{
|
2020-11-26 10:28:32 +00:00
|
|
|
kcmUi->verificationKey->setText(i18n("Key: %1", QString::fromUtf8(currentDevice->verificationKey())));
|
2015-09-12 18:43:15 +01:00
|
|
|
|
|
|
|
kcmUi->name_label->setText(currentDevice->name());
|
2022-09-10 22:23:52 +01:00
|
|
|
setWhenAvailable(
|
|
|
|
currentDevice->isTrusted(),
|
|
|
|
[this](bool trusted) {
|
|
|
|
if (trusted)
|
|
|
|
setCurrentDeviceTrusted(Trusted);
|
|
|
|
else
|
|
|
|
setWhenAvailable(
|
|
|
|
currentDevice->hasPairingRequests(),
|
|
|
|
[this](bool haspr) {
|
|
|
|
setCurrentDeviceTrusted(haspr ? RequestedByPeer : NotTrusted);
|
|
|
|
},
|
|
|
|
this);
|
|
|
|
},
|
|
|
|
this);
|
2015-09-07 17:50:26 +01:00
|
|
|
|
2021-11-18 10:05:09 +00:00
|
|
|
const QVector<KPluginMetaData> pluginInfo = KPluginMetaData::findPlugins(QStringLiteral("kdeconnect/"));
|
|
|
|
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());
|
2021-11-18 10:05:09 +00:00
|
|
|
kcmUi->pluginSelector->clear();
|
|
|
|
kcmUi->pluginSelector->setConfigurationArguments(QStringList(currentDevice->id()));
|
|
|
|
kcmUi->pluginSelector->addPlugins(availablePluginInfo, i18n("Available plugins"));
|
|
|
|
kcmUi->pluginSelector->setConfig(deviceConfig->group("Plugins"));
|
|
|
|
connect(kcmUi->pluginSelector, &KPluginWidget::changed, this, &KdeConnectKcm::pluginsConfigChanged);
|
2013-06-19 15:15:25 +01:00
|
|
|
}
|
|
|
|
|
2013-08-30 18:10:43 +01:00
|
|
|
void KdeConnectKcm::requestPair()
|
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
|
|
|
|
|
|
|
kcmUi->messages->hide();
|
|
|
|
|
2017-02-20 20:00:26 +00:00
|
|
|
setCurrentDeviceTrusted(Requested);
|
2013-08-30 18:10:43 +01:00
|
|
|
|
|
|
|
currentDevice->requestPair();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::unpair()
|
|
|
|
{
|
2013-09-16 15:52:40 +01:00
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-07-14 00:01:15 +01:00
|
|
|
setCurrentDeviceTrusted(NotTrusted);
|
2013-09-16 15:52:40 +01:00
|
|
|
currentDevice->unpair();
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:00:26 +00:00
|
|
|
void KdeConnectKcm::acceptPairing()
|
|
|
|
{
|
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentDevice->acceptPairing();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::rejectPairing()
|
|
|
|
{
|
|
|
|
if (!currentDevice) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentDevice->rejectPairing();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2017-02-20 20:00:26 +00:00
|
|
|
setCurrentDeviceTrusted(NotTrusted);
|
2013-09-16 15:52:40 +01:00
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
kcmUi->messages->setText(i18n("Error trying to pair: %1", error));
|
2013-08-30 18:10:43 +01:00
|
|
|
kcmUi->messages->animatedShow();
|
|
|
|
}
|
|
|
|
|
2017-01-13 16:52:08 +00:00
|
|
|
void KdeConnectKcm::trustedChanged(bool trusted)
|
2013-08-30 18:10:43 +01:00
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
DeviceDbusInterface *senderDevice = (DeviceDbusInterface *)sender();
|
2017-01-13 16:52:08 +00:00
|
|
|
if (senderDevice == currentDevice)
|
2017-02-20 20:00:26 +00:00
|
|
|
setCurrentDeviceTrusted(trusted ? Trusted : NotTrusted);
|
2017-01-13 16:52:08 +00:00
|
|
|
}
|
2013-09-16 14:46:28 +01:00
|
|
|
|
2017-02-20 20:00:26 +00:00
|
|
|
void KdeConnectKcm::setCurrentDeviceTrusted(KdeConnectKcm::TrustStatus trusted)
|
2017-01-13 16:52:08 +00:00
|
|
|
{
|
2017-02-20 20:00:26 +00:00
|
|
|
kcmUi->accept_button->setVisible(trusted == RequestedByPeer);
|
|
|
|
kcmUi->reject_button->setVisible(trusted == RequestedByPeer);
|
|
|
|
kcmUi->pair_button->setVisible(trusted == NotTrusted);
|
|
|
|
kcmUi->unpair_button->setVisible(trusted == Trusted);
|
|
|
|
kcmUi->progressBar->setVisible(trusted == Requested);
|
|
|
|
kcmUi->ping_button->setVisible(trusted == Trusted);
|
|
|
|
switch (trusted) {
|
2022-09-10 22:23:52 +01:00
|
|
|
case Trusted:
|
|
|
|
kcmUi->status_label->setText(i18n("(paired)"));
|
|
|
|
break;
|
|
|
|
case NotTrusted:
|
|
|
|
kcmUi->status_label->setText(i18n("(not paired)"));
|
|
|
|
break;
|
|
|
|
case RequestedByPeer:
|
|
|
|
kcmUi->status_label->setText(i18n("(incoming pair request)"));
|
|
|
|
break;
|
|
|
|
case Requested:
|
|
|
|
kcmUi->status_label->setText(i18n("(pairing requested)"));
|
|
|
|
break;
|
2017-02-20 20:00:26 +00:00
|
|
|
}
|
2013-08-13 04:07:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void KdeConnectKcm::pluginsConfigChanged()
|
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
// Store previous selection
|
|
|
|
if (!currentDevice)
|
|
|
|
return;
|
2013-08-13 04:07:32 +01:00
|
|
|
|
|
|
|
kcmUi->pluginSelector->save();
|
|
|
|
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
|
|
|
|
2015-03-01 21:59:28 +00:00
|
|
|
QSize KdeConnectKcm::sizeHint() const
|
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
return QSize(890, 550); // Golden ratio :D
|
2015-03-01 21:59:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QSize KdeConnectKcm::minimumSizeHint() const
|
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
return QSize(500, 300);
|
2015-03-01 21:59:28 +00:00
|
|
|
}
|
|
|
|
|
2014-06-16 19:02:07 +01:00
|
|
|
#include "kcm.moc"
|
|
|
|
#include "moc_kcm.cpp"
|