Refactoring
This commit is contained in:
parent
fd07c7bea6
commit
b5bf26c919
4 changed files with 6 additions and 14 deletions
|
@ -73,7 +73,7 @@ void Daemon::init()
|
|||
qCDebug(KDECONNECT_CORE) << "DBus registration complete";
|
||||
|
||||
auto configInstance = KdeConnectConfig::instance();
|
||||
auto status = configInstance.getLinkProviderStatus();
|
||||
auto status = configInstance.linkProviderStatus();
|
||||
|
||||
// Load backends
|
||||
if (d->m_testMode) {
|
||||
|
@ -153,7 +153,7 @@ QSet<LinkProvider *> Daemon::getLinkProviders() const
|
|||
QStringList Daemon::linkProviders() const
|
||||
{
|
||||
auto configInstance = KdeConnectConfig::instance();
|
||||
auto status = configInstance.getLinkProviderStatus();
|
||||
auto status = configInstance.linkProviderStatus();
|
||||
QStringList returnValue;
|
||||
|
||||
for (LinkProvider *a : std::as_const(d->m_linkProviders)) {
|
||||
|
|
|
@ -83,14 +83,10 @@ void KdeConnectConfig::setLinkProviderStatus(const QStringList enabledProviders,
|
|||
d->m_config->sync();
|
||||
}
|
||||
|
||||
QMap<QString, QStringList> KdeConnectConfig::getLinkProviderStatus()
|
||||
QMap<QString, QStringList> KdeConnectConfig::linkProviderStatus() const
|
||||
{
|
||||
QMap<QString, QStringList> result;
|
||||
|
||||
result[QStringLiteral("enabled")] = d->m_config->value(QStringLiteral("enabled_providers")).toStringList();
|
||||
result[QStringLiteral("disabled")] = d->m_config->value(QStringLiteral("disabled_providers")).toStringList();
|
||||
|
||||
return result;
|
||||
return {{QStringLiteral("enabled"), d->m_config->value(QStringLiteral("enabled_providers")).toStringList()},
|
||||
{QStringLiteral("disabled"), d->m_config->value(QStringLiteral("disabled_providers")).toStringList()}};
|
||||
}
|
||||
|
||||
DeviceType KdeConnectConfig::deviceType()
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
void setName(const QString &name);
|
||||
void setLinkProviderStatus(const QStringList enabledProviders, const QStringList disabledProviders);
|
||||
QMap<QString, QStringList> getLinkProviderStatus();
|
||||
QMap<QString, QStringList> linkProviderStatus() const;
|
||||
|
||||
/*
|
||||
* Trusted devices
|
||||
|
|
|
@ -101,7 +101,6 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const KPluginMetaData &md, const Q
|
|||
kcmUi.linkProviders_list->clear();
|
||||
for (int i = 0; i < linkProviders.size(); ++i) {
|
||||
QStringList linkProvider = linkProviders.at(i).split(QStringLiteral("|"));
|
||||
|
||||
QString providerName = linkProvider.at(0);
|
||||
QString providerStatus = linkProvider.at(1);
|
||||
|
||||
|
@ -191,11 +190,8 @@ void KdeConnectKcm::refresh()
|
|||
QString providerIsEnabled = item->checkState() == Qt::Checked ? QStringLiteral("enabled") : QStringLiteral("disabled");
|
||||
QString line = item->text() + QStringLiteral("|") + providerIsEnabled;
|
||||
providerStatusToSend.append(line);
|
||||
// QMessageBox::information(widget(), QStringLiteral("thisLine"), line, QMessageBox::StandardButton::NoButton);
|
||||
}
|
||||
|
||||
// QMessageBox::information(widget(), QStringLiteral("ProviderStatus"),providerStatusToSend.join(QStringLiteral("")),
|
||||
// QMessageBox::StandardButton::NoButton);
|
||||
daemon->setProviderStatus(providerStatusToSend);
|
||||
daemon->forceOnNetworkChange();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue