Skip to content
GitLab
Menu
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
f0218b8f
Commit
f0218b8f
authored
Aug 05, 2009
by
mae
Browse files
fix occasionally broken link to the modified state of the editor
parent
c6eced4c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/editormanager/openeditorsmodel.cpp
View file @
f0218b8f
...
...
@@ -72,6 +72,9 @@ QList<IEditor *> OpenEditorsModel::editors() const
void
OpenEditorsModel
::
addEditor
(
IEditor
*
editor
,
bool
isDuplicate
)
{
if
(
!
editor
)
return
;
if
(
isDuplicate
)
{
m_duplicateEditors
.
append
(
editor
);
return
;
...
...
@@ -195,7 +198,7 @@ int OpenEditorsModel::restoredEditorCount() const
bool
OpenEditorsModel
::
isDuplicate
(
IEditor
*
editor
)
const
{
return
m_duplicateEditors
.
contains
(
editor
);
return
editor
&&
m_duplicateEditors
.
contains
(
editor
);
}
IEditor
*
OpenEditorsModel
::
originalForDuplicate
(
IEditor
*
duplicate
)
const
...
...
@@ -219,13 +222,15 @@ QList<IEditor *> OpenEditorsModel::duplicatesFor(IEditor *editor) const
void
OpenEditorsModel
::
makeOriginal
(
IEditor
*
duplicate
)
{
Q_ASSERT
(
isDuplicate
(
duplicate
));
Q_ASSERT
(
duplicate
&&
isDuplicate
(
duplicate
));
IEditor
*
original
=
originalForDuplicate
(
duplicate
);
Q_ASSERT
(
original
);
int
i
=
findEditor
(
original
);
m_editors
[
i
].
editor
=
duplicate
;
m_duplicateEditors
.
removeOne
(
duplicate
);
m_duplicateEditors
.
append
(
original
);
disconnect
(
original
,
SIGNAL
(
changed
()),
this
,
SLOT
(
itemChanged
()));
connect
(
duplicate
,
SIGNAL
(
changed
()),
this
,
SLOT
(
itemChanged
()));
}
void
OpenEditorsModel
::
emitDataChanged
(
IEditor
*
editor
)
...
...
src/plugins/coreplugin/editormanager/openeditorswindow.cpp
View file @
f0218b8f
...
...
@@ -199,14 +199,14 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
QSet
<
IFile
*>
filesDone
;
foreach
(
const
EditLocation
&
hi
,
view
->
editorHistory
())
{
if
(
hi
.
file
==
0
||
filesDone
.
contains
(
hi
.
file
))
if
(
hi
.
file
.
isNull
()
||
filesDone
.
contains
(
hi
.
file
))
continue
;
filesDone
.
insert
(
hi
.
file
.
data
());
QTreeWidgetItem
*
item
=
new
QTreeWidgetItem
();
QString
title
=
model
->
displayNameForFile
(
hi
.
file
);
if
(
hi
.
file
&&
hi
.
file
->
isModified
())
if
(
hi
.
file
->
isModified
())
title
+=
tr
(
"*"
);
item
->
setIcon
(
0
,
hi
.
file
->
isReadOnly
()
?
lockedIcon
:
emptyIcon
);
item
->
setText
(
0
,
title
);
...
...
@@ -226,20 +226,21 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
// add missing editors from the main view
if
(
mainView
!=
view
)
{
foreach
(
const
EditLocation
&
hi
,
mainView
->
editorHistory
())
{
if
(
hi
.
file
==
0
||
filesDone
.
contains
(
hi
.
file
))
if
(
hi
.
file
.
isNull
()
||
filesDone
.
contains
(
hi
.
file
))
continue
;
filesDone
.
insert
(
hi
.
file
.
data
());
QTreeWidgetItem
*
item
=
new
QTreeWidgetItem
();
QString
title
=
model
->
displayNameForFile
(
hi
.
file
);
if
(
hi
.
file
&&
hi
.
file
->
isModified
())
if
(
hi
.
file
->
isModified
())
title
+=
tr
(
"*"
);
item
->
setIcon
(
0
,
hi
.
file
->
isReadOnly
()
?
lockedIcon
:
emptyIcon
);
item
->
setText
(
0
,
title
);
item
->
setToolTip
(
0
,
hi
.
file
->
fileName
());
item
->
setData
(
0
,
Qt
::
UserRole
,
QVariant
::
fromValue
(
hi
.
file
.
data
()));
item
->
setData
(
0
,
Qt
::
UserRole
+
1
,
QVariant
::
fromValue
(
view
));
item
->
setData
(
0
,
Qt
::
UserRole
+
2
,
QVariant
::
fromValue
(
hi
.
kind
));
item
->
setTextAlignment
(
0
,
Qt
::
AlignLeft
);
m_editorList
->
addTopLevelItem
(
item
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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