diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-03 17:47:46 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:42 +0800 |
commit | 9fde5c0edb566a0a6f286dfb826887c1e43051e8 (patch) | |
tree | cc2ede75f3882f63416912f4200f2e64e3925b7a | |
parent | 48c145f1f79f3a9bcaef882a2e0f5cfc4c11c022 (diff) | |
download | gsoc2013-evolution-9fde5c0edb566a0a6f286dfb826887c1e43051e8.tar gsoc2013-evolution-9fde5c0edb566a0a6f286dfb826887c1e43051e8.tar.gz gsoc2013-evolution-9fde5c0edb566a0a6f286dfb826887c1e43051e8.tar.bz2 gsoc2013-evolution-9fde5c0edb566a0a6f286dfb826887c1e43051e8.tar.lz gsoc2013-evolution-9fde5c0edb566a0a6f286dfb826887c1e43051e8.tar.xz gsoc2013-evolution-9fde5c0edb566a0a6f286dfb826887c1e43051e8.tar.zst gsoc2013-evolution-9fde5c0edb566a0a6f286dfb826887c1e43051e8.zip |
Bug #646646 - Incomplete and folder-incorrect import of pst file
-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++; |