sftpplugin.h 2.18 KB
Newer Older
Samoilenko Yuri's avatar
Samoilenko Yuri committed
1
/**
Samoilenko Yuri's avatar
Samoilenko Yuri committed
2
 * Copyright 2014 Samoilenko Yuri<kinnalru@gmail.com>
Samoilenko Yuri's avatar
Samoilenko Yuri committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License or (at your option) version 3 or any later version
 * accepted by the membership of KDE e.V. (or its successor approved
 * by the membership of KDE e.V.), which shall act as a proxy
 * defined in Section 14 of version 3 of the license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef SFTPPLUGIN_H
#define SFTPPLUGIN_H

#include "../kdeconnectplugin.h"

#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp")

28
class KNotification;
Samoilenko Yuri's avatar
Samoilenko Yuri committed
29 30 31 32 33

class SftpPlugin
    : public KdeConnectPlugin
{
    Q_OBJECT
34 35
    Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.sftp")
    
Samoilenko Yuri's avatar
Samoilenko Yuri committed
36
public:
37
  
Samoilenko Yuri's avatar
Samoilenko Yuri committed
38 39 40
    explicit SftpPlugin(QObject *parent, const QVariantList &args);
    virtual ~SftpPlugin();

41 42
Q_SIGNALS:
  
Samoilenko Yuri's avatar
Samoilenko Yuri committed
43
    void packageReceived(const NetworkPackage& np);
Samoilenko Yuri's avatar
Samoilenko Yuri committed
44 45
    Q_SCRIPTABLE void mounted();
    Q_SCRIPTABLE void unmounted();
46
    
Samoilenko Yuri's avatar
Samoilenko Yuri committed
47 48 49
public Q_SLOTS:
    virtual bool receivePackage(const NetworkPackage& np);
    virtual void connected();
50

51
    Q_SCRIPTABLE void mount();
Samoilenko Yuri's avatar
Samoilenko Yuri committed
52
    Q_SCRIPTABLE void unmount();
53
    Q_SCRIPTABLE bool mountAndWait();
54
    Q_SCRIPTABLE bool isMounted() const;
55
    
Samoilenko Yuri's avatar
Samoilenko Yuri committed
56
    Q_SCRIPTABLE bool startBrowsing();
57
    Q_SCRIPTABLE QString mountPoint();
Samoilenko Yuri's avatar
Samoilenko Yuri committed
58 59
    
    
60

Samoilenko Yuri's avatar
Samoilenko Yuri committed
61
private Q_SLOTS:
Samoilenko Yuri's avatar
Samoilenko Yuri committed
62 63 64
    void onMounted();
    void onUnmounted(bool idleTimeout);
    void onFailed(const QString& message);
65
    
Samoilenko Yuri's avatar
Samoilenko Yuri committed
66
private:
67
    QString dbusPath() const { return "/modules/kdeconnect/devices/" + device()->id() + "/sftp"; }
68
    void knotify(int type, const QString& text, const QPixmap& icon) const;
69 70
    void addToDolphin();
    void removeFromDolphin();
71 72 73 74
    
private:
    struct Pimpl;
    QScopedPointer<Pimpl> m_d;
Samoilenko Yuri's avatar
Samoilenko Yuri committed
75 76
};

77

Samoilenko Yuri's avatar
Samoilenko Yuri committed
78
#endif