summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper K. Pedersen <jesper.pedersen@kdab.com>2013-05-22 10:30:06 +0000
committerJesper K. Pedersen <jesper.pedersen@kdab.com>2013-05-23 13:56:36 +0200
commit5c4418a2be7d0c441a40c9dee7f2ca10d84cc8aa (patch)
tree2058ff41d7c98302a6e519c0966e5206aaa1114d
parentd788bc73f1aa5b60c6675d3c3a6db0650b435ec2 (diff)
Wrap UI editors as text editors
Reason for this is that the UI editor in text mode is read only Change-Id: Ice4a83b8d932407c2bc8716c68cae39ee13a3899 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
-rw-r--r--objects/editors.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/objects/editors.cpp b/objects/editors.cpp
index d6da92e..ada1500 100644
--- a/objects/editors.cpp
+++ b/objects/editors.cpp
@@ -40,6 +40,7 @@
#include "scriptrunner.h"
#include <designer/formwindoweditor.h>
#include <texteditor/plaintexteditor.h>
+#include <coreplugin/coreconstants.h>
using namespace Scripting;
using namespace Scripting::Internal;
@@ -93,7 +94,13 @@ QStringList Editors::existingEditors()
Editor *Editors::openFile(const QString &fileName)
{
- Core::IEditor* editor = Core::EditorManager::instance()->openEditor(ScriptRunner::absolutePath(fileName));
+ Core::IEditor* editor;
+ if (fileName.endsWith(QLatin1String(".ui"))) {
+ // Force the text editor for UI files, otherwise it will be read only in text mode.
+ editor = Core::EditorManager::instance()->openEditor(ScriptRunner::absolutePath(fileName), Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
+ }
+ else
+ editor = Core::EditorManager::instance()->openEditor(ScriptRunner::absolutePath(fileName) );
if (editor) {
Editor* wrapper = wrapEditor(editor);
wrapper->waitForInitialized();