diff browser_side/dialog.py @ 221:f3898fbb00c3

browser_side: check for duplicate name before adding a new contact group
author souliane <souliane@mailoo.org>
date Sat, 21 Sep 2013 20:24:36 +0200
parents 9827cda1a6b0
children f3a5a094c8d6
line wrap: on
line diff
--- a/browser_side/dialog.py	Sat Sep 21 15:37:29 2013 +0200
+++ b/browser_side/dialog.py	Sat Sep 21 20:24:36 2013 +0200
@@ -265,6 +265,10 @@
 
     def onGroupInput(self, sender):
         text = sender.getText()
+        for index in xrange(0, self.list_box.getItemCount()):
+            if text == self.list_box.getValue(index):
+                Window.alert("The group '%s' already exists." % text)
+                return
         for pattern in FORBIDDEN_PATTERNS_IN_GROUP:
             if pattern in text:
                 Window.alert("The pattern '%s' is not allowed in group names." % pattern)