diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-03 17:47:46 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-08-03 17:48:53 +0800 |
commit | 1000762b671decc62627fbc02f2ad85e5951d683 (patch) | |
tree | aab021b0ba2b1447f4e3dc4ed4af46574b9d92bc /plugins | |
parent | db19f2c6db132a9ddaeb957d7ab8dab63de45762 (diff) | |
download | gsoc2013-evolution-1000762b671decc62627fbc02f2ad85e5951d683.tar gsoc2013-evolution-1000762b671decc62627fbc02f2ad85e5951d683.tar.gz gsoc2013-evolution-1000762b671decc62627fbc02f2ad85e5951d683.tar.bz2 gsoc2013-evolution-1000762b671decc62627fbc02f2ad85e5951d683.tar.lz gsoc2013-evolution-1000762b671decc62627fbc02f2ad85e5951d683.tar.xz gsoc2013-evolution-1000762b671decc62627fbc02f2ad85e5951d683.tar.zst gsoc2013-evolution-1000762b671decc62627fbc02f2ad85e5951d683.zip |
Bug #646646 - Incomplete and folder-incorrect import of pst file
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/pst-import/pst-importer.c | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 201b09df7b..75bb3afb87 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -554,6 +554,11 @@ pst_import_folders (PstImporter *m, pst_desc_tree *topitem) pst_process_item (m, d_ptr); if (d_ptr->child != NULL) { + if (m->folder) { + g_object_unref (m->folder); + m->folder = NULL; + } + g_free (m->parent_uri); m->parent_uri = g_strdup (m->folder_uri); d_ptr = d_ptr->child; @@ -561,6 +566,13 @@ pst_import_folders (PstImporter *m, pst_desc_tree *topitem) d_ptr = d_ptr->next; } else { while (d_ptr != topitem && d_ptr->next == NULL) { + if (m->folder_uri && g_str_equal (m->folder_uri, m->parent_uri)) { + /* this is for cases where folder has only messages */ + seperator = g_strrstr (m->parent_uri, "/"); + if (seperator != NULL) + *seperator = '\0'; + } + if (m->folder_uri) { g_free (m->folder_uri); } @@ -572,6 +584,11 @@ pst_import_folders (PstImporter *m, pst_desc_tree *topitem) *seperator = '\0'; /* Truncate uri */ } + if (m->folder) { + g_object_unref (m->folder); + m->folder = NULL; + } + d_ptr = d_ptr->parent; } @@ -614,36 +631,29 @@ pst_process_item (PstImporter *m, pst_desc_tree *d_ptr) camel_operation_progress (NULL, 100); } - if (item->email != NULL && - (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT)) { - - if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) - pst_process_email (m, item); - - } else if (item->contact && item->type == PST_TYPE_CONTACT) { - - if (m->addressbook && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-addr"))) { + switch (item->type) { + case PST_TYPE_CONTACT: + if (item->contact && m->addressbook && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-addr"))) pst_process_contact (m, item); - } - - } else if (item->type == PST_TYPE_APPOINTMENT && item->appointment) { - - if (m->calendar && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-appt"))) { + break; + case PST_TYPE_APPOINTMENT: + if (item->appointment && m->calendar && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-appt"))) pst_process_appointment (m, item); - } - - } else if (item->type == PST_TYPE_TASK && item->appointment) { - - if (m->tasks && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-task"))) { + break; + case PST_TYPE_TASK: + if (item->appointment && m->tasks && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-task"))) pst_process_task (m, item); - } - - } else if (item->type == PST_TYPE_JOURNAL && item->appointment) { - - if (m->journal && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-journal"))) { + break; + case PST_TYPE_JOURNAL: + if (item->appointment && m->journal && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-journal"))) pst_process_journal (m, item); - } - + break; + case PST_TYPE_NOTE: + case PST_TYPE_SCHEDULE: + case PST_TYPE_REPORT: + if (item->email && GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) + pst_process_email (m, item); + break; } m->current_item++; |