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
Tobias Hunger
qt-creator
Commits
8598a59b
Commit
8598a59b
authored
Feb 16, 2009
by
mae
Browse files
fix context definitions of the vcs editors (this makes shortcuts work again)
parent
2ff2c9c1
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/git/gitconstants.h
View file @
8598a59b
...
...
@@ -38,9 +38,13 @@ namespace Git {
namespace
Constants
{
const
char
*
const
GIT_COMMAND_LOG_EDITOR_KIND
=
"Git Command Log Editor"
;
const
char
*
const
C_GIT_COMMAND_LOG_EDITOR
=
"Git Command Log Editor"
;
const
char
*
const
GIT_LOG_EDITOR_KIND
=
"Git File Log Editor"
;
const
char
*
const
C_GIT_LOG_EDITOR
=
"Git File Log Editor"
;
const
char
*
const
GIT_BLAME_EDITOR_KIND
=
"Git Annotation Editor"
;
const
char
*
const
C_GIT_BLAME_EDITOR
=
"Git Annotation Editor"
;
const
char
*
const
GIT_DIFF_EDITOR_KIND
=
"Git Diff Editor"
;
const
char
*
const
C_GIT_DIFF_EDITOR
=
"Git Diff Editor"
;
const
char
*
const
C_GITSUBMITEDITOR
=
"Git Submit Editor"
;
const
char
*
const
GITSUBMITEDITOR_KIND
=
"Git Submit Editor"
;
...
...
src/plugins/git/gitplugin.cpp
View file @
8598a59b
...
...
@@ -73,22 +73,22 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase
::
RegularCommandOutput
,
Git
::
Constants
::
GIT_COMMAND_LOG_EDITOR_KIND
,
Core
::
Constants
::
C_G
LOBAL
,
Git
::
Constants
::
C_G
IT_COMMAND_LOG_EDITOR
,
"application/vnd.nokia.text.scs_git_commandlog"
,
"gitlog"
},
{
VCSBase
::
LogOutput
,
Git
::
Constants
::
GIT_LOG_EDITOR_KIND
,
Core
::
Constants
::
C_G
LOBAL
,
Git
::
Constants
::
C_G
IT_LOG_EDITOR
,
"application/vnd.nokia.text.scs_git_filelog"
,
"gitfilelog"
},
{
VCSBase
::
AnnotateOutput
,
Git
::
Constants
::
GIT_BLAME_EDITOR_KIND
,
Core
::
Constants
::
C_G
LOBAL
,
Git
::
Constants
::
C_G
IT_BLAME_EDITOR
,
"application/vnd.nokia.text.scs_git_annotation"
,
"gitsannotate"
},
{
VCSBase
::
DiffOutput
,
Git
::
Constants
::
GIT_DIFF_EDITOR_KIND
,
Core
::
Constants
::
C_G
LOBAL
,
Git
::
Constants
::
C_G
IT_DIFF_EDITOR
,
"text/x-patch"
,
"diff"
}
};
...
...
src/plugins/qtscripteditor/qtscripteditoractionhandler.cpp
View file @
8598a59b
...
...
@@ -70,13 +70,6 @@ void QtScriptEditorActionHandler::createActions()
}
void
QtScriptEditorActionHandler
::
updateActions
(
UpdateMode
um
)
{
TextEditor
::
TextEditorActionHandler
::
updateActions
(
um
);
if
(
m_runAction
)
m_runAction
->
setEnabled
(
um
!=
NoEditor
);
}
void
QtScriptEditorActionHandler
::
run
()
{
typedef
Core
::
ScriptManager
::
Stack
Stack
;
...
...
src/plugins/qtscripteditor/qtscripteditoractionhandler.h
View file @
8598a59b
...
...
@@ -48,7 +48,6 @@ public:
private:
virtual
void
createActions
();
virtual
void
updateActions
(
UpdateMode
um
);
private
slots
:
void
run
();
...
...
src/plugins/subversion/subversionplugin.cpp
View file @
8598a59b
...
...
@@ -103,23 +103,23 @@ const char * const SubversionPlugin::DESCRIBE = "Subversion.Describe";
static
const
VCSBase
::
VCSBaseEditorParameters
editorParameters
[]
=
{
{
VCSBase
::
RegularCommandOutput
,
"Subversion Command Log Editor"
,
Core
::
Constants
::
C_GLOBAL
,
"Subversion Command Log Editor"
,
// kind
"Subversion Command Log Editor"
,
// context
"application/vnd.nokia.text.scs_svn_commandlog"
,
"scslog"
},
{
VCSBase
::
LogOutput
,
"Subversion File Log Editor"
,
Core
::
Constants
::
C_GLOBAL
,
"Subversion File Log Editor"
,
// kind
"Subversion File Log Editor"
,
// context
"application/vnd.nokia.text.scs_svn_filelog"
,
"scsfilelog"
},
{
VCSBase
::
AnnotateOutput
,
"Subversion Annotation Editor"
,
Core
::
Constants
::
C_GLOBAL
,
"Subversion Annotation Editor"
,
// kind
"Subversion Annotation Editor"
,
// context
"application/vnd.nokia.text.scs_svn_annotation"
,
"scsannotate"
},
{
VCSBase
::
DiffOutput
,
"Subversion Diff Editor"
,
Core
::
Constants
::
C_GLOBAL
,
"Subversion Diff Editor"
,
// kind
"Subversion Diff Editor"
,
// context
"text/x-patch"
,
"diff"
}
};
...
...
src/plugins/texteditor/texteditoractionhandler.cpp
View file @
8598a59b
...
...
@@ -18,7 +18,7 @@
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** Foundation and appearing
`
in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
...
...
@@ -91,8 +91,8 @@ TextEditorActionHandler::TextEditorActionHandler(const QString &context,
m_contextId
<<
Core
::
UniqueIDManager
::
instance
()
->
uniqueIdentifier
(
context
);
connect
(
Core
::
ICore
::
instance
()
,
SIGNAL
(
contextAboutTo
Change
(
Core
::
I
Context
*
)),
this
,
SLOT
(
updateCurrentEditor
(
Core
::
I
Context
*
)));
connect
(
Core
::
ICore
::
instance
()
->
editorManager
(),
SIGNAL
(
currentEditor
Change
d
(
Core
::
I
Editor
*
)),
this
,
SLOT
(
updateCurrentEditor
(
Core
::
I
Editor
*
)));
}
void
TextEditorActionHandler
::
setupActions
(
BaseTextEditor
*
editor
)
...
...
@@ -282,49 +282,31 @@ QAction *TextEditorActionHandler::registerNewAction(const QString &id,
TextEditorActionHandler
::
UpdateMode
TextEditorActionHandler
::
updateMode
()
const
{
if
(
!
m_currentEditor
)
return
NoEditor
;
Q_ASSERT
(
m_currentEditor
!=
0
);
return
m_currentEditor
->
file
()
->
isReadOnly
()
?
ReadOnlyMode
:
WriteMode
;
}
void
TextEditorActionHandler
::
updateActions
()
{
if
(
!
m_currentEditor
||
!
m_initialized
)
return
;
updateActions
(
updateMode
());
}
void
TextEditorActionHandler
::
updateActions
(
UpdateMode
um
)
{
if
(
!
m_initialized
)
return
;
m_pasteAction
->
setEnabled
(
um
!=
NoEditor
);
m_selectAllAction
->
setEnabled
(
um
!=
NoEditor
);
m_gotoAction
->
setEnabled
(
um
!=
NoEditor
);
m_selectEncodingAction
->
setEnabled
(
um
!=
NoEditor
);
m_printAction
->
setEnabled
(
um
!=
NoEditor
);
m_formatAction
->
setEnabled
((
m_optionalActions
&
Format
)
&&
um
!=
NoEditor
);
m_unCommentSelectionAction
->
setEnabled
((
m_optionalActions
&
UnCommentSelection
)
&&
um
!=
NoEditor
);
m_collapseAction
->
setEnabled
(
um
!=
NoEditor
);
m_expandAction
->
setEnabled
(
um
!=
NoEditor
);
m_unCollapseAllAction
->
setEnabled
((
m_optionalActions
&
UnCollapseAll
)
&&
um
!=
NoEditor
);
m_decreaseFontSizeAction
->
setEnabled
(
um
!=
NoEditor
);
m_increaseFontSizeAction
->
setEnabled
(
um
!=
NoEditor
);
m_gotoBlockStartAction
->
setEnabled
(
um
!=
NoEditor
);
m_gotoBlockStartWithSelectionAction
->
setEnabled
(
um
!=
NoEditor
);
m_gotoBlockEndAction
->
setEnabled
(
um
!=
NoEditor
);
m_gotoBlockEndWithSelectionAction
->
setEnabled
(
um
!=
NoEditor
);
m_selectBlockUpAction
->
setEnabled
(
um
!=
NoEditor
);
m_selectBlockDownAction
->
setEnabled
(
um
!=
NoEditor
);
m_moveLineUpAction
->
setEnabled
(
um
!=
NoEditor
);
m_moveLineDownAction
->
setEnabled
(
um
!=
NoEditor
);
m_visualizeWhitespaceAction
->
setEnabled
(
um
!=
NoEditor
);
if
(
m_currentEditor
)
m_visualizeWhitespaceAction
->
setChecked
(
m_currentEditor
->
displaySettings
().
m_visualizeWhitespace
);
m_cleanWhitespaceAction
->
setEnabled
(
um
!=
NoEditor
);
m_pasteAction
->
setEnabled
(
um
!=
ReadOnlyMode
);
m_formatAction
->
setEnabled
((
m_optionalActions
&
Format
)
&&
um
!=
ReadOnlyMode
);
m_unCommentSelectionAction
->
setEnabled
((
m_optionalActions
&
UnCommentSelection
)
&&
um
!=
ReadOnlyMode
);
m_moveLineUpAction
->
setEnabled
(
um
!=
ReadOnlyMode
);
m_moveLineDownAction
->
setEnabled
(
um
!=
ReadOnlyMode
);
m_formatAction
->
setEnabled
((
m_optionalActions
&
Format
));
m_unCommentSelectionAction
->
setEnabled
((
m_optionalActions
&
UnCommentSelection
));
m_unCollapseAllAction
->
setEnabled
((
m_optionalActions
&
UnCollapseAll
));
m_visualizeWhitespaceAction
->
setChecked
(
m_currentEditor
->
displaySettings
().
m_visualizeWhitespace
);
if
(
m_textWrappingAction
)
{
m_textWrappingAction
->
setEnabled
(
um
!=
NoEditor
);
if
(
m_currentEditor
)
m_textWrappingAction
->
setChecked
(
m_currentEditor
->
displaySettings
().
m_textWrapping
);
m_textWrappingAction
->
setChecked
(
m_currentEditor
->
displaySettings
().
m_textWrapping
);
}
updateRedoAction
();
...
...
@@ -346,11 +328,12 @@ void TextEditorActionHandler::updateUndoAction()
void
TextEditorActionHandler
::
updateCopyAction
()
{
const
bool
hasCopyableText
=
m_currentEditor
&&
m_currentEditor
->
textCursor
().
hasSelection
();
const
bool
hasCopyableText
=
m_currentEditor
&&
m_currentEditor
->
textCursor
().
hasSelection
();
if
(
m_cutAction
)
m_cutAction
->
setEnabled
(
hasCopyableText
&&
updateMode
()
==
WriteMode
);
if
(
m_copyAction
)
if
(
m_copyAction
)
{
m_copyAction
->
setEnabled
(
hasCopyableText
);
}
}
void
TextEditorActionHandler
::
gotoAction
()
...
...
@@ -422,37 +405,19 @@ FUNCTION(selectBlockDown)
FUNCTION
(
moveLineUp
)
FUNCTION
(
moveLineDown
)
void
TextEditorActionHandler
::
updateCurrentEditor
(
Core
::
I
Context
*
object
)
void
TextEditorActionHandler
::
updateCurrentEditor
(
Core
::
I
Editor
*
editor
)
{
do
{
if
(
!
object
)
{
if
(
!
m_currentEditor
)
return
;
m_currentEditor
=
0
;
break
;
}
BaseTextEditor
*
editor
=
qobject_cast
<
BaseTextEditor
*>
(
object
->
widget
());
if
(
!
editor
)
{
if
(
!
m_currentEditor
)
return
;
m_currentEditor
=
0
;
break
;
}
if
(
editor
==
m_currentEditor
)
return
;
if
(
editor
->
actionHack
()
!=
this
)
{
m_currentEditor
=
0
;
break
;
}
m_currentEditor
=
editor
;
}
while
(
false
);
updateActions
();
m_currentEditor
=
0
;
if
(
!
editor
)
return
;
BaseTextEditor
*
baseEditor
=
qobject_cast
<
BaseTextEditor
*>
(
editor
->
widget
());
if
(
baseEditor
&&
baseEditor
->
actionHack
()
==
this
)
{
m_currentEditor
=
baseEditor
;
updateActions
();
}
}
...
...
src/plugins/texteditor/texteditoractionhandler.h
View file @
8598a59b
...
...
@@ -78,7 +78,7 @@ protected:
QAction
*
registerNewAction
(
const
QString
&
id
,
QObject
*
receiver
,
const
char
*
slot
,
const
QString
&
title
=
QString
());
enum
UpdateMode
{
NoEditor
,
ReadOnlyMode
,
WriteMode
};
enum
UpdateMode
{
ReadOnlyMode
,
WriteMode
};
UpdateMode
updateMode
()
const
;
virtual
void
createActions
();
...
...
@@ -114,7 +114,7 @@ private slots:
void
selectBlockDown
();
void
moveLineUp
();
void
moveLineDown
();
void
updateCurrentEditor
(
Core
::
I
Context
*
object
);
void
updateCurrentEditor
(
Core
::
I
Editor
*
editor
);
private:
QAction
*
m_undoAction
;
...
...
src/plugins/vcsbase/basevcseditorfactory.cpp
View file @
8598a59b
...
...
@@ -56,7 +56,7 @@ BaseVCSEditorFactoryPrivate::BaseVCSEditorFactoryPrivate(const VCSBaseEditorPara
m_type
(
t
),
m_kind
(
QLatin1String
(
t
->
kind
)),
m_mimeTypes
(
QStringList
(
QLatin1String
(
t
->
mimeType
))),
m_editorHandler
(
new
TextEditor
::
TextEditorActionHandler
(
t
->
kind
))
m_editorHandler
(
new
TextEditor
::
TextEditorActionHandler
(
t
->
context
))
{
}
...
...
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