From e3dbbed2dd95da39cf0651ae4ddb1bff73db73dc Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 24 Nov 2009 15:06:04 +0100 Subject: [PATCH] auto-increment order value in privacy list entries. Fixes #5441 --- src/dialogs.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dialogs.py b/src/dialogs.py index 4d197a896..4f2802e75 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -3080,6 +3080,8 @@ class PrivacyListWindow: self.global_rules = {} self.list_of_groups = {} + self.max_order = 0 + # Default Edit Values self.edit_rule_type = 'jid' self.allow_deny = 'allow' @@ -3175,6 +3177,8 @@ class PrivacyListWindow: else: text_item = _('Order: %(order)s, action: %(action)s') % \ {'order': rule['order'], 'action': rule['action']} + if int(rule['order']) > self.max_order: + self.max_order = int(rule['order']) self.global_rules[text_item] = rule self.list_of_rules_combobox.append_text(text_item) if len(rules) == 0: @@ -3322,7 +3326,7 @@ class PrivacyListWindow: self.edit_view_status_checkbutton.set_active(False) self.edit_send_status_checkbutton.set_active(False) self.edit_all_checkbutton.set_active(False) - self.edit_order_spinbutton.set_value(1) + self.edit_order_spinbutton.set_value(self.max_order + 1) self.edit_type_group_combobox.set_active(0) self.edit_type_subscription_combobox.set_active(0) self.add_edit_rule_label.set_label( @@ -3365,6 +3369,8 @@ class PrivacyListWindow: def on_save_rule_button_clicked(self, widget): tags=[] current_tags = self.get_current_tags() + if int(current_tags['order']) > self.max_order: + self.max_order = int(current_tags['order']) if self.active_rule == '': tags.append(current_tags)