|
52 | 52 | from MetaSearch.dialogs.xmldialog import XMLDialog
|
53 | 53 | from MetaSearch.util import (get_connections_from_file, get_ui_class,
|
54 | 54 | get_help_url, highlight_xml, normalize_text,
|
55 |
| - open_url, render_template, StaticContext) |
| 55 | + open_url, render_template, serialize_string, |
| 56 | + StaticContext) |
56 | 57 |
|
57 | 58 | BASE_CLASS = get_ui_class('maindialog.ui')
|
58 | 59 |
|
@@ -648,6 +649,8 @@ def navigate(self):
|
648 | 649 | def add_to_ows(self):
|
649 | 650 | """add to OWS provider connection list"""
|
650 | 651 |
|
| 652 | + conn_name_matches = [] |
| 653 | + |
651 | 654 | item = self.treeRecords.currentItem()
|
652 | 655 |
|
653 | 656 | if not item:
|
@@ -678,13 +681,19 @@ def add_to_ows(self):
|
678 | 681 | keys = self.settings.childGroups()
|
679 | 682 | self.settings.endGroup()
|
680 | 683 |
|
| 684 | + for key in keys: |
| 685 | + if key.startswith(sname): |
| 686 | + conn_name_matches.append(key) |
| 687 | + if conn_name_matches: |
| 688 | + sname = matches[-1] |
| 689 | + |
681 | 690 | # check for duplicates
|
682 | 691 | if sname in keys:
|
683 | 692 | msg = self.tr('Connection %s exists. Overwrite?') % sname
|
684 | 693 | res = QMessageBox.warning(self, self.tr('Saving server'), msg,
|
685 | 694 | QMessageBox.Yes | QMessageBox.No)
|
686 |
| - if res != QMessageBox.Yes: |
687 |
| - return |
| 695 | + if res != QMessageBox.Yes: # assign new name with serial |
| 696 | + sname = serialize_string(sname) |
688 | 697 |
|
689 | 698 | # no dups detected or overwrite is allowed
|
690 | 699 | self.settings.beginGroup('/Qgis/connections-%s' % stype[1])
|
|
0 commit comments