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