contentstorage/caclient/src/caservice.cpp
changeset 127 7b66bc3c6dc9
parent 125 26079c1bb561
--- a/contentstorage/caclient/src/caservice.cpp	Wed Oct 13 12:59:22 2010 +0300
+++ b/contentstorage/caclient/src/caservice.cpp	Mon Oct 18 10:44:15 2010 +0300
@@ -83,9 +83,7 @@
  Proxy to client notifier.
  */
 
-namespace Hs {
-    const char packageTypeName[] = "package";
-}
+const char packageTypeName[] = "package";
 
 // Initialization of a static member variable.
 QWeakPointer<CaService> CaService::m_instance = QWeakPointer<CaService>();
@@ -911,11 +909,11 @@
 }
 
 /*!
-    Set new order of collection's items set by user.
-    \groupId Group id.
-    \param entryIdList consists of new order of items.
-    \retval true if new order of collection's items is set correctly,
-     otherwise return false.
+ Set new order of collection's items set by user.
+ \groupId Group id.
+ \param entryIdList consists of new order of items.
+ \retval true if new order of collection's items is set correctly,
+ otherwise return false.
  */
 
 bool CaService::customSort(int groupId, QList<int> &entryIdList) const
@@ -924,6 +922,24 @@
 }
 
 /*!
+ Initiate preloading of handlers during the idle time
+ (when there is no events to handle).
+ The following handlers would be loaded:
+ CaAppHandler, CaTappHandler, CaUrlHandler.
+
+ \example
+ \code
+ ...
+ CaService::instance()->preloadHandlers();
+ ...
+ \endcode
+ */
+void CaService::preloadHandlers() const
+{
+    m_d->preloadHandlers();
+}
+
+/*!
  Returns code of an error caused by the last executed operation.
  \retval code of error, zero means no error.
 
@@ -1130,7 +1146,7 @@
     if (entry.flags() & RemovableEntryFlag &&
         (entry.flags() & UsedEntryFlag) == 0 &&
         entry.role() == ItemEntryRole &&
-        entry.entryTypeName() != QString(Hs::packageTypeName)) {
+        entry.entryTypeName() != QString(packageTypeName)) {
            
         mErrorCode = mProxy->touch(entry);
         if (mErrorCode == ServerTerminated) {
@@ -1347,12 +1363,12 @@
 }
 
 /*!
- Executes command on entry (fe. "open", "remove")
- \param const reference to an entry on which command will be issued
- \param string containing a command
- \param receiver QObject with slot
- \param member slot from QObject
- \retval int which is used as an error code return value, 0 means no errors
+ Executes command on entry (eg. "open", "remove").
+ \param const reference to an entry on which command will be issued.
+ \param string containing a command.
+ \param receiver QObject with slot.
+ \param member slot from QObject.
+ \retval int which is used as an error code return value, 0 means no errors.
  */
 int CaServicePrivate::executeCommand(const CaEntry &entry,
                                       const QString &command,
@@ -1370,18 +1386,19 @@
     
     int errorCode = mCommandHandler->execute(entry, 
             command, receiver, member);
-    mErrorCode = CaObjectAdapter::convertErrorCode(errorCode);
     
     if (command == caCmdOpen) {
         touch(entry);
     }
 
+    mErrorCode = CaObjectAdapter::convertErrorCode(errorCode);
+    
     qDebug() << "CaServicePrivate::executeCommand mErrorCode on return:"
              << mErrorCode;
 
     CACLIENTTEST_FUNC_EXIT("CaServicePrivate::executeCommand");
 
-    return errorCode;
+    return mErrorCode;
 }
 
 /*!
@@ -1423,6 +1440,14 @@
 }
 
 /*!
+     Preload handlers during the idle time.
+ */
+void CaServicePrivate::preloadHandlers() const
+{
+    mCommandHandler->preloadHandlers();
+}
+
+/*!
  Returns code of an error caused by the last executed operation.
  \retval code of error, zero means no error.
  */