summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2012-10-25 20:29:41 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2012-10-25 20:29:41 (GMT)
commit3df855466673f66ca8b5df233f55cded971d5c9a (patch)
tree4631d1db9d4188095b55ef23e49dda4762807270
parentf2ea19436fb179c6c3c0babcf46ffb9e705b8618 (diff)
downloadkolab-utils-3df855466673f66ca8b5df233f55cded971d5c9a.tar.gz
Migrate journals as well, test mail migration.
-rw-r--r--migrationutility/sourceaccount.cpp6
-rw-r--r--migrationutility/tests/exchangeimaptest.cpp21
2 files changed, 22 insertions, 5 deletions
diff --git a/migrationutility/sourceaccount.cpp b/migrationutility/sourceaccount.cpp
index 9fc29af..96f1d11 100644
--- a/migrationutility/sourceaccount.cpp
+++ b/migrationutility/sourceaccount.cpp
@@ -237,6 +237,8 @@ QPair<Kolab::ObjectType, KMime::Content*> ExchangeIMAPSourceAccount::getObjectTy
return QPair<Kolab::ObjectType, KMime::Content*>(Kolab::EventObject, c);
} else if (!calendar->todos().isEmpty()) {
return QPair<Kolab::ObjectType, KMime::Content*>(Kolab::TodoObject, c);
+ } else if (!calendar->journals().isEmpty()) {
+ return QPair<Kolab::ObjectType, KMime::Content*>(Kolab::JournalObject, c);
}
}
if (c->contentType()->mimeType() == vcardType) {
@@ -260,6 +262,9 @@ Kolab::FolderType ExchangeIMAPSourceAccount::getFolderType(const QString &folder
if (type == Kolab::TodoObject) {
return Kolab::TaskType;
}
+ if (type == Kolab::JournalObject) {
+ return Kolab::JournalType;
+ }
if (type == Kolab::ContactObject) {
return Kolab::ContactType;
}
@@ -269,7 +274,6 @@ Kolab::FolderType ExchangeIMAPSourceAccount::getFolderType(const QString &folder
QPair<Kolab::FolderType, QString> ExchangeIMAPSourceAccount::translateFolder(const QString& folder)
{
- //Fetch items and check first item for type
return QPair<Kolab::FolderType, QString>(getFolderType(folder), folder);
}
diff --git a/migrationutility/tests/exchangeimaptest.cpp b/migrationutility/tests/exchangeimaptest.cpp
index 33d8012..93fe80a 100644
--- a/migrationutility/tests/exchangeimaptest.cpp
+++ b/migrationutility/tests/exchangeimaptest.cpp
@@ -148,7 +148,20 @@ class ExchangeIMAPTest: public QObject
targetObject.message = Kolab::KolabObjectWriter::writeContact(addressee);
targetObject.flags << QByteArray("\\Seen");
return QPair<Object,Object>(calObj1, targetObject);
+ }
+ Object createMail(const QString &subject)
+ {
+ KMime::Message::Ptr msg(new KMime::Message);
+ msg->userAgent()->from7BitString( "exchangeimaptest" );
+ msg->contentType()->setMimeType( "multipart/mixed" );
+ msg->contentType()->setBoundary( KMime::multiPartBoundary() );
+ msg->subject()->fromUnicodeString( subject, "utf-8" );
+ msg->assemble();
+ Object targetObject;
+ targetObject.message = msg;
+ targetObject.flags << QByteArray("\\Seen");
+ return targetObject;
}
public:
@@ -161,20 +174,20 @@ public:
adminpw("admin"),
port(143)
{
- folders << Folder("INBOX");
+ folders << Folder("INBOX", Kolab::MailType, QList<Object>() << createMail("subject"));
folders << Folder("Calendar", Kolab::MailType, QList<Object>() << createEvent("uid1").first);
folders << Folder("Tasks", Kolab::MailType, QList<Object>() << createTodo("uid2").first);
folders << Folder("Contacts", Kolab::MailType, QList<Object>() << createContact("John Doe").first);
- folders << Folder("Drafts");
+ folders << Folder("Drafts", Kolab::MailType, QList<Object>() << createMail("subject2"));
folders << Folder("Sent");
folders << Folder("Trash");
- targetFolders << Folder("INBOX");
+ targetFolders << Folder("INBOX", Kolab::MailType, QList<Object>() << createMail("subject"));
targetFolders << Folder("Calendar", Kolab::EventType, QList<Object>() << createEvent("uid1").second);
// targetFolders << Folder("Calendar/Personal Calendar", Kolab::EventType, QList<Object>() << createEvent("uid2"));
targetFolders << Folder("Configuration", Kolab::ConfigurationType);
targetFolders << Folder("Contacts", Kolab::ContactType, QList<Object>() << createContact("John Doe").second);
- targetFolders << Folder("Drafts");
+ targetFolders << Folder("Drafts", Kolab::MailType, QList<Object>() << createMail("subject2"));
targetFolders << Folder("Journal", Kolab::JournalType);
targetFolders << Folder("Notes", Kolab::NoteType);
targetFolders << Folder("Sent");