diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 0d6e85548..c261667a8 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-06-17 Don Allingham + * src/EditPlace.py: check to make sure a duplicate title is not + entered + 2005-06-17 Alex Roitman * src/WriteGedcom.py (write_sources): Pass handle to the id creator; (write_person): write person sources; (sid): return diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index 392fe6a50..5a77ba757 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -243,11 +243,25 @@ class EditPlace: self.add_itself_to_menu() self.top_window.get_widget('ok').set_sensitive(not self.db.readonly) self.top.show() + + self.pdmap = {} + self.build_pdmap() + if self.ref_not_loaded: Utils.temp_label(self.refs_label,self.top) gobject.idle_add(self.display_references) self.ref_not_loaded = 0 + def build_pdmap(self): + self.pdmap.clear() + cursor = self.db.get_place_cursor() + data = cursor.next() + while data: + if data[1][2]: + self.pdmap[data[1][2]] = data[0] + data = cursor.next() + cursor.close() + def on_delete_event(self,obj,b): self.glry.close() self.close_child_windows() @@ -371,6 +385,15 @@ class EditPlace: format = self.preform.get_active() mloc = self.place.get_main_location() + title = self.title.get_text() + if self.pdmap.has_key(title) and self.pdmap[title] != self.place.handle: + import QuestionDialog + QuestionDialog.ErrorDialog(_("Place title is already in use"), + _("Each place must have a unique title, and " + "title you have selected is already used by " + "another place")) + return + self.set(self.city,mloc.get_city,mloc.set_city) self.set(self.parish,mloc.get_parish,mloc.set_parish) self.set(self.state,mloc.get_state,mloc.set_state)