diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-07-28 10:31:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-07-28 23:24:49 +0800 |
commit | 2c4510e858fcf96e8f3d02f3f92564460752e983 (patch) | |
tree | 777c673d5fdaf649fb1c9eabd9357eac622b15f6 /plugins | |
parent | 3fe8269156da1b57b0fc7391f5cf07cab6f61606 (diff) | |
parent | 067ef5580fc287809958d4503691bfcba2b29ee5 (diff) | |
download | gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar.gz gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar.bz2 gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar.lz gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar.xz gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.tar.zst gsoc2013-evolution-2c4510e858fcf96e8f3d02f3f92564460752e983.zip |
Merge commit 'EVOLUTION_2_27_5' into kill-bonobo
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/calendar-file/calendar-file.c | 268 | ||||
-rw-r--r-- | plugins/calendar-file/org-gnome-calendar-file.eplug.xml | 4 | ||||
-rw-r--r-- | plugins/google-account-setup/Makefile.am | 8 | ||||
-rw-r--r-- | plugins/google-account-setup/google-source.c | 223 | ||||
-rw-r--r-- | plugins/google-account-setup/org-gnome-evolution-google.eplug.xml | 4 | ||||
-rw-r--r-- | plugins/groupwise-features/Makefile.am | 2 | ||||
-rw-r--r-- | plugins/groupwise-features/mail-send-options.c | 20 | ||||
-rw-r--r-- | plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml | 11 | ||||
-rw-r--r-- | plugins/groupwise-features/proxy-login.c | 4 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 328 |
10 files changed, 612 insertions, 260 deletions
diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c index 9d21d62688..66a491edcd 100644 --- a/plugins/calendar-file/calendar-file.c +++ b/plugins/calendar-file/calendar-file.c @@ -27,15 +27,160 @@ #include <glib/gi18n.h> #include <string.h> -GtkWidget *e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data); +static void +location_changed (GtkFileChooserButton *widget, ESource *source) +{ + gchar *filename; + + g_return_if_fail (widget != NULL); + g_return_if_fail (source != NULL); + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); + e_source_set_property (source, "custom-file", (filename && *filename) ? filename : NULL); + g_free (filename); +} + +static void +set_refresh_time (ESource *source, GtkWidget *spin, GtkWidget *combobox) +{ + gint time; + gint item_num = 0; + const gchar *refresh_str = e_source_get_property (source, "refresh"); + time = refresh_str ? atoi (refresh_str) : 30; + + if (time && !(time % 10080)) { + /* weeks */ + item_num = 3; + time /= 10080; + } else if (time && !(time % 1440)) { + /* days */ + item_num = 2; + time /= 1440; + } else if (time && !(time % 60)) { + /* hours */ + item_num = 1; + time /= 60; + } + gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), item_num); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time); +} + +static gchar * +get_refresh_minutes (GtkWidget *spin, GtkWidget *combobox) +{ + gint setting = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)); + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combobox))) { + case 0: + /* minutes */ + break; + case 1: + /* hours */ + setting *= 60; + break; + case 2: + /* days */ + setting *= 1440; + break; + case 3: + /* weeks - is this *really* necessary? */ + setting *= 10080; + break; + default: + g_warning ("Time unit out of range"); + break; + } + + return g_strdup_printf ("%d", setting); +} + +static void +spin_changed (GtkSpinButton *spin, ESource *source) +{ + gchar *refresh_str; + GtkWidget *combobox; + + combobox = g_object_get_data (G_OBJECT (spin), "combobox"); + + refresh_str = get_refresh_minutes ((GtkWidget *) spin, combobox); + e_source_set_property (source, "refresh", refresh_str); + g_free (refresh_str); +} + +static void +combobox_changed (GtkComboBox *combobox, ESource *source) +{ + gchar *refresh_str; + GtkWidget *spin; + + spin = g_object_get_data (G_OBJECT (combobox), "spin"); + + refresh_str = get_refresh_minutes (spin, (GtkWidget *) combobox); + e_source_set_property (source, "refresh", refresh_str); + g_free (refresh_str); +} + +static void +maincheck_toggled (GtkToggleButton *check, ESource *source) +{ + GtkWidget *w; + gboolean enabled = gtk_toggle_button_get_active (check); + + w = g_object_get_data (G_OBJECT (check), "child"); + gtk_widget_set_sensitive (w, enabled); + + if (enabled) { + gchar *file; + + w = g_object_get_data (G_OBJECT (check), "file-chooser"); + file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w)); + e_source_set_property (source, "custom-file", (file && *file) ? file : NULL); + g_free (file); + } else { + e_source_set_property (source, "custom-file", NULL); + } +} + +static void +refresh_type_changed (GtkComboBox *refresh_type, ESource *source) +{ + GtkWidget *spin, *combobox; + gint active = gtk_combo_box_get_active (refresh_type); + gchar buff[2] = {0}; + + spin = g_object_get_data (G_OBJECT (refresh_type), "spin"); + combobox = g_object_get_data (G_OBJECT (refresh_type), "combobox"); + + if (active < 0 || active > 2) + active = 0; + + if (active == 2) { + gtk_widget_show (spin); + gtk_widget_show (combobox); + } else { + gtk_widget_hide (spin); + gtk_widget_hide (combobox); + } + + buff [0] = '0' + active; + e_source_set_property (source, "refresh-type", buff); +} + +static void +force_readonly_toggled (GtkToggleButton *check, ESource *source) +{ + e_source_set_property (source, "custom-file-readonly", gtk_toggle_button_get_active (check) ? "1" : NULL); +} + +GtkWidget *e_calendar_file_customs (EPlugin *epl, EConfigHookItemFactoryData *data); GtkWidget * -e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) +e_calendar_file_customs (EPlugin *epl, EConfigHookItemFactoryData *data) { ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; ESource *source = t->source; gchar *uri_text; - const gchar *relative_uri; + const gchar *relative_uri, *value; + GtkWidget *w1, *w2, *w3, *box1, *box2, *mainbox, *maincheck; uri_text = e_source_get_uri (source); if (strncmp (uri_text, "file", 4)) { @@ -45,13 +190,124 @@ e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) } relative_uri = e_source_peek_relative_uri (source); - g_free (uri_text); - if (relative_uri && *relative_uri) { + if (relative_uri && g_str_equal (relative_uri, "system")) { + g_free (uri_text); return NULL; } e_source_set_relative_uri (source, e_source_peek_uid (source)); - return NULL; + mainbox = gtk_vbox_new (FALSE, 2); + gtk_table_attach (GTK_TABLE (data->parent), mainbox, 1, 2, GTK_TABLE (data->parent)->nrows, GTK_TABLE (data->parent)->nrows + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); + + maincheck = gtk_check_button_new_with_mnemonic (_("_Customize options")); + g_signal_connect (G_OBJECT (maincheck), "toggled", G_CALLBACK (maincheck_toggled), source); + gtk_box_pack_start ((GtkBox *)mainbox, maincheck, TRUE, TRUE, 2); + + box1 = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)mainbox, box1, TRUE, TRUE, 2); + + g_object_set_data ((GObject*)maincheck, "child", box1); + + /* left-most space, the first one */ + w1 = gtk_label_new (""); + gtk_box_pack_start ((GtkBox *)box1, w1, FALSE, TRUE, 8); + + box2 = gtk_vbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)box1, box2, TRUE, TRUE, 2); + + box1 = box2; + box2 = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)box1, box2, TRUE, TRUE, 2); + + w1 = gtk_label_new_with_mnemonic (_("File _name:")); + gtk_misc_set_alignment (GTK_MISC (w1), 0.0, 0.5); + gtk_box_pack_start ((GtkBox *)box2, w1, FALSE, TRUE, 2); + + w2 = gtk_file_chooser_button_new (_("Choose calendar file"), GTK_FILE_CHOOSER_ACTION_OPEN); + gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (w2), TRUE); + gtk_label_set_mnemonic_widget (GTK_LABEL (w1), w2); + g_signal_connect (G_OBJECT (w2), "file-set", G_CALLBACK (location_changed), source); + gtk_box_pack_start ((GtkBox *)box2, w2, TRUE, TRUE, 2); + + g_object_set_data (G_OBJECT (maincheck), "file-chooser", w2); + + value = e_source_get_property (source, "custom-file"); + if (value && *value) { + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (w2), value); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (maincheck), TRUE); + } else { + gchar *uri = NULL; + + switch (t->source_type) { + case E_CAL_SOURCE_TYPE_EVENT: + uri = g_strconcat (uri_text, "/", "calendar.ics", NULL); + break; + case E_CAL_SOURCE_TYPE_TODO: + uri = g_strconcat (uri_text, "/", "tasks.ics", NULL); + break; + case E_CAL_SOURCE_TYPE_JOURNAL: + uri = g_strconcat (uri_text, "/", "journal.ics", NULL); + break; + case E_CAL_SOURCE_TYPE_LAST: + break; + } + + if (uri && *uri) + gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (w2), uri); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (maincheck), FALSE); + g_free (uri); + } + maincheck_toggled (GTK_TOGGLE_BUTTON (maincheck), source); + + box2 = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start ((GtkBox *)box1, box2, FALSE, TRUE, 2); + + w1 = gtk_label_new_with_mnemonic (_("Re_fresh:")); + gtk_misc_set_alignment (GTK_MISC (w1), 0.0, 0.5); + gtk_box_pack_start ((GtkBox *)box2, w1, FALSE, TRUE, 2); + + w2 = gtk_combo_box_new_text (); + gtk_combo_box_append_text ((GtkComboBox *)w2, _("On open")); + gtk_combo_box_append_text ((GtkComboBox *)w2, _("On file change")); + gtk_combo_box_append_text ((GtkComboBox *)w2, _("Periodically")); + gtk_label_set_mnemonic_widget (GTK_LABEL (w1), w2); + gtk_box_pack_start ((GtkBox *)box2, w2, FALSE, TRUE, 2); + + value = e_source_get_property (source, "refresh-type"); + gtk_combo_box_set_active ((GtkComboBox *)w2, (value && *value && !value[1] && value [0] >= '0' && value [0] <= '2') ? value [0] - '0' : 0); + + w1 = w2; + w2 = gtk_spin_button_new_with_range (1, 100, 1); + gtk_box_pack_start (GTK_BOX (box2), w2, FALSE, TRUE, 0); + + w3 = gtk_combo_box_new_text (); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("minutes")); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("hours")); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("days")); + gtk_combo_box_append_text (GTK_COMBO_BOX (w3), _("weeks")); + set_refresh_time (source, w2, w3); + gtk_box_pack_start (GTK_BOX (box2), w3, FALSE, TRUE, 0); + + g_object_set_data (G_OBJECT (w1), "spin", w2); + g_object_set_data (G_OBJECT (w1), "combobox", w3); + g_object_set_data (G_OBJECT (w2), "combobox", w3); + + g_signal_connect (G_OBJECT (w1), "changed", G_CALLBACK (refresh_type_changed), source); + g_signal_connect (G_OBJECT (w2), "value-changed", G_CALLBACK (spin_changed), source); + g_signal_connect (G_OBJECT (w3), "changed", G_CALLBACK (combobox_changed), source); + + w2 = gtk_check_button_new_with_mnemonic (_("Force read _only")); + g_signal_connect (G_OBJECT (w2), "toggled", G_CALLBACK (force_readonly_toggled), source); + gtk_box_pack_start ((GtkBox *)box1, w2, TRUE, TRUE, 2); + + gtk_widget_show_all (mainbox); + + /* w1 is a refresh-type combobox, and it hides widgets, + thus should be called after show_all call */ + refresh_type_changed (GTK_COMBO_BOX (w1), source); + g_free (uri_text); + + return mainbox; } diff --git a/plugins/calendar-file/org-gnome-calendar-file.eplug.xml b/plugins/calendar-file/org-gnome-calendar-file.eplug.xml index 9b146101f2..a9c6379636 100644 --- a/plugins/calendar-file/org-gnome-calendar-file.eplug.xml +++ b/plugins/calendar-file/org-gnome-calendar-file.eplug.xml @@ -14,8 +14,8 @@ id="org.gnome.evolution.calendar.calendarProperties"> <item type="item_table" - path="00.general/00.source/00.file_dummy" - factory="e_calendar_file_dummy"/> + path="00.general/00.source/99.file_customs" + factory="e_calendar_file_customs"/> </group> </hook> </e-plugin> diff --git a/plugins/google-account-setup/Makefile.am b/plugins/google-account-setup/Makefile.am index ed452c0bc7..d6d6c36cdc 100644 --- a/plugins/google-account-setup/Makefile.am +++ b/plugins/google-account-setup/Makefile.am @@ -1,6 +1,7 @@ AM_CPPFLAGS = \ -I . \ - -I$(top_srcdir) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ -DCALDAV_GLADEDIR=\""$(gladedir)"\" \ $(EVOLUTION_CALENDAR_CFLAGS) \ $(EVOLUTION_ADDRESSBOOK_CFLAGS) @@ -15,8 +16,9 @@ liborg_gnome_evolution_google_la_SOURCES = \ google-contacts-source.h \ google-contacts-source.c -liborg_gnome_evolution_google_la_LIBADD = \ - $(EVOLUTION_CALENDAR_LIBS) \ +liborg_gnome_evolution_google_la_LIBADD = \ + $(top_builddir)/calendar/gui/libcal-gui.la \ + $(EVOLUTION_CALENDAR_LIBS) \ $(EPLUGIN_LIBS) liborg_gnome_evolution_google_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index e0655ce6aa..8867cf3b61 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -36,6 +36,7 @@ #include <e-util/e-plugin.h> #include <calendar/gui/e-cal-config.h> +#include <calendar/gui/e-cal-event.h> #include <libedataserver/e-url.h> #include <libedataserver/e-account-list.h> @@ -49,19 +50,19 @@ #include "google-contacts-source.h" +#define GOOGLE_BASE_URI "google://" #define CALENDAR_LOCATION "://www.google.com/calendar/feeds/" #define CALENDAR_DEFAULT_PATH "/private/full" #define URL_GET_SUBSCRIBED_CALENDARS "://www.google.com/calendar/feeds/default/allcalendars/full" +#define CALENDAR_CALDAV_URI "caldav://%s@www.google.com/calendar/dav/%s/events" #define d(x) /*****************************************************************************/ /* prototypes */ -gint e_plugin_lib_enable (EPluginLib *ep, - gint enable); - -GtkWidget * plugin_google (EPlugin *epl, - EConfigHookItemFactoryData *data); +gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +GtkWidget *plugin_google (EPlugin *epl, EConfigHookItemFactoryData *data); +void e_calendar_google_migrate (EPlugin *epl, ECalEventTargetModule *data); /*****************************************************************************/ /* plugin intialization */ @@ -76,7 +77,7 @@ ensure_google_source_group (void) return; } - e_source_list_ensure_group (slist, _("Google"), "google://", FALSE); + e_source_list_ensure_group (slist, _("Google"), GOOGLE_BASE_URI, FALSE); g_object_unref (slist); } @@ -97,6 +98,22 @@ e_plugin_lib_enable (EPluginLib *ep, gint enable) /********************************************************************************************************************/ +static gchar * +decode_at_back (const gchar *user) +{ + gchar *res, *at; + + g_return_val_if_fail (user != NULL, NULL); + + res = g_strdup (user); + while (at = strstr (res, "%40"), at != NULL) { + *at = '@'; + memmove (at + 1, at + 3, strlen (at + 3) + 1); + } + + return res; +} + static gboolean is_email (const gchar *address) { @@ -118,7 +135,9 @@ sanitize_user_mail (const gchar *user) if (!user) return NULL; - if (!is_email (user)) { + if (strstr (user, "%40") != NULL) { + return g_strdup (user); + } else if (!is_email (user)) { return g_strconcat (user, "%40gmail.com", NULL); } else { gchar *tmp = g_malloc0 (sizeof (gchar) * (1 + strlen (user) + 2)); @@ -190,31 +209,94 @@ is_default_uri (const gchar *given_uri, const gchar *username) return res; } +static void +update_source_uris (ESource *source, const gchar *uri) +{ + gchar *abs_uri, *tmp, *user_sanitized, *slash; + const gchar *user, *feeds; + + g_return_if_fail (source != NULL); + g_return_if_fail (uri != NULL); + + /* this also changes an absolute uri */ + e_source_set_relative_uri (source, uri); + + user = e_source_get_property (source, "username"); + g_return_if_fail (user != NULL); + + feeds = strstr (uri, "/feeds/"); + g_return_if_fail (feeds != NULL); + feeds += 7; + + user_sanitized = sanitize_user_mail (user); + /* no "%40" in the URL path for caldav, really */ + tmp = decode_at_back (feeds); + + slash = strchr (tmp, '/'); + if (slash) + *slash = '\0'; + + abs_uri = g_strdup_printf (CALENDAR_CALDAV_URI, user_sanitized, tmp); + e_source_set_absolute_uri (source, abs_uri); + + g_free (abs_uri); + g_free (tmp); + g_free (user_sanitized); +} + static void init_combo_values (GtkComboBox *combo, const gchar *deftitle, const gchar *defuri); static void -user_changed (GtkEntry *editable, ESource *source) +update_user_in_source (ESource *source, const gchar *new_user) { - gchar *uri; - const gchar *user, *ssl; + gchar *uri, *eml, *user; + const gchar *ssl; + + /* to ensure it will not be freed before the work with it is done */ + user = g_strdup (new_user); /* two reasons why set readonly to FALSE: a) the e_source_set_relative_uri does nothing for readonly sources b) we are going to set default uri, which should be always writeable */ e_source_set_readonly (source, FALSE); + if (user && *user) { + /* store the non-encoded email in the "username" property */ + if (strstr (user, "@") == NULL && strstr (user, "%40") == NULL) + eml = g_strconcat (user, "@gmail.com", NULL); + else + eml = decode_at_back (user); + } else { + eml = NULL; + } + + /* set username first, as it's used in update_source_uris */ + e_source_set_property (source, "username", eml); + ssl = e_source_get_property (source, "ssl"); - user = gtk_entry_get_text (GTK_ENTRY (editable)); uri = construct_default_uri (user, !ssl || g_str_equal (ssl, "1")); - e_source_set_relative_uri (source, uri); + update_source_uris (source, uri); g_free (uri); - e_source_set_property (source, "username", user); - e_source_set_property (source, "protocol", "google"); - e_source_set_property (source, "auth-domain", "google"); + /* "setup-username" is used to this plugin only, to keep what user wrote, + not what uses the backend */ + e_source_set_property (source, "setup-username", user); e_source_set_property (source, "auth", (user && *user) ? "1" : NULL); e_source_set_property (source, "googlename", NULL); + /* delete obsolete properties */ + e_source_set_property (source, "protocol", NULL); + e_source_set_property (source, "auth-domain", NULL); + + g_free (eml); + g_free (user); +} + +static void +user_changed (GtkEntry *editable, ESource *source) +{ + update_user_in_source (source, gtk_entry_get_text (GTK_ENTRY (editable))); + /* we changed user, thus reset the chosen calendar combo too, because other user means other calendars subscribed */ init_combo_values (GTK_COMBO_BOX (g_object_get_data (G_OBJECT (editable), "CalendarCombo")), _("Default"), NULL); @@ -361,11 +443,13 @@ cal_combo_changed (GtkComboBox *combo, ESource *source) /* first set readonly to FALSE, otherwise if TRUE, then e_source_set_readonly does nothing */ e_source_set_readonly (source, FALSE); - e_source_set_relative_uri (source, uri); + update_source_uris (source, uri); e_source_set_readonly (source, readonly); e_source_set_property (source, "googlename", title); - e_source_set_property (source, "protocol", "google"); - e_source_set_property (source, "auth-domain", "google"); + + /* delete obsolete properties */ + e_source_set_property (source, "protocol", NULL); + e_source_set_property (source, "auth-domain", NULL); g_free (title); g_free (uri); @@ -393,7 +477,7 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) ESource *source; GDataGoogleService *service; GDataFeed *feed; - gchar *password, *tmp; + gchar *user, *password, *tmp; const gchar *username, *ssl; gchar *get_subscribed_url; GError *error = NULL; @@ -410,17 +494,20 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) username = e_source_get_property (source, "username"); g_return_if_fail (username != NULL && *username != '\0'); - tmp = g_strdup_printf (_("Enter password for user %s to access list of subscribed calendars."), username); + user = decode_at_back (username); + tmp = g_strdup_printf (_("Enter password for user %s to access list of subscribed calendars."), user); password = e_passwords_ask_password (_("Enter password"), "Calendar", "", tmp, E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_REPROMPT | E_PASSWORDS_SECRET | E_PASSWORDS_DISABLE_REMEMBER, NULL, parent); g_free (tmp); - if (!password) + if (!password) { + g_free (user); return; + } service = gdata_google_service_new ("cl", "evolution-client-0.0.1"); - gdata_service_set_credentials (GDATA_SERVICE (service), username, password); + gdata_service_set_credentials (GDATA_SERVICE (service), user, password); /* privacy... maybe... */ memset (password, 0, strlen (password)); g_free (password); @@ -478,7 +565,7 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) if (color) gdk_color_parse (color, &gdkcolor); - if (default_idx == -1 && is_default_uri (uri, username)) { + if (default_idx == -1 && is_default_uri (uri, user)) { /* have the default uri always NULL and first in the combo */ uri = NULL; gtk_list_store_insert (store, &iter, 0); @@ -524,6 +611,7 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) } g_object_unref (service); + g_free (user); } static void @@ -538,20 +626,6 @@ retrieve_list_sensitize (GtkEntry *username_entry, gtk_widget_set_sensitive (button, sensitive); } -static void -ssl_toggled (GtkToggleButton *check, ESource *source) -{ - g_return_if_fail (check != NULL); - g_return_if_fail (source != NULL); - - if (gtk_toggle_button_get_active (check)) - e_source_set_property (source, "ssl", "1"); - else - e_source_set_property (source, "ssl", "0"); - - user_changed (GTK_ENTRY (g_object_get_data (G_OBJECT (check), "username")), source); -} - GtkWidget * plugin_google (EPlugin *epl, EConfigHookItemFactoryData *data) @@ -561,7 +635,6 @@ plugin_google (EPlugin *epl, ESourceGroup *group; EUri *euri; GtkWidget *parent; - GtkWidget *cssl; GtkWidget *widget; GtkWidget *luser; GtkWidget *user; @@ -569,8 +642,6 @@ plugin_google (EPlugin *epl, GtkWidget *combo; gchar *uri; const gchar *username; - const gchar *ssl_prop; - gboolean ssl_enabled; gint row; GtkCellRenderer *renderer; GtkListStore *store; @@ -581,7 +652,7 @@ plugin_google (EPlugin *epl, group = e_source_peek_group (source); widget = NULL; - if (g_ascii_strncasecmp ("google://", e_source_group_peek_base_uri (group), 9) != 0) { + if (g_ascii_strncasecmp (GOOGLE_BASE_URI, e_source_group_peek_base_uri (group), strlen (GOOGLE_BASE_URI)) != 0) { return NULL; } @@ -595,37 +666,17 @@ plugin_google (EPlugin *epl, e_uri_free (euri); - username = e_source_get_property (source, "username"); - - ssl_prop = e_source_get_property (source, "ssl"); - if (!ssl_prop || g_str_equal (ssl_prop, "1")) { - ssl_enabled = TRUE; - } else { - ssl_enabled = FALSE; - } - - if (!ssl_prop) { - e_source_set_property (source, "ssl", "1"); - } else if (ssl_enabled) { - const gchar *rel_uri = e_source_peek_relative_uri (source); + username = e_source_get_property (source, "setup-username"); + if (!username) + username = e_source_get_property (source, "username"); - if (rel_uri && g_str_has_prefix (rel_uri, "http://")) { - ssl_enabled = FALSE; - e_source_set_property (source, "ssl", "0"); - } - } + /* google's CalDAV requires SSL, thus forcing it here, and no setup for it */ + e_source_set_property (source, "ssl", "1"); /* Build up the UI */ parent = data->parent; row = GTK_TABLE (parent)->nrows; - cssl = gtk_check_button_new_with_mnemonic (_("Use _SSL")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cssl), ssl_enabled); - gtk_widget_show (cssl); - gtk_table_attach (GTK_TABLE (parent), - cssl, 1, 2, - row + 3, row + 4, - GTK_FILL, 0, 0, 0); luser = gtk_label_new_with_mnemonic (_("User_name:")); gtk_widget_show (luser); gtk_misc_set_alignment (GTK_MISC (luser), 0.0, 0.5); @@ -679,9 +730,6 @@ plugin_google (EPlugin *epl, gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row + 2, row + 3, GTK_EXPAND | GTK_FILL, 0, 0, 0); - g_object_set_data (G_OBJECT (cssl), "username", user); - g_signal_connect (cssl, "toggled", G_CALLBACK (ssl_toggled), source); - g_signal_connect (G_OBJECT (user), "changed", G_CALLBACK (user_changed), @@ -690,7 +738,7 @@ plugin_google (EPlugin *epl, label = gtk_label_new_with_mnemonic (_("Cal_endar:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row + 4, row + 5, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row + 3, row + 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); store = gtk_list_store_new ( NUM_COLUMNS, @@ -727,10 +775,41 @@ plugin_google (EPlugin *epl, g_signal_connect (user, "changed", G_CALLBACK (retrieve_list_sensitize), label); g_object_set_data (G_OBJECT (label), "ESource", source); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - gtk_widget_set_sensitive (label, FALSE); + gtk_widget_set_sensitive (label, username && *username); gtk_widget_show_all (hbox); - gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row + 4, row + 5, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row + 3, row + 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); return widget; } + +void +e_calendar_google_migrate (EPlugin *epl, ECalEventTargetModule *data) +{ + ESourceList *source_list; + ESourceGroup *google = NULL; + gboolean changed = FALSE; + + source_list = data->source_list; + + google = e_source_list_peek_group_by_base_uri (source_list, GOOGLE_BASE_URI); + if (google) { + GSList *s; + + for (s = e_source_group_peek_sources (google); s; s = s->next) { + ESource *source = E_SOURCE (s->data); + + if (!source) + continue; + + /* new source through CalDAV uses absolute uri, thus it should be migrated if not set */ + if (!e_source_peek_absolute_uri (source)) { + update_user_in_source (source, e_source_get_property (source, "username")); + changed = TRUE; + } + } + } + + if (changed) + e_source_list_sync (source_list, NULL); +} diff --git a/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml b/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml index 42b84d58fa..afccbd3fb7 100644 --- a/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml +++ b/plugins/google-account-setup/org-gnome-evolution-google.eplug.xml @@ -11,6 +11,10 @@ <item type="item_table" path="00.general/00.source/15.google" factory="plugin_google"/> </group> </hook> + <hook class="org.gnome.evolution.calendar.events:1.0"> + <event target="component" id="component.migration" handle="e_calendar_google_migrate"/> + </hook> + <hook class="org.gnome.evolution.addressbook.config:1.0"> <group target="source" id="com.novell.evolution.addressbook.config.accountEditor"> <item type="item" path="00.general/10.display/00.google" factory="plugin_google_contacts"/> diff --git a/plugins/groupwise-features/Makefile.am b/plugins/groupwise-features/Makefile.am index 41b3f91170..20fd6bf812 100644 --- a/plugins/groupwise-features/Makefile.am +++ b/plugins/groupwise-features/Makefile.am @@ -64,6 +64,7 @@ error_DATA = \ org-gnome-shared-folder.error \ org-gnome-proxy.error \ org-gnome-proxy-login.error \ + org-gnome-process-meeting.error \ org-gnome-mail-retract.error errordir = $(privdatadir)/errors @@ -75,6 +76,7 @@ EXTRA_DIST = \ org-gnome-compose-send-options.xml \ org-gnome-groupwise-features.eplug.xml \ org-gnome-shared-folder.error.xml \ + org-gnome-process-meeting.error.xml \ org-gnome-proxy.error.xml \ org-gnome-proxy-login.error.xml \ org-gnome-mail-retract.error.xml diff --git a/plugins/groupwise-features/mail-send-options.c b/plugins/groupwise-features/mail-send-options.c index 4faaf9bbc6..8244088f8a 100644 --- a/plugins/groupwise-features/mail-send-options.c +++ b/plugins/groupwise-features/mail-send-options.c @@ -44,6 +44,7 @@ static ESendOptionsDialog * dialog = NULL; void org_gnome_composer_send_options (EPlugin *ep, EMEventTargetComposer *t); +void org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t); static time_t add_day_to_time (time_t time, gint days) @@ -171,3 +172,22 @@ org_gnome_composer_send_options (EPlugin *ep, EMEventTargetComposer *t) G_CALLBACK (send_options_commit), dialog); } +void +org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t) +{ + EMsgComposer *comp = (struct _EMsgComposer *)t->composer; + EComposerHeaderTable *table; + EAccount *account = NULL; + gchar *temp = NULL; + + table = e_msg_composer_get_header_table (comp); + account = e_composer_header_table_get_account (table); + if (!account) + return; + + temp = strstr (account->transport->url, "groupwise"); + if (!temp) { + return; + } + e_msg_composer_add_header (comp, "X-GW-ORIG-ITEM-ID", t->uid); +} diff --git a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml index 8bb6651acf..ea4f06a6e7 100644 --- a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml +++ b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml @@ -72,7 +72,16 @@ enable="sendoption" /> </hook> - + + <hook class="org.gnome.evolution.mail.events:1.0"> + <event + id="message.replying" + handle="org_gnome_composer_message_reply" + target="message" + enable="reply" + /> + </hook> + <hook class="org.gnome.evolution.mail.config:1.0"> <group id="org.gnome.evolution.mail.config.accountEditor" target="account" commit = "proxy_commit" abort="proxy_abort"> diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index cc572a6893..123fc0641b 100644 --- a/plugins/groupwise-features/proxy-login.c +++ b/plugins/groupwise-features/proxy-login.c @@ -401,7 +401,9 @@ proxy_login_tree_view_changed_cb(GtkDialog *dialog) account_select = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree)); gtk_tree_selection_get_selected (account_select, &model, &iter); - gtk_tree_model_get (model, &iter, ACCOUNT_NAME, &account_mailid, -1); + if ((priv->store)->stamp != (&iter)->stamp) + return; + gtk_tree_model_get (model, &iter, ACCOUNT_NAME, &account_mailid, -1); account_mailid = g_strrstr (account_mailid, "\n") + 1; account_name_tbox = glade_xml_get_widget (priv->xml, "account_name"); gtk_entry_set_text((GtkEntry*) account_name_tbox,account_mailid); diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 3ad3ade1ae..06473e8340 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -66,7 +66,6 @@ #include <mail/mail-tools.h> #include <mail/em-utils.h> -#include <libpst/define.h> #include <libpst/libpst.h> #include <libpst/timeconv.h> @@ -75,8 +74,8 @@ typedef struct _PstImporter PstImporter; gint pst_init (pst_file *pst, gchar *filename); gchar *get_pst_rootname (pst_file *pst, gchar *filename); static void pst_error_msg (const gchar *fmt, ...); -static void pst_import_folders (PstImporter *m, pst_desc_ll *topitem); -static void pst_process_item (PstImporter *m, pst_desc_ll *d_ptr); +static void pst_import_folders (PstImporter *m, pst_desc_tree *topitem); +static void pst_process_item (PstImporter *m, pst_desc_tree *d_ptr); static void pst_process_folder (PstImporter *m, pst_item *item); static void pst_process_email (PstImporter *m, pst_item *item); static void pst_process_contact (PstImporter *m, pst_item *item); @@ -447,7 +446,7 @@ pst_import_file (PstImporter *m) gint ret; gchar *filename; pst_item *item = NULL; - pst_desc_ll *d_ptr; + pst_desc_tree *d_ptr; filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL); m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */ @@ -470,7 +469,7 @@ pst_import_file (PstImporter *m) camel_operation_progress_count (NULL, 1); - if ((item = pst_parse_item (&m->pst, m->pst.d_head)) == NULL) { + if ((item = pst_parse_item (&m->pst, m->pst.d_head, NULL)) == NULL) { pst_error_msg ("Could not get root record"); return; } @@ -494,9 +493,9 @@ pst_import_file (PstImporter *m) } static void -pst_import_folders (PstImporter *m, pst_desc_ll *topitem) +pst_import_folders (PstImporter *m, pst_desc_tree *topitem) { - pst_desc_ll *d_ptr; + pst_desc_tree *d_ptr; gchar *seperator; d_ptr = topitem->child; @@ -538,14 +537,14 @@ pst_import_folders (PstImporter *m, pst_desc_ll *topitem) } static void -pst_process_item (PstImporter *m, pst_desc_ll *d_ptr) +pst_process_item (PstImporter *m, pst_desc_tree *d_ptr) { pst_item *item = NULL; if (d_ptr->desc == NULL) return; - item = pst_parse_item (&m->pst, d_ptr); + item = pst_parse_item (&m->pst, d_ptr, NULL); if (item == NULL) return; @@ -558,7 +557,7 @@ pst_process_item (PstImporter *m, pst_desc_ll *d_ptr) if (item->folder != NULL) { pst_process_folder (m, item); - camel_operation_start (NULL, _("Importing `%s'"), item->file_as); + camel_operation_start (NULL, _("Importing `%s'"), item->file_as.str); } else { if (m->folder_count && (m->current_item < m->folder_count)) { camel_operation_progress (NULL, (m->current_item * 100) / m->folder_count); @@ -659,10 +658,10 @@ pst_process_folder (PstImporter *m, pst_item *item) g_free (m->folder_name); g_free (m->folder_uri); - if (item->file_as != NULL) { - m->folder_name = foldername_to_utf8 (item->file_as); + if (item->file_as.str != NULL) { + m->folder_name = foldername_to_utf8 (item->file_as.str); } else { - g_critical ("Folder: No name! item->file_as=%s", item->file_as); + g_critical ("Folder: No name! item->file_as=%s", item->file_as.str); m->folder_name = g_strdup ("unknown_name"); } @@ -674,7 +673,7 @@ pst_process_folder (PstImporter *m, pst_item *item) m->folder = NULL; } - m->folder_count = item->folder->email_count; + m->folder_count = item->folder->item_count; m->current_item = 0; } @@ -735,29 +734,28 @@ attachment_to_part (PstImporter *m, pst_item_attach *attach) part = camel_mime_part_new (); - if (attach->filename2 || attach->filename1) { - camel_mime_part_set_filename (part, (attach->filename2 ? attach->filename2 : attach->filename1)); + if (attach->filename2.str || attach->filename1.str) { + camel_mime_part_set_filename (part, (attach->filename2.str ? attach->filename2.str : attach->filename1.str)); camel_mime_part_set_disposition (part, "attachment"); camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_BASE64); } else { camel_mime_part_set_disposition (part, "inline"); } - if (attach->mimetype != NULL) { - mimetype = attach->mimetype; + if (attach->mimetype.str != NULL) { + mimetype = attach->mimetype.str; } else { mimetype = "application/octet-stream"; } - if (attach->data != NULL) { - camel_mime_part_set_content (part, attach->data, strlen (attach->data), mimetype); + if (attach->data.data != NULL) { + camel_mime_part_set_content (part, attach->data.data, attach->data.size, mimetype); } else { - gchar *buf = NULL; - gsize size; - size = pst_attach_to_mem (&m->pst, attach, &buf); + pst_binary attach_rc; + attach_rc = pst_attach_to_mem (&m->pst, attach); - camel_mime_part_set_content (part, (gchar *) buf, size, mimetype); - free(buf); + camel_mime_part_set_content (part, (gchar *) attach_rc.data, attach_rc.size, mimetype); + free(attach_rc.data); } return part; @@ -771,6 +769,7 @@ pst_process_email (PstImporter *m, pst_item *item) CamelMultipart *mp; CamelMimePart *part; CamelMessageInfo *info; + pst_item_attach *attach; if (m->folder == NULL) { pst_create_folder (m); @@ -780,12 +779,12 @@ pst_process_email (PstImporter *m, pst_item *item) msg = camel_mime_message_new (); - if (item->email->subject != NULL) { + if (item->subject.str != NULL) { gchar *subj; - subj = string_to_utf8 (item->email->subject->subj); + subj = string_to_utf8 (item->subject.str); if (subj == NULL) { - g_warning ("Could not convert email subject to utf8: %s", item->email->subject->subj); + g_warning ("Could not convert email subject to utf8: %s", item->subject.str); camel_mime_message_set_subject (msg, "(lost subject)"); } else { camel_mime_message_set_subject (msg, subj); @@ -795,12 +794,12 @@ pst_process_email (PstImporter *m, pst_item *item) addr = camel_internet_address_new (); - if (item->email->outlook_sender_name != NULL && item->email->outlook_sender != NULL) { - camel_internet_address_add (addr, item->email->outlook_sender_name, item->email->outlook_sender); - } else if (item->email->outlook_sender_name != NULL) { - camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender_name); - } else if (item->email->outlook_sender != NULL) { - camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender); + if (item->email->outlook_sender_name.str != NULL && item->email->outlook_sender.str != NULL) { + camel_internet_address_add (addr, item->email->outlook_sender_name.str, item->email->outlook_sender.str); + } else if (item->email->outlook_sender_name.str != NULL) { + camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender_name.str); + } else if (item->email->outlook_sender.str != NULL) { + camel_address_decode (CAMEL_ADDRESS (addr), item->email->outlook_sender.str); } else { /* Evo prints a warning if no from is set, so supply an empty address */ camel_internet_address_add (addr, "", ""); @@ -810,38 +809,38 @@ pst_process_email (PstImporter *m, pst_item *item) camel_object_unref (addr); if (item->email->sent_date != NULL) { - camel_mime_message_set_date (msg, fileTimeToUnixTime (item->email->sent_date, 0), 0); + camel_mime_message_set_date (msg, pst_fileTimeToUnixTime (item->email->sent_date), 0); } - if (item->email->messageid != NULL) { - camel_mime_message_set_message_id (msg, item->email->messageid); + if (item->email->messageid.str != NULL) { + camel_mime_message_set_message_id (msg, item->email->messageid.str); } - if (item->email->header != NULL) { + if (item->email->header.str != NULL) { /* Use mime parser to read headers */ CamelStream *stream; /*g_debug (" Email headers length=%zd", strlen (item->email->header));*/ /*g_message (" Email headers... %s...", item->email->header);*/ - stream = camel_stream_mem_new_with_buffer (item->email->header, strlen (item->email->header)); + stream = camel_stream_mem_new_with_buffer (item->email->header.str, strlen (item->email->header.str)); if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream) == -1) g_warning ("Error reading headers, skipped"); } else { - if (item->email->sentto_address != NULL) { + if (item->email->sentto_address.str != NULL) { addr = camel_internet_address_new (); - if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address) > 0); + if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address.str) > 0); camel_mime_message_set_recipients (msg, "To", addr); camel_object_unref (addr); } - if (item->email->cc_address != NULL) { + if (item->email->cc_address.str != NULL) { addr = camel_internet_address_new (); - if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address) > 0); + if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address.str) > 0); camel_mime_message_set_recipients (msg, "CC", addr); camel_object_unref (addr); @@ -854,11 +853,11 @@ pst_process_email (PstImporter *m, pst_item *item) camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (mp), "multipart/mixed"); - } else if (item->email->htmlbody && item->email->body) { + } else if (item->email->htmlbody.str && item->body.str) { camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (mp), "multipart/alternate"); - } else if (item->email->htmlbody) { + } else if (item->email->htmlbody.str) { camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (mp), "text/html"); @@ -866,56 +865,50 @@ pst_process_email (PstImporter *m, pst_item *item) camel_multipart_set_boundary (mp, NULL); - if (item->email->body != NULL) { + if (item->body.str != NULL) { /* Read internet headers */ /*g_debug (" Email body length=%zd", strlen (item->email->body)); g_message (" Email body %100s...", item->email->body);*/ part = camel_mime_part_new (); - camel_mime_part_set_content (part, item->email->body, strlen (item->email->body), "text/plain"); + camel_mime_part_set_content (part, item->body.str, strlen (item->body.str), "text/plain"); camel_multipart_add_part (mp, part); camel_object_unref (part); } - if (item->email->htmlbody != NULL) { + if (item->email->htmlbody.str != NULL) { /*g_debug (" HTML body length=%zd", strlen (item->email->htmlbody));*/ part = camel_mime_part_new (); - camel_mime_part_set_content (part, item->email->htmlbody, strlen (item->email->htmlbody), "text/html"); + camel_mime_part_set_content (part, item->email->htmlbody.str, strlen (item->email->htmlbody.str), "text/html"); camel_multipart_add_part (mp, part); camel_object_unref (part); } - item->current_attach = item->attach; - - while (item->current_attach != NULL) { - pst_item_attach *attach; - - attach = item->current_attach; - part = attachment_to_part(m, attach); - - camel_multipart_add_part (mp, part); - camel_object_unref (part); - - item->current_attach = item->current_attach->next; + for (attach = item->attach; attach; attach = attach->next) { + if (attach->data.data || attach->i_id) { + part = attachment_to_part(m, attach); + camel_multipart_add_part (mp, part); + camel_object_unref (part); + } } /*camel_mime_message_dump (msg, TRUE);*/ - if (item->email->htmlbody || item->attach) { + if (item->email->htmlbody.str || item->attach) { camel_medium_set_content_object (CAMEL_MEDIUM (msg), CAMEL_DATA_WRAPPER (mp)); - } else if (item->email->body) { - camel_mime_part_set_content (CAMEL_MIME_PART (msg), item->email->body, strlen (item->email->body), "text/plain"); + } else if (item->body.str) { + camel_mime_part_set_content (CAMEL_MIME_PART (msg), item->body.str, strlen (item->body.str), "text/plain"); } else { g_warning ("Email without body. Subject:%s", - (item->email->subject->subj ? item->email->subject->subj : "(empty)")); + (item->subject.str ? item->subject.str : "(empty)")); camel_mime_part_set_content (CAMEL_MIME_PART (msg), "\n", 1, "text/plain"); } info = camel_message_info_new (NULL); /* Read message flags (see comments in libpst.c */ - if (item->email->flag && 0x01) + if (item->flags && 0x01) camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0); if (item->email->importance == 2) @@ -1001,7 +994,7 @@ contact_set_date (EContact *contact, EContactField id, FILETIME *date) EContactDate *bday; bday = e_contact_date_new (); - t1 = fileTimeToUnixTime (date, 0); + t1 = pst_fileTimeToUnixTime (date); gmtime_r (&t1, &tm); bday->year = tm.tm_year + 1900; @@ -1024,84 +1017,84 @@ pst_process_contact (PstImporter *m, pst_item *item) ec = e_contact_new (); /* pst's fullname field only contains first, middle, surname */ - if (c->display_name_prefix || c->suffix) { + if (c->display_name_prefix.str || c->suffix.str) { GString *name = g_string_sized_new (128); - if (c->display_name_prefix) { - g_string_assign (name, c->display_name_prefix); + if (c->display_name_prefix.str) { + g_string_assign (name, c->display_name_prefix.str); } - if (c->first_name) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->first_name); + if (c->first_name.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->first_name.str); } - if (c->middle_name) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->middle_name); + if (c->middle_name.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->middle_name.str); } - if (c->surname) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->surname); + if (c->surname.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->surname.str); } - if (c->suffix) { - g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->suffix); + if (c->surname.str) { + g_string_append_printf (name, "%s%s", (name->len ? " " : ""), c->surname.str); } contact_set_string (ec, E_CONTACT_FULL_NAME, name->str); g_string_free (name, TRUE); } else { - contact_set_string (ec, E_CONTACT_FULL_NAME, c->fullname); + contact_set_string (ec, E_CONTACT_FULL_NAME, c->fullname.str); } /* unknown_field (ec, notes, "initials", c->initials); */ - contact_set_string (ec, E_CONTACT_NICKNAME, c->nickname); + contact_set_string (ec, E_CONTACT_NICKNAME, c->nickname.str); - contact_set_string (ec, E_CONTACT_ORG, c->company_name); - contact_set_string (ec, E_CONTACT_ORG_UNIT, c->department); - contact_set_string (ec, E_CONTACT_TITLE, c->job_title); + contact_set_string (ec, E_CONTACT_ORG, c->company_name.str); + contact_set_string (ec, E_CONTACT_ORG_UNIT, c->department.str); + contact_set_string (ec, E_CONTACT_TITLE, c->job_title.str); contact_set_address (ec,E_CONTACT_ADDRESS_WORK, - c->business_address, c->business_city, c->business_country, - c->business_po_box, c->business_postal_code, c->business_state, c->business_street); + c->business_address.str, c->business_city.str, c->business_country.str, + c->business_po_box.str, c->business_postal_code.str, c->business_state.str, c->business_street.str); contact_set_address (ec,E_CONTACT_ADDRESS_HOME, - c->home_address, c->home_city, c->home_country, - c->home_po_box, c->home_postal_code, c->home_state, c->home_street); + c->home_address.str, c->home_city.str, c->home_country.str, + c->home_po_box.str, c->home_postal_code.str, c->home_state.str, c->home_street.str); contact_set_address (ec,E_CONTACT_ADDRESS_OTHER, - c->other_address, c->other_city, c->other_country, - c->other_po_box, c->other_postal_code, c->other_state, c->other_street); - - contact_set_string (ec, E_CONTACT_PHONE_ASSISTANT, c->assistant_phone); - contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_FAX, c->business_fax); - contact_set_string (ec, E_CONTACT_PHONE_BUSINESS, c->business_phone); - contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_2, c->business_phone2); - contact_set_string (ec, E_CONTACT_PHONE_CALLBACK, c->callback_phone); - contact_set_string (ec, E_CONTACT_PHONE_CAR, c->car_phone); - contact_set_string (ec, E_CONTACT_PHONE_COMPANY, c->company_main_phone); - contact_set_string (ec, E_CONTACT_PHONE_HOME_FAX, c->home_fax); - contact_set_string (ec, E_CONTACT_PHONE_HOME, c->home_phone); - contact_set_string (ec, E_CONTACT_PHONE_HOME_2, c->home_phone2); - contact_set_string (ec, E_CONTACT_PHONE_ISDN, c->isdn_phone); - contact_set_string (ec, E_CONTACT_PHONE_MOBILE, c->mobile_phone); - contact_set_string (ec, E_CONTACT_PHONE_OTHER_FAX, c->primary_fax); /* ? */ - contact_set_string (ec, E_CONTACT_PHONE_PAGER, c->pager_phone); - contact_set_string (ec, E_CONTACT_PHONE_PRIMARY, c->primary_phone); - contact_set_string (ec, E_CONTACT_PHONE_RADIO, c->radio_phone); - contact_set_string (ec, E_CONTACT_PHONE_TTYTDD, c->ttytdd_phone); - contact_set_string (ec, E_CONTACT_PHONE_TELEX, c->telex); - unknown_field (ec, notes, "account_name", c->account_name); + c->other_address.str, c->other_city.str, c->other_country.str, + c->other_po_box.str, c->other_postal_code.str, c->other_state.str, c->other_street.str); + + contact_set_string (ec, E_CONTACT_PHONE_ASSISTANT, c->assistant_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_FAX, c->business_fax.str); + contact_set_string (ec, E_CONTACT_PHONE_BUSINESS, c->business_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_BUSINESS_2, c->business_phone2.str); + contact_set_string (ec, E_CONTACT_PHONE_CALLBACK, c->callback_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_CAR, c->car_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_COMPANY, c->company_main_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_HOME_FAX, c->home_fax.str); + contact_set_string (ec, E_CONTACT_PHONE_HOME, c->home_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_HOME_2, c->home_phone2.str); + contact_set_string (ec, E_CONTACT_PHONE_ISDN, c->isdn_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_MOBILE, c->mobile_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_OTHER_FAX, c->primary_fax.str); /* ? */ + contact_set_string (ec, E_CONTACT_PHONE_PAGER, c->pager_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_PRIMARY, c->primary_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_RADIO, c->radio_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_TTYTDD, c->ttytdd_phone.str); + contact_set_string (ec, E_CONTACT_PHONE_TELEX, c->telex.str); + unknown_field (ec, notes, "account_name", c->account_name.str); contact_set_date (ec, E_CONTACT_ANNIVERSARY, c->wedding_anniversary); - contact_set_string (ec, E_CONTACT_ASSISTANT, c->assistant_name); - unknown_field (ec, notes, "billing_information", c->billing_information); + contact_set_string (ec, E_CONTACT_ASSISTANT, c->assistant_name.str); + unknown_field (ec, notes, "billing_information", c->billing_information.str); contact_set_date (ec, E_CONTACT_BIRTH_DATE, c->birthday); /* contact_set_string (ec, E_CONTACT_CATEGORIES, c->??); */ - contact_set_string (ec, E_CONTACT_EMAIL_1 , c->address1); - contact_set_string (ec, E_CONTACT_EMAIL_2 , c->address2); - contact_set_string (ec, E_CONTACT_EMAIL_3 , c->address3); + contact_set_string (ec, E_CONTACT_EMAIL_1 , c->address1.str); + contact_set_string (ec, E_CONTACT_EMAIL_2 , c->address2.str); + contact_set_string (ec, E_CONTACT_EMAIL_3 , c->address3.str); /*unknown_field (ec, notes, "address1_desc" , c->address1_desc); unknown_field (ec, notes, "address1_transport" , c->address1_transport); @@ -1113,43 +1106,42 @@ pst_process_contact (PstImporter *m, pst_item *item) /*unknown_field (ec, notes, "def_postal_address", c->def_postal_address);*/ /* unknown_field (ec, ??, c->gender); */ - unknown_field (ec, notes, "access_method", c->access_method); - unknown_field (ec, notes, "gov_id", c->gov_id); - unknown_field (ec, notes, "customer_id", c->customer_id); - unknown_field (ec, notes, "hobbies", c->hobbies); - unknown_field (ec, notes, "followup", c->followup); - - contact_set_string (ec, E_CONTACT_FREEBUSY_URL , c->free_busy_address); - - unknown_field (ec, notes, "keyword", c->keyword); - unknown_field (ec, notes, "language", c->language); - unknown_field (ec, notes, "location", c->location); - contact_set_string (ec, E_CONTACT_OFFICE, c->office_loc); - unknown_field (ec, notes, "computer_name", c->computer_name); - unknown_field (ec, notes, "ftp_site", c->ftp_site); - - contact_set_string (ec, E_CONTACT_MANAGER , c->manager_name); - unknown_field (ec, notes, "mileage", c->mileage); - unknown_field (ec, notes, "org_id", c->org_id); - contact_set_string (ec, E_CONTACT_ROLE, c->profession); - - contact_set_string (ec, E_CONTACT_SPOUSE , c->spouse_name); - - if (c->personal_homepage) { - contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->personal_homepage); - if (c->business_homepage) { - unknown_field (ec, notes, "business_homepage", c->business_homepage); + unknown_field (ec, notes, "gov_id", c->gov_id.str); + unknown_field (ec, notes, "customer_id", c->customer_id.str); + unknown_field (ec, notes, "hobbies", c->hobbies.str); + unknown_field (ec, notes, "followup", c->followup.str); + + contact_set_string (ec, E_CONTACT_FREEBUSY_URL , c->free_busy_address.str); + + unknown_field (ec, notes, "keyword", c->keyword.str); + unknown_field (ec, notes, "language", c->language.str); + unknown_field (ec, notes, "location", c->location.str); + contact_set_string (ec, E_CONTACT_OFFICE, c->office_loc.str); + unknown_field (ec, notes, "computer_name", c->computer_name.str); + unknown_field (ec, notes, "ftp_site", c->ftp_site.str); + + contact_set_string (ec, E_CONTACT_MANAGER , c->manager_name.str); + unknown_field (ec, notes, "mileage", c->mileage.str); + unknown_field (ec, notes, "org_id", c->org_id.str); + contact_set_string (ec, E_CONTACT_ROLE, c->profession.str); + + contact_set_string (ec, E_CONTACT_SPOUSE , c->spouse_name.str); + + if (c->personal_homepage.str) { + contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->personal_homepage.str); + if (c->business_homepage.str) { + unknown_field (ec, notes, "business_homepage", c->business_homepage.str); } - } else if (c->business_homepage) { - contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->business_homepage); + } else if (c->business_homepage.str) { + contact_set_string (ec, E_CONTACT_HOMEPAGE_URL , c->business_homepage.str); } - if (item->comment) { - g_string_append_printf (notes, "%s\n", item->comment); + if (item->comment.str) { + g_string_append_printf (notes, "%s\n", item->comment.str); } - if (item->email && item->email->body) { - g_string_append_printf (notes, "%s\n", item->email->body); + if (item->email && item->body.str) { + g_string_append_printf (notes, "%s\n", item->body.str); } contact_set_string (ec, E_CONTACT_NOTE, notes->str); @@ -1172,26 +1164,13 @@ get_ical_date (FILETIME *date, gboolean is_date) if (date && (date->dwLowDateTime || date->dwHighDateTime) ) { time_t t; - t = fileTimeToUnixTime (date, 0); + t = pst_fileTimeToUnixTime (date); return icaltime_from_timet_with_zone (t, is_date, NULL); } else { return icaltime_null_date (); } } -gchar *rfc2445_datetime_format (FILETIME *ft) { - static gchar * buffer = NULL; - struct tm *stm = NULL; - - if (buffer == NULL) { - buffer = malloc (30); // should be enough - } - - stm = fileTimeToStructTM (ft); - strftime (buffer, 30, "%Y%m%dT%H%M%SZ", stm); - return buffer; -} - static void set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_attach *attach) { @@ -1313,19 +1292,19 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha } if (e) { - if (e->subject || e->proc_subject) { - if (e->subject) { - text.value = e->subject->subj; - } else if (e->proc_subject) { - text.value = e->proc_subject; + if (item->subject.str || e->processed_subject.str) { + if (item->subject.str) { + text.value = item->subject.str; + } else if (e->processed_subject.str) { + text.value = e->processed_subject.str; } text.altrep = NULL; /* email->proc_subject? */ e_cal_component_set_summary (ec, &text); } - if (e->body) { + if (item->body.str) { GSList l; - text.value = e->body; + text.value = item->body.str; text.altrep = NULL; l.data = &text; l.next = NULL; @@ -1335,8 +1314,8 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha g_warning ("%s without subject / body!", type); } - if (a->location) { - e_cal_component_set_location (ec, a->location); + if (a->location.str) { + e_cal_component_set_location (ec, a->location.str); } if (a->start) { @@ -1403,7 +1382,7 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha } if (a->alarm) { - if (a->alarm_filename) { + if (a->alarm_filename.str) { e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_AUDIO); } else { e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY); @@ -1415,7 +1394,7 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha } - if (a->recurrence != PST_APP_RECUR_NONE) { + if (a->recurrence_description.str != PST_APP_RECUR_NONE) { struct icalrecurrencetype r; GSList recur_list; @@ -1704,7 +1683,6 @@ pst_init (pst_file *pst, gchar *filename) DEBUG_REGISTER_CLOSE (); #endif - DEBUG_ENT ("main"); if (pst_open (pst, filename) < 0) { pst_error_msg ("Error opening PST file %s", filename); return -1; @@ -1735,7 +1713,7 @@ get_pst_rootname (pst_file *pst, gchar *filename) pst_item *item = NULL; gchar *rootname = NULL; - if ((item = pst_parse_item (pst, pst->d_head)) == NULL) { + if ((item = pst_parse_item (pst, pst->d_head, NULL)) == NULL) { pst_error_msg ("Could not get root record"); return NULL; } @@ -1747,14 +1725,14 @@ get_pst_rootname (pst_file *pst, gchar *filename) } /* default the file_as to the same as the main filename if it doesn't exist */ - if (item->file_as == NULL) { + if (item->file_as.str == NULL) { if (filename == NULL) { pst_freeItem (item); return NULL; } rootname = g_path_get_basename (filename); } else { - rootname = g_strdup (item->file_as); + rootname = g_strdup (item->file_as.str); } pst_freeItem (item); |