aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorHao Sheng <hao.sheng@sun.com>2004-09-24 12:50:00 +0800
committerHarry Lu <haip@src.gnome.org>2004-09-24 12:50:00 +0800
commit809fa4df4490bcad9663458df09d4928f865ef55 (patch)
tree3064e4d2aaa7351bad937d584459469ab58482f4 /addressbook
parentd362be429cf05a0e7aaa0582d55dbd97c4616256 (diff)
downloadgsoc2013-evolution-809fa4df4490bcad9663458df09d4928f865ef55.tar
gsoc2013-evolution-809fa4df4490bcad9663458df09d4928f865ef55.tar.gz
gsoc2013-evolution-809fa4df4490bcad9663458df09d4928f865ef55.tar.bz2
gsoc2013-evolution-809fa4df4490bcad9663458df09d4928f865ef55.tar.lz
gsoc2013-evolution-809fa4df4490bcad9663458df09d4928f865ef55.tar.xz
gsoc2013-evolution-809fa4df4490bcad9663458df09d4928f865ef55.tar.zst
gsoc2013-evolution-809fa4df4490bcad9663458df09d4928f865ef55.zip
Fix for #66523
2004-09-24 Hao Sheng <hao.sheng@sun.com> Fix for #66523 * gui/contact-list-editor/e-contact-list-model.c: (e_contact_list_model_add_email): estimate the same mail address and popup a warning dialog. * addressbook-errors.xml: add the question message for the warning dialog. svn path=/trunk/; revision=27360
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog10
-rw-r--r--addressbook/addressbook-errors.xml6
-rw-r--r--addressbook/addressbook-errors.xml.h5
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.c18
4 files changed, 39 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 6e228020f5..eb3e556e49 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,13 @@
+2004-09-24 Hao Sheng <hao.sheng@sun.com>
+
+ Fix for #66523
+
+ * gui/contact-list-editor/e-contact-list-model.c:
+ (e_contact_list_model_add_email): estimate the same mail address
+ and popup a warning dialog.
+ * addressbook-errors.xml: add the question message for the warning
+ dialog.
+
2004-09-23 Pamplona Hackers <gnome-desarrollo@es.gnome.org>
Fixes #61978
diff --git a/addressbook/addressbook-errors.xml b/addressbook/addressbook-errors.xml
index b936f56e97..e75e59ccab 100644
--- a/addressbook/addressbook-errors.xml
+++ b/addressbook/addressbook-errors.xml
@@ -77,4 +77,10 @@
<secondary>Your contacts for {0} will not be available until Evolution is restarted.</secondary>
</error>
+ <error id="ask-list-add-exists" type="question" default="GTK_RESPONSE_NO">
+ <primary>Address '{0}' already exists.</primary>
+ <secondary>A contact already exists with this address. Would you like to add a new card with the same address anyway?</secondary>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+ <button stock="gtk-ok" label="_Add" response="GTK_RESPONSE_YES"/>
+ </error>
</error-list>
diff --git a/addressbook/addressbook-errors.xml.h b/addressbook/addressbook-errors.xml.h
index 2ad50c14e2..15b0cd5423 100644
--- a/addressbook/addressbook-errors.xml.h
+++ b/addressbook/addressbook-errors.xml.h
@@ -51,3 +51,8 @@ char *s = N_("Error saving contacts to {0}: {1}");
char *s = N_("The Evolution addressbook has quit unexpectedly.");
/* addressbook:backend-died secondary */
char *s = N_("Your contacts for {0} will not be available until Evolution is restarted.");
+/* addressbook:ask-list-add-exists primary */
+char *s = N_("Address '{0}' already exists.");
+/* addressbook:ask-list-add-exists secondary */
+char *s = N_("A contact already exists with this address. Would you like to add a new card with the same address anyway?");
+char *s = N_("_Add");
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c
index ee9b3a3601..4560413c19 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c
@@ -3,7 +3,9 @@
#include <config.h>
#include <string.h>
#include "e-contact-list-model.h"
+#include "widgets/misc/e-error.h"
+#include <gtk/gtkmessagedialog.h>
#define PARENT_TYPE e_table_model_get_type()
static ETableModelClass *parent_class;
@@ -195,10 +197,26 @@ e_contact_list_model_add_email (EContactListModel *model,
const char *email)
{
EDestination *new_dest;
+ char *list_email;
+ int row;
+ int row_count;
g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
g_return_if_fail (email != NULL);
+ row_count = e_table_model_row_count (E_TABLE_MODEL (model));
+
+ for (row = 0; row < row_count; row++) {
+ list_email = (char *) e_table_model_value_at (E_TABLE_MODEL (model), 1, row);
+
+ if (strcmp (list_email, email) == 0) {
+ if (e_error_run (NULL, "addressbook:ask-list-add-exists",
+ email) != GTK_RESPONSE_YES)
+ return;
+ break;
+ }
+ }
+
new_dest = e_destination_new ();
e_destination_set_email (new_dest, email);