File: kmtpstorageinterface.h

package info (click to toggle)
kio-extras 4%3A22.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,768 kB
  • sloc: cpp: 26,898; ansic: 4,443; perl: 1,058; xml: 97; sh: 69; python: 28; makefile: 9
file content (63 lines) | stat: -rw-r--r-- 1,870 bytes parent folder | download
1
2
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
    This file is part of the KMTP framework, part of the KDE project.

    SPDX-FileCopyrightText: 2018 Andreas Krutzler <andreas.krutzler@gmx.net>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#ifndef KMTPSTORAGEINTERFACE_H
#define KMTPSTORAGEINTERFACE_H

#include "storageinterface.h"
#include "kmtpfile.h"

class KMTPDeviceInterface;

/**
 * @brief The KMTPStorageInterface class
 *
 * @note This interface should be a public API.
 */
class KMTPStorageInterface : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString description READ description)
    Q_PROPERTY(quint64 maxCapacity READ maxCapacity)
    Q_PROPERTY(quint64 freeSpaceInBytes READ freeSpaceInBytes)

public:
    explicit KMTPStorageInterface(const QString &dbusObjectPath, KMTPDeviceInterface *parent);

    QString description() const;
    quint64 maxCapacity() const;
    quint64 freeSpaceInBytes() const;

private:
    org::kde::kmtp::Storage *m_dbusInterface;

public Q_SLOTS:
    // file management
    KMTPFileList getFilesAndFolders(const QString &path, int &result) const;
    KMTPFile getFileMetadata(const QString &path) const;

    int getFileToHandler(const QString &path) const;
    int getFileToFileDescriptor(const QDBusUnixFileDescriptor &descriptor, const QString &sourcePath) const;

    int sendFileFromFileDescriptor(const QDBusUnixFileDescriptor &descriptor, const QString &destinationPath) const;

    int setFileName(const QString &path, const QString &newName) const;

    // folder management
    quint32 createFolder(const QString &path) const;

    // object management
    int deleteObject(const QString &path) const;

Q_SIGNALS:
    void dataReady(const QByteArray &data);
    void copyProgress(qulonglong transferredBytes, qulonglong totalBytes);
    void copyFinished(int result);
};

#endif // KMTPSTORAGEINTERFACE_H