OK, so this builds; but doesn't return the right type now. Untested if
the UI does what we want
This commit is contained in:
parent
837c2af9bf
commit
0bb9c8e294
3 changed files with 66 additions and 33 deletions
|
@ -149,11 +149,20 @@ QSet<LinkProvider *> Daemon::getLinkProviders() const
|
||||||
|
|
||||||
QStringList Daemon::linkProviders() const
|
QStringList Daemon::linkProviders() const
|
||||||
{
|
{
|
||||||
QStringList returnValue;
|
QString allStr = QStringLiteral("all");
|
||||||
|
QString enabledStr = QStringLiteral("enabled");
|
||||||
|
|
||||||
|
QMap<QString, QStringList> returnValue;
|
||||||
|
returnValue[allStr] = QStringList();
|
||||||
|
returnValue[enabledStr] = QStringList();
|
||||||
|
|
||||||
for (LinkProvider *a : std::as_const(d->m_linkProviders)) {
|
for (LinkProvider *a : std::as_const(d->m_linkProviders)) {
|
||||||
returnValue.append(a->name());
|
returnValue[allStr].append(a->name());
|
||||||
|
|
||||||
|
// TODO add filtering by enabled config
|
||||||
|
returnValue[enabledStr].append(a->name());
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue[allStr];
|
||||||
}
|
}
|
||||||
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
||||||
{
|
{
|
||||||
|
|
28
kcm/kcm.cpp
28
kcm/kcm.cpp
|
@ -12,6 +12,7 @@
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
#include <KPluginMetaData>
|
#include <KPluginMetaData>
|
||||||
|
#include <QtWidgets/QListView>
|
||||||
#include <kcmutils_version.h>
|
#include <kcmutils_version.h>
|
||||||
|
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
@ -92,19 +93,30 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const KPluginMetaData &md, const Q
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
|
/*
|
||||||
kcmUi.bluetoothEnabled_checkbox->setChecked(false);
|
setWhenAvailable(
|
||||||
|
daemon->linkProviders(),
|
||||||
|
[this](bool error, const QStringList linkProviders) {
|
||||||
|
for (int i = 0; i < linkProviders[QStringLiteral("all")].size(); ++i) {
|
||||||
|
QString linkProvider = QString(linkProviders[QStringLiteral("all")].at(i).constData());
|
||||||
|
QListWidgetItem linkProviderItem = new QListWidgetItem(linkProvider, kcmUi.linkProviders_list);
|
||||||
|
linkProviderItem->setCheckState(Qt::Unchecked);
|
||||||
|
if(linkProviders[QStringLiteral("enabled")].contains(linkProvider)){
|
||||||
|
linkProviderItem->setCheckState(Qt::Checked);
|
||||||
|
}
|
||||||
|
kcmUi.linkProviders_list->addItem(linkProviderItem);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
this);
|
||||||
|
*/
|
||||||
setWhenAvailable(
|
setWhenAvailable(
|
||||||
daemon->linkProviders(),
|
daemon->linkProviders(),
|
||||||
[this](bool error, const QStringList linkProviders) {
|
[this](bool error, const QStringList linkProviders) {
|
||||||
for (int i = 0; i < linkProviders.size(); ++i) {
|
for (int i = 0; i < linkProviders.size(); ++i) {
|
||||||
QString linkProvider = QString(linkProviders.at(i).constData());
|
QString linkProvider = QString(linkProviders.at(i).constData());
|
||||||
qDebug() << "link provider: " << linkProvider;
|
QListWidgetItem *linkProviderItem = new QListWidgetItem(linkProvider, kcmUi.linkProviders_list);
|
||||||
|
linkProviderItem->setCheckState(Qt::Checked);
|
||||||
if (linkProvider == QStringLiteral("BluetoothLinkProvider")) {
|
kcmUi.linkProviders_list->addItem(linkProviderItem);
|
||||||
kcmUi.bluetoothEnabled_checkbox->setChecked(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
|
|
56
kcm/kcm.ui
56
kcm/kcm.ui
|
@ -46,6 +46,19 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="rename_group_2">
|
<layout class="QHBoxLayout" name="rename_group_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="rename_label">
|
<widget class="QLabel" name="rename_label">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -62,19 +75,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="renameShow_button">
|
<widget class="QToolButton" name="renameShow_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -109,26 +109,38 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QQuickWidget" name="list_quick_widget">
|
<widget class="QListView" name="deviceList">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="resizeMode">
|
</widget>
|
||||||
<enum>QQuickWidget::ResizeMode::SizeRootObjectToView</enum>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="linkProvider_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Link Providers</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="bluetoothEnabled_checkbox">
|
<widget class="QListWidget" name="linkProviders_list">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::MultiSelection</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bluetooth Enabled</string>
|
<string>Placeholder</string>
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Reference in a new issue