[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasmate/terietor/kconfigxt] editors/kconfigxt: Check if there is already one TODO entry before you
From:       Giorgos Tsiapaliokas <terietor () gmail ! com>
Date:       2012-08-09 13:00:26
Message-ID: 20120809130026.E8DEBA60CD () git ! kde ! org
[Download RAW message or body]

Git commit 84ea9a84c355390ba70aad1072e3463ccdae4ace by Giorgos Tsiapaliokas.
Committed on 09/08/2012 at 14:20.
Pushed by tsiapaliwkas into branch 'terietor/kconfigxt'.

Check if there is already one TODO entry before you create a new one

M  +17   -1    editors/kconfigxt/kconfigxteditor.cpp

http://commits.kde.org/plasmate/84ea9a84c355390ba70aad1072e3463ccdae4ace

diff --git a/editors/kconfigxt/kconfigxteditor.cpp b/editors/kconfigxt/kconfigxteditor.cpp
index 4fc591a..b9272ce 100644
--- a/editors/kconfigxt/kconfigxteditor.cpp
+++ b/editors/kconfigxt/kconfigxteditor.cpp
@@ -154,8 +154,24 @@ void KConfigXtEditor::createNewEntry()
         return;
     }
 
+    QString groupName = currentGroupItem->text(0);
+    QStringList entryNameList;
+
+    foreach(const KConfigXtReaderItem it, m_keysValuesTypes) {
+        if (groupName == it.groupName()) {
+            entryNameList << it.entryName();
+        }
+    }
+
+    if (entryNameList.contains("TODO")) {
+        QString text = i18n("There is already a TODO entry,"
+            " fix it before you continue");
+        KMessageBox::information(this, text);
+        return;
+    }
+
     KConfigXtReaderItem newEntryItem;
-    newEntryItem.setGroupName(currentGroupItem->text(0));
+    newEntryItem.setGroupName(groupName);
     newEntryItem.setEntryName("TODO");
     //remember we need a valid type due to the
     //internal check

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic