Changeset View
Changeset View
Standalone View
Standalone View
krArc/krarc.h
Show All 40 Lines | |||||
41 | class QByteArray; | 41 | class QByteArray; | ||
42 | class QTextCodec; | 42 | class QTextCodec; | ||
43 | 43 | | |||
44 | class kio_krarcProtocol : public QObject, public KIO::SlaveBase, public KrArcBaseManager | 44 | class kio_krarcProtocol : public QObject, public KIO::SlaveBase, public KrArcBaseManager | ||
45 | { | 45 | { | ||
46 | Q_OBJECT | 46 | Q_OBJECT | ||
47 | public: | 47 | public: | ||
48 | kio_krarcProtocol(const QByteArray &pool_socket, const QByteArray &app_socket); | 48 | kio_krarcProtocol(const QByteArray &pool_socket, const QByteArray &app_socket); | ||
49 | virtual ~kio_krarcProtocol(); | 49 | ~kio_krarcProtocol() override; | ||
50 | virtual void stat(const QUrl &url) Q_DECL_OVERRIDE; | 50 | void stat(const QUrl &url) Q_DECL_OVERRIDE; | ||
51 | virtual void get(const QUrl &url) Q_DECL_OVERRIDE; | 51 | void get(const QUrl &url) Q_DECL_OVERRIDE; | ||
52 | virtual void put(const QUrl &url, int permissions, KIO::JobFlags flags) Q_DECL_OVERRIDE; | 52 | void put(const QUrl &url, int permissions, KIO::JobFlags flags) Q_DECL_OVERRIDE; | ||
53 | virtual void mkdir(const QUrl &url, int permissions) Q_DECL_OVERRIDE; | 53 | void mkdir(const QUrl &url, int permissions) Q_DECL_OVERRIDE; | ||
54 | virtual void listDir(const QUrl &url) Q_DECL_OVERRIDE; | 54 | void listDir(const QUrl &url) Q_DECL_OVERRIDE; | ||
55 | virtual void del(QUrl const & url, bool isFile) Q_DECL_OVERRIDE; | 55 | void del(QUrl const & url, bool isFile) Q_DECL_OVERRIDE; | ||
56 | virtual void copy(const QUrl &src, const QUrl &dest, int permissions, KIO::JobFlags flags) Q_DECL_OVERRIDE; | 56 | void copy(const QUrl &src, const QUrl &dest, int permissions, KIO::JobFlags flags) Q_DECL_OVERRIDE; | ||
57 | virtual void rename(const QUrl &src, const QUrl & dest, KIO::JobFlags flags) Q_DECL_OVERRIDE; | 57 | void rename(const QUrl &src, const QUrl & dest, KIO::JobFlags flags) Q_DECL_OVERRIDE; | ||
58 | 58 | | |||
59 | public slots: | 59 | public slots: | ||
60 | void receivedData(KProcess *, QByteArray &); | 60 | void receivedData(KProcess *, QByteArray &); | ||
61 | void checkOutputForPassword(KProcess *, QByteArray &); | 61 | void checkOutputForPassword(KProcess *, QByteArray &); | ||
62 | 62 | | |||
63 | protected: | 63 | protected: | ||
64 | virtual bool initDirDict(const QUrl &url, bool forced = false); | 64 | virtual bool initDirDict(const QUrl &url, bool forced = false); | ||
65 | virtual bool initArcParameters(); | 65 | virtual bool initArcParameters(); | ||
66 | void checkIf7zIsEncrypted(bool &, QString) Q_DECL_OVERRIDE; | 66 | void checkIf7zIsEncrypted(bool &, QString) Q_DECL_OVERRIDE; | ||
67 | virtual void parseLine(int lineNo, QString line); | 67 | virtual void parseLine(int lineNo, QString line); | ||
68 | virtual bool setArcFile(const QUrl &url); | 68 | virtual bool setArcFile(const QUrl &url); | ||
69 | virtual QString getPassword(); | 69 | virtual QString getPassword(); | ||
70 | virtual void invalidatePassword(); | 70 | virtual void invalidatePassword(); | ||
71 | QString getPath(const QUrl &url, QUrl::FormattingOptions options = 0); | 71 | QString getPath(const QUrl &url, QUrl::FormattingOptions options = nullptr); | ||
72 | 72 | | |||
73 | QString localeEncodedString(QString str); | 73 | QString localeEncodedString(QString str); | ||
74 | QByteArray encodeString(QString); | 74 | QByteArray encodeString(const QString&); | ||
75 | QString decodeString(char *); | 75 | QString decodeString(char *); | ||
76 | 76 | | |||
77 | // archive specific commands | 77 | // archive specific commands | ||
78 | QString cmd; ///< the archiver name. | 78 | QString cmd; ///< the archiver name. | ||
79 | QStringList listCmd; ///< list files. | 79 | QStringList listCmd; ///< list files. | ||
80 | QStringList getCmd; ///< unpack files command. | 80 | QStringList getCmd; ///< unpack files command. | ||
81 | QStringList delCmd; ///< delete files command. | 81 | QStringList delCmd; ///< delete files command. | ||
82 | QStringList putCmd; ///< add file command. | 82 | QStringList putCmd; ///< add file command. | ||
83 | QStringList copyCmd; ///< copy to file command. | 83 | QStringList copyCmd; ///< copy to file command. | ||
84 | QStringList renCmd; ///< rename file command. | 84 | QStringList renCmd; ///< rename file command. | ||
85 | 85 | | |||
86 | private: | 86 | private: | ||
87 | void get(const QUrl &url, int tries); | 87 | void get(const QUrl &url, int tries); | ||
88 | /** checks if a returned status ("exit code") of an archiving-related process is OK. */ | 88 | /** checks if a returned status ("exit code") of an archiving-related process is OK. */ | ||
89 | bool checkStatus(int exitCode); | 89 | bool checkStatus(int exitCode); | ||
90 | /** service function for parseLine. */ | 90 | /** service function for parseLine. */ | ||
91 | QString nextWord(QString &s, char d = ' '); | 91 | QString nextWord(QString &s, char d = ' '); | ||
92 | /** translate permission string to mode_t. */ | 92 | /** translate permission string to mode_t. */ | ||
93 | mode_t parsePermString(QString perm); | 93 | mode_t parsePermString(QString perm); | ||
94 | /** return the name of the directory inside the archive. */ | 94 | /** return the name of the directory inside the archive. */ | ||
95 | QString findArcDirectory(const QUrl &url); | 95 | QString findArcDirectory(const QUrl &url); | ||
96 | /** find the UDSEntry of a file in a directory. */ | 96 | /** find the UDSEntry of a file in a directory. */ | ||
97 | KIO::UDSEntry* findFileEntry(const QUrl &url); | 97 | KIO::UDSEntry* findFileEntry(const QUrl &url); | ||
98 | /** add a new directory (file list container). */ | 98 | /** add a new directory (file list container). */ | ||
99 | KIO::UDSEntryList* addNewDir(QString path); | 99 | KIO::UDSEntryList* addNewDir(const QString& path); | ||
100 | QString fullPathName(QString name); | 100 | QString fullPathName(const QString& name); | ||
101 | static QString detectFullPathName(QString name); | 101 | static QString detectFullPathName(QString name); | ||
102 | bool checkWriteSupport(); | 102 | bool checkWriteSupport(); | ||
103 | 103 | | |||
104 | QHash<QString, KIO::UDSEntryList *> dirDict; //< the directories data structure. | 104 | QHash<QString, KIO::UDSEntryList *> dirDict; //< the directories data structure. | ||
105 | bool encrypted; //< tells whether the archive is encrypted | 105 | bool encrypted; //< tells whether the archive is encrypted | ||
106 | bool archiveChanged; //< true if the archive was changed. | 106 | bool archiveChanged; //< true if the archive was changed. | ||
107 | bool archiveChanging; //< true if the archive is currently changing. | 107 | bool archiveChanging; //< true if the archive is currently changing. | ||
108 | bool newArchiveURL; //< true if new archive was entered for the protocol | 108 | bool newArchiveURL; //< true if new archive was entered for the protocol | ||
Show All 37 Lines |