Fwd: [kate] /: be coarse grained, just tell the outside about EditViMode, not the internal vi mode we are in
Christoph Cullmann
cullmann at absint.com
Thu Apr 4 19:23:36 UTC 2013
Hi,
viewEditMode extended. (add since 4.11 in second commit)
As I guess you don't want to depend on KDE 4.11, just cast the enum value you receive to an int.
If == 2 you shall show some widget for the viewMode() string, if you like to show the vi mode that is active.
See Kate/KWrite for reference if anything is still unclear.
Greetings
Christoph
----- Weitergeleitete Mail -----
Von: "Christoph Cullmann" <cullmann at kde.org>
An: kde-commits at kde.org
Gesendet: Donnerstag, 4. April 2013 21:19:18
Betreff: [kate] /: be coarse grained, just tell the outside about EditViMode, not the internal vi mode we are in
Git commit 17a17bab491183c77e0894559de16e537bec291c by Christoph Cullmann.
Committed on 04/04/2013 at 21:18.
Pushed by cullmann into branch 'master'.
be coarse grained, just tell the outside about EditViMode, not the internal vi mode we are in
M +3 -2 ktexteditor/view.h
M +11 -0 part/view/kateview.cpp
M +1 -1 part/view/kateview.h
http://commits.kde.org/kate/17a17bab491183c77e0894559de16e537bec291c
diff --git a/ktexteditor/view.h b/ktexteditor/view.h
index a395e4e..60bac02 100644
--- a/ktexteditor/view.h
+++ b/ktexteditor/view.h
@@ -203,8 +203,9 @@ class KTEXTEDITOR_EXPORT View : public QWidget, public KXMLGUIClient
* These correspond to various modes the text editor might be in.
*/
enum EditMode {
- EditInsert = 0, /**< Insert mode. Characters will be added. */
- EditOverwrite = 1 /**< Overwrite mode. Characters will be replaced. */
+ EditInsert = 0, /**< Insert mode. Characters will be added. */
+ EditOverwrite = 1, /**< Overwrite mode. Characters will be replaced. */
+ EditViMode = 2 /**< Vi mode. The view will behave like the editor vi(m) */
};
/**
diff --git a/part/view/kateview.cpp b/part/view/kateview.cpp
index 02d7d78..4d2308b 100644
--- a/part/view/kateview.cpp
+++ b/part/view/kateview.cpp
@@ -1097,6 +1097,14 @@ void KateView::unfoldLine (int startLine)
textFolding().unfoldRange (startingRanges[i].first);
}
+KTextEditor::View::EditMode KateView::viewEditMode() const
+{
+ if (viInputMode())
+ return EditViMode;
+
+ return isOverwriteMode() ? EditOverwrite : EditInsert;
+}
+
QString KateView::viewMode () const
{
/**
@@ -1203,6 +1211,7 @@ void KateView::slotReadWriteChanged ()
// => view mode changed
emit viewModeChanged(this);
+ emit viewEditModeChanged(this,viewEditMode());
}
void KateView::slotClipboardHistoryChanged ()
@@ -1494,12 +1503,14 @@ void KateView::updateViModeBarMode()
{
// view mode changed => status bar in container apps might change!
emit viewModeChanged (this);
+ emit viewEditModeChanged(this,viewEditMode());
}
void KateView::updateViModeBarCmd()
{
// view mode changed => status bar in container apps might change!
emit viewModeChanged (this);
+ emit viewEditModeChanged(this,viewEditMode());
}
ViMode KateView::getCurrentViMode() const
diff --git a/part/view/kateview.h b/part/view/kateview.h
index a65843a..59c93b2 100644
--- a/part/view/kateview.h
+++ b/part/view/kateview.h
@@ -394,7 +394,7 @@ class KATEPART_TESTS_EXPORT KateView : public KTextEditor::View,
Return values for "save" related commands.
*/
bool isOverwriteMode() const;
- enum KTextEditor::View::EditMode viewEditMode() const {return isOverwriteMode() ? KTextEditor::View::EditOverwrite : KTextEditor::View::EditInsert;}
+ EditMode viewEditMode() const;
QString currentTextLine();
/**
--
----------------------------- Dr.-Ing. Christoph Cullmann ---------
AbsInt Angewandte Informatik GmbH Email: cullmann at AbsInt.com
Science Park 1 Tel: +49-681-38360-22
66123 Saarbrücken Fax: +49-681-38360-20
GERMANY WWW: http://www.AbsInt.com
--------------------------------------------------------------------
Geschäftsführung: Dr.-Ing. Christian Ferdinand
Eingetragen im Handelsregister des Amtsgerichts Saarbrücken, HRB 11234
More information about the KDevelop-devel
mailing list