/usr/include/libfm-qt/filedialog.h is in libfm-qt-dev 0.12.0-14build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | #ifndef FM_FILEDIALOG_H
#define FM_FILEDIALOG_H
#include "libfmqtglobals.h"
#include "core/filepath.h"
#include <QFileDialog>
#include <QRegExp>
#include <vector>
#include <memory>
#include "folderview.h"
#include "browsehistory.h"
namespace Ui {
class FileDialog;
}
namespace Fm {
class CachedFolderModel;
class ProxyFolderModel;
class LIBFM_QT_API FileDialog : public QDialog {
Q_OBJECT
public:
explicit FileDialog(QWidget *parent = 0, FilePath path = FilePath::homeDir());
~FileDialog();
// Some QFileDialog compatible interface
void accept() override;
void reject() override;
QFileDialog::Options options() const {
return options_;
}
void setOptions(QFileDialog::Options options) {
options_ = options;
}
// interface for QPlatformFileDialogHelper
void setDirectory(const QUrl &directory);
QUrl directory() const;
void selectFile(const QUrl &filename);
QList<QUrl> selectedFiles();
void selectNameFilter(const QString &filter);
QString selectedNameFilter() const {
return currentNameFilter_;
}
void selectMimeTypeFilter(const QString &filter);
QString selectedMimeTypeFilter() const;
bool isSupportedUrl(const QUrl &url);
// options
// not yet supported
QDir::Filters filter() const {
return filters_;
}
// not yet supported
void setFilter(QDir::Filters filters);
void setViewMode(FolderView::ViewMode mode);
FolderView::ViewMode viewMode() const {
return viewMode_;
}
void setFileMode(QFileDialog::FileMode mode);
QFileDialog::FileMode fileMode() const {
return fileMode_;
}
void setAcceptMode(QFileDialog::AcceptMode mode);
QFileDialog::AcceptMode acceptMode() const {
return acceptMode_;
}
void setNameFilters(const QStringList &filters);
QStringList nameFilters() const {
return nameFilters_;
}
void setMimeTypeFilters(const QStringList &filters);
QStringList mimeTypeFilters() const {
return mimeTypeFilters_;
}
void setDefaultSuffix(const QString &suffix) {
if(!suffix.isEmpty() && suffix[0] == '.') {
// if the first char is dot, remove it.
defaultSuffix_ = suffix.mid(1);
}
else {
defaultSuffix_ = suffix;
}
}
QString defaultSuffix() const {
return defaultSuffix_;
}
void setConfirmOverwrite(bool enabled) {
confirmOverwrite_ = enabled;
}
bool confirmOverwrite() const {
return confirmOverwrite_;
}
void setLabelText(QFileDialog::DialogLabel label, const QString &text);
QString labelText(QFileDialog::DialogLabel label) const;
int splitterPos() const;
void setSplitterPos(int pos);
private Q_SLOTS:
void onCurrentRowChanged(const QModelIndex ¤t, const QModelIndex& /*previous*/);
void onSelectionChanged(const QItemSelection& /*selected*/, const QItemSelection& /*deselected*/);
void onFileClicked(int type, const std::shared_ptr<const Fm::FileInfo>& file);
void onNewFolder();
void onViewModeToggled(bool active);
void goHome();
Q_SIGNALS:
// emitted when the dialog is accepted and some files are selected
void fileSelected(const QUrl &file);
void filesSelected(const QList<QUrl> &files);
// emitted whenever selection changes (including no selected files)
void currentChanged(const QUrl &path);
void directoryEntered(const QUrl &directory);
void filterSelected(const QString &filter);
private:
class FileDialogFilter: public ProxyFolderModelFilter {
public:
FileDialogFilter(FileDialog* dlg): dlg_{dlg} {}
virtual bool filterAcceptsRow(const ProxyFolderModel* /*model*/, const std::shared_ptr<const Fm::FileInfo>& info) const override;
void update();
FileDialog* dlg_;
std::vector<QRegExp> patterns_;
};
bool isLabelExplicitlySet(QFileDialog::DialogLabel label) const {
return !explicitLabels_[label].isEmpty();
}
void setLabelExplicitly(QFileDialog::DialogLabel label, const QString& text) {
explicitLabels_[label] = text;
}
void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text);
void updateSaveButtonText(bool saveOnFolder);
void updateAcceptButtonState();
std::shared_ptr<const Fm::FileInfo> firstSelectedDir() const;
void selectFilePath(const FilePath& path);
void selectFilePathWithDelay(const FilePath& path);
void selectFilesOnReload(const Fm::FileInfoList& infos);
void setDirectoryPath(FilePath directory, FilePath selectedPath = FilePath(), bool addHistory = true);
void updateSelectionMode();
void doAccept();
void onFileInfoJobFinished();
void freeFolder();
QStringList parseNames() const;
private:
std::unique_ptr<Ui::FileDialog> ui;
CachedFolderModel* folderModel_;
ProxyFolderModel* proxyModel_;
FilePath directoryPath_;
std::shared_ptr<Fm::Folder> folder_;
Fm::BrowseHistory history_;
QFileDialog::Options options_;
QDir::Filters filters_;
FolderView::ViewMode viewMode_;
QFileDialog::FileMode fileMode_;
QFileDialog::AcceptMode acceptMode_;
bool confirmOverwrite_;
QStringList nameFilters_;
QStringList mimeTypeFilters_;
QString defaultSuffix_;
FileDialogFilter modelFilter_;
QString currentNameFilter_;
QList<QUrl> selectedFiles_;
// view modes:
QAction* iconViewAction_;
QAction* thumbnailViewAction_;
QAction* compactViewAction_;
QAction* detailedViewAction_;
// back and forward buttons:
QAction* backAction_;
QAction* forwardAction_;
// dialog labels that can be set explicitly:
QString explicitLabels_[5];
// needed for disconnecting Fm::Folder signal from lambda:
QMetaObject::Connection lambdaConnection_;
};
} // namespace Fm
#endif // FM_FILEDIALOG_H
|