1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the dialog module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#ifndef QFILEDIALOG_P_H
30
#define QFILEDIALOG_P_H
36
// This file is not part of the Qt API. It exists purely as an
37
// implementation detail. This header file may change from version to
38
// version without notice, or even be removed.
43
#include <private/qdialog_p.h>
44
#include <qitemselectionmodel.h>
45
#include <qabstractitemview.h>
46
#include <qtoolbutton.h>
54
class QFileDialogLineEdit;
58
class QFileDialogPrivate : public QDialogPrivate
60
Q_DECLARE_PUBLIC(QFileDialog)
66
void navigateToPrevious();
67
void navigateToParent();
68
void enterDirectory(const QModelIndex &index);
69
void enterDirectory(const QString &path);
70
void enterDirectory();
74
void useFilter(const QString &filter);
75
void updateFileName(const QItemSelection &selection);
76
void autoCompleteFileName(const QString &text);
77
void autoCompleteDirectory(const QString &text);
78
void showContextMenu(const QPoint &pos);
79
void createDirectory();
86
void currentChanged(const QModelIndex &index);
89
void setup(const QString &directory, const QStringList &nameFilter);
91
void setupListView(const QModelIndex &index, QGridLayout *grid);
92
void setupTreeView(const QModelIndex &index, QGridLayout *grid);
93
void setupToolButtons(const QModelIndex &index, QGridLayout *grid);
94
void setupWidgets(QGridLayout *grid);
97
void updateButtons(const QModelIndex &index);
98
void setRootIndex(const QModelIndex &index);
99
QModelIndex rootIndex() const;
100
void setDirSorting(QDir::SortFlags sort);
101
void setDirFilter(QDir::Filters filter);
102
QDir::Filters filterForMode(QFileDialog::FileMode mode);
103
QAbstractItemView::SelectionMode selectionMode(QFileDialog::FileMode mode);
104
QModelIndex matchDir(const QString &text, const QModelIndex &first) const;
105
QModelIndex matchName(const QString &name, const QModelIndex &first) const;
108
inline QString tr(const char *text) const { return QObject::tr(text); }
109
inline QString toNative(const QString &path) const
110
{ return QDir::convertSeparators(path); }
111
inline QString toInternal(const QString &path) const
113
#if defined(Q_FS_FAT) || defined(Q_OS_OS2EMX)
115
for (int i = 0; i < (int)n.length(); ++i)
116
if (n[i] == '\\') n[i] = '/';
118
#else // the compile should optimize away this
122
inline QFileDialog::ViewMode viewMode() const
123
{ return (listModeButton->isDown() ? QFileDialog::List : QFileDialog::Detail); }
126
static QString encodeFileName(const QString &filename);
127
static QString workingDirectory(const QString &path, bool encode = true);
128
static QString initialSelection(const QString &path, bool encode = true);
132
QItemSelectionModel *selections;
136
QFileDialog::FileMode fileMode;
137
QFileDialog::AcceptMode acceptMode;
138
bool confirmOverwrite;
139
QString defaultSuffix;
141
QList<QPersistentModelIndex> history;
143
QComboBox *lookInCombo;
144
QFileDialogLineEdit *fileNameEdit;
145
QFileDialogLineEdit *lookInEdit;
146
QComboBox *fileTypeCombo;
149
QAction *renameAction;
150
QAction *deleteAction;
152
QAction *reloadAction;
153
QAction *sortByNameAction;
154
QAction *sortBySizeAction;
155
QAction *sortByDateAction;
156
QAction *unsortedAction;
157
QAction *showHiddenAction;
159
QPushButton *acceptButton;
160
QPushButton *rejectButton;
162
QToolButton *backButton;
163
QToolButton *toParentButton;
164
QToolButton *newFolderButton;
165
QToolButton *detailModeButton;
166
QToolButton *listModeButton;
169
QLabel *fileNameLabel;
170
QLabel *fileTypeLabel;
173
struct QFileDialogArgs
175
QFileDialogArgs() : parent(0), mode(QFileDialog::AnyFile) {}
182
QFileDialog::FileMode mode;
183
QFileDialog::Options options;
186
#endif // QFILEDIALOG_P_H