dialogs/qfiledialog.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include <qvariant.h> -
43#include <private/qwidgetitemdata_p.h> -
44#include "qfiledialog.h" -
45 -
46#ifndef QT_NO_FILEDIALOG -
47#include "qfiledialog_p.h" -
48#include <private/qguiapplication_p.h> -
49#include <qfontmetrics.h> -
50#include <qaction.h> -
51#include <qheaderview.h> -
52#include <qshortcut.h> -
53#include <qgridlayout.h> -
54#include <qmenu.h> -
55#include <qmessagebox.h> -
56#include <qinputdialog.h> -
57#include <stdlib.h> -
58#include <qsettings.h> -
59#include <qdebug.h> -
60#include <qapplication.h> -
61#include <qstylepainter.h> -
62#if !defined(Q_OS_WINCE) -
63#include "ui_qfiledialog.h" -
64#else -
65#define Q_EMBEDDED_SMALLSCREEN -
66#include "ui_qfiledialog_embedded.h" -
67#if defined(Q_OS_WINCE) -
68extern bool qt_priv_ptr_valid; -
69#endif -
70#endif -
71#if defined(Q_OS_UNIX) -
72#include <pwd.h> -
73#elif defined(Q_OS_WIN) -
74# include <QtCore/qt_windows.h> -
75#endif -
76 -
77QT_BEGIN_NAMESPACE -
78 -
79Q_GLOBAL_STATIC(QString, lastVisitedDir)
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:587
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:586
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-587
80 -
81/* -
82 \internal -
83 -
84 Exported hooks that can be used to customize the static functions. -
85 */ -
86typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options); -
87Q_WIDGETS_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook = 0; -
88 -
89typedef QString (*_qt_filedialog_open_filename_hook)(QWidget * parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); -
90Q_WIDGETS_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook = 0; -
91 -
92typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); -
93Q_WIDGETS_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook = 0; -
94 -
95typedef QString (*_qt_filedialog_save_filename_hook)(QWidget * parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); -
96Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook = 0; -
97 -
98/*! -
99 \class QFileDialog -
100 \brief The QFileDialog class provides a dialog that allow users to select files or directories. -
101 \ingroup standard-dialogs -
102 \inmodule QtWidgets -
103 -
104 The QFileDialog class enables a user to traverse the file system in -
105 order to select one or many files or a directory. -
106 -
107 The easiest way to create a QFileDialog is to use the static -
108 functions. On Windows, Mac OS X, KDE and GNOME, these static functions will -
109 call the native file dialog when possible. -
110 -
111 \snippet code/src_gui_dialogs_qfiledialog.cpp 0 -
112 -
113 In the above example, a modal QFileDialog is created using a static -
114 function. The dialog initially displays the contents of the "/home/jana" -
115 directory, and displays files matching the patterns given in the -
116 string "Image Files (*.png *.jpg *.bmp)". The parent of the file dialog -
117 is set to \e this, and the window title is set to "Open Image". -
118 -
119 If you want to use multiple filters, separate each one with -
120 \e two semicolons. For example: -
121 -
122 \snippet code/src_gui_dialogs_qfiledialog.cpp 1 -
123 -
124 You can create your own QFileDialog without using the static -
125 functions. By calling setFileMode(), you can specify what the user must -
126 select in the dialog: -
127 -
128 \snippet code/src_gui_dialogs_qfiledialog.cpp 2 -
129 -
130 In the above example, the mode of the file dialog is set to -
131 AnyFile, meaning that the user can select any file, or even specify a -
132 file that doesn't exist. This mode is useful for creating a -
133 "Save As" file dialog. Use ExistingFile if the user must select an -
134 existing file, or \l Directory if only a directory may be selected. -
135 See the \l QFileDialog::FileMode enum for the complete list of modes. -
136 -
137 The fileMode property contains the mode of operation for the dialog; -
138 this indicates what types of objects the user is expected to select. -
139 Use setNameFilter() to set the dialog's file filter. For example: -
140 -
141 \snippet code/src_gui_dialogs_qfiledialog.cpp 3 -
142 -
143 In the above example, the filter is set to \c{"Images (*.png *.xpm *.jpg)"}, -
144 this means that only files with the extension \c png, \c xpm, -
145 or \c jpg will be shown in the QFileDialog. You can apply -
146 several filters by using setNameFilters(). Use selectNameFilter() to select -
147 one of the filters you've given as the file dialog's default filter. -
148 -
149 The file dialog has two view modes: \l{QFileDialog::}{List} and -
150 \l{QFileDialog::}{Detail}. -
151 \l{QFileDialog::}{List} presents the contents of the current directory -
152 as a list of file and directory names. \l{QFileDialog::}{Detail} also -
153 displays a list of file and directory names, but provides additional -
154 information alongside each name, such as the file size and modification -
155 date. Set the mode with setViewMode(): -
156 -
157 \snippet code/src_gui_dialogs_qfiledialog.cpp 4 -
158 -
159 The last important function you will need to use when creating your -
160 own file dialog is selectedFiles(). -
161 -
162 \snippet code/src_gui_dialogs_qfiledialog.cpp 5 -
163 -
164 In the above example, a modal file dialog is created and shown. If -
165 the user clicked OK, the file they selected is put in \c fileName. -
166 -
167 The dialog's working directory can be set with setDirectory(). -
168 Each file in the current directory can be selected using -
169 the selectFile() function. -
170 -
171 The \l{dialogs/standarddialogs}{Standard Dialogs} example shows -
172 how to use QFileDialog as well as other built-in Qt dialogs. -
173 -
174 \sa QDir, QFileInfo, QFile, QColorDialog, QFontDialog, {Standard Dialogs Example}, -
175 {Application Example} -
176*/ -
177 -
178/*! -
179 \enum QFileDialog::AcceptMode -
180 -
181 \value AcceptOpen -
182 \value AcceptSave -
183*/ -
184 -
185/*! -
186 \enum QFileDialog::ViewMode -
187 -
188 This enum describes the view mode of the file dialog; i.e. what -
189 information about each file will be displayed. -
190 -
191 \value Detail Displays an icon, a name, and details for each item in -
192 the directory. -
193 \value List Displays only an icon and a name for each item in the -
194 directory. -
195 -
196 \sa setViewMode() -
197*/ -
198 -
199/*! -
200 \enum QFileDialog::FileMode -
201 -
202 This enum is used to indicate what the user may select in the file -
203 dialog; i.e. what the dialog will return if the user clicks OK. -
204 -
205 \value AnyFile The name of a file, whether it exists or not. -
206 \value ExistingFile The name of a single existing file. -
207 \value Directory The name of a directory. Both files and -
208 directories are displayed. -
209 \value ExistingFiles The names of zero or more existing files. -
210 -
211 This value is obsolete since Qt 4.5: -
212 -
213 \value DirectoryOnly Use \c Directory and setOption(ShowDirsOnly, true) instead. -
214 -
215 \sa setFileMode() -
216*/ -
217 -
218/*! -
219 \enum QFileDialog::Option -
220 -
221 \value ShowDirsOnly Only show directories in the file dialog. By -
222 default both files and directories are shown. (Valid only in the -
223 \l Directory file mode.) -
224 -
225 \value DontResolveSymlinks Don't resolve symlinks in the file -
226 dialog. By default symlinks are resolved. -
227 -
228 \value DontConfirmOverwrite Don't ask for confirmation if an -
229 existing file is selected. By default confirmation is requested. -
230 -
231 \value DontUseNativeDialog Don't use the native file dialog. By -
232 default, the native file dialog is used unless you use a subclass -
233 of QFileDialog that contains the Q_OBJECT macro. -
234 -
235 \value ReadOnly Indicates that the model is readonly. -
236 -
237 \value HideNameFilterDetails Indicates if the file name filter details are -
238 hidden or not. -
239 -
240 \value DontUseSheet In previous versions of Qt, the static -
241 functions would create a sheet by default if the static function -
242 was given a parent. This is no longer supported and does nothing in Qt 4.5, The -
243 static functions will always be an application modal dialog. If -
244 you want to use sheets, use QFileDialog::open() instead. -
245 -
246*/ -
247 -
248/*! -
249 \enum QFileDialog::DialogLabel -
250 -
251 \value LookIn -
252 \value FileName -
253 \value FileType -
254 \value Accept -
255 \value Reject -
256*/ -
257 -
258/*! -
259 \fn void QFileDialog::filesSelected(const QStringList &selected) -
260 -
261 When the selection changes and the dialog is accepted, this signal is -
262 emitted with the (possibly empty) list of \a selected files. -
263 -
264 \sa currentChanged(), QDialog::Accepted -
265*/ -
266 -
267 -
268/*! -
269 \fn void QFileDialog::fileSelected(const QString &file) -
270 -
271 When the selection changes and the dialog is accepted, this signal is -
272 emitted with the (possibly empty) selected \a file. -
273 -
274 \sa currentChanged(), QDialog::Accepted -
275*/ -
276 -
277 -
278/*! -
279 \fn void QFileDialog::currentChanged(const QString &path) -
280 -
281 When the current file changes, this signal is emitted with the -
282 new file name as the \a path parameter. -
283 -
284 \sa filesSelected() -
285*/ -
286 -
287/*! -
288 \fn void QFileDialog::directoryEntered(const QString &directory) -
289 \since 4.3 -
290 -
291 This signal is emitted when the user enters a \a directory. -
292*/ -
293 -
294/*! -
295 \fn void QFileDialog::filterSelected(const QString &filter) -
296 \since 4.3 -
297 -
298 This signal is emitted when the user selects a \a filter. -
299*/ -
300 -
301//#if defined(Q_WS_WIN) || defined(Q_WS_MAC) -
302//bool Q_WIDGETS_EXPORT qt_use_native_dialogs = true; // for the benefit of testing tools, until we have a proper API -
303//#endif -
304 -
305QT_BEGIN_INCLUDE_NAMESPACE -
306#ifdef Q_WS_WIN -
307#include <qwindowsstyle_p.h> -
308#endif -
309#include <qshortcut.h> -
310#ifdef Q_WS_MAC -
311#include <qmacstyle_mac_p.h> -
312#endif -
313QT_END_INCLUDE_NAMESPACE -
314 -
315/*! -
316 \fn QFileDialog::QFileDialog(QWidget *parent, Qt::WindowFlags flags) -
317 -
318 Constructs a file dialog with the given \a parent and widget \a flags. -
319*/ -
320QFileDialog::QFileDialog(QWidget *parent, Qt::WindowFlags f) -
321 : QDialog(*new QFileDialogPrivate, parent, f) -
322{ -
323 Q_D(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
324 d->init();
never executed (the execution status of this line is deduced): d->init();
-
325 d->lineEdit()->selectAll();
never executed (the execution status of this line is deduced): d->lineEdit()->selectAll();
-
326}
never executed: }
0
327 -
328/*! -
329 Constructs a file dialog with the given \a parent and \a caption that -
330 initially displays the contents of the specified \a directory. -
331 The contents of the directory are filtered before being shown in the -
332 dialog, using a semicolon-separated list of filters specified by -
333 \a filter. -
334*/ -
335QFileDialog::QFileDialog(QWidget *parent, -
336 const QString &caption, -
337 const QString &directory, -
338 const QString &filter) -
339 : QDialog(*new QFileDialogPrivate, parent, 0) -
340{ -
341 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
342 d->init(directory, filter, caption);
executed (the execution status of this line is deduced): d->init(directory, filter, caption);
-
343 d->lineEdit()->selectAll();
executed (the execution status of this line is deduced): d->lineEdit()->selectAll();
-
344}
executed: }
Execution Count:119
119
345 -
346/*! -
347 \internal -
348*/ -
349QFileDialog::QFileDialog(const QFileDialogArgs &args) -
350 : QDialog(*new QFileDialogPrivate, args.parent, 0) -
351{ -
352 Q_D(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
353 d->init(args.directory, args.filter, args.caption);
never executed (the execution status of this line is deduced): d->init(args.directory, args.filter, args.caption);
-
354 setFileMode(args.mode);
never executed (the execution status of this line is deduced): setFileMode(args.mode);
-
355 setOptions(args.options);
never executed (the execution status of this line is deduced): setOptions(args.options);
-
356 selectFile(args.selection);
never executed (the execution status of this line is deduced): selectFile(args.selection);
-
357 d->lineEdit()->selectAll();
never executed (the execution status of this line is deduced): d->lineEdit()->selectAll();
-
358}
never executed: }
0
359 -
360/*! -
361 Destroys the file dialog. -
362*/ -
363QFileDialog::~QFileDialog() -
364{ -
365#ifndef QT_NO_SETTINGS -
366 QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
executed (the execution status of this line is deduced): QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
-
367 settings.beginGroup(QLatin1String("Qt"));
executed (the execution status of this line is deduced): settings.beginGroup(QLatin1String("Qt"));
-
368 settings.setValue(QLatin1String("filedialog"), saveState());
executed (the execution status of this line is deduced): settings.setValue(QLatin1String("filedialog"), saveState());
-
369#endif -
370}
executed: }
Execution Count:119
119
371 -
372/*! -
373 \since 4.3 -
374 Sets the \a urls that are located in the sidebar. -
375 -
376 For instance: -
377 -
378 \snippet filedialogurls.cpp 0 -
379 -
380 The file dialog will then look like this: -
381 -
382 \image filedialogurls.png -
383 -
384 \sa sidebarUrls() -
385*/ -
386void QFileDialog::setSidebarUrls(const QList<QUrl> &urls) -
387{ -
388 Q_D(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
389 d->qFileDialogUi->sidebar->setUrls(urls);
never executed (the execution status of this line is deduced): d->qFileDialogUi->sidebar->setUrls(urls);
-
390}
never executed: }
0
391 -
392/*! -
393 \since 4.3 -
394 Returns a list of urls that are currently in the sidebar -
395*/ -
396QList<QUrl> QFileDialog::sidebarUrls() const -
397{ -
398 Q_D(const QFileDialog);
never executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
399 return d->qFileDialogUi->sidebar->urls();
never executed: return d->qFileDialogUi->sidebar->urls();
0
400} -
401 -
402static const qint32 QFileDialogMagic = 0xbe; -
403 -
404/*! -
405 \since 4.3 -
406 Saves the state of the dialog's layout, history and current directory. -
407 -
408 Typically this is used in conjunction with QSettings to remember the size -
409 for a future session. A version number is stored as part of the data. -
410*/ -
411QByteArray QFileDialog::saveState() const -
412{ -
413 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
414 int version = 3;
executed (the execution status of this line is deduced): int version = 3;
-
415 QByteArray data;
executed (the execution status of this line is deduced): QByteArray data;
-
416 QDataStream stream(&data, QIODevice::WriteOnly);
executed (the execution status of this line is deduced): QDataStream stream(&data, QIODevice::WriteOnly);
-
417 -
418 stream << qint32(QFileDialogMagic);
executed (the execution status of this line is deduced): stream << qint32(QFileDialogMagic);
-
419 stream << qint32(version);
executed (the execution status of this line is deduced): stream << qint32(version);
-
420 stream << d->qFileDialogUi->splitter->saveState();
executed (the execution status of this line is deduced): stream << d->qFileDialogUi->splitter->saveState();
-
421 stream << d->qFileDialogUi->sidebar->urls();
executed (the execution status of this line is deduced): stream << d->qFileDialogUi->sidebar->urls();
-
422 stream << history();
executed (the execution status of this line is deduced): stream << history();
-
423 stream << *lastVisitedDir();
executed (the execution status of this line is deduced): stream << *lastVisitedDir();
-
424 stream << d->qFileDialogUi->treeView->header()->saveState();
executed (the execution status of this line is deduced): stream << d->qFileDialogUi->treeView->header()->saveState();
-
425 stream << qint32(viewMode());
executed (the execution status of this line is deduced): stream << qint32(viewMode());
-
426 return data;
executed: return data;
Execution Count:119
119
427} -
428 -
429/*! -
430 \since 4.3 -
431 Restores the dialogs's layout, history and current directory to the \a state specified. -
432 -
433 Typically this is used in conjunction with QSettings to restore the size -
434 from a past session. -
435 -
436 Returns false if there are errors -
437*/ -
438bool QFileDialog::restoreState(const QByteArray &state) -
439{ -
440 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
441 int version = 3;
executed (the execution status of this line is deduced): int version = 3;
-
442 QByteArray sd = state;
executed (the execution status of this line is deduced): QByteArray sd = state;
-
443 QDataStream stream(&sd, QIODevice::ReadOnly);
executed (the execution status of this line is deduced): QDataStream stream(&sd, QIODevice::ReadOnly);
-
444 if (stream.atEnd())
evaluated: stream.atEnd()
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:61
58-61
445 return false;
executed: return false;
Execution Count:58
58
446 QByteArray splitterState;
executed (the execution status of this line is deduced): QByteArray splitterState;
-
447 QByteArray headerData;
executed (the execution status of this line is deduced): QByteArray headerData;
-
448 QList<QUrl> bookmarks;
executed (the execution status of this line is deduced): QList<QUrl> bookmarks;
-
449 QStringList history;
executed (the execution status of this line is deduced): QStringList history;
-
450 QString currentDirectory;
executed (the execution status of this line is deduced): QString currentDirectory;
-
451 qint32 marker;
executed (the execution status of this line is deduced): qint32 marker;
-
452 qint32 v;
executed (the execution status of this line is deduced): qint32 v;
-
453 qint32 viewMode;
executed (the execution status of this line is deduced): qint32 viewMode;
-
454 stream >> marker;
executed (the execution status of this line is deduced): stream >> marker;
-
455 stream >> v;
executed (the execution status of this line is deduced): stream >> v;
-
456 if (marker != QFileDialogMagic || v != version)
partially evaluated: marker != QFileDialogMagic
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
partially evaluated: v != version
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
0-61
457 return false;
never executed: return false;
0
458 -
459 stream >> splitterState
executed (the execution status of this line is deduced): stream >> splitterState
-
460 >> bookmarks
executed (the execution status of this line is deduced): >> bookmarks
-
461 >> history
executed (the execution status of this line is deduced): >> history
-
462 >> currentDirectory
executed (the execution status of this line is deduced): >> currentDirectory
-
463 >> headerData
executed (the execution status of this line is deduced): >> headerData
-
464 >> viewMode;
executed (the execution status of this line is deduced): >> viewMode;
-
465 -
466 if (!d->qFileDialogUi->splitter->restoreState(splitterState))
partially evaluated: !d->qFileDialogUi->splitter->restoreState(splitterState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
0-61
467 return false;
never executed: return false;
0
468 QList<int> list = d->qFileDialogUi->splitter->sizes();
executed (the execution status of this line is deduced): QList<int> list = d->qFileDialogUi->splitter->sizes();
-
469 if (list.count() >= 2 && list.at(0) == 0 && list.at(1) == 0) {
partially evaluated: list.count() >= 2
TRUEFALSE
yes
Evaluation Count:61
no
Evaluation Count:0
partially evaluated: list.at(0) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
never evaluated: list.at(1) == 0
0-61
470 for (int i = 0; i < list.count(); ++i)
never evaluated: i < list.count()
0
471 list[i] = d->qFileDialogUi->splitter->widget(i)->sizeHint().width();
never executed: list[i] = d->qFileDialogUi->splitter->widget(i)->sizeHint().width();
0
472 d->qFileDialogUi->splitter->setSizes(list);
never executed (the execution status of this line is deduced): d->qFileDialogUi->splitter->setSizes(list);
-
473 }
never executed: }
0
474 -
475 d->qFileDialogUi->sidebar->setUrls(bookmarks);
executed (the execution status of this line is deduced): d->qFileDialogUi->sidebar->setUrls(bookmarks);
-
476 while (history.count() > 5)
partially evaluated: history.count() > 5
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
0-61
477 history.pop_front();
never executed: history.pop_front();
0
478 setHistory(history);
executed (the execution status of this line is deduced): setHistory(history);
-
479 setDirectory(lastVisitedDir()->isEmpty() ? currentDirectory : *lastVisitedDir());
executed (the execution status of this line is deduced): setDirectory(lastVisitedDir()->isEmpty() ? currentDirectory : *lastVisitedDir());
-
480 QHeaderView *headerView = d->qFileDialogUi->treeView->header();
executed (the execution status of this line is deduced): QHeaderView *headerView = d->qFileDialogUi->treeView->header();
-
481 if (!headerView->restoreState(headerData))
partially evaluated: !headerView->restoreState(headerData)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
0-61
482 return false;
never executed: return false;
0
483 -
484 QList<QAction*> actions = headerView->actions();
executed (the execution status of this line is deduced): QList<QAction*> actions = headerView->actions();
-
485 QAbstractItemModel *abstractModel = d->model;
executed (the execution status of this line is deduced): QAbstractItemModel *abstractModel = d->model;
-
486#ifndef QT_NO_PROXYMODEL -
487 if (d->proxyModel)
partially evaluated: d->proxyModel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:61
0-61
488 abstractModel = d->proxyModel;
never executed: abstractModel = d->proxyModel;
0
489#endif -
490 int total = qMin(abstractModel->columnCount(QModelIndex()), actions.count() + 1);
executed (the execution status of this line is deduced): int total = qMin(abstractModel->columnCount(QModelIndex()), actions.count() + 1);
-
491 for (int i = 1; i < total; ++i)
evaluated: i < total
TRUEFALSE
yes
Evaluation Count:183
yes
Evaluation Count:61
61-183
492 actions.at(i - 1)->setChecked(!headerView->isSectionHidden(i));
executed: actions.at(i - 1)->setChecked(!headerView->isSectionHidden(i));
Execution Count:183
183
493 -
494 setViewMode(ViewMode(viewMode));
executed (the execution status of this line is deduced): setViewMode(ViewMode(viewMode));
-
495 return true;
executed: return true;
Execution Count:61
61
496} -
497 -
498/*! -
499 \reimp -
500*/ -
501void QFileDialog::changeEvent(QEvent *e) -
502{ -
503 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
504 if (e->type() == QEvent::LanguageChange) {
partially evaluated: e->type() == QEvent::LanguageChange
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:152
0-152
505 d->retranslateWindowTitle();
never executed (the execution status of this line is deduced): d->retranslateWindowTitle();
-
506 d->retranslateStrings();
never executed (the execution status of this line is deduced): d->retranslateStrings();
-
507 }
never executed: }
0
508 QDialog::changeEvent(e);
executed (the execution status of this line is deduced): QDialog::changeEvent(e);
-
509}
executed: }
Execution Count:152
152
510 -
511QFileDialogPrivate::QFileDialogPrivate() -
512 : -
513#ifndef QT_NO_PROXYMODEL -
514 proxyModel(0), -
515#endif -
516 model(0), -
517 currentHistoryLocation(-1), -
518 renameAction(0), -
519 deleteAction(0), -
520 showHiddenAction(0), -
521 useDefaultCaption(true), -
522 defaultFileTypes(true), -
523 qFileDialogUi(0), -
524 options(new QFileDialogOptions) -
525{ -
526}
executed: }
Execution Count:119
119
527 -
528QFileDialogPrivate::~QFileDialogPrivate() -
529{ -
530} -
531 -
532void QFileDialogPrivate::initHelper(QPlatformDialogHelper *h) -
533{ -
534 QFileDialog *d = q_func();
never executed (the execution status of this line is deduced): QFileDialog *d = q_func();
-
535 QObject::connect(h, SIGNAL(fileSelected(QString)), d, SIGNAL(fileSelected(QString)));
never executed (the execution status of this line is deduced): QObject::connect(h, "2""fileSelected(QString)", d, "2""fileSelected(QString)");
-
536 QObject::connect(h, SIGNAL(filesSelected(QStringList)), d, SIGNAL(filesSelected(QStringList)));
never executed (the execution status of this line is deduced): QObject::connect(h, "2""filesSelected(QStringList)", d, "2""filesSelected(QStringList)");
-
537 QObject::connect(h, SIGNAL(currentChanged(QString)), d, SIGNAL(currentChanged(QString)));
never executed (the execution status of this line is deduced): QObject::connect(h, "2""currentChanged(QString)", d, "2""currentChanged(QString)");
-
538 QObject::connect(h, SIGNAL(directoryEntered(QString)), d, SIGNAL(directoryEntered(QString)));
never executed (the execution status of this line is deduced): QObject::connect(h, "2""directoryEntered(QString)", d, "2""directoryEntered(QString)");
-
539 QObject::connect(h, SIGNAL(filterSelected(QString)), d, SIGNAL(filterSelected(QString)));
never executed (the execution status of this line is deduced): QObject::connect(h, "2""filterSelected(QString)", d, "2""filterSelected(QString)");
-
540 static_cast<QPlatformFileDialogHelper *>(h)->setOptions(options);
never executed (the execution status of this line is deduced): static_cast<QPlatformFileDialogHelper *>(h)->setOptions(options);
-
541}
never executed: }
0
542 -
543void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *) -
544{ -
545 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
546 options->setWindowTitle(q->windowTitle());
never executed (the execution status of this line is deduced): options->setWindowTitle(q->windowTitle());
-
547 options->setViewMode(static_cast<QFileDialogOptions::ViewMode>(q->viewMode()));
never executed (the execution status of this line is deduced): options->setViewMode(static_cast<QFileDialogOptions::ViewMode>(q->viewMode()));
-
548 options->setHistory(q->history());
never executed (the execution status of this line is deduced): options->setHistory(q->history());
-
549 options->setSidebarUrls(qFileDialogUi->sidebar->urls());
never executed (the execution status of this line is deduced): options->setSidebarUrls(qFileDialogUi->sidebar->urls());
-
550 const QDir directory = q->directory();
never executed (the execution status of this line is deduced): const QDir directory = q->directory();
-
551 options->setInitialDirectory(directory.exists() ?
never executed (the execution status of this line is deduced): options->setInitialDirectory(directory.exists() ?
-
552 directory.absolutePath() :
never executed (the execution status of this line is deduced): directory.absolutePath() :
-
553 QString());
never executed (the execution status of this line is deduced): QString());
-
554 options->setInitiallySelectedNameFilter(q->selectedNameFilter());
never executed (the execution status of this line is deduced): options->setInitiallySelectedNameFilter(q->selectedNameFilter());
-
555 options->setInitiallySelectedFiles(userSelectedFiles());
never executed (the execution status of this line is deduced): options->setInitiallySelectedFiles(userSelectedFiles());
-
556}
never executed: }
0
557 -
558void QFileDialogPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *) -
559{ -
560 if (code == QDialog::Accepted) {
never evaluated: code == QDialog::Accepted
0
561 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
562 q->setViewMode(static_cast<QFileDialog::ViewMode>(options->viewMode()));
never executed (the execution status of this line is deduced): q->setViewMode(static_cast<QFileDialog::ViewMode>(options->viewMode()));
-
563 q->setSidebarUrls(options->sidebarUrls());
never executed (the execution status of this line is deduced): q->setSidebarUrls(options->sidebarUrls());
-
564 q->setHistory(options->history());
never executed (the execution status of this line is deduced): q->setHistory(options->history());
-
565 }
never executed: }
0
566}
never executed: }
0
567 -
568void QFileDialogPrivate::retranslateWindowTitle() -
569{ -
570 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
571 if (!useDefaultCaption || setWindowTitle != q->windowTitle())
evaluated: !useDefaultCaption
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:216
evaluated: setWindowTitle != q->windowTitle()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:215
1-216
572 return;
executed: return;
Execution Count:52
52
573 if (q->acceptMode() == QFileDialog::AcceptOpen) {
evaluated: q->acceptMode() == QFileDialog::AcceptOpen
TRUEFALSE
yes
Evaluation Count:212
yes
Evaluation Count:3
3-212
574 const QFileDialog::FileMode fileMode = q->fileMode();
executed (the execution status of this line is deduced): const QFileDialog::FileMode fileMode = q->fileMode();
-
575 if (fileMode == QFileDialog::DirectoryOnly || fileMode == QFileDialog::Directory)
evaluated: fileMode == QFileDialog::DirectoryOnly
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:210
evaluated: fileMode == QFileDialog::Directory
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:207
2-210
576 q->setWindowTitle(QFileDialog::tr("Find Directory"));
executed: q->setWindowTitle(QFileDialog::tr("Find Directory"));
Execution Count:5
5
577 else -
578 q->setWindowTitle(QFileDialog::tr("Open"));
executed: q->setWindowTitle(QFileDialog::tr("Open"));
Execution Count:207
207
579 } else -
580 q->setWindowTitle(QFileDialog::tr("Save As"));
executed: q->setWindowTitle(QFileDialog::tr("Save As"));
Execution Count:3
3
581 -
582 setWindowTitle = q->windowTitle();
executed (the execution status of this line is deduced): setWindowTitle = q->windowTitle();
-
583}
executed: }
Execution Count:215
215
584 -
585void QFileDialogPrivate::setLastVisitedDirectory(const QString &dir) -
586{ -
587 *lastVisitedDir() = dir;
executed (the execution status of this line is deduced): *lastVisitedDir() = dir;
-
588}
executed: }
Execution Count:245
245
589 -
590void QFileDialogPrivate::updateFileNameLabel() -
591{ -
592 if (!options->isLabelExplicitlySet(QFileDialogOptions::FileName)) {
partially evaluated: !options->isLabelExplicitlySet(QFileDialogOptions::FileName)
TRUEFALSE
yes
Evaluation Count:253
no
Evaluation Count:0
0-253
593 switch (q_func()->fileMode()) { -
594 case QFileDialog::DirectoryOnly: -
595 case QFileDialog::Directory: -
596 setLabelTextControl(QFileDialog::FileName, QFileDialog::tr("Directory:"));
executed (the execution status of this line is deduced): setLabelTextControl(QFileDialog::FileName, QFileDialog::tr("Directory:"));
-
597 break;
executed: break;
Execution Count:7
7
598 default: -
599 setLabelTextControl(QFileDialog::FileName, QFileDialog::tr("File &name:"));
executed (the execution status of this line is deduced): setLabelTextControl(QFileDialog::FileName, QFileDialog::tr("File &name:"));
-
600 break;
executed: break;
Execution Count:246
246
601 } -
602 }
executed: }
Execution Count:253
253
603}
executed: }
Execution Count:253
253
604 -
605void QFileDialogPrivate::updateOkButtonText(bool saveAsOnFolder) -
606{ -
607 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
608 // 'Save as' at a folder: Temporarily change to "Open". -
609 if (saveAsOnFolder) {
evaluated: saveAsOnFolder
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:489
16-489
610 setLabelTextControl(QFileDialog::Accept, QFileDialog::tr("&Open"));
executed (the execution status of this line is deduced): setLabelTextControl(QFileDialog::Accept, QFileDialog::tr("&Open"));
-
611 } else if (options->isLabelExplicitlySet(QFileDialogOptions::Accept)) {
executed: }
Execution Count:16
evaluated: options->isLabelExplicitlySet(QFileDialogOptions::Accept)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:488
1-488
612 setLabelTextControl(QFileDialog::Accept, options->labelText(QFileDialogOptions::Accept));
executed (the execution status of this line is deduced): setLabelTextControl(QFileDialog::Accept, options->labelText(QFileDialogOptions::Accept));
-
613 return;
executed: return;
Execution Count:1
1
614 } else { -
615 switch (q->fileMode()) { -
616 case QFileDialog::DirectoryOnly: -
617 case QFileDialog::Directory: -
618 setLabelTextControl(QFileDialog::Accept, QFileDialog::tr("&Choose"));
executed (the execution status of this line is deduced): setLabelTextControl(QFileDialog::Accept, QFileDialog::tr("&Choose"));
-
619 break;
executed: break;
Execution Count:24
24
620 default: -
621 setLabelTextControl(QFileDialog::Accept,
executed (the execution status of this line is deduced): setLabelTextControl(QFileDialog::Accept,
-
622 q->acceptMode() == QFileDialog::AcceptOpen ?
executed (the execution status of this line is deduced): q->acceptMode() == QFileDialog::AcceptOpen ?
-
623 QFileDialog::tr("&Open") :
executed (the execution status of this line is deduced): QFileDialog::tr("&Open") :
-
624 QFileDialog::tr("&Save"));
executed (the execution status of this line is deduced): QFileDialog::tr("&Save"));
-
625 break;
executed: break;
Execution Count:464
464
626 } -
627 }
executed: }
Execution Count:488
488
628} -
629 -
630void QFileDialogPrivate::retranslateStrings() -
631{ -
632 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
633 /* WIDGETS */ -
634 if (defaultFileTypes)
partially evaluated: defaultFileTypes
TRUEFALSE
yes
Evaluation Count:119
no
Evaluation Count:0
0-119
635 q->setNameFilter(QFileDialog::tr("All Files (*)"));
executed: q->setNameFilter(QFileDialog::tr("All Files (*)"));
Execution Count:119
119
636 -
637 QList<QAction*> actions = qFileDialogUi->treeView->header()->actions();
executed (the execution status of this line is deduced): QList<QAction*> actions = qFileDialogUi->treeView->header()->actions();
-
638 QAbstractItemModel *abstractModel = model;
executed (the execution status of this line is deduced): QAbstractItemModel *abstractModel = model;
-
639#ifndef QT_NO_PROXYMODEL -
640 if (proxyModel)
partially evaluated: proxyModel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:119
0-119
641 abstractModel = proxyModel;
never executed: abstractModel = proxyModel;
0
642#endif -
643 int total = qMin(abstractModel->columnCount(QModelIndex()), actions.count() + 1);
executed (the execution status of this line is deduced): int total = qMin(abstractModel->columnCount(QModelIndex()), actions.count() + 1);
-
644 for (int i = 1; i < total; ++i) {
evaluated: i < total
TRUEFALSE
yes
Evaluation Count:357
yes
Evaluation Count:119
119-357
645 actions.at(i - 1)->setText(QFileDialog::tr("Show ") + abstractModel->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString());
executed (the execution status of this line is deduced): actions.at(i - 1)->setText(QFileDialog::tr("Show ") + abstractModel->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString());
-
646 }
executed: }
Execution Count:357
357
647 -
648 /* MENU ACTIONS */ -
649 renameAction->setText(QFileDialog::tr("&Rename"));
executed (the execution status of this line is deduced): renameAction->setText(QFileDialog::tr("&Rename"));
-
650 deleteAction->setText(QFileDialog::tr("&Delete"));
executed (the execution status of this line is deduced): deleteAction->setText(QFileDialog::tr("&Delete"));
-
651 showHiddenAction->setText(QFileDialog::tr("Show &hidden files"));
executed (the execution status of this line is deduced): showHiddenAction->setText(QFileDialog::tr("Show &hidden files"));
-
652 newFolderAction->setText(QFileDialog::tr("&New Folder"));
executed (the execution status of this line is deduced): newFolderAction->setText(QFileDialog::tr("&New Folder"));
-
653 qFileDialogUi->retranslateUi(q);
executed (the execution status of this line is deduced): qFileDialogUi->retranslateUi(q);
-
654 updateFileNameLabel();
executed (the execution status of this line is deduced): updateFileNameLabel();
-
655}
executed: }
Execution Count:119
119
656 -
657void QFileDialogPrivate::emitFilesSelected(const QStringList &files) -
658{ -
659 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
660 emit q->filesSelected(files);
executed (the execution status of this line is deduced): q->filesSelected(files);
-
661 if (files.count() == 1)
partially evaluated: files.count() == 1
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
662 emit q->fileSelected(files.first());
executed: q->fileSelected(files.first());
Execution Count:5
5
663}
executed: }
Execution Count:5
5
664 -
665bool QFileDialogPrivate::canBeNativeDialog() -
666{ -
667 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
668 if (nativeDialogInUse)
partially evaluated: nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
669 return true;
never executed: return true;
0
670 if (q->testAttribute(Qt::WA_DontShowOnScreen))
partially evaluated: q->testAttribute(Qt::WA_DontShowOnScreen)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
671 return false;
never executed: return false;
0
672 if (q->options() & QFileDialog::DontUseNativeDialog)
partially evaluated: q->options() & QFileDialog::DontUseNativeDialog
TRUEFALSE
yes
Evaluation Count:27
no
Evaluation Count:0
0-27
673 return false;
executed: return false;
Execution Count:27
27
674 -
675 QLatin1String staticName(QFileDialog::staticMetaObject.className());
never executed (the execution status of this line is deduced): QLatin1String staticName(QFileDialog::staticMetaObject.className());
-
676 QLatin1String dynamicName(q->metaObject()->className());
never executed (the execution status of this line is deduced): QLatin1String dynamicName(q->metaObject()->className());
-
677 return (staticName == dynamicName);
never executed: return (staticName == dynamicName);
0
678} -
679 -
680/*! -
681 \since 4.5 -
682 Sets the given \a option to be enabled if \a on is true; otherwise, -
683 clears the given \a option. -
684 -
685 \sa options, testOption() -
686*/ -
687void QFileDialog::setOption(Option option, bool on) -
688{ -
689 const QFileDialog::Options previousOptions = options();
executed (the execution status of this line is deduced): const QFileDialog::Options previousOptions = options();
-
690 if (!(previousOptions & option) != !on)
evaluated: !(previousOptions & option) != !on
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:135
130-135
691 setOptions(previousOptions ^ option);
executed: setOptions(previousOptions ^ option);
Execution Count:130
130
692}
executed: }
Execution Count:265
265
693 -
694/*! -
695 \since 4.5 -
696 -
697 Returns true if the given \a option is enabled; otherwise, returns -
698 false. -
699 -
700 \sa options, setOption() -
701*/ -
702bool QFileDialog::testOption(Option option) const -
703{ -
704 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
705 return d->options->testOption(static_cast<QFileDialogOptions::FileDialogOption>(option));
executed: return d->options->testOption(static_cast<QFileDialogOptions::FileDialogOption>(option));
Execution Count:289
289
706} -
707 -
708/*! -
709 \property QFileDialog::options -
710 \brief the various options that affect the look and feel of the dialog -
711 \since 4.5 -
712 -
713 By default, all options are disabled. -
714 -
715 Options should be set before showing the dialog. Setting them while the -
716 dialog is visible is not guaranteed to have an immediate effect on the -
717 dialog (depending on the option and on the platform). -
718 -
719 \sa setOption(), testOption() -
720*/ -
721void QFileDialog::setOptions(Options options) -
722{ -
723 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
724 -
725 Options changed = (options ^ QFileDialog::options());
executed (the execution status of this line is deduced): Options changed = (options ^ QFileDialog::options());
-
726 if (!changed)
evaluated: !changed
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:130
15-130
727 return;
executed: return;
Execution Count:15
15
728 -
729 d->options->setOptions(QFileDialogOptions::FileDialogOptions(int(options)));
executed (the execution status of this line is deduced): d->options->setOptions(QFileDialogOptions::FileDialogOptions(int(options)));
-
730 if (changed & DontResolveSymlinks)
evaluated: changed & DontResolveSymlinks
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:128
2-128
731 d->model->setResolveSymlinks(!(options & DontResolveSymlinks));
executed: d->model->setResolveSymlinks(!(options & DontResolveSymlinks));
Execution Count:2
2
732 if (changed & ReadOnly) {
evaluated: changed & ReadOnly
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:129
1-129
733 bool ro = (options & ReadOnly);
executed (the execution status of this line is deduced): bool ro = (options & ReadOnly);
-
734 d->model->setReadOnly(ro);
executed (the execution status of this line is deduced): d->model->setReadOnly(ro);
-
735 d->qFileDialogUi->newFolderButton->setEnabled(!ro);
executed (the execution status of this line is deduced): d->qFileDialogUi->newFolderButton->setEnabled(!ro);
-
736 d->renameAction->setEnabled(!ro);
executed (the execution status of this line is deduced): d->renameAction->setEnabled(!ro);
-
737 d->deleteAction->setEnabled(!ro);
executed (the execution status of this line is deduced): d->deleteAction->setEnabled(!ro);
-
738 }
executed: }
Execution Count:1
1
739 if (changed & HideNameFilterDetails)
evaluated: changed & HideNameFilterDetails
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:127
3-127
740 setNameFilters(d->options->nameFilters());
executed: setNameFilters(d->options->nameFilters());
Execution Count:3
3
741 -
742 if (changed & ShowDirsOnly)
evaluated: changed & ShowDirsOnly
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:127
3-127
743 setFilter((options & ShowDirsOnly) ? filter() & ~QDir::Files : filter() | QDir::Files);
executed: setFilter((options & ShowDirsOnly) ? filter() & ~QDir::Files : filter() | QDir::Files);
Execution Count:3
3
744}
executed: }
Execution Count:130
130
745 -
746QFileDialog::Options QFileDialog::options() const -
747{ -
748 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
749 return QFileDialog::Options(int(d->options->options()));
executed: return QFileDialog::Options(int(d->options->options()));
Execution Count:437
437
750} -
751 -
752/*! -
753 \overload -
754 -
755 \since 4.5 -
756 -
757 This function connects one of its signals to the slot specified by \a receiver -
758 and \a member. The specific signal depends is filesSelected() if fileMode is -
759 ExistingFiles and fileSelected() if fileMode is anything else. -
760 -
761 The signal will be disconnected from the slot when the dialog is closed. -
762*/ -
763void QFileDialog::open(QObject *receiver, const char *member) -
764{ -
765 Q_D(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
766 const char *signal = (fileMode() == ExistingFiles) ? SIGNAL(filesSelected(QStringList))
never evaluated: (fileMode() == ExistingFiles)
0
767 : SIGNAL(fileSelected(QString));
never executed (the execution status of this line is deduced): : "2""fileSelected(QString)";
-
768 connect(this, signal, receiver, member);
never executed (the execution status of this line is deduced): connect(this, signal, receiver, member);
-
769 d->signalToDisconnectOnClose = signal;
never executed (the execution status of this line is deduced): d->signalToDisconnectOnClose = signal;
-
770 d->receiverToDisconnectOnClose = receiver;
never executed (the execution status of this line is deduced): d->receiverToDisconnectOnClose = receiver;
-
771 d->memberToDisconnectOnClose = member;
never executed (the execution status of this line is deduced): d->memberToDisconnectOnClose = member;
-
772 -
773 QDialog::open();
never executed (the execution status of this line is deduced): QDialog::open();
-
774}
never executed: }
0
775 -
776 -
777/*! -
778 \reimp -
779*/ -
780void QFileDialog::setVisible(bool visible) -
781{ -
782 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
783 if (visible){
evaluated: visible
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:5
5-22
784 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden))
partially evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
never evaluated: !testAttribute(Qt::WA_WState_Hidden)
0-22
785 return;
never executed: return;
0
786 } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))
executed: }
Execution Count:22
partially evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: testAttribute(Qt::WA_WState_Hidden)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-22
787 return;
never executed: return;
0
788 -
789 if (d->canBeNativeDialog()){
partially evaluated: d->canBeNativeDialog()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
790 if (d->setNativeDialogVisible(visible)){
never evaluated: d->setNativeDialogVisible(visible)
0
791 // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below -
792 // updates the state correctly, but skips showing the non-native version: -
793 setAttribute(Qt::WA_DontShowOnScreen);
never executed (the execution status of this line is deduced): setAttribute(Qt::WA_DontShowOnScreen);
-
794#ifndef QT_NO_FSCOMPLETER -
795 //So the completer don't try to complete and therefore to show a popup -
796 d->completer->setModel(0);
never executed (the execution status of this line is deduced): d->completer->setModel(0);
-
797#endif -
798 } else {
never executed: }
0
799 setAttribute(Qt::WA_DontShowOnScreen, false);
never executed (the execution status of this line is deduced): setAttribute(Qt::WA_DontShowOnScreen, false);
-
800#ifndef QT_NO_FSCOMPLETER -
801 if (d->proxyModel != 0)
never evaluated: d->proxyModel != 0
0
802 d->completer->setModel(d->proxyModel);
never executed: d->completer->setModel(d->proxyModel);
0
803 else -
804 d->completer->setModel(d->model);
never executed: d->completer->setModel(d->model);
0
805#endif -
806 } -
807 } -
808 -
809 if (!d->nativeDialogInUse)
partially evaluated: !d->nativeDialogInUse
TRUEFALSE
yes
Evaluation Count:27
no
Evaluation Count:0
0-27
810 d->qFileDialogUi->fileNameEdit->setFocus();
executed: d->qFileDialogUi->fileNameEdit->setFocus();
Execution Count:27
27
811 -
812 QDialog::setVisible(visible);
executed (the execution status of this line is deduced): QDialog::setVisible(visible);
-
813}
executed: }
Execution Count:27
27
814 -
815/*! -
816 \internal -
817 set the directory to url -
818*/ -
819void QFileDialogPrivate::_q_goToUrl(const QUrl &url) -
820{ -
821 //The shortcut in the side bar may have a parent that is not fetched yet (e.g. an hidden file) -
822 //so we force the fetching -
823 QFileSystemModelPrivate::QFileSystemNode *node = model->d_func()->node(url.toLocalFile(), true);
never executed (the execution status of this line is deduced): QFileSystemModelPrivate::QFileSystemNode *node = model->d_func()->node(url.toLocalFile(), true);
-
824 QModelIndex idx = model->d_func()->index(node);
never executed (the execution status of this line is deduced): QModelIndex idx = model->d_func()->index(node);
-
825 _q_enterDirectory(idx);
never executed (the execution status of this line is deduced): _q_enterDirectory(idx);
-
826}
never executed: }
0
827 -
828/*! -
829 \fn void QFileDialog::setDirectory(const QDir &directory) -
830 -
831 \overload -
832*/ -
833 -
834/*! -
835 Sets the file dialog's current \a directory. -
836*/ -
837void QFileDialog::setDirectory(const QString &directory) -
838{ -
839 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
840 QString newDirectory = directory;
executed (the execution status of this line is deduced): QString newDirectory = directory;
-
841 QFileInfo info(directory);
executed (the execution status of this line is deduced): QFileInfo info(directory);
-
842 //we remove .. and . from the given path if exist -
843 if (!directory.isEmpty())
partially evaluated: !directory.isEmpty()
TRUEFALSE
yes
Evaluation Count:227
no
Evaluation Count:0
0-227
844 newDirectory = QDir::cleanPath(directory);
executed: newDirectory = QDir::cleanPath(directory);
Execution Count:227
227
845 -
846 if (!directory.isEmpty() && newDirectory.isEmpty())
partially evaluated: !directory.isEmpty()
TRUEFALSE
yes
Evaluation Count:227
no
Evaluation Count:0
partially evaluated: newDirectory.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:227
0-227
847 return;
never executed: return;
0
848 -
849 d->setLastVisitedDirectory(newDirectory);
executed (the execution status of this line is deduced): d->setLastVisitedDirectory(newDirectory);
-
850 -
851 if (d->nativeDialogInUse){
partially evaluated: d->nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:227
0-227
852 d->setDirectory_sys(newDirectory);
never executed (the execution status of this line is deduced): d->setDirectory_sys(newDirectory);
-
853 return;
never executed: return;
0
854 } -
855 if (d->rootPath() == newDirectory)
evaluated: d->rootPath() == newDirectory
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:151
76-151
856 return;
executed: return;
Execution Count:76
76
857 QModelIndex root = d->model->setRootPath(newDirectory);
executed (the execution status of this line is deduced): QModelIndex root = d->model->setRootPath(newDirectory);
-
858 d->qFileDialogUi->newFolderButton->setEnabled(d->model->flags(root) & Qt::ItemIsDropEnabled);
executed (the execution status of this line is deduced): d->qFileDialogUi->newFolderButton->setEnabled(d->model->flags(root) & Qt::ItemIsDropEnabled);
-
859 if (root != d->rootIndex()) {
partially evaluated: root != d->rootIndex()
TRUEFALSE
yes
Evaluation Count:151
no
Evaluation Count:0
0-151
860#ifndef QT_NO_FSCOMPLETER -
861 if (directory.endsWith(QLatin1Char('/')))
evaluated: directory.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:142
9-142
862 d->completer->setCompletionPrefix(newDirectory);
executed: d->completer->setCompletionPrefix(newDirectory);
Execution Count:9
9
863 else -
864 d->completer->setCompletionPrefix(newDirectory + QLatin1Char('/'));
executed: d->completer->setCompletionPrefix(newDirectory + QLatin1Char('/'));
Execution Count:142
142
865#endif -
866 d->setRootIndex(root);
executed (the execution status of this line is deduced): d->setRootIndex(root);
-
867 }
executed: }
Execution Count:151
151
868 d->qFileDialogUi->listView->selectionModel()->clear();
executed (the execution status of this line is deduced): d->qFileDialogUi->listView->selectionModel()->clear();
-
869}
executed: }
Execution Count:151
151
870 -
871/*! -
872 Returns the directory currently being displayed in the dialog. -
873*/ -
874QDir QFileDialog::directory() const -
875{ -
876 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
877 return QDir(d->nativeDialogInUse ? d->directory_sys() : d->rootPath());
executed: return QDir(d->nativeDialogInUse ? d->directory_sys() : d->rootPath());
Execution Count:504
504
878} -
879 -
880/*! -
881 Selects the given \a filename in the file dialog. -
882 -
883 \sa selectedFiles() -
884*/ -
885void QFileDialog::selectFile(const QString &filename) -
886{ -
887 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
888 if (filename.isEmpty())
evaluated: filename.isEmpty()
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:16
16-117
889 return;
executed: return;
Execution Count:117
117
890 -
891 if (d->nativeDialogInUse){
partially evaluated: d->nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
892 d->selectFile_sys(filename);
never executed (the execution status of this line is deduced): d->selectFile_sys(filename);
-
893 return;
never executed: return;
0
894 } -
895 -
896 if (!QDir::isRelativePath(filename)) {
evaluated: !QDir::isRelativePath(filename)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:7
7-9
897 QFileInfo info(filename);
executed (the execution status of this line is deduced): QFileInfo info(filename);
-
898 QString filenamePath = info.absoluteDir().path();
executed (the execution status of this line is deduced): QString filenamePath = info.absoluteDir().path();
-
899 -
900 if (d->model->rootPath() != filenamePath)
evaluated: d->model->rootPath() != filenamePath
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5
4-5
901 setDirectory(filenamePath);
executed: setDirectory(filenamePath);
Execution Count:4
4
902 }
executed: }
Execution Count:9
9
903 -
904 QModelIndex index = d->model->index(filename);
executed (the execution status of this line is deduced): QModelIndex index = d->model->index(filename);
-
905 QString file;
executed (the execution status of this line is deduced): QString file;
-
906 if (!index.isValid()) {
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:8
8
907 // save as dialog where we want to input a default value -
908 QString text = filename;
executed (the execution status of this line is deduced): QString text = filename;
-
909 if (QFileInfo(filename).isAbsolute()) {
evaluated: QFileInfo(filename).isAbsolute()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7
1-7
910 QString current = d->rootPath();
executed (the execution status of this line is deduced): QString current = d->rootPath();
-
911 text.remove(current);
executed (the execution status of this line is deduced): text.remove(current);
-
912 if (text.at(0) == QDir::separator()
partially evaluated: text.at(0) == QDir::separator()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
913#ifdef Q_OS_WIN -
914 //On Windows both cases can happen -
915 || text.at(0) == QLatin1Char('/') -
916#endif -
917 ) -
918 text = text.remove(0,1);
executed: text = text.remove(0,1);
Execution Count:1
1
919 }
executed: }
Execution Count:1
1
920 file = text;
executed (the execution status of this line is deduced): file = text;
-
921 } else {
executed: }
Execution Count:8
8
922 file = index.data().toString();
executed (the execution status of this line is deduced): file = index.data().toString();
-
923 }
executed: }
Execution Count:8
8
924 d->qFileDialogUi->listView->selectionModel()->clear();
executed (the execution status of this line is deduced): d->qFileDialogUi->listView->selectionModel()->clear();
-
925 if (!isVisible() || !d->lineEdit()->hasFocus())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:5
partially evaluated: !d->lineEdit()->hasFocus()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-11
926 d->lineEdit()->setText(file);
executed: d->lineEdit()->setText(file);
Execution Count:16
16
927}
executed: }
Execution Count:16
16
928 -
929#ifdef Q_OS_UNIX -
930Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0) -
931{ -
932 if (expanded != 0)
evaluated: expanded != 0
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:43
43-263
933 *expanded = false;
executed: *expanded = false;
Execution Count:263
263
934 if (!path.startsWith(QLatin1Char('~')))
partially evaluated: !path.startsWith(QLatin1Char('~'))
TRUEFALSE
yes
Evaluation Count:306
no
Evaluation Count:0
0-306
935 return path;
executed: return path;
Execution Count:306
306
936 QString ret = path;
never executed (the execution status of this line is deduced): QString ret = path;
-
937 QStringList tokens = ret.split(QDir::separator());
never executed (the execution status of this line is deduced): QStringList tokens = ret.split(QDir::separator());
-
938 if (tokens.first() == QLatin1String("~")) {
never evaluated: tokens.first() == QLatin1String("~")
0
939 ret.replace(0, 1, QDir::homePath());
never executed (the execution status of this line is deduced): ret.replace(0, 1, QDir::homePath());
-
940 } else {
never executed: }
0
941 QString userName = tokens.first();
never executed (the execution status of this line is deduced): QString userName = tokens.first();
-
942 userName.remove(0, 1);
never executed (the execution status of this line is deduced): userName.remove(0, 1);
-
943#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) -
944 passwd pw;
never executed (the execution status of this line is deduced): passwd pw;
-
945 passwd *tmpPw;
never executed (the execution status of this line is deduced): passwd *tmpPw;
-
946 char buf[200];
never executed (the execution status of this line is deduced): char buf[200];
-
947 const int bufSize = sizeof(buf);
never executed (the execution status of this line is deduced): const int bufSize = sizeof(buf);
-
948 int err = 0;
never executed (the execution status of this line is deduced): int err = 0;
-
949#if defined(Q_OS_SOLARIS) && (_POSIX_C_SOURCE - 0 < 199506L) -
950 tmpPw = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize); -
951#else -
952 err = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize, &tmpPw);
never executed (the execution status of this line is deduced): err = getpwnam_r(userName.toLocal8Bit().constData(), &pw, buf, bufSize, &tmpPw);
-
953#endif -
954 if (err || !tmpPw)
never evaluated: err
never evaluated: !tmpPw
0
955 return ret;
never executed: return ret;
0
956 const QString homePath = QString::fromLocal8Bit(pw.pw_dir);
never executed (the execution status of this line is deduced): const QString homePath = QString::fromLocal8Bit(pw.pw_dir);
-
957#else -
958 passwd *pw = getpwnam(userName.toLocal8Bit().constData()); -
959 if (!pw) -
960 return ret; -
961 const QString homePath = QString::fromLocal8Bit(pw->pw_dir); -
962#endif -
963 ret.replace(0, tokens.first().length(), homePath);
never executed (the execution status of this line is deduced): ret.replace(0, tokens.first().length(), homePath);
-
964 }
never executed: }
0
965 if (expanded != 0)
never evaluated: expanded != 0
0
966 *expanded = true;
never executed: *expanded = true;
0
967 return ret;
never executed: return ret;
0
968} -
969#endif -
970 -
971/** -
972 Returns the text in the line edit which can be one or more file names -
973 */ -
974QStringList QFileDialogPrivate::typedFiles() const -
975{ -
976 Q_Q(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialog * const q = q_func();
-
977 QStringList files;
executed (the execution status of this line is deduced): QStringList files;
-
978 QString editText = lineEdit()->text();
executed (the execution status of this line is deduced): QString editText = lineEdit()->text();
-
979 if (!editText.contains(QLatin1Char('"'))) {
evaluated: !editText.contains(QLatin1Char('"'))
TRUEFALSE
yes
Evaluation Count:133
yes
Evaluation Count:5
5-133
980#ifdef Q_OS_UNIX -
981 const QString prefix = q->directory().absolutePath() + QDir::separator();
executed (the execution status of this line is deduced): const QString prefix = q->directory().absolutePath() + QDir::separator();
-
982 if (QFile::exists(prefix + editText))
evaluated: QFile::exists(prefix + editText)
TRUEFALSE
yes
Evaluation Count:95
yes
Evaluation Count:38
38-95
983 files << editText;
executed: files << editText;
Execution Count:95
95
984 else -
985 files << qt_tildeExpansion(editText);
executed: files << qt_tildeExpansion(editText);
Execution Count:38
38
986#else -
987 files << editText; -
988 Q_UNUSED(q) -
989#endif -
990 } else { -
991 // " is used to separate files like so: "file1" "file2" "file3" ... -
992 // ### need escape character for filenames with quotes (") -
993 QStringList tokens = editText.split(QLatin1Char('\"'));
executed (the execution status of this line is deduced): QStringList tokens = editText.split(QLatin1Char('\"'));
-
994 for (int i=0; i<tokens.size(); ++i) {
evaluated: i<tokens.size()
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:5
5-43
995 if ((i % 2) == 0)
evaluated: (i % 2) == 0
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:19
19-24
996 continue; // Every even token is a separator
executed: continue;
Execution Count:24
24
997#ifdef Q_OS_UNIX -
998 const QString token = tokens.at(i);
executed (the execution status of this line is deduced): const QString token = tokens.at(i);
-
999 const QString prefix = q->directory().absolutePath() + QDir::separator();
executed (the execution status of this line is deduced): const QString prefix = q->directory().absolutePath() + QDir::separator();
-
1000 if (QFile::exists(prefix + token))
evaluated: QFile::exists(prefix + token)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:5
5-14
1001 files << token;
executed: files << token;
Execution Count:14
14
1002 else -
1003 files << qt_tildeExpansion(token);
executed: files << qt_tildeExpansion(token);
Execution Count:5
5
1004#else -
1005 files << toInternal(tokens.at(i)); -
1006#endif -
1007 } -
1008 }
executed: }
Execution Count:5
5
1009 return addDefaultSuffixToFiles(files);
executed: return addDefaultSuffixToFiles(files);
Execution Count:138
138
1010} -
1011 -
1012// Return selected files without defaulting to the root of the file system model -
1013// used for initializing QFileDialogOptions for native dialogs. The default is -
1014// not suitable for native dialogs since it mostly equals directory(). -
1015QStringList QFileDialogPrivate::userSelectedFiles() const -
1016{ -
1017 if (nativeDialogInUse)
partially evaluated: nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:383
0-383
1018 return addDefaultSuffixToFiles(selectedFiles_sys());
never executed: return addDefaultSuffixToFiles(selectedFiles_sys());
0
1019 -
1020 QStringList files;
executed (the execution status of this line is deduced): QStringList files;
-
1021 foreach (const QModelIndex &index, qFileDialogUi->listView->selectionModel()->selectedRows())
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(qFileDialogUi->listView->selectionModel()->selectedRows())> _container_(qFileDialogUi->listView->selectionModel()->selectedRows()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QModelIndex &index = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
1022 files.append(index.data(QFileSystemModel::FilePathRole).toString());
executed: files.append(index.data(QFileSystemModel::FilePathRole).toString());
Execution Count:66
66
1023 -
1024 if (files.isEmpty() && !lineEdit()->text().isEmpty())
evaluated: files.isEmpty()
TRUEFALSE
yes
Evaluation Count:332
yes
Evaluation Count:51
evaluated: !lineEdit()->text().isEmpty()
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:262
51-332
1025 files = typedFiles();
executed: files = typedFiles();
Execution Count:70
70
1026 -
1027 return files;
executed: return files;
Execution Count:383
383
1028} -
1029 -
1030QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesToFix) const -
1031{ -
1032 QStringList files;
executed (the execution status of this line is deduced): QStringList files;
-
1033 for (int i=0; i<filesToFix.size(); ++i) {
evaluated: i<filesToFix.size()
TRUEFALSE
yes
Evaluation Count:152
yes
Evaluation Count:138
138-152
1034 QString name = toInternal(filesToFix.at(i));
executed (the execution status of this line is deduced): QString name = toInternal(filesToFix.at(i));
-
1035 QFileInfo info(name);
executed (the execution status of this line is deduced): QFileInfo info(name);
-
1036 // if the filename has no suffix, add the default suffix -
1037 const QString defaultSuffix = options->defaultSuffix();
executed (the execution status of this line is deduced): const QString defaultSuffix = options->defaultSuffix();
-
1038 if (!defaultSuffix.isEmpty() && !info.isDir() && name.lastIndexOf(QLatin1Char('.')) == -1)
partially evaluated: !defaultSuffix.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:152
never evaluated: !info.isDir()
never evaluated: name.lastIndexOf(QLatin1Char('.')) == -1
0-152
1039 name += QLatin1Char('.') + defaultSuffix;
never executed: name += QLatin1Char('.') + defaultSuffix;
0
1040 if (info.isAbsolute()) {
evaluated: info.isAbsolute()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:151
1-151
1041 files.append(name);
executed (the execution status of this line is deduced): files.append(name);
-
1042 } else {
executed: }
Execution Count:1
1
1043 // at this point the path should only have Qt path separators. -
1044 // This check is needed since we might be at the root directory -
1045 // and on Windows it already ends with slash. -
1046 QString path = rootPath();
executed (the execution status of this line is deduced): QString path = rootPath();
-
1047 if (!path.endsWith(QLatin1Char('/')))
evaluated: !path.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:147
yes
Evaluation Count:4
4-147
1048 path += QLatin1Char('/');
executed: path += QLatin1Char('/');
Execution Count:147
147
1049 path += name;
executed (the execution status of this line is deduced): path += name;
-
1050 files.append(path);
executed (the execution status of this line is deduced): files.append(path);
-
1051 }
executed: }
Execution Count:151
151
1052 } -
1053 return files;
executed: return files;
Execution Count:138
138
1054} -
1055 -
1056 -
1057/*! -
1058 Returns a list of strings containing the absolute paths of the -
1059 selected files in the dialog. If no files are selected, or -
1060 the mode is not ExistingFiles or ExistingFile, selectedFiles() contains the current path in the viewport. -
1061 -
1062 \sa selectedNameFilter(), selectFile() -
1063*/ -
1064QStringList QFileDialog::selectedFiles() const -
1065{ -
1066 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1067 -
1068 QStringList files = d->userSelectedFiles();
executed (the execution status of this line is deduced): QStringList files = d->userSelectedFiles();
-
1069 if (files.isEmpty()) {
evaluated: files.isEmpty()
TRUEFALSE
yes
Evaluation Count:262
yes
Evaluation Count:121
121-262
1070 const FileMode fm = fileMode();
executed (the execution status of this line is deduced): const FileMode fm = fileMode();
-
1071 if (fm != ExistingFile && fm != ExistingFiles)
evaluated: fm != ExistingFile
TRUEFALSE
yes
Evaluation Count:260
yes
Evaluation Count:2
evaluated: fm != ExistingFiles
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:3
2-260
1072 files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
executed: files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
Execution Count:257
257
1073 }
executed: }
Execution Count:262
262
1074 return files;
executed: return files;
Execution Count:383
383
1075} -
1076 -
1077/* -
1078 Makes a list of filters from ;;-separated text. -
1079 Used by the mac and windows implementations -
1080*/ -
1081QStringList qt_make_filter_list(const QString &filter) -
1082{ -
1083 QString f(filter);
executed (the execution status of this line is deduced): QString f(filter);
-
1084 -
1085 if (f.isEmpty())
evaluated: f.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:128
2-128
1086 return QStringList();
executed: return QStringList();
Execution Count:2
2
1087 -
1088 QString sep(QLatin1String(";;"));
executed (the execution status of this line is deduced): QString sep(QLatin1String(";;"));
-
1089 int i = f.indexOf(sep, 0);
executed (the execution status of this line is deduced): int i = f.indexOf(sep, 0);
-
1090 if (i == -1) {
evaluated: i == -1
TRUEFALSE
yes
Evaluation Count:122
yes
Evaluation Count:6
6-122
1091 if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
partially evaluated: f.indexOf(QLatin1Char('\n'), 0) != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:122
0-122
1092 sep = QLatin1Char('\n');
never executed (the execution status of this line is deduced): sep = QLatin1Char('\n');
-
1093 i = f.indexOf(sep, 0);
never executed (the execution status of this line is deduced): i = f.indexOf(sep, 0);
-
1094 }
never executed: }
0
1095 }
executed: }
Execution Count:122
122
1096 -
1097 return f.split(sep);
executed: return f.split(sep);
Execution Count:128
128
1098} -
1099 -
1100/*! -
1101 \since 4.4 -
1102 -
1103 Sets the filter used in the file dialog to the given \a filter. -
1104 -
1105 If \a filter contains a pair of parentheses containing one or more -
1106 of \b{anything*something}, separated by spaces, then only the -
1107 text contained in the parentheses is used as the filter. This means -
1108 that these calls are all equivalent: -
1109 -
1110 \snippet code/src_gui_dialogs_qfiledialog.cpp 6 -
1111 -
1112 \sa setNameFilters() -
1113*/ -
1114void QFileDialog::setNameFilter(const QString &filter) -
1115{ -
1116 setNameFilters(qt_make_filter_list(filter));
executed (the execution status of this line is deduced): setNameFilters(qt_make_filter_list(filter));
-
1117}
executed: }
Execution Count:127
127
1118 -
1119 -
1120/*! -
1121 \property QFileDialog::nameFilterDetailsVisible -
1122 \obsolete -
1123 \brief This property holds whether the filter details is shown or not. -
1124 \since 4.4 -
1125 -
1126 When this property is true (the default), the filter details are shown -
1127 in the combo box. When the property is set to false, these are hidden. -
1128 -
1129 Use setOption(HideNameFilterDetails, !\e enabled) or -
1130 !testOption(HideNameFilterDetails). -
1131*/ -
1132void QFileDialog::setNameFilterDetailsVisible(bool enabled) -
1133{ -
1134 setOption(HideNameFilterDetails, !enabled);
executed (the execution status of this line is deduced): setOption(HideNameFilterDetails, !enabled);
-
1135}
executed: }
Execution Count:6
6
1136 -
1137bool QFileDialog::isNameFilterDetailsVisible() const -
1138{ -
1139 return !testOption(HideNameFilterDetails);
never executed: return !testOption(HideNameFilterDetails);
0
1140} -
1141 -
1142 -
1143/* -
1144 Strip the filters by removing the details, e.g. (*.*). -
1145*/ -
1146QStringList qt_strip_filters(const QStringList &filters) -
1147{ -
1148 QStringList strippedFilters;
executed (the execution status of this line is deduced): QStringList strippedFilters;
-
1149 QRegExp r(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp));
executed (the execution status of this line is deduced): QRegExp r(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp));
-
1150 for (int i = 0; i < filters.count(); ++i) {
evaluated: i < filters.count()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:5
5-8
1151 QString filterName;
executed (the execution status of this line is deduced): QString filterName;
-
1152 int index = r.indexIn(filters[i]);
executed (the execution status of this line is deduced): int index = r.indexIn(filters[i]);
-
1153 if (index >= 0)
evaluated: index >= 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1
1-7
1154 filterName = r.cap(1);
executed: filterName = r.cap(1);
Execution Count:7
7
1155 strippedFilters.append(filterName.simplified());
executed (the execution status of this line is deduced): strippedFilters.append(filterName.simplified());
-
1156 }
executed: }
Execution Count:8
8
1157 return strippedFilters;
executed: return strippedFilters;
Execution Count:5
5
1158} -
1159 -
1160 -
1161/*! -
1162 \since 4.4 -
1163 -
1164 Sets the \a filters used in the file dialog. -
1165 -
1166 \snippet code/src_gui_dialogs_qfiledialog.cpp 7 -
1167*/ -
1168void QFileDialog::setNameFilters(const QStringList &filters) -
1169{ -
1170 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1171 d->defaultFileTypes = (filters == QStringList(QFileDialog::tr("All Files (*)")));
executed (the execution status of this line is deduced): d->defaultFileTypes = (filters == QStringList(QFileDialog::tr("All Files (*)")));
-
1172 QStringList cleanedFilters;
executed (the execution status of this line is deduced): QStringList cleanedFilters;
-
1173 for (int i = 0; i < filters.count(); ++i) {
evaluated: i < filters.count()
TRUEFALSE
yes
Evaluation Count:160
yes
Evaluation Count:140
140-160
1174 cleanedFilters << filters[i].simplified();
executed (the execution status of this line is deduced): cleanedFilters << filters[i].simplified();
-
1175 }
executed: }
Execution Count:160
160
1176 d->options->setNameFilters(cleanedFilters);
executed (the execution status of this line is deduced): d->options->setNameFilters(cleanedFilters);
-
1177 -
1178 d->qFileDialogUi->fileTypeCombo->clear();
executed (the execution status of this line is deduced): d->qFileDialogUi->fileTypeCombo->clear();
-
1179 if (cleanedFilters.isEmpty())
evaluated: cleanedFilters.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:135
5-135
1180 return;
executed: return;
Execution Count:5
5
1181 -
1182 if (testOption(HideNameFilterDetails))
evaluated: testOption(HideNameFilterDetails)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:133
2-133
1183 d->qFileDialogUi->fileTypeCombo->addItems(qt_strip_filters(cleanedFilters));
executed: d->qFileDialogUi->fileTypeCombo->addItems(qt_strip_filters(cleanedFilters));
Execution Count:2
2
1184 else -
1185 d->qFileDialogUi->fileTypeCombo->addItems(cleanedFilters);
executed: d->qFileDialogUi->fileTypeCombo->addItems(cleanedFilters);
Execution Count:133
133
1186 -
1187 d->_q_useNameFilter(0);
executed (the execution status of this line is deduced): d->_q_useNameFilter(0);
-
1188}
executed: }
Execution Count:135
135
1189 -
1190/*! -
1191 \since 4.4 -
1192 -
1193 Returns the file type filters that are in operation on this file -
1194 dialog. -
1195*/ -
1196QStringList QFileDialog::nameFilters() const -
1197{ -
1198 return d_func()->options->nameFilters();
executed: return d_func()->options->nameFilters();
Execution Count:10
10
1199} -
1200 -
1201/*! -
1202 \since 4.4 -
1203 -
1204 Sets the current file type \a filter. Multiple filters can be -
1205 passed in \a filter by separating them with semicolons or spaces. -
1206 -
1207 \sa setNameFilter(), setNameFilters(), selectedNameFilter() -
1208*/ -
1209void QFileDialog::selectNameFilter(const QString &filter) -
1210{ -
1211 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1212 if (d->nativeDialogInUse) {
partially evaluated: d->nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
1213 d->selectNameFilter_sys(filter);
never executed (the execution status of this line is deduced): d->selectNameFilter_sys(filter);
-
1214 return;
never executed: return;
0
1215 } -
1216 int i = -1;
executed (the execution status of this line is deduced): int i = -1;
-
1217 if (testOption(HideNameFilterDetails)) {
evaluated: testOption(HideNameFilterDetails)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
3-7
1218 const QStringList filters = qt_strip_filters(qt_make_filter_list(filter));
executed (the execution status of this line is deduced): const QStringList filters = qt_strip_filters(qt_make_filter_list(filter));
-
1219 if (!filters.isEmpty())
evaluated: !filters.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1220 i = d->qFileDialogUi->fileTypeCombo->findText(filters.first());
executed: i = d->qFileDialogUi->fileTypeCombo->findText(filters.first());
Execution Count:2
2
1221 } else {
executed: }
Execution Count:3
3
1222 i = d->qFileDialogUi->fileTypeCombo->findText(filter);
executed (the execution status of this line is deduced): i = d->qFileDialogUi->fileTypeCombo->findText(filter);
-
1223 }
executed: }
Execution Count:7
7
1224 if (i >= 0) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6
4-6
1225 d->qFileDialogUi->fileTypeCombo->setCurrentIndex(i);
executed (the execution status of this line is deduced): d->qFileDialogUi->fileTypeCombo->setCurrentIndex(i);
-
1226 d->_q_useNameFilter(d->qFileDialogUi->fileTypeCombo->currentIndex());
executed (the execution status of this line is deduced): d->_q_useNameFilter(d->qFileDialogUi->fileTypeCombo->currentIndex());
-
1227 }
executed: }
Execution Count:4
4
1228}
executed: }
Execution Count:10
10
1229 -
1230/*! -
1231 \since 4.4 -
1232 -
1233 Returns the filter that the user selected in the file dialog. -
1234 -
1235 \sa selectedFiles() -
1236*/ -
1237QString QFileDialog::selectedNameFilter() const -
1238{ -
1239 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1240 if (d->nativeDialogInUse)
partially evaluated: d->nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1241 return d->selectedNameFilter_sys();
never executed: return d->selectedNameFilter_sys();
0
1242 -
1243 return d->qFileDialogUi->fileTypeCombo->currentText();
executed: return d->qFileDialogUi->fileTypeCombo->currentText();
Execution Count:12
12
1244} -
1245 -
1246/*! -
1247 \since 4.4 -
1248 -
1249 Returns the filter that is used when displaying files. -
1250 -
1251 \sa setFilter() -
1252*/ -
1253QDir::Filters QFileDialog::filter() const -
1254{ -
1255 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1256 return d->model->filter();
executed: return d->model->filter();
Execution Count:137
137
1257} -
1258 -
1259/*! -
1260 \since 4.4 -
1261 -
1262 Sets the filter used by the model to \a filters. The filter is used -
1263 to specify the kind of files that should be shown. -
1264 -
1265 \sa filter() -
1266*/ -
1267 -
1268void QFileDialog::setFilter(QDir::Filters filters) -
1269{ -
1270 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1271 d->model->setFilter(filters);
executed (the execution status of this line is deduced): d->model->setFilter(filters);
-
1272 d->options->setFilter(filters);
executed (the execution status of this line is deduced): d->options->setFilter(filters);
-
1273 if (d->nativeDialogInUse){
partially evaluated: d->nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1274 d->setFilter_sys();
never executed (the execution status of this line is deduced): d->setFilter_sys();
-
1275 return;
never executed: return;
0
1276 } -
1277 -
1278 d->showHiddenAction->setChecked((filters & QDir::Hidden));
executed (the execution status of this line is deduced): d->showHiddenAction->setChecked((filters & QDir::Hidden));
-
1279}
executed: }
Execution Count:3
3
1280 -
1281/*! -
1282 \property QFileDialog::viewMode -
1283 \brief the way files and directories are displayed in the dialog -
1284 -
1285 By default, the \c Detail mode is used to display information about -
1286 files and directories. -
1287 -
1288 \sa ViewMode -
1289*/ -
1290void QFileDialog::setViewMode(QFileDialog::ViewMode mode) -
1291{ -
1292 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1293 if (mode == Detail)
evaluated: mode == Detail
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:73
1-73
1294 d->_q_showDetailsView();
executed: d->_q_showDetailsView();
Execution Count:1
1
1295 else -
1296 d->_q_showListView();
executed: d->_q_showListView();
Execution Count:73
73
1297} -
1298 -
1299QFileDialog::ViewMode QFileDialog::viewMode() const -
1300{ -
1301 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1302 return (d->qFileDialogUi->stackedWidget->currentWidget() == d->qFileDialogUi->listView->parent() ? QFileDialog::List : QFileDialog::Detail);
executed: return (d->qFileDialogUi->stackedWidget->currentWidget() == d->qFileDialogUi->listView->parent() ? QFileDialog::List : QFileDialog::Detail);
Execution Count:122
122
1303} -
1304 -
1305/*! -
1306 \property QFileDialog::fileMode -
1307 \brief the file mode of the dialog -
1308 -
1309 The file mode defines the number and type of items that the user is -
1310 expected to select in the dialog. -
1311 -
1312 By default, this property is set to AnyFile. -
1313 -
1314 This function will set the labels for the FileName and -
1315 \l{QFileDialog::}{Accept} \l{DialogLabel}s. It is possible to set -
1316 custom text after the call to setFileMode(). -
1317 -
1318 \sa FileMode -
1319*/ -
1320void QFileDialog::setFileMode(QFileDialog::FileMode mode) -
1321{ -
1322 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1323 d->options->setFileMode(static_cast<QFileDialogOptions::FileMode>(mode));
executed (the execution status of this line is deduced): d->options->setFileMode(static_cast<QFileDialogOptions::FileMode>(mode));
-
1324 d->retranslateWindowTitle();
executed (the execution status of this line is deduced): d->retranslateWindowTitle();
-
1325 -
1326 // keep ShowDirsOnly option in sync with fileMode (BTW, DirectoryOnly is obsolete) -
1327 setOption(ShowDirsOnly, mode == DirectoryOnly);
executed (the execution status of this line is deduced): setOption(ShowDirsOnly, mode == DirectoryOnly);
-
1328 -
1329 // set selection mode and behavior -
1330 QAbstractItemView::SelectionMode selectionMode;
executed (the execution status of this line is deduced): QAbstractItemView::SelectionMode selectionMode;
-
1331 if (mode == QFileDialog::ExistingFiles)
evaluated: mode == QFileDialog::ExistingFiles
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:131
3-131
1332 selectionMode = QAbstractItemView::ExtendedSelection;
executed: selectionMode = QAbstractItemView::ExtendedSelection;
Execution Count:3
3
1333 else -
1334 selectionMode = QAbstractItemView::SingleSelection;
executed: selectionMode = QAbstractItemView::SingleSelection;
Execution Count:131
131
1335 d->qFileDialogUi->listView->setSelectionMode(selectionMode);
executed (the execution status of this line is deduced): d->qFileDialogUi->listView->setSelectionMode(selectionMode);
-
1336 d->qFileDialogUi->treeView->setSelectionMode(selectionMode);
executed (the execution status of this line is deduced): d->qFileDialogUi->treeView->setSelectionMode(selectionMode);
-
1337 // set filter -
1338 d->model->setFilter(d->filterForMode(filter()));
executed (the execution status of this line is deduced): d->model->setFilter(d->filterForMode(filter()));
-
1339 // setup file type for directory -
1340 if (mode == DirectoryOnly || mode == Directory) {
evaluated: mode == DirectoryOnly
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:132
evaluated: mode == Directory
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:127
2-132
1341 d->qFileDialogUi->fileTypeCombo->clear();
executed (the execution status of this line is deduced): d->qFileDialogUi->fileTypeCombo->clear();
-
1342 d->qFileDialogUi->fileTypeCombo->addItem(tr("Directories"));
executed (the execution status of this line is deduced): d->qFileDialogUi->fileTypeCombo->addItem(tr("Directories"));
-
1343 d->qFileDialogUi->fileTypeCombo->setEnabled(false);
executed (the execution status of this line is deduced): d->qFileDialogUi->fileTypeCombo->setEnabled(false);
-
1344 }
executed: }
Execution Count:7
7
1345 d->updateFileNameLabel();
executed (the execution status of this line is deduced): d->updateFileNameLabel();
-
1346 d->updateOkButtonText();
executed (the execution status of this line is deduced): d->updateOkButtonText();
-
1347 if (d->nativeDialogInUse){
partially evaluated: d->nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:134
0-134
1348 d->setFilter_sys();
never executed (the execution status of this line is deduced): d->setFilter_sys();
-
1349 return;
never executed: return;
0
1350 } -
1351 -
1352 d->qFileDialogUi->fileTypeCombo->setEnabled(!testOption(ShowDirsOnly));
executed (the execution status of this line is deduced): d->qFileDialogUi->fileTypeCombo->setEnabled(!testOption(ShowDirsOnly));
-
1353 d->_q_updateOkButton();
executed (the execution status of this line is deduced): d->_q_updateOkButton();
-
1354}
executed: }
Execution Count:134
134
1355 -
1356QFileDialog::FileMode QFileDialog::fileMode() const -
1357{ -
1358 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1359 return static_cast<FileMode>(d->options->fileMode());
executed: return static_cast<FileMode>(d->options->fileMode());
Execution Count:1768
1768
1360} -
1361 -
1362/*! -
1363 \property QFileDialog::acceptMode -
1364 \brief the accept mode of the dialog -
1365 -
1366 The action mode defines whether the dialog is for opening or saving files. -
1367 -
1368 By default, this property is set to \l{AcceptOpen}. -
1369 -
1370 \sa AcceptMode -
1371*/ -
1372void QFileDialog::setAcceptMode(QFileDialog::AcceptMode mode) -
1373{ -
1374 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1375 d->options->setAcceptMode(static_cast<QFileDialogOptions::AcceptMode>(mode));
executed (the execution status of this line is deduced): d->options->setAcceptMode(static_cast<QFileDialogOptions::AcceptMode>(mode));
-
1376 QDialogButtonBox::StandardButton button = (mode == AcceptOpen ? QDialogButtonBox::Open : QDialogButtonBox::Save);
evaluated: mode == AcceptOpen
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:13
13-120
1377 d->qFileDialogUi->buttonBox->setStandardButtons(button | QDialogButtonBox::Cancel);
executed (the execution status of this line is deduced): d->qFileDialogUi->buttonBox->setStandardButtons(button | QDialogButtonBox::Cancel);
-
1378 d->qFileDialogUi->buttonBox->button(button)->setEnabled(false);
executed (the execution status of this line is deduced): d->qFileDialogUi->buttonBox->button(button)->setEnabled(false);
-
1379 d->_q_updateOkButton();
executed (the execution status of this line is deduced): d->_q_updateOkButton();
-
1380 if (mode == AcceptSave) {
evaluated: mode == AcceptSave
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:120
13-120
1381 d->qFileDialogUi->lookInCombo->setEditable(false);
executed (the execution status of this line is deduced): d->qFileDialogUi->lookInCombo->setEditable(false);
-
1382 }
executed: }
Execution Count:13
13
1383 d->retranslateWindowTitle();
executed (the execution status of this line is deduced): d->retranslateWindowTitle();
-
1384 // we need to recreate the native dialog when changing the AcceptMode -
1385 d->deletePlatformHelper();
executed (the execution status of this line is deduced): d->deletePlatformHelper();
-
1386 // clear WA_DontShowOnScreen so that d->canBeNativeDialog() doesn't return false incorrectly -
1387 setAttribute(Qt::WA_DontShowOnScreen, false);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_DontShowOnScreen, false);
-
1388}
executed: }
Execution Count:133
133
1389 -
1390/* -
1391 Returns the file system model index that is the root index in the -
1392 views -
1393*/ -
1394QModelIndex QFileDialogPrivate::rootIndex() const { -
1395 return mapToSource(qFileDialogUi->listView->rootIndex());
executed: return mapToSource(qFileDialogUi->listView->rootIndex());
Execution Count:533
533
1396} -
1397 -
1398QAbstractItemView *QFileDialogPrivate::currentView() const { -
1399 if (!qFileDialogUi->stackedWidget)
never evaluated: !qFileDialogUi->stackedWidget
0
1400 return 0;
never executed: return 0;
0
1401 if (qFileDialogUi->stackedWidget->currentWidget() == qFileDialogUi->listView->parent())
never evaluated: qFileDialogUi->stackedWidget->currentWidget() == qFileDialogUi->listView->parent()
0
1402 return qFileDialogUi->listView;
never executed: return qFileDialogUi->listView;
0
1403 return qFileDialogUi->treeView;
never executed: return qFileDialogUi->treeView;
0
1404} -
1405 -
1406QLineEdit *QFileDialogPrivate::lineEdit() const { -
1407 return (QLineEdit*)qFileDialogUi->fileNameEdit;
executed: return (QLineEdit*)qFileDialogUi->fileNameEdit;
Execution Count:1098
1098
1408} -
1409 -
1410int QFileDialogPrivate::maxNameLength(const QString &path) -
1411{ -
1412#if defined(Q_OS_UNIX) -
1413 return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
executed: return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
Execution Count:116
116
1414#elif defined(Q_OS_WINCE) -
1415 Q_UNUSED(path); -
1416 return MAX_PATH; -
1417#elif defined(Q_OS_WIN) -
1418 DWORD maxLength; -
1419 const QString drive = path.left(3); -
1420 if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == false) -
1421 return -1; -
1422 return maxLength; -
1423#else -
1424 Q_UNUSED(path); -
1425#endif -
1426 return -1;
dead code: return -1;
-
1427} -
1428 -
1429/* -
1430 Sets the view root index to be the file system model index -
1431*/ -
1432void QFileDialogPrivate::setRootIndex(const QModelIndex &index) const { -
1433 Q_ASSERT(index.isValid() ? index.model() == model : true);
executed (the execution status of this line is deduced): qt_noop();
-
1434 QModelIndex idx = mapFromSource(index);
executed (the execution status of this line is deduced): QModelIndex idx = mapFromSource(index);
-
1435 qFileDialogUi->treeView->setRootIndex(idx);
executed (the execution status of this line is deduced): qFileDialogUi->treeView->setRootIndex(idx);
-
1436 qFileDialogUi->listView->setRootIndex(idx);
executed (the execution status of this line is deduced): qFileDialogUi->listView->setRootIndex(idx);
-
1437}
executed: }
Execution Count:153
153
1438/* -
1439 Select a file system model index -
1440 returns the index that was selected (or not depending upon sortfilterproxymodel) -
1441*/ -
1442QModelIndex QFileDialogPrivate::select(const QModelIndex &index) const { -
1443 Q_ASSERT(index.isValid() ? index.model() == model : true);
executed (the execution status of this line is deduced): qt_noop();
-
1444 -
1445 QModelIndex idx = mapFromSource(index);
executed (the execution status of this line is deduced): QModelIndex idx = mapFromSource(index);
-
1446 if (idx.isValid() && !qFileDialogUi->listView->selectionModel()->isSelected(idx))
evaluated: idx.isValid()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:49
partially evaluated: !qFileDialogUi->listView->selectionModel()->isSelected(idx)
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-49
1447 qFileDialogUi->listView->selectionModel()->select(idx,
executed: qFileDialogUi->listView->selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
Execution Count:13
13
1448 QItemSelectionModel::Select | QItemSelectionModel::Rows);
executed: qFileDialogUi->listView->selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
Execution Count:13
13
1449 return idx;
executed: return idx;
Execution Count:62
62
1450} -
1451 -
1452QFileDialog::AcceptMode QFileDialog::acceptMode() const -
1453{ -
1454 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1455 return static_cast<AcceptMode>(d->options->acceptMode());
executed: return static_cast<AcceptMode>(d->options->acceptMode());
Execution Count:1823
1823
1456} -
1457 -
1458/*! -
1459 \property QFileDialog::readOnly -
1460 \obsolete -
1461 \brief Whether the filedialog is read-only -
1462 -
1463 If this property is set to false, the file dialog will allow renaming, -
1464 and deleting of files and directories and creating directories. -
1465 -
1466 Use setOption(ReadOnly, \e enabled) or testOption(ReadOnly) instead. -
1467*/ -
1468void QFileDialog::setReadOnly(bool enabled) -
1469{ -
1470 setOption(ReadOnly, enabled);
executed (the execution status of this line is deduced): setOption(ReadOnly, enabled);
-
1471}
executed: }
Execution Count:1
1
1472 -
1473bool QFileDialog::isReadOnly() const -
1474{ -
1475 return testOption(ReadOnly);
executed: return testOption(ReadOnly);
Execution Count:2
2
1476} -
1477 -
1478/*! -
1479 \property QFileDialog::resolveSymlinks -
1480 \obsolete -
1481 \brief whether the filedialog should resolve shortcuts -
1482 -
1483 If this property is set to true, the file dialog will resolve -
1484 shortcuts or symbolic links. -
1485 -
1486 Use setOption(DontResolveSymlinks, !\a enabled) or -
1487 !testOption(DontResolveSymlinks). -
1488*/ -
1489void QFileDialog::setResolveSymlinks(bool enabled) -
1490{ -
1491 setOption(DontResolveSymlinks, !enabled);
executed (the execution status of this line is deduced): setOption(DontResolveSymlinks, !enabled);
-
1492}
executed: }
Execution Count:2
2
1493 -
1494bool QFileDialog::resolveSymlinks() const -
1495{ -
1496 return !testOption(DontResolveSymlinks);
executed: return !testOption(DontResolveSymlinks);
Execution Count:3
3
1497} -
1498 -
1499/*! -
1500 \property QFileDialog::confirmOverwrite -
1501 \obsolete -
1502 \brief whether the filedialog should ask before accepting a selected file, -
1503 when the accept mode is AcceptSave -
1504 -
1505 Use setOption(DontConfirmOverwrite, !\e enabled) or -
1506 !testOption(DontConfirmOverwrite) instead. -
1507*/ -
1508void QFileDialog::setConfirmOverwrite(bool enabled) -
1509{ -
1510 setOption(DontConfirmOverwrite, !enabled);
executed (the execution status of this line is deduced): setOption(DontConfirmOverwrite, !enabled);
-
1511}
executed: }
Execution Count:3
3
1512 -
1513bool QFileDialog::confirmOverwrite() const -
1514{ -
1515 return !testOption(DontConfirmOverwrite);
executed: return !testOption(DontConfirmOverwrite);
Execution Count:5
5
1516} -
1517 -
1518/*! -
1519 \property QFileDialog::defaultSuffix -
1520 \brief suffix added to the filename if no other suffix was specified -
1521 -
1522 This property specifies a string that will be added to the -
1523 filename if it has no suffix already. The suffix is typically -
1524 used to indicate the file type (e.g. "txt" indicates a text -
1525 file). -
1526*/ -
1527void QFileDialog::setDefaultSuffix(const QString &suffix) -
1528{ -
1529 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1530 d->options->setDefaultSuffix(suffix);
executed (the execution status of this line is deduced): d->options->setDefaultSuffix(suffix);
-
1531}
executed: }
Execution Count:2
2
1532 -
1533QString QFileDialog::defaultSuffix() const -
1534{ -
1535 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1536 return d->options->defaultSuffix();
executed: return d->options->defaultSuffix();
Execution Count:3
3
1537} -
1538 -
1539/*! -
1540 Sets the browsing history of the filedialog to contain the given -
1541 \a paths. -
1542*/ -
1543void QFileDialog::setHistory(const QStringList &paths) -
1544{ -
1545 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1546 d->qFileDialogUi->lookInCombo->setHistory(paths);
executed (the execution status of this line is deduced): d->qFileDialogUi->lookInCombo->setHistory(paths);
-
1547}
executed: }
Execution Count:214
214
1548 -
1549void QFileDialogComboBox::setHistory(const QStringList &paths) -
1550{ -
1551 m_history = paths;
executed (the execution status of this line is deduced): m_history = paths;
-
1552 // Only populate the first item, showPopup will populate the rest if needed -
1553 QList<QUrl> list;
executed (the execution status of this line is deduced): QList<QUrl> list;
-
1554 QModelIndex idx = d_ptr->model->index(d_ptr->rootPath());
executed (the execution status of this line is deduced): QModelIndex idx = d_ptr->model->index(d_ptr->rootPath());
-
1555 //On windows the popup display the "C:\", convert to nativeSeparators -
1556 QUrl url = QUrl::fromLocalFile(QDir::toNativeSeparators(idx.data(QFileSystemModel::FilePathRole).toString()));
executed (the execution status of this line is deduced): QUrl url = QUrl::fromLocalFile(QDir::toNativeSeparators(idx.data(QFileSystemModel::FilePathRole).toString()));
-
1557 if (url.isValid())
partially evaluated: url.isValid()
TRUEFALSE
yes
Evaluation Count:214
no
Evaluation Count:0
0-214
1558 list.append(url);
executed: list.append(url);
Execution Count:214
214
1559 urlModel->setUrls(list);
executed (the execution status of this line is deduced): urlModel->setUrls(list);
-
1560}
executed: }
Execution Count:214
214
1561 -
1562/*! -
1563 Returns the browsing history of the filedialog as a list of paths. -
1564*/ -
1565QStringList QFileDialog::history() const -
1566{ -
1567 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1568 QStringList currentHistory = d->qFileDialogUi->lookInCombo->history();
executed (the execution status of this line is deduced): QStringList currentHistory = d->qFileDialogUi->lookInCombo->history();
-
1569 //On windows the popup display the "C:\", convert to nativeSeparators -
1570 QString newHistory = QDir::toNativeSeparators(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
executed (the execution status of this line is deduced): QString newHistory = QDir::toNativeSeparators(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
-
1571 if (!currentHistory.contains(newHistory))
evaluated: !currentHistory.contains(newHistory)
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:46
46-77
1572 currentHistory << newHistory;
executed: currentHistory << newHistory;
Execution Count:77
77
1573 return currentHistory;
executed: return currentHistory;
Execution Count:123
123
1574} -
1575 -
1576/*! -
1577 Sets the item delegate used to render items in the views in the -
1578 file dialog to the given \a delegate. -
1579 -
1580 \warning You should not share the same instance of a delegate between views. -
1581 Doing so can cause incorrect or unintuitive editing behavior since each -
1582 view connected to a given delegate may receive the \l{QAbstractItemDelegate::}{closeEditor()} -
1583 signal, and attempt to access, modify or close an editor that has already been closed. -
1584 -
1585 Note that the model used is QFileSystemModel. It has custom item data roles, which is -
1586 described by the \l{QFileSystemModel::}{Roles} enum. You can use a QFileIconProvider if -
1587 you only want custom icons. -
1588 -
1589 \sa itemDelegate(), setIconProvider(), QFileSystemModel -
1590*/ -
1591void QFileDialog::setItemDelegate(QAbstractItemDelegate *delegate) -
1592{ -
1593 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1594 d->qFileDialogUi->listView->setItemDelegate(delegate);
executed (the execution status of this line is deduced): d->qFileDialogUi->listView->setItemDelegate(delegate);
-
1595 d->qFileDialogUi->treeView->setItemDelegate(delegate);
executed (the execution status of this line is deduced): d->qFileDialogUi->treeView->setItemDelegate(delegate);
-
1596}
executed: }
Execution Count:1
1
1597 -
1598/*! -
1599 Returns the item delegate used to render the items in the views in the filedialog. -
1600*/ -
1601QAbstractItemDelegate *QFileDialog::itemDelegate() const -
1602{ -
1603 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1604 return d->qFileDialogUi->listView->itemDelegate();
executed: return d->qFileDialogUi->listView->itemDelegate();
Execution Count:2
2
1605} -
1606 -
1607/*! -
1608 Sets the icon provider used by the filedialog to the specified \a provider. -
1609*/ -
1610void QFileDialog::setIconProvider(QFileIconProvider *provider) -
1611{ -
1612 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1613 d->model->setIconProvider(provider);
executed (the execution status of this line is deduced): d->model->setIconProvider(provider);
-
1614 //It forces the refresh of all entries in the side bar, then we can get new icons -
1615 d->qFileDialogUi->sidebar->setUrls(d->qFileDialogUi->sidebar->urls());
executed (the execution status of this line is deduced): d->qFileDialogUi->sidebar->setUrls(d->qFileDialogUi->sidebar->urls());
-
1616}
executed: }
Execution Count:1
1
1617 -
1618/*! -
1619 Returns the icon provider used by the filedialog. -
1620*/ -
1621QFileIconProvider *QFileDialog::iconProvider() const -
1622{ -
1623 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1624 return d->model->iconProvider();
executed: return d->model->iconProvider();
Execution Count:2
2
1625} -
1626 -
1627void QFileDialogPrivate::setLabelTextControl(QFileDialog::DialogLabel label, const QString &text) -
1628{ -
1629 switch (label) { -
1630 case QFileDialog::LookIn: -
1631 qFileDialogUi->lookInLabel->setText(text);
executed (the execution status of this line is deduced): qFileDialogUi->lookInLabel->setText(text);
-
1632 break;
executed: break;
Execution Count:1
1
1633 case QFileDialog::FileName: -
1634 qFileDialogUi->fileNameLabel->setText(text);
executed (the execution status of this line is deduced): qFileDialogUi->fileNameLabel->setText(text);
-
1635 break;
executed: break;
Execution Count:254
254
1636 case QFileDialog::FileType: -
1637 qFileDialogUi->fileTypeLabel->setText(text);
executed (the execution status of this line is deduced): qFileDialogUi->fileTypeLabel->setText(text);
-
1638 break;
executed: break;
Execution Count:1
1
1639 case QFileDialog::Accept: -
1640 if (q_func()->acceptMode() == QFileDialog::AcceptOpen) {
evaluated: q_func()->acceptMode() == QFileDialog::AcceptOpen
TRUEFALSE
yes
Evaluation Count:486
yes
Evaluation Count:22
22-486
1641 if (QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Open))
evaluated: QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Open)
TRUEFALSE
yes
Evaluation Count:367
yes
Evaluation Count:119
119-367
1642 button->setText(text);
executed: button->setText(text);
Execution Count:367
367
1643 } else {
executed: }
Execution Count:486
486
1644 if (QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Save))
partially evaluated: QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Save)
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
0-22
1645 button->setText(text);
executed: button->setText(text);
Execution Count:22
22
1646 }
executed: }
Execution Count:22
22
1647 break;
executed: break;
Execution Count:508
508
1648 case QFileDialog::Reject: -
1649 if (QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel))
partially evaluated: QPushButton *button = qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1650 button->setText(text);
executed: button->setText(text);
Execution Count:1
1
1651 break;
executed: break;
Execution Count:1
1
1652 } -
1653}
executed: }
Execution Count:765
765
1654 -
1655/*! -
1656 Sets the \a text shown in the filedialog in the specified \a label. -
1657*/ -
1658 -
1659void QFileDialog::setLabelText(DialogLabel label, const QString &text) -
1660{ -
1661 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
1662 d->options->setLabelText(static_cast<QFileDialogOptions::DialogLabel>(label), text);
executed (the execution status of this line is deduced): d->options->setLabelText(static_cast<QFileDialogOptions::DialogLabel>(label), text);
-
1663 d->setLabelTextControl(label, text);
executed (the execution status of this line is deduced): d->setLabelTextControl(label, text);
-
1664}
executed: }
Execution Count:7
7
1665 -
1666/*! -
1667 Returns the text shown in the filedialog in the specified \a label. -
1668*/ -
1669QString QFileDialog::labelText(DialogLabel label) const -
1670{ -
1671 QPushButton *button;
executed (the execution status of this line is deduced): QPushButton *button;
-
1672 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
1673 switch (label) { -
1674 case LookIn: -
1675 return d->qFileDialogUi->lookInLabel->text();
executed: return d->qFileDialogUi->lookInLabel->text();
Execution Count:2
2
1676 case FileName: -
1677 return d->qFileDialogUi->fileNameLabel->text();
executed: return d->qFileDialogUi->fileNameLabel->text();
Execution Count:2
2
1678 case FileType: -
1679 return d->qFileDialogUi->fileTypeLabel->text();
executed: return d->qFileDialogUi->fileTypeLabel->text();
Execution Count:2
2
1680 case Accept: -
1681 if (acceptMode() == AcceptOpen)
partially evaluated: acceptMode() == AcceptOpen
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1682 button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Open);
executed: button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Open);
Execution Count:2
2
1683 else -
1684 button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Save);
never executed: button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Save);
0
1685 if (button)
partially evaluated: button
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1686 return button->text();
executed: return button->text();
Execution Count:2
2
1687 case Reject:
code before this statement never executed: case Reject:
0
1688 button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel);
executed (the execution status of this line is deduced): button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel);
-
1689 if (button)
partially evaluated: button
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1690 return button->text();
executed: return button->text();
Execution Count:2
2
1691 }
never executed: }
0
1692 return QString();
never executed: return QString();
0
1693} -
1694 -
1695/* -
1696 For the native file dialogs -
1697*/ -
1698 -
1699#if defined(Q_WS_WIN) -
1700extern QString qt_win_get_open_file_name(const QFileDialogArgs &args, -
1701 QString *initialDirectory, -
1702 QString *selectedFilter); -
1703 -
1704extern QString qt_win_get_save_file_name(const QFileDialogArgs &args, -
1705 QString *initialDirectory, -
1706 QString *selectedFilter); -
1707 -
1708extern QStringList qt_win_get_open_file_names(const QFileDialogArgs &args, -
1709 QString *initialDirectory, -
1710 QString *selectedFilter); -
1711 -
1712extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); -
1713#endif -
1714 -
1715/*! -
1716 This is a convenience static function that returns an existing file -
1717 selected by the user. If the user presses Cancel, it returns a null string. -
1718 -
1719 \snippet code/src_gui_dialogs_qfiledialog.cpp 8 -
1720 -
1721 The function creates a modal file dialog with the given \a parent widget. -
1722 If \a parent is not 0, the dialog will be shown centered over the parent -
1723 widget. -
1724 -
1725 The file dialog's working directory will be set to \a dir. If \a dir -
1726 includes a file name, the file will be selected. Only files that match the -
1727 given \a filter are shown. The filter selected is set to \a selectedFilter. -
1728 The parameters \a dir, \a selectedFilter, and \a filter may be empty -
1729 strings. If you want multiple filters, separate them with ';;', for -
1730 example: -
1731 -
1732 \code -
1733 "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)" -
1734 \endcode -
1735 -
1736 The \a options argument holds various options about how to run the dialog, -
1737 see the QFileDialog::Option enum for more information on the flags you can -
1738 pass. -
1739 -
1740 The dialog's caption is set to \a caption. If \a caption is not specified -
1741 then a default caption will be used. -
1742 -
1743 On Windows, and Mac OS X, this static function will use the -
1744 native file dialog and not a QFileDialog. -
1745 -
1746 On Windows the dialog will spin a blocking modal event loop that will not -
1747 dispatch any QTimers, and if \a parent is not 0 then it will position the -
1748 dialog just below the parent's title bar. -
1749 -
1750 On Unix/X11, the normal behavior of the file dialog is to resolve and -
1751 follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, -
1752 the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If -
1753 \a options includes DontResolveSymlinks, the file dialog will treat -
1754 symlinks as regular directories. -
1755 -
1756 \warning Do not delete \a parent during the execution of the dialog. If you -
1757 want to do this, you should create the dialog yourself using one of the -
1758 QFileDialog constructors. -
1759 -
1760 \sa getOpenFileNames(), getSaveFileName(), getExistingDirectory() -
1761*/ -
1762QString QFileDialog::getOpenFileName(QWidget *parent, -
1763 const QString &caption, -
1764 const QString &dir, -
1765 const QString &filter, -
1766 QString *selectedFilter, -
1767 Options options) -
1768{ -
1769 if (qt_filedialog_open_filename_hook && !(options & DontUseNativeDialog))
partially evaluated: qt_filedialog_open_filename_hook
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !(options & DontUseNativeDialog)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1770 return qt_filedialog_open_filename_hook(parent, caption, dir, filter, selectedFilter, options);
executed: return qt_filedialog_open_filename_hook(parent, caption, dir, filter, selectedFilter, options);
Execution Count:1
1
1771 QFileDialogArgs args;
never executed (the execution status of this line is deduced): QFileDialogArgs args;
-
1772 args.parent = parent;
never executed (the execution status of this line is deduced): args.parent = parent;
-
1773 args.caption = caption;
never executed (the execution status of this line is deduced): args.caption = caption;
-
1774 args.directory = QFileDialogPrivate::workingDirectory(dir);
never executed (the execution status of this line is deduced): args.directory = QFileDialogPrivate::workingDirectory(dir);
-
1775 args.selection = QFileDialogPrivate::initialSelection(dir);
never executed (the execution status of this line is deduced): args.selection = QFileDialogPrivate::initialSelection(dir);
-
1776 args.filter = filter;
never executed (the execution status of this line is deduced): args.filter = filter;
-
1777 args.mode = ExistingFile;
never executed (the execution status of this line is deduced): args.mode = ExistingFile;
-
1778 args.options = options;
never executed (the execution status of this line is deduced): args.options = options;
-
1779#if defined(Q_WS_WIN) -
1780 if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) { -
1781 return qt_win_get_open_file_name(args, &(args.directory), selectedFilter); -
1782 } -
1783#endif -
1784 -
1785 // create a qt dialog -
1786 QFileDialog dialog(args);
never executed (the execution status of this line is deduced): QFileDialog dialog(args);
-
1787 if (selectedFilter && !selectedFilter->isEmpty())
never evaluated: selectedFilter
never evaluated: !selectedFilter->isEmpty()
0
1788 dialog.selectNameFilter(*selectedFilter);
never executed: dialog.selectNameFilter(*selectedFilter);
0
1789 if (dialog.exec() == QDialog::Accepted) {
never evaluated: dialog.exec() == QDialog::Accepted
0
1790 if (selectedFilter)
never evaluated: selectedFilter
0
1791 *selectedFilter = dialog.selectedNameFilter();
never executed: *selectedFilter = dialog.selectedNameFilter();
0
1792 return dialog.selectedFiles().value(0);
never executed: return dialog.selectedFiles().value(0);
0
1793 } -
1794 return QString();
never executed: return QString();
0
1795} -
1796 -
1797/*! -
1798 This is a convenience static function that will return one or more existing -
1799 files selected by the user. -
1800 -
1801 \snippet code/src_gui_dialogs_qfiledialog.cpp 9 -
1802 -
1803 This function creates a modal file dialog with the given \a parent widget. -
1804 If \a parent is not 0, the dialog will be shown centered over the parent -
1805 widget. -
1806 -
1807 The file dialog's working directory will be set to \a dir. If \a dir -
1808 includes a file name, the file will be selected. The filter is set to -
1809 \a filter so that only those files which match the filter are shown. The -
1810 filter selected is set to \a selectedFilter. The parameters \a dir, -
1811 \a selectedFilter and \a filter may be empty strings. If you need multiple -
1812 filters, separate them with ';;', for instance: -
1813 -
1814 \code -
1815 "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)" -
1816 \endcode -
1817 -
1818 The dialog's caption is set to \a caption. If \a caption is not specified -
1819 then a default caption will be used. -
1820 -
1821 On Windows, and Mac OS X, this static function will use the -
1822 native file dialog and not a QFileDialog. -
1823 -
1824 On Windows the dialog will spin a blocking modal event loop that will not -
1825 dispatch any QTimers, and if \a parent is not 0 then it will position the -
1826 dialog just below the parent's title bar. -
1827 -
1828 On Unix/X11, the normal behavior of the file dialog is to resolve and -
1829 follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, -
1830 the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. -
1831 The \a options argument holds various options about how to run the dialog, -
1832 see the QFileDialog::Option enum for more information on the flags you can -
1833 pass. -
1834 -
1835 \note If you want to iterate over the list of files, you should iterate -
1836 over a copy. For example: -
1837 -
1838 \snippet code/src_gui_dialogs_qfiledialog.cpp 10 -
1839 -
1840 \warning Do not delete \a parent during the execution of the dialog. If you -
1841 want to do this, you should create the dialog yourself using one of the -
1842 QFileDialog constructors. -
1843 -
1844 \sa getOpenFileName(), getSaveFileName(), getExistingDirectory() -
1845*/ -
1846QStringList QFileDialog::getOpenFileNames(QWidget *parent, -
1847 const QString &caption, -
1848 const QString &dir, -
1849 const QString &filter, -
1850 QString *selectedFilter, -
1851 Options options) -
1852{ -
1853 if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog))
partially evaluated: qt_filedialog_open_filenames_hook
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !(options & DontUseNativeDialog)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1854 return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options);
executed: return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options);
Execution Count:1
1
1855 QFileDialogArgs args;
never executed (the execution status of this line is deduced): QFileDialogArgs args;
-
1856 args.parent = parent;
never executed (the execution status of this line is deduced): args.parent = parent;
-
1857 args.caption = caption;
never executed (the execution status of this line is deduced): args.caption = caption;
-
1858 args.directory = QFileDialogPrivate::workingDirectory(dir);
never executed (the execution status of this line is deduced): args.directory = QFileDialogPrivate::workingDirectory(dir);
-
1859 args.selection = QFileDialogPrivate::initialSelection(dir);
never executed (the execution status of this line is deduced): args.selection = QFileDialogPrivate::initialSelection(dir);
-
1860 args.filter = filter;
never executed (the execution status of this line is deduced): args.filter = filter;
-
1861 args.mode = ExistingFiles;
never executed (the execution status of this line is deduced): args.mode = ExistingFiles;
-
1862 args.options = options;
never executed (the execution status of this line is deduced): args.options = options;
-
1863 -
1864#if defined(Q_WS_WIN) -
1865 if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) { -
1866 return qt_win_get_open_file_names(args, &(args.directory), selectedFilter); -
1867 } -
1868#endif -
1869 -
1870 // create a qt dialog -
1871 QFileDialog dialog(args);
never executed (the execution status of this line is deduced): QFileDialog dialog(args);
-
1872 if (selectedFilter && !selectedFilter->isEmpty())
never evaluated: selectedFilter
never evaluated: !selectedFilter->isEmpty()
0
1873 dialog.selectNameFilter(*selectedFilter);
never executed: dialog.selectNameFilter(*selectedFilter);
0
1874 if (dialog.exec() == QDialog::Accepted) {
never evaluated: dialog.exec() == QDialog::Accepted
0
1875 if (selectedFilter)
never evaluated: selectedFilter
0
1876 *selectedFilter = dialog.selectedNameFilter();
never executed: *selectedFilter = dialog.selectedNameFilter();
0
1877 return dialog.selectedFiles();
never executed: return dialog.selectedFiles();
0
1878 } -
1879 return QStringList();
never executed: return QStringList();
0
1880} -
1881 -
1882/*! -
1883 This is a convenience static function that will return a file name selected -
1884 by the user. The file does not have to exist. -
1885 -
1886 It creates a modal file dialog with the given \a parent widget. If -
1887 \a parent is not 0, the dialog will be shown centered over the parent -
1888 widget. -
1889 -
1890 \snippet code/src_gui_dialogs_qfiledialog.cpp 11 -
1891 -
1892 The file dialog's working directory will be set to \a dir. If \a dir -
1893 includes a file name, the file will be selected. Only files that match the -
1894 \a filter are shown. The filter selected is set to \a selectedFilter. The -
1895 parameters \a dir, \a selectedFilter, and \a filter may be empty strings. -
1896 Multiple filters are separated with ';;'. For instance: -
1897 -
1898 \code -
1899 "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)" -
1900 \endcode -
1901 -
1902 The \a options argument holds various options about how to run the dialog, -
1903 see the QFileDialog::Option enum for more information on the flags you can -
1904 pass. -
1905 -
1906 The default filter can be chosen by setting \a selectedFilter to the -
1907 desired value. -
1908 -
1909 The dialog's caption is set to \a caption. If \a caption is not specified, -
1910 a default caption will be used. -
1911 -
1912 On Windows, and Mac OS X, this static function will use the -
1913 native file dialog and not a QFileDialog. -
1914 -
1915 On Windows the dialog will spin a blocking modal event loop that will not -
1916 dispatch any QTimers, and if \a parent is not 0 then it will position the -
1917 dialog just below the parent's title bar. On Mac OS X, with its native file -
1918 dialog, the filter argument is ignored. -
1919 -
1920 On Unix/X11, the normal behavior of the file dialog is to resolve and -
1921 follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, -
1922 the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If -
1923 \a options includes DontResolveSymlinks the file dialog will treat symlinks -
1924 as regular directories. -
1925 -
1926 \warning Do not delete \a parent during the execution of the dialog. If you -
1927 want to do this, you should create the dialog yourself using one of the -
1928 QFileDialog constructors. -
1929 -
1930 \sa getOpenFileName(), getOpenFileNames(), getExistingDirectory() -
1931*/ -
1932QString QFileDialog::getSaveFileName(QWidget *parent, -
1933 const QString &caption, -
1934 const QString &dir, -
1935 const QString &filter, -
1936 QString *selectedFilter, -
1937 Options options) -
1938{ -
1939 if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog))
partially evaluated: qt_filedialog_save_filename_hook
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !(options & DontUseNativeDialog)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1940 return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options);
executed: return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options);
Execution Count:1
1
1941 QFileDialogArgs args;
never executed (the execution status of this line is deduced): QFileDialogArgs args;
-
1942 args.parent = parent;
never executed (the execution status of this line is deduced): args.parent = parent;
-
1943 args.caption = caption;
never executed (the execution status of this line is deduced): args.caption = caption;
-
1944 args.directory = QFileDialogPrivate::workingDirectory(dir);
never executed (the execution status of this line is deduced): args.directory = QFileDialogPrivate::workingDirectory(dir);
-
1945 args.selection = QFileDialogPrivate::initialSelection(dir);
never executed (the execution status of this line is deduced): args.selection = QFileDialogPrivate::initialSelection(dir);
-
1946 args.filter = filter;
never executed (the execution status of this line is deduced): args.filter = filter;
-
1947 args.mode = AnyFile;
never executed (the execution status of this line is deduced): args.mode = AnyFile;
-
1948 args.options = options;
never executed (the execution status of this line is deduced): args.options = options;
-
1949 -
1950#if defined(Q_WS_WIN) -
1951 if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) { -
1952 return qt_win_get_save_file_name(args, &(args.directory), selectedFilter); -
1953 } -
1954#endif -
1955 -
1956 // create a qt dialog -
1957 QFileDialog dialog(args);
never executed (the execution status of this line is deduced): QFileDialog dialog(args);
-
1958 dialog.setAcceptMode(AcceptSave);
never executed (the execution status of this line is deduced): dialog.setAcceptMode(AcceptSave);
-
1959 if (selectedFilter && !selectedFilter->isEmpty())
never evaluated: selectedFilter
never evaluated: !selectedFilter->isEmpty()
0
1960 dialog.selectNameFilter(*selectedFilter);
never executed: dialog.selectNameFilter(*selectedFilter);
0
1961 if (dialog.exec() == QDialog::Accepted) {
never evaluated: dialog.exec() == QDialog::Accepted
0
1962 if (selectedFilter)
never evaluated: selectedFilter
0
1963 *selectedFilter = dialog.selectedNameFilter();
never executed: *selectedFilter = dialog.selectedNameFilter();
0
1964 return dialog.selectedFiles().value(0);
never executed: return dialog.selectedFiles().value(0);
0
1965 } -
1966 -
1967 return QString();
never executed: return QString();
0
1968} -
1969 -
1970/*! -
1971 This is a convenience static function that will return an existing -
1972 directory selected by the user. -
1973 -
1974 \snippet code/src_gui_dialogs_qfiledialog.cpp 12 -
1975 -
1976 This function creates a modal file dialog with the given \a parent widget. -
1977 If \a parent is not 0, the dialog will be shown centered over the parent -
1978 widget. -
1979 -
1980 The dialog's working directory is set to \a dir, and the caption is set to -
1981 \a caption. Either of these may be an empty string in which case the -
1982 current directory and a default caption will be used respectively. -
1983 -
1984 The \a options argument holds various options about how to run the dialog, -
1985 see the QFileDialog::Option enum for more information on the flags you can -
1986 pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must -
1987 be set. -
1988 -
1989 On Windows, and Mac OS X, this static function will use the -
1990 native file dialog and not a QFileDialog. On Windows CE, if the device has -
1991 no native file dialog, a QFileDialog will be used. -
1992 -
1993 On Unix/X11, the normal behavior of the file dialog is to resolve and -
1994 follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, -
1995 the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If -
1996 \a options includes DontResolveSymlinks, the file dialog will treat -
1997 symlinks as regular directories. -
1998 -
1999 On Windows the dialog will spin a blocking modal event loop that will not -
2000 dispatch any QTimers, and if \a parent is not 0 then it will position the -
2001 dialog just below the parent's title bar. -
2002 -
2003 \warning Do not delete \a parent during the execution of the dialog. If you -
2004 want to do this, you should create the dialog yourself using one of the -
2005 QFileDialog constructors. -
2006 -
2007 \sa getOpenFileName(), getOpenFileNames(), getSaveFileName() -
2008*/ -
2009QString QFileDialog::getExistingDirectory(QWidget *parent, -
2010 const QString &caption, -
2011 const QString &dir, -
2012 Options options) -
2013{ -
2014 if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog))
partially evaluated: qt_filedialog_existing_directory_hook
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !(options & DontUseNativeDialog)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2015 return qt_filedialog_existing_directory_hook(parent, caption, dir, options);
executed: return qt_filedialog_existing_directory_hook(parent, caption, dir, options);
Execution Count:1
1
2016 QFileDialogArgs args;
never executed (the execution status of this line is deduced): QFileDialogArgs args;
-
2017 args.parent = parent;
never executed (the execution status of this line is deduced): args.parent = parent;
-
2018 args.caption = caption;
never executed (the execution status of this line is deduced): args.caption = caption;
-
2019 args.directory = QFileDialogPrivate::workingDirectory(dir);
never executed (the execution status of this line is deduced): args.directory = QFileDialogPrivate::workingDirectory(dir);
-
2020 args.mode = (options & ShowDirsOnly ? DirectoryOnly : Directory);
never evaluated: options & ShowDirsOnly
0
2021 args.options = options;
never executed (the execution status of this line is deduced): args.options = options;
-
2022 -
2023#if defined(Q_WS_WIN) -
2024 if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog) && (options & ShowDirsOnly) -
2025#if defined(Q_OS_WINCE) -
2026 && qt_priv_ptr_valid -
2027#endif -
2028 ) { -
2029 return qt_win_get_existing_directory(args); -
2030 } -
2031#endif -
2032 -
2033 // create a qt dialog -
2034 QFileDialog dialog(args);
never executed (the execution status of this line is deduced): QFileDialog dialog(args);
-
2035 if (dialog.exec() == QDialog::Accepted) {
never evaluated: dialog.exec() == QDialog::Accepted
0
2036 return dialog.selectedFiles().value(0);
never executed: return dialog.selectedFiles().value(0);
0
2037 } -
2038 return QString();
never executed: return QString();
0
2039} -
2040 -
2041inline static QString _qt_get_directory(const QString &path) -
2042{ -
2043 QFileInfo info = QFileInfo(QDir::current(), path);
executed (the execution status of this line is deduced): QFileInfo info = QFileInfo(QDir::current(), path);
-
2044 if (info.exists() && info.isDir())
evaluated: info.exists()
TRUEFALSE
yes
Evaluation Count:128
yes
Evaluation Count:9
partially evaluated: info.isDir()
TRUEFALSE
yes
Evaluation Count:128
no
Evaluation Count:0
0-128
2045 return QDir::cleanPath(info.absoluteFilePath());
executed: return QDir::cleanPath(info.absoluteFilePath());
Execution Count:128
128
2046 info.setFile(info.absolutePath());
executed (the execution status of this line is deduced): info.setFile(info.absolutePath());
-
2047 if (info.exists() && info.isDir())
partially evaluated: info.exists()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
partially evaluated: info.isDir()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
2048 return info.absoluteFilePath();
executed: return info.absoluteFilePath();
Execution Count:9
9
2049 return QString();
never executed: return QString();
0
2050} -
2051/* -
2052 Get the initial directory path -
2053 -
2054 \sa initialSelection() -
2055 */ -
2056QString QFileDialogPrivate::workingDirectory(const QString &path) -
2057{ -
2058 if (!path.isEmpty()) {
evaluated: !path.isEmpty()
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:101
36-101
2059 QString directory = _qt_get_directory(path);
executed (the execution status of this line is deduced): QString directory = _qt_get_directory(path);
-
2060 if (!directory.isEmpty())
partially evaluated: !directory.isEmpty()
TRUEFALSE
yes
Evaluation Count:36
no
Evaluation Count:0
0-36
2061 return directory;
executed: return directory;
Execution Count:36
36
2062 }
never executed: }
0
2063 QString directory = _qt_get_directory(*lastVisitedDir());
executed (the execution status of this line is deduced): QString directory = _qt_get_directory(*lastVisitedDir());
-
2064 if (!directory.isEmpty())
partially evaluated: !directory.isEmpty()
TRUEFALSE
yes
Evaluation Count:101
no
Evaluation Count:0
0-101
2065 return directory;
executed: return directory;
Execution Count:101
101
2066 return QDir::currentPath();
never executed: return QDir::currentPath();
0
2067} -
2068 -
2069/* -
2070 Get the initial selection given a path. The initial directory -
2071 can contain both the initial directory and initial selection -
2072 /home/user/foo.txt -
2073 -
2074 \sa workingDirectory() -
2075 */ -
2076QString QFileDialogPrivate::initialSelection(const QString &path) -
2077{ -
2078 if (!path.isEmpty()) {
evaluated: !path.isEmpty()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:101
18-101
2079 QFileInfo info(path);
executed (the execution status of this line is deduced): QFileInfo info(path);
-
2080 if (!info.isDir())
evaluated: !info.isDir()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:14
4-14
2081 return info.fileName();
executed: return info.fileName();
Execution Count:4
4
2082 }
executed: }
Execution Count:14
14
2083 return QString();
executed: return QString();
Execution Count:115
115
2084} -
2085 -
2086/*! -
2087 \reimp -
2088*/ -
2089void QFileDialog::done(int result) -
2090{ -
2091 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
2092 -
2093 QDialog::done(result);
executed (the execution status of this line is deduced): QDialog::done(result);
-
2094 -
2095 if (d->receiverToDisconnectOnClose) {
partially evaluated: d->receiverToDisconnectOnClose
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2096 disconnect(this, d->signalToDisconnectOnClose,
never executed (the execution status of this line is deduced): disconnect(this, d->signalToDisconnectOnClose,
-
2097 d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
never executed (the execution status of this line is deduced): d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
-
2098 d->receiverToDisconnectOnClose = 0;
never executed (the execution status of this line is deduced): d->receiverToDisconnectOnClose = 0;
-
2099 }
never executed: }
0
2100 d->memberToDisconnectOnClose.clear();
executed (the execution status of this line is deduced): d->memberToDisconnectOnClose.clear();
-
2101 d->signalToDisconnectOnClose.clear();
executed (the execution status of this line is deduced): d->signalToDisconnectOnClose.clear();
-
2102}
executed: }
Execution Count:5
5
2103 -
2104/*! -
2105 \reimp -
2106*/ -
2107void QFileDialog::accept() -
2108{ -
2109 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
2110 QStringList files = selectedFiles();
executed (the execution status of this line is deduced): QStringList files = selectedFiles();
-
2111 if (files.isEmpty())
partially evaluated: files.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2112 return;
never executed: return;
0
2113 if (d->nativeDialogInUse){
partially evaluated: d->nativeDialogInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2114 d->emitFilesSelected(files);
never executed (the execution status of this line is deduced): d->emitFilesSelected(files);
-
2115 QDialog::accept();
never executed (the execution status of this line is deduced): QDialog::accept();
-
2116 return;
never executed: return;
0
2117 } -
2118 -
2119 QString lineEditText = d->lineEdit()->text();
executed (the execution status of this line is deduced): QString lineEditText = d->lineEdit()->text();
-
2120 // "hidden feature" type .. and then enter, and it will move up a dir -
2121 // special case for ".." -
2122 if (lineEditText == QLatin1String("..")) {
partially evaluated: lineEditText == QLatin1String("..")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2123 d->_q_navigateToParent();
never executed (the execution status of this line is deduced): d->_q_navigateToParent();
-
2124 bool block = d->qFileDialogUi->fileNameEdit->blockSignals(true);
never executed (the execution status of this line is deduced): bool block = d->qFileDialogUi->fileNameEdit->blockSignals(true);
-
2125 d->lineEdit()->selectAll();
never executed (the execution status of this line is deduced): d->lineEdit()->selectAll();
-
2126 d->qFileDialogUi->fileNameEdit->blockSignals(block);
never executed (the execution status of this line is deduced): d->qFileDialogUi->fileNameEdit->blockSignals(block);
-
2127 return;
never executed: return;
0
2128 } -
2129 -
2130 switch (fileMode()) { -
2131 case DirectoryOnly: -
2132 case Directory: { -
2133 QString fn = files.first();
executed (the execution status of this line is deduced): QString fn = files.first();
-
2134 QFileInfo info(fn);
executed (the execution status of this line is deduced): QFileInfo info(fn);
-
2135 if (!info.exists())
partially evaluated: !info.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2136 info = QFileInfo(d->getEnvironmentVariable(fn));
never executed: info = QFileInfo(d->getEnvironmentVariable(fn));
0
2137 if (!info.exists()) {
partially evaluated: !info.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2138#ifndef QT_NO_MESSAGEBOX -
2139 QString message = tr("%1\nDirectory not found.\nPlease verify the "
never executed (the execution status of this line is deduced): QString message = tr("%1\nDirectory not found.\nPlease verify the "
-
2140 "correct directory name was given.");
never executed (the execution status of this line is deduced): "correct directory name was given.");
-
2141 QMessageBox::warning(this, windowTitle(), message.arg(info.fileName()));
never executed (the execution status of this line is deduced): QMessageBox::warning(this, windowTitle(), message.arg(info.fileName()));
-
2142#endif // QT_NO_MESSAGEBOX -
2143 return;
never executed: return;
0
2144 } -
2145 if (info.isDir()) {
partially evaluated: info.isDir()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2146 d->emitFilesSelected(files);
executed (the execution status of this line is deduced): d->emitFilesSelected(files);
-
2147 QDialog::accept();
executed (the execution status of this line is deduced): QDialog::accept();
-
2148 }
executed: }
Execution Count:2
2
2149 return;
executed: return;
Execution Count:2
2
2150 } -
2151 -
2152 case AnyFile: { -
2153 QString fn = files.first();
executed (the execution status of this line is deduced): QString fn = files.first();
-
2154 QFileInfo info(fn);
executed (the execution status of this line is deduced): QFileInfo info(fn);
-
2155 if (info.isDir()) {
partially evaluated: info.isDir()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2156 setDirectory(info.absoluteFilePath());
never executed (the execution status of this line is deduced): setDirectory(info.absoluteFilePath());
-
2157 return;
never executed: return;
0
2158 } -
2159 -
2160 if (!info.exists()) {
partially evaluated: !info.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2161 int maxNameLength = d->maxNameLength(info.path());
never executed (the execution status of this line is deduced): int maxNameLength = d->maxNameLength(info.path());
-
2162 if (maxNameLength >= 0 && info.fileName().length() > maxNameLength)
never evaluated: maxNameLength >= 0
never evaluated: info.fileName().length() > maxNameLength
0
2163 return;
never executed: return;
0
2164 }
never executed: }
0
2165 -
2166 // check if we have to ask for permission to overwrite the file -
2167 if (!info.exists() || !confirmOverwrite() || acceptMode() == AcceptOpen) {
partially evaluated: !info.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: !confirmOverwrite()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: acceptMode() == AcceptOpen
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2168 d->emitFilesSelected(QStringList(fn));
executed (the execution status of this line is deduced): d->emitFilesSelected(QStringList(fn));
-
2169 QDialog::accept();
executed (the execution status of this line is deduced): QDialog::accept();
-
2170#ifndef QT_NO_MESSAGEBOX -
2171 } else {
executed: }
Execution Count:1
1
2172 if (QMessageBox::warning(this, windowTitle(),
never evaluated: QMessageBox::warning(this, windowTitle(), tr("%1 already exists.\nDo you want to replace it?") .arg(info.fileName()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes
0
2173 tr("%1 already exists.\nDo you want to replace it?")
never evaluated: QMessageBox::warning(this, windowTitle(), tr("%1 already exists.\nDo you want to replace it?") .arg(info.fileName()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes
0
2174 .arg(info.fileName()),
never evaluated: QMessageBox::warning(this, windowTitle(), tr("%1 already exists.\nDo you want to replace it?") .arg(info.fileName()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes
0
2175 QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
never evaluated: QMessageBox::warning(this, windowTitle(), tr("%1 already exists.\nDo you want to replace it?") .arg(info.fileName()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes
0
2176 == QMessageBox::Yes) {
never evaluated: QMessageBox::warning(this, windowTitle(), tr("%1 already exists.\nDo you want to replace it?") .arg(info.fileName()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes
0
2177 d->emitFilesSelected(QStringList(fn));
never executed (the execution status of this line is deduced): d->emitFilesSelected(QStringList(fn));
-
2178 QDialog::accept();
never executed (the execution status of this line is deduced): QDialog::accept();
-
2179 }
never executed: }
0
2180#endif -
2181 }
never executed: }
0
2182 return;
executed: return;
Execution Count:1
1
2183 } -
2184 -
2185 case ExistingFile: -
2186 case ExistingFiles: -
2187 for (int i = 0; i < files.count(); ++i) {
evaluated: i < files.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2188 QFileInfo info(files.at(i));
executed (the execution status of this line is deduced): QFileInfo info(files.at(i));
-
2189 if (!info.exists())
partially evaluated: !info.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2190 info = QFileInfo(d->getEnvironmentVariable(files.at(i)));
never executed: info = QFileInfo(d->getEnvironmentVariable(files.at(i)));
0
2191 if (!info.exists()) {
partially evaluated: !info.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2192#ifndef QT_NO_MESSAGEBOX -
2193 QString message = tr("%1\nFile not found.\nPlease verify the "
never executed (the execution status of this line is deduced): QString message = tr("%1\nFile not found.\nPlease verify the "
-
2194 "correct file name was given.");
never executed (the execution status of this line is deduced): "correct file name was given.");
-
2195 QMessageBox::warning(this, windowTitle(), message.arg(info.fileName()));
never executed (the execution status of this line is deduced): QMessageBox::warning(this, windowTitle(), message.arg(info.fileName()));
-
2196#endif // QT_NO_MESSAGEBOX -
2197 return;
never executed: return;
0
2198 } -
2199 if (info.isDir()) {
partially evaluated: info.isDir()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2200 setDirectory(info.absoluteFilePath());
never executed (the execution status of this line is deduced): setDirectory(info.absoluteFilePath());
-
2201 d->lineEdit()->clear();
never executed (the execution status of this line is deduced): d->lineEdit()->clear();
-
2202 return;
never executed: return;
0
2203 } -
2204 }
executed: }
Execution Count:2
2
2205 d->emitFilesSelected(files);
executed (the execution status of this line is deduced): d->emitFilesSelected(files);
-
2206 QDialog::accept();
executed (the execution status of this line is deduced): QDialog::accept();
-
2207 return;
executed: return;
Execution Count:2
2
2208 } -
2209}
never executed: }
0
2210 -
2211/*! -
2212 \internal -
2213 -
2214 Create widgets, layout and set default values -
2215*/ -
2216void QFileDialogPrivate::init(const QString &directory, const QString &nameFilter, -
2217 const QString &caption) -
2218{ -
2219 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2220 if (!caption.isEmpty()) {
evaluated: !caption.isEmpty()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:100
19-100
2221 useDefaultCaption = false;
executed (the execution status of this line is deduced): useDefaultCaption = false;
-
2222 setWindowTitle = caption;
executed (the execution status of this line is deduced): setWindowTitle = caption;
-
2223 q->setWindowTitle(caption);
executed (the execution status of this line is deduced): q->setWindowTitle(caption);
-
2224 }
executed: }
Execution Count:19
19
2225 -
2226 createWidgets();
executed (the execution status of this line is deduced): createWidgets();
-
2227 createMenuActions();
executed (the execution status of this line is deduced): createMenuActions();
-
2228 retranslateStrings();
executed (the execution status of this line is deduced): retranslateStrings();
-
2229 q->setFileMode(QFileDialog::AnyFile);
executed (the execution status of this line is deduced): q->setFileMode(QFileDialog::AnyFile);
-
2230 -
2231#ifndef QT_NO_SETTINGS -
2232 QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
executed (the execution status of this line is deduced): QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
-
2233 settings.beginGroup(QLatin1String("Qt"));
executed (the execution status of this line is deduced): settings.beginGroup(QLatin1String("Qt"));
-
2234 if (!directory.isEmpty())
evaluated: !directory.isEmpty()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:101
18-101
2235 setLastVisitedDirectory(workingDirectory(directory));
executed: setLastVisitedDirectory(workingDirectory(directory));
Execution Count:18
18
2236 q->restoreState(settings.value(QLatin1String("filedialog")).toByteArray());
executed (the execution status of this line is deduced): q->restoreState(settings.value(QLatin1String("filedialog")).toByteArray());
-
2237#endif -
2238 -
2239#if defined(Q_EMBEDDED_SMALLSCREEN) -
2240 qFileDialogUi->lookInLabel->setVisible(false); -
2241 qFileDialogUi->fileNameLabel->setVisible(false); -
2242 qFileDialogUi->fileTypeLabel->setVisible(false); -
2243 qFileDialogUi->sidebar->hide(); -
2244#endif -
2245 // Default case -
2246 if (!nameFilter.isEmpty())
evaluated: !nameFilter.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:118
1-118
2247 q->setNameFilter(nameFilter);
executed: q->setNameFilter(nameFilter);
Execution Count:1
1
2248 q->setAcceptMode(QFileDialog::AcceptOpen);
executed (the execution status of this line is deduced): q->setAcceptMode(QFileDialog::AcceptOpen);
-
2249 q->setDirectory(workingDirectory(directory));
executed (the execution status of this line is deduced): q->setDirectory(workingDirectory(directory));
-
2250 q->selectFile(initialSelection(directory));
executed (the execution status of this line is deduced): q->selectFile(initialSelection(directory));
-
2251 -
2252 _q_updateOkButton();
executed (the execution status of this line is deduced): _q_updateOkButton();
-
2253 q->resize(q->sizeHint());
executed (the execution status of this line is deduced): q->resize(q->sizeHint());
-
2254}
executed: }
Execution Count:119
119
2255 -
2256/*! -
2257 \internal -
2258 -
2259 Create the widgets, set properties and connections -
2260*/ -
2261void QFileDialogPrivate::createWidgets() -
2262{ -
2263 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2264 model = new QFileSystemModel(q);
executed (the execution status of this line is deduced): model = new QFileSystemModel(q);
-
2265 options->setFilter(model->filter());
executed (the execution status of this line is deduced): options->setFilter(model->filter());
-
2266 model->setObjectName(QLatin1String("qt_filesystem_model"));
executed (the execution status of this line is deduced): model->setObjectName(QLatin1String("qt_filesystem_model"));
-
2267 if (QPlatformFileDialogHelper *helper = platformFileDialogHelper())
partially evaluated: QPlatformFileDialogHelper *helper = platformFileDialogHelper()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:119
0-119
2268 model->setNameFilterDisables(helper->defaultNameFilterDisables());
never executed: model->setNameFilterDisables(helper->defaultNameFilterDisables());
0
2269 else -
2270 model->setNameFilterDisables(false);
executed: model->setNameFilterDisables(false);
Execution Count:119
119
2271 model->d_func()->disableRecursiveSort = true;
executed (the execution status of this line is deduced): model->d_func()->disableRecursiveSort = true;
-
2272 QFileDialog::connect(model, SIGNAL(fileRenamed(QString,QString,QString)), q, SLOT(_q_fileRenamed(QString,QString,QString)));
executed (the execution status of this line is deduced): QFileDialog::connect(model, "2""fileRenamed(QString,QString,QString)", q, "1""_q_fileRenamed(QString,QString,QString)");
-
2273 QFileDialog::connect(model, SIGNAL(rootPathChanged(QString)),
executed (the execution status of this line is deduced): QFileDialog::connect(model, "2""rootPathChanged(QString)",
-
2274 q, SLOT(_q_pathChanged(QString)));
executed (the execution status of this line is deduced): q, "1""_q_pathChanged(QString)");
-
2275 QFileDialog::connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QFileDialog::connect(model, "2""rowsInserted(QModelIndex,int,int)",
-
2276 q, SLOT(_q_rowsInserted(QModelIndex)));
executed (the execution status of this line is deduced): q, "1""_q_rowsInserted(QModelIndex)");
-
2277 model->setReadOnly(false);
executed (the execution status of this line is deduced): model->setReadOnly(false);
-
2278 -
2279 qFileDialogUi.reset(new Ui_QFileDialog());
executed (the execution status of this line is deduced): qFileDialogUi.reset(new Ui_QFileDialog());
-
2280 qFileDialogUi->setupUi(q);
executed (the execution status of this line is deduced): qFileDialogUi->setupUi(q);
-
2281 -
2282 QList<QUrl> initialBookmarks;
executed (the execution status of this line is deduced): QList<QUrl> initialBookmarks;
-
2283 initialBookmarks << QUrl::fromLocalFile(QLatin1String(""))
executed (the execution status of this line is deduced): initialBookmarks << QUrl::fromLocalFile(QLatin1String(""))
-
2284 << QUrl::fromLocalFile(QDir::homePath());
executed (the execution status of this line is deduced): << QUrl::fromLocalFile(QDir::homePath());
-
2285 qFileDialogUi->sidebar->setModelAndUrls(model, initialBookmarks);
executed (the execution status of this line is deduced): qFileDialogUi->sidebar->setModelAndUrls(model, initialBookmarks);
-
2286 QFileDialog::connect(qFileDialogUi->sidebar, SIGNAL(goToUrl(QUrl)),
executed (the execution status of this line is deduced): QFileDialog::connect(qFileDialogUi->sidebar, "2""goToUrl(QUrl)",
-
2287 q, SLOT(_q_goToUrl(QUrl)));
executed (the execution status of this line is deduced): q, "1""_q_goToUrl(QUrl)");
-
2288 -
2289 QObject::connect(qFileDialogUi->buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->buttonBox, "2""accepted()", q, "1""accept()");
-
2290 QObject::connect(qFileDialogUi->buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->buttonBox, "2""rejected()", q, "1""reject()");
-
2291 -
2292 qFileDialogUi->lookInCombo->setFileDialogPrivate(this);
executed (the execution status of this line is deduced): qFileDialogUi->lookInCombo->setFileDialogPrivate(this);
-
2293 QObject::connect(qFileDialogUi->lookInCombo, SIGNAL(activated(QString)), q, SLOT(_q_goToDirectory(QString)));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->lookInCombo, "2""activated(QString)", q, "1""_q_goToDirectory(QString)");
-
2294 -
2295 qFileDialogUi->lookInCombo->setInsertPolicy(QComboBox::NoInsert);
executed (the execution status of this line is deduced): qFileDialogUi->lookInCombo->setInsertPolicy(QComboBox::NoInsert);
-
2296 qFileDialogUi->lookInCombo->setDuplicatesEnabled(false);
executed (the execution status of this line is deduced): qFileDialogUi->lookInCombo->setDuplicatesEnabled(false);
-
2297 -
2298 // filename -
2299 qFileDialogUi->fileNameEdit->setFileDialogPrivate(this);
executed (the execution status of this line is deduced): qFileDialogUi->fileNameEdit->setFileDialogPrivate(this);
-
2300#ifndef QT_NO_SHORTCUT -
2301 qFileDialogUi->fileNameLabel->setBuddy(qFileDialogUi->fileNameEdit);
executed (the execution status of this line is deduced): qFileDialogUi->fileNameLabel->setBuddy(qFileDialogUi->fileNameEdit);
-
2302#endif -
2303#ifndef QT_NO_FSCOMPLETER -
2304 completer = new QFSCompleter(model, q);
executed (the execution status of this line is deduced): completer = new QFSCompleter(model, q);
-
2305 qFileDialogUi->fileNameEdit->setCompleter(completer);
executed (the execution status of this line is deduced): qFileDialogUi->fileNameEdit->setCompleter(completer);
-
2306#endif // QT_NO_FSCOMPLETER -
2307 QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->fileNameEdit, "2""textChanged(QString)",
-
2308 q, SLOT(_q_autoCompleteFileName(QString)));
executed (the execution status of this line is deduced): q, "1""_q_autoCompleteFileName(QString)");
-
2309 QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->fileNameEdit, "2""textChanged(QString)",
-
2310 q, SLOT(_q_updateOkButton()));
executed (the execution status of this line is deduced): q, "1""_q_updateOkButton()");
-
2311 -
2312 QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(returnPressed()), q, SLOT(accept()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->fileNameEdit, "2""returnPressed()", q, "1""accept()");
-
2313 -
2314 // filetype -
2315 qFileDialogUi->fileTypeCombo->setDuplicatesEnabled(false);
executed (the execution status of this line is deduced): qFileDialogUi->fileTypeCombo->setDuplicatesEnabled(false);
-
2316 qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
executed (the execution status of this line is deduced): qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
-
2317 qFileDialogUi->fileTypeCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
executed (the execution status of this line is deduced): qFileDialogUi->fileTypeCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-
2318 QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(activated(int)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->fileTypeCombo, "2""activated(int)",
-
2319 q, SLOT(_q_useNameFilter(int)));
executed (the execution status of this line is deduced): q, "1""_q_useNameFilter(int)");
-
2320 QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(activated(QString)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->fileTypeCombo, "2""activated(QString)",
-
2321 q, SIGNAL(filterSelected(QString)));
executed (the execution status of this line is deduced): q, "2""filterSelected(QString)");
-
2322 -
2323 qFileDialogUi->listView->setFileDialogPrivate(this);
executed (the execution status of this line is deduced): qFileDialogUi->listView->setFileDialogPrivate(this);
-
2324 qFileDialogUi->listView->setModel(model);
executed (the execution status of this line is deduced): qFileDialogUi->listView->setModel(model);
-
2325 QObject::connect(qFileDialogUi->listView, SIGNAL(activated(QModelIndex)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->listView, "2""activated(QModelIndex)",
-
2326 q, SLOT(_q_enterDirectory(QModelIndex)));
executed (the execution status of this line is deduced): q, "1""_q_enterDirectory(QModelIndex)");
-
2327 QObject::connect(qFileDialogUi->listView, SIGNAL(customContextMenuRequested(QPoint)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->listView, "2""customContextMenuRequested(QPoint)",
-
2328 q, SLOT(_q_showContextMenu(QPoint)));
executed (the execution status of this line is deduced): q, "1""_q_showContextMenu(QPoint)");
-
2329#ifndef QT_NO_SHORTCUT -
2330 QShortcut *shortcut = new QShortcut(qFileDialogUi->listView);
executed (the execution status of this line is deduced): QShortcut *shortcut = new QShortcut(qFileDialogUi->listView);
-
2331 shortcut->setKey(QKeySequence(QLatin1String("Delete")));
executed (the execution status of this line is deduced): shortcut->setKey(QKeySequence(QLatin1String("Delete")));
-
2332 QObject::connect(shortcut, SIGNAL(activated()), q, SLOT(_q_deleteCurrent()));
executed (the execution status of this line is deduced): QObject::connect(shortcut, "2""activated()", q, "1""_q_deleteCurrent()");
-
2333#endif -
2334 -
2335 qFileDialogUi->treeView->setFileDialogPrivate(this);
executed (the execution status of this line is deduced): qFileDialogUi->treeView->setFileDialogPrivate(this);
-
2336 qFileDialogUi->treeView->setModel(model);
executed (the execution status of this line is deduced): qFileDialogUi->treeView->setModel(model);
-
2337 QHeaderView *treeHeader = qFileDialogUi->treeView->header();
executed (the execution status of this line is deduced): QHeaderView *treeHeader = qFileDialogUi->treeView->header();
-
2338 QFontMetrics fm(q->font());
executed (the execution status of this line is deduced): QFontMetrics fm(q->font());
-
2339 treeHeader->resizeSection(0, fm.width(QLatin1String("wwwwwwwwwwwwwwwwwwwwwwwwww")));
executed (the execution status of this line is deduced): treeHeader->resizeSection(0, fm.width(QLatin1String("wwwwwwwwwwwwwwwwwwwwwwwwww")));
-
2340 treeHeader->resizeSection(1, fm.width(QLatin1String("128.88 GB")));
executed (the execution status of this line is deduced): treeHeader->resizeSection(1, fm.width(QLatin1String("128.88 GB")));
-
2341 treeHeader->resizeSection(2, fm.width(QLatin1String("mp3Folder")));
executed (the execution status of this line is deduced): treeHeader->resizeSection(2, fm.width(QLatin1String("mp3Folder")));
-
2342 treeHeader->resizeSection(3, fm.width(QLatin1String("10/29/81 02:02PM")));
executed (the execution status of this line is deduced): treeHeader->resizeSection(3, fm.width(QLatin1String("10/29/81 02:02PM")));
-
2343 treeHeader->setContextMenuPolicy(Qt::ActionsContextMenu);
executed (the execution status of this line is deduced): treeHeader->setContextMenuPolicy(Qt::ActionsContextMenu);
-
2344 -
2345 QActionGroup *showActionGroup = new QActionGroup(q);
executed (the execution status of this line is deduced): QActionGroup *showActionGroup = new QActionGroup(q);
-
2346 showActionGroup->setExclusive(false);
executed (the execution status of this line is deduced): showActionGroup->setExclusive(false);
-
2347 QObject::connect(showActionGroup, SIGNAL(triggered(QAction*)),
executed (the execution status of this line is deduced): QObject::connect(showActionGroup, "2""triggered(QAction*)",
-
2348 q, SLOT(_q_showHeader(QAction*)));;
executed (the execution status of this line is deduced): q, "1""_q_showHeader(QAction*)");;
-
2349 -
2350 QAbstractItemModel *abstractModel = model;
executed (the execution status of this line is deduced): QAbstractItemModel *abstractModel = model;
-
2351#ifndef QT_NO_PROXYMODEL -
2352 if (proxyModel)
partially evaluated: proxyModel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:119
0-119
2353 abstractModel = proxyModel;
never executed: abstractModel = proxyModel;
0
2354#endif -
2355 for (int i = 1; i < abstractModel->columnCount(QModelIndex()); ++i) {
evaluated: i < abstractModel->columnCount(QModelIndex())
TRUEFALSE
yes
Evaluation Count:357
yes
Evaluation Count:119
119-357
2356 QAction *showHeader = new QAction(showActionGroup);
executed (the execution status of this line is deduced): QAction *showHeader = new QAction(showActionGroup);
-
2357 showHeader->setCheckable(true);
executed (the execution status of this line is deduced): showHeader->setCheckable(true);
-
2358 showHeader->setChecked(true);
executed (the execution status of this line is deduced): showHeader->setChecked(true);
-
2359 treeHeader->addAction(showHeader);
executed (the execution status of this line is deduced): treeHeader->addAction(showHeader);
-
2360 }
executed: }
Execution Count:357
357
2361 -
2362 QScopedPointer<QItemSelectionModel> selModel(qFileDialogUi->treeView->selectionModel());
executed (the execution status of this line is deduced): QScopedPointer<QItemSelectionModel> selModel(qFileDialogUi->treeView->selectionModel());
-
2363 qFileDialogUi->treeView->setSelectionModel(qFileDialogUi->listView->selectionModel());
executed (the execution status of this line is deduced): qFileDialogUi->treeView->setSelectionModel(qFileDialogUi->listView->selectionModel());
-
2364 -
2365 QObject::connect(qFileDialogUi->treeView, SIGNAL(activated(QModelIndex)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->treeView, "2""activated(QModelIndex)",
-
2366 q, SLOT(_q_enterDirectory(QModelIndex)));
executed (the execution status of this line is deduced): q, "1""_q_enterDirectory(QModelIndex)");
-
2367 QObject::connect(qFileDialogUi->treeView, SIGNAL(customContextMenuRequested(QPoint)),
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->treeView, "2""customContextMenuRequested(QPoint)",
-
2368 q, SLOT(_q_showContextMenu(QPoint)));
executed (the execution status of this line is deduced): q, "1""_q_showContextMenu(QPoint)");
-
2369#ifndef QT_NO_SHORTCUT -
2370 shortcut = new QShortcut(qFileDialogUi->treeView);
executed (the execution status of this line is deduced): shortcut = new QShortcut(qFileDialogUi->treeView);
-
2371 shortcut->setKey(QKeySequence(QLatin1String("Delete")));
executed (the execution status of this line is deduced): shortcut->setKey(QKeySequence(QLatin1String("Delete")));
-
2372 QObject::connect(shortcut, SIGNAL(activated()), q, SLOT(_q_deleteCurrent()));
executed (the execution status of this line is deduced): QObject::connect(shortcut, "2""activated()", q, "1""_q_deleteCurrent()");
-
2373#endif -
2374 -
2375 // Selections -
2376 QItemSelectionModel *selections = qFileDialogUi->listView->selectionModel();
executed (the execution status of this line is deduced): QItemSelectionModel *selections = qFileDialogUi->listView->selectionModel();
-
2377 QObject::connect(selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
executed (the execution status of this line is deduced): QObject::connect(selections, "2""selectionChanged(QItemSelection,QItemSelection)",
-
2378 q, SLOT(_q_selectionChanged()));
executed (the execution status of this line is deduced): q, "1""_q_selectionChanged()");
-
2379 QObject::connect(selections, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
executed (the execution status of this line is deduced): QObject::connect(selections, "2""currentChanged(QModelIndex,QModelIndex)",
-
2380 q, SLOT(_q_currentChanged(QModelIndex)));
executed (the execution status of this line is deduced): q, "1""_q_currentChanged(QModelIndex)");
-
2381 qFileDialogUi->splitter->setStretchFactor(qFileDialogUi->splitter->indexOf(qFileDialogUi->splitter->widget(1)), QSizePolicy::Expanding);
executed (the execution status of this line is deduced): qFileDialogUi->splitter->setStretchFactor(qFileDialogUi->splitter->indexOf(qFileDialogUi->splitter->widget(1)), QSizePolicy::Expanding);
-
2382 -
2383 createToolButtons();
executed (the execution status of this line is deduced): createToolButtons();
-
2384}
executed: }
Execution Count:119
119
2385 -
2386void QFileDialogPrivate::_q_showHeader(QAction *action) -
2387{ -
2388 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2389 QActionGroup *actionGroup = qobject_cast<QActionGroup*>(q->sender());
never executed (the execution status of this line is deduced): QActionGroup *actionGroup = qobject_cast<QActionGroup*>(q->sender());
-
2390 qFileDialogUi->treeView->header()->setSectionHidden(actionGroup->actions().indexOf(action) + 1, !action->isChecked());
never executed (the execution status of this line is deduced): qFileDialogUi->treeView->header()->setSectionHidden(actionGroup->actions().indexOf(action) + 1, !action->isChecked());
-
2391}
never executed: }
0
2392 -
2393#ifndef QT_NO_PROXYMODEL -
2394/*! -
2395 \since 4.3 -
2396 -
2397 Sets the model for the views to the given \a proxyModel. This is useful if you -
2398 want to modify the underlying model; for example, to add columns, filter -
2399 data or add drives. -
2400 -
2401 Any existing proxy model will be removed, but not deleted. The file dialog -
2402 will take ownership of the \a proxyModel. -
2403 -
2404 \sa proxyModel() -
2405*/ -
2406void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) -
2407{ -
2408 Q_D(QFileDialog);
executed (the execution status of this line is deduced): QFileDialogPrivate * const d = d_func();
-
2409 if ((!proxyModel && !d->proxyModel)
evaluated: !proxyModel
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
evaluated: !d->proxyModel
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-2
2410 || (proxyModel == d->proxyModel))
partially evaluated: (proxyModel == d->proxyModel)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2411 return;
executed: return;
Execution Count:1
1
2412 -
2413 QModelIndex idx = d->rootIndex();
executed (the execution status of this line is deduced): QModelIndex idx = d->rootIndex();
-
2414 if (d->proxyModel) {
evaluated: d->proxyModel
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2415 disconnect(d->proxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->proxyModel, "2""rowsInserted(QModelIndex,int,int)",
-
2416 this, SLOT(_q_rowsInserted(QModelIndex)));
executed (the execution status of this line is deduced): this, "1""_q_rowsInserted(QModelIndex)");
-
2417 } else {
executed: }
Execution Count:1
1
2418 disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
2419 this, SLOT(_q_rowsInserted(QModelIndex)));
executed (the execution status of this line is deduced): this, "1""_q_rowsInserted(QModelIndex)");
-
2420 }
executed: }
Execution Count:1
1
2421 -
2422 if (proxyModel != 0) {
evaluated: proxyModel != 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2423 proxyModel->setParent(this);
executed (the execution status of this line is deduced): proxyModel->setParent(this);
-
2424 d->proxyModel = proxyModel;
executed (the execution status of this line is deduced): d->proxyModel = proxyModel;
-
2425 proxyModel->setSourceModel(d->model);
executed (the execution status of this line is deduced): proxyModel->setSourceModel(d->model);
-
2426 d->qFileDialogUi->listView->setModel(d->proxyModel);
executed (the execution status of this line is deduced): d->qFileDialogUi->listView->setModel(d->proxyModel);
-
2427 d->qFileDialogUi->treeView->setModel(d->proxyModel);
executed (the execution status of this line is deduced): d->qFileDialogUi->treeView->setModel(d->proxyModel);
-
2428#ifndef QT_NO_FSCOMPLETER -
2429 d->completer->setModel(d->proxyModel);
executed (the execution status of this line is deduced): d->completer->setModel(d->proxyModel);
-
2430 d->completer->proxyModel = d->proxyModel;
executed (the execution status of this line is deduced): d->completer->proxyModel = d->proxyModel;
-
2431#endif -
2432 connect(d->proxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->proxyModel, "2""rowsInserted(QModelIndex,int,int)",
-
2433 this, SLOT(_q_rowsInserted(QModelIndex)));
executed (the execution status of this line is deduced): this, "1""_q_rowsInserted(QModelIndex)");
-
2434 } else {
executed: }
Execution Count:1
1
2435 d->proxyModel = 0;
executed (the execution status of this line is deduced): d->proxyModel = 0;
-
2436 d->qFileDialogUi->listView->setModel(d->model);
executed (the execution status of this line is deduced): d->qFileDialogUi->listView->setModel(d->model);
-
2437 d->qFileDialogUi->treeView->setModel(d->model);
executed (the execution status of this line is deduced): d->qFileDialogUi->treeView->setModel(d->model);
-
2438#ifndef QT_NO_FSCOMPLETER -
2439 d->completer->setModel(d->model);
executed (the execution status of this line is deduced): d->completer->setModel(d->model);
-
2440 d->completer->sourceModel = d->model;
executed (the execution status of this line is deduced): d->completer->sourceModel = d->model;
-
2441 d->completer->proxyModel = 0;
executed (the execution status of this line is deduced): d->completer->proxyModel = 0;
-
2442#endif -
2443 connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
2444 this, SLOT(_q_rowsInserted(QModelIndex)));
executed (the execution status of this line is deduced): this, "1""_q_rowsInserted(QModelIndex)");
-
2445 }
executed: }
Execution Count:1
1
2446 QScopedPointer<QItemSelectionModel> selModel(d->qFileDialogUi->treeView->selectionModel());
executed (the execution status of this line is deduced): QScopedPointer<QItemSelectionModel> selModel(d->qFileDialogUi->treeView->selectionModel());
-
2447 d->qFileDialogUi->treeView->setSelectionModel(d->qFileDialogUi->listView->selectionModel());
executed (the execution status of this line is deduced): d->qFileDialogUi->treeView->setSelectionModel(d->qFileDialogUi->listView->selectionModel());
-
2448 -
2449 d->setRootIndex(idx);
executed (the execution status of this line is deduced): d->setRootIndex(idx);
-
2450 -
2451 // reconnect selection -
2452 QItemSelectionModel *selections = d->qFileDialogUi->listView->selectionModel();
executed (the execution status of this line is deduced): QItemSelectionModel *selections = d->qFileDialogUi->listView->selectionModel();
-
2453 QObject::connect(selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
executed (the execution status of this line is deduced): QObject::connect(selections, "2""selectionChanged(QItemSelection,QItemSelection)",
-
2454 this, SLOT(_q_selectionChanged()));
executed (the execution status of this line is deduced): this, "1""_q_selectionChanged()");
-
2455 QObject::connect(selections, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
executed (the execution status of this line is deduced): QObject::connect(selections, "2""currentChanged(QModelIndex,QModelIndex)",
-
2456 this, SLOT(_q_currentChanged(QModelIndex)));
executed (the execution status of this line is deduced): this, "1""_q_currentChanged(QModelIndex)");
-
2457}
executed: }
Execution Count:2
2
2458 -
2459/*! -
2460 Returns the proxy model used by the file dialog. By default no proxy is set. -
2461 -
2462 \sa setProxyModel() -
2463*/ -
2464QAbstractProxyModel *QFileDialog::proxyModel() const -
2465{ -
2466 Q_D(const QFileDialog);
executed (the execution status of this line is deduced): const QFileDialogPrivate * const d = d_func();
-
2467 return d->proxyModel;
executed: return d->proxyModel;
Execution Count:4
4
2468} -
2469#endif // QT_NO_PROXYMODEL -
2470 -
2471/*! -
2472 \internal -
2473 -
2474 Create tool buttons, set properties and connections -
2475*/ -
2476void QFileDialogPrivate::createToolButtons() -
2477{ -
2478 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2479 qFileDialogUi->backButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowBack, 0, q));
executed (the execution status of this line is deduced): qFileDialogUi->backButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowBack, 0, q));
-
2480 qFileDialogUi->backButton->setAutoRaise(true);
executed (the execution status of this line is deduced): qFileDialogUi->backButton->setAutoRaise(true);
-
2481 qFileDialogUi->backButton->setEnabled(false);
executed (the execution status of this line is deduced): qFileDialogUi->backButton->setEnabled(false);
-
2482 QObject::connect(qFileDialogUi->backButton, SIGNAL(clicked()), q, SLOT(_q_navigateBackward()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->backButton, "2""clicked()", q, "1""_q_navigateBackward()");
-
2483 -
2484 qFileDialogUi->forwardButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowForward, 0, q));
executed (the execution status of this line is deduced): qFileDialogUi->forwardButton->setIcon(q->style()->standardIcon(QStyle::SP_ArrowForward, 0, q));
-
2485 qFileDialogUi->forwardButton->setAutoRaise(true);
executed (the execution status of this line is deduced): qFileDialogUi->forwardButton->setAutoRaise(true);
-
2486 qFileDialogUi->forwardButton->setEnabled(false);
executed (the execution status of this line is deduced): qFileDialogUi->forwardButton->setEnabled(false);
-
2487 QObject::connect(qFileDialogUi->forwardButton, SIGNAL(clicked()), q, SLOT(_q_navigateForward()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->forwardButton, "2""clicked()", q, "1""_q_navigateForward()");
-
2488 -
2489 qFileDialogUi->toParentButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogToParent, 0, q));
executed (the execution status of this line is deduced): qFileDialogUi->toParentButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogToParent, 0, q));
-
2490 qFileDialogUi->toParentButton->setAutoRaise(true);
executed (the execution status of this line is deduced): qFileDialogUi->toParentButton->setAutoRaise(true);
-
2491 qFileDialogUi->toParentButton->setEnabled(false);
executed (the execution status of this line is deduced): qFileDialogUi->toParentButton->setEnabled(false);
-
2492 QObject::connect(qFileDialogUi->toParentButton, SIGNAL(clicked()), q, SLOT(_q_navigateToParent()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->toParentButton, "2""clicked()", q, "1""_q_navigateToParent()");
-
2493 -
2494 qFileDialogUi->listModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogListView, 0, q));
executed (the execution status of this line is deduced): qFileDialogUi->listModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogListView, 0, q));
-
2495 qFileDialogUi->listModeButton->setAutoRaise(true);
executed (the execution status of this line is deduced): qFileDialogUi->listModeButton->setAutoRaise(true);
-
2496 qFileDialogUi->listModeButton->setDown(true);
executed (the execution status of this line is deduced): qFileDialogUi->listModeButton->setDown(true);
-
2497 QObject::connect(qFileDialogUi->listModeButton, SIGNAL(clicked()), q, SLOT(_q_showListView()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->listModeButton, "2""clicked()", q, "1""_q_showListView()");
-
2498 -
2499 qFileDialogUi->detailModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogDetailedView, 0, q));
executed (the execution status of this line is deduced): qFileDialogUi->detailModeButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogDetailedView, 0, q));
-
2500 qFileDialogUi->detailModeButton->setAutoRaise(true);
executed (the execution status of this line is deduced): qFileDialogUi->detailModeButton->setAutoRaise(true);
-
2501 QObject::connect(qFileDialogUi->detailModeButton, SIGNAL(clicked()), q, SLOT(_q_showDetailsView()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->detailModeButton, "2""clicked()", q, "1""_q_showDetailsView()");
-
2502 -
2503 QSize toolSize(qFileDialogUi->fileNameEdit->sizeHint().height(), qFileDialogUi->fileNameEdit->sizeHint().height());
executed (the execution status of this line is deduced): QSize toolSize(qFileDialogUi->fileNameEdit->sizeHint().height(), qFileDialogUi->fileNameEdit->sizeHint().height());
-
2504 qFileDialogUi->backButton->setFixedSize(toolSize);
executed (the execution status of this line is deduced): qFileDialogUi->backButton->setFixedSize(toolSize);
-
2505 qFileDialogUi->listModeButton->setFixedSize(toolSize);
executed (the execution status of this line is deduced): qFileDialogUi->listModeButton->setFixedSize(toolSize);
-
2506 qFileDialogUi->detailModeButton->setFixedSize(toolSize);
executed (the execution status of this line is deduced): qFileDialogUi->detailModeButton->setFixedSize(toolSize);
-
2507 qFileDialogUi->forwardButton->setFixedSize(toolSize);
executed (the execution status of this line is deduced): qFileDialogUi->forwardButton->setFixedSize(toolSize);
-
2508 qFileDialogUi->toParentButton->setFixedSize(toolSize);
executed (the execution status of this line is deduced): qFileDialogUi->toParentButton->setFixedSize(toolSize);
-
2509 -
2510 qFileDialogUi->newFolderButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogNewFolder, 0, q));
executed (the execution status of this line is deduced): qFileDialogUi->newFolderButton->setIcon(q->style()->standardIcon(QStyle::SP_FileDialogNewFolder, 0, q));
-
2511 qFileDialogUi->newFolderButton->setFixedSize(toolSize);
executed (the execution status of this line is deduced): qFileDialogUi->newFolderButton->setFixedSize(toolSize);
-
2512 qFileDialogUi->newFolderButton->setAutoRaise(true);
executed (the execution status of this line is deduced): qFileDialogUi->newFolderButton->setAutoRaise(true);
-
2513 qFileDialogUi->newFolderButton->setEnabled(false);
executed (the execution status of this line is deduced): qFileDialogUi->newFolderButton->setEnabled(false);
-
2514 QObject::connect(qFileDialogUi->newFolderButton, SIGNAL(clicked()), q, SLOT(_q_createDirectory()));
executed (the execution status of this line is deduced): QObject::connect(qFileDialogUi->newFolderButton, "2""clicked()", q, "1""_q_createDirectory()");
-
2515}
executed: }
Execution Count:119
119
2516 -
2517/*! -
2518 \internal -
2519 -
2520 Create actions which will be used in the right click. -
2521*/ -
2522void QFileDialogPrivate::createMenuActions() -
2523{ -
2524 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2525 -
2526 QAction *goHomeAction = new QAction(q);
executed (the execution status of this line is deduced): QAction *goHomeAction = new QAction(q);
-
2527#ifndef QT_NO_SHORTCUT -
2528 goHomeAction->setShortcut(Qt::CTRL + Qt::Key_H + Qt::SHIFT);
executed (the execution status of this line is deduced): goHomeAction->setShortcut(Qt::CTRL + Qt::Key_H + Qt::SHIFT);
-
2529#endif -
2530 QObject::connect(goHomeAction, SIGNAL(triggered()), q, SLOT(_q_goHome()));
executed (the execution status of this line is deduced): QObject::connect(goHomeAction, "2""triggered()", q, "1""_q_goHome()");
-
2531 q->addAction(goHomeAction);
executed (the execution status of this line is deduced): q->addAction(goHomeAction);
-
2532 -
2533 // ### TODO add Desktop & Computer actions -
2534 -
2535 QAction *goToParent = new QAction(q);
executed (the execution status of this line is deduced): QAction *goToParent = new QAction(q);
-
2536 goToParent->setObjectName(QLatin1String("qt_goto_parent_action"));
executed (the execution status of this line is deduced): goToParent->setObjectName(QLatin1String("qt_goto_parent_action"));
-
2537#ifndef QT_NO_SHORTCUT -
2538 goToParent->setShortcut(Qt::CTRL + Qt::UpArrow);
executed (the execution status of this line is deduced): goToParent->setShortcut(Qt::CTRL + Qt::UpArrow);
-
2539#endif -
2540 QObject::connect(goToParent, SIGNAL(triggered()), q, SLOT(_q_navigateToParent()));
executed (the execution status of this line is deduced): QObject::connect(goToParent, "2""triggered()", q, "1""_q_navigateToParent()");
-
2541 q->addAction(goToParent);
executed (the execution status of this line is deduced): q->addAction(goToParent);
-
2542 -
2543 renameAction = new QAction(q);
executed (the execution status of this line is deduced): renameAction = new QAction(q);
-
2544 renameAction->setEnabled(false);
executed (the execution status of this line is deduced): renameAction->setEnabled(false);
-
2545 renameAction->setObjectName(QLatin1String("qt_rename_action"));
executed (the execution status of this line is deduced): renameAction->setObjectName(QLatin1String("qt_rename_action"));
-
2546 QObject::connect(renameAction, SIGNAL(triggered()), q, SLOT(_q_renameCurrent()));
executed (the execution status of this line is deduced): QObject::connect(renameAction, "2""triggered()", q, "1""_q_renameCurrent()");
-
2547 -
2548 deleteAction = new QAction(q);
executed (the execution status of this line is deduced): deleteAction = new QAction(q);
-
2549 deleteAction->setEnabled(false);
executed (the execution status of this line is deduced): deleteAction->setEnabled(false);
-
2550 deleteAction->setObjectName(QLatin1String("qt_delete_action"));
executed (the execution status of this line is deduced): deleteAction->setObjectName(QLatin1String("qt_delete_action"));
-
2551 QObject::connect(deleteAction, SIGNAL(triggered()), q, SLOT(_q_deleteCurrent()));
executed (the execution status of this line is deduced): QObject::connect(deleteAction, "2""triggered()", q, "1""_q_deleteCurrent()");
-
2552 -
2553 showHiddenAction = new QAction(q);
executed (the execution status of this line is deduced): showHiddenAction = new QAction(q);
-
2554 showHiddenAction->setObjectName(QLatin1String("qt_show_hidden_action"));
executed (the execution status of this line is deduced): showHiddenAction->setObjectName(QLatin1String("qt_show_hidden_action"));
-
2555 showHiddenAction->setCheckable(true);
executed (the execution status of this line is deduced): showHiddenAction->setCheckable(true);
-
2556 QObject::connect(showHiddenAction, SIGNAL(triggered()), q, SLOT(_q_showHidden()));
executed (the execution status of this line is deduced): QObject::connect(showHiddenAction, "2""triggered()", q, "1""_q_showHidden()");
-
2557 -
2558 newFolderAction = new QAction(q);
executed (the execution status of this line is deduced): newFolderAction = new QAction(q);
-
2559 newFolderAction->setObjectName(QLatin1String("qt_new_folder_action"));
executed (the execution status of this line is deduced): newFolderAction->setObjectName(QLatin1String("qt_new_folder_action"));
-
2560 QObject::connect(newFolderAction, SIGNAL(triggered()), q, SLOT(_q_createDirectory()));
executed (the execution status of this line is deduced): QObject::connect(newFolderAction, "2""triggered()", q, "1""_q_createDirectory()");
-
2561}
executed: }
Execution Count:119
119
2562 -
2563void QFileDialogPrivate::_q_goHome() -
2564{ -
2565 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2566 q->setDirectory(QDir::homePath());
never executed (the execution status of this line is deduced): q->setDirectory(QDir::homePath());
-
2567}
never executed: }
0
2568 -
2569/*! -
2570 \internal -
2571 -
2572 Update history with new path, buttons, and combo -
2573*/ -
2574void QFileDialogPrivate::_q_pathChanged(const QString &newPath) -
2575{ -
2576 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2577 QDir dir(model->rootDirectory());
executed (the execution status of this line is deduced): QDir dir(model->rootDirectory());
-
2578 qFileDialogUi->toParentButton->setEnabled(dir.exists());
executed (the execution status of this line is deduced): qFileDialogUi->toParentButton->setEnabled(dir.exists());
-
2579 qFileDialogUi->sidebar->selectUrl(QUrl::fromLocalFile(newPath));
executed (the execution status of this line is deduced): qFileDialogUi->sidebar->selectUrl(QUrl::fromLocalFile(newPath));
-
2580 q->setHistory(qFileDialogUi->lookInCombo->history());
executed (the execution status of this line is deduced): q->setHistory(qFileDialogUi->lookInCombo->history());
-
2581 -
2582 if (currentHistoryLocation < 0 || currentHistory.value(currentHistoryLocation) != QDir::toNativeSeparators(newPath)) {
evaluated: currentHistoryLocation < 0
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:32
evaluated: currentHistory.value(currentHistoryLocation) != QDir::toNativeSeparators(newPath)
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:12
12-119
2583 while (currentHistoryLocation >= 0 && currentHistoryLocation + 1 < currentHistory.count()) {
evaluated: currentHistoryLocation >= 0
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:119
evaluated: currentHistoryLocation + 1 < currentHistory.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:20
2-119
2584 currentHistory.removeLast();
executed (the execution status of this line is deduced): currentHistory.removeLast();
-
2585 }
executed: }
Execution Count:2
2
2586 currentHistory.append(QDir::toNativeSeparators(newPath));
executed (the execution status of this line is deduced): currentHistory.append(QDir::toNativeSeparators(newPath));
-
2587 ++currentHistoryLocation;
executed (the execution status of this line is deduced): ++currentHistoryLocation;
-
2588 }
executed: }
Execution Count:139
139
2589 qFileDialogUi->forwardButton->setEnabled(currentHistory.size() - currentHistoryLocation > 1);
executed (the execution status of this line is deduced): qFileDialogUi->forwardButton->setEnabled(currentHistory.size() - currentHistoryLocation > 1);
-
2590 qFileDialogUi->backButton->setEnabled(currentHistoryLocation > 0);
executed (the execution status of this line is deduced): qFileDialogUi->backButton->setEnabled(currentHistoryLocation > 0);
-
2591}
executed: }
Execution Count:151
151
2592 -
2593/*! -
2594 \internal -
2595 -
2596 Navigates to the last directory viewed in the dialog. -
2597*/ -
2598void QFileDialogPrivate::_q_navigateBackward() -
2599{ -
2600 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2601 if (!currentHistory.isEmpty() && currentHistoryLocation > 0) {
partially evaluated: !currentHistory.isEmpty()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: currentHistoryLocation > 0
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
2602 --currentHistoryLocation;
executed (the execution status of this line is deduced): --currentHistoryLocation;
-
2603 QString previousHistory = currentHistory.at(currentHistoryLocation);
executed (the execution status of this line is deduced): QString previousHistory = currentHistory.at(currentHistoryLocation);
-
2604 q->setDirectory(previousHistory);
executed (the execution status of this line is deduced): q->setDirectory(previousHistory);
-
2605 }
executed: }
Execution Count:8
8
2606}
executed: }
Execution Count:8
8
2607 -
2608/*! -
2609 \internal -
2610 -
2611 Navigates to the last directory viewed in the dialog. -
2612*/ -
2613void QFileDialogPrivate::_q_navigateForward() -
2614{ -
2615 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2616 if (!currentHistory.isEmpty() && currentHistoryLocation < currentHistory.size() - 1) {
partially evaluated: !currentHistory.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: currentHistoryLocation < currentHistory.size() - 1
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2617 ++currentHistoryLocation;
executed (the execution status of this line is deduced): ++currentHistoryLocation;
-
2618 QString nextHistory = currentHistory.at(currentHistoryLocation);
executed (the execution status of this line is deduced): QString nextHistory = currentHistory.at(currentHistoryLocation);
-
2619 q->setDirectory(nextHistory);
executed (the execution status of this line is deduced): q->setDirectory(nextHistory);
-
2620 }
executed: }
Execution Count:4
4
2621}
executed: }
Execution Count:4
4
2622 -
2623/*! -
2624 \internal -
2625 -
2626 Navigates to the parent directory of the currently displayed directory -
2627 in the dialog. -
2628*/ -
2629void QFileDialogPrivate::_q_navigateToParent() -
2630{ -
2631 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2632 QDir dir(model->rootDirectory());
never executed (the execution status of this line is deduced): QDir dir(model->rootDirectory());
-
2633 QString newDirectory;
never executed (the execution status of this line is deduced): QString newDirectory;
-
2634 if (dir.isRoot()) {
never evaluated: dir.isRoot()
0
2635 newDirectory = model->myComputer().toString();
never executed (the execution status of this line is deduced): newDirectory = model->myComputer().toString();
-
2636 } else {
never executed: }
0
2637 dir.cdUp();
never executed (the execution status of this line is deduced): dir.cdUp();
-
2638 newDirectory = dir.absolutePath();
never executed (the execution status of this line is deduced): newDirectory = dir.absolutePath();
-
2639 }
never executed: }
0
2640 q->setDirectory(newDirectory);
never executed (the execution status of this line is deduced): q->setDirectory(newDirectory);
-
2641 emit q->directoryEntered(newDirectory);
never executed (the execution status of this line is deduced): q->directoryEntered(newDirectory);
-
2642}
never executed: }
0
2643 -
2644/*! -
2645 \internal -
2646 -
2647 Creates a new directory, first asking the user for a suitable name. -
2648*/ -
2649void QFileDialogPrivate::_q_createDirectory() -
2650{ -
2651 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2652 qFileDialogUi->listView->clearSelection();
never executed (the execution status of this line is deduced): qFileDialogUi->listView->clearSelection();
-
2653 -
2654 QString newFolderString = QFileDialog::tr("New Folder");
never executed (the execution status of this line is deduced): QString newFolderString = QFileDialog::tr("New Folder");
-
2655 QString folderName = newFolderString;
never executed (the execution status of this line is deduced): QString folderName = newFolderString;
-
2656 QString prefix = q->directory().absolutePath() + QDir::separator();
never executed (the execution status of this line is deduced): QString prefix = q->directory().absolutePath() + QDir::separator();
-
2657 if (QFile::exists(prefix + folderName)) {
never evaluated: QFile::exists(prefix + folderName)
0
2658 qlonglong suffix = 2;
never executed (the execution status of this line is deduced): qlonglong suffix = 2;
-
2659 while (QFile::exists(prefix + folderName)) {
never evaluated: QFile::exists(prefix + folderName)
0
2660 folderName = newFolderString + QString::number(suffix++);
never executed (the execution status of this line is deduced): folderName = newFolderString + QString::number(suffix++);
-
2661 }
never executed: }
0
2662 }
never executed: }
0
2663 -
2664 QModelIndex parent = rootIndex();
never executed (the execution status of this line is deduced): QModelIndex parent = rootIndex();
-
2665 QModelIndex index = model->mkdir(parent, folderName);
never executed (the execution status of this line is deduced): QModelIndex index = model->mkdir(parent, folderName);
-
2666 if (!index.isValid())
never evaluated: !index.isValid()
0
2667 return;
never executed: return;
0
2668 -
2669 index = select(index);
never executed (the execution status of this line is deduced): index = select(index);
-
2670 if (index.isValid()) {
never evaluated: index.isValid()
0
2671 qFileDialogUi->treeView->setCurrentIndex(index);
never executed (the execution status of this line is deduced): qFileDialogUi->treeView->setCurrentIndex(index);
-
2672 currentView()->edit(index);
never executed (the execution status of this line is deduced): currentView()->edit(index);
-
2673 }
never executed: }
0
2674}
never executed: }
0
2675 -
2676void QFileDialogPrivate::_q_showListView() -
2677{ -
2678 qFileDialogUi->listModeButton->setDown(true);
executed (the execution status of this line is deduced): qFileDialogUi->listModeButton->setDown(true);
-
2679 qFileDialogUi->detailModeButton->setDown(false);
executed (the execution status of this line is deduced): qFileDialogUi->detailModeButton->setDown(false);
-
2680 qFileDialogUi->treeView->hide();
executed (the execution status of this line is deduced): qFileDialogUi->treeView->hide();
-
2681 qFileDialogUi->listView->show();
executed (the execution status of this line is deduced): qFileDialogUi->listView->show();
-
2682 qFileDialogUi->stackedWidget->setCurrentWidget(qFileDialogUi->listView->parentWidget());
executed (the execution status of this line is deduced): qFileDialogUi->stackedWidget->setCurrentWidget(qFileDialogUi->listView->parentWidget());
-
2683 qFileDialogUi->listView->doItemsLayout();
executed (the execution status of this line is deduced): qFileDialogUi->listView->doItemsLayout();
-
2684}
executed: }
Execution Count:73
73
2685 -
2686void QFileDialogPrivate::_q_showDetailsView() -
2687{ -
2688 qFileDialogUi->listModeButton->setDown(false);
executed (the execution status of this line is deduced): qFileDialogUi->listModeButton->setDown(false);
-
2689 qFileDialogUi->detailModeButton->setDown(true);
executed (the execution status of this line is deduced): qFileDialogUi->detailModeButton->setDown(true);
-
2690 qFileDialogUi->listView->hide();
executed (the execution status of this line is deduced): qFileDialogUi->listView->hide();
-
2691 qFileDialogUi->treeView->show();
executed (the execution status of this line is deduced): qFileDialogUi->treeView->show();
-
2692 qFileDialogUi->stackedWidget->setCurrentWidget(qFileDialogUi->treeView->parentWidget());
executed (the execution status of this line is deduced): qFileDialogUi->stackedWidget->setCurrentWidget(qFileDialogUi->treeView->parentWidget());
-
2693 qFileDialogUi->treeView->doItemsLayout();
executed (the execution status of this line is deduced): qFileDialogUi->treeView->doItemsLayout();
-
2694}
executed: }
Execution Count:1
1
2695 -
2696/*! -
2697 \internal -
2698 -
2699 Show the context menu for the file/dir under position -
2700*/ -
2701void QFileDialogPrivate::_q_showContextMenu(const QPoint &position) -
2702{ -
2703#ifdef QT_NO_MENU -
2704 Q_UNUSED(position); -
2705#else -
2706 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2707 QAbstractItemView *view = 0;
never executed (the execution status of this line is deduced): QAbstractItemView *view = 0;
-
2708 if (q->viewMode() == QFileDialog::Detail)
never evaluated: q->viewMode() == QFileDialog::Detail
0
2709 view = qFileDialogUi->treeView;
never executed: view = qFileDialogUi->treeView;
0
2710 else -
2711 view = qFileDialogUi->listView;
never executed: view = qFileDialogUi->listView;
0
2712 QModelIndex index = view->indexAt(position);
never executed (the execution status of this line is deduced): QModelIndex index = view->indexAt(position);
-
2713 index = mapToSource(index.sibling(index.row(), 0));
never executed (the execution status of this line is deduced): index = mapToSource(index.sibling(index.row(), 0));
-
2714 -
2715 QMenu menu(view);
never executed (the execution status of this line is deduced): QMenu menu(view);
-
2716 if (index.isValid()) {
never evaluated: index.isValid()
0
2717 // file context menu -
2718 const bool ro = model && model->isReadOnly();
never evaluated: model
never evaluated: model->isReadOnly()
0
2719 QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt());
never executed (the execution status of this line is deduced): QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt());
-
2720 renameAction->setEnabled(!ro && p & QFile::WriteUser);
never executed (the execution status of this line is deduced): renameAction->setEnabled(!ro && p & QFile::WriteUser);
-
2721 menu.addAction(renameAction);
never executed (the execution status of this line is deduced): menu.addAction(renameAction);
-
2722 deleteAction->setEnabled(!ro && p & QFile::WriteUser);
never executed (the execution status of this line is deduced): deleteAction->setEnabled(!ro && p & QFile::WriteUser);
-
2723 menu.addAction(deleteAction);
never executed (the execution status of this line is deduced): menu.addAction(deleteAction);
-
2724 menu.addSeparator();
never executed (the execution status of this line is deduced): menu.addSeparator();
-
2725 }
never executed: }
0
2726 menu.addAction(showHiddenAction);
never executed (the execution status of this line is deduced): menu.addAction(showHiddenAction);
-
2727 if (qFileDialogUi->newFolderButton->isVisible()) {
never evaluated: qFileDialogUi->newFolderButton->isVisible()
0
2728 newFolderAction->setEnabled(qFileDialogUi->newFolderButton->isEnabled());
never executed (the execution status of this line is deduced): newFolderAction->setEnabled(qFileDialogUi->newFolderButton->isEnabled());
-
2729 menu.addAction(newFolderAction);
never executed (the execution status of this line is deduced): menu.addAction(newFolderAction);
-
2730 }
never executed: }
0
2731 menu.exec(view->viewport()->mapToGlobal(position));
never executed (the execution status of this line is deduced): menu.exec(view->viewport()->mapToGlobal(position));
-
2732#endif // QT_NO_MENU -
2733}
never executed: }
0
2734 -
2735/*! -
2736 \internal -
2737*/ -
2738void QFileDialogPrivate::_q_renameCurrent() -
2739{ -
2740 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2741 QModelIndex index = qFileDialogUi->listView->currentIndex();
never executed (the execution status of this line is deduced): QModelIndex index = qFileDialogUi->listView->currentIndex();
-
2742 index = index.sibling(index.row(), 0);
never executed (the execution status of this line is deduced): index = index.sibling(index.row(), 0);
-
2743 if (q->viewMode() == QFileDialog::List)
never evaluated: q->viewMode() == QFileDialog::List
0
2744 qFileDialogUi->listView->edit(index);
never executed: qFileDialogUi->listView->edit(index);
0
2745 else -
2746 qFileDialogUi->treeView->edit(index);
never executed: qFileDialogUi->treeView->edit(index);
0
2747} -
2748 -
2749bool QFileDialogPrivate::removeDirectory(const QString &path) -
2750{ -
2751 QModelIndex modelIndex = model->index(path);
never executed (the execution status of this line is deduced): QModelIndex modelIndex = model->index(path);
-
2752 return model->remove(modelIndex);
never executed: return model->remove(modelIndex);
0
2753} -
2754 -
2755/*! -
2756 \internal -
2757 -
2758 Deletes the currently selected item in the dialog. -
2759*/ -
2760void QFileDialogPrivate::_q_deleteCurrent() -
2761{ -
2762 if (model->isReadOnly())
never evaluated: model->isReadOnly()
0
2763 return;
never executed: return;
0
2764 -
2765 QModelIndexList list = qFileDialogUi->listView->selectionModel()->selectedRows();
never executed (the execution status of this line is deduced): QModelIndexList list = qFileDialogUi->listView->selectionModel()->selectedRows();
-
2766 for (int i = list.count() - 1; i >= 0; --i) {
never evaluated: i >= 0
0
2767 QModelIndex index = list.at(i);
never executed (the execution status of this line is deduced): QModelIndex index = list.at(i);
-
2768 if (index == qFileDialogUi->listView->rootIndex())
never evaluated: index == qFileDialogUi->listView->rootIndex()
0
2769 continue;
never executed: continue;
0
2770 -
2771 index = mapToSource(index.sibling(index.row(), 0));
never executed (the execution status of this line is deduced): index = mapToSource(index.sibling(index.row(), 0));
-
2772 if (!index.isValid())
never evaluated: !index.isValid()
0
2773 continue;
never executed: continue;
0
2774 -
2775 QString fileName = index.data(QFileSystemModel::FileNameRole).toString();
never executed (the execution status of this line is deduced): QString fileName = index.data(QFileSystemModel::FileNameRole).toString();
-
2776 QString filePath = index.data(QFileSystemModel::FilePathRole).toString();
never executed (the execution status of this line is deduced): QString filePath = index.data(QFileSystemModel::FilePathRole).toString();
-
2777 bool isDir = model->isDir(index);
never executed (the execution status of this line is deduced): bool isDir = model->isDir(index);
-
2778 -
2779 QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt());
never executed (the execution status of this line is deduced): QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt());
-
2780#ifndef QT_NO_MESSAGEBOX -
2781 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2782 if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"),
never evaluated: !(p & QFile::WriteUser)
never evaluated: (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
0
2783 QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?")
never evaluated: (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
0
2784 .arg(fileName),
never evaluated: (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
0
2785 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No))
never evaluated: (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
0
2786 return;
never executed: return;
0
2787 else if (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"),
never evaluated: QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("Are you sure you want to delete '%1'?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No
0
2788 QFileDialog::tr("Are you sure you want to delete '%1'?")
never evaluated: QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("Are you sure you want to delete '%1'?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No
0
2789 .arg(fileName),
never evaluated: QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("Are you sure you want to delete '%1'?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No
0
2790 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
never evaluated: QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), QFileDialog::tr("Are you sure you want to delete '%1'?") .arg(fileName), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No
0
2791 return;
never executed: return;
0
2792 -
2793#else -
2794 if (!(p & QFile::WriteUser)) -
2795 return; -
2796#endif // QT_NO_MESSAGEBOX -
2797 -
2798 // the event loop has run, we can NOT reuse index because the model might have removed it. -
2799 if (isDir) {
never evaluated: isDir
0
2800 if (!removeDirectory(filePath)) {
never evaluated: !removeDirectory(filePath)
0
2801#ifndef QT_NO_MESSAGEBOX -
2802 QMessageBox::warning(q, q->windowTitle(),
never executed (the execution status of this line is deduced): QMessageBox::warning(q, q->windowTitle(),
-
2803 QFileDialog::tr("Could not delete directory."));
never executed (the execution status of this line is deduced): QFileDialog::tr("Could not delete directory."));
-
2804#endif -
2805 }
never executed: }
0
2806 } else {
never executed: }
0
2807 model->remove(index);
never executed (the execution status of this line is deduced): model->remove(index);
-
2808 }
never executed: }
0
2809 } -
2810}
never executed: }
0
2811 -
2812void QFileDialogPrivate::_q_autoCompleteFileName(const QString &text) -
2813{ -
2814 if (text.startsWith(QLatin1String("//")) || text.startsWith(QLatin1Char('\\'))) {
partially evaluated: text.startsWith(QLatin1String("//"))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:68
partially evaluated: text.startsWith(QLatin1Char('\\'))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:68
0-68
2815 qFileDialogUi->listView->selectionModel()->clearSelection();
never executed (the execution status of this line is deduced): qFileDialogUi->listView->selectionModel()->clearSelection();
-
2816 return;
never executed: return;
0
2817 } -
2818 -
2819 QStringList multipleFiles = typedFiles();
executed (the execution status of this line is deduced): QStringList multipleFiles = typedFiles();
-
2820 if (multipleFiles.count() > 0) {
partially evaluated: multipleFiles.count() > 0
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
0-68
2821 QModelIndexList oldFiles = qFileDialogUi->listView->selectionModel()->selectedRows();
executed (the execution status of this line is deduced): QModelIndexList oldFiles = qFileDialogUi->listView->selectionModel()->selectedRows();
-
2822 QModelIndexList newFiles;
executed (the execution status of this line is deduced): QModelIndexList newFiles;
-
2823 for (int i = 0; i < multipleFiles.count(); ++i) {
evaluated: i < multipleFiles.count()
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:68
68-78
2824 QModelIndex idx = model->index(multipleFiles.at(i));
executed (the execution status of this line is deduced): QModelIndex idx = model->index(multipleFiles.at(i));
-
2825 if (oldFiles.contains(idx))
evaluated: oldFiles.contains(idx)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:62
16-62
2826 oldFiles.removeAll(idx);
executed: oldFiles.removeAll(idx);
Execution Count:16
16
2827 else -
2828 newFiles.append(idx);
executed: newFiles.append(idx);
Execution Count:62
62
2829 } -
2830 for (int i = 0; i < newFiles.count(); ++i)
evaluated: i < newFiles.count()
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:68
62-68
2831 select(newFiles.at(i));
executed: select(newFiles.at(i));
Execution Count:62
62
2832 if (lineEdit()->hasFocus())
evaluated: lineEdit()->hasFocus()
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:24
24-44
2833 for (int i = 0; i < oldFiles.count(); ++i)
evaluated: i < oldFiles.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:44
2-44
2834 qFileDialogUi->listView->selectionModel()->select(oldFiles.at(i),
executed: qFileDialogUi->listView->selectionModel()->select(oldFiles.at(i), QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
Execution Count:2
2
2835 QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
executed: qFileDialogUi->listView->selectionModel()->select(oldFiles.at(i), QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
Execution Count:2
2
2836 }
executed: }
Execution Count:68
68
2837}
executed: }
Execution Count:68
68
2838 -
2839/*! -
2840 \internal -
2841*/ -
2842void QFileDialogPrivate::_q_updateOkButton() -
2843{ -
2844 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2845 QPushButton *button = qFileDialogUi->buttonBox->button((q->acceptMode() == QFileDialog::AcceptOpen)
executed (the execution status of this line is deduced): QPushButton *button = qFileDialogUi->buttonBox->button((q->acceptMode() == QFileDialog::AcceptOpen)
-
2846 ? QDialogButtonBox::Open : QDialogButtonBox::Save);
executed (the execution status of this line is deduced): ? QDialogButtonBox::Open : QDialogButtonBox::Save);
-
2847 if (!button)
evaluated: !button
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:371
119-371
2848 return;
executed: return;
Execution Count:119
119
2849 const QFileDialog::FileMode fileMode = q->fileMode();
executed (the execution status of this line is deduced): const QFileDialog::FileMode fileMode = q->fileMode();
-
2850 -
2851 bool enableButton = true;
executed (the execution status of this line is deduced): bool enableButton = true;
-
2852 bool isOpenDirectory = false;
executed (the execution status of this line is deduced): bool isOpenDirectory = false;
-
2853 -
2854 QStringList files = q->selectedFiles();
executed (the execution status of this line is deduced): QStringList files = q->selectedFiles();
-
2855 QString lineEditText = lineEdit()->text();
executed (the execution status of this line is deduced): QString lineEditText = lineEdit()->text();
-
2856 -
2857 if (lineEditText.startsWith(QLatin1String("//")) || lineEditText.startsWith(QLatin1Char('\\'))) {
partially evaluated: lineEditText.startsWith(QLatin1String("//"))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:371
partially evaluated: lineEditText.startsWith(QLatin1Char('\\'))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:371
0-371
2858 button->setEnabled(true);
never executed (the execution status of this line is deduced): button->setEnabled(true);
-
2859 updateOkButtonText();
never executed (the execution status of this line is deduced): updateOkButtonText();
-
2860 return;
never executed: return;
0
2861 } -
2862 -
2863 if (files.isEmpty()) {
evaluated: files.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:366
5-366
2864 enableButton = false;
executed (the execution status of this line is deduced): enableButton = false;
-
2865 } else if (lineEditText == QLatin1String("..")) {
executed: }
Execution Count:5
evaluated: lineEditText == QLatin1String("..")
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:361
5-361
2866 isOpenDirectory = true;
executed (the execution status of this line is deduced): isOpenDirectory = true;
-
2867 } else {
executed: }
Execution Count:5
5
2868 switch (fileMode) { -
2869 case QFileDialog::DirectoryOnly: -
2870 case QFileDialog::Directory: { -
2871 QString fn = files.first();
executed (the execution status of this line is deduced): QString fn = files.first();
-
2872 QModelIndex idx = model->index(fn);
executed (the execution status of this line is deduced): QModelIndex idx = model->index(fn);
-
2873 if (!idx.isValid())
evaluated: !idx.isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:14
3-14
2874 idx = model->index(getEnvironmentVariable(fn));
executed: idx = model->index(getEnvironmentVariable(fn));
Execution Count:3
3
2875 if (!idx.isValid() || !model->isDir(idx))
evaluated: !idx.isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:14
partially evaluated: !model->isDir(idx)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2876 enableButton = false;
executed: enableButton = false;
Execution Count:3
3
2877 break;
executed: break;
Execution Count:17
17
2878 } -
2879 case QFileDialog::AnyFile: { -
2880 QString fn = files.first();
executed (the execution status of this line is deduced): QString fn = files.first();
-
2881 QFileInfo info(fn);
executed (the execution status of this line is deduced): QFileInfo info(fn);
-
2882 QModelIndex idx = model->index(fn);
executed (the execution status of this line is deduced): QModelIndex idx = model->index(fn);
-
2883 QString fileDir;
executed (the execution status of this line is deduced): QString fileDir;
-
2884 QString fileName;
executed (the execution status of this line is deduced): QString fileName;
-
2885 if (info.isDir()) {
evaluated: info.isDir()
TRUEFALSE
yes
Evaluation Count:240
yes
Evaluation Count:84
84-240
2886 fileDir = info.canonicalFilePath();
executed (the execution status of this line is deduced): fileDir = info.canonicalFilePath();
-
2887 } else {
executed: }
Execution Count:240
240
2888 fileDir = fn.mid(0, fn.lastIndexOf(QLatin1Char('/')));
executed (the execution status of this line is deduced): fileDir = fn.mid(0, fn.lastIndexOf(QLatin1Char('/')));
-
2889 fileName = fn.mid(fileDir.length() + 1);
executed (the execution status of this line is deduced): fileName = fn.mid(fileDir.length() + 1);
-
2890 }
executed: }
Execution Count:84
84
2891 if (lineEditText.contains(QLatin1String(".."))) {
evaluated: lineEditText.contains(QLatin1String(".."))
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:287
37-287
2892 fileDir = info.canonicalFilePath();
executed (the execution status of this line is deduced): fileDir = info.canonicalFilePath();
-
2893 fileName = info.fileName();
executed (the execution status of this line is deduced): fileName = info.fileName();
-
2894 }
executed: }
Execution Count:37
37
2895 -
2896 if (fileDir == q->directory().canonicalPath() && fileName.isEmpty()) {
evaluated: fileDir == q->directory().canonicalPath()
TRUEFALSE
yes
Evaluation Count:218
yes
Evaluation Count:106
evaluated: fileName.isEmpty()
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:25
25-218
2897 enableButton = false;
executed (the execution status of this line is deduced): enableButton = false;
-
2898 break;
executed: break;
Execution Count:193
193
2899 } -
2900 if (idx.isValid() && model->isDir(idx)) {
evaluated: idx.isValid()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:116
evaluated: model->isDir(idx)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:4
4-116
2901 isOpenDirectory = true;
executed (the execution status of this line is deduced): isOpenDirectory = true;
-
2902 enableButton = true;
executed (the execution status of this line is deduced): enableButton = true;
-
2903 break;
executed: break;
Execution Count:11
11
2904 } -
2905 if (!idx.isValid()) {
evaluated: !idx.isValid()
TRUEFALSE
yes
Evaluation Count:116
yes
Evaluation Count:4
4-116
2906 int maxLength = maxNameLength(fileDir);
executed (the execution status of this line is deduced): int maxLength = maxNameLength(fileDir);
-
2907 enableButton = maxLength < 0 || fileName.length() <= maxLength;
evaluated: maxLength < 0
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:57
evaluated: fileName.length() <= maxLength
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:3
3-59
2908 }
executed: }
Execution Count:116
116
2909 break;
executed: break;
Execution Count:120
120
2910 } -
2911 case QFileDialog::ExistingFile: -
2912 case QFileDialog::ExistingFiles: -
2913 for (int i = 0; i < files.count(); ++i) {
evaluated: i < files.count()
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:20
20-34
2914 QModelIndex idx = model->index(files.at(i));
executed (the execution status of this line is deduced): QModelIndex idx = model->index(files.at(i));
-
2915 if (!idx.isValid())
partially evaluated: !idx.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34
0-34
2916 idx = model->index(getEnvironmentVariable(files.at(i)));
never executed: idx = model->index(getEnvironmentVariable(files.at(i)));
0
2917 if (!idx.isValid()) {
partially evaluated: !idx.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34
0-34
2918 enableButton = false;
never executed (the execution status of this line is deduced): enableButton = false;
-
2919 break;
never executed: break;
0
2920 } -
2921 if (idx.isValid() && model->isDir(idx)) {
partially evaluated: idx.isValid()
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
partially evaluated: model->isDir(idx)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34
0-34
2922 isOpenDirectory = true;
never executed (the execution status of this line is deduced): isOpenDirectory = true;
-
2923 break;
never executed: break;
0
2924 } -
2925 }
executed: }
Execution Count:34
34
2926 break;
executed: break;
Execution Count:20
20
2927 default: -
2928 break;
never executed: break;
0
2929 } -
2930 }
executed: }
Execution Count:361
361
2931 -
2932 button->setEnabled(enableButton);
executed (the execution status of this line is deduced): button->setEnabled(enableButton);
-
2933 updateOkButtonText(isOpenDirectory);
executed (the execution status of this line is deduced): updateOkButtonText(isOpenDirectory);
-
2934}
executed: }
Execution Count:371
371
2935 -
2936/*! -
2937 \internal -
2938*/ -
2939void QFileDialogPrivate::_q_currentChanged(const QModelIndex &index) -
2940{ -
2941 _q_updateOkButton();
executed (the execution status of this line is deduced): _q_updateOkButton();
-
2942 emit q_func()->currentChanged(index.data(QFileSystemModel::FilePathRole).toString());
executed (the execution status of this line is deduced): q_func()->currentChanged(index.data(QFileSystemModel::FilePathRole).toString());
-
2943}
executed: }
Execution Count:10
10
2944 -
2945/*! -
2946 \internal -
2947 -
2948 This is called when the user double clicks on a file with the corresponding -
2949 model item \a index. -
2950*/ -
2951void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index) -
2952{ -
2953 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2954 // My Computer or a directory -
2955 QModelIndex sourceIndex = index.model() == proxyModel ? mapToSource(index) : index;
partially evaluated: index.model() == proxyModel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2956 QString path = sourceIndex.data(QFileSystemModel::FilePathRole).toString();
executed (the execution status of this line is deduced): QString path = sourceIndex.data(QFileSystemModel::FilePathRole).toString();
-
2957 if (path.isEmpty() || model->isDir(sourceIndex)) {
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: model->isDir(sourceIndex)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2958 const QFileDialog::FileMode fileMode = q->fileMode();
executed (the execution status of this line is deduced): const QFileDialog::FileMode fileMode = q->fileMode();
-
2959 q->setDirectory(path);
executed (the execution status of this line is deduced): q->setDirectory(path);
-
2960 emit q->directoryEntered(path);
executed (the execution status of this line is deduced): q->directoryEntered(path);
-
2961 if (fileMode == QFileDialog::Directory
evaluated: fileMode == QFileDialog::Directory
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2962 || fileMode == QFileDialog::DirectoryOnly) {
partially evaluated: fileMode == QFileDialog::DirectoryOnly
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2963 // ### find out why you have to do both of these. -
2964 lineEdit()->setText(QString());
executed (the execution status of this line is deduced): lineEdit()->setText(QString());
-
2965 lineEdit()->clear();
executed (the execution status of this line is deduced): lineEdit()->clear();
-
2966 }
executed: }
Execution Count:1
1
2967 } else {
executed: }
Execution Count:2
2
2968 q->accept();
never executed (the execution status of this line is deduced): q->accept();
-
2969 }
never executed: }
0
2970} -
2971 -
2972/*! -
2973 \internal -
2974 -
2975 Changes the file dialog's current directory to the one specified -
2976 by \a path. -
2977*/ -
2978void QFileDialogPrivate::_q_goToDirectory(const QString &path) -
2979{ -
2980 #ifndef QT_NO_MESSAGEBOX -
2981 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
2982#endif -
2983 QModelIndex index = qFileDialogUi->lookInCombo->model()->index(qFileDialogUi->lookInCombo->currentIndex(),
never executed (the execution status of this line is deduced): QModelIndex index = qFileDialogUi->lookInCombo->model()->index(qFileDialogUi->lookInCombo->currentIndex(),
-
2984 qFileDialogUi->lookInCombo->modelColumn(),
never executed (the execution status of this line is deduced): qFileDialogUi->lookInCombo->modelColumn(),
-
2985 qFileDialogUi->lookInCombo->rootModelIndex());
never executed (the execution status of this line is deduced): qFileDialogUi->lookInCombo->rootModelIndex());
-
2986 QString path2 = path;
never executed (the execution status of this line is deduced): QString path2 = path;
-
2987 if (!index.isValid())
never evaluated: !index.isValid()
0
2988 index = mapFromSource(model->index(getEnvironmentVariable(path)));
never executed: index = mapFromSource(model->index(getEnvironmentVariable(path)));
0
2989 else { -
2990 path2 = index.data(UrlRole).toUrl().toLocalFile();
never executed (the execution status of this line is deduced): path2 = index.data((Qt::UserRole + 1)).toUrl().toLocalFile();
-
2991 index = mapFromSource(model->index(path2));
never executed (the execution status of this line is deduced): index = mapFromSource(model->index(path2));
-
2992 }
never executed: }
0
2993 QDir dir(path2);
never executed (the execution status of this line is deduced): QDir dir(path2);
-
2994 if (!dir.exists())
never evaluated: !dir.exists()
0
2995 dir = getEnvironmentVariable(path2);
never executed: dir = getEnvironmentVariable(path2);
0
2996 -
2997 if (dir.exists() || path2.isEmpty() || path2 == model->myComputer().toString()) {
never evaluated: dir.exists()
never evaluated: path2.isEmpty()
never evaluated: path2 == model->myComputer().toString()
0
2998 _q_enterDirectory(index);
never executed (the execution status of this line is deduced): _q_enterDirectory(index);
-
2999#ifndef QT_NO_MESSAGEBOX -
3000 } else {
never executed: }
0
3001 QString message = QFileDialog::tr("%1\nDirectory not found.\nPlease verify the "
never executed (the execution status of this line is deduced): QString message = QFileDialog::tr("%1\nDirectory not found.\nPlease verify the "
-
3002 "correct directory name was given.");
never executed (the execution status of this line is deduced): "correct directory name was given.");
-
3003 QMessageBox::warning(q, q->windowTitle(), message.arg(path2));
never executed (the execution status of this line is deduced): QMessageBox::warning(q, q->windowTitle(), message.arg(path2));
-
3004#endif // QT_NO_MESSAGEBOX -
3005 }
never executed: }
0
3006} -
3007 -
3008/*! -
3009 \internal -
3010 -
3011 Sets the current name filter to be nameFilter and -
3012 update the qFileDialogUi->fileNameEdit when in AcceptSave mode with the new extension. -
3013*/ -
3014void QFileDialogPrivate::_q_useNameFilter(int index) -
3015{ -
3016 QStringList nameFilters = options->nameFilters();
executed (the execution status of this line is deduced): QStringList nameFilters = options->nameFilters();
-
3017 if (index == nameFilters.size()) {
partially evaluated: index == nameFilters.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
3018 QAbstractItemModel *comboModel = qFileDialogUi->fileTypeCombo->model();
never executed (the execution status of this line is deduced): QAbstractItemModel *comboModel = qFileDialogUi->fileTypeCombo->model();
-
3019 nameFilters.append(comboModel->index(comboModel->rowCount() - 1, 0).data().toString());
never executed (the execution status of this line is deduced): nameFilters.append(comboModel->index(comboModel->rowCount() - 1, 0).data().toString());
-
3020 options->setNameFilters(nameFilters);
never executed (the execution status of this line is deduced): options->setNameFilters(nameFilters);
-
3021 }
never executed: }
0
3022 -
3023 QString nameFilter = nameFilters.at(index);
executed (the execution status of this line is deduced): QString nameFilter = nameFilters.at(index);
-
3024 QStringList newNameFilters = QPlatformFileDialogHelper::cleanFilterList(nameFilter);
executed (the execution status of this line is deduced): QStringList newNameFilters = QPlatformFileDialogHelper::cleanFilterList(nameFilter);
-
3025 if (q_func()->acceptMode() == QFileDialog::AcceptSave) {
evaluated: q_func()->acceptMode() == QFileDialog::AcceptSave
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:137
3-137
3026 QString newNameFilterExtension;
executed (the execution status of this line is deduced): QString newNameFilterExtension;
-
3027 if (newNameFilters.count() > 0)
partially evaluated: newNameFilters.count() > 0
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
3028 newNameFilterExtension = QFileInfo(newNameFilters.at(0)).suffix();
executed: newNameFilterExtension = QFileInfo(newNameFilters.at(0)).suffix();
Execution Count:3
3
3029 -
3030 QString fileName = lineEdit()->text();
executed (the execution status of this line is deduced): QString fileName = lineEdit()->text();
-
3031 const QString fileNameExtension = QFileInfo(fileName).suffix();
executed (the execution status of this line is deduced): const QString fileNameExtension = QFileInfo(fileName).suffix();
-
3032 if (!fileNameExtension.isEmpty() && !newNameFilterExtension.isEmpty()) {
partially evaluated: !fileNameExtension.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never evaluated: !newNameFilterExtension.isEmpty()
0-3
3033 const int fileNameExtensionLength = fileNameExtension.count();
never executed (the execution status of this line is deduced): const int fileNameExtensionLength = fileNameExtension.count();
-
3034 fileName.replace(fileName.count() - fileNameExtensionLength,
never executed (the execution status of this line is deduced): fileName.replace(fileName.count() - fileNameExtensionLength,
-
3035 fileNameExtensionLength, newNameFilterExtension);
never executed (the execution status of this line is deduced): fileNameExtensionLength, newNameFilterExtension);
-
3036 qFileDialogUi->listView->clearSelection();
never executed (the execution status of this line is deduced): qFileDialogUi->listView->clearSelection();
-
3037 lineEdit()->setText(fileName);
never executed (the execution status of this line is deduced): lineEdit()->setText(fileName);
-
3038 }
never executed: }
0
3039 }
executed: }
Execution Count:3
3
3040 -
3041 model->setNameFilters(newNameFilters);
executed (the execution status of this line is deduced): model->setNameFilters(newNameFilters);
-
3042}
executed: }
Execution Count:140
140
3043 -
3044/*! -
3045 \internal -
3046 -
3047 This is called when the model index corresponding to the current file is changed -
3048 from \a index to \a current. -
3049*/ -
3050void QFileDialogPrivate::_q_selectionChanged() -
3051{ -
3052 const QFileDialog::FileMode fileMode = q_func()->fileMode();
executed (the execution status of this line is deduced): const QFileDialog::FileMode fileMode = q_func()->fileMode();
-
3053 QModelIndexList indexes = qFileDialogUi->listView->selectionModel()->selectedRows();
executed (the execution status of this line is deduced): QModelIndexList indexes = qFileDialogUi->listView->selectionModel()->selectedRows();
-
3054 bool stripDirs = (fileMode != QFileDialog::DirectoryOnly && fileMode != QFileDialog::Directory);
evaluated: fileMode != QFileDialog::DirectoryOnly
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:1
evaluated: fileMode != QFileDialog::Directory
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:4
1-35
3055 -
3056 QStringList allFiles;
executed (the execution status of this line is deduced): QStringList allFiles;
-
3057 for (int i = 0; i < indexes.count(); ++i) {
evaluated: i < indexes.count()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:36
36-38
3058 if (stripDirs && model->isDir(mapToSource(indexes.at(i))))
evaluated: stripDirs
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:4
evaluated: model->isDir(mapToSource(indexes.at(i)))
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:24
4-34
3059 continue;
executed: continue;
Execution Count:10
10
3060 allFiles.append(indexes.at(i).data().toString());
executed (the execution status of this line is deduced): allFiles.append(indexes.at(i).data().toString());
-
3061 }
executed: }
Execution Count:28
28
3062 if (allFiles.count() > 1)
evaluated: allFiles.count() > 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:32
4-32
3063 for (int i = 0; i < allFiles.count(); ++i) {
evaluated: i < allFiles.count()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:4
4-14
3064 allFiles.replace(i, QString(QLatin1Char('"') + allFiles.at(i) + QLatin1Char('"')));
executed (the execution status of this line is deduced): allFiles.replace(i, QString(QLatin1Char('"') + allFiles.at(i) + QLatin1Char('"')));
-
3065 }
executed: }
Execution Count:14
14
3066 -
3067 QString finalFiles = allFiles.join(QLatin1Char(' '));
executed (the execution status of this line is deduced): QString finalFiles = allFiles.join(QLatin1Char(' '));
-
3068 if (!finalFiles.isEmpty() && !lineEdit()->hasFocus() && lineEdit()->isVisible())
evaluated: !finalFiles.isEmpty()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:18
evaluated: !lineEdit()->hasFocus()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:7
evaluated: lineEdit()->isVisible()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1
1-18
3069 lineEdit()->setText(finalFiles);
executed: lineEdit()->setText(finalFiles);
Execution Count:10
10
3070 else -
3071 _q_updateOkButton();
executed: _q_updateOkButton();
Execution Count:26
26
3072} -
3073 -
3074/*! -
3075 \internal -
3076 -
3077 Includes hidden files and directories in the items displayed in the dialog. -
3078*/ -
3079void QFileDialogPrivate::_q_showHidden() -
3080{ -
3081 Q_Q(QFileDialog);
never executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
3082 QDir::Filters dirFilters = q->filter();
never executed (the execution status of this line is deduced): QDir::Filters dirFilters = q->filter();
-
3083 if (showHiddenAction->isChecked())
never evaluated: showHiddenAction->isChecked()
0
3084 dirFilters |= QDir::Hidden;
never executed: dirFilters |= QDir::Hidden;
0
3085 else -
3086 dirFilters &= ~QDir::Hidden;
never executed: dirFilters &= ~QDir::Hidden;
0
3087 q->setFilter(dirFilters);
never executed (the execution status of this line is deduced): q->setFilter(dirFilters);
-
3088}
never executed: }
0
3089 -
3090/*! -
3091 \internal -
3092 -
3093 When parent is root and rows have been inserted when none was there before -
3094 then select the first one. -
3095*/ -
3096void QFileDialogPrivate::_q_rowsInserted(const QModelIndex &parent) -
3097{ -
3098 if (!qFileDialogUi->treeView
partially evaluated: !qFileDialogUi->treeView
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1429
0-1429
3099 || parent != qFileDialogUi->treeView->rootIndex()
evaluated: parent != qFileDialogUi->treeView->rootIndex()
TRUEFALSE
yes
Evaluation Count:1283
yes
Evaluation Count:146
146-1283
3100 || !qFileDialogUi->treeView->selectionModel()
evaluated: !qFileDialogUi->treeView->selectionModel()
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:27
27-119
3101 || qFileDialogUi->treeView->selectionModel()->hasSelection()
evaluated: qFileDialogUi->treeView->selectionModel()->hasSelection()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:23
4-23
3102 || qFileDialogUi->treeView->model()->rowCount(parent) == 0)
partially evaluated: qFileDialogUi->treeView->model()->rowCount(parent) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
0-23
3103 return;
executed: return;
Execution Count:1406
1406
3104}
executed: }
Execution Count:23
23
3105 -
3106void QFileDialogPrivate::_q_fileRenamed(const QString &path, const QString oldName, const QString newName) -
3107{ -
3108 const QFileDialog::FileMode fileMode = q_func()->fileMode();
never executed (the execution status of this line is deduced): const QFileDialog::FileMode fileMode = q_func()->fileMode();
-
3109 if (fileMode == QFileDialog::Directory || fileMode == QFileDialog::DirectoryOnly) {
never evaluated: fileMode == QFileDialog::Directory
never evaluated: fileMode == QFileDialog::DirectoryOnly
0
3110 if (path == rootPath() && lineEdit()->text() == oldName)
never evaluated: path == rootPath()
never evaluated: lineEdit()->text() == oldName
0
3111 lineEdit()->setText(newName);
never executed: lineEdit()->setText(newName);
0
3112 }
never executed: }
0
3113}
never executed: }
0
3114 -
3115/*! -
3116 \internal -
3117 -
3118 For the list and tree view watch keys to goto parent and back in the history -
3119 -
3120 returns true if handled -
3121*/ -
3122bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) { -
3123 -
3124 Q_Q(QFileDialog);
executed (the execution status of this line is deduced): QFileDialog * const q = q_func();
-
3125 switch (event->key()) { -
3126 case Qt::Key_Backspace: -
3127 _q_navigateToParent();
never executed (the execution status of this line is deduced): _q_navigateToParent();
-
3128 return true;
never executed: return true;
0
3129 case Qt::Key_Back: -
3130#ifdef QT_KEYPAD_NAVIGATION -
3131 if (QApplication::keypadNavigationEnabled()) -
3132 return false; -
3133#endif -
3134 case Qt::Key_Left: -
3135 if (event->key() == Qt::Key_Back || event->modifiers() == Qt::AltModifier) {
never evaluated: event->key() == Qt::Key_Back
never evaluated: event->modifiers() == Qt::AltModifier
0
3136 _q_navigateBackward();
never executed (the execution status of this line is deduced): _q_navigateBackward();
-
3137 return true;
never executed: return true;
0
3138 } -
3139 break;
never executed: break;
0
3140 case Qt::Key_Escape: -
3141 q->hide();
never executed (the execution status of this line is deduced): q->hide();
-
3142 return true;
never executed: return true;
0
3143 default: -
3144 break;
executed: break;
Execution Count:4
4
3145 } -
3146 return false;
executed: return false;
Execution Count:4
4
3147} -
3148 -
3149QString QFileDialogPrivate::getEnvironmentVariable(const QString &string) -
3150{ -
3151#ifdef Q_OS_UNIX -
3152 if (string.size() > 1 && string.startsWith(QLatin1Char('$'))) {
partially evaluated: string.size() > 1
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: string.startsWith(QLatin1Char('$'))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
3153 return QString::fromLocal8Bit(getenv(string.mid(1).toLatin1().constData()));
never executed: return QString::fromLocal8Bit(getenv(string.mid(1).toLatin1().constData()));
0
3154 } -
3155#else -
3156 if (string.size() > 2 && string.startsWith(QLatin1Char('%')) && string.endsWith(QLatin1Char('%'))) { -
3157 return QString::fromLocal8Bit(qgetenv(string.mid(1, string.size() - 2).toLatin1().constData())); -
3158 } -
3159#endif -
3160 return string;
executed: return string;
Execution Count:3
3
3161} -
3162 -
3163void QFileDialogComboBox::setFileDialogPrivate(QFileDialogPrivate *d_pointer) { -
3164 d_ptr = d_pointer;
executed (the execution status of this line is deduced): d_ptr = d_pointer;
-
3165 urlModel = new QUrlModel(this);
executed (the execution status of this line is deduced): urlModel = new QUrlModel(this);
-
3166 urlModel->showFullPath = true;
executed (the execution status of this line is deduced): urlModel->showFullPath = true;
-
3167 urlModel->setFileSystemModel(d_ptr->model);
executed (the execution status of this line is deduced): urlModel->setFileSystemModel(d_ptr->model);
-
3168 setModel(urlModel);
executed (the execution status of this line is deduced): setModel(urlModel);
-
3169}
executed: }
Execution Count:119
119
3170 -
3171void QFileDialogComboBox::showPopup() -
3172{ -
3173 if (model()->rowCount() > 1)
never evaluated: model()->rowCount() > 1
0
3174 QComboBox::showPopup();
never executed: QComboBox::showPopup();
0
3175 -
3176 urlModel->setUrls(QList<QUrl>());
never executed (the execution status of this line is deduced): urlModel->setUrls(QList<QUrl>());
-
3177 QList<QUrl> list;
never executed (the execution status of this line is deduced): QList<QUrl> list;
-
3178 QModelIndex idx = d_ptr->model->index(d_ptr->rootPath());
never executed (the execution status of this line is deduced): QModelIndex idx = d_ptr->model->index(d_ptr->rootPath());
-
3179 while (idx.isValid()) {
never evaluated: idx.isValid()
0
3180 QUrl url = QUrl::fromLocalFile(idx.data(QFileSystemModel::FilePathRole).toString());
never executed (the execution status of this line is deduced): QUrl url = QUrl::fromLocalFile(idx.data(QFileSystemModel::FilePathRole).toString());
-
3181 if (url.isValid())
never evaluated: url.isValid()
0
3182 list.append(url);
never executed: list.append(url);
0
3183 idx = idx.parent();
never executed (the execution status of this line is deduced): idx = idx.parent();
-
3184 }
never executed: }
0
3185 // add "my computer" -
3186 list.append(QUrl::fromLocalFile(QLatin1String("")));
never executed (the execution status of this line is deduced): list.append(QUrl::fromLocalFile(QLatin1String("")));
-
3187 urlModel->addUrls(list, 0);
never executed (the execution status of this line is deduced): urlModel->addUrls(list, 0);
-
3188 idx = model()->index(model()->rowCount() - 1, 0);
never executed (the execution status of this line is deduced): idx = model()->index(model()->rowCount() - 1, 0);
-
3189 -
3190 // append history -
3191 QList<QUrl> urls;
never executed (the execution status of this line is deduced): QList<QUrl> urls;
-
3192 for (int i = 0; i < m_history.count(); ++i) {
never evaluated: i < m_history.count()
0
3193 QUrl path = QUrl::fromLocalFile(m_history.at(i));
never executed (the execution status of this line is deduced): QUrl path = QUrl::fromLocalFile(m_history.at(i));
-
3194 if (!urls.contains(path))
never evaluated: !urls.contains(path)
0
3195 urls.prepend(path);
never executed: urls.prepend(path);
0
3196 }
never executed: }
0
3197 if (urls.count() > 0) {
never evaluated: urls.count() > 0
0
3198 model()->insertRow(model()->rowCount());
never executed (the execution status of this line is deduced): model()->insertRow(model()->rowCount());
-
3199 idx = model()->index(model()->rowCount()-1, 0);
never executed (the execution status of this line is deduced): idx = model()->index(model()->rowCount()-1, 0);
-
3200 // ### TODO maybe add a horizontal line before this -
3201 model()->setData(idx, QFileDialog::tr("Recent Places"));
never executed (the execution status of this line is deduced): model()->setData(idx, QFileDialog::tr("Recent Places"));
-
3202 QStandardItemModel *m = qobject_cast<QStandardItemModel*>(model());
never executed (the execution status of this line is deduced): QStandardItemModel *m = qobject_cast<QStandardItemModel*>(model());
-
3203 if (m) {
never evaluated: m
0
3204 Qt::ItemFlags flags = m->flags(idx);
never executed (the execution status of this line is deduced): Qt::ItemFlags flags = m->flags(idx);
-
3205 flags &= ~Qt::ItemIsEnabled;
never executed (the execution status of this line is deduced): flags &= ~Qt::ItemIsEnabled;
-
3206 m->item(idx.row(), idx.column())->setFlags(flags);
never executed (the execution status of this line is deduced): m->item(idx.row(), idx.column())->setFlags(flags);
-
3207 }
never executed: }
0
3208 urlModel->addUrls(urls, -1, false);
never executed (the execution status of this line is deduced): urlModel->addUrls(urls, -1, false);
-
3209 }
never executed: }
0
3210 setCurrentIndex(0);
never executed (the execution status of this line is deduced): setCurrentIndex(0);
-
3211 -
3212 QComboBox::showPopup();
never executed (the execution status of this line is deduced): QComboBox::showPopup();
-
3213}
never executed: }
0
3214 -
3215// Exact same as QComboBox::paintEvent(), except we elide the text. -
3216void QFileDialogComboBox::paintEvent(QPaintEvent *) -
3217{ -
3218 QStylePainter painter(this);
executed (the execution status of this line is deduced): QStylePainter painter(this);
-
3219 painter.setPen(palette().color(QPalette::Text));
executed (the execution status of this line is deduced): painter.setPen(palette().color(QPalette::Text));
-
3220 -
3221 // draw the combobox frame, focusrect and selected etc. -
3222 QStyleOptionComboBox opt;
executed (the execution status of this line is deduced): QStyleOptionComboBox opt;
-
3223 initStyleOption(&opt);
executed (the execution status of this line is deduced): initStyleOption(&opt);
-
3224 -
3225 QRect editRect = style()->subControlRect(QStyle::CC_ComboBox, &opt,
executed (the execution status of this line is deduced): QRect editRect = style()->subControlRect(QStyle::CC_ComboBox, &opt,
-
3226 QStyle::SC_ComboBoxEditField, this);
executed (the execution status of this line is deduced): QStyle::SC_ComboBoxEditField, this);
-
3227 int size = editRect.width() - opt.iconSize.width() - 4;
executed (the execution status of this line is deduced): int size = editRect.width() - opt.iconSize.width() - 4;
-
3228 opt.currentText = opt.fontMetrics.elidedText(opt.currentText, Qt::ElideMiddle, size);
executed (the execution status of this line is deduced): opt.currentText = opt.fontMetrics.elidedText(opt.currentText, Qt::ElideMiddle, size);
-
3229 painter.drawComplexControl(QStyle::CC_ComboBox, opt);
executed (the execution status of this line is deduced): painter.drawComplexControl(QStyle::CC_ComboBox, opt);
-
3230 -
3231 // draw the icon and text -
3232 painter.drawControl(QStyle::CE_ComboBoxLabel, opt);
executed (the execution status of this line is deduced): painter.drawControl(QStyle::CE_ComboBoxLabel, opt);
-
3233}
executed: }
Execution Count:26
26
3234 -
3235QFileDialogListView::QFileDialogListView(QWidget *parent) : QListView(parent) -
3236{ -
3237}
executed: }
Execution Count:119
119
3238 -
3239void QFileDialogListView::setFileDialogPrivate(QFileDialogPrivate *d_pointer) -
3240{ -
3241 d_ptr = d_pointer;
executed (the execution status of this line is deduced): d_ptr = d_pointer;
-
3242 setSelectionBehavior(QAbstractItemView::SelectRows);
executed (the execution status of this line is deduced): setSelectionBehavior(QAbstractItemView::SelectRows);
-
3243 setWrapping(true);
executed (the execution status of this line is deduced): setWrapping(true);
-
3244 setResizeMode(QListView::Adjust);
executed (the execution status of this line is deduced): setResizeMode(QListView::Adjust);
-
3245 setEditTriggers(QAbstractItemView::EditKeyPressed);
executed (the execution status of this line is deduced): setEditTriggers(QAbstractItemView::EditKeyPressed);
-
3246 setContextMenuPolicy(Qt::CustomContextMenu);
executed (the execution status of this line is deduced): setContextMenuPolicy(Qt::CustomContextMenu);
-
3247#ifndef QT_NO_DRAGANDDROP -
3248 setDragDropMode(QAbstractItemView::InternalMove);
executed (the execution status of this line is deduced): setDragDropMode(QAbstractItemView::InternalMove);
-
3249#endif -
3250}
executed: }
Execution Count:119
119
3251 -
3252QSize QFileDialogListView::sizeHint() const -
3253{ -
3254 int height = qMax(10, sizeHintForRow(0));
executed (the execution status of this line is deduced): int height = qMax(10, sizeHintForRow(0));
-
3255 return QSize(QListView::sizeHint().width() * 2, height * 30);
executed: return QSize(QListView::sizeHint().width() * 2, height * 30);
Execution Count:120
120
3256} -
3257 -
3258void QFileDialogListView::keyPressEvent(QKeyEvent *e) -
3259{ -
3260#ifdef QT_KEYPAD_NAVIGATION -
3261 if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { -
3262 QListView::keyPressEvent(e); -
3263 return; -
3264 } -
3265#endif // QT_KEYPAD_NAVIGATION -
3266 -
3267 if (!d_ptr->itemViewKeyboardEvent(e))
partially evaluated: !d_ptr->itemViewKeyboardEvent(e)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
3268 QListView::keyPressEvent(e);
executed: QListView::keyPressEvent(e);
Execution Count:4
4
3269 e->accept();
executed (the execution status of this line is deduced): e->accept();
-
3270}
executed: }
Execution Count:4
4
3271 -
3272QFileDialogTreeView::QFileDialogTreeView(QWidget *parent) : QTreeView(parent) -
3273{ -
3274}
executed: }
Execution Count:119
119
3275 -
3276void QFileDialogTreeView::setFileDialogPrivate(QFileDialogPrivate *d_pointer) -
3277{ -
3278 d_ptr = d_pointer;
executed (the execution status of this line is deduced): d_ptr = d_pointer;
-
3279 setSelectionBehavior(QAbstractItemView::SelectRows);
executed (the execution status of this line is deduced): setSelectionBehavior(QAbstractItemView::SelectRows);
-
3280 setRootIsDecorated(false);
executed (the execution status of this line is deduced): setRootIsDecorated(false);
-
3281 setItemsExpandable(false);
executed (the execution status of this line is deduced): setItemsExpandable(false);
-
3282 setSortingEnabled(true);
executed (the execution status of this line is deduced): setSortingEnabled(true);
-
3283 header()->setSortIndicator(0, Qt::AscendingOrder);
executed (the execution status of this line is deduced): header()->setSortIndicator(0, Qt::AscendingOrder);
-
3284 header()->setStretchLastSection(false);
executed (the execution status of this line is deduced): header()->setStretchLastSection(false);
-
3285 setTextElideMode(Qt::ElideMiddle);
executed (the execution status of this line is deduced): setTextElideMode(Qt::ElideMiddle);
-
3286 setEditTriggers(QAbstractItemView::EditKeyPressed);
executed (the execution status of this line is deduced): setEditTriggers(QAbstractItemView::EditKeyPressed);
-
3287 setContextMenuPolicy(Qt::CustomContextMenu);
executed (the execution status of this line is deduced): setContextMenuPolicy(Qt::CustomContextMenu);
-
3288#ifndef QT_NO_DRAGANDDROP -
3289 setDragDropMode(QAbstractItemView::InternalMove);
executed (the execution status of this line is deduced): setDragDropMode(QAbstractItemView::InternalMove);
-
3290#endif -
3291}
executed: }
Execution Count:119
119
3292 -
3293void QFileDialogTreeView::keyPressEvent(QKeyEvent *e) -
3294{ -
3295#ifdef QT_KEYPAD_NAVIGATION -
3296 if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { -
3297 QTreeView::keyPressEvent(e); -
3298 return; -
3299 } -
3300#endif // QT_KEYPAD_NAVIGATION -
3301 -
3302 if (!d_ptr->itemViewKeyboardEvent(e))
never evaluated: !d_ptr->itemViewKeyboardEvent(e)
0
3303 QTreeView::keyPressEvent(e);
never executed: QTreeView::keyPressEvent(e);
0
3304 e->accept();
never executed (the execution status of this line is deduced): e->accept();
-
3305}
never executed: }
0
3306 -
3307QSize QFileDialogTreeView::sizeHint() const -
3308{ -
3309 int height = qMax(10, sizeHintForRow(0));
executed (the execution status of this line is deduced): int height = qMax(10, sizeHintForRow(0));
-
3310 QSize sizeHint = header()->sizeHint();
executed (the execution status of this line is deduced): QSize sizeHint = header()->sizeHint();
-
3311 return QSize(sizeHint.width() * 4, height * 30);
executed: return QSize(sizeHint.width() * 4, height * 30);
Execution Count:120
120
3312} -
3313 -
3314/*! -
3315 // FIXME: this is a hack to avoid propagating key press events -
3316 // to the dialog and from there to the "Ok" button -
3317*/ -
3318void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) -
3319{ -
3320#ifdef QT_KEYPAD_NAVIGATION -
3321 if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { -
3322 QLineEdit::keyPressEvent(e); -
3323 return; -
3324 } -
3325#endif // QT_KEYPAD_NAVIGATION -
3326 -
3327 int key = e->key();
executed (the execution status of this line is deduced): int key = e->key();
-
3328 QLineEdit::keyPressEvent(e);
executed (the execution status of this line is deduced): QLineEdit::keyPressEvent(e);
-
3329 if (key != Qt::Key_Escape)
partially evaluated: key != Qt::Key_Escape
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
3330 e->accept();
executed: e->accept();
Execution Count:11
11
3331 if (hideOnEsc && (key == Qt::Key_Escape || key == Qt::Key_Return || key == Qt::Key_Enter)) {
partially evaluated: hideOnEsc
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
never evaluated: key == Qt::Key_Escape
never evaluated: key == Qt::Key_Return
never evaluated: key == Qt::Key_Enter
0-11
3332 e->accept();
never executed (the execution status of this line is deduced): e->accept();
-
3333 hide();
never executed (the execution status of this line is deduced): hide();
-
3334 d_ptr->currentView()->setFocus(Qt::ShortcutFocusReason);
never executed (the execution status of this line is deduced): d_ptr->currentView()->setFocus(Qt::ShortcutFocusReason);
-
3335 }
never executed: }
0
3336}
executed: }
Execution Count:11
11
3337 -
3338#ifndef QT_NO_FSCOMPLETER -
3339 -
3340QString QFSCompleter::pathFromIndex(const QModelIndex &index) const -
3341{ -
3342 const QFileSystemModel *dirModel;
never executed (the execution status of this line is deduced): const QFileSystemModel *dirModel;
-
3343 if (proxyModel)
never evaluated: proxyModel
0
3344 dirModel = qobject_cast<const QFileSystemModel *>(proxyModel->sourceModel());
never executed: dirModel = qobject_cast<const QFileSystemModel *>(proxyModel->sourceModel());
0
3345 else -
3346 dirModel = sourceModel;
never executed: dirModel = sourceModel;
0
3347 QString currentLocation = dirModel->rootPath();
never executed (the execution status of this line is deduced): QString currentLocation = dirModel->rootPath();
-
3348 QString path = index.data(QFileSystemModel::FilePathRole).toString();
never executed (the execution status of this line is deduced): QString path = index.data(QFileSystemModel::FilePathRole).toString();
-
3349 if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) {
never evaluated: !currentLocation.isEmpty()
never evaluated: path.startsWith(currentLocation)
0
3350#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) -
3351 if (currentLocation == QDir::separator())
never evaluated: currentLocation == QDir::separator()
0
3352 return path.mid(currentLocation.length());
never executed: return path.mid(currentLocation.length());
0
3353#endif -
3354 if (currentLocation.endsWith(QLatin1Char('/')))
never evaluated: currentLocation.endsWith(QLatin1Char('/'))
0
3355 return path.mid(currentLocation.length());
never executed: return path.mid(currentLocation.length());
0
3356 else -
3357 return path.mid(currentLocation.length()+1);
never executed: return path.mid(currentLocation.length()+1);
0
3358 } -
3359 return index.data(QFileSystemModel::FilePathRole).toString();
never executed: return index.data(QFileSystemModel::FilePathRole).toString();
0
3360} -
3361 -
3362QStringList QFSCompleter::splitPath(const QString &path) const -
3363{ -
3364 if (path.isEmpty())
partially evaluated: path.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:263
0-263
3365 return QStringList(completionPrefix());
never executed: return QStringList(completionPrefix());
0
3366 -
3367 QString pathCopy = QDir::toNativeSeparators(path);
executed (the execution status of this line is deduced): QString pathCopy = QDir::toNativeSeparators(path);
-
3368 QString sep = QDir::separator();
executed (the execution status of this line is deduced): QString sep = QDir::separator();
-
3369#if defined(Q_OS_WIN) -
3370 if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\")) -
3371 return QStringList(pathCopy); -
3372 QString doubleSlash(QLatin1String("\\\\")); -
3373 if (pathCopy.startsWith(doubleSlash)) -
3374 pathCopy = pathCopy.mid(2); -
3375 else -
3376 doubleSlash.clear(); -
3377#elif defined(Q_OS_UNIX) -
3378 bool expanded;
executed (the execution status of this line is deduced): bool expanded;
-
3379 pathCopy = qt_tildeExpansion(pathCopy, &expanded);
executed (the execution status of this line is deduced): pathCopy = qt_tildeExpansion(pathCopy, &expanded);
-
3380 if (expanded) {
partially evaluated: expanded
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:263
0-263
3381 QFileSystemModel *dirModel;
never executed (the execution status of this line is deduced): QFileSystemModel *dirModel;
-
3382 if (proxyModel)
never evaluated: proxyModel
0
3383 dirModel = qobject_cast<QFileSystemModel *>(proxyModel->sourceModel());
never executed: dirModel = qobject_cast<QFileSystemModel *>(proxyModel->sourceModel());
0
3384 else -
3385 dirModel = sourceModel;
never executed: dirModel = sourceModel;
0
3386 dirModel->fetchMore(dirModel->index(pathCopy));
never executed (the execution status of this line is deduced): dirModel->fetchMore(dirModel->index(pathCopy));
-
3387 }
never executed: }
0
3388#endif -
3389 -
3390 QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']'));
executed (the execution status of this line is deduced): QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']'));
-
3391 -
3392#if defined(Q_OS_WIN) -
3393 QStringList parts = pathCopy.split(re, QString::SkipEmptyParts); -
3394 if (!doubleSlash.isEmpty() && !parts.isEmpty()) -
3395 parts[0].prepend(doubleSlash); -
3396 if (pathCopy.endsWith(sep)) -
3397 parts.append(QString()); -
3398#else -
3399 QStringList parts = pathCopy.split(re);
executed (the execution status of this line is deduced): QStringList parts = pathCopy.split(re);
-
3400 if (pathCopy[0] == sep[0]) // read the "/" at the beginning as the split removed it
evaluated: pathCopy[0] == sep[0]
TRUEFALSE
yes
Evaluation Count:208
yes
Evaluation Count:55
55-208
3401 parts[0] = sep[0];
executed: parts[0] = sep[0];
Execution Count:208
208
3402#endif -
3403 -
3404#if defined(Q_OS_WIN) -
3405 bool startsFromRoot = !parts.isEmpty() && parts[0].endsWith(QLatin1Char(':')); -
3406#else -
3407 bool startsFromRoot = pathCopy[0] == sep[0];
executed (the execution status of this line is deduced): bool startsFromRoot = pathCopy[0] == sep[0];
-
3408#endif -
3409 if (parts.count() == 1 || (parts.count() > 1 && !startsFromRoot)) {
evaluated: parts.count() == 1
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:247
partially evaluated: parts.count() > 1
TRUEFALSE
yes
Evaluation Count:247
no
Evaluation Count:0
evaluated: !startsFromRoot
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:208
0-247
3410 const QFileSystemModel *dirModel;
executed (the execution status of this line is deduced): const QFileSystemModel *dirModel;
-
3411 if (proxyModel)
partially evaluated: proxyModel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
3412 dirModel = qobject_cast<const QFileSystemModel *>(proxyModel->sourceModel());
never executed: dirModel = qobject_cast<const QFileSystemModel *>(proxyModel->sourceModel());
0
3413 else -
3414 dirModel = sourceModel;
executed: dirModel = sourceModel;
Execution Count:55
55
3415 QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath());
executed (the execution status of this line is deduced): QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath());
-
3416#if defined(Q_OS_WIN) -
3417 if (currentLocation.endsWith(QLatin1Char(':'))) -
3418 currentLocation.append(sep); -
3419#endif -
3420 if (currentLocation.contains(sep) && path != currentLocation) {
partially evaluated: currentLocation.contains(sep)
TRUEFALSE
yes
Evaluation Count:55
no
Evaluation Count:0
partially evaluated: path != currentLocation
TRUEFALSE
yes
Evaluation Count:55
no
Evaluation Count:0
0-55
3421 QStringList currentLocationList = splitPath(currentLocation);
executed (the execution status of this line is deduced): QStringList currentLocationList = splitPath(currentLocation);
-
3422 while (!currentLocationList.isEmpty()
evaluated: !currentLocationList.isEmpty()
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:34
34-98
3423 && parts.count() > 0
evaluated: parts.count() > 0
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:4
4-94
3424 && parts.at(0) == QLatin1String("..")) {
evaluated: parts.at(0) == QLatin1String("..")
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:17
17-77
3425 parts.removeFirst();
executed (the execution status of this line is deduced): parts.removeFirst();
-
3426 currentLocationList.removeLast();
executed (the execution status of this line is deduced): currentLocationList.removeLast();
-
3427 }
executed: }
Execution Count:77
77
3428 if (!currentLocationList.isEmpty() && currentLocationList.last().isEmpty())
evaluated: !currentLocationList.isEmpty()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:34
evaluated: currentLocationList.last().isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:19
2-34
3429 currentLocationList.removeLast();
executed: currentLocationList.removeLast();
Execution Count:2
2
3430 return currentLocationList + parts;
executed: return currentLocationList + parts;
Execution Count:55
55
3431 } -
3432 }
never executed: }
0
3433 return parts;
executed: return parts;
Execution Count:208
208
3434} -
3435 -
3436#endif // QT_NO_COMPLETER -
3437 -
3438 -
3439QT_END_NAMESPACE -
3440 -
3441#include "moc_qfiledialog.cpp" -
3442 -
3443#endif // QT_NO_FILEDIALOG -
3444 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial