| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com)
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com.
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef QFILEDIALOG_P_H
|
|---|
| 43 | #define QFILEDIALOG_P_H
|
|---|
| 44 |
|
|---|
| 45 | //
|
|---|
| 46 | // W A R N I N G
|
|---|
| 47 | // -------------
|
|---|
| 48 | //
|
|---|
| 49 | // This file is not part of the Qt API. It exists purely as an
|
|---|
| 50 | // implementation detail. This header file may change from version to
|
|---|
| 51 | // version without notice, or even be removed.
|
|---|
| 52 | //
|
|---|
| 53 | // We mean it.
|
|---|
| 54 | //
|
|---|
| 55 |
|
|---|
| 56 | #ifndef QT_NO_FILEDIALOG
|
|---|
| 57 |
|
|---|
| 58 | #include "qfiledialog.h"
|
|---|
| 59 | #include "private/qdialog_p.h"
|
|---|
| 60 | #include "qplatformdefs.h"
|
|---|
| 61 |
|
|---|
| 62 | #include "qfilesystemmodel_p.h"
|
|---|
| 63 | #include <qlistview.h>
|
|---|
| 64 | #include <qtreeview.h>
|
|---|
| 65 | #include <qcombobox.h>
|
|---|
| 66 | #include <qtoolbutton.h>
|
|---|
| 67 | #include <qlabel.h>
|
|---|
| 68 | #include <qevent.h>
|
|---|
| 69 | #include <qlineedit.h>
|
|---|
| 70 | #include <qurl.h>
|
|---|
| 71 | #include <qstackedwidget.h>
|
|---|
| 72 | #include <qdialogbuttonbox.h>
|
|---|
| 73 | #include <qabstractproxymodel.h>
|
|---|
| 74 | #include <qcompleter.h>
|
|---|
| 75 | #include <qpointer.h>
|
|---|
| 76 | #include <qtimeline.h>
|
|---|
| 77 | #include <qdebug.h>
|
|---|
| 78 | #include "qsidebar_p.h"
|
|---|
| 79 |
|
|---|
| 80 | #if defined (Q_OS_UNIX)
|
|---|
| 81 | #include <unistd.h>
|
|---|
| 82 | #endif
|
|---|
| 83 |
|
|---|
| 84 | QT_BEGIN_NAMESPACE
|
|---|
| 85 |
|
|---|
| 86 | class QFileDialogListView;
|
|---|
| 87 | class QFileDialogTreeView;
|
|---|
| 88 | class QFileDialogLineEdit;
|
|---|
| 89 | class QGridLayout;
|
|---|
| 90 | class QCompleter;
|
|---|
| 91 | class QHBoxLayout;
|
|---|
| 92 | class Ui_QFileDialog;
|
|---|
| 93 |
|
|---|
| 94 | #ifndef QT_NO_COMPLETER
|
|---|
| 95 | /*!
|
|---|
| 96 | QCompleter that can deal with QFileSystemModel
|
|---|
| 97 | */
|
|---|
| 98 | class QFSCompletor : public QCompleter {
|
|---|
| 99 | public:
|
|---|
| 100 | QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0)
|
|---|
| 101 | {
|
|---|
| 102 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 103 | setCaseSensitivity(Qt::CaseInsensitive);
|
|---|
| 104 | #endif
|
|---|
| 105 | }
|
|---|
| 106 | QString pathFromIndex(const QModelIndex &index) const;
|
|---|
| 107 | QStringList splitPath(const QString& path) const;
|
|---|
| 108 |
|
|---|
| 109 | QAbstractProxyModel *proxyModel;
|
|---|
| 110 | QFileSystemModel *sourceModel;
|
|---|
| 111 | };
|
|---|
| 112 | #endif // QT_NO_COMPLETER
|
|---|
| 113 |
|
|---|
| 114 | struct QFileDialogArgs
|
|---|
| 115 | {
|
|---|
| 116 | QFileDialogArgs() : parent(0), mode(QFileDialog::AnyFile) {}
|
|---|
| 117 |
|
|---|
| 118 | QWidget *parent;
|
|---|
| 119 | QString caption;
|
|---|
| 120 | QString directory;
|
|---|
| 121 | QString selection;
|
|---|
| 122 | QString filter;
|
|---|
| 123 | QFileDialog::FileMode mode;
|
|---|
| 124 | QFileDialog::Options options;
|
|---|
| 125 | };
|
|---|
| 126 |
|
|---|
| 127 | #define UrlRole (Qt::UserRole + 1)
|
|---|
| 128 |
|
|---|
| 129 | class Q_AUTOTEST_EXPORT QFileDialogPrivate : public QDialogPrivate
|
|---|
| 130 | {
|
|---|
| 131 | Q_DECLARE_PUBLIC(QFileDialog)
|
|---|
| 132 |
|
|---|
| 133 | public:
|
|---|
| 134 | QFileDialogPrivate() :
|
|---|
| 135 | #ifndef QT_NO_PROXYMODEL
|
|---|
| 136 | proxyModel(0),
|
|---|
| 137 | #endif
|
|---|
| 138 | model(0),
|
|---|
| 139 | fileMode(QFileDialog::AnyFile),
|
|---|
| 140 | acceptMode(QFileDialog::AcceptOpen),
|
|---|
| 141 | currentHistoryLocation(-1),
|
|---|
| 142 | renameAction(0),
|
|---|
| 143 | deleteAction(0),
|
|---|
| 144 | showHiddenAction(0),
|
|---|
| 145 | useDefaultCaption(true),
|
|---|
| 146 | defaultFileTypes(true),
|
|---|
| 147 | fileNameLabelExplicitlySat(false),
|
|---|
| 148 | nativeDialogInUse(false),
|
|---|
| 149 | #ifdef Q_WS_MAC
|
|---|
| 150 | mDelegate(0),
|
|---|
| 151 | #ifndef QT_MAC_USE_COCOA
|
|---|
| 152 | mDialog(0),
|
|---|
| 153 | mDialogStarted(false),
|
|---|
| 154 | mDialogClosed(true),
|
|---|
| 155 | #endif
|
|---|
| 156 | #endif
|
|---|
| 157 | qFileDialogUi(0)
|
|---|
| 158 | {}
|
|---|
| 159 |
|
|---|
| 160 | void createToolButtons();
|
|---|
| 161 | void createMenuActions();
|
|---|
| 162 | void createWidgets();
|
|---|
| 163 |
|
|---|
| 164 | void init(const QString &directory = QString(), const QString &nameFilter = QString(),
|
|---|
| 165 | const QString &caption = QString());
|
|---|
| 166 | bool itemViewKeyboardEvent(QKeyEvent *event);
|
|---|
| 167 | QString getEnvironmentVariable(const QString &string);
|
|---|
| 168 | static QString workingDirectory(const QString &path);
|
|---|
| 169 | static QString initialSelection(const QString &path);
|
|---|
| 170 | QStringList typedFiles() const;
|
|---|
| 171 | QStringList addDefaultSuffixToFiles(const QStringList filesToFix) const;
|
|---|
| 172 | bool removeDirectory(const QString &path);
|
|---|
| 173 |
|
|---|
| 174 | inline QModelIndex mapToSource(const QModelIndex &index) const;
|
|---|
| 175 | inline QModelIndex mapFromSource(const QModelIndex &index) const;
|
|---|
| 176 | inline QModelIndex rootIndex() const;
|
|---|
| 177 | inline void setRootIndex(const QModelIndex &index) const;
|
|---|
| 178 | inline QModelIndex select(const QModelIndex &index) const;
|
|---|
| 179 | inline QString rootPath() const;
|
|---|
| 180 |
|
|---|
| 181 | QLineEdit *lineEdit() const;
|
|---|
| 182 |
|
|---|
| 183 | int maxNameLength(const QString &path) {
|
|---|
| 184 | #if defined(Q_OS_UNIX)
|
|---|
| 185 | return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
|
|---|
| 186 | #elif defined(Q_OS_WIN)
|
|---|
| 187 | #ifndef Q_OS_WINCE
|
|---|
| 188 | DWORD maxLength;
|
|---|
| 189 | QString drive = path.left(3);
|
|---|
| 190 | if (QT_WA_INLINE(::GetVolumeInformationW(reinterpret_cast<const WCHAR *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0),
|
|---|
| 191 | ::GetVolumeInformationA(drive.toLocal8Bit().constData(), NULL, 0, NULL, &maxLength, NULL, NULL, 0)) == FALSE)
|
|---|
| 192 | return -1;
|
|---|
| 193 | return maxLength;
|
|---|
| 194 | #else
|
|---|
| 195 | Q_UNUSED(path);
|
|---|
| 196 | return MAX_PATH;
|
|---|
| 197 | #endif //Q_OS_WINCE
|
|---|
| 198 | #elif defined(Q_OS_OS2)
|
|---|
| 199 | Q_UNUSED(path);
|
|---|
| 200 | return CCHMAXPATH;
|
|---|
| 201 | #else
|
|---|
| 202 | Q_UNUSED(path);
|
|---|
| 203 | #endif
|
|---|
| 204 | return -1;
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | QString basename(const QString &path) const
|
|---|
| 208 | {
|
|---|
| 209 | int separator = QDir::toNativeSeparators(path).lastIndexOf(QDir::separator());
|
|---|
| 210 | if (separator != -1)
|
|---|
| 211 | return path.mid(separator + 1);
|
|---|
| 212 | return path;
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | QDir::Filters filterForMode(QDir::Filters filters) const
|
|---|
| 216 | {
|
|---|
| 217 | if (fileMode == QFileDialog::DirectoryOnly) {
|
|---|
| 218 | filters |= QDir::Drives | QDir::AllDirs | QDir::Dirs;
|
|---|
| 219 | filters &= ~QDir::Files;
|
|---|
| 220 | } else {
|
|---|
| 221 | filters |= QDir::Drives | QDir::AllDirs | QDir::Files | QDir::Dirs;
|
|---|
| 222 | }
|
|---|
| 223 | return filters;
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 | QAbstractItemView *currentView() const;
|
|---|
| 227 |
|
|---|
| 228 | static inline QString toInternal(const QString &path)
|
|---|
| 229 | {
|
|---|
| 230 | #if defined(Q_FS_FAT) || defined(Q_OS_OS2EMX)
|
|---|
| 231 | QString n(path);
|
|---|
| 232 | for (int i = 0; i < (int)n.length(); ++i)
|
|---|
| 233 | if (n[i] == QLatin1Char('\\')) n[i] = QLatin1Char('/');
|
|---|
| 234 | #if defined(Q_OS_WINCE)
|
|---|
| 235 | if ((n.size() > 1) && (n.startsWith(QLatin1String("//"))))
|
|---|
| 236 | n = n.mid(1);
|
|---|
| 237 | #endif
|
|---|
| 238 | return n;
|
|---|
| 239 | #else // the compile should optimize away this
|
|---|
| 240 | return path;
|
|---|
| 241 | #endif
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 | void setLastVisitedDirectory(const QString &dir);
|
|---|
| 245 | void retranslateWindowTitle();
|
|---|
| 246 | void retranslateStrings();
|
|---|
| 247 | void emitFilesSelected(const QStringList &files);
|
|---|
| 248 |
|
|---|
| 249 | void _q_goHome();
|
|---|
| 250 | void _q_pathChanged(const QString &);
|
|---|
| 251 | void _q_navigateBackward();
|
|---|
| 252 | void _q_navigateForward();
|
|---|
| 253 | void _q_navigateToParent();
|
|---|
| 254 | void _q_createDirectory();
|
|---|
| 255 | void _q_showListView();
|
|---|
| 256 | void _q_showDetailsView();
|
|---|
| 257 | void _q_showContextMenu(const QPoint &position);
|
|---|
| 258 | void _q_renameCurrent();
|
|---|
| 259 | void _q_deleteCurrent();
|
|---|
| 260 | void _q_showHidden();
|
|---|
| 261 | void _q_showHeader(QAction *);
|
|---|
| 262 | void _q_updateOkButton();
|
|---|
| 263 | void _q_currentChanged(const QModelIndex &index);
|
|---|
| 264 | void _q_enterDirectory(const QModelIndex &index);
|
|---|
| 265 | void _q_goToDirectory(const QString &);
|
|---|
| 266 | void _q_useNameFilter(int index);
|
|---|
| 267 | void _q_selectionChanged();
|
|---|
| 268 | void _q_goToUrl(const QUrl &url);
|
|---|
| 269 | void _q_autoCompleteFileName(const QString &);
|
|---|
| 270 | void _q_rowsInserted(const QModelIndex & parent);
|
|---|
| 271 | void _q_fileRenamed(const QString &path, const QString oldName, const QString newName);
|
|---|
| 272 |
|
|---|
| 273 | // layout
|
|---|
| 274 | #ifndef QT_NO_PROXYMODEL
|
|---|
| 275 | QAbstractProxyModel *proxyModel;
|
|---|
| 276 | #endif
|
|---|
| 277 |
|
|---|
| 278 | // data
|
|---|
| 279 | QStringList watching;
|
|---|
| 280 | QFileSystemModel *model;
|
|---|
| 281 | QFSCompletor *completer;
|
|---|
| 282 |
|
|---|
| 283 | QFileDialog::FileMode fileMode;
|
|---|
| 284 | QFileDialog::AcceptMode acceptMode;
|
|---|
| 285 | bool confirmOverwrite;
|
|---|
| 286 | QString defaultSuffix;
|
|---|
| 287 | QString setWindowTitle;
|
|---|
| 288 |
|
|---|
| 289 | QStringList currentHistory;
|
|---|
| 290 | int currentHistoryLocation;
|
|---|
| 291 |
|
|---|
| 292 | QAction *renameAction;
|
|---|
| 293 | QAction *deleteAction;
|
|---|
| 294 | QAction *showHiddenAction;
|
|---|
| 295 | QAction *newFolderAction;
|
|---|
| 296 |
|
|---|
| 297 | bool useDefaultCaption;
|
|---|
| 298 | bool defaultFileTypes;
|
|---|
| 299 | bool fileNameLabelExplicitlySat;
|
|---|
| 300 | QStringList nameFilters;
|
|---|
| 301 |
|
|---|
| 302 | // Members for using native dialogs:
|
|---|
| 303 | bool nativeDialogInUse;
|
|---|
| 304 | // setVisible_sys returns true if it ends up showing a native
|
|---|
| 305 | // dialog. Returning false means that a non-native dialog must be
|
|---|
| 306 | // used instead.
|
|---|
| 307 | bool canBeNativeDialog();
|
|---|
| 308 | bool setVisible_sys(bool visible);
|
|---|
| 309 | void deleteNativeDialog_sys();
|
|---|
| 310 | QDialog::DialogCode dialogResultCode_sys();
|
|---|
| 311 |
|
|---|
| 312 | void setDirectory_sys(const QString &directory);
|
|---|
| 313 | QString directory_sys() const;
|
|---|
| 314 | void selectFile_sys(const QString &filename);
|
|---|
| 315 | QStringList selectedFiles_sys() const;
|
|---|
| 316 | void setFilter_sys();
|
|---|
| 317 | void setNameFilters_sys(const QStringList &filters);
|
|---|
| 318 | void selectNameFilter_sys(const QString &filter);
|
|---|
| 319 | QString selectedNameFilter_sys() const;
|
|---|
| 320 | //////////////////////////////////////////////
|
|---|
| 321 |
|
|---|
| 322 | #if defined(Q_WS_MAC)
|
|---|
| 323 | void *mDelegate;
|
|---|
| 324 | #ifndef QT_MAC_USE_COCOA
|
|---|
| 325 | NavDialogRef mDialog;
|
|---|
| 326 | bool mDialogStarted;
|
|---|
| 327 | bool mDialogClosed;
|
|---|
| 328 | QString mCurrentLocation;
|
|---|
| 329 | QString mCurrentSelection;
|
|---|
| 330 | QStringList mCurrentSelectionList;
|
|---|
| 331 |
|
|---|
| 332 | struct QtMacFilterName {
|
|---|
| 333 | QString description;
|
|---|
| 334 | QString regexp;
|
|---|
| 335 | QString filter;
|
|---|
| 336 | };
|
|---|
| 337 | struct QtMacNavFilterInfo {
|
|---|
| 338 | QtMacNavFilterInfo() : currentSelection(-1) {}
|
|---|
| 339 | int currentSelection;
|
|---|
| 340 | QList<QtMacFilterName> filters;
|
|---|
| 341 | } filterInfo;
|
|---|
| 342 |
|
|---|
| 343 | static void qt_mac_filedialog_event_proc(const NavEventCallbackMessage msg, NavCBRecPtr p,
|
|---|
| 344 | NavCallBackUserData data);
|
|---|
| 345 | static Boolean qt_mac_filedialog_filter_proc(AEDesc *theItem, void *info, void *data,
|
|---|
| 346 | NavFilterModes);
|
|---|
| 347 | bool showCarbonNavServicesDialog();
|
|---|
| 348 | bool hideCarbonNavServicesDialog();
|
|---|
| 349 | void createNavServicesDialog();
|
|---|
| 350 | #else
|
|---|
| 351 | bool showCocoaFilePanel();
|
|---|
| 352 | bool hideCocoaFilePanel();
|
|---|
| 353 | #endif
|
|---|
| 354 | void createNSOpenSavePanelDelegate();
|
|---|
| 355 | void QNSOpenSavePanelDelegate_selectionChanged(const QString &newPath);
|
|---|
| 356 | void QNSOpenSavePanelDelegate_panelClosed(bool accepted);
|
|---|
| 357 | void QNSOpenSavePanelDelegate_directoryEntered(const QString &newDir);
|
|---|
| 358 | void QNSOpenSavePanelDelegate_filterSelected(int menuIndex);
|
|---|
| 359 | void _q_macRunNativeAppModalPanel();
|
|---|
| 360 | void mac_nativeDialogModalHelp();
|
|---|
| 361 | #endif
|
|---|
| 362 |
|
|---|
| 363 | Ui_QFileDialog *qFileDialogUi;
|
|---|
| 364 |
|
|---|
| 365 | QString acceptLabel;
|
|---|
| 366 |
|
|---|
| 367 | QPointer<QObject> receiverToDisconnectOnClose;
|
|---|
| 368 | QByteArray memberToDisconnectOnClose;
|
|---|
| 369 | QByteArray signalToDisconnectOnClose;
|
|---|
| 370 |
|
|---|
| 371 | QFileDialog::Options opts;
|
|---|
| 372 | };
|
|---|
| 373 |
|
|---|
| 374 | class QFileDialogLineEdit : public QLineEdit
|
|---|
| 375 | {
|
|---|
| 376 | public:
|
|---|
| 377 | QFileDialogLineEdit(QWidget *parent = 0) : QLineEdit(parent), hideOnEsc(false), d_ptr(0){}
|
|---|
| 378 | void init(QFileDialogPrivate *d_pointer) {d_ptr = d_pointer; }
|
|---|
| 379 | void keyPressEvent(QKeyEvent *e);
|
|---|
| 380 | bool hideOnEsc;
|
|---|
| 381 | private:
|
|---|
| 382 | QFileDialogPrivate *d_ptr;
|
|---|
| 383 | };
|
|---|
| 384 |
|
|---|
| 385 | class QFileDialogComboBox : public QComboBox
|
|---|
| 386 | {
|
|---|
| 387 | public:
|
|---|
| 388 | QFileDialogComboBox(QWidget *parent = 0) : QComboBox(parent), urlModel(0) {}
|
|---|
| 389 | void init(QFileDialogPrivate *d_pointer);
|
|---|
| 390 | void showPopup();
|
|---|
| 391 | void setHistory(const QStringList &paths);
|
|---|
| 392 | QStringList history() const { return m_history; }
|
|---|
| 393 | void paintEvent(QPaintEvent *);
|
|---|
| 394 |
|
|---|
| 395 | private:
|
|---|
| 396 | QUrlModel *urlModel;
|
|---|
| 397 | QFileDialogPrivate *d_ptr;
|
|---|
| 398 | QStringList m_history;
|
|---|
| 399 | };
|
|---|
| 400 |
|
|---|
| 401 | class QFileDialogListView : public QListView
|
|---|
| 402 | {
|
|---|
| 403 | public:
|
|---|
| 404 | QFileDialogListView(QWidget *parent = 0);
|
|---|
| 405 | void init(QFileDialogPrivate *d_pointer);
|
|---|
| 406 | QSize sizeHint() const;
|
|---|
| 407 | protected:
|
|---|
| 408 | void keyPressEvent(QKeyEvent *e);
|
|---|
| 409 | private:
|
|---|
| 410 | QFileDialogPrivate *d_ptr;
|
|---|
| 411 | };
|
|---|
| 412 |
|
|---|
| 413 | class QFileDialogTreeView : public QTreeView
|
|---|
| 414 | {
|
|---|
| 415 | public:
|
|---|
| 416 | QFileDialogTreeView(QWidget *parent);
|
|---|
| 417 | void init(QFileDialogPrivate *d_pointer);
|
|---|
| 418 | QSize sizeHint() const;
|
|---|
| 419 |
|
|---|
| 420 | protected:
|
|---|
| 421 | void keyPressEvent(QKeyEvent *e);
|
|---|
| 422 | private:
|
|---|
| 423 | QFileDialogPrivate *d_ptr;
|
|---|
| 424 | };
|
|---|
| 425 |
|
|---|
| 426 | inline QModelIndex QFileDialogPrivate::mapToSource(const QModelIndex &index) const {
|
|---|
| 427 | #ifdef QT_NO_PROXYMODEL
|
|---|
| 428 | return index;
|
|---|
| 429 | #else
|
|---|
| 430 | return proxyModel ? proxyModel->mapToSource(index) : index;
|
|---|
| 431 | #endif
|
|---|
| 432 | }
|
|---|
| 433 | inline QModelIndex QFileDialogPrivate::mapFromSource(const QModelIndex &index) const {
|
|---|
| 434 | #ifdef QT_NO_PROXYMODEL
|
|---|
| 435 | return index;
|
|---|
| 436 | #else
|
|---|
| 437 | return proxyModel ? proxyModel->mapFromSource(index) : index;
|
|---|
| 438 | #endif
|
|---|
| 439 | }
|
|---|
| 440 |
|
|---|
| 441 | inline QString QFileDialogPrivate::rootPath() const {
|
|---|
| 442 | return model->rootPath();
|
|---|
| 443 | }
|
|---|
| 444 |
|
|---|
| 445 | #ifndef Q_WS_MAC
|
|---|
| 446 | // Dummies for platforms that don't use native dialogs:
|
|---|
| 447 | inline void QFileDialogPrivate::deleteNativeDialog_sys() {}
|
|---|
| 448 | inline bool QFileDialogPrivate::setVisible_sys(bool) { return false; }
|
|---|
| 449 | inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys(){ return QDialog::Rejected; }
|
|---|
| 450 | inline void QFileDialogPrivate::setDirectory_sys(const QString &) {}
|
|---|
| 451 | inline QString QFileDialogPrivate::directory_sys() const { return QString(); }
|
|---|
| 452 | inline void QFileDialogPrivate::selectFile_sys(const QString &) {}
|
|---|
| 453 | inline QStringList QFileDialogPrivate::selectedFiles_sys() const { return QStringList(); }
|
|---|
| 454 | inline void QFileDialogPrivate::setFilter_sys() {}
|
|---|
| 455 | inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &) {}
|
|---|
| 456 | inline void QFileDialogPrivate::selectNameFilter_sys(const QString &) {}
|
|---|
| 457 | inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return QString(); }
|
|---|
| 458 | #endif
|
|---|
| 459 |
|
|---|
| 460 | QT_END_NAMESPACE
|
|---|
| 461 |
|
|---|
| 462 | #endif // QT_NO_FILEDIALOG
|
|---|
| 463 |
|
|---|
| 464 | #endif // QFILEDIALOG_P_H
|
|---|