[ktexteditor] src: Implemented displaying of total lines in kate

Christoph Cullmann null at kde.org
Wed Jun 20 18:42:43 UTC 2018


Git commit 3f0638e717a990c81fbc248298cc62709e8af851 by Christoph Cullmann, on behalf of Shubham Jangra.
Committed on 20/06/2018 at 18:40.
Pushed by cullmann into branch 'master'.

Implemented displaying of total lines in kate

GUI: new option to display total lines in the status bar

BUG: 387362

M  +3    -0    src/dialogs/katedialogs.cpp
M  +10   -0    src/dialogs/textareaappearanceconfigwidget.ui
M  +25   -0    src/utils/kateconfig.cpp
M  +5    -0    src/utils/kateconfig.h

https://commits.kde.org/ktexteditor/3f0638e717a990c81fbc248298cc62709e8af851

diff --git a/src/dialogs/katedialogs.cpp b/src/dialogs/katedialogs.cpp
index b0fd86ff..4732c97e 100644
--- a/src/dialogs/katedialogs.cpp
+++ b/src/dialogs/katedialogs.cpp
@@ -679,6 +679,7 @@ KateViewDefaultsConfig::KateViewDefaultsConfig(QWidget *parent)
     connect(textareaUi->chkAnimateBracketMatching, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
     connect(textareaUi->chkFoldFirstLine,  SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
     connect(textareaUi->chkShowWordCount,  SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
+    connect(textareaUi->chkShowLinesCount, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
 
     connect(bordersUi->chkIconBorder, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
     connect(bordersUi->chkScrollbarMarks, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
@@ -737,6 +738,7 @@ void KateViewDefaultsConfig::apply()
     KateRendererConfig::global()->setAnimateBracketMatching(textareaUi->chkAnimateBracketMatching->isChecked());
     KateViewConfig::global()->setFoldFirstLine(textareaUi->chkFoldFirstLine->isChecked());
     KateViewConfig::global()->setShowWordCount(textareaUi->chkShowWordCount->isChecked());
+    KateViewConfig::global()->setShowLinesCount(textareaUi->chkShowLinesCount->isChecked());
 
     KateRendererConfig::global()->configEnd();
     KateViewConfig::global()->configEnd();
@@ -768,6 +770,7 @@ void KateViewDefaultsConfig::reload()
     textareaUi->chkAnimateBracketMatching->setChecked(KateRendererConfig::global()->animateBracketMatching());
     textareaUi->chkFoldFirstLine->setChecked(KateViewConfig::global()->foldFirstLine());
     textareaUi->chkShowWordCount->setChecked(KateViewConfig::global()->showWordCount());
+    textareaUi->chkShowLinesCount->setChecked(KateViewConfig::global()->showLinesCount());
 }
 
 void KateViewDefaultsConfig::reset()
diff --git a/src/dialogs/textareaappearanceconfigwidget.ui b/src/dialogs/textareaappearanceconfigwidget.ui
index 2779ecb7..9cf0a29b 100644
--- a/src/dialogs/textareaappearanceconfigwidget.ui
+++ b/src/dialogs/textareaappearanceconfigwidget.ui
@@ -193,6 +193,16 @@ beginning of a file.</string>
                 </property>
               </widget>
             </item>
+            <item>
+              <widget class="QCheckBox" name="chkShowLinesCount">
+                <property name="toolTip">
+                  <string>Show/hide Lines count in status bar</string>
+                </property>
+                <property name="text">
+                  <string>Show Lines Count</string>
+                </property>
+              </widget>
+            </item>
           </layout>
         </widget>
       </item>
diff --git a/src/utils/kateconfig.cpp b/src/utils/kateconfig.cpp
index d23ed307..1cf3f504 100644
--- a/src/utils/kateconfig.cpp
+++ b/src/utils/kateconfig.cpp
@@ -1260,6 +1260,7 @@ KateViewConfig::KateViewConfig()
     m_wordCompletionRemoveTailSet(false),
     m_foldFirstLineSet (false),
     m_showWordCountSet(false),
+    m_showLinesCountSet(false),
     m_autoBracketsSet(false),
     m_backspaceRemoveComposedSet(false)
 
@@ -1351,6 +1352,7 @@ const char KEY_WORD_COMPLETION_REMOVE_TAIL[] = "Word Completion Remove Tail";
 const char KEY_SMART_COPY_CUT[] = "Smart Copy Cut";
 const char KEY_SCROLL_PAST_END[] = "Scroll Past End";
 const char KEY_FOLD_FIRST_LINE[] = "Fold First Line";
+const char KEY_SHOW_LINES_COUNT[] = "Show Lines Count";
 const char KEY_SHOW_WORD_COUNT[] = "Show Word Count";
 const char KEY_AUTO_BRACKETS[] = "Auto Brackets";
 const char KEY_BACKSPACE_REMOVE_COMPOSED[] = "Backspace Remove Composed Characters";
@@ -1413,6 +1415,7 @@ void KateViewConfig::readConfig(const KConfigGroup &config)
     setSmartCopyCut(config.readEntry(KEY_SMART_COPY_CUT, false));
     setScrollPastEnd(config.readEntry(KEY_SCROLL_PAST_END, false));
     setFoldFirstLine(config.readEntry(KEY_FOLD_FIRST_LINE, false));
+    setShowLinesCount(config.readEntry(KEY_SHOW_LINES_COUNT, false));
     setShowWordCount(config.readEntry(KEY_SHOW_WORD_COUNT, false));
     setAutoBrackets(config.readEntry(KEY_AUTO_BRACKETS, false));
 
@@ -1477,6 +1480,7 @@ void KateViewConfig::writeConfig(KConfigGroup &config)
     config.writeEntry(KEY_VI_INPUT_MODE_STEAL_KEYS, viInputModeStealKeys());
     config.writeEntry(KEY_VI_RELATIVE_LINE_NUMBERS, viRelativeLineNumbers());
 
+    config.writeEntry(KEY_SHOW_LINES_COUNT, showLinesCount());
     config.writeEntry(KEY_SHOW_WORD_COUNT, showWordCount());
     config.writeEntry(KEY_AUTO_BRACKETS, autoBrackets());
 
@@ -2244,6 +2248,27 @@ void KateViewConfig::setShowWordCount(bool on)
     configEnd();
 }
 
+bool KateViewConfig::showLinesCount()
+{
+    if (m_showLinesCountSet || isGlobal()) {
+        return m_showLinesCount;
+    }
+
+    return s_global->showLinesCount();
+}
+
+void KateViewConfig::setShowLinesCount(bool on)
+{
+    if (m_showLinesCountSet && m_showLinesCount == on) {
+        return;
+    }
+
+    configStart();
+    m_showLinesCountSet = true;
+    m_showLinesCount = on;
+    configEnd();
+}
+
 bool KateViewConfig::backspaceRemoveComposed() const
 {
     if (m_backspaceRemoveComposedSet || isGlobal()) {
diff --git a/src/utils/kateconfig.h b/src/utils/kateconfig.h
index 1f65cc46..75eee56a 100644
--- a/src/utils/kateconfig.h
+++ b/src/utils/kateconfig.h
@@ -572,6 +572,9 @@ public:
     bool showWordCount();
     void setShowWordCount(bool on);
 
+    bool showLinesCount();
+    void setShowLinesCount(bool on);
+
     bool autoBrackets() const;
     void setAutoBrackets(bool on);
 
@@ -611,6 +614,7 @@ private:
     bool m_scrollPastEnd;
     bool m_foldFirstLine;
     bool m_showWordCount = false;
+    bool m_showLinesCount = false;
     bool m_autoBrackets;
     bool m_backspaceRemoveComposed;
 
@@ -646,6 +650,7 @@ private:
     bool m_wordCompletionRemoveTailSet : 1;
     bool m_foldFirstLineSet : 1;
     bool m_showWordCountSet : 1;
+    bool m_showLinesCountSet : 1;
     bool m_autoBracketsSet : 1;
     bool m_backspaceRemoveComposedSet : 1;
 



More information about the kde-doc-english mailing list