Changeset View
Changeset View
Standalone View
Standalone View
mtp/kio_mtp.h
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Main implementation for KIO-MTP | 2 | * Main implementation for KIO-MTP | ||
3 | * Copyright (C) 2012 Philipp Schmidt <philschmidt@gmx.net> | 3 | * Copyright (C) 2012 Philipp Schmidt <philschmidt@gmx.net> | ||
4 | * Copyright (C) 2018 Andreas Krutzler <andreas.krutzler@gmx.net> | ||||
4 | * | 5 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | 9 | * (at your option) any later version. | ||
9 | * | 10 | * | ||
10 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
Show All 12 Lines | |||||
24 | #include <kio/slavebase.h> | 25 | #include <kio/slavebase.h> | ||
25 | #include <KLocalizedString> | 26 | #include <KLocalizedString> | ||
26 | 27 | | |||
27 | #include <stdlib.h> | 28 | #include <stdlib.h> | ||
28 | #include <sys/stat.h> | 29 | #include <sys/stat.h> | ||
29 | #include <errno.h> | 30 | #include <errno.h> | ||
30 | #include <time.h> | 31 | #include <time.h> | ||
31 | 32 | | |||
32 | #include <libmtp.h> | | |||
33 | 33 | | |||
34 | // #include <QCache> | 34 | // #include <QCache> | ||
35 | #include "filecache.h" | | |||
36 | #include "devicecache.h" | | |||
37 | 35 | | |||
38 | #include <QUrl> | 36 | #include <QUrl> | ||
39 | #include <QLoggingCategory> | 37 | #include <QLoggingCategory> | ||
40 | 38 | | |||
41 | #define MAX_XFER_BUF_SIZE 16348 | 39 | #define MAX_XFER_BUF_SIZE 16348 | ||
42 | #define KIO_MTP 7000 | 40 | #define KIO_MTP 7000 | ||
41 | #include <kmtpdinterface.h> | ||||
42 | | ||||
43 | class KMTPDeviceInterface; | ||||
44 | class KMTPStorageInterface; | ||||
45 | class KMTPFile; | ||||
43 | 46 | | |||
44 | using namespace KIO; | 47 | using namespace KIO; | ||
45 | 48 | | |||
46 | Q_DECLARE_LOGGING_CATEGORY(LOG_KIO_MTP) | 49 | Q_DECLARE_LOGGING_CATEGORY(LOG_KIO_MTP) | ||
47 | 50 | | |||
48 | class MTPSlave : public QObject, public KIO::SlaveBase | 51 | class MTPSlave : public QObject, public KIO::SlaveBase | ||
49 | { | 52 | { | ||
50 | Q_OBJECT | 53 | Q_OBJECT | ||
Show All 26 Lines | 79 | private: | |||
77 | /** | 80 | /** | ||
78 | * Check if it is a valid url or an udi. | 81 | * Check if it is a valid url or an udi. | ||
79 | * | 82 | * | ||
80 | * @param url The url to checkUrl | 83 | * @param url The url to checkUrl | ||
81 | * @param redirect If udi= should be redirected or just return false | 84 | * @param redirect If udi= should be redirected or just return false | ||
82 | * @return 0 if valid, 1 if udi and redirected, 2 if udi but invalid device, -1 else | 85 | * @return 0 if valid, 1 if udi and redirected, 2 if udi but invalid device, -1 else | ||
83 | */ | 86 | */ | ||
84 | int checkUrl(const QUrl &url, bool redirect = true); | 87 | int checkUrl(const QUrl &url, bool redirect = true); | ||
85 | static QString urlDirectory(const QUrl &url, bool appendTrailingSlash = false); | | |||
86 | static QString urlFileName(const QUrl &url); | | |||
87 | 88 | | |||
88 | void fileSystemFreeSpace(const QUrl &url); | 89 | void fileSystemFreeSpace(const QUrl &url); | ||
89 | 90 | | |||
90 | FileCache *fileCache; | 91 | /** | ||
91 | DeviceCache *deviceCache; | 92 | * @brief Waits for a pending copy operation to finish while updating its progress. | ||
92 | QPair<void *, LIBMTP_mtpdevice_t *> getPath(const QString &path); | 93 | * @param storage | ||
94 | * @return The result of the operation, usually 0 if valid | ||||
95 | */ | ||||
96 | int waitForCopyOperation(const KMTPStorageInterface *storage); | ||||
97 | | ||||
98 | KMTPDInterface m_kmtpDaemon; | ||||
dfaure: class-static private functions pollute the header file for no benefit, they might as well… | |||||
93 | }; | 99 | }; | ||
94 | 100 | | |||
95 | #endif // KIO_MTP_H | 101 | #endif // KIO_MTP_H |
class-static private functions pollute the header file for no benefit, they might as well become file-static functions (i.e. remove the declarations from here, and remove the classname from the implementation, and ensure they're at the top of the file).