[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:28:16 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=b0cc45b
The following commit has been merged in the master branch:
commit b0cc45b52aef6a54755c23c26aeeaf18beccb31c
Author: Albert Vaca <albertvaka at gmail.com>
Date: Sun Mar 1 21:23:05 2015 -0800
You can now change your name (the one seen by other devices on the network)
---
core/daemon.cpp | 11 ++++++++++
core/daemon.h | 3 +++
kcm/kcm.cpp | 43 ++++++++++++++++++++++++++++++++++----
kcm/kcm.h | 5 +++++
kcm/kcm.ui | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 123 insertions(+), 4 deletions(-)
diff --git a/core/daemon.cpp b/core/daemon.cpp
index e7fff1e..4e9cec4 100644
--- a/core/daemon.cpp
+++ b/core/daemon.cpp
@@ -162,6 +162,17 @@ void Daemon::onDeviceReachableStatusChanged()
}
}
+void Daemon::setAnnouncedName(QString name)
+{
+ KdeConnectConfig::instance()->setName(name);
+ forceOnNetworkChange();
+}
+
+QString Daemon::announcedName()
+{
+ return KdeConnectConfig::instance()->name();
+}
+
Daemon::~Daemon()
{
diff --git a/core/daemon.h b/core/daemon.h
index 35efa33..70f9abb 100644
--- a/core/daemon.h
+++ b/core/daemon.h
@@ -49,6 +49,9 @@ public Q_SLOTS:
Q_SCRIPTABLE void forceOnNetworkChange();
+ Q_SCRIPTABLE QString announcedName();
+ Q_SCRIPTABLE void setAnnouncedName(QString name);
+
//Returns a list of ids. The respective devices can be manipulated using the dbus path: "/modules/kdeconnect/Devices/"+id
Q_SCRIPTABLE QStringList devices(bool onlyReachable = false, bool onlyVisible = false) const;
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index e817fd5..8c377fa 100644
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -35,7 +35,6 @@
#include <KAboutData>
#include <KLocalizedString>
-
#include "ui_kcm.h"
#include "interfaces/dbusinterfaces.h"
#include "interfaces/devicesmodel.h"
@@ -46,12 +45,13 @@ K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin<KdeConnectKcm>();)
KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&)
: KCModule(KAboutData::pluginData("kdeconnect-kcm"), parent)
, kcmUi(new Ui::KdeConnectKcmUi())
+ , daemon(new DaemonDbusInterface(this))
, devicesModel(new DevicesModel(this))
, currentDevice(0)
- //, config(KSharedConfig::openConfig("kdeconnectrc"))
{
kcmUi->setupUi(this);
+
kcmUi->deviceList->setIconSize(QSize(32,32));
sortProxyModel = new DevicesSortProxyModel(devicesModel);
@@ -62,6 +62,10 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&)
kcmUi->progressBar->setVisible(false);
kcmUi->messages->setVisible(false);
+ kcmUi->rename_label->setText(daemon->announcedName());
+ kcmUi->rename_edit->setText(daemon->announcedName());
+ setRenameMode(false);
+
setButtons(KCModule::NoAdditionalButton);
connect(devicesModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
@@ -76,6 +80,38 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&)
this, SLOT(sendPing()));
connect(kcmUi->refresh_button,SIGNAL(clicked()),
this, SLOT(refresh()));
+ connect(kcmUi->rename_edit,SIGNAL(returnPressed()),
+ this, SLOT(renameDone()));
+ connect(kcmUi->renameDone_button,SIGNAL(clicked()),
+ this, SLOT(renameDone()));
+ connect(kcmUi->renameShow_button,SIGNAL(clicked()),
+ this, SLOT(renameShow()));
+
+}
+
+void KdeConnectKcm::renameShow()
+{
+ setRenameMode(true);
+}
+
+void KdeConnectKcm::renameDone()
+{
+ QString newName = kcmUi->rename_edit->text();
+ if (newName.isEmpty()) {
+ //Rollback changes
+ kcmUi->rename_edit->setText(kcmUi->rename_label->text());
+ } else {
+ kcmUi->rename_label->setText(newName);
+ daemon->setAnnouncedName(newName);
+ }
+ setRenameMode(false);
+}
+
+void KdeConnectKcm::setRenameMode(bool b) {
+ kcmUi->renameDone_button->setVisible(b);
+ kcmUi->rename_edit->setVisible(b);
+ kcmUi->renameShow_button->setVisible(!b);
+ kcmUi->rename_label->setVisible(!b);
}
KdeConnectKcm::~KdeConnectKcm()
@@ -85,8 +121,7 @@ KdeConnectKcm::~KdeConnectKcm()
void KdeConnectKcm::refresh()
{
- QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect", "org.kde.kdeconnect.daemon", "forceOnNetworkChange");
- QDBusConnection::sessionBus().call(msg);
+ daemon->forceOnNetworkChange();
}
void KdeConnectKcm::resetSelection()
diff --git a/kcm/kcm.h b/kcm/kcm.h
index 61ca8f8..1c2b0da 100644
--- a/kcm/kcm.h
+++ b/kcm/kcm.h
@@ -26,6 +26,7 @@
class QModelIndex;
class DeviceDbusInterface;
+class DaemonDbusInterface;
class DevicesModel;
class DevicesSortProxyModel;
@@ -56,9 +57,13 @@ private Q_SLOTS:
void pairingFailed(const QString& error);
void unpaired();
void refresh();
+ void renameShow();
+ void renameDone();
+ void setRenameMode(bool b);
private:
Ui::KdeConnectKcmUi* kcmUi;
+ DaemonDbusInterface* daemon;
DevicesModel* devicesModel;
DevicesSortProxyModel* sortProxyModel;
DeviceDbusInterface* currentDevice;
diff --git a/kcm/kcm.ui b/kcm/kcm.ui
index 63ca387..d3bb9af 100644
--- a/kcm/kcm.ui
+++ b/kcm/kcm.ui
@@ -33,6 +33,71 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
+ <layout class="QHBoxLayout" name="rename_group_2">
+ <item>
+ <widget class="QLabel" name="rename_label">
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>KDE Connect</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ </widget>
+ </item>
+ <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>
+ <widget class="QPushButton" name="renameShow_button">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="edit-rename"/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="rename_group">
+ <item>
+ <widget class="QLineEdit" name="rename_edit">
+ <property name="maxLength">
+ <number>64</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="renameDone_button">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="dialog-ok"/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<widget class="QListView" name="deviceList"/>
</item>
<item>
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list