Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
05d8ddf5
Commit
05d8ddf5
authored
Dec 01, 2010
by
con
Browse files
Allow empty editor id with openEditorWithContents.
Tries to figure out the editor type from the title pattern in that case.
parent
9a472466
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/editormanager/editormanager.cpp
View file @
05d8ddf5
...
...
@@ -1282,28 +1282,11 @@ IEditor *EditorManager::openEditorWithContents(const QString &editorId,
if
(
debugEditorManager
)
qDebug
()
<<
Q_FUNC_INFO
<<
editorId
<<
titlePattern
<<
contents
;
if
(
editorId
.
isEmpty
())
return
0
;
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
IEditor
*
edt
=
createEditor
(
editorId
);
if
(
!
edt
)
{
QApplication
::
restoreOverrideCursor
();
return
0
;
}
if
(
!
edt
->
createNew
(
contents
))
{
QApplication
::
restoreOverrideCursor
();
delete
edt
;
edt
=
0
;
return
0
;
}
QString
title
=
edt
->
displayName
();
QString
title
;
if
(
titlePattern
)
{
const
QChar
dollar
=
QLatin1Char
(
'$'
);
const
QChar
dot
=
QLatin1Char
(
'.'
);
QString
base
=
*
titlePattern
;
if
(
base
.
isEmpty
())
...
...
@@ -1315,7 +1298,6 @@ IEditor *EditorManager::openEditorWithContents(const QString &editorId,
QString
name
=
editor
->
file
()
->
fileName
();
if
(
name
.
isEmpty
())
{
name
=
editor
->
displayName
();
name
.
remove
(
QLatin1Char
(
'*'
));
}
else
{
name
=
QFileInfo
(
name
).
completeBaseName
();
}
...
...
@@ -1331,6 +1313,23 @@ IEditor *EditorManager::openEditorWithContents(const QString &editorId,
}
*
titlePattern
=
title
;
}
IEditor
*
edt
=
createEditor
(
editorId
,
title
);
if
(
!
edt
)
{
QApplication
::
restoreOverrideCursor
();
return
0
;
}
if
(
!
edt
->
createNew
(
contents
))
{
QApplication
::
restoreOverrideCursor
();
delete
edt
;
edt
=
0
;
return
0
;
}
if
(
title
.
isEmpty
())
title
=
edt
->
displayName
();
edt
->
setDisplayName
(
title
);
addEditor
(
edt
);
QApplication
::
restoreOverrideCursor
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment