Changeset View
Changeset View
Standalone View
Standalone View
krusader/Archive/krarchandler.h
Show All 32 Lines | |||||
33 | namespace KWallet { | 33 | namespace KWallet { | ||
34 | class Wallet; | 34 | class Wallet; | ||
35 | } | 35 | } | ||
36 | 36 | | |||
37 | class KRarcObserver : public QObject | 37 | class KRarcObserver : public QObject | ||
38 | { | 38 | { | ||
39 | Q_OBJECT | 39 | Q_OBJECT | ||
40 | public: | 40 | public: | ||
41 | virtual ~KRarcObserver() {} | 41 | ~KRarcObserver() override = default; | ||
42 | 42 | | |||
43 | virtual void processEvents() = 0; | 43 | virtual void processEvents() = 0; | ||
44 | virtual void subJobStarted(const QString & jobTitle, int count) = 0; | 44 | virtual void subJobStarted(const QString & jobTitle, int count) = 0; | ||
45 | virtual void subJobStopped() = 0; | 45 | virtual void subJobStopped() = 0; | ||
46 | virtual bool wasCancelled() = 0; | 46 | virtual bool wasCancelled() = 0; | ||
47 | virtual void error(const QString & error) = 0; | 47 | virtual void error(const QString & error) = 0; | ||
48 | virtual void detailedError(const QString & error, const QString & details) = 0; | 48 | virtual void detailedError(const QString & error, const QString & details) = 0; | ||
49 | 49 | | |||
50 | public slots: | 50 | public slots: | ||
51 | virtual void incrementProgress(int) = 0; | 51 | virtual void incrementProgress(int) = 0; | ||
52 | }; | 52 | }; | ||
53 | 53 | | |||
54 | class KRarcHandler: public QObject, public KrArcBaseManager | 54 | class KRarcHandler: public QObject, public KrArcBaseManager | ||
55 | { | 55 | { | ||
56 | Q_OBJECT | 56 | Q_OBJECT | ||
57 | public: | 57 | public: | ||
58 | // return the number of files in the archive | 58 | // return the number of files in the archive | ||
59 | static long arcFileCount(QString archive, QString type, QString password, KRarcObserver *observer); | 59 | static long arcFileCount(const QString& archive, const QString& type, const QString& password, KRarcObserver *observer); | ||
60 | // unpack an archive to destination directory | 60 | // unpack an archive to destination directory | ||
61 | static bool unpack(QString archive, QString type, QString password, QString dest, KRarcObserver *observer ); | 61 | static bool unpack(QString archive, const QString& type, const QString& password, const QString& dest, KRarcObserver *observer ); | ||
62 | // pack an archive to destination directory | 62 | // pack an archive to destination directory | ||
63 | static bool pack(QStringList fileNames, QString type, QString dest, long count, QMap<QString, QString> extraProps, KRarcObserver *observer ); | 63 | static bool pack(QStringList fileNames, QString type, const QString& dest, long count, QMap<QString, QString> extraProps, KRarcObserver *observer ); | ||
64 | // test an archive | 64 | // test an archive | ||
65 | static bool test(QString archive, QString type, QString password, KRarcObserver *observer, long count = 0L ); | 65 | static bool test(const QString& archive, const QString& type, const QString& password, KRarcObserver *observer, long count = 0L ); | ||
66 | // returns `true` if the right unpacker exist in the system | 66 | // returns `true` if the right unpacker exist in the system | ||
67 | static bool arcSupported(QString type); | 67 | static bool arcSupported(QString type); | ||
68 | // return the list of supported packers | 68 | // return the list of supported packers | ||
69 | static QStringList supportedPackers(); | 69 | static QStringList supportedPackers(); | ||
70 | // returns `true` if the url is an archive (ie: tar:/home/test/file.tar.bz2) | 70 | // returns `true` if the url is an archive (ie: tar:/home/test/file.tar.bz2) | ||
71 | static bool isArchive(const QUrl &url); | 71 | static bool isArchive(const QUrl &url); | ||
72 | // used to determine the type of the archive | 72 | // used to determine the type of the archive | ||
73 | QString getType(bool &encrypted, QString fileName, QString mime, bool checkEncrypted = true, bool fast = false); | 73 | QString getType(bool &encrypted, QString fileName, const QString& mime, bool checkEncrypted = true, bool fast = false); | ||
74 | // queries the password from the user | 74 | // queries the password from the user | ||
75 | static QString getPassword(QString path); | 75 | static QString getPassword(const QString& path); | ||
76 | // detects the archive type | 76 | // detects the archive type | ||
77 | void checkIf7zIsEncrypted(bool &, QString) Q_DECL_OVERRIDE; | 77 | void checkIf7zIsEncrypted(bool &, QString) Q_DECL_OVERRIDE; | ||
78 | private: | 78 | private: | ||
79 | //! checks if a returned status ("exit code") of an archiving-related process is OK | 79 | //! checks if a returned status ("exit code") of an archiving-related process is OK | ||
80 | static bool checkStatus(QString type, int exitCode); | 80 | static bool checkStatus(const QString& type, int exitCode); | ||
81 | 81 | | |||
82 | static bool openWallet(); | 82 | static bool openWallet(); | ||
83 | 83 | | |||
84 | static KWallet::Wallet * wallet; | 84 | static KWallet::Wallet * wallet; | ||
85 | }; | 85 | }; | ||
86 | 86 | | |||
87 | #endif | 87 | #endif |