[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/akonadi/exchange/connector
From:       Shaheed Haque <srhaque () theiet ! org>
Date:       2013-04-24 21:41:50
Message-ID: 20130424214150.66A20AC87A () svn ! kde ! org
[Download RAW message or body]

SVN commit 1351045 by shaheed:

Review/revise error reporting in core layer of
MapiResource.


 M  +13 -14    mapiresource.cpp  
 M  +6 -4      mapiresource.h  


--- trunk/playground/pim/akonadi/exchange/connector/mapiresource.cpp #1351044:1351045
@@ -111,10 +111,9 @@
 
     // Create the new root collection.
     MapiId rootId(m_connection, rootFolder);
-    kError() << "default folder:" << rootId.toString();
     if (!rootId.isValid())
     {
-        error(i18n("cannot find Exchange folder root"));
+        error(i18n("Cannot find folder root: %1, %2", rootId.toString(), \
mapiError()));  return;
     }
     Collection root;
@@ -126,23 +125,23 @@
     root.setContentMimeTypes(contentTypes);
     collections.append(root);
     fetchCollections(root.name(), rootId, root, collections);
-    emit status(Running, i18n("fetched collections: %1").arg(collections.size()));
+    emit status(Running, i18n("Fetched collections: %1", collections.size()));
 }
 
 void MapiResource::fetchCollections(const QString &path, const MapiId &parentId, \
const Collection &parent, Akonadi::Collection::List &collections)  {
     kDebug() << "fetch collections in:" << path << "under parent folder:" << \
parentId.toString();  
-    MapiFolder parentFolder(m_connection, "MapiResource::retrieveCollection", \
parentId); +    MapiFolder parentFolder(m_connection, __FUNCTION__, parentId);
     if (!parentFolder.open()) {
-        error(parentFolder, i18n("cannot open Exchange folder list"));
+        error(parentFolder, i18n("Cannot open folder list: %1", mapiError()));
         return;
     }
 
     QList<MapiFolder *> list;
-    emit status(Running, i18n("fetching folder list from Exchange: %1").arg(path));
+    emit status(Running, i18n("Fetching folder list: %1", path));
     if (!parentFolder.childrenPull(list, m_mapiFolderFilter)) {
-        error(parentFolder, i18n("cannot fetch folder list from Exchange"));
+        error(parentFolder, i18n("Cannot fetch folder list: %1", mapiError()));
         return;
     }
 
@@ -183,7 +182,7 @@
     QSet<MapiId> knownRemoteIds;
     QMap<MapiId, Item> knownItems;
     {
-        emit status(Running, i18n("Fetching items from Akonadi cache"));
+        emit status(Running, i18n("Fetching %1 from cache", collection.name()));
         ItemFetchJob *fetch = new ItemFetchJob( collection );
 
         Akonadi::ItemFetchScope scope;
@@ -193,7 +192,7 @@
         scope.fetchFullPayload(false);
         fetch->setFetchScope(scope);
         if ( !fetch->exec() ) {
-            error(collection, i18n("unable to fetch listing of collection: %1", \
fetch->errorString())); +            error(collection, i18n("Unable to list \
collection: %1, %2", fetch->errorString(), mapiError()));  return;
         }
         Item::List existingItems = fetch->items();
@@ -207,9 +206,9 @@
     kError() << "knownRemoteIds:" << knownRemoteIds.size();
 
     MapiId parentId(collection.remoteId());
-    MapiFolder parentFolder(m_connection, "MapiResource::retrieveItems", parentId);
+    MapiFolder parentFolder(m_connection, __FUNCTION__, parentId);
     if (!parentFolder.open()) {
-        error(collection, i18n("unable to open collection"));
+        error(collection, i18n("Unable to open collection: %1", mapiError()));
         return;
     }
 
@@ -217,7 +216,7 @@
     QList<MapiItem *> list;
     emit status(Running, i18n("Fetching collection: %1", collection.name()));
     if (!parentFolder.childrenPull(list)) {
-        error(collection, i18n("unable to fetch collection"));
+        error(collection, i18n("Unable to fetch collection: %1", mapiError()));
         return;
     }
     kError() << "fetched:" << list.size() << "items from collection:" << \
collection.name(); @@ -280,11 +279,11 @@
 
     if (!m_connected) {
         // logon to exchange (if needed)
-        emit status(Running, i18n("Logging in to Exchange as %1").arg(profileName));
+        emit status(Running, i18n("Logging in as %1").arg(profileName));
         m_connected = m_connection->login(profileName);
     }
     if (!m_connected) {
-        emit status(Broken, i18n("Unable to login as %1").arg(profileName));
+        emit status(Broken, i18n("Unable to login as %1, %2", profileName, \
mapiError()));  }
     return m_connected;
 }
--- trunk/playground/pim/akonadi/exchange/connector/mapiresource.h #1351044:1351045
@@ -130,7 +130,7 @@
 template <class Message>
 Message *MapiResource::fetchItem(const Akonadi::Item &itemOrig)
 {
-    kError() << "fetch item:" << currentCollection().name() << itemOrig.id() <<
+    kDebug() << "fetch item:" << currentCollection().name() << itemOrig.id() <<
             ", " << itemOrig.remoteId();
 
     if (!logon()) {
@@ -138,16 +138,18 @@
     }
 
     MapiId remoteId(itemOrig.remoteId());
-    Message *message = new Message(m_connection, "MapiResource::fetchItem", \
remoteId); +    Message *message = new Message(m_connection, __FUNCTION__, remoteId);
     if (!message->open()) {
-        kError() << "open failed!";
-        emit status(Broken, i18n("Unable to open item: %1/%2", \
currentCollection().name(), itemOrig.id())); +        emit status(Broken, \
i18n("Unable to open item: %1/%2, %3", currentCollection().name(), +                  \
itemOrig.id(), mapiError()));  return 0;
     }
 
     // find the remoteId of the item and the collection and try to fetch the needed \
                data from the server
     emit status(Running, i18n("Fetching item: %1/%2", currentCollection().name(), \
itemOrig.id()));  if (!message->propertiesPull()) {
+        emit status(Broken, i18n("Unable to fetch item: %1/%2, %3", \
currentCollection().name(), +                                 itemOrig.id(), \
mapiError()));  delete message;
         return 0;
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic