1 /* 2 * Copyright (C) 2012 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 * 18 */ 19 20 21 #ifndef FM_FILEPROPSDIALOG_H 22 #define FM_FILEPROPSDIALOG_H 23 24 #include "libfmqtglobals.h" 25 #include <QDialog> 26 #include <QTimer> 27 28 #include "core/fileinfo.h" 29 #include "core/totalsizejob.h" 30 31 namespace Ui { 32 class FilePropsDialog; 33 } 34 35 namespace Fm { 36 37 class LIBFM_QT_API FilePropsDialog : public QDialog { 38 Q_OBJECT 39 40 public: 41 explicit FilePropsDialog(Fm::FileInfoList files, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); 42 ~FilePropsDialog() override; 43 44 void accept() override; 45 46 static FilePropsDialog* showForFile(std::shared_ptr<const Fm::FileInfo> file, QWidget* parent = nullptr) { 47 Fm::FileInfoList files; 48 files.push_back(std::move(file)); 49 FilePropsDialog* dlg = showForFiles(files, parent); 50 return dlg; 51 } 52 53 static FilePropsDialog* showForFiles(Fm::FileInfoList files, QWidget* parent = nullptr) { 54 FilePropsDialog* dlg = new FilePropsDialog(std::move(files), parent); 55 dlg->show(); 56 return dlg; 57 } 58 59 private: 60 void initGeneralPage(); 61 void initApplications(); 62 void initPermissionsPage(); 63 void initOwner(); 64 65 private Q_SLOTS: 66 void onDeepCountJobFinished(); 67 void onFileSizeTimerTimeout(); 68 void onIconButtonclicked(); 69 void onEmblemButtonclicked(); 70 void onClearEmblemButtonclicked(); 71 72 private: 73 Ui::FilePropsDialog* ui; 74 Fm::FileInfoList fileInfos_; // list of all file infos 75 std::shared_ptr<const Fm::FileInfo> fileInfo; // file info of the first file in the list 76 bool singleType; // all files are of the same type? 77 bool singleFile; // only one file is selected? 78 bool hasDir; // is there any dir in the files? 79 bool allNative; // all files are on native UNIX filesystems (not virtual or remote) 80 QIcon customIcon; // custom (folder) icon (wiil be checked for its nullity) 81 82 std::shared_ptr<const Fm::MimeType> mimeType; // mime type of the files 83 84 uid_t uid; // owner uid of the files, INVALID_UID means all files do not have the same uid 85 gid_t gid; // owner gid of the files, INVALID_GID means all files do not have the same uid 86 mode_t ownerPerm; // read permission of the files, -1 means not all files have the same value 87 int ownerPermSel; 88 mode_t groupPerm; // read permission of the files, -1 means not all files have the same value 89 int groupPermSel; 90 mode_t otherPerm; // read permission of the files, -1 means not all files have the same value 91 int otherPermSel; 92 mode_t execPerm; // exec permission of the files 93 Qt::CheckState execCheckState; 94 95 Fm::TotalSizeJob* totalSizeJob; // job used to count total size 96 QTimer* fileSizeTimer; 97 }; 98 99 } 100 101 #endif // FM_FILEPROPSDIALOG_H 102