PCManFM-Qt
filepropsdialog.h
1 /*
2 
3  Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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 #include <libfm/fm.h>
28 
29 namespace Ui {
30  class FilePropsDialog;
31 };
32 
33 namespace Fm {
34 
35 class LIBFM_QT_API FilePropsDialog : public QDialog {
36 Q_OBJECT
37 
38 public:
39  explicit FilePropsDialog(FmFileInfoList* files, QWidget* parent = 0, Qt::WindowFlags f = 0);
40  virtual ~FilePropsDialog();
41 
42  virtual void accept();
43 
44  static FilePropsDialog* showForFile(FmFileInfo* file, QWidget* parent = 0) {
45  FmFileInfoList* files = fm_file_info_list_new();
46  fm_file_info_list_push_tail(files, file);
47  FilePropsDialog* dlg = showForFiles(files, parent);
48  fm_file_info_list_unref(files);
49  return dlg;
50  }
51 
52  static FilePropsDialog* showForFiles(FmFileInfoList* files, QWidget* parent = 0) {
53  FilePropsDialog* dlg = new FilePropsDialog(files, parent);
54  dlg->show();
55  return dlg;
56  }
57 
58 private:
59  void initGeneralPage();
60  void initApplications();
61  void initPermissionsPage();
62  void initOwner();
63 
64  static void onDeepCountJobFinished(FmDeepCountJob* job, FilePropsDialog* pThis);
65 
66 private Q_SLOTS:
67  void onFileSizeTimerTimeout();
68 
69 private:
70  Ui::FilePropsDialog* ui;
71  FmFileInfoList* fileInfos_; // list of all file infos
72  FmFileInfo* fileInfo; // file info of the first file in the list
73  bool singleType; // all files are of the same type?
74  bool singleFile; // only one file is selected?
75  bool hasDir; // is there any dir in the files?
76  bool allNative; // all files are on native UNIX filesystems (not virtual or remote)
77 
78  FmMimeType* mimeType; // mime type of the files
79 
80  gint32 uid; // owner uid of the files, -1 means all files do not have the same uid
81  gint32 gid; // owner gid of the files, -1 means all files do not have the same uid
82  mode_t ownerPerm; // read permission of the files, -1 means not all files have the same value
83  int ownerPermSel;
84  mode_t groupPerm; // read permission of the files, -1 means not all files have the same value
85  int groupPermSel;
86  mode_t otherPerm; // read permission of the files, -1 means not all files have the same value
87  int otherPermSel;
88  mode_t execPerm; // exec permission of the files
89  Qt::CheckState execCheckState;
90 
91  FmDeepCountJob* deepCountJob; // job used to count total size
92  QTimer* fileSizeTimer;
93 };
94 
95 }
96 
97 #endif // FM_FILEPROPSDIALOG_H
Definition: appchoosercombobox.cpp:26
Definition: appchooserdialog.h:28
Definition: filepropsdialog.h:35