[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:13 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=f4813b8
The following commit has been merged in the master branch:
commit f4813b88bc8c870dd1abbee64459565fba2f2ee0
Author: Samoilenko Yuri <kinnalru at gmail.com>
Date: Tue Jan 7 00:55:50 2014 +0400
sftp plugin
---
kded/plugins/{battery => sftp}/CMakeLists.txt | 20 ++++----
kded/plugins/sftp/README | 21 +++++++++
kded/plugins/sftp/kdeconnect_sftp.desktop | 47 ++++++++++++++++++
.../sftpdbusinterface.cpp} | 20 +++++---
.../pingplugin.h => sftp/sftpdbusinterface.h} | 26 +++++-----
.../sftpplugin.cpp} | 55 ++++++++++++++--------
.../pausemusicplugin.h => sftp/sftpplugin.h} | 25 +++++-----
7 files changed, 155 insertions(+), 59 deletions(-)
diff --git a/kded/plugins/battery/CMakeLists.txt b/kded/plugins/sftp/CMakeLists.txt
similarity index 59%
copy from kded/plugins/battery/CMakeLists.txt
copy to kded/plugins/sftp/CMakeLists.txt
index d623141..59ffcc1 100644
--- a/kded/plugins/battery/CMakeLists.txt
+++ b/kded/plugins/sftp/CMakeLists.txt
@@ -11,9 +11,9 @@ include_directories(
${CMAKE_SOURCE_DIR}
)
-set(kdeconnect_battery_SRCS
- batteryplugin.cpp
- batterydbusinterface.cpp
+set(kdeconnect_sftp_SRCS
+ sftpplugin.cpp
+ sftpdbusinterface.cpp
../kdeconnectplugin.cpp
../pluginloader.cpp
../../networkpackage.cpp
@@ -22,9 +22,9 @@ set(kdeconnect_battery_SRCS
../../kdebugnamespace.cpp
)
-kde4_add_plugin(kdeconnect_battery ${kdeconnect_battery_SRCS})
+kde4_add_plugin(kdeconnect_sftp ${kdeconnect_sftp_SRCS})
-target_link_libraries(kdeconnect_battery
+target_link_libraries(kdeconnect_sftp
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
@@ -33,14 +33,14 @@ target_link_libraries(kdeconnect_battery
${QCA2_LIBRARIES}
)
-install(TARGETS kdeconnect_battery DESTINATION ${PLUGIN_INSTALL_DIR} )
-install(FILES kdeconnect_battery.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+install(TARGETS kdeconnect_sftp DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(FILES kdeconnect_sftp.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
include(../../../macros.cmake)
generate_and_install_dbus_interface(
- kdeconnect_battery
- batterydbusinterface.h
- org.kde.kdeconnect.device.battery.xml
+ kdeconnect_sftp
+ sftpdbusinterface.h
+ org.kde.kdeconnect.device.sftp.xml
OPTIONS -a
)
diff --git a/kded/plugins/sftp/README b/kded/plugins/sftp/README
new file mode 100644
index 0000000..d5146e7
--- /dev/null
+++ b/kded/plugins/sftp/README
@@ -0,0 +1,21 @@
+
+This plugins receives packages with type "kdeconnect.sftp" and reads the
+following fields:
+
+ip (string): ip of the curretly active network on device
+port (string): port where sftp server starts
+user (string): username to connect to sftp server
+password (string): one session password to access sftp server
+path (string): root directory to access device filesystem
+
+This plugins sends packages with type "kdeconnect.sftp" and fills the
+following fields:
+
+startBrowsing (boolean): tell device to start sftp server and noify desktop
+
+<TODO>
+random password generation
+using encrypted packages
+</TODO>
+
+
diff --git a/kded/plugins/sftp/kdeconnect_sftp.desktop b/kded/plugins/sftp/kdeconnect_sftp.desktop
new file mode 100644
index 0000000..89e5fe5
--- /dev/null
+++ b/kded/plugins/sftp/kdeconnect_sftp.desktop
@@ -0,0 +1,47 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+ServiceTypes=KdeConnect/Plugin
+X-KDE-Library=kdeconnect_sftp
+X-KDE-PluginInfo-Author=Samoilenko Yuri
+X-KDE-PluginInfo-Email=kinnalru at gmail.com
+X-KDE-PluginInfo-Name=kdeconnect_sftp
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=http://albertvaka.wordpress.com
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+Icon=system-file-manager
+Name=SFTP browser
+Name[cs]=SFTP browser
+Name[da]=SFTP browser
+Name[de]=SFTP browser
+Name[es]=SFTP browser
+Name[fr]=SFTP browser
+Name[hu]=SFTP browser
+Name[it]=SFTP browser
+Name[nl]=SFTP browser
+Name[pt]=SFTP browser
+Name[pt_BR]=SFTP browser
+Name[ru]=SFTP обозреватель
+Name[sk]=SFTP browser
+Name[sv]=SFTP browser
+Name[tr]=SFTP browser
+Name[uk]=SFTP обозреватель
+Name[x-test]=xxSFTP browserxx
+Comment=Browse device files in filemanager through SFTP
+Comment[da]=Browse device files in filemanager through SFTP
+Comment[de]=Browse device files in filemanager through SFTP
+Comment[es]=Browse device files in filemanager through SFTP
+Comment[fr]=Browse device files in filemanager through SFTP
+Comment[hu]=Browse device files in filemanager through SFTP
+Comment[it]=Browse device files in filemanager through SFTP
+Comment[nl]=Browse device files in filemanager through SFTP
+Comment[pt]=Browse device files in filemanager through SFTP
+Comment[pt_BR]=Browse device files in filemanager through SFTP
+Comment[ru]=Доступ к файлам на устройстве через SFTP
+Comment[sv]=Browse device files in filemanager through SFTP
+Comment[tr]=Browse device files in filemanager through SFTP
+Comment[uk]=Доступ к файлам на устройстве через SFTP
+Comment[x-test]=xxBrowse device files in filemanager through SFTPxx
+
+X-KdeConnect-SupportedPackageType=kdeconnect.sftp
diff --git a/kded/plugins/kdeconnectplugin.cpp b/kded/plugins/sftp/sftpdbusinterface.cpp
similarity index 72%
copy from kded/plugins/kdeconnectplugin.cpp
copy to kded/plugins/sftp/sftpdbusinterface.cpp
index 1f3691e..e30a999 100644
--- a/kded/plugins/kdeconnectplugin.cpp
+++ b/kded/plugins/sftp/sftpdbusinterface.cpp
@@ -18,17 +18,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "kdeconnectplugin.h"
+#include "sftpdbusinterface.h"
-#include "../device.h"
+#include "../../kdebugnamespace.h"
-KdeConnectPlugin::KdeConnectPlugin(QObject* parent, const QVariantList& args)
- : QObject(parent)
+SftpDbusInterface::SftpDbusInterface(QObject *parent)
+ : QDBusAbstractAdaptor(parent)
{
- mDevice = qvariant_cast< Device* >(args.first());
}
-Device* KdeConnectPlugin::device()
+SftpDbusInterface::~SftpDbusInterface()
{
- return mDevice;
+ kDebug(kdeconnect_kded()) << "Destroying SftpDbusInterface";
}
+
+void SftpDbusInterface::browseFilesystem()
+{
+ emit startBrowsing();
+}
+
+
diff --git a/kded/plugins/ping/pingplugin.h b/kded/plugins/sftp/sftpdbusinterface.h
similarity index 71%
copy from kded/plugins/ping/pingplugin.h
copy to kded/plugins/sftp/sftpdbusinterface.h
index 334a353..80dc127 100644
--- a/kded/plugins/ping/pingplugin.h
+++ b/kded/plugins/sftp/sftpdbusinterface.h
@@ -18,25 +18,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef PINGPLUGIN_H
-#define PINGPLUGIN_H
+#ifndef SFTPDBUSINTERFACE_H
+#define SFTPDBUSINTERFACE_H
-#include <QObject>
+#include <QDBusAbstractAdaptor>
-#include "../kdeconnectplugin.h"
-
-class KDE_EXPORT PingPlugin
- : public KdeConnectPlugin
+class SftpDbusInterface
+ : public QDBusAbstractAdaptor
{
Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.sftp")
public:
- explicit PingPlugin(QObject *parent, const QVariantList &args);
- virtual ~PingPlugin();
+ explicit SftpDbusInterface(QObject *parent);
+ virtual ~SftpDbusInterface();
-public Q_SLOTS:
- virtual bool receivePackage(const NetworkPackage& np);
- virtual void connected() { };
+ Q_SCRIPTABLE void browseFilesystem();
+
+Q_SIGNALS:
+ void startBrowsing();
+
+private:
};
diff --git a/kded/plugins/notifications/notificationsplugin.cpp b/kded/plugins/sftp/sftpplugin.cpp
similarity index 52%
copy from kded/plugins/notifications/notificationsplugin.cpp
copy to kded/plugins/sftp/sftpplugin.cpp
index 5ff4198..7c01ccb 100644
--- a/kded/plugins/notifications/notificationsplugin.cpp
+++ b/kded/plugins/sftp/sftpplugin.cpp
@@ -18,48 +18,65 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "notificationsplugin.h"
+#include "sftpplugin.h"
+#include <KNotification>
#include <KIcon>
+#include <KLocalizedString>
+#include <KRun>
+#include <QMessageBox>
#include "../../kdebugnamespace.h"
-#include "notificationsdbusinterface.h"
+#include "sftpdbusinterface.h"
-K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< NotificationsPlugin >(); )
-K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_notifications", "kdeconnect_notifications") )
+K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SftpPlugin >(); )
+K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_sftp", "kdeconnect_sftp") )
-NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& args)
+SftpPlugin::SftpPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
+ , sftpDbusInterface(new SftpDbusInterface(parent))
{
- notificationsDbusInterface = new NotificationsDbusInterface(device(), parent);
+
+ connect(sftpDbusInterface, SIGNAL(startBrowsing()), this, SLOT(startBrowsing()));
}
-void NotificationsPlugin::connected()
+void SftpPlugin::connected()
{
- NetworkPackage np(PACKAGE_TYPE_NOTIFICATION);
- np.set("request", true);
- device()->sendPackage(np);
}
-NotificationsPlugin::~NotificationsPlugin()
+SftpPlugin::~SftpPlugin()
{
//FIXME: Qt dbus does not allow to remove an adaptor! (it causes a crash in
// the next dbus access to its parent). The implication of not deleting this
// is that disabling the plugin does not remove the interface (that will
// return outdated values) and that enabling it again instantiates a second
- // adaptor.
-
- //notificationsDbusInterface->deleteLater();
+ // adaptor. This is also a memory leak until the entire device is destroyed.
+ //sftpDbusInterface->deleteLater();
}
-bool NotificationsPlugin::receivePackage(const NetworkPackage& np)
+void SftpPlugin::startBrowsing()
{
- if (np.get<bool>("request")) return false;
+ NetworkPackage np(PACKAGE_TYPE_SFTP);
+ np.set("startBrowsing", true);
+ device()->sendPackage(np);
+}
+
- notificationsDbusInterface->processPackage(np);
+bool SftpPlugin::receivePackage(const NetworkPackage& np)
+{
+ KUrl url;
+ url.setProtocol("sftp");
+ url.setHost(np.get<QString>("ip"));
+ url.setPort(np.get<QString>("port").toInt());
+ url.setUser(np.get<QString>("user"));
+ url.setPass(np.get<QString>("password"));
+ url.setPath(np.get<QString>("home"));
+
+ if (url.isValid()) {
+ return KRun::runUrl(url, "inode/vnd.kde.service.sftp-ssh", 0);
+ }
- return true;
+ return false;
}
-
diff --git a/kded/plugins/pausemusic/pausemusicplugin.h b/kded/plugins/sftp/sftpplugin.h
similarity index 75%
copy from kded/plugins/pausemusic/pausemusicplugin.h
copy to kded/plugins/sftp/sftpplugin.h
index 2b5b32b..f3a4bdb 100644
--- a/kded/plugins/pausemusic/pausemusicplugin.h
+++ b/kded/plugins/sftp/sftpplugin.h
@@ -18,30 +18,33 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef PAUSEMUSICPLUGIN_H
-#define PAUSEMUSICPLUGIN_H
-
-#include <QObject>
-#include <QSet>
-#include <QString>
+#ifndef SFTPPLUGIN_H
+#define SFTPPLUGIN_H
#include "../kdeconnectplugin.h"
-class PauseMusicPlugin
+#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp")
+
+class SftpDbusInterface;
+
+class SftpPlugin
: public KdeConnectPlugin
{
Q_OBJECT
public:
- explicit PauseMusicPlugin(QObject *parent, const QVariantList &args);
+ explicit SftpPlugin(QObject *parent, const QVariantList &args);
+ virtual ~SftpPlugin();
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np);
- virtual void connected() { };
+ virtual void connected();
-private:
- QSet<QString> pausedSources;
+private Q_SLOTS:
+ void startBrowsing();
+private:
+ SftpDbusInterface* sftpDbusInterface;
};
#endif
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list