diff options
author | hjk <hjk121@nokiamail.com> | 2014-01-06 10:56:30 +0100 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-01-06 13:41:20 +0100 |
commit | 6d19f33f79011c0c704e03e9b29ce6edaf630ad5 (patch) | |
tree | 11a34c9123ff9882334bbde340454bda7c4160ad /src/plugins | |
parent | f5544d4c2d750424834d3a2aecff30c25ba01df2 (diff) | |
download | qt-creator-6d19f33f79011c0c704e03e9b29ce6edaf630ad5.tar.gz |
DocumentManager: Use ICore::dialogParent for all dialogs
Change-Id: Id2eda57bc816c8601a3460aaf224852c267d336e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/coreplugin/documentmanager.cpp | 26 | ||||
-rw-r--r-- | src/plugins/coreplugin/documentmanager.h | 2 |
2 files changed, 13 insertions, 15 deletions
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 9e7dbbdba3..8311da8a49 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -135,7 +135,7 @@ struct FileState struct DocumentManagerPrivate { - explicit DocumentManagerPrivate(QMainWindow *mw); + DocumentManagerPrivate(); QFileSystemWatcher *fileWatcher(); QFileSystemWatcher *linkWatcher(); @@ -150,7 +150,6 @@ struct DocumentManagerPrivate QString m_currentFile; - QMainWindow *m_mainWindow; QFileSystemWatcher *m_fileWatcher; // Delayed creation. QFileSystemWatcher *m_linkWatcher; // Delayed creation (only UNIX/if a link is seen). bool m_blockActivated; @@ -193,8 +192,7 @@ QFileSystemWatcher *DocumentManagerPrivate::linkWatcher() return fileWatcher(); } -DocumentManagerPrivate::DocumentManagerPrivate(QMainWindow *mw) : - m_mainWindow(mw), +DocumentManagerPrivate::DocumentManagerPrivate() : m_fileWatcher(0), m_linkWatcher(0), m_blockActivated(false), @@ -213,10 +211,10 @@ namespace Core { using namespace Internal; -DocumentManager::DocumentManager(QMainWindow *mw) - : QObject(mw) +DocumentManager::DocumentManager(QObject *parent) + : QObject(parent) { - d = new DocumentManagerPrivate(mw); + d = new DocumentManagerPrivate; m_instance = this; connect(ICore::instance(), SIGNAL(contextChanged(QList<Core::IContext*>,Core::Context)), this, SLOT(syncWithEditor(QList<Core::IContext*>))); @@ -619,7 +617,7 @@ static QList<IDocument *> saveModifiedFilesHelper(const QList<IDocument *> &docu if (silently) { documentsToSave = modifiedDocuments; } else { - SaveItemsDialog dia(d->m_mainWindow, modifiedDocuments); + SaveItemsDialog dia(ICore::dialogParent(), modifiedDocuments); if (!message.isEmpty()) dia.setMessage(message); if (!alwaysSaveMessage.isNull()) @@ -643,7 +641,7 @@ static QList<IDocument *> saveModifiedFilesHelper(const QList<IDocument *> &docu roDocuments << document; } if (!roDocuments.isEmpty()) { - Core::Internal::ReadOnlyFilesDialog roDialog(roDocuments, d->m_mainWindow); + ReadOnlyFilesDialog roDialog(roDocuments, ICore::dialogParent()); roDialog.setShowFailWarning(true, DocumentManager::tr( "Could not save the files.", "error message")); @@ -683,7 +681,7 @@ bool DocumentManager::saveDocument(IDocument *document, const QString &fileName, } *isReadOnly = false; } - QMessageBox::critical(d->m_mainWindow, tr("File Error"), + QMessageBox::critical(ICore::dialogParent(), tr("File Error"), tr("Error while saving file: %1").arg(errorString)); out: ret = false; @@ -703,7 +701,7 @@ QString DocumentManager::getSaveFileName(const QString &title, const QString &pa do { repeat = false; fileName = QFileDialog::getSaveFileName( - d->m_mainWindow, title, path, filter, selectedFilter, QFileDialog::DontConfirmOverwrite); + ICore::dialogParent(), title, path, filter, selectedFilter, QFileDialog::DontConfirmOverwrite); if (!fileName.isEmpty()) { // If the selected filter is All Files (*) we leave the name exactly as the user // specified. Otherwise the suffix must be one available in the selected filter. If @@ -727,7 +725,7 @@ QString DocumentManager::getSaveFileName(const QString &title, const QString &pa } } if (QFile::exists(fileName)) { - if (QMessageBox::warning(d->m_mainWindow, tr("Overwrite?"), + if (QMessageBox::warning(ICore::dialogParent(), tr("Overwrite?"), tr("An item named '%1' already exists at this location. " "Do you want to overwrite it?").arg(fileName), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) { @@ -800,7 +798,7 @@ QStringList DocumentManager::getOpenFileNames(const QString &filters, if (path.isEmpty() && useProjectsDirectory()) path = projectsDirectory(); } - const QStringList files = QFileDialog::getOpenFileNames(d->m_mainWindow, + const QStringList files = QFileDialog::getOpenFileNames(ICore::dialogParent(), tr("Open File"), path, filters, selectedFilter); @@ -1029,7 +1027,7 @@ void DocumentManager::checkForReload() d->m_blockedIDocument = 0; } if (!errorStrings.isEmpty()) - QMessageBox::critical(d->m_mainWindow, tr("File Error"), + QMessageBox::critical(ICore::dialogParent(), tr("File Error"), errorStrings.join(QLatin1String("\n"))); // handle deleted files diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h index 70168a2b23..7449154448 100644 --- a/src/plugins/coreplugin/documentmanager.h +++ b/src/plugins/coreplugin/documentmanager.h @@ -153,7 +153,7 @@ private slots: void syncWithEditor(const QList<Core::IContext *> &context); private: - explicit DocumentManager(QMainWindow *ew); + explicit DocumentManager(QObject *parent); ~DocumentManager(); friend class Core::Internal::MainWindow; |