Warning, file /utilities/kio-stash/src/kioworker/filestash.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /*************************************************************************** 0002 * Copyright (C) 2016 by Arnav Dhamija <arnav.dhamija@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 0018 ***************************************************************************/ 0019 0020 #ifndef FILESTASH_H 0021 #define FILESTASH_H 0022 0023 #include <KIO/ForwardingWorkerBase> 0024 #include <QObject> 0025 #include <QString> 0026 0027 class FileStash : public KIO::ForwardingWorkerBase 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 FileStash(const QByteArray &pool, 0033 const QByteArray &app, 0034 const QString &daemonService = "org.kde.kio.StashNotifier", 0035 const QString &daemonPath = "/StashNotifier"); 0036 ~FileStash(); 0037 0038 enum NodeType { 0039 DirectoryNode, 0040 SymlinkNode, 0041 FileNode, 0042 InvalidNode, 0043 }; 0044 0045 struct dirList { 0046 QString filePath; 0047 QString source; 0048 FileStash::NodeType type; 0049 0050 dirList() 0051 { 0052 } 0053 0054 ~dirList() 0055 { 0056 } 0057 0058 dirList(const dirList &obj) 0059 { 0060 filePath = obj.filePath; 0061 source = obj.source; 0062 type = obj.type; 0063 } 0064 }; 0065 0066 private: 0067 void createTopLevelDirEntry(KIO::UDSEntry &entry); 0068 bool isRoot(const QString &string); 0069 bool statUrl(const QUrl &url, KIO::UDSEntry &entry); 0070 bool createUDSEntry(KIO::UDSEntry &entry, const FileStash::dirList &fileItem); 0071 bool copyFileToStash(const QUrl &src, const QUrl &dest, KIO::JobFlags flags); 0072 bool copyStashToFile(const QUrl &src, const QUrl &dest, KIO::JobFlags flags); 0073 bool copyStashToStash(const QUrl &src, const QUrl &dest, KIO::JobFlags flags); 0074 bool deletePath(const QUrl &src); 0075 0076 QStringList setFileList(const QUrl &url); 0077 QString setFileInfo(const QUrl &url); 0078 FileStash::dirList createDirListItem(const QString &fileInfo); 0079 0080 const QString m_daemonService; 0081 const QString m_daemonPath; 0082 0083 public: 0084 KIO::WorkerResult listDir(const QUrl &url) override; 0085 KIO::WorkerResult copy(const QUrl &src, const QUrl &dest, int permissions, KIO::JobFlags flags) override; 0086 KIO::WorkerResult mkdir(const QUrl &url, int permissions) override; 0087 KIO::WorkerResult del(const QUrl &url, bool isFile) override; 0088 KIO::WorkerResult stat(const QUrl &url) override; 0089 KIO::WorkerResult rename(const QUrl &src, const QUrl &dest, KIO::JobFlags flags) override; 0090 0091 protected: 0092 bool rewriteUrl(const QUrl &url, QUrl &newUrl) override; 0093 }; 0094 0095 #endif