Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
e33508b2
Commit
e33508b2
authored
May 04, 2009
by
con
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "Close all except 'foo.bar'" action.
parent
38d7c52d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
1 deletion
+35
-1
src/plugins/coreplugin/coreconstants.h
src/plugins/coreplugin/coreconstants.h
+1
-0
src/plugins/coreplugin/editormanager/editormanager.cpp
src/plugins/coreplugin/editormanager/editormanager.cpp
+21
-1
src/plugins/coreplugin/editormanager/editormanager.h
src/plugins/coreplugin/editormanager/editormanager.h
+1
-0
src/plugins/coreplugin/editormanager/editorview.cpp
src/plugins/coreplugin/editormanager/editorview.cpp
+11
-0
src/plugins/coreplugin/editormanager/editorview.h
src/plugins/coreplugin/editormanager/editorview.h
+1
-0
No files found.
src/plugins/coreplugin/coreconstants.h
View file @
e33508b2
...
...
@@ -130,6 +130,7 @@ const char * const SAVEASDEFAULT = "QtCreator.SaveAsDefaultLayout";
const
char
*
const
RESTOREDEFAULT
=
"QtCreator.RestoreDefaultLayout"
;
const
char
*
const
CLOSE
=
"QtCreator.Close"
;
const
char
*
const
CLOSEALL
=
"QtCreator.CloseAll"
;
const
char
*
const
CLOSEOTHERS
=
"QtCreator.CloseOthers"
;
const
char
*
const
GOTONEXT
=
"QtCreator.GotoNext"
;
const
char
*
const
GOTOPREV
=
"QtCreator.GotoPrevious"
;
const
char
*
const
GOTONEXTINHISTORY
=
"QtCreator.GotoNextInHistory"
;
...
...
src/plugins/coreplugin/editormanager/editormanager.cpp
View file @
e33508b2
...
...
@@ -149,6 +149,7 @@ struct EditorManagerPrivate {
QAction
*
m_saveAsAction
;
QAction
*
m_closeCurrentEditorAction
;
QAction
*
m_closeAllEditorsAction
;
QAction
*
m_closeOtherEditorsAction
;
QAction
*
m_gotoNextDocHistoryAction
;
QAction
*
m_gotoPreviousDocHistoryAction
;
QAction
*
m_goBackAction
;
...
...
@@ -187,6 +188,7 @@ EditorManagerPrivate::EditorManagerPrivate(ICore *core, QWidget *parent) :
m_saveAsAction
(
new
QAction
(
parent
)),
m_closeCurrentEditorAction
(
new
QAction
(
EditorManager
::
tr
(
"Close"
),
parent
)),
m_closeAllEditorsAction
(
new
QAction
(
EditorManager
::
tr
(
"Close All"
),
parent
)),
m_closeOtherEditorsAction
(
new
QAction
(
EditorManager
::
tr
(
"Close Others"
),
parent
)),
m_gotoNextDocHistoryAction
(
new
QAction
(
EditorManager
::
tr
(
"Next Document in History"
),
parent
)),
m_gotoPreviousDocHistoryAction
(
new
QAction
(
EditorManager
::
tr
(
"Previous Document in History"
),
parent
)),
m_goBackAction
(
new
QAction
(
EditorManager
::
tr
(
"Go back"
),
parent
)),
...
...
@@ -292,6 +294,12 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
mfile
->
addAction
(
cmd
,
Constants
::
G_FILE_CLOSE
);
connect
(
m_d
->
m_closeAllEditorsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
closeAllEditors
()));
//Close All Others Action
cmd
=
am
->
registerAction
(
m_d
->
m_closeOtherEditorsAction
,
Constants
::
CLOSEOTHERS
,
editManagerContext
);
mfile
->
addAction
(
cmd
,
Constants
::
G_FILE_CLOSE
);
cmd
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
connect
(
m_d
->
m_closeOtherEditorsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
closeOtherEditors
()));
// Goto Previous In History Action
cmd
=
am
->
registerAction
(
m_d
->
m_gotoPreviousDocHistoryAction
,
Constants
::
GOTOPREVINHISTORY
,
editManagerContext
);
#ifdef Q_WS_MAC
...
...
@@ -648,6 +656,16 @@ bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
return
closeEditors
(
openedEditors
(),
askAboutModifiedEditors
);
}
void
EditorManager
::
closeOtherEditors
()
{
IEditor
*
current
=
currentEditor
();
QTC_ASSERT
(
current
,
return
);
m_d
->
m_editorModel
->
removeAllRestoredEditors
();
QList
<
IEditor
*>
editors
=
openedEditors
();
editors
.
removeAll
(
current
);
closeEditors
(
editors
,
true
);
}
bool
EditorManager
::
closeEditors
(
const
QList
<
IEditor
*>
editorsToClose
,
bool
askAboutModifiedEditors
)
{
if
(
editorsToClose
.
isEmpty
())
...
...
@@ -1331,7 +1349,7 @@ void EditorManager::updateActions()
{
QString
fName
;
IEditor
*
curEditor
=
currentEditor
();
int
openedCount
=
openedEditors
().
count
();
int
openedCount
=
openedEditors
().
count
()
+
m_d
->
m_editorModel
->
restoredEditorCount
()
;
if
(
curEditor
)
{
if
(
!
curEditor
->
file
()
->
fileName
().
isEmpty
())
{
QFileInfo
fi
(
curEditor
->
file
()
->
fileName
());
...
...
@@ -1367,6 +1385,8 @@ void EditorManager::updateActions()
m_d
->
m_closeCurrentEditorAction
->
setEnabled
(
curEditor
!=
0
);
m_d
->
m_closeCurrentEditorAction
->
setText
(
tr
(
"Close %1"
).
arg
(
quotedName
));
m_d
->
m_closeAllEditorsAction
->
setEnabled
(
openedCount
>
0
);
m_d
->
m_closeOtherEditorsAction
->
setEnabled
(
openedCount
>
1
);
m_d
->
m_closeOtherEditorsAction
->
setText
((
openedCount
>
1
?
tr
(
"Close All Except %1"
).
arg
(
quotedName
)
:
tr
(
"Close Others"
)));
m_d
->
m_gotoNextDocHistoryAction
->
setEnabled
(
m_d
->
m_editorHistory
.
count
()
>
0
);
m_d
->
m_gotoPreviousDocHistoryAction
->
setEnabled
(
m_d
->
m_editorHistory
.
count
()
>
0
);
...
...
src/plugins/coreplugin/editormanager/editormanager.h
View file @
e33508b2
...
...
@@ -198,6 +198,7 @@ private slots:
bool
saveFile
(
Core
::
IEditor
*
editor
=
0
);
bool
saveFileAs
(
Core
::
IEditor
*
editor
=
0
);
void
closeEditor
();
void
closeOtherEditors
();
void
gotoNextDocHistory
();
void
gotoPreviousDocHistory
();
...
...
src/plugins/coreplugin/editormanager/editorview.cpp
View file @
e33508b2
...
...
@@ -205,6 +205,17 @@ void EditorModel::removeAllRestoredEditors()
}
}
int
EditorModel
::
restoredEditorCount
()
const
{
int
count
=
0
;
for
(
int
i
=
m_editors
.
count
()
-
1
;
i
>=
0
;
--
i
)
{
if
(
!
m_editors
.
at
(
i
).
editor
)
{
++
count
;
}
}
return
count
;
}
bool
EditorModel
::
isDuplicate
(
IEditor
*
editor
)
const
{
return
m_duplicateEditors
.
contains
(
editor
);
...
...
src/plugins/coreplugin/editormanager/editorview.h
View file @
e33508b2
...
...
@@ -89,6 +89,7 @@ public:
void
removeEditor
(
const
QModelIndex
&
index
);
void
removeAllRestoredEditors
();
int
restoredEditorCount
()
const
;
void
emitDataChanged
(
IEditor
*
editor
);
QList
<
IEditor
*>
editors
()
const
;
...
...
Write
Preview
Markdown
is supported
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