aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/refactoringchanges.cpp
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-09-20 21:52:56 +0200
committerhjk <hjk121@nokiamail.com>2014-09-25 18:06:47 +0200
commit111f65b5187e2eae6e36bdb4ca64ca8ce89a63c1 (patch)
tree5757c66d00f32911adb5b6a2a3476856f3877ad9 /src/plugins/texteditor/refactoringchanges.cpp
parent0fcca946adbc17ee6f911a5891e9c5dc11631288 (diff)
Core: Reorganize ReadOnlyFilesDialog
Move exported class out of namespace Internal, but expose only a minimal interface. Use Qt 5 connections, adjust callers and surrounding code. Change-Id: I52b4156d78cd1ec42ec6c94994775ce74f24ebdc Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/texteditor/refactoringchanges.cpp')
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index e025fbd22ac..d50495d1b84 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -43,6 +43,9 @@
#include <QDebug>
#include <QApplication>
+using namespace Core;
+using namespace Utils;
+
namespace TextEditor {
RefactoringChanges::RefactoringChanges()
@@ -93,8 +96,8 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont
cursor.endEditBlock();
// Write the file to disk:
- Utils::TextFileFormat format;
- format.codec = Core::EditorManager::defaultTextCodec();
+ TextFileFormat format;
+ format.codec = EditorManager::defaultTextCodec();
QString error;
bool saveOk = format.writeFile(fileName, document->toPlainText(), &error);
delete document;
@@ -121,15 +124,14 @@ bool RefactoringChanges::removeFile(const QString &fileName) const
BaseTextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, bool activate, int line, int column)
{
- Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory;
+ EditorManager::OpenEditorFlags flags = EditorManager::IgnoreNavigationHistory;
if (!activate)
- flags |= Core::EditorManager::DoNotChangeCurrentEditor;
+ flags |= EditorManager::DoNotChangeCurrentEditor;
if (line != -1) {
// openEditorAt uses a 1-based line and a 0-based column!
column -= 1;
}
- Core::IEditor *editor = Core::EditorManager::openEditorAt(
- fileName, line, column, Core::Id(), flags);
+ IEditor *editor = EditorManager::openEditorAt(fileName, line, column, Id(), flags);
if (editor)
return qobject_cast<BaseTextEditorWidget *>(editor->widget());
@@ -177,7 +179,7 @@ RefactoringFile::RefactoringFile(const QString &fileName, const QSharedPointer<R
, m_editorCursorPosition(-1)
, m_appliedOnce(false)
{
- QList<Core::IEditor *> editors = Core::DocumentModel::editorsForFilePath(fileName);
+ QList<IEditor *> editors = DocumentModel::editorsForFilePath(fileName);
if (!editors.isEmpty())
m_editor = qobject_cast<BaseTextEditorWidget *>(editors.first()->widget());
}
@@ -207,12 +209,12 @@ QTextDocument *RefactoringFile::mutableDocument() const
QString fileContents;
if (!m_fileName.isEmpty()) {
QString error;
- QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
- Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
+ QTextCodec *defaultCodec = EditorManager::defaultTextCodec();
+ TextFileFormat::ReadResult result = TextFileFormat::readFile(
m_fileName, defaultCodec,
&fileContents, &m_textFileFormat,
&error);
- if (result != Utils::TextFileFormat::ReadSuccess) {
+ if (result != TextFileFormat::ReadSuccess) {
qWarning() << "Could not read " << m_fileName << ". Error: " << error;
m_textFileFormat.codec = 0;
}
@@ -285,7 +287,7 @@ QString RefactoringFile::textOf(const Range &range) const
return textOf(range.start, range.end);
}
-void RefactoringFile::setChangeSet(const Utils::ChangeSet &changeSet)
+void RefactoringFile::setChangeSet(const ChangeSet &changeSet)
{
if (m_fileName.isEmpty())
return;
@@ -321,11 +323,11 @@ void RefactoringFile::apply()
// test file permissions
if (!QFileInfo(fileName()).isWritable()) {
const QString &path = fileName();
- Core::Internal::ReadOnlyFilesDialog roDialog(path, Core::ICore::mainWindow());
+ ReadOnlyFilesDialog roDialog(path, ICore::mainWindow());
const QString &failDetailText = QApplication::translate("RefactoringFile::apply",
"Refactoring cannot be applied.");
roDialog.setShowFailWarning(true, failDetailText);
- if (roDialog.exec() == Core::Internal::ReadOnlyFilesDialog::RO_Cancel)
+ if (roDialog.exec() == ReadOnlyFilesDialog::RO_Cancel)
return;
}