Changeset View
Changeset View
Standalone View
Standalone View
mtp/shared/kmtpstorageinterface.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | This file is part of the KMTP framework, part of the KDE project. | ||||
3 | | ||||
4 | Copyright (C) 2018 Andreas Krutzler <andreas.krutzler@gmx.net> | ||||
5 | | ||||
6 | This library is free software; you can redistribute it and/or | ||||
7 | modify it under the terms of the GNU Lesser General Public | ||||
8 | License as published by the Free Software Foundation; either | ||||
9 | version 2.1 of the License, or (at your option) version 3, or any | ||||
10 | later version accepted by the membership of KDE e.V. (or its | ||||
11 | successor approved by the membership of KDE e.V.), which shall | ||||
12 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
13 | | ||||
14 | This library is distributed in the hope that it will be useful, | ||||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
17 | Lesser General Public License for more details. | ||||
18 | | ||||
19 | You should have received a copy of the GNU Lesser General Public | ||||
20 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
21 | */ | ||||
22 | | ||||
23 | #ifndef KMTPSTORAGEINTERFACE_H | ||||
24 | #define KMTPSTORAGEINTERFACE_H | ||||
25 | | ||||
26 | #include "storageinterface.h" | ||||
27 | #include "kmtpfile.h" | ||||
28 | | ||||
29 | class KMTPDeviceInterface; | ||||
30 | | ||||
31 | /** | ||||
32 | * @brief The KMTPStorageInterface class | ||||
33 | * | ||||
34 | * @note This interface should be a public API. | ||||
35 | */ | ||||
36 | class KMTPStorageInterface : public QObject | ||||
37 | { | ||||
38 | Q_OBJECT | ||||
39 | Q_PROPERTY(QString description READ description) | ||||
40 | Q_PROPERTY(quint64 maxCapacity READ maxCapacity) | ||||
41 | Q_PROPERTY(quint64 freeSpaceInBytes READ freeSpaceInBytes) | ||||
42 | | ||||
43 | public: | ||||
44 | KMTPStorageInterface(const QString &dbusObjectPath, KMTPDeviceInterface *parent); | ||||
45 | | ||||
46 | QString description() const; | ||||
47 | quint64 maxCapacity() const; | ||||
48 | quint64 freeSpaceInBytes() const; | ||||
49 | | ||||
50 | private: | ||||
51 | org::kde::kmtp::Storage *m_dbusInterface; | ||||
52 | | ||||
53 | public slots: | ||||
54 | // file management | ||||
55 | KMTPFileList getFilesAndFolders(const QString &path, int &result) const; | ||||
56 | KMTPFile getFileMetadata(const QString &path) const; | ||||
57 | | ||||
58 | int getFileToHandler(const QString &path) const; | ||||
59 | int getFileToFileDescriptor(const QDBusUnixFileDescriptor &descriptor, const QString &sourcePath) const; | ||||
60 | | ||||
61 | int sendFileFromFileDescriptor(const QDBusUnixFileDescriptor &descriptor, const QString &destinationPath) const; | ||||
62 | | ||||
63 | int setFileName(const QString &path, const QString &newName) const; | ||||
64 | | ||||
65 | // folder management | ||||
66 | quint32 createFolder(const QString &path) const; | ||||
67 | | ||||
68 | // object management | ||||
69 | int deleteObject(const QString &path) const; | ||||
70 | | ||||
71 | signals: | ||||
72 | void dataReady(const QByteArray &data); | ||||
73 | void copyProgress(qulonglong transferredBytes, qulonglong totalBytes); | ||||
74 | void copyFinished(int result); | ||||
75 | }; | ||||
76 | | ||||
77 | #endif // KMTPSTORAGEINTERFACE_H |