diff --git a/autotests/httpserver_p.h b/autotests/httpserver_p.h index 31b3d24f..f86fea97 100644 --- a/autotests/httpserver_p.h +++ b/autotests/httpserver_p.h @@ -1,179 +1,179 @@ /**************************************************************************** ** Copyright (C) 2010-2016 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com. ** Author: David Faure ** All rights reserved. ** ** This file initially comes from the KD Soap library. ** ** This file may be distributed and/or modified under the terms of the ** GNU Lesser General Public License version 2.1 and version 3 as published by the ** Free Software Foundation and appearing in the file COPYING.LIB included. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Contact info@kdab.com if any conditions of this licensing are not ** clear to you. ** **********************************************************************/ #ifndef HTTPSERVER_P_H #define HTTPSERVER_P_H #include #include #include #include #include #include #include #include class BlockingHttpServer; class HttpServerThread : public QThread { Q_OBJECT public: enum Feature { Public = 0, // HTTP with no ssl and no authentication needed Ssl = 1, // HTTPS BasicAuth = 2, // Requires authentication Error404 = 4 // Return "404 not found" // bitfield, next item is 8 }; Q_DECLARE_FLAGS(Features, Feature) HttpServerThread(const QByteArray &dataToSend, Features features) : m_dataToSend(dataToSend), m_features(features) { start(); m_ready.acquire(); } ~HttpServerThread() { finish(); wait(); } void setContentType(const QByteArray &mime) { QMutexLocker lock(&m_mutex); m_contentType = mime; } void setResponseData(const QByteArray &data) { QMutexLocker lock(&m_mutex); m_dataToSend = data; } void setFeatures(Features features) { QMutexLocker lock(&m_mutex); m_features = features; } void disableSsl(); inline int serverPort() const { QMutexLocker lock(&m_mutex); return m_port; } QString endPoint() const { return QString::fromLatin1("%1://127.0.0.1:%2/path") .arg(QString::fromLatin1((m_features & Ssl) ? "https" : "http")) .arg(serverPort()); } void finish(); QByteArray receivedData() const { QMutexLocker lock(&m_mutex); return m_receivedData; } QByteArray receivedHeaders() const { QMutexLocker lock(&m_mutex); return m_receivedHeaders; } void resetReceivedBuffers() { QMutexLocker lock(&m_mutex); m_receivedData.clear(); m_receivedHeaders.clear(); } QByteArray header(const QByteArray &value) const { QMutexLocker lock(&m_mutex); return m_headers.value(value); } protected: - /* \reimp */ void run() Q_DECL_OVERRIDE; + /* \reimp */ void run() override; private: QByteArray makeHttpResponse(const QByteArray &responseData) const; private: QByteArray m_partialRequest; QSemaphore m_ready; QByteArray m_dataToSend; QByteArray m_contentType; mutable QMutex m_mutex; // protects the 4 vars below QByteArray m_receivedData; QByteArray m_receivedHeaders; QMap m_headers; int m_port; Features m_features; BlockingHttpServer *m_server; }; Q_DECLARE_OPERATORS_FOR_FLAGS(HttpServerThread::Features) // A blocking http server (must be used in a thread) which supports SSL. class BlockingHttpServer : public QTcpServer { Q_OBJECT public: BlockingHttpServer(bool ssl) : doSsl(ssl), sslSocket(nullptr) {} ~BlockingHttpServer() {} QTcpSocket *waitForNextConnectionSocket() { if (!waitForNewConnection(20000)) { // 2000 would be enough, except in valgrind return nullptr; } if (doSsl) { Q_ASSERT(sslSocket); return sslSocket; } else { //qDebug() << "returning nextPendingConnection"; return nextPendingConnection(); } } - void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE; + void incomingConnection(qintptr socketDescriptor) override; void disableSsl() { doSsl = false; } private Q_SLOTS: void slotSslErrors(const QList &errors) { qDebug() << "server-side: slotSslErrors" << sslSocket->errorString() << errors; } private: bool doSsl; QTcpSocket *sslSocket; }; #endif /* HTTPSERVER_P_H */ diff --git a/autotests/kdirlistertest.h b/autotests/kdirlistertest.h index 7f5d398c..a2388c42 100644 --- a/autotests/kdirlistertest.h +++ b/autotests/kdirlistertest.h @@ -1,151 +1,151 @@ /* This file is part of the KDE project Copyright (C) 2007 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDIRLISTERTEST_H #define KDIRLISTERTEST_H #include #include #include #include #include #include Q_DECLARE_METATYPE(KFileItemList) class GlobalInits { public: GlobalInits() { // Must be done before the QSignalSpys connect qRegisterMetaType(); qRegisterMetaType(); } }; class MyDirLister : public KDirLister, GlobalInits { public: MyDirLister() : spyStarted(this, SIGNAL(started(QUrl))), spyClear(this, SIGNAL(clear())), spyClearQUrl(this, SIGNAL(clear(QUrl))), spyCompleted(this, SIGNAL(completed())), spyCompletedQUrl(this, SIGNAL(completed(QUrl))), spyCanceled(this, SIGNAL(canceled())), spyCanceledQUrl(this, SIGNAL(canceled(QUrl))), spyRedirection(this, SIGNAL(redirection(QUrl))), spyItemsDeleted(this, SIGNAL(itemsDeleted(KFileItemList))) {} void clearSpies() { spyStarted.clear(); spyClear.clear(); spyClearQUrl.clear(); spyCompleted.clear(); spyCompletedQUrl.clear(); spyCanceled.clear(); spyCanceledQUrl.clear(); spyRedirection.clear(); spyItemsDeleted.clear(); } QSignalSpy spyStarted; QSignalSpy spyClear; QSignalSpy spyClearQUrl; QSignalSpy spyCompleted; QSignalSpy spyCompletedQUrl; QSignalSpy spyCanceled; QSignalSpy spyCanceledQUrl; QSignalSpy spyRedirection; QSignalSpy spyItemsDeleted; protected: - void handleError(KIO::Job *job) Q_DECL_OVERRIDE; + void handleError(KIO::Job *job) override; }; class KDirListerTest : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase(); void cleanup(); void testOpenUrl(); void testOpenUrlFromCache(); void testNewItems(); void testNewItemByCopy(); void testNewItemsInSymlink(); void testRefreshItems(); void testRefreshRootItem(); void testDeleteItem(); void testRenameItem(); void testRenameAndOverwrite(); void testConcurrentListing(); void testConcurrentHoldingListing(); void testConcurrentListingAndStop(); void testDeleteListerEarly(); void testOpenUrlTwice(); void testOpenUrlTwiceWithKeep(); void testOpenAndStop(); void testBug211472(); void testRenameCurrentDir(); void testRenameCurrentDirOpenUrl(); void testRedirection(); void testListEmptyDirFromCache(); void testWatchingAfterCopyJob(); void testRemoveWatchedDirectory(); void testDirPermissionChange(); void testCopyAfterListingAndMove(); // #353195 void testDeleteCurrentDir(); // must be last! protected Q_SLOTS: // 'more private than private slots' - i.e. not seen by qtestlib void exitLoop(); void slotNewItems(const KFileItemList &); void slotNewItems2(const KFileItemList &); void slotRefreshItems(const QList > &); void slotRefreshItems2(const QList > &); void slotOpenUrlOnRename(const QUrl &); Q_SIGNALS: void refreshItemsReceived(); private: void enterLoop(int exitCount = 1); int fileCount() const; QString path() const { return m_tempDir.path() + '/'; } bool waitForRefreshedItems(); void createSimpleFile(const QString &fileName); void fillDirLister2(MyDirLister &lister, const QString &path); void waitUntilMTimeChange(const QString &path); void waitUntilAfter(const QDateTime &ctime); private: int m_exitCount; QEventLoop m_eventLoop; QTemporaryDir m_tempDir; MyDirLister m_dirLister; KFileItemList m_items; KFileItemList m_items2; QList > m_refreshedItems, m_refreshedItems2; }; #endif diff --git a/autotests/kiotesthelper.h b/autotests/kiotesthelper.h index 470e0fa2..2530f1b5 100644 --- a/autotests/kiotesthelper.h +++ b/autotests/kiotesthelper.h @@ -1,205 +1,205 @@ /* This file is part of the KDE project Copyright (C) 2006 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // This file can only be included once in a given binary #include #include #include #include #include #ifdef Q_OS_UNIX #include #else #include #endif #include #include "kioglobal_p.h" QString homeTmpDir() { const QString dir(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/kiotests/"); if (!QFile::exists(dir)) { const bool ok = QDir().mkpath(dir); if (!ok) { qFatal("Couldn't create %s", qPrintable(dir)); } } return dir; } static QDateTime s_referenceTimeStamp; static void setTimeStamp(const QString &path, const QDateTime &mtime) { #ifdef Q_OS_UNIX // Put timestamp in the past so that we can check that the listing is correct struct utimbuf utbuf; utbuf.actime = mtime.toTime_t(); utbuf.modtime = utbuf.actime; utime(QFile::encodeName(path), &utbuf); //qDebug( "Time changed for %s", qPrintable( path ) ); #elif defined(Q_OS_WIN) struct _utimbuf utbuf; utbuf.actime = mtime.toTime_t(); utbuf.modtime = utbuf.actime; _wutime(reinterpret_cast(path.utf16()), &utbuf); #endif } static void createTestFile(const QString &path, bool plainText = false) { QDir().mkpath(QFileInfo(path).absolutePath()); QFile f(path); if (!f.open(QIODevice::WriteOnly)) { qFatal("Couldn't create %s", qPrintable(path)); } QByteArray data(plainText ? "Hello world" : "Hello\0world", 11); QCOMPARE(data.size(), 11); f.write(data); f.close(); setTimeStamp(path, s_referenceTimeStamp); } static void createTestSymlink(const QString &path, const QByteArray &target = "/IDontExist") { QFile::remove(path); bool ok = KIOPrivate::createSymlink(target, path); // broken symlink if (!ok) { qFatal("couldn't create symlink: %s", strerror(errno)); } QT_STATBUF buf; QVERIFY(QT_LSTAT(QFile::encodeName(path), &buf) == 0); QVERIFY((buf.st_mode & QT_STAT_MASK) == QT_STAT_LNK); //qDebug( "symlink %s created", qPrintable( path ) ); QVERIFY(QFileInfo(path).isSymLink()); } enum CreateTestDirectoryOptions { DefaultOptions = 0, NoSymlink = 1 }; static inline void createTestDirectory(const QString &path, CreateTestDirectoryOptions opt = DefaultOptions) { QDir dir; bool ok = dir.mkdir(path); if (!ok && !dir.exists()) { qFatal("Couldn't create %s", qPrintable(path)); } createTestFile(path + "/testfile"); if ((opt & NoSymlink) == 0) { #ifndef Q_OS_WIN createTestSymlink(path + "/testlink"); QVERIFY(QFileInfo(path + "/testlink").isSymLink()); #else // to not change the filecount everywhere in the tests createTestFile(path + "/testlink"); #endif } setTimeStamp(path, s_referenceTimeStamp); } #include class PredefinedAnswerJobUiDelegate : public KIO::JobUiDelegateExtension { public: PredefinedAnswerJobUiDelegate() : JobUiDelegateExtension(), m_askFileRenameCalled(0), m_askSkipCalled(0), m_askDeleteCalled(0), m_messageBoxCalled(0), m_renameResult(KIO::R_SKIP), m_skipResult(KIO::S_SKIP), m_deleteResult(false), m_messageBoxResult(0) { } KIO::RenameDialog_Result askFileRename(KJob *job, const QString &caption, const QUrl &src, const QUrl &dest, KIO::RenameDialog_Options options, QString &newDest, KIO::filesize_t = (KIO::filesize_t) - 1, KIO::filesize_t = (KIO::filesize_t) - 1, const QDateTime & = QDateTime(), const QDateTime & = QDateTime(), const QDateTime & = QDateTime(), - const QDateTime & = QDateTime()) Q_DECL_OVERRIDE { + const QDateTime & = QDateTime()) override { Q_UNUSED(job) Q_UNUSED(caption) Q_UNUSED(src) Q_UNUSED(dest) Q_UNUSED(options) Q_UNUSED(newDest) ++m_askFileRenameCalled; return m_renameResult; } KIO::SkipDialog_Result askSkip(KJob *job, KIO::SkipDialog_Options options, - const QString &error_text) Q_DECL_OVERRIDE { + const QString &error_text) override { Q_UNUSED(job) Q_UNUSED(options) Q_UNUSED(error_text) ++m_askSkipCalled; return m_skipResult; } bool askDeleteConfirmation(const QList &urls, DeletionType deletionType, - ConfirmationType confirmationType) Q_DECL_OVERRIDE { + ConfirmationType confirmationType) override { Q_UNUSED(urls); Q_UNUSED(deletionType); Q_UNUSED(confirmationType); ++m_askDeleteCalled; return m_deleteResult; } int requestMessageBox(MessageBoxType type, const QString &text, const QString &caption, const QString &buttonYes, const QString &buttonNo, const QString &iconYes = QString(), const QString &iconNo = QString(), const QString &dontAskAgainName = QString(), - const KIO::MetaData &sslMetaData = KIO::MetaData()) Q_DECL_OVERRIDE { + const KIO::MetaData &sslMetaData = KIO::MetaData()) override { Q_UNUSED(type); Q_UNUSED(text); Q_UNUSED(caption); Q_UNUSED(buttonYes); Q_UNUSED(buttonNo); Q_UNUSED(iconYes); Q_UNUSED(iconNo); Q_UNUSED(dontAskAgainName); Q_UNUSED(sslMetaData); ++m_messageBoxCalled; return m_messageBoxResult; } // yeah, public, for get and reset. int m_askFileRenameCalled; int m_askSkipCalled; int m_askDeleteCalled; int m_messageBoxCalled; KIO::RenameDialog_Result m_renameResult; KIO::SkipDialog_Result m_skipResult; bool m_deleteResult; int m_messageBoxResult; }; diff --git a/src/core/batchrenamejob.h b/src/core/batchrenamejob.h index 48bba112..9036237e 100644 --- a/src/core/batchrenamejob.h +++ b/src/core/batchrenamejob.h @@ -1,89 +1,89 @@ /* This file is part of the KDE libraries Copyright (C) 2017 by Chinmoy Ranjan Pradhan This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef BATCHRENAMEJOB_H #define BATCHRENAMEJOB_H #include "kiocore_export.h" #include "job_base.h" namespace KIO { class BatchRenameJobPrivate; /** * @class KIO::BatchRenameJob batchrenamejob.h * * A KIO job that renames multiple files in one go. * * @since 5.42 */ class KIOCORE_EXPORT BatchRenameJob : public Job { Q_OBJECT public: - ~BatchRenameJob() Q_DECL_OVERRIDE; + ~BatchRenameJob() override; Q_SIGNALS: /** * Signals that a file was renamed. */ void fileRenamed(const QUrl &oldUrl, const QUrl &newUrl); protected Q_SLOTS: - void slotResult(KJob *job) Q_DECL_OVERRIDE; + void slotResult(KJob *job) override; protected: /// @internal BatchRenameJob(BatchRenameJobPrivate &dd); private: Q_PRIVATE_SLOT(d_func(), void slotStart()) Q_DECLARE_PRIVATE(BatchRenameJob) }; /** * Renames multiple files at once. * * The new filename is obtained by replacing the characters represented by * @p placeHolder by the index @p index. * E.g. Calling batchRename({"file:///Test.jpg"}, "Test #" 12, '#') renames * the file to "Test 12.jpg". A connected sequence of placeholders results in * leading zeros. batchRename({"file:///Test.jpg"}, "Test ####" 12, '#') renames * the file to "Test 0012.jpg". And if no placeholder is there then @p index is * appended to @p newName. Calling batchRename({"file:///Test.jpg"}, "NewTest" 12, '#') * renames the file to "NewTest12.jpg". * * @param src The list of items to rename. * @param newName The base name to use in all new filenames. * @param index The integer(incremented after renaming a file) to add to the base name. * @param placeHolder The character(s) which @p index will replace. * * @return A pointer to the job handling the operation. * @since 5.42 */ KIOCORE_EXPORT BatchRenameJob *batchRename(const QList &src, const QString &newName, int index, QChar placeHolder, JobFlags flags = DefaultFlags); } #endif diff --git a/src/core/chmodjob.h b/src/core/chmodjob.h index a30203c3..dca32606 100644 --- a/src/core/chmodjob.h +++ b/src/core/chmodjob.h @@ -1,89 +1,89 @@ // -*- c++ -*- /* This file is part of the KDE libraries Copyright (C) 2000 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIO_CHMODJOB_H #define KIO_CHMODJOB_H #include "global.h" #include "job_base.h" #include "kiocore_export.h" #include namespace KIO { class ChmodJobPrivate; /** * @class KIO::ChmodJob chmodjob.h * * This job changes permissions on a list of files or directories, * optionally in a recursive manner. * @see KIO::chmod() */ class KIOCORE_EXPORT ChmodJob : public KIO::Job { Q_OBJECT public: virtual ~ChmodJob(); protected Q_SLOTS: - void slotResult(KJob *job) Q_DECL_OVERRIDE; + void slotResult(KJob *job) override; protected: ChmodJob(ChmodJobPrivate &dd); private: Q_PRIVATE_SLOT(d_func(), void _k_slotEntries(KIO::Job *, const KIO::UDSEntryList &)) Q_PRIVATE_SLOT(d_func(), void _k_processList()) Q_PRIVATE_SLOT(d_func(), void _k_chmodNextFile()) Q_DECLARE_PRIVATE(ChmodJob) }; /** * Creates a job that changes permissions/ownership on several files or directories, * optionally recursively. * This version of chmod uses a KFileItemList so that it directly knows * what to do with the items. TODO: a version that takes a QList, * and a general job that stats each url and returns a KFileItemList. * * Note that change of ownership is only supported for local files. * * Inside directories, the "x" bits will only be changed for files that had * at least one "x" bit before, and for directories. * This emulates the behavior of chmod +X. * * @param lstItems The file items representing several files or directories. * @param permissions the permissions we want to set * @param mask the bits we are allowed to change. * For instance, if mask is 0077, we don't change * the "user" bits, only "group" and "others". * @param newOwner If non-empty, the new owner for the files * @param newGroup If non-empty, the new group for the files * @param recursive whether to open directories recursively * @param flags We support HideProgressInfo here * @return The job handling the operation. */ KIOCORE_EXPORT ChmodJob *chmod(const KFileItemList &lstItems, int permissions, int mask, const QString &newOwner, const QString &newGroup, bool recursive, JobFlags flags = DefaultFlags); } #endif diff --git a/src/core/copyjob.h b/src/core/copyjob.h index fb4c0b26..68cd9fe9 100644 --- a/src/core/copyjob.h +++ b/src/core/copyjob.h @@ -1,436 +1,436 @@ // -*- c++ -*- /* This file is part of the KDE libraries Copyright 2000 Stephan Kulow Copyright 2000-2006 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIO_COPYJOB_H #define KIO_COPYJOB_H #include #include #include #include #include "kiocore_export.h" #include // filesize_t #include "job_base.h" class QTimer; namespace KIO { /// @internal /// KF6 TODO: move to .cpp and remove aboutToCreate signal struct CopyInfo { QUrl uSource; QUrl uDest; QString linkDest; // for symlinks only int permissions; QDateTime ctime; QDateTime mtime; KIO::filesize_t size; // 0 for dirs }; class CopyJobPrivate; /** * @class KIO::CopyJob copyjob.h * * CopyJob is used to move, copy or symlink files and directories. * Don't create the job directly, but use KIO::copy(), * KIO::move(), KIO::link() and friends. * * @see KIO::copy() * @see KIO::copyAs() * @see KIO::move() * @see KIO::moveAs() * @see KIO::link() * @see KIO::linkAs() */ class KIOCORE_EXPORT CopyJob : public Job { Q_OBJECT public: /** * Defines the mode of the operation */ enum CopyMode { Copy, Move, Link }; - ~CopyJob() Q_DECL_OVERRIDE; + ~CopyJob() override; /** * Returns the mode of the operation (copy, move, or link), * depending on whether KIO::copy(), KIO::move() or KIO::link() was called. */ CopyMode operationMode() const; /** * Returns the list of source URLs. * @return the list of source URLs. */ QList srcUrls() const; /** * Returns the destination URL. * @return the destination URL */ QUrl destUrl() const; /** * By default the permissions of the copied files will be those of the source files. * * But when copying "template" files to "new" files, people prefer the umask * to apply, rather than the template's permissions. * For that case, call setDefaultPermissions(true) */ void setDefaultPermissions(bool b); /** * Skip copying or moving any file when the destination already exists, * instead of the default behavior (interactive mode: showing a dialog to the user, * non-interactive mode: aborting with an error). * Initially added for a unit test. * \since 4.2 */ void setAutoSkip(bool autoSkip); /** * Rename files automatically when the destination already exists, * instead of the default behavior (interactive mode: showing a dialog to the user, * non-interactive mode: aborting with an error). * Initially added for a unit test. * \since 4.7 */ void setAutoRename(bool autoRename); /** * Reuse any directory that already exists, instead of the default behavior * (interactive mode: showing a dialog to the user, * non-interactive mode: aborting with an error). * \since 4.2 */ void setWriteIntoExistingDirectories(bool overwriteAllDirs); /** * Reimplemented for internal reasons */ - bool doSuspend() Q_DECL_OVERRIDE; + bool doSuspend() override; /** * Reimplemented for internal reasons */ - bool doResume() Q_DECL_OVERRIDE; + bool doResume() override; Q_SIGNALS: /** * Emitted when the total number of files is known. * @param job the job that emitted this signal * @param files the total number of files */ void totalFiles(KJob *job, unsigned long files); /** * Emitted when the toal number of direcotries is known. * @param job the job that emitted this signal * @param dirs the total number of directories */ void totalDirs(KJob *job, unsigned long dirs); /** * Emitted when it is known which files / directories are going * to be created. Note that this may still change e.g. when * existing files with the same name are discovered. * @param job the job that emitted this signal * @param files a list of items that are about to be created. * @deprecated since 5.2 -- this signal is unused since kde 3... */ QT_MOC_COMPAT void aboutToCreate(KIO::Job *job, const QList &files); /** * Sends the number of processed files. * @param job the job that emitted this signal * @param files the number of processed files */ void processedFiles(KIO::Job *job, unsigned long files); /** * Sends the number of processed directories. * @param job the job that emitted this signal * @param dirs the number of processed dirs */ void processedDirs(KIO::Job *job, unsigned long dirs); /** * The job is copying a file or directory. * * Note: This signal is used for progress dialogs, it's not emitted for * every file or directory (this would be too slow), but every 200ms. * * @param job the job that emitted this signal * @param src the URL of the file or directory that is currently * being copied * @param dest the destination of the current operation */ void copying(KIO::Job *job, const QUrl &src, const QUrl &dest); /** * The job is creating a symbolic link. * * Note: This signal is used for progress dialogs, it's not emitted for * every file or directory (this would be too slow), but every 200ms. * * @param job the job that emitted this signal * @param target the URL of the file or directory that is currently * being linked * @param to the destination of the current operation */ void linking(KIO::Job *job, const QString &target, const QUrl &to); /** * The job is moving a file or directory. * * Note: This signal is used for progress dialogs, it's not emitted for * every file or directory (this would be too slow), but every 200ms. * * @param job the job that emitted this signal * @param from the URL of the file or directory that is currently * being moved * @param to the destination of the current operation */ void moving(KIO::Job *job, const QUrl &from, const QUrl &to); /** * The job is creating the directory @p dir. * * This signal is emitted for every directory being created. * * @param job the job that emitted this signal * @param dir the directory that is currently being created */ void creatingDir(KIO::Job *job, const QUrl &dir); /** * The user chose to rename @p from to @p to. * * @param job the job that emitted this signal * @param from the original name * @param to the new name */ void renamed(KIO::Job *job, const QUrl &from, const QUrl &to); /** * The job emits this signal when copying or moving a file or directory successfully finished. * This signal is mainly for the Undo feature. * If you simply want to know when a copy job is done, use result(). * * @param job the job that emitted this signal * @param from the source URL * @param to the destination URL * @param mtime the modification time of the source file, hopefully set on the destination file * too (when the kioslave supports it). * @param directory indicates whether a file or directory was successfully copied/moved. * true for a directory, false for file * @param renamed indicates that the destination URL was created using a * rename operation (i.e. fast directory moving). true if is has been renamed */ void copyingDone(KIO::Job *job, const QUrl &from, const QUrl &to, const QDateTime &mtime, bool directory, bool renamed); /** * The job is copying or moving a symbolic link, that points to target. * The new link is created in @p to. The existing one is/was in @p from. * This signal is mainly for the Undo feature. * @param job the job that emitted this signal * @param from the source URL * @param target the target * @param to the destination URL */ void copyingLinkDone(KIO::Job *job, const QUrl &from, const QString &target, const QUrl &to); protected Q_SLOTS: - void slotResult(KJob *job) Q_DECL_OVERRIDE; + void slotResult(KJob *job) override; protected: CopyJob(CopyJobPrivate &dd); void emitResult(); private: Q_PRIVATE_SLOT(d_func(), void slotStart()) Q_PRIVATE_SLOT(d_func(), void slotEntries(KIO::Job *, const KIO::UDSEntryList &list)) Q_PRIVATE_SLOT(d_func(), void slotSubError(KIO::ListJob *, KIO::ListJob *)) Q_PRIVATE_SLOT(d_func(), void slotProcessedSize(KJob *, qulonglong data_size)) Q_PRIVATE_SLOT(d_func(), void slotTotalSize(KJob *, qulonglong size)) Q_PRIVATE_SLOT(d_func(), void slotReport()) Q_PRIVATE_SLOT(d_func(), void sourceStated(const KIO::UDSEntry &entry, const QUrl &sourceUrl)) Q_DECLARE_PRIVATE(CopyJob) }; /** * Copy a file or directory @p src into the destination @p dest, * which can be a file (including the final filename) or a directory * (into which @p src will be copied). * * This emulates the cp command completely. * * @param src the file or directory to copy * @param dest the destination * @param flags copy() supports HideProgressInfo and Overwrite. * Note: Overwrite has the meaning of both "write into existing directories" and * "overwrite existing files". However if "dest" exists, then src is copied * into a subdir of dest, just like "cp" does. Use copyAs if you don't want that. * * @return the job handling the operation * @see copyAs() */ KIOCORE_EXPORT CopyJob *copy(const QUrl &src, const QUrl &dest, JobFlags flags = DefaultFlags); /** * Copy a file or directory @p src into the destination @p dest, * which is the destination name in any case, even for a directory. * * As opposed to copy(), this doesn't emulate cp, but is the only * way to copy a directory, giving it a new name and getting an error * box if a directory already exists with the same name (or writing the * contents of @p src into @p dest, when using Overwrite). * * @param src the file or directory to copy * @param dest the destination * @param flags copyAs() supports HideProgressInfo and Overwrite. * Note: Overwrite has the meaning of both "write into existing directories" and * "overwrite existing files". * * * @return the job handling the operation */ KIOCORE_EXPORT CopyJob *copyAs(const QUrl &src, const QUrl &dest, JobFlags flags = DefaultFlags); /** * Copy a list of file/dirs @p src into a destination directory @p dest. * * @param src the list of files and/or directories * @param dest the destination * @param flags copy() supports HideProgressInfo and Overwrite. * Note: Overwrite has the meaning of both "write into existing directories" and * "overwrite existing files". However if "dest" exists, then src is copied * into a subdir of dest, just like "cp" does. * @return the job handling the operation */ KIOCORE_EXPORT CopyJob *copy(const QList &src, const QUrl &dest, JobFlags flags = DefaultFlags); /** * Moves a file or directory @p src to the given destination @p dest. * * @param src the file or directory to copy * @param dest the destination * @param flags move() supports HideProgressInfo and Overwrite. * Note: Overwrite has the meaning of both "write into existing directories" and * "overwrite existing files". However if "dest" exists, then src is copied * into a subdir of dest, just like "cp" does. * @return the job handling the operation * @see copy() * @see moveAs() */ KIOCORE_EXPORT CopyJob *move(const QUrl &src, const QUrl &dest, JobFlags flags = DefaultFlags); /** * Moves a file or directory @p src to the given destination @p dest. Unlike move() * this operation will not move @p src into @p dest when @p dest exists: it will * either fail, or move the contents of @p src into it if Overwrite is set. * * @param src the file or directory to copy * @param dest the destination * @param flags moveAs() supports HideProgressInfo and Overwrite. * Note: Overwrite has the meaning of both "write into existing directories" and * "overwrite existing files". * @return the job handling the operation * @see copyAs() */ KIOCORE_EXPORT CopyJob *moveAs(const QUrl &src, const QUrl &dest, JobFlags flags = DefaultFlags); /** * Moves a list of files or directories @p src to the given destination @p dest. * * @param src the list of files or directories to copy * @param dest the destination * @param flags move() supports HideProgressInfo and Overwrite. * Note: Overwrite has the meaning of both "write into existing directories" and * "overwrite existing files". However if "dest" exists, then src is copied * into a subdir of dest, just like "cp" does. * @return the job handling the operation * @see copy() */ KIOCORE_EXPORT CopyJob *move(const QList &src, const QUrl &dest, JobFlags flags = DefaultFlags); /** * Create a link. * If the protocols and hosts are the same, a Unix symlink will be created. * Otherwise, a .desktop file of Type Link and pointing to the src URL will be created. * * @param src The existing file or directory, 'target' of the link. * @param destDir Destination directory where the link will be created. * @param flags link() supports HideProgressInfo only * @return the job handling the operation */ KIOCORE_EXPORT CopyJob *link(const QUrl &src, const QUrl &destDir, JobFlags flags = DefaultFlags); /** * Create several links * If the protocols and hosts are the same, a Unix symlink will be created. * Otherwise, a .desktop file of Type Link and pointing to the src URL will be created. * * @param src The existing files or directories, 'targets' of the link. * @param destDir Destination directory where the links will be created. * @param flags link() supports HideProgressInfo only * @return the job handling the operation * @see link() */ KIOCORE_EXPORT CopyJob *link(const QList &src, const QUrl &destDir, JobFlags flags = DefaultFlags); /** * Create a link. Unlike link() this operation will fail when @p dest is an existing * directory rather than the final name for the link. * If the protocols and hosts are the same, a Unix symlink will be created. * Otherwise, a .desktop file of Type Link and pointing to the src URL will be created. * * @param src The existing file or directory, 'target' of the link. * @param dest Destination (i.e. the final symlink) * @param flags linkAs() supports HideProgressInfo only * @return the job handling the operation * @see link () * @see copyAs() */ KIOCORE_EXPORT CopyJob *linkAs(const QUrl &src, const QUrl &dest, JobFlags flags = DefaultFlags); /** * Trash a file or directory. * This is currently only supported for local files and directories. * Use QUrl::fromLocalFile to create a URL from a local file path. * * @param src file to delete * @param flags trash() supports HideProgressInfo only * @return the job handling the operation */ KIOCORE_EXPORT CopyJob *trash(const QUrl &src, JobFlags flags = DefaultFlags); /** * Trash a list of files or directories. * This is currently only supported for local files and directories. * * @param src the files to delete * @param flags trash() supports HideProgressInfo only * @return the job handling the operation */ KIOCORE_EXPORT CopyJob *trash(const QList &src, JobFlags flags = DefaultFlags); } #endif diff --git a/src/core/dataslave_p.h b/src/core/dataslave_p.h index d5c5e439..14629e51 100644 --- a/src/core/dataslave_p.h +++ b/src/core/dataslave_p.h @@ -1,127 +1,127 @@ // -*- c++ -*- /* * This file is part of the KDE libraries * Copyright (c) 2003 Leo Savernik * Derived from slave.h * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License version 2 as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. **/ #ifndef KIO_DATASLAVE_H #define KIO_DATASLAVE_H #include "global.h" #include "slave.h" class QTimer; // don't forget to sync DISPATCH_IMPL in dataslave_p.h #define DISPATCH_DECL(type) \ void dispatch_##type(); // don't forget to sync DISPATCH_IMPL1 in dataslave_p.h #define DISPATCH_DECL1(type, paramtype, param) \ void dispatch_##type(paramtype param); namespace KIO { /** * This class provides a high performance implementation for the data * url scheme (rfc2397). * * @internal * Do not use this class in external applications. It is an implementation * detail of KIO and subject to change without notice. * @author Leo Savernik */ class DataSlave : public KIO::Slave { Q_OBJECT public: DataSlave(); - ~DataSlave() Q_DECL_OVERRIDE; + ~DataSlave() override; virtual void setHost(const QString &host, quint16 port, - const QString &user, const QString &passwd) Q_DECL_OVERRIDE; - void setConfig(const MetaData &config) Q_DECL_OVERRIDE; + const QString &user, const QString &passwd) override; + void setConfig(const MetaData &config) override; - void suspend() Q_DECL_OVERRIDE; - void resume() Q_DECL_OVERRIDE; - bool suspended() Q_DECL_OVERRIDE; - void send(int cmd, const QByteArray &arr = QByteArray()) Q_DECL_OVERRIDE; + void suspend() override; + void resume() override; + bool suspended() override; + void send(int cmd, const QByteArray &arr = QByteArray()) override; - void hold(const QUrl &url) Q_DECL_OVERRIDE; + void hold(const QUrl &url) override; // pure virtual methods that are defined by the actual protocol virtual void get(const QUrl &url) = 0; virtual void mimetype(const QUrl &url) = 0; protected: /** * Sets metadata * @internal */ void setAllMetaData(const MetaData &); /** * Sends metadata set with setAllMetaData * @internal */ void sendMetaData(); // queuing methods /** identifiers of functions to be queued */ enum QueueType { Queue_mimeType = 1, Queue_totalSize, Queue_sendMetaData, Queue_data, Queue_finished }; /** structure for queuing. It is very primitive, it doesn't * even try to conserve memory. */ struct QueueStruct { QueueType type; QString s; KIO::filesize_t size; QByteArray ba; QueueStruct() {} QueueStruct(QueueType type) : type(type) {} }; typedef QList DispatchQueue; DispatchQueue dispatchQueue; DISPATCH_DECL1(mimeType, const QString &, s) DISPATCH_DECL1(totalSize, KIO::filesize_t, size) DISPATCH_DECL(sendMetaData) DISPATCH_DECL1(data, const QByteArray &, ba) DISPATCH_DECL(finished) protected Q_SLOTS: /** dispatches next queued method. Does nothing if there are no * queued methods. */ void dispatchNext(); private: MetaData meta_data; bool _suspended; QTimer *timer; }; } #undef DISPATCH_DECL #undef DISPATCH_DECL1 #endif diff --git a/src/core/davjob.h b/src/core/davjob.h index 1b595b92..f9190cc3 100644 --- a/src/core/davjob.h +++ b/src/core/davjob.h @@ -1,126 +1,126 @@ // -*- c++ -*- /* This file is part of the KDE libraries Copyright (C) 2002 Jan-Pascal van Best This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIO_DAVJOB_H #define KIO_DAVJOB_H #include #include #include #include #include #include #include #include "kiocore_export.h" #include "transferjob.h" #include "global.h" namespace KIO { class Slave; class DavJobPrivate; /** * @class KIO::DavJob davjob.h * * The transfer job pumps data into and/or out of a Slave. * Data is sent to the slave on request of the slave ( dataReq). * If data coming from the slave can not be handled, the * reading of data from the slave should be suspended. * @see KIO::davPropFind() * @see KIO::davPropPatch() * @see KIO::davSearch() */ class KIOCORE_EXPORT DavJob : public TransferJob { Q_OBJECT public: /** * Returns the response as a QDomDocument. * @return the response document */ QDomDocument &response(); protected Q_SLOTS: - void slotFinished() Q_DECL_OVERRIDE; - void slotData(const QByteArray &data) Q_DECL_OVERRIDE; + void slotFinished() override; + void slotData(const QByteArray &data) override; protected: DavJob(DavJobPrivate &dd, int, const QString &); private: Q_DECLARE_PRIVATE(DavJob) }; /** * Creates a new DavJob that issues a PROPFIND command. PROPFIND retrieves * the properties of the resource identified by the given @p url. * * @param url the URL of the resource * @param properties a propfind document that describes the properties that * should be retrieved * @param depth the depth of the request. Can be "0", "1" or "infinity" * @param flags We support HideProgressInfo here * @return the new DavJob */ KIOCORE_EXPORT DavJob *davPropFind(const QUrl &url, const QDomDocument &properties, const QString &depth, JobFlags flags = DefaultFlags); /** * Creates a new DavJob that issues a PROPPATCH command. PROPPATCH sets * the properties of the resource identified by the given @p url. * * @param url the URL of the resource * @param properties a PROPPACTCH document that describes the properties that * should be modified and its new values * @param flags We support HideProgressInfo here * @return the new DavJob */ KIOCORE_EXPORT DavJob *davPropPatch(const QUrl &url, const QDomDocument &properties, JobFlags flags = DefaultFlags); /** * Creates a new DavJob that issues a SEARCH command. * * @param url the URL of the resource * @param nsURI the URI of the search method's qualified name * @param qName the local part of the search method's qualified name * @param query the search string * @param flags We support HideProgressInfo here * @return the new DavJob */ KIOCORE_EXPORT DavJob *davSearch(const QUrl &url, const QString &nsURI, const QString &qName, const QString &query, JobFlags flags = DefaultFlags); /** * Creates a new DavJob that issues a REPORT command. * * @param url the URL of the resource * @param report a REPORT document that describes the request to make * @param depth the depth of the request. Can be "0", "1" or "infinity" * @param flags We support HideProgressInfo here * @return the new DavJob * @since 4.4 */ KIOCORE_EXPORT DavJob *davReport(const QUrl &url, const QString &report, const QString &depth, JobFlags flags = DefaultFlags); } #endif diff --git a/src/core/deletejob.h b/src/core/deletejob.h index a1b46633..68c5b4da 100644 --- a/src/core/deletejob.h +++ b/src/core/deletejob.h @@ -1,127 +1,127 @@ // -*- c++ -*- /* This file is part of the KDE libraries Copyright 2000 Stephan Kulow Copyright 2000-2006 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIO_DELETEJOB_H #define KIO_DELETEJOB_H #include #include "kiocore_export.h" #include "global.h" #include "job_base.h" class QTimer; namespace KIO { class DeleteJobPrivate; /** * @class KIO::DeleteJob deletejob.h * * A more complex Job to delete files and directories. * Don't create the job directly, but use KIO::del() instead. * * @see KIO::del() */ class KIOCORE_EXPORT DeleteJob : public Job { Q_OBJECT public: - ~DeleteJob() Q_DECL_OVERRIDE; + ~DeleteJob() override; /** * Returns the list of URLs. * @return the list of URLs. */ QList urls() const; Q_SIGNALS: /** * Emitted when the total number of files is known. * @param job the job that emitted this signal * @param files the total number of files */ void totalFiles(KJob *job, unsigned long files); /** * Emitted when the toal number of direcotries is known. * @param job the job that emitted this signal * @param dirs the total number of directories */ void totalDirs(KJob *job, unsigned long dirs); /** * Sends the number of processed files. * @param job the job that emitted this signal * @param files the number of processed files */ void processedFiles(KIO::Job *job, unsigned long files); /** * Sends the number of processed directories. * @param job the job that emitted this signal * @param dirs the number of processed dirs */ void processedDirs(KIO::Job *job, unsigned long dirs); /** * Sends the URL of the file that is currently being deleted. * @param job the job that emitted this signal * @param file the URL of the file or directory that is being * deleted */ void deleting(KIO::Job *job, const QUrl &file); protected Q_SLOTS: - void slotResult(KJob *job) Q_DECL_OVERRIDE; + void slotResult(KJob *job) override; protected: DeleteJob(DeleteJobPrivate &dd); private: Q_PRIVATE_SLOT(d_func(), void slotStart()) Q_PRIVATE_SLOT(d_func(), void slotEntries(KIO::Job *, const KIO::UDSEntryList &list)) Q_PRIVATE_SLOT(d_func(), void slotReport()) Q_DECLARE_PRIVATE(DeleteJob) }; /** * Delete a file or directory. * * @param src file to delete * @param flags We support HideProgressInfo here * @return the job handling the operation */ KIOCORE_EXPORT DeleteJob *del(const QUrl &src, JobFlags flags = DefaultFlags); /** * Deletes a list of files or directories. * * @param src the files to delete * @param flags We support HideProgressInfo here * @return the job handling the operation */ KIOCORE_EXPORT DeleteJob *del(const QList &src, JobFlags flags = DefaultFlags); } #endif diff --git a/src/core/directorysizejob.h b/src/core/directorysizejob.h index 51915701..833fbe74 100644 --- a/src/core/directorysizejob.h +++ b/src/core/directorysizejob.h @@ -1,100 +1,100 @@ /* This file is part of the KDE libraries Copyright (C) 2000, 2006 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DIRECTORYSIZEJOB_H #define DIRECTORYSIZEJOB_H #include "kiocore_export.h" #include "job_base.h" #include namespace KIO { class DirectorySizeJobPrivate; /** * @class KIO::DirectorySizeJob directorysizejob.h * * Computes a directory size (similar to "du", but doesn't give the same results * since we simply sum up the dir and file sizes, whereas du speaks disk blocks) * * Usage: see KIO::directorySize. */ class KIOCORE_EXPORT DirectorySizeJob : public KIO::Job { Q_OBJECT public: - ~DirectorySizeJob() Q_DECL_OVERRIDE; + ~DirectorySizeJob() override; public: /** * @return the size we found */ KIO::filesize_t totalSize() const; /** * @return the total number of files (counting symlinks to files, sockets * and character devices as files) in this directory and all sub-directories */ KIO::filesize_t totalFiles() const; /** * @return the total number of sub-directories found (not including the * directory the search started from and treating symlinks to directories * as directories) */ KIO::filesize_t totalSubdirs() const; protected Q_SLOTS: - void slotResult(KJob *job) Q_DECL_OVERRIDE; + void slotResult(KJob *job) override; protected: DirectorySizeJob(DirectorySizeJobPrivate &dd); private: Q_PRIVATE_SLOT(d_func(), void slotEntries(KIO::Job *, const KIO::UDSEntryList &)) Q_PRIVATE_SLOT(d_func(), void processNextItem()) Q_DECLARE_PRIVATE(DirectorySizeJob) }; /** * Computes a directory size (by doing a recursive listing). * Connect to the result signal (this is the preferred solution to avoid blocking the GUI), * or use exec() for a synchronous (blocking) calculation. * * This one lists a single directory. */ KIOCORE_EXPORT DirectorySizeJob *directorySize(const QUrl &directory); /** * Computes a directory size (by doing a recursive listing). * Connect to the result signal (this is the preferred solution to avoid blocking the GUI), * or use exec() for a synchronous (blocking) calculation. * * This one lists the items from @p lstItems. * The reason we asks for items instead of just urls, is so that * we directly know if the item is a file or a directory, * and in case of a file, we already have its size. */ KIOCORE_EXPORT DirectorySizeJob *directorySize(const KFileItemList &lstItems); } #endif diff --git a/src/core/emptytrashjob.h b/src/core/emptytrashjob.h index 7105b2d8..b5af385c 100644 --- a/src/core/emptytrashjob.h +++ b/src/core/emptytrashjob.h @@ -1,66 +1,66 @@ /* This file is part of the KDE libraries Copyright (C) 2014 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef EMPTYTRASHJOB_H #define EMPTYTRASHJOB_H #include "kiocore_export.h" #include "simplejob.h" namespace KIO { class EmptyTrashJobPrivate; /** * @class KIO::EmptyTrashJob emptytrashjob.h * * A KIO job for emptying the trash * @see KIO::trash() * @see KIO::restoreFromTrash() * @since 5.2 */ class KIOCORE_EXPORT EmptyTrashJob : public SimpleJob { Q_OBJECT public: - ~EmptyTrashJob() Q_DECL_OVERRIDE; + ~EmptyTrashJob() override; protected: - void slotFinished() Q_DECL_OVERRIDE; + void slotFinished() override; private: EmptyTrashJob(EmptyTrashJobPrivate &dd); private: Q_DECLARE_PRIVATE(EmptyTrashJob) }; /** * Empties the trash. * * @return A pointer to the job handling the operation. * @since 5.2 */ KIOCORE_EXPORT EmptyTrashJob *emptyTrash(); } #endif diff --git a/src/core/filecopyjob.h b/src/core/filecopyjob.h index 00b415c6..e5ccd8f4 100644 --- a/src/core/filecopyjob.h +++ b/src/core/filecopyjob.h @@ -1,157 +1,157 @@ /* This file is part of the KDE libraries Copyright (C) 2000 Stephan Kulow 2000-2009 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIO_FILECOPYJOB_H #define KIO_FILECOPYJOB_H #include "job_base.h" #include // filesize_t namespace KIO { class FileCopyJobPrivate; /** * @class KIO::FileCopyJob filecopyjob.h * * The FileCopyJob copies data from one place to another. * @see KIO::file_copy() * @see KIO::file_move() */ class KIOCORE_EXPORT FileCopyJob : public Job { Q_OBJECT public: - ~FileCopyJob() Q_DECL_OVERRIDE; + ~FileCopyJob() override; /** * If you know the size of the source file, call this method * to inform this job. It will be displayed in the "resume" dialog. * @param size the size of the source file */ void setSourceSize(KIO::filesize_t size); /** * Sets the modification time of the file * * Note that this is ignored if a direct copy (SlaveBase::copy) can be done, * in which case the mtime of the source is applied to the destination (if the protocol * supports the concept). */ void setModificationTime(const QDateTime &mtime); /** * Returns the source URL. * @return the source URL */ QUrl srcUrl() const; /** * Returns the destination URL. * @return the destination URL */ QUrl destUrl() const; - bool doSuspend() Q_DECL_OVERRIDE; - bool doResume() Q_DECL_OVERRIDE; + bool doSuspend() override; + bool doResume() override; Q_SIGNALS: /** * Mimetype determined during a file copy. * This is never emitted during a move, and might not be emitted during * a file copy, depending on the slave. But when a get and a put are * being used (which is the common case), this signal forwards the * mimetype information from the get job. * * @param job the job that emitted this signal * @param type the mime type */ void mimetype(KIO::Job *job, const QString &type); protected Q_SLOTS: /** * Called whenever a subjob finishes. * @param job the job that emitted this signal */ - void slotResult(KJob *job) Q_DECL_OVERRIDE; + void slotResult(KJob *job) override; protected: FileCopyJob(FileCopyJobPrivate &dd); private: Q_PRIVATE_SLOT(d_func(), void slotStart()) Q_PRIVATE_SLOT(d_func(), void slotData(KIO::Job *, const QByteArray &data)) Q_PRIVATE_SLOT(d_func(), void slotDataReq(KIO::Job *, QByteArray &data)) Q_PRIVATE_SLOT(d_func(), void slotMimetype(KIO::Job *, const QString &type)) Q_PRIVATE_SLOT(d_func(), void slotProcessedSize(KJob *job, qulonglong size)) Q_PRIVATE_SLOT(d_func(), void slotTotalSize(KJob *job, qulonglong size)) Q_PRIVATE_SLOT(d_func(), void slotPercent(KJob *job, unsigned long pct)) Q_PRIVATE_SLOT(d_func(), void slotCanResume(KIO::Job *job, KIO::filesize_t offset)) Q_DECLARE_PRIVATE(FileCopyJob) }; /** * Copy a single file. * * Uses either SlaveBase::copy() if the slave supports that * or get() and put() otherwise. * @param src Where to get the file. * @param dest Where to put the file. * @param permissions May be -1. In this case no special permission mode is set. * @param flags Can be HideProgressInfo, Overwrite and Resume here. WARNING: * Setting Resume means that the data will be appended to @p dest if @p dest exists. * @return the job handling the operation. */ KIOCORE_EXPORT FileCopyJob *file_copy(const QUrl &src, const QUrl &dest, int permissions = -1, JobFlags flags = DefaultFlags); /** * Overload for catching code mistakes. Do NOT call this method (it is not implemented), * insert a value for permissions (-1 by default) before the JobFlags. * @since 4.5 */ FileCopyJob *file_copy(const QUrl &src, const QUrl &dest, JobFlags flags) Q_DECL_EQ_DELETE; // not implemented - on purpose. /** * Move a single file. * * Use either SlaveBase::rename() if the slave supports that, * or copy() and del() otherwise, or eventually get() & put() & del() * @param src Where to get the file. * @param dest Where to put the file. * @param permissions May be -1. In this case no special permission mode is set. * @param flags Can be HideProgressInfo, Overwrite and Resume here. WARNING: * Setting Resume means that the data will be appended to @p dest if @p dest exists. * @return the job handling the operation. */ KIOCORE_EXPORT FileCopyJob *file_move(const QUrl &src, const QUrl &dest, int permissions = -1, JobFlags flags = DefaultFlags); /** * Overload for catching code mistakes. Do NOT call this method (it is not implemented), * insert a value for permissions (-1 by default) before the JobFlags. * @since 4.3 */ FileCopyJob *file_move(const QUrl &src, const QUrl &dest, JobFlags flags) Q_DECL_EQ_DELETE; // not implemented - on purpose. } #endif diff --git a/src/core/filesystemfreespacejob.h b/src/core/filesystemfreespacejob.h index 573aafcc..656558a7 100644 --- a/src/core/filesystemfreespacejob.h +++ b/src/core/filesystemfreespacejob.h @@ -1,75 +1,75 @@ /* This file is part of the KDE libraries Copyright (C) 2000 Stephan Kulow 2000-2009 David Faure 2014 Mathias Tillman This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef FILESYSTEMFREESPACEJOB_H #define FILESYSTEMFREESPACEJOB_H #include "kiocore_export.h" #include "simplejob.h" namespace KIO { class FileSystemFreeSpaceJobPrivate; /** * @class KIO::FileSystemFreeSpaceJob filesystemfreespacejob.h * * A KIO job that retrieves the total and available size of a filesystem. * @since 5.3 */ class KIOCORE_EXPORT FileSystemFreeSpaceJob : public SimpleJob { Q_OBJECT public: - ~FileSystemFreeSpaceJob() Q_DECL_OVERRIDE; + ~FileSystemFreeSpaceJob() override; Q_SIGNALS: /** * Signals the result * @param job the job that is redirected * @param size total amount of space * @param available amount of free space */ void result(KIO::Job *job, KIO::filesize_t size, KIO::filesize_t available); protected Q_SLOTS: - void slotFinished() Q_DECL_OVERRIDE; + void slotFinished() override; public: FileSystemFreeSpaceJob(FileSystemFreeSpaceJobPrivate &dd); private: Q_DECLARE_PRIVATE(FileSystemFreeSpaceJob) }; /** * Get a filesystem's total and available space. * * @param url Url to the filesystem. * @return the job handling the operation. */ KIOCORE_EXPORT FileSystemFreeSpaceJob *fileSystemFreeSpace(const QUrl &url); } #endif /* FILESYSTEMFREESPACEJOB_H */ diff --git a/src/core/forwardingslavebase.h b/src/core/forwardingslavebase.h index 51513583..75c23893 100644 --- a/src/core/forwardingslavebase.h +++ b/src/core/forwardingslavebase.h @@ -1,194 +1,194 @@ /* This file is part of the KDE project Copyright (c) 2004 Kevin Ottens This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _FORWARDING_SLAVE_BASE_H_ #define _FORWARDING_SLAVE_BASE_H_ #include "kiocore_export.h" #include #include "job_base.h" // JobFlags #include #include namespace KIO { class ForwardingSlaveBasePrivate; /** * @class KIO::ForwardingSlaveBase forwardingslavebase.h * * This class should be used as a base for ioslaves acting as a * forwarder to other ioslaves. It has been designed to support only * local filesystem like ioslaves. * * If the resulting ioslave should be a simple proxy, you only need * to implement the ForwardingSlaveBase::rewriteUrl() method. * * For more advanced behavior, the classic ioslave methods should * be reimplemented, because their default behavior in this class * is to forward using the ForwardingSlaveBase::rewriteUrl() method. * * A possible code snippet for an advanced stat() behavior would look * like this in the child class: * * \code * void ChildProtocol::stat(const QUrl &url) * { * bool is_special = false; * * // Process the URL to see if it should have * // a special treatment * * if ( is_special ) * { * // Handle the URL ourselves * KIO::UDSEntry entry; * // Fill entry with UDSAtom instances * statEntry(entry); * finished(); * } * else * { * // Setup the ioslave internal state if * // required by ChildProtocol::rewriteUrl() * ForwardingSlaveBase::stat(url); * } * } * \endcode * * Of course in this case, you surely need to reimplement listDir() * and get() accordingly. * * If you want view on directories to be correctly refreshed when * something changes on a forwarded URL, you'll need a companion kded * module to emit the KDirNotify Files*() D-Bus signals. * * This class was initially used for media:/ ioslave. This ioslave code * and the MediaDirNotify class of its companion kded module can be a * good source of inspiration. * * @see ForwardingSlaveBase::rewriteUrl() * @author Kevin Ottens */ class KIOCORE_EXPORT ForwardingSlaveBase : public QObject, public SlaveBase { Q_OBJECT public: ForwardingSlaveBase(const QByteArray &protocol, const QByteArray &poolSocket, const QByteArray &appSocket); - ~ForwardingSlaveBase() Q_DECL_OVERRIDE; + ~ForwardingSlaveBase() override; - void get(const QUrl &url) Q_DECL_OVERRIDE; + void get(const QUrl &url) override; void put(const QUrl &url, int permissions, - JobFlags flags) Q_DECL_OVERRIDE; + JobFlags flags) override; - void stat(const QUrl &url) Q_DECL_OVERRIDE; + void stat(const QUrl &url) override; - void mimetype(const QUrl &url) Q_DECL_OVERRIDE; + void mimetype(const QUrl &url) override; - void listDir(const QUrl &url) Q_DECL_OVERRIDE; + void listDir(const QUrl &url) override; - void mkdir(const QUrl &url, int permissions) Q_DECL_OVERRIDE; + void mkdir(const QUrl &url, int permissions) override; - void rename(const QUrl &src, const QUrl &dest, JobFlags flags) Q_DECL_OVERRIDE; + void rename(const QUrl &src, const QUrl &dest, JobFlags flags) override; void symlink(const QString &target, const QUrl &dest, - JobFlags flags) Q_DECL_OVERRIDE; + JobFlags flags) override; - void chmod(const QUrl &url, int permissions) Q_DECL_OVERRIDE; + void chmod(const QUrl &url, int permissions) override; - void setModificationTime(const QUrl &url, const QDateTime &mtime) Q_DECL_OVERRIDE; + void setModificationTime(const QUrl &url, const QDateTime &mtime) override; void copy(const QUrl &src, const QUrl &dest, - int permissions, JobFlags flags) Q_DECL_OVERRIDE; + int permissions, JobFlags flags) override; - void del(const QUrl &url, bool isfile) Q_DECL_OVERRIDE; + void del(const QUrl &url, bool isfile) override; protected: /** * Rewrite an url to its forwarded counterpart. It should return * true if everything was ok, and false otherwise. * * If a problem is detected it's up to this method to trigger error() * before returning. Returning false silently cancels the current * slave operation. * * @param url The URL as given during the slave call * @param newURL The new URL to forward the slave call to * @return true if the given url could be correctly rewritten */ virtual bool rewriteUrl(const QUrl &url, QUrl &newURL) = 0; /** * Allow to modify a UDSEntry before it's sent to the ioslave endpoint. * This is the default implementation working in most cases, but sometimes * you could make use of more forwarding black magic (for example * dynamically transform any desktop file into a fake directory...) * * @param entry the UDSEntry to post-process * @param listing indicate if this entry it created during a listDir * operation */ virtual void prepareUDSEntry(KIO::UDSEntry &entry, bool listing = false) const; /** * Return the URL being processed by the ioslave * Only access it inside prepareUDSEntry() */ QUrl processedUrl() const; /** * Return the URL asked to the ioslave * Only access it inside prepareUDSEntry() */ QUrl requestedUrl() const; private: // KIO::Job Q_PRIVATE_SLOT(d, void _k_slotResult(KJob *job)) Q_PRIVATE_SLOT(d, void _k_slotWarning(KJob *job, const QString &msg)) Q_PRIVATE_SLOT(d, void _k_slotInfoMessage(KJob *job, const QString &msg)) Q_PRIVATE_SLOT(d, void _k_slotTotalSize(KJob *job, qulonglong size)) Q_PRIVATE_SLOT(d, void _k_slotProcessedSize(KJob *job, qulonglong size)) Q_PRIVATE_SLOT(d, void _k_slotSpeed(KJob *job, unsigned long bytesPerSecond)) // KIO::SimpleJob subclasses Q_PRIVATE_SLOT(d, void _k_slotRedirection(KIO::Job *job, const QUrl &url)) // KIO::ListJob Q_PRIVATE_SLOT(d, void _k_slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries)) // KIO::TransferJob Q_PRIVATE_SLOT(d, void _k_slotData(KIO::Job *job, const QByteArray &data)) Q_PRIVATE_SLOT(d, void _k_slotDataReq(KIO::Job *job, QByteArray &data)) Q_PRIVATE_SLOT(d, void _k_slotMimetype(KIO::Job *job, const QString &type)) Q_PRIVATE_SLOT(d, void _k_slotCanResume(KIO::Job *job, KIO::filesize_t offset)) friend class ForwardingSlaveBasePrivate; ForwardingSlaveBasePrivate *const d; }; } #endif diff --git a/src/core/job_base.h b/src/core/job_base.h index 66bd8610..5966ab19 100644 --- a/src/core/job_base.h +++ b/src/core/job_base.h @@ -1,322 +1,322 @@ /* This file is part of the KDE libraries Copyright (C) 2000 Stephan Kulow 2000-2009 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIO_JOB_BASE_H #define KIO_JOB_BASE_H #include #include namespace KIO { class JobUiDelegateExtension; class JobPrivate; /** * @class KIO::Job job_base.h * * The base class for all jobs. * For all jobs created in an application, the code looks like * * \code * KIO::Job * job = KIO::someoperation( some parameters ); * connect( job, SIGNAL( result( KJob * ) ), * this, SLOT( slotResult( KJob * ) ) ); * \endcode * (other connects, specific to the job) * * And slotResult is usually at least: * * \code * if ( job->error() ) * job->uiDelegate()->showErrorMessage(); * \endcode * @see KIO::Scheduler */ class KIOCORE_EXPORT Job : public KCompositeJob { Q_OBJECT protected: Job(); Job(JobPrivate &dd); public: virtual ~Job(); - void start() Q_DECL_OVERRIDE {} // Since KIO autostarts its jobs + void start() override {} // Since KIO autostarts its jobs /** * Retrieves the UI delegate of this job. * * @deprecated since 5.0, can now be replaced with uiDelegate() * * @return the delegate used by the job to communicate with the UI */ #ifndef KIOCORE_NO_DEPRECATED KIOCORE_DEPRECATED KJobUiDelegate *ui() const; #endif /** * Retrieves the UI delegate extension used by this job. * @since 5.0 */ JobUiDelegateExtension *uiDelegateExtension() const; /** * Sets the UI delegate extension to be used by this job. * The default UI delegate extension is KIO::defaultJobUiDelegateExtension() */ void setUiDelegateExtension(JobUiDelegateExtension *extension); protected: /** * Abort this job. * This kills all subjobs and deletes the job. * */ - bool doKill() Q_DECL_OVERRIDE; + bool doKill() override; /** * Suspend this job * @see resume */ - bool doSuspend() Q_DECL_OVERRIDE; + bool doSuspend() override; /** * Resume this job * @see suspend */ - bool doResume() Q_DECL_OVERRIDE; + bool doResume() override; public: /** * Converts an error code and a non-i18n error message into an * error message in the current language. The low level (non-i18n) * error message (usually a url) is put into the translated error * message using %1. * * Example for errid == ERR_CANNOT_OPEN_FOR_READING: * \code * i18n( "Could not read\n%1" ).arg( errortext ); * \endcode * Use this to display the error yourself, but for a dialog box * use uiDelegate()->showErrorMessage(). Do not call it if error() * is not 0. * @return the error message and if there is no error, a message * telling the user that the app is broken, so check with * error() whether there is an error */ - QString errorString() const Q_DECL_OVERRIDE; + QString errorString() const override; /** * Converts an error code and a non-i18n error message into i18n * strings suitable for presentation in a detailed error message box. * * @param reqUrl the request URL that generated this error message * @param method the method that generated this error message * (unimplemented) * @return the following strings: caption, error + description, * causes+solutions */ QStringList detailedErrorStrings(const QUrl *reqUrl = nullptr, int method = -1) const; /** * Set the parent Job. * One example use of this is when FileCopyJob calls RenameDialog::open, * it must pass the correct progress ID of the parent CopyJob * (to hide the progress dialog). * You can set the parent job only once. By default a job does not * have a parent job. * @param parentJob the new parent job */ void setParentJob(Job *parentJob); /** * Returns the parent job, if there is one. * @return the parent job, or 0 if there is none * @see setParentJob */ Job *parentJob() const; /** * Set meta data to be sent to the slave, replacing existing * meta data. * @param metaData the meta data to set * @see addMetaData() * @see mergeMetaData() */ void setMetaData(const KIO::MetaData &metaData); /** * Add key/value pair to the meta data that is sent to the slave. * @param key the key of the meta data * @param value the value of the meta data * @see setMetaData() * @see mergeMetaData() */ void addMetaData(const QString &key, const QString &value); /** * Add key/value pairs to the meta data that is sent to the slave. * If a certain key already existed, it will be overridden. * @param values the meta data to add * @see setMetaData() * @see mergeMetaData() */ void addMetaData(const QMap &values); /** * Add key/value pairs to the meta data that is sent to the slave. * If a certain key already existed, it will remain unchanged. * @param values the meta data to merge * @see setMetaData() * @see addMetaData() */ void mergeMetaData(const QMap &values); /** * @internal. For the scheduler. Do not use. */ MetaData outgoingMetaData() const; /** * Get meta data received from the slave. * (Valid when first data is received and/or slave is finished) * @return the job's meta data */ MetaData metaData() const; /** * Query meta data received from the slave. * (Valid when first data is received and/or slave is finished) * @param key the key of the meta data to retrieve * @return the value of the meta data, or QString() if the * @p key does not exist */ QString queryMetaData(const QString &key); protected: Q_SIGNALS: /** * @deprecated. Don't use ! * Emitted when the job is canceled. * Signal result() is emitted as well, and error() is, * in this case, ERR_USER_CANCELED. * @param job the job that emitted this signal */ #ifndef KIOCORE_NO_DEPRECATED KIOCORE_DEPRECATED void canceled(KJob *job); #endif /** * Emitted when the slave successfully connected to the host. * There is no guarantee the slave will send this, and this is * currently unused (in the applications). * @param job the job that emitted this signal */ void connected(KIO::Job *job); protected: /** * Add a job that has to be finished before a result * is emitted. This has obviously to be called before * the finish signal is emitted by the slave. * * @param job the subjob to add */ - bool addSubjob(KJob *job) Q_DECL_OVERRIDE; + bool addSubjob(KJob *job) override; /** * Mark a sub job as being done. * * Note that this does not terminate the parent job, even if @p job * is the last subjob. emitResult must be called to indicate that * the job is complete. * * @param job the subjob to remove */ - bool removeSubjob(KJob *job) Q_DECL_OVERRIDE; + bool removeSubjob(KJob *job) override; protected: JobPrivate *const d_ptr; private: /** * Forward signal from subjob. * @param job the subjob * @param speed the speed in bytes/s * @see speed() */ Q_PRIVATE_SLOT(d_func(), void slotSpeed(KJob *job, unsigned long speed)) Q_DECLARE_PRIVATE(Job) }; /** * Flags for the job properties. * Not all flags are supported in all cases. Please see documentation of * the calling function! */ enum JobFlag { /** * Show the progress info GUI, no Resume and no Overwrite */ DefaultFlags = 0, /** * Hide progress information dialog, i.e. don't show a GUI. */ HideProgressInfo = 1, /** * When set, automatically append to the destination file if it exists already. * WARNING: this is NOT the builtin support for offering the user to resume a previous * partial download. The Resume option is much less used, it allows to append * to an existing file. * This is used by KIO::put(), KIO::file_copy(), KIO::file_move(). */ Resume = 2, /** * When set, automatically overwrite the destination if it exists already. * This is used by KIO::rename(), KIO::put(), KIO::file_copy(), KIO::file_move(), KIO::symlink(). * Otherwise the operation will fail with ERR_FILE_ALREADY_EXIST or ERR_DIR_ALREADY_EXIST. */ Overwrite = 4, /** * When set, notifies the slave that application/job does not want privilege execution. * So in case of failure due to insufficient privileges show an error without attempting * to run the operation as root first. * * @since 5.43 */ NoPrivilegeExecution = 8, }; Q_DECLARE_FLAGS(JobFlags, JobFlag) Q_DECLARE_OPERATORS_FOR_FLAGS(JobFlags) enum LoadType { Reload, NoReload }; } #endif diff --git a/src/core/job_p.h b/src/core/job_p.h index 7599e769..f68a7460 100644 --- a/src/core/job_p.h +++ b/src/core/job_p.h @@ -1,398 +1,398 @@ /* This file is part of the KDE libraries Copyright (C) 2000 Stephan Kulow 2000-2009 David Faure Waldo Bastian Copyright (C) 2007 Thiago Macieira Copyright (C) 2013 Dawit Alemayehu This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIO_JOB_P_H #define KIO_JOB_P_H #include "simplejob.h" #include "transferjob.h" #include "commands_p.h" #include "kjobtrackerinterface.h" #include #include #include #include #include #include "kiocoredebug.h" #include "global.h" #define KIO_ARGS QByteArray packedArgs; QDataStream stream( &packedArgs, QIODevice::WriteOnly ); stream namespace KIO { class Slave; // Exported for KIOWidgets jobs class KIOCORE_EXPORT JobPrivate { public: JobPrivate() : m_parentJob(nullptr), m_extraFlags(0), m_uiDelegateExtension(KIO::defaultJobUiDelegateExtension()), m_privilegeExecutionEnabled(false) { } virtual ~JobPrivate(); /** * Some extra storage space for jobs that don't have their own * private d pointer. */ enum { EF_TransferJobAsync = (1 << 0), EF_TransferJobNeedData = (1 << 1), EF_TransferJobDataSent = (1 << 2), EF_ListJobUnrestricted = (1 << 3), EF_KillCalled = (1 << 4) }; enum FileOperationType { ChangeAttr, // chmod(), chown(), setModificationTime() Copy, Delete, MkDir, Move, Rename, Symlink, Transfer, // put() and get() Other // if other file operation set message, caption inside the job. }; // Maybe we could use the QObject parent/child mechanism instead // (requires a new ctor, and moving the ctor code to some init()). Job *m_parentJob; int m_extraFlags; MetaData m_incomingMetaData; MetaData m_internalMetaData; MetaData m_outgoingMetaData; JobUiDelegateExtension *m_uiDelegateExtension; Job *q_ptr; // For privilege operation bool m_privilegeExecutionEnabled; QString m_caption, m_message; FileOperationType m_operationType; QByteArray privilegeOperationData(); void slotSpeed(KJob *job, unsigned long speed); static void emitMoving(KIO::Job *, const QUrl &src, const QUrl &dest); static void emitCopying(KIO::Job *, const QUrl &src, const QUrl &dest); static void emitCreatingDir(KIO::Job *, const QUrl &dir); static void emitDeleting(KIO::Job *, const QUrl &url); static void emitStating(KIO::Job *, const QUrl &url); static void emitTransferring(KIO::Job *, const QUrl &url); static void emitMounting(KIO::Job *, const QString &dev, const QString &point); static void emitUnmounting(KIO::Job *, const QString &point); Q_DECLARE_PUBLIC(Job) }; class SimpleJobPrivate: public JobPrivate { public: /** * Creates a new simple job. * @param url the url of the job * @param command the command of the job * @param packedArgs the arguments */ SimpleJobPrivate(const QUrl &url, int command, const QByteArray &packedArgs) : m_slave(nullptr), m_packedArgs(packedArgs), m_url(url), m_command(command), m_checkOnHold(false), m_schedSerial(0), m_redirectionHandlingEnabled(true) { #if 0 if (m_url.hasSubUrl()) { QList list = KUrl::split(m_url); list.removeLast(); m_subUrl = KUrl::join(list); //qDebug() << "New URL = " << m_url.url(); //qDebug() << "Sub URL = " << m_subUrl.url(); } #endif } Slave *m_slave; QByteArray m_packedArgs; QUrl m_url; QUrl m_subUrl; int m_command; // for use in KIO::Scheduler // // There are two kinds of protocol: // (1) The protocol of the url // (2) The actual protocol that the io-slave uses. // // These two often match, but not necessarily. Most notably, they don't // match when doing ftp via a proxy. // In that case (1) is ftp, but (2) is http. // // JobData::protocol stores (2) while Job::url().protocol() returns (1). // The ProtocolInfoDict is indexed with (2). // // We schedule slaves based on (2) but tell the slave about (1) via // Slave::setProtocol(). QString m_protocol; QStringList m_proxyList; bool m_checkOnHold; int m_schedSerial; bool m_redirectionHandlingEnabled; void simpleJobInit(); /** * Called on a slave's connected signal. * @see connected() */ void slotConnected(); /** * Forward signal from the slave. * @param data_size the processed size in bytes * @see processedSize() */ void slotProcessedSize(KIO::filesize_t data_size); /** * Forward signal from the slave. * @param speed the speed in bytes/s * @see speed() */ void slotSpeed(unsigned long speed); /** * Forward signal from the slave * Can also be called by the parent job, when it knows the size. * @param data_size the total size */ void slotTotalSize(KIO::filesize_t data_size); /** * Called on a slave's info message. * @param s the info message * @see infoMessage() */ void _k_slotSlaveInfoMessage(const QString &s); /** * Called when privilegeOperationRequested() is emitted by slave. */ void slotPrivilegeOperationRequested(); /** * @internal * Called by the scheduler when a slave gets to * work on this job. **/ virtual void start(KIO::Slave *slave); /** * @internal * Called to detach a slave from a job. **/ void slaveDone(); /** * Called by subclasses to restart the job after a redirection was signalled. * The m_redirectionURL data member can appear in several subclasses, so we have it * passed in. The regular URL will be set to the redirection URL which is then cleared. */ void restartAfterRedirection(QUrl *redirectionUrl); /** * Request the ui delegate to show a message box. * @internal */ int requestMessageBox(int type, const QString &text, const QString &caption, const QString &buttonYes, const QString &buttonNo, const QString &iconYes = QString(), const QString &iconNo = QString(), const QString &dontAskAgainName = QString(), const KIO::MetaData &sslMetaData = KIO::MetaData()); Q_DECLARE_PUBLIC(SimpleJob) static inline SimpleJobPrivate *get(KIO::SimpleJob *job) { return job->d_func(); } static inline SimpleJob *newJobNoUi(const QUrl &url, int command, const QByteArray &packedArgs) { SimpleJob *job = new SimpleJob(*new SimpleJobPrivate(url, command, packedArgs)); return job; } static inline SimpleJob *newJob(const QUrl &url, int command, const QByteArray &packedArgs, JobFlags flags = HideProgressInfo) { SimpleJob *job = new SimpleJob(*new SimpleJobPrivate(url, command, packedArgs)); job->setUiDelegate(KIO::createDefaultJobUiDelegate()); if (!(flags & HideProgressInfo)) { KIO::getJobTracker()->registerJob(job); } if (!(flags & NoPrivilegeExecution)) { job->d_func()->m_privilegeExecutionEnabled = true; // Only delete, rename and symlink operation accept JobFlags. FileOperationType opType; switch (command) { case CMD_DEL: opType = Delete; break; case CMD_RENAME: opType = Rename; break; case CMD_SYMLINK: opType = Symlink; break; } job->d_func()->m_operationType = opType; } return job; } }; class TransferJobPrivate: public SimpleJobPrivate { public: inline TransferJobPrivate(const QUrl &url, int command, const QByteArray &packedArgs, const QByteArray &_staticData) : SimpleJobPrivate(url, command, packedArgs), m_internalSuspended(false), m_errorPage(false), staticData(_staticData), m_isMimetypeEmitted(false), m_closedBeforeStart(false), m_subJob(nullptr) { } inline TransferJobPrivate(const QUrl &url, int command, const QByteArray &packedArgs, QIODevice *ioDevice) : SimpleJobPrivate(url, command, packedArgs), m_internalSuspended(false), m_errorPage(false), m_isMimetypeEmitted(false), m_closedBeforeStart(false), m_subJob(nullptr), m_outgoingDataSource(QPointer(ioDevice)) { } bool m_internalSuspended; bool m_errorPage; QByteArray staticData; QUrl m_redirectionURL; QList m_redirectionList; QString m_mimetype; bool m_isMimetypeEmitted; bool m_closedBeforeStart; TransferJob *m_subJob; QPointer m_outgoingDataSource; /** * Flow control. Suspend data processing from the slave. */ void internalSuspend(); /** * Flow control. Resume data processing from the slave. */ void internalResume(); /** * @internal * Called by the scheduler when a slave gets to * work on this job. * @param slave the slave that works on the job */ - void start(KIO::Slave *slave) Q_DECL_OVERRIDE; + void start(KIO::Slave *slave) override; /** * @internal * Called when the ioslave needs the data to send the server. This slot * is invoked when the data is to be sent is read from a QIODevice rather * instead of a QByteArray buffer. */ virtual void slotDataReqFromDevice(); void slotIODeviceClosed(); void slotIODeviceClosedBeforeStart(); void slotErrorPage(); void slotCanResume(KIO::filesize_t offset); void slotPostRedirection(); void slotNeedSubUrlData(); void slotSubUrlData(KIO::Job *, const QByteArray &); Q_DECLARE_PUBLIC(TransferJob) static inline TransferJob *newJob(const QUrl &url, int command, const QByteArray &packedArgs, const QByteArray &_staticData, JobFlags flags) { TransferJob *job = new TransferJob(*new TransferJobPrivate(url, command, packedArgs, _staticData)); job->setUiDelegate(KIO::createDefaultJobUiDelegate()); if (!(flags & HideProgressInfo)) { KIO::getJobTracker()->registerJob(job); } if (!(flags & NoPrivilegeExecution)) { job->d_func()->m_privilegeExecutionEnabled = true; job->d_func()->m_operationType = Transfer; } return job; } static inline TransferJob *newJob(const QUrl &url, int command, const QByteArray &packedArgs, QIODevice *ioDevice, JobFlags flags) { TransferJob *job = new TransferJob(*new TransferJobPrivate(url, command, packedArgs, ioDevice)); job->setUiDelegate(KIO::createDefaultJobUiDelegate()); if (!(flags & HideProgressInfo)) { KIO::getJobTracker()->registerJob(job); } if (!(flags & NoPrivilegeExecution)) { job->d_func()->m_privilegeExecutionEnabled = true; job->d_func()->m_operationType = Transfer; } return job; } }; class DirectCopyJobPrivate; /** * @internal * Used for direct copy from or to the local filesystem (i.e. SlaveBase::copy()) */ class DirectCopyJob : public SimpleJob { Q_OBJECT public: DirectCopyJob(const QUrl &url, const QByteArray &packedArgs); ~DirectCopyJob(); public Q_SLOTS: void slotCanResume(KIO::filesize_t offset); Q_SIGNALS: /** * @internal * Emitted if the job found an existing partial file * and supports resuming. Used by FileCopyJob. */ void canResume(KIO::Job *job, KIO::filesize_t offset); private: Q_DECLARE_PRIVATE(DirectCopyJob) }; } #endif diff --git a/src/core/kcoredirlister_p.h b/src/core/kcoredirlister_p.h index 671fc0f3..7b81ed35 100644 --- a/src/core/kcoredirlister_p.h +++ b/src/core/kcoredirlister_p.h @@ -1,586 +1,586 @@ /* This file is part of the KDE project Copyright (C) 2002-2006 Michael Brade This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef kdirlister_p_h #define kdirlister_p_h #include "kfileitem.h" #include #include #include #include #include #include #include #include #include #include /** * KCoreDirListerCache stores pointers to KFileItems internally and expects that * these pointers remain valid, even if the number of items in the list 'lstItems' * in KCoreDirLister::DirItem changes. Since such changes in a QList * may change the internal memory layout of the QList, pointers to KFileItems in a * QList might become invalid. * * Therefore, we make 'lstItems' a QList, where * NonMovableFileItem is a class that inherits KFileItem, but is not declared as a * Q_MOVABLE_TYPE. This forces QList to never move these items in memory, which is * achieved by allocating space for each individual item, and store pointers to * these items in the contiguous region in memory. * * TODO: Try to get rid of the raw KFileItem pointers in KCoreDirListerCache, and * replace all occurrences of NonMovableFileItem(List) with KFileItem(List). */ class NonMovableFileItem : public KFileItem { public: NonMovableFileItem(const KFileItem &item) : KFileItem(item) {} }; class NonMovableFileItemList : public QList { public: NonMovableFileItemList() {} KFileItem findByName(const QString &fileName) const { const_iterator it = begin(); const const_iterator itend = end(); for (; it != itend; ++it) { if ((*it).name() == fileName) { return *it; } } return KFileItem(); } KFileItemList toKFileItemList() const { KFileItemList result; result.reserve(count()); foreach (const NonMovableFileItem &item, *this) { result.append(item); } return result; } }; class KCoreDirLister; namespace KIO { class Job; class ListJob; } class OrgKdeKDirNotifyInterface; struct KCoreDirListerCacheDirectoryData; class Q_DECL_HIDDEN KCoreDirLister::Private { public: Private(KCoreDirLister *parent) : m_parent(parent) { complete = false; autoUpdate = false; delayedMimeTypes = false; rootFileItem = KFileItem(); lstNewItems = nullptr; lstRefreshItems = nullptr; lstMimeFilteredItems = nullptr; lstRemoveItems = nullptr; hasPendingChanges = false; } void _k_emitCachedItems(const QUrl &, bool, bool); void _k_slotInfoMessage(KJob *, const QString &); void _k_slotPercent(KJob *, unsigned long); void _k_slotTotalSize(KJob *, qulonglong); void _k_slotProcessedSize(KJob *, qulonglong); void _k_slotSpeed(KJob *, unsigned long); bool doMimeExcludeFilter(const QString &mimeExclude, const QStringList &filters) const; void connectJob(KIO::ListJob *); void jobDone(KIO::ListJob *); uint numJobs(); void addNewItem(const QUrl &directoryUrl, const KFileItem &item); void addNewItems(const QUrl &directoryUrl, const NonMovableFileItemList &items); void addRefreshItem(const QUrl &directoryUrl, const KFileItem &oldItem, const KFileItem &item); void emitItems(); void emitItemsDeleted(const KFileItemList &items); /** * Redirect this dirlister from oldUrl to newUrl. * @param keepItems if true, keep the fileitems (e.g. when renaming an existing dir); * if false, clear out everything (e.g. when redirecting during listing). */ void redirect(const QUrl &oldUrl, const QUrl &newUrl, bool keepItems); /** * Should this item be visible according to the current filter settings? */ bool isItemVisible(const KFileItem &item) const; void prepareForSettingsChange() { if (!hasPendingChanges) { hasPendingChanges = true; oldSettings = settings; } } void emitChanges(); class CachedItemsJob; CachedItemsJob *cachedItemsJobForUrl(const QUrl &url) const; KCoreDirLister *m_parent; /** * List of dirs handled by this dirlister. The first entry is the base URL. * For a tree view, it contains all the dirs shown. */ QList lstDirs; // toplevel URL QUrl url; bool complete: 1; bool autoUpdate: 1; bool delayedMimeTypes: 1; bool hasPendingChanges: 1; // i.e. settings != oldSettings struct JobData { long unsigned int percent, speed; KIO::filesize_t processedSize, totalSize; }; QMap jobData; // file item for the root itself (".") KFileItem rootFileItem; typedef QHash NewItemsHash; NewItemsHash *lstNewItems; QList > *lstRefreshItems; KFileItemList *lstMimeFilteredItems, *lstRemoveItems; QList m_cachedItemsJobs; QString nameFilter; // parsed into lstFilters struct FilterSettings { FilterSettings() : isShowingDotFiles(false), dirOnlyMode(false) {} bool isShowingDotFiles; bool dirOnlyMode; QList lstFilters; QStringList mimeFilter; QStringList mimeExcludeFilter; }; FilterSettings settings; FilterSettings oldSettings; friend class KCoreDirListerCache; }; /** * Design of the cache: * There is a single KCoreDirListerCache for the whole process. * It holds all the items used by the dir listers (itemsInUse) * as well as a cache of the recently used items (itemsCached). * Those items are grouped by directory (a DirItem represents a whole directory). * * KCoreDirListerCache also runs all the jobs for listing directories, whether they are for * normal listing or for updates. * For faster lookups, it also stores a hash table, which gives for a directory URL: * - the dirlisters holding that URL (listersCurrentlyHolding) * - the dirlisters currently listing that URL (listersCurrentlyListing) */ class KCoreDirListerCache : public QObject { Q_OBJECT public: KCoreDirListerCache(); // only called by K_GLOBAL_STATIC ~KCoreDirListerCache(); void updateDirectory(const QUrl &dir); KFileItem itemForUrl(const QUrl &url) const; NonMovableFileItemList *itemsForDir(const QUrl &dir) const; bool listDir(KCoreDirLister *lister, const QUrl &_url, bool _keep, bool _reload); // stop all running jobs for lister void stop(KCoreDirLister *lister, bool silent = false); // stop just the job listing url for lister void stopListingUrl(KCoreDirLister *lister, const QUrl &_url, bool silent = false); void setAutoUpdate(KCoreDirLister *lister, bool enable); void forgetDirs(KCoreDirLister *lister); void forgetDirs(KCoreDirLister *lister, const QUrl &_url, bool notify); KFileItem findByName(const KCoreDirLister *lister, const QString &_name) const; // findByUrl returns a pointer so that it's possible to modify the item. // See itemForUrl for the version that returns a readonly kfileitem. // @param lister can be 0. If set, it is checked that the url is held by the lister KFileItem *findByUrl(const KCoreDirLister *lister, const QUrl &url) const; // Called by CachedItemsJob: // Emits the cached items, for this lister and this url void emitItemsFromCache(KCoreDirLister::Private::CachedItemsJob *job, KCoreDirLister *lister, const QUrl &_url, bool _reload, bool _emitCompleted); // Called by CachedItemsJob: void forgetCachedItemsJob(KCoreDirLister::Private::CachedItemsJob *job, KCoreDirLister *lister, const QUrl &url); public Q_SLOTS: /** * Notify that files have been added in @p directory * The receiver will list that directory again to find * the new items (since it needs more than just the names anyway). * Connected to the DBus signal from the KDirNotify interface. */ void slotFilesAdded(const QString &urlDirectory); /** * Notify that files have been deleted. * This call passes the exact urls of the deleted files * so that any view showing them can simply remove them * or be closed (if its current dir was deleted) * Connected to the DBus signal from the KDirNotify interface. */ void slotFilesRemoved(const QStringList &fileList); /** * Notify that files have been changed. * At the moment, this is only used for new icon, but it could be * used for size etc. as well. * Connected to the DBus signal from the KDirNotify interface. */ void slotFilesChanged(const QStringList &fileList); void slotFileRenamed(const QString &srcUrl, const QString &dstUrl, const QString &dstPath); private Q_SLOTS: void slotFileDirty(const QString &_file); void slotFileCreated(const QString &_file); void slotFileDeleted(const QString &_file); void slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries); void slotResult(KJob *j); void slotRedirection(KIO::Job *job, const QUrl &url); void slotUpdateEntries(KIO::Job *job, const KIO::UDSEntryList &entries); void slotUpdateResult(KJob *job); void processPendingUpdates(); private: void itemsAddedInDirectory(const QUrl &url); class DirItem; DirItem *dirItemForUrl(const QUrl &dir) const; bool validUrl(KCoreDirLister *lister, const QUrl &_url) const; void stopListJob(const QString &url, bool silent); KIO::ListJob *jobForUrl(const QString &url, KIO::ListJob *not_job = nullptr); const QUrl &joburl(KIO::ListJob *job); void killJob(KIO::ListJob *job); // Called when something tells us that the directory @p url has changed. // Returns true if @p url is held by some lister (meaning: do the update now) // otherwise mark the cached item as not-up-to-date for later and return false bool checkUpdate(const QUrl &url); // Helper method for slotFileDirty void handleFileDirty(const QUrl &url); void handleDirDirty(const QUrl &url); // when there were items deleted from the filesystem all the listers holding // the parent directory need to be notified, the items have to be deleted // and removed from the cache including all the children. void deleteUnmarkedItems(const QList&, NonMovableFileItemList &lstItems, const QHash &itemsToDelete); // Helper method called when we know that a list of items was deleted void itemsDeleted(const QList &listers, const KFileItemList &deletedItems); void slotFilesRemoved(const QList &urls); // common for slotRedirection and slotFileRenamed void renameDir(const QUrl &oldUrl, const QUrl &url); // common for deleteUnmarkedItems and slotFilesRemoved void deleteDir(const QUrl &dirUrl); // remove directory from cache (itemsCached), including all child dirs void removeDirFromCache(const QUrl &dir); // helper for renameDir void emitRedirections(const QUrl &oldUrl, const QUrl &url); /** * Emits refreshItem() in the directories that cared for oldItem. * The caller has to remember to call emitItems in the set of dirlisters returned * (but this allows to buffer change notifications) */ QSet emitRefreshItem(const KFileItem &oldItem, const KFileItem &fileitem); /** * When KDirWatch tells us that something changed in "dir", we need to * also notify the dirlisters that are listing a symlink to "dir" (#213799) */ QList directoriesForCanonicalPath(const QUrl &dir) const; /** * Returns the names listed in dir's ".hidden" file, if it exists. * If a file named ".hidden" exists in the @p dir directory, this method * returns all the file names listed in that file. If it doesn't exist, an * empty set is returned. * @param dir path to the target directory. * @return names listed in the directory's ".hidden" file (empty if it doesn't exist). */ QSet filesInDotHiddenForDir(const QString& dir); #ifndef NDEBUG void printDebug(); #endif class DirItem { public: DirItem(const QUrl &dir, const QString &canonicalPath) : url(dir), m_canonicalPath(canonicalPath) { autoUpdates = 0; complete = false; watchedWhileInCache = false; } ~DirItem() { if (autoUpdates) { if (KDirWatch::exists() && url.isLocalFile()) { KDirWatch::self()->removeDir(m_canonicalPath); } // Since sendSignal goes through D-Bus, QCoreApplication has to be available // which might not be the case anymore from a global static dtor like the // lister cache if (QCoreApplication::instance()) { sendSignal(false, url); } } lstItems.clear(); } void sendSignal(bool entering, const QUrl &url) { // Note that "entering" means "start watching", and "leaving" means "stop watching" // (i.e. it's not when the user leaves the directory, it's when the directory is removed from the cache) if (entering) { org::kde::KDirNotify::emitEnteredDirectory(url); } else { org::kde::KDirNotify::emitLeftDirectory(url); } } void redirect(const QUrl &newUrl) { if (autoUpdates) { if (url.isLocalFile()) { KDirWatch::self()->removeDir(m_canonicalPath); } sendSignal(false, url); if (newUrl.isLocalFile()) { m_canonicalPath = QFileInfo(newUrl.toLocalFile()).canonicalFilePath(); KDirWatch::self()->addDir(m_canonicalPath); } sendSignal(true, newUrl); } url = newUrl; if (!rootItem.isNull()) { rootItem.setUrl(newUrl); } } void incAutoUpdate() { if (autoUpdates++ == 0) { if (url.isLocalFile()) { KDirWatch::self()->addDir(m_canonicalPath); } sendSignal(true, url); } } void decAutoUpdate() { if (--autoUpdates == 0) { if (url.isLocalFile()) { KDirWatch::self()->removeDir(m_canonicalPath); } sendSignal(false, url); } else if (autoUpdates < 0) { autoUpdates = 0; } } // number of KCoreDirListers using autoUpdate for this dir short autoUpdates; // this directory is up-to-date bool complete; // the directory is watched while being in the cache (useful for proper incAutoUpdate/decAutoUpdate count) bool watchedWhileInCache; // the complete url of this directory QUrl url; // the local path, with symlinks resolved, so that KDirWatch works QString m_canonicalPath; // KFileItem representing the root of this directory. // Remember that this is optional. FTP sites don't return '.' in // the list, so they give no root item KFileItem rootItem; NonMovableFileItemList lstItems; }; // definition of the cache of ".hidden" files struct CacheHiddenFile { CacheHiddenFile(const QDateTime& mtime, const QSet& listedFiles) : mtime(mtime), listedFiles(listedFiles) { } QDateTime mtime; QSet listedFiles; }; //static const unsigned short MAX_JOBS_PER_LISTER; QMap runningListJobs; // an item is a complete directory QHash itemsInUse; QCache itemsCached; // cache of ".hidden" files QCache