Changeset View
Changeset View
Standalone View
Standalone View
plugins/sftp/sftpplugin.h
Show All 32 Lines | |||||
33 | { | 33 | { | ||
34 | Q_OBJECT | 34 | Q_OBJECT | ||
35 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.sftp") | 35 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.sftp") | ||
36 | 36 | | |||
37 | public: | 37 | public: | ||
38 | explicit SftpPlugin(QObject *parent, const QVariantList &args); | 38 | explicit SftpPlugin(QObject *parent, const QVariantList &args); | ||
39 | ~SftpPlugin() override; | 39 | ~SftpPlugin() override; | ||
40 | 40 | | |||
41 | bool receivePackage(const NetworkPackage& np) override; | ||||
42 | void connected() override {} | ||||
43 | QString dbusPath() const override { return "/modules/kdeconnect/devices/" + deviceId + "/sftp"; } | ||||
44 | | ||||
41 | Q_SIGNALS: | 45 | Q_SIGNALS: | ||
42 | void packageReceived(const NetworkPackage& np); | 46 | void packageReceived(const NetworkPackage& np); | ||
43 | Q_SCRIPTABLE void mounted(); | 47 | Q_SCRIPTABLE void mounted(); | ||
44 | Q_SCRIPTABLE void unmounted(); | 48 | Q_SCRIPTABLE void unmounted(); | ||
45 | 49 | | |||
46 | public Q_SLOTS: | 50 | public Q_SLOTS: | ||
47 | bool receivePackage(const NetworkPackage& np) override; | | |||
48 | void connected() override; | | |||
49 | | ||||
50 | Q_SCRIPTABLE void mount(); | 51 | Q_SCRIPTABLE void mount(); | ||
51 | Q_SCRIPTABLE void unmount(); | 52 | Q_SCRIPTABLE void unmount(); | ||
52 | Q_SCRIPTABLE bool mountAndWait(); | 53 | Q_SCRIPTABLE bool mountAndWait(); | ||
53 | Q_SCRIPTABLE bool isMounted() const; | 54 | Q_SCRIPTABLE bool isMounted() const; | ||
54 | 55 | | |||
55 | Q_SCRIPTABLE bool startBrowsing(); | 56 | Q_SCRIPTABLE bool startBrowsing(); | ||
56 | Q_SCRIPTABLE QString mountPoint(); | 57 | Q_SCRIPTABLE QString mountPoint(); | ||
57 | Q_SCRIPTABLE QVariantMap getDirectories(); //Actually a QMap<String, String>, but QDBus preffers this | 58 | Q_SCRIPTABLE QVariantMap getDirectories(); //Actually a QMap<String, String>, but QDBus preffers this | ||
58 | 59 | | |||
59 | private Q_SLOTS: | 60 | private Q_SLOTS: | ||
60 | void onMounted(); | 61 | void onMounted(); | ||
61 | void onUnmounted(); | 62 | void onUnmounted(); | ||
62 | void onFailed(const QString& message); | 63 | void onFailed(const QString& message); | ||
63 | 64 | | |||
64 | private: | 65 | private: | ||
65 | QString dbusPath() const { return "/modules/kdeconnect/devices/" + deviceId + "/sftp"; } | | |||
66 | void knotify(int type, const QString& text, const QPixmap& icon) const; | 66 | void knotify(int type, const QString& text, const QPixmap& icon) const; | ||
67 | void addToDolphin(); | 67 | void addToDolphin(); | ||
68 | void removeFromDolphin(); | 68 | void removeFromDolphin(); | ||
69 | 69 | | |||
70 | private: | 70 | private: | ||
71 | struct Pimpl; | 71 | struct Pimpl; | ||
72 | QScopedPointer<Pimpl> m_d; | 72 | QScopedPointer<Pimpl> m_d; | ||
73 | QString deviceId; //Storing it to avoid accessing device() from the destructor which could cause a crash | 73 | QString deviceId; //Storing it to avoid accessing device() from the destructor which could cause a crash | ||
74 | 74 | | |||
75 | QVariantMap remoteDirectories; //Actually a QMap<String, String>, but QDBus preffers this | 75 | QVariantMap remoteDirectories; //Actually a QMap<String, String>, but QDBus preffers this | ||
76 | }; | 76 | }; | ||
77 | 77 | | |||
78 | 78 | | |||
79 | #endif | 79 | #endif |