diff options
| author | Alexey Shvetsov <alexxy@gentoo.org> | 2009-05-08 17:41:21 +0400 |
|---|---|---|
| committer | Alexey Shvetsov <alexxy@gentoo.org> | 2009-05-08 17:41:21 +0400 |
| commit | 93f23f842e1409c2ee252b180c954428f572279f (patch) | |
| tree | 9e1119b2b7fa614a18cc56a1191c2a1e23938fcb | |
| parent | 42d5d587b60bb8f5d038a67dec798b272fca4bbe (diff) | |
| download | kde-93f23f842e1409c2ee252b180c954428f572279f.tar.gz kde-93f23f842e1409c2ee252b180c954428f572279f.tar.bz2 kde-93f23f842e1409c2ee252b180c954428f572279f.zip | |
fix akonadi
(Portage version: 2.2_rc33/git/Linux x86_64)
(Signed Manifest commit)
| -rw-r--r-- | kde-base/akonadi/Manifest | 9 | ||||
| -rw-r--r-- | kde-base/akonadi/akonadi-4.2.85.ebuild | 6 | ||||
| -rw-r--r-- | kde-base/akonadi/files/akonadi-4.2.85-kolabfix.patch | 506 |
3 files changed, 9 insertions, 512 deletions
diff --git a/kde-base/akonadi/Manifest b/kde-base/akonadi/Manifest index dbae7e1746a..335b97018d0 100644 --- a/kde-base/akonadi/Manifest +++ b/kde-base/akonadi/Manifest @@ -2,11 +2,10 @@ Hash: SHA1 AUX akonadi-4.2.71-emaillineedit.patch 532 RMD160 56e123b1ea1c4fcb6342fd2e2f56d4813fc797f7 SHA1 b9605f296cbf8662473eae2f42b89f9119ccccd3 SHA256 8e57390221249e20413167859ca3ad14d7f77dab865342cdb6079a178e5f1eee -AUX akonadi-4.2.85-kolabfix.patch 20357 RMD160 a6aede01ee24b8f338cdd98be1ff85b913e9fee1 SHA1 5e429584ac65e11e70e670fbf833d6f5804716c6 SHA256 b83f6085cbeeaa6033ea2c50295ce9b2c7fb7973da743be7fbf99567f33c7161 DIST kdepim-4.2.71.tar.lzma 10992809 RMD160 2a61f3a0fcc7619b7c0635be238e7c7425df9784 SHA1 2f26b10f7e549e9d070026bb7fa3a37f12c290da SHA256 85fbbb1931c7286edcdbfa2afc1adb9f69cdbf94638bdcbb70db5c8a086c90ba DIST kdepim-4.2.85.tar.bz2 12518919 RMD160 6d6e272470cf1e5481d144ec8647450c0e412c51 SHA1 ecd08fe899ac644f7e9940f433da57e610664593 SHA256 51b02c103a4e3fd0da317f9a25c0c6bd6a3a2b0f59770dee803b803abcda099b EBUILD akonadi-4.2.71.ebuild 2252 RMD160 8ed7d1182e021c7004e68ac501c1afa9e212836b SHA1 64facc28c311c8c2935c8cc02da78c97068176bd SHA256 539f96913941b9aa573632f41a461c3c4b90e95120b11d4f6f06ee852a6880c7 -EBUILD akonadi-4.2.85.ebuild 2247 RMD160 7738e6241e7889307634a1906d7bfd547308c18c SHA1 267f61751c835f4df0d35407ebb9e3b228622c98 SHA256 7da58aab8cf6d7720196c56a24d6a5f94f5d19ef3081ba059e56885d4c202861 +EBUILD akonadi-4.2.85.ebuild 2358 RMD160 902a964e0a94403815ba25fe0e03f71e309e71cb SHA1 6cc067866fefdef785137b9249683161d9f936bf SHA256 be10f4acda73445c843f5c901985424dbfac85ccbcedeca807c0b7f7a856fbda EBUILD akonadi-4.2.9999.ebuild 1970 RMD160 7e19e948a8f9b4978422ad0fc794273c58f001da SHA1 ccef11bcc1a8245f977f3e5506b9c237103b56ee SHA256 14e12997fd571c27a66b1e7c678299adf40a777aa03f10fc93421e3f63f2927f EBUILD akonadi-9999.ebuild 2185 RMD160 6637ef5eaca52ed5945fc9ae1e0f7f2375981ddc SHA1 90581e2cff422dba28e6a4eb87080af136d1731d SHA256 004c4bb527bad18b886bca3affb0a6bb8050ee700d6ce9faff1050290cb76ff4 MISC ChangeLog 8837 RMD160 a45523f4e26c5dc3b3e3028fcd17f9b77fa330a9 SHA1 7c8168bbcf79b24833c48e4086425756079406c7 SHA256 e917d6c716b419de0aa14b1b47691737acca4e6186dbcfdb6508e863e4bd8748 @@ -14,7 +13,7 @@ MISC metadata.xml 255 RMD160 cc252d52dc3af272430aacb18e2295e5a8a6bc87 SHA1 02a40 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (GNU/Linux) -iEYEARECAAYFAkoELpoACgkQ5BmOA85PVLhLDwCeMvhk+CkLjoTxBgc5nGiIR953 -WvUAnjEzz5zy2JyXDXNSwuBZqS8GR439 -=CK0T +iEYEARECAAYFAkoENoEACgkQ5BmOA85PVLgjRgCgm1KyC1Cu6N/eRrSXrNtymtsV +eR0An0BrEiy+bb2t47Y4wMveJtMfJu7V +=aTwC -----END PGP SIGNATURE----- diff --git a/kde-base/akonadi/akonadi-4.2.85.ebuild b/kde-base/akonadi/akonadi-4.2.85.ebuild index 47fcf6b4056..89206cda9b0 100644 --- a/kde-base/akonadi/akonadi-4.2.85.ebuild +++ b/kde-base/akonadi/akonadi-4.2.85.ebuild @@ -38,7 +38,11 @@ src_prepare() { akonadi/resources/CMakeLists.txt\ || die "Failed to disable nepomuktag" fi - epatch "${FILESDIR}/akonadi-4.2.85-kolabfix.patch" + # disable broken by upstream kolab + sed -i -e "s/add_subdirectory( kolabproxy )//"\ + akonadi/resources/CMakeLists.txt\ + || die "Failed to disable kolabproxy" + kde4-meta_src_prepare } diff --git a/kde-base/akonadi/files/akonadi-4.2.85-kolabfix.patch b/kde-base/akonadi/files/akonadi-4.2.85-kolabfix.patch deleted file mode 100644 index ebca33fd39b..00000000000 --- a/kde-base/akonadi/files/akonadi-4.2.85-kolabfix.patch +++ /dev/null @@ -1,506 +0,0 @@ ---- trunk/KDE/kdepim/akonadi/resources/kolabproxy/CMakeLists.txt 2009/05/06 16:21:54 964415 -+++ trunk/KDE/kdepim/akonadi/resources/kolabproxy/CMakeLists.txt 2009/05/06 16:23:56 964416 -@@ -14,6 +14,8 @@ - kolabproxyresource.cpp - contact.cpp - kolabbase.cpp -+ kolabhandler.cpp -+ addressbookhandler.cpp - ${AKONADI_COLLECTIONATTRIBUTES_SHARED_SOURCES} - ) - ---- trunk/KDE/kdepim/akonadi/resources/kolabproxy/kolabproxyresource.cpp 2009/05/06 16:21:54 964415 -+++ trunk/KDE/kdepim/akonadi/resources/kolabproxy/kolabproxyresource.cpp 2009/05/06 16:23:56 964416 -@@ -21,8 +21,8 @@ - - #include "settings.h" - #include "settingsadaptor.h" --#include "contact.h" - #include "collectionannotationsattribute.h" -+#include "addressbookhandler.h" - #include <akonadi/attributefactory.h> - - #include <akonadi/collectioncreatejob.h> -@@ -36,8 +36,6 @@ - #include <akonadi/monitor.h> - #include <akonadi/item.h> - #include <akonadi/changerecorder.h> --#include <kabc/addressee.h> --#include <krandom.h> - - #include <QtDBus/QDBusConnection> - #include <QSet> -@@ -47,25 +45,25 @@ - KolabProxyResource::KolabProxyResource( const QString &id ) - : ResourceBase( id ) - { -- Akonadi::AttributeFactory::registerAttribute<CollectionAnnotationsAttribute>(); -+ AttributeFactory::registerAttribute<CollectionAnnotationsAttribute>(); - - new SettingsAdaptor( Settings::self() ); - QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ), - Settings::self(), QDBusConnection::ExportAdaptors ); - -- m_monitor = new Akonadi::Monitor(); -- Akonadi::ItemFetchScope scope; -+ m_monitor = new Monitor(); -+ ItemFetchScope scope; - scope.fetchFullPayload(); - m_monitor->setItemFetchScope(scope); - -- m_colectionMonitor = new Akonadi::Monitor(); -+ m_colectionMonitor = new Monitor(); - m_colectionMonitor->setCollectionMonitored(Collection::root()); - -- connect(m_monitor, SIGNAL(itemAdded(const Akonadi::Item & , const Akonadi::Collection &)), this, SLOT(imapItemAdded(const Akonadi::Item & , const Akonadi::Collection &))); -- connect(m_monitor, SIGNAL(itemRemoved(const Akonadi::Item &)), this, SLOT(imapItemRemoved(const Akonadi::Item &))); -- connect(m_colectionMonitor, SIGNAL(collectionAdded(const Akonadi::Collection &, const Akonadi::Collection &)), this, SLOT(imapCollectionAdded(const Akonadi::Collection &, const Akonadi::Collection &))); -- connect(m_colectionMonitor, SIGNAL(collectionRemoved(const Akonadi::Collection &)), this, SLOT(imapCollectionRemoved(const Akonadi::Collection &))); -- connect(m_colectionMonitor, SIGNAL(collectionChanged(const Akonadi::Collection &)), this, SLOT(imapCollectionChanged(const Akonadi::Collection &))); -+ connect(m_monitor, SIGNAL(itemAdded(const Item & , const Collection &)), this, SLOT(imapItemAdded(const Item & , const Collection &))); -+ connect(m_monitor, SIGNAL(itemRemoved(const Item &)), this, SLOT(imapItemRemoved(const Item &))); -+ connect(m_colectionMonitor, SIGNAL(collectionAdded(const Collection &, const Collection &)), this, SLOT(imapCollectionAdded(const Collection &, const Collection &))); -+ connect(m_colectionMonitor, SIGNAL(collectionRemoved(const Collection &)), this, SLOT(imapCollectionRemoved(const Collection &))); -+ connect(m_colectionMonitor, SIGNAL(collectionChanged(const Collection &)), this, SLOT(imapCollectionChanged(const Collection &))); - - } - -@@ -84,10 +82,11 @@ - collection.attribute<CollectionAnnotationsAttribute>(); - if (annotationsAttribute) { - QMap<QByteArray, QByteArray> annotations = annotationsAttribute->annotations(); -- if (annotations["/vendor/kolab/folder-type"] == "contact.default" || annotations["/vendor/kolab/folder-type"] == "contact") { -+ KolabHandler *handler = KolabHandler::createHandler(annotations["/vendor/kolab/folder-type"]); -+ if (handler) { - kDebug() << "Monitor folder: " << collection.name() << collection.remoteId(); - m_monitor->setCollectionMonitored(collection); -- m_monitoredCollections.append(collection.id()); -+ m_monitoredCollections.insert(collection.id(), handler); - } - } - } -@@ -102,25 +101,35 @@ - } - } - --void KolabProxyResource::retrieveItems( const Akonadi::Collection &collection ) -+void KolabProxyResource::retrieveItems( const Collection &collection ) - { - kDebug() << "RETRIEVEITEMS"; -- Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( Collection(collection.remoteId().toUInt()) ); -+ ItemFetchJob *job = new ItemFetchJob( Collection(collection.remoteId().toUInt()) ); - job->fetchScope().fetchFullPayload(); - if (job->exec()) { -- Akonadi::Item::List items = job->items(); -- createAddressEntry(items); -+ Item::List items = job->items(); -+ KolabHandler *handler = m_monitoredCollections.value(collection.remoteId().toUInt()); -+ if (handler) { -+ Item::List newItems = handler->translateItems(items); -+ itemsRetrieved(newItems); -+ } - } - } - --bool KolabProxyResource::retrieveItem( const Akonadi::Item &item, const QSet<QByteArray> &parts ) -+bool KolabProxyResource::retrieveItem( const Item &item, const QSet<QByteArray> &parts ) - { - kDebug() << "RETRIEVEITEM"; -- Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item ); -+ ItemFetchJob *job = new ItemFetchJob( item ); - job->fetchScope().fetchFullPayload(); -+ Item::Id collectionId = -1; - if (job->exec()) { -- Akonadi::Item::List items = job->items(); -- createAddressEntry(items); -+ Item::List items = job->items(); -+ collectionId = items[0].collectionId(); -+ KolabHandler *handler = m_monitoredCollections.value(collectionId); -+ if (handler) { -+ Item::List newItems = handler->translateItems(items); -+ itemsRetrieved(newItems); -+ } - } - return true; - } -@@ -143,10 +152,10 @@ - // of focus stealing prevention technique - } - --void KolabProxyResource::itemAdded( const Akonadi::Item &_item, const Akonadi::Collection &collection ) -+void KolabProxyResource::itemAdded( const Item &_item, const Collection &collection ) - { - -- Akonadi::Item item(_item); -+ Item item(_item); - // kDebug() << "Item added " << item.id() << collection.remoteId() << collection.id(); - Collection c; - CollectionFetchJob *coljob = new CollectionFetchJob( Collection::List() << collection ); -@@ -164,11 +173,11 @@ - kWarning() << "Can't fetch collection" << imapCollection.id(); - } - -- Akonadi::Item addrItem; -- Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item ); -+ Item addrItem; -+ ItemFetchJob *job = new ItemFetchJob( item ); - job->fetchScope().fetchFullPayload(); - if (job->exec()) { -- Akonadi::Item::List items = job->items(); -+ Item::List items = job->items(); - if (items.isEmpty()) { - kDebug() << "Empty fecth"; - return; -@@ -179,57 +188,14 @@ - kWarning() << "Can't fetch address item " << item.id(); - } - -- KABC::Addressee addressee = addrItem.payload<KABC::Addressee>(); -- Kolab::Contact contact(&addressee, 0); -- Item imapItem; -- imapItem.setMimeType( "message/rfc822" ); -- MessagePtr message(new KMime::Message); -- QString header; -- header += "From: " + addressee.fullEmail() + "\n"; -- header += "Subject: " + addressee.uid() + "\n"; --// header += "Date: " + QDateTime::currentDateTime().toString(Qt::ISODate) + "\n"; -- header += "User-Agent: Akonadi Kolab Proxy Resource \n"; -- header += "MIME-Version: 1.0\n"; -- header += "X-Kolab-Type: application/x-vnd.kolab.contact\n\n\n"; -- message->setContent(header.toLatin1()); -- -- KMime::Content *content = new KMime::Content(); -- QByteArray contentData = QByteArray("Content-Type: text/plain; charset=\"us-ascii\"\nContent-Transfer-Encoding: 7bit\n\n") + -- "This is a Kolab Groupware object.\n" + -- "To view this object you will need an email client that can understand the Kolab Groupware format.\n" + -- "For a list of such email clients please visit\n" -- "http://www.kolab.org/kolab2-clients.html\n"; -- content->setContent(contentData); -- message->addContent(content); -- -- content = new KMime::Content(); -- header = "Content-Type: application/x-vnd.kolab.contact; name=\"kolab.xml\"\n"; -- header += "Content-Transfer-Encoding: 7bit\n"; //FIXME 7bit??? -- header += "Content-Disposition: attachment; filename=\"kolab.xml\""; -- content->setHead(header.toLatin1()); -- content->setBody(contact.saveXML().toUtf8()); -- message->addContent(content); -- -- if (!contact.pictureAttachmentName().isEmpty()) { -- header = "Content-Type: image/png; name=\"kolab-picture.png\"\n"; -- header += "Content-Transfer-Encoding: base64\n"; -- header += "Content-Disposition: attachment; filename=\"kolab-picture.png\""; -- content = new KMime::Content(); -- content->setHead(header.toLatin1()); -- QByteArray pic; -- QBuffer buffer(&pic); -- buffer.open(QIODevice::WriteOnly); -- contact.picture().save(&buffer, "PNG"); -- buffer.close(); -- content->setBody(pic.toBase64()); -- message->addContent(content); -- -+ KolabHandler *handler = m_monitoredCollections.value(imapCollection.id()); -+ if (!handler) { -+ kWarning() << "No handler found"; -+ return; - } -- -- imapItem.setPayload<MessagePtr>(message); -- -- -- Akonadi::ItemCreateJob *cjob = new Akonadi::ItemCreateJob(imapItem, imapCollection); -+ Item imapItem = handler->toKolabFormat(addrItem); -+ -+ ItemCreateJob *cjob = new ItemCreateJob(imapItem, imapCollection); - if (!cjob->exec()) { - kWarning() << "Can't create imap item " << imapItem.id() << cjob->errorString(); - } -@@ -241,48 +207,51 @@ - changeCommitted( addrItem ); - } - --void KolabProxyResource::itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &parts ) -+void KolabProxyResource::itemChanged( const Item &item, const QSet<QByteArray> &parts ) - { -- Akonadi::Item addrItem; -- Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item ); -+ Item addrItem; -+ ItemFetchJob *job = new ItemFetchJob( item ); - job->fetchScope().fetchFullPayload(); - if (job->exec()) { -- Akonadi::Item::List items = job->items(); -+ Item::List items = job->items(); - addrItem = items[0]; - } else { - kWarning() << "Can't fetch address item " << item.id(); - } -+ - Item imapItem; -- KABC::Addressee addressee = addrItem.payload<KABC::Addressee>(); -- job = new Akonadi::ItemFetchJob( Item(addrItem.remoteId().toUInt()) ); -+ job = new ItemFetchJob( Item(addrItem.remoteId().toUInt()) ); - job->fetchScope().fetchFullPayload(); - if (job->exec()) { -- Akonadi::Item::List items = job->items(); -+ Item::List items = job->items(); - imapItem = items[0]; - } else { - kWarning() << "Can't fetch imap item " << addrItem.remoteId(); - } -- MessagePtr message = imapItem.payload<MessagePtr>(); -- KMime::Content *xmlContent = findContent(message, "application/x-vnd.kolab.contact"); -- if (xmlContent) { -- Kolab::Contact contact(&addressee, 0); -- xmlContent->setBody(contact.saveXML().toUtf8()); -- Akonadi::ItemModifyJob *mjob = new Akonadi::ItemModifyJob( imapItem ); -+ -+ KolabHandler *handler = m_monitoredCollections.value(imapItem.collectionId()); -+ if (!handler) { -+ kWarning() << "No handler found"; -+ return; -+ } -+ -+ imapItem = handler->toKolabFormat(addrItem); -+ ItemModifyJob *mjob = new ItemModifyJob( imapItem ); - if (!mjob->exec()) { - kWarning() << "Can't modify imap item " << imapItem.id(); - } -- } -+ - changeCommitted( addrItem ); - - } - --void KolabProxyResource::itemRemoved( const Akonadi::Item &item ) -+void KolabProxyResource::itemRemoved( const Item &item ) - { - kDebug() << "Item removed " << item.id() << item.remoteId(); - Item imapItem(item.remoteId().toUInt()); -- Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( imapItem ); -+ ItemFetchJob *job = new ItemFetchJob( imapItem ); - if (job->exec()) { -- Akonadi::Item::List items = job->items(); -+ Item::List items = job->items(); - imapItem = items[0]; - } else { - kWarning() << "Can't fetch imap item " << imapItem.id(); -@@ -292,7 +261,7 @@ - Q_UNUSED(djob); - } - --void KolabProxyResource::imapItemAdded(const Akonadi::Item& item, const Akonadi::Collection &collection) -+void KolabProxyResource::imapItemAdded(const Item& item, const Collection &collection) - { - kDebug() << "imapItemAdded " << item.id() << collection.id() << Collection::root().id(); - if (m_excludeAppend.contains(item.id())) { -@@ -320,15 +289,17 @@ - break; - } - } -- KABC::Addressee addressee; -- MessagePtr message = m_items[job].payload<MessagePtr>(); -- if (addresseFromKolab(message, addressee)) { -- Item newItem("text/directory"); -- kDebug() << "m_item " << m_items[job].id(); -- newItem.setRemoteId(QString::number(m_items[job].id())); -- newItem.setPayload(addressee); -- Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob( newItem, c ); -- connect(job, SIGNAL(result(KJob*)), this, SLOT(itemCreatedDone(KJob *))); -+ -+ KolabHandler *handler = m_monitoredCollections.value(c.remoteId().toUInt()); -+ if (!handler) { -+ kWarning() << "No handler found"; -+ return; -+ } -+ -+ Item::List newItems = handler->translateItems(Item::List() << m_items[job]); -+ if (!newItems.isEmpty()) { -+ ItemCreateJob *cjob = new ItemCreateJob( newItems[0], c ); -+ connect(cjob, SIGNAL(result(KJob*)), this, SLOT(itemCreatedDone(KJob *))); - } - } - m_ids.remove(job); -@@ -343,7 +314,7 @@ - } - } - --void KolabProxyResource::imapItemRemoved(const Akonadi::Item& item) -+void KolabProxyResource::imapItemRemoved(const Item& item) - { - Item addr; - addr.setRemoteId(QString::number(item.id())); -@@ -351,7 +322,7 @@ - Q_UNUSED(job); - } - --void KolabProxyResource::imapCollectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) -+void KolabProxyResource::imapCollectionAdded(const Collection &collection, const Collection &parent) - { - if (m_monitoredCollections.contains(collection.id())) - return; -@@ -368,17 +339,19 @@ - imapCollection.attribute<CollectionAnnotationsAttribute>(); - if (annotationsAttribute) { - QMap<QByteArray, QByteArray> annotations = annotationsAttribute->annotations(); -- if (annotations["/vendor/kolab/folder-type"] == "contact.default" || annotations["/vendor/kolab/folder-type"] == "contact") { -- kDebug() << "Monitor folder: " << imapCollection.name() << imapCollection.remoteId(); -+ -+ KolabHandler *handler = KolabHandler::createHandler(annotations["/vendor/kolab/folder-type"]); -+ if (handler) { - m_monitor->setCollectionMonitored(imapCollection); -- m_monitoredCollections.append(imapCollection.id()); -+ m_monitoredCollections.insert(imapCollection.id(), handler); - Collection c = createCollection(imapCollection); - new CollectionCreateJob(c); -+ - } - } - } - --void KolabProxyResource::imapCollectionRemoved(const Akonadi::Collection &collection) -+void KolabProxyResource::imapCollectionRemoved(const Collection &collection) - { - Collection c; - CollectionFetchJob *job = new CollectionFetchJob( Collection::root(), CollectionFetchJob::Recursive ); -@@ -396,11 +369,13 @@ - return; - } - -- m_monitoredCollections.removeAll(collection.id()); -- CollectionDeleteJob *djob = new CollectionDeleteJob(c); -+ KolabHandler *handler = m_monitoredCollections.value(collection.id()); -+ delete handler; -+ m_monitoredCollections.remove(collection.id()); -+ new CollectionDeleteJob(c); - } - --void KolabProxyResource::imapCollectionChanged(const Akonadi::Collection &collection) -+void KolabProxyResource::imapCollectionChanged(const Collection &collection) - { - // kDebug() << "imapCollectionChanged" << collection.id(); - if (m_monitoredCollections.contains(collection.id())) -@@ -418,72 +393,18 @@ - imapCollection.attribute<CollectionAnnotationsAttribute>(); - if (annotationsAttribute) { - QMap<QByteArray, QByteArray> annotations = annotationsAttribute->annotations(); -- if (annotations["/vendor/kolab/folder-type"] == "contact.default" || annotations["/vendor/kolab/folder-type"] == "contact") { -- kDebug() << "Monitor folder: " << imapCollection.name() << imapCollection.remoteId(); -+ KolabHandler *handler = KolabHandler::createHandler(annotations["/vendor/kolab/folder-type"]); -+ if (handler) { - m_monitor->setCollectionMonitored(imapCollection); -- m_monitoredCollections.append(imapCollection.id()); -+ m_monitoredCollections.insert(imapCollection.id(), handler); - Collection c = createCollection(imapCollection); - new CollectionCreateJob(c); -+ - } - } - } - --bool KolabProxyResource::addresseFromKolab(MessagePtr data, KABC::Addressee &addressee) --{ -- KMime::Content *xmlContent = findContent(data, "application/x-vnd.kolab.contact"); -- if (xmlContent) { -- QByteArray xmlData = xmlContent->decodedContent(); --// kDebug() << "xmlData " << xmlData; -- Kolab::Contact contact(QString::fromLatin1(xmlData)); -- QString pictureAttachmentName = contact.pictureAttachmentName(); -- if (!pictureAttachmentName.isEmpty()) { -- KMime::Content *imgContent = findContent(data, "image/png"); -- if (imgContent) { -- QByteArray imgData = imgContent->decodedContent(); -- QBuffer buffer(&imgData); -- buffer.open(QIODevice::ReadOnly); -- QImage image; -- image.load(&buffer, "PNG"); -- contact.setPicture(image); -- } -- } -- contact.saveTo(&addressee); -- return true; -- } -- return false; --} -- --void KolabProxyResource::createAddressEntry(const Akonadi::Item::List & addrs) --{ -- Akonadi::Item::List items; -- Q_FOREACH(Akonadi::Item addr, addrs) -- { --// kDebug() << addr.id(); -- MessagePtr payload = addr.payload<MessagePtr>(); -- KABC::Addressee addressee; -- if (addresseFromKolab(payload, addressee)) { -- Item item("text/directory"); -- item.setRemoteId(QString::number(addr.id())); -- item.setPayload(addressee); -- items << item; -- } -- } -- itemsRetrieved(items); --} -- --KMime::Content *KolabProxyResource::findContent(MessagePtr data, const QByteArray &type) --{ -- KMime::Content::List list = data->contents(); -- Q_FOREACH(KMime::Content *c, list) -- { -- if (c->contentType()->mimeType() == type) -- return c; -- } -- return 0L; -- --} -- --Akonadi::Collection KolabProxyResource::createCollection(const Akonadi::Collection& imapCollection) -+Collection KolabProxyResource::createCollection(const Collection& imapCollection) - { - Collection c; - c.setParent( Collection::root() ); ---- trunk/KDE/kdepim/akonadi/resources/kolabproxy/kolabproxyresource.h 2009/05/06 16:21:54 964415 -+++ trunk/KDE/kdepim/akonadi/resources/kolabproxy/kolabproxyresource.h 2009/05/06 16:23:56 964416 -@@ -22,18 +22,13 @@ - - #include <akonadi/resourcebase.h> - #include <QStringList> --#include <boost/shared_ptr.hpp> --#include <kmime/kmime_message.h> --typedef boost::shared_ptr<KMime::Message> MessagePtr; - - - namespace Akonadi { - class Monitor; - } - --namespace KABC{ -- class Addressee; --} -+class KolabHandler; - - class KolabProxyResource : public Akonadi::ResourceBase, - public Akonadi::AgentBase::Observer -@@ -56,7 +51,6 @@ - void imapCollectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent); - void imapCollectionRemoved(const Akonadi::Collection &collection); - void imapCollectionChanged(const Akonadi::Collection &collection); -- void createAddressEntry(const Akonadi::Item::List & addrs); - void itemCreatedDone(KJob *job); - void collectionFetchDone(KJob *job); - -@@ -66,14 +60,12 @@ - virtual void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ); - virtual void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &parts ); - virtual void itemRemoved( const Akonadi::Item &item ); -- bool addresseFromKolab(MessagePtr data, KABC::Addressee &addressee); - Akonadi::Collection createCollection(const Akonadi::Collection& imapCollection); -- KMime::Content *findContent(MessagePtr data, const QByteArray &type); - - Akonadi::Monitor *m_monitor; - Akonadi::Monitor *m_colectionMonitor; - QStringList m_managedCollections; -- QList<Akonadi::Item::Id> m_monitoredCollections; -+ QMap<Akonadi::Item::Id, KolabHandler*> m_monitoredCollections; - QMap<KJob*, QString> m_ids; - QMap<KJob*, Akonadi::Item> m_items; - QList<Akonadi::Item::Id> m_excludeAppend; |
