diff options
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/dialogs.pri | 7 | ||||
-rw-r--r-- | src/gui/dialogs/qdialog.cpp | 35 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 71 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog_embedded.ui (renamed from src/gui/dialogs/qfiledialog_wince.ui) | 0 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog_p.h | 59 | ||||
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer.cpp | 30 | ||||
-rw-r--r-- | src/gui/dialogs/qfilesystemmodel.cpp | 35 | ||||
-rw-r--r-- | src/gui/dialogs/qfscompleter_p.h | 82 | ||||
-rw-r--r-- | src/gui/dialogs/qmessagebox.cpp | 2 | ||||
-rw-r--r-- | src/gui/dialogs/qpagesetupdialog_win.cpp | 2 | ||||
-rw-r--r-- | src/gui/dialogs/qprintdialog_unix.cpp | 4 | ||||
-rw-r--r-- | src/gui/dialogs/qprintpreviewdialog.cpp | 13 | ||||
-rw-r--r-- | src/gui/dialogs/qprintpreviewdialog.h | 2 | ||||
-rw-r--r-- | src/gui/dialogs/qwizard.cpp | 2 |
14 files changed, 238 insertions, 106 deletions
diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index f1ec858..b9fad41 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -7,6 +7,7 @@ HEADERS += \ dialogs/qabstractpagesetupdialog_p.h \ dialogs/qcolordialog.h \ dialogs/qcolordialog_p.h \ + dialogs/qfscompleter_p.h \ dialogs/qdialog.h \ dialogs/qdialog_p.h \ dialogs/qerrormessage.h \ @@ -45,7 +46,7 @@ win32 { !win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library } -!mac:!embedded:unix { +!mac:!embedded:!symbian:unix { HEADERS += dialogs/qpagesetupdialog_unix_p.h SOURCES += dialogs/qprintdialog_unix.cpp \ dialogs/qpagesetupdialog_unix.cpp @@ -70,7 +71,7 @@ embedded { } } -wince*: FORMS += dialogs/qfiledialog_wince.ui +wince*|symbian: FORMS += dialogs/qfiledialog_embedded.ui else: FORMS += dialogs/qfiledialog.ui INCLUDEPATH += $$PWD @@ -94,4 +95,4 @@ SOURCES += \ FORMS += dialogs/qpagesetupwidget.ui RESOURCES += dialogs/qprintdialog.qrc -RESOURCES += dialogs/qmessagebox.qrc
\ No newline at end of file +RESOURCES += dialogs/qmessagebox.qrc diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index cd808b3..326dee4 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -64,8 +64,10 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp #elif defined(Q_WS_X11) # include "../kernel/qt_x11_p.h" +#elif defined(Q_OS_SYMBIAN) +# include "qfiledialog.h" +# include "qmenubar.h" #endif - #ifndef SPI_GETSNAPTODEFBUTTON # define SPI_GETSNAPTODEFBUTTON 95 #endif @@ -292,9 +294,13 @@ QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f) QDialog::~QDialog() { - // Need to hide() here, as our (to-be) overridden hide() - // will not be called in ~QWidget. - hide(); + QT_TRY { + // Need to hide() here, as our (to-be) overridden hide() + // will not be called in ~QWidget. + hide(); + } QT_CATCH(...) { + // we're in the destructor - just swallow the exception + } } /*! @@ -486,7 +492,19 @@ int QDialog::exec() #endif //QT_NO_MENUBAR #endif //Q_WS_WINCE_WM - show(); +#ifdef Q_OS_SYMBIAN +#ifndef QT_NO_MENUBAR + QMenuBar *menuBar = 0; + if (!findChild<QMenuBar *>()) + menuBar = new QMenuBar(this); +#endif + + if (qobject_cast<QFileDialog *>(this)) + showFullScreen(); + else +#endif // Q_OS_SYMBIAN + + show(); #ifdef Q_WS_MAC d->mac_nativeDialogModalHelp(); @@ -511,6 +529,13 @@ int QDialog::exec() delete menuBar; #endif //QT_NO_MENUBAR #endif //Q_WS_WINCE_WM +#ifdef Q_OS_SYMBIAN +#ifndef QT_NO_MENUBAR + else if (menuBar) + delete menuBar; +#endif //QT_NO_MENUBAR +#endif //Q_OS_SYMBIAN + return res; } diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 8299f69..7a30c3d 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -58,12 +58,15 @@ #include <qdebug.h> #include <qapplication.h> #include <qstylepainter.h> -#ifndef Q_WS_WINCE +#if !defined(Q_WS_WINCE) && !defined(Q_OS_SYMBIAN) #include "ui_qfiledialog.h" #else -#include "ui_qfiledialog_wince.h" +#define Q_EMBEDDED_SMALLSCREEN +#include "ui_qfiledialog_embedded.h" +#if defined(Q_OS_WINCE) extern bool qt_priv_ptr_valid; #endif +#endif QT_BEGIN_NAMESPACE @@ -358,7 +361,6 @@ QFileDialog::~QFileDialog() settings.beginGroup(QLatin1String("Qt")); settings.setValue(QLatin1String("filedialog"), saveState()); #endif - delete d->qFileDialogUi; d->deleteNativeDialog_sys(); } @@ -493,6 +495,38 @@ void QFileDialog::changeEvent(QEvent *e) QDialog::changeEvent(e); } +QFileDialogPrivate::QFileDialogPrivate() + : +#ifndef QT_NO_PROXYMODEL + proxyModel(0), +#endif + model(0), + fileMode(QFileDialog::AnyFile), + acceptMode(QFileDialog::AcceptOpen), + currentHistoryLocation(-1), + renameAction(0), + deleteAction(0), + showHiddenAction(0), + useDefaultCaption(true), + defaultFileTypes(true), + fileNameLabelExplicitlySat(false), + nativeDialogInUse(false), +#ifdef Q_WS_MAC + mDelegate(0), +#ifndef QT_MAC_USE_COCOA + mDialog(0), + mDialogStarted(false), + mDialogClosed(true), +#endif +#endif + qFileDialogUi(0) +{ +} + +QFileDialogPrivate::~QFileDialogPrivate() +{ +} + void QFileDialogPrivate::retranslateWindowTitle() { Q_Q(QFileDialog); @@ -2076,7 +2110,7 @@ void QFileDialogPrivate::init(const QString &directory, const QString &nameFilte q->restoreState(settings.value(QLatin1String("filedialog")).toByteArray()); #endif -#ifdef Q_WS_WINCE +#if defined(Q_EMBEDDED_SMALLSCREEN) qFileDialogUi->lookInLabel->setVisible(false); qFileDialogUi->fileNameLabel->setVisible(false); qFileDialogUi->fileTypeLabel->setVisible(false); @@ -2116,7 +2150,7 @@ void QFileDialogPrivate::createWidgets() q, SLOT(_q_rowsInserted(const QModelIndex &))); model->setReadOnly(false); - qFileDialogUi = new Ui_QFileDialog(); + qFileDialogUi.reset(new Ui_QFileDialog()); qFileDialogUi->setupUi(q); QList<QUrl> initialBookmarks; @@ -2142,7 +2176,7 @@ void QFileDialogPrivate::createWidgets() qFileDialogUi->fileNameLabel->setBuddy(qFileDialogUi->fileNameEdit); #endif #ifndef QT_NO_COMPLETER - completer = new QFSCompletor(model, q); + completer = new QFSCompleter(model, q); qFileDialogUi->fileNameEdit->setCompleter(completer); QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_autoCompleteFileName(QString))); @@ -2200,9 +2234,9 @@ void QFileDialogPrivate::createWidgets() treeHeader->addAction(showHeader); } - QItemSelectionModel *selModel = qFileDialogUi->treeView->selectionModel(); + QScopedPointer<QItemSelectionModel> selModel(qFileDialogUi->treeView->selectionModel()); qFileDialogUi->treeView->setSelectionModel(qFileDialogUi->listView->selectionModel()); - delete selModel; + QObject::connect(qFileDialogUi->treeView, SIGNAL(activated(QModelIndex)), q, SLOT(_q_enterDirectory(QModelIndex))); QObject::connect(qFileDialogUi->treeView, SIGNAL(customContextMenuRequested(QPoint)), @@ -2284,9 +2318,9 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) connect(d->model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(_q_rowsInserted(const QModelIndex &))); } - QItemSelectionModel *selModel = d->qFileDialogUi->treeView->selectionModel(); + QScopedPointer<QItemSelectionModel> selModel(d->qFileDialogUi->treeView->selectionModel()); d->qFileDialogUi->treeView->setSelectionModel(d->qFileDialogUi->listView->selectionModel()); - delete selModel; + d->setRootIndex(idx); // reconnect selection @@ -3164,7 +3198,7 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) #ifndef QT_NO_COMPLETER -QString QFSCompletor::pathFromIndex(const QModelIndex &index) const +QString QFSCompleter::pathFromIndex(const QModelIndex &index) const { const QFileSystemModel *dirModel; if (proxyModel) @@ -3179,14 +3213,17 @@ QString QFSCompletor::pathFromIndex(const QModelIndex &index) const return index.data(QFileSystemModel::FilePathRole).toString(); } -QStringList QFSCompletor::splitPath(const QString &path) const +QStringList QFSCompleter::splitPath(const QString &path) const { if (path.isEmpty()) return QStringList(completionPrefix()); QString pathCopy = QDir::toNativeSeparators(path); QString sep = QDir::separator(); -#ifdef Q_OS_WIN +#if defined(Q_OS_SYMBIAN) + if (pathCopy == QLatin1String("\\")) + return QStringList(pathCopy); +#elif defined(Q_OS_WIN) if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\")) return QStringList(pathCopy); QString doubleSlash(QLatin1String("\\\\")); @@ -3198,7 +3235,11 @@ QStringList QFSCompletor::splitPath(const QString &path) const QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']')); -#ifdef Q_OS_WIN +#if defined(Q_OS_SYMBIAN) + QStringList parts = pathCopy.split(re, QString::SkipEmptyParts); + if (pathCopy.endsWith(sep)) + parts.append(QString()); +#elif defined(Q_OS_WIN) QStringList parts = pathCopy.split(re, QString::SkipEmptyParts); if (!doubleSlash.isEmpty() && !parts.isEmpty()) parts[0].prepend(doubleSlash); @@ -3210,7 +3251,7 @@ QStringList QFSCompletor::splitPath(const QString &path) const parts[0] = sep[0]; #endif -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) bool startsFromRoot = !parts.isEmpty() && parts[0].endsWith(QLatin1Char(':')); #else bool startsFromRoot = path[0] == sep[0]; diff --git a/src/gui/dialogs/qfiledialog_wince.ui b/src/gui/dialogs/qfiledialog_embedded.ui index 1851aea..1851aea 100644 --- a/src/gui/dialogs/qfiledialog_wince.ui +++ b/src/gui/dialogs/qfiledialog_embedded.ui diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index bdc0109..2806ae4 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -75,6 +75,7 @@ #include <qpointer.h> #include <qdebug.h> #include "qsidebar_p.h" +#include "qfscompleter_p.h" #if defined (Q_OS_UNIX) #include <unistd.h> @@ -90,25 +91,6 @@ class QCompleter; class QHBoxLayout; class Ui_QFileDialog; -#ifndef QT_NO_COMPLETER -/*! - QCompleter that can deal with QFileSystemModel - */ -class QFSCompletor : public QCompleter { -public: - QFSCompletor(QFileSystemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(model) - { -#ifdef Q_OS_WIN - setCaseSensitivity(Qt::CaseInsensitive); -#endif - } - QString pathFromIndex(const QModelIndex &index) const; - QStringList splitPath(const QString& path) const; - - QAbstractProxyModel *proxyModel; - QFileSystemModel *sourceModel; -}; -#endif // QT_NO_COMPLETER struct QFileDialogArgs { @@ -130,31 +112,7 @@ class Q_AUTOTEST_EXPORT QFileDialogPrivate : public QDialogPrivate Q_DECLARE_PUBLIC(QFileDialog) public: - QFileDialogPrivate() : -#ifndef QT_NO_PROXYMODEL - proxyModel(0), -#endif - model(0), - fileMode(QFileDialog::AnyFile), - acceptMode(QFileDialog::AcceptOpen), - currentHistoryLocation(-1), - renameAction(0), - deleteAction(0), - showHiddenAction(0), - useDefaultCaption(true), - defaultFileTypes(true), - fileNameLabelExplicitlySat(false), - nativeDialogInUse(false), -#ifdef Q_WS_MAC - mDelegate(0), -#ifndef QT_MAC_USE_COCOA - mDialog(0), - mDialogStarted(false), - mDialogClosed(true), -#endif -#endif - qFileDialogUi(0) - {} + QFileDialogPrivate(); void createToolButtons(); void createMenuActions(); @@ -222,7 +180,7 @@ public: static inline QString toInternal(const QString &path) { -#if defined(Q_FS_FAT) || defined(Q_OS_OS2EMX) +#if defined(Q_FS_FAT) || defined(Q_OS_OS2EMX) || defined(Q_OS_SYMBIAN) QString n(path); for (int i = 0; i < (int)n.length(); ++i) if (n[i] == QLatin1Char('\\')) n[i] = QLatin1Char('/'); @@ -275,7 +233,7 @@ public: QFileSystemModel *model; #ifndef QT_NO_COMPLETER - QFSCompletor *completer; + QFSCompleter *completer; #endif //QT_NO_COMPLETER QFileDialog::FileMode fileMode; @@ -296,7 +254,7 @@ public: bool defaultFileTypes; bool fileNameLabelExplicitlySat; QStringList nameFilters; - + // Members for using native dialogs: bool nativeDialogInUse; // setVisible_sys returns true if it ends up showing a native @@ -358,7 +316,7 @@ public: void mac_nativeDialogModalHelp(); #endif - Ui_QFileDialog *qFileDialogUi; + QScopedPointer<Ui_QFileDialog> qFileDialogUi; QString acceptLabel; @@ -367,6 +325,11 @@ public: QByteArray signalToDisconnectOnClose; QFileDialog::Options opts; + + ~QFileDialogPrivate(); + +private: + Q_DISABLE_COPY(QFileDialogPrivate) }; class QFileDialogLineEdit : public QLineEdit diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 8666f69..b92df61 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -86,10 +86,10 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) */ QFileInfoGatherer::~QFileInfoGatherer() { - mutex.lock(); + QMutexLocker locker(&mutex); abort = true; condition.wakeOne(); - mutex.unlock(); + locker.unlock(); wait(); } @@ -97,9 +97,8 @@ void QFileInfoGatherer::setResolveSymlinks(bool enable) { Q_UNUSED(enable); #ifdef Q_OS_WIN - mutex.lock(); + QMutexLocker locker(&mutex); m_resolveSymlinks = enable; - mutex.unlock(); #endif } @@ -110,9 +109,8 @@ bool QFileInfoGatherer::resolveSymlinks() const void QFileInfoGatherer::setIconProvider(QFileIconProvider *provider) { - mutex.lock(); + QMutexLocker locker(&mutex); m_iconProvider = provider; - mutex.unlock(); } QFileIconProvider *QFileInfoGatherer::iconProvider() const @@ -127,12 +125,11 @@ QFileIconProvider *QFileInfoGatherer::iconProvider() const */ void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStringList &files) { - mutex.lock(); + QMutexLocker locker(&mutex); // See if we already have this dir/file in our que int loc = this->path.lastIndexOf(path); while (loc > 0) { if (this->files.at(loc) == files) { - mutex.unlock(); return; } loc = this->path.lastIndexOf(path, loc - 1); @@ -140,7 +137,6 @@ void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStr this->path.push(path); this->files.push(files); condition.wakeAll(); - mutex.unlock(); } /*! @@ -163,10 +159,9 @@ void QFileInfoGatherer::updateFile(const QString &filePath) void QFileInfoGatherer::clear() { #ifndef QT_NO_FILESYSTEMWATCHER - mutex.lock(); + QMutexLocker locker(&mutex); watcher->removePaths(watcher->files()); watcher->removePaths(watcher->directories()); - mutex.unlock(); #endif } @@ -178,9 +173,8 @@ void QFileInfoGatherer::clear() void QFileInfoGatherer::removePath(const QString &path) { #ifndef QT_NO_FILESYSTEMWATCHER - mutex.lock(); + QMutexLocker locker(&mutex); watcher->removePath(path); - mutex.unlock(); #endif } @@ -201,9 +195,8 @@ void QFileInfoGatherer::run() { forever { bool updateFiles = false; - mutex.lock(); + QMutexLocker locker(&mutex); if (abort) { - mutex.unlock(); return; } if (this->path.isEmpty()) @@ -217,8 +210,9 @@ void QFileInfoGatherer::run() this->files.pop_front(); updateFiles = true; } - mutex.unlock(); - if (updateFiles) getFileInfos(path, list); + locker.unlock(); + if (updateFiles) + getFileInfos(path, list); } } @@ -290,6 +284,8 @@ QString QFileInfoGatherer::translateDriveName(const QFileInfo &drive) const #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if (driveName.startsWith(QLatin1Char('/'))) // UNC host return drive.fileName(); +#endif +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) if (driveName.endsWith(QLatin1Char('/'))) driveName.chop(1); #endif diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 6456454..2c46ae4 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -347,7 +347,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS // ### TODO can we use bool QAbstractFileEngine::caseSensitive() const? QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty()) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if (!defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(Q_OS_SYMBIAN) && QDir::fromNativeSeparators(longPath) != QLatin1String("/") #endif ) @@ -376,9 +376,21 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS r = translateVisibleLocation(rootNode, r); index = q->index(r, 0, QModelIndex()); pathElements.pop_front(); - } else { + } else +#endif + +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) + { if (!pathElements.at(0).contains(QLatin1String(":"))) +#if defined(Q_CC_NOKIAX86) + { + // Workaround for bizarre compiler crash. + QString rootPath = QDir(longPath).rootPath(); + pathElements.prepend(rootPath); + } +#else pathElements.prepend(QDir(longPath).rootPath()); +#endif if (pathElements.at(0).endsWith(QLatin1Char('/'))) pathElements[0].chop(1); } @@ -1589,12 +1601,25 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons if (parentNode->children.count() == 0) return; QStringList toRemove; +#if defined(Q_OS_SYMBIAN) + // Filename case must be exact in qBinaryFind below, so create a list of all lowercase names. + QStringList newFiles; + for(int i = 0; i < files.size(); i++) { + newFiles << files.at(i).toLower(); + } +#else QStringList newFiles = files; +#endif qSort(newFiles.begin(), newFiles.end()); QHash<QString, QFileSystemNode*>::const_iterator i = parentNode->children.constBegin(); while (i != parentNode->children.constEnd()) { QStringList::iterator iterator; - iterator = qBinaryFind(newFiles.begin(), newFiles.end(), i.value()->fileName); + iterator = qBinaryFind(newFiles.begin(), newFiles.end(), +#if defined(Q_OS_SYMBIAN) + i.value()->fileName.toLower()); +#else + i.value()->fileName); +#endif if (iterator == newFiles.end()) { toRemove.append(i.value()->fileName); } @@ -1917,8 +1942,8 @@ bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const return true; } +QT_END_NAMESPACE + #include "moc_qfilesystemmodel.cpp" #endif // QT_NO_FILESYSTEMMODEL - -QT_END_NAMESPACE diff --git a/src/gui/dialogs/qfscompleter_p.h b/src/gui/dialogs/qfscompleter_p.h new file mode 100644 index 0000000..f0fcdec --- /dev/null +++ b/src/gui/dialogs/qfscompleter_p.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOMPLETOR_P_H +#define QCOMPLETOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qcompleter.h" +#include <QtGui/qfilesystemmodel.h> +QT_BEGIN_NAMESPACE +#ifndef QT_NO_COMPLETER + +/*! + QCompleter that can deal with QFileSystemModel + */ +class QFSCompleter : public QCompleter { +public: + QFSCompleter(QFileSystemModel *model, QObject *parent = 0) + : QCompleter(model, parent), proxyModel(0), sourceModel(model) + { +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + setCaseSensitivity(Qt::CaseInsensitive); +#endif + } + QString pathFromIndex(const QModelIndex &index) const; + QStringList splitPath(const QString& path) const; + + QAbstractProxyModel *proxyModel; + QFileSystemModel *sourceModel; +}; +#endif // QT_NO_COMPLETER +QT_END_NAMESPACE +#endif // QCOMPLETOR_P_H + diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 7a81ea5..857ce46 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -269,7 +269,7 @@ void QMessageBoxPrivate::updateSize() return; QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); -#if defined(Q_WS_QWS) || defined(Q_WS_WINCE) +#if defined(Q_WS_QWS) || defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) // the width of the screen, less the window border. int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width()); #else diff --git a/src/gui/dialogs/qpagesetupdialog_win.cpp b/src/gui/dialogs/qpagesetupdialog_win.cpp index 08b322e..880a198 100644 --- a/src/gui/dialogs/qpagesetupdialog_win.cpp +++ b/src/gui/dialogs/qpagesetupdialog_win.cpp @@ -71,7 +71,7 @@ int QPageSetupDialog::exec() return Rejected; QWin32PrintEngine *engine = static_cast<QWin32PrintEngine*>(d->printer->paintEngine()); - QWin32PrintEnginePrivate *ep = static_cast<QWin32PrintEnginePrivate *>(engine->d_ptr); + QWin32PrintEnginePrivate *ep = static_cast<QWin32PrintEnginePrivate *>(engine->d_ptr.data()); PAGESETUPDLG psd; memset(&psd, 0, sizeof(PAGESETUPDLG)); diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index d3fbed7..a491532 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -44,7 +44,6 @@ #ifndef QT_NO_PRINTDIALOG #include "private/qabstractprintdialog_p.h" -#include "qfiledialog_p.h" #include <QtGui/qmessagebox.h> #include "qprintdialog.h" #include "qfiledialog.h" @@ -55,6 +54,7 @@ #include <QtGui/qdialogbuttonbox.h> +#include "qfscompleter_p.h" #include "ui_qprintpropertieswidget.h" #include "ui_qprintsettingsoutput.h" #include "ui_qprintwidget.h" @@ -696,7 +696,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p) QFileSystemModel *fsm = new QFileSystemModel(widget.filename); fsm->setRootPath(QDir::homePath()); #if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG) - widget.filename->setCompleter(new QFSCompletor(fsm, widget.filename)); + widget.filename->setCompleter(new QFSCompleter(fsm, widget.filename)); #endif #endif _q_printerChanged(currentPrinterIndex); diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index ee16fe5..6565739 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -42,6 +42,7 @@ #include "qprintpreviewdialog.h" #include "qprintpreviewwidget.h" #include <private/qprinter_p.h> +#include "private/qdialog_p.h" #include <QtGui/qaction.h> #include <QtGui/qboxlayout.h> @@ -138,12 +139,12 @@ private: }; } // anonymous namespace -class QPrintPreviewDialogPrivate +class QPrintPreviewDialogPrivate : public QDialogPrivate { Q_DECLARE_PUBLIC(QPrintPreviewDialog) public: - QPrintPreviewDialogPrivate(QPrintPreviewDialog *q) - : q_ptr(q), printDialog(0), ownPrinter(false), + QPrintPreviewDialogPrivate() + : printDialog(0), ownPrinter(false), initialized(false) {} // private slots @@ -168,7 +169,6 @@ public: void updatePageNumLabel(); void updateZoomFactor(); - QPrintPreviewDialog *q_ptr; QPrintDialog *printDialog; QPrintPreviewWidget *preview; QPrinter *printer; @@ -662,7 +662,7 @@ void QPrintPreviewDialogPrivate::_q_zoomFactorChanged() \sa QWidget::setWindowFlags() */ QPrintPreviewDialog::QPrintPreviewDialog(QPrinter* printer, QWidget *parent, Qt::WindowFlags flags) - : QDialog(parent, flags), d_ptr(new QPrintPreviewDialogPrivate(this)) + : QDialog(*new QPrintPreviewDialogPrivate, parent, flags) { Q_D(QPrintPreviewDialog); d->init(printer); @@ -676,7 +676,7 @@ QPrintPreviewDialog::QPrintPreviewDialog(QPrinter* printer, QWidget *parent, Qt: system default printer. */ QPrintPreviewDialog::QPrintPreviewDialog(QWidget *parent, Qt::WindowFlags f) - : QDialog(parent, f), d_ptr(new QPrintPreviewDialogPrivate(this)) + : QDialog(*new QPrintPreviewDialogPrivate, parent, f) { Q_D(QPrintPreviewDialog); d->init(); @@ -691,7 +691,6 @@ QPrintPreviewDialog::~QPrintPreviewDialog() if (d->ownPrinter) delete d->printer; delete d->printDialog; - delete d_ptr; } /*! diff --git a/src/gui/dialogs/qprintpreviewdialog.h b/src/gui/dialogs/qprintpreviewdialog.h index 9b5264e..0b55ad3 100644 --- a/src/gui/dialogs/qprintpreviewdialog.h +++ b/src/gui/dialogs/qprintpreviewdialog.h @@ -94,7 +94,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_previewChanged()) Q_PRIVATE_SLOT(d_func(), void _q_zoomFactorChanged()) - QPrintPreviewDialogPrivate *d_ptr; + void *dummy; // ### Qt 5 - remove me }; diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index a2767e9..41e8579 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -83,7 +83,7 @@ const int ModernHeaderTopMargin = 2; const int ClassicHMargin = 4; const int MacButtonTopMargin = 13; const int MacLayoutLeftMargin = 20; -const int MacLayoutTopMargin = 14; +//const int MacLayoutTopMargin = 14; // Unused. Save some space and avoid warning. const int MacLayoutRightMargin = 20; const int MacLayoutBottomMargin = 17; |