emailuis/nmailuiengine/src/nmbaseclientplugin.cpp
changeset 30 759dc5235cdb
parent 27 9ba4404ef423
child 66 084b5b1f02a7
--- a/emailuis/nmailuiengine/src/nmbaseclientplugin.cpp	Thu May 27 12:43:55 2010 +0300
+++ b/emailuis/nmailuiengine/src/nmbaseclientplugin.cpp	Fri Jun 11 13:27:14 2010 +0300
@@ -104,9 +104,9 @@
 mViewerToolBarRequest(NULL),
 mViewerViewRequest(NULL)
 {
-    NMLOG("NmBaseClientPlugin::NmBaseClientPlugin()-->");
+    NM_FUNCTION;
+    
     mUiEngine = NmUiEngine::instance();
-    NMLOG("<--NmBaseClientPlugin::NmBaseClientPlugin()");
 }
 
 /*!
@@ -114,27 +114,29 @@
 */
 NmBaseClientPlugin::~NmBaseClientPlugin()
 {
-    NMLOG("NmBaseClientPlugin::~NmBaseClientPlugin()-->");
+    NM_FUNCTION;
+    
     NmUiEngine::releaseInstance(mUiEngine);
     mUiEngine = NULL;
-    NMLOG("<--NmBaseClientPlugin::~NmBaseClientPlugin()");
 }
 
+
 /*!
-    Provides list of supported NmActions.
+    Provides a list of supported NmActions.
     Implementation of NmUiExtensionInterface.
+
     Parameter \a request controls list of request services.
     Parameter \a actionList is updated by supported NmActions.
 */
-void NmBaseClientPlugin::getActions(
-      const NmActionRequest &request,
-      QList<NmAction *> &actionList)
+void NmBaseClientPlugin::getActions(const NmActionRequest &request,
+                                    QList<NmAction *> &actionList)
 {
-    NMLOG("NmBaseClientPlugin::getActions()-->");
-
+    NM_FUNCTION;
+    
     if (request.observer()) {
         switch (request.contextView()) {
             case NmActionContextViewMessageList:
+            case NmActionContextViewMessageSearchList:
             {
                 createMessageListCommands(request, actionList);
                 break;
@@ -151,30 +153,28 @@
             }
             default:
             {
-                NMLOG(QString("NmBaseClientPlugin::getActions(): Unknown contextView()=%1").arg(request.contextView()));
+                NM_COMMENT(QString("NmBaseClientPlugin::getActions(): unknown contextView()=%1").arg(request.contextView()));
                 break;
             }
         }
     }
-    NMLOG("<--NmBaseClientPlugin::getActions()");
 }
 
+
 /*!
     Public slot connected to options menu refresh NmAction.
     Refreshes mailbox using the NmUiEngine instance.
 */
 void NmBaseClientPlugin::refresh()
 {
-    NMLOG("NmBaseClientPlugin::refresh()-->");
-
+    NM_FUNCTION;
+    
     int err = mUiEngine->refreshMailbox(mMenuRequest.mailboxId());
 
     if (NmNoError != err) {
         // Failed to refresh the mailbox!
-        NMLOG(QString("NmBaseClientPlugin::refresh(): failed err=%1").arg(err));
+        NM_ERROR(1,QString("NmBaseClientPlugin::refresh(): failed err=%1").arg(err));
     }
-
-    NMLOG("<--NmBaseClientPlugin::refresh()");
 }
 
 /*!
@@ -183,6 +183,8 @@
 */
 void NmBaseClientPlugin::openMessage()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandOpen, mMenuRequest);
 }
 
@@ -191,8 +193,8 @@
 */
 void NmBaseClientPlugin::deleteMessage()
 {
-    NMLOG("NmBaseClientPlugin::deleteMessage()-->");
-
+    NM_FUNCTION;
+    
     QList<NmId> messageList;
     messageList.append(mMenuRequest.messageId());
 
@@ -201,10 +203,9 @@
                                         messageList);
     if (NmNoError != err) {
         // Failed to delete the messages!
-        NMLOG(QString("NmBaseClientPlugin::deleteMessage(): failed err=%1").arg(err));
+        NM_ERROR(1,QString("NmBaseClientPlugin::deleteMessage(): failed err=%1").arg(err));
     }
     messageList.clear();
-    NMLOG("<--NmBaseClientPlugin::deleteMessage()");
 }
 
 /*!
@@ -213,6 +214,8 @@
 */
 void NmBaseClientPlugin::deleteMessageFromViewerView()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandDeleteMail, mViewerViewRequest);
 }
 
@@ -222,6 +225,8 @@
 */
 void NmBaseClientPlugin::createNewMailViewerToolBar()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandNewMail, mViewerToolBarRequest);
 }
 
@@ -231,6 +236,8 @@
 */
 void NmBaseClientPlugin::createNewMail()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandNewMail, mMenuRequest);
 }
 
@@ -240,6 +247,8 @@
 */
 void NmBaseClientPlugin::settings()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandSettings, mMenuRequest);
 }
 
@@ -249,6 +258,8 @@
 */
 void NmBaseClientPlugin::sendMail()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandSendMail, mEditorToolBarRequest);
 }
 
@@ -259,6 +270,8 @@
 
 void NmBaseClientPlugin::replyMail()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandReply, mViewerViewRequest);
 }
 
@@ -269,6 +282,8 @@
 
 void NmBaseClientPlugin::replyAllMail()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandReplyAll, mViewerViewRequest);
 }
 
@@ -278,6 +293,8 @@
 */
 void NmBaseClientPlugin::forwardMail()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandForward, mViewerViewRequest);
 }
 
@@ -286,6 +303,8 @@
 */
 void NmBaseClientPlugin::setPriorityHigh()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandPriorityHigh, mMenuRequest);
 }
 
@@ -294,6 +313,8 @@
 */
 void NmBaseClientPlugin::setPriorityNormal()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandNone, mMenuRequest);
 }
 
@@ -302,6 +323,8 @@
 */
 void NmBaseClientPlugin::setPriorityLow()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandPriorityLow, mMenuRequest);
 }
 
@@ -310,6 +333,8 @@
 */
 void NmBaseClientPlugin::attach()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandAttach, mEditorToolBarRequest);
 }
 
@@ -318,6 +343,8 @@
 */
 void NmBaseClientPlugin::removeAttachment()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandRemoveAttachment, mMenuRequest);
 }
 
@@ -326,6 +353,8 @@
 */
 void NmBaseClientPlugin::openAttachment()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandOpenAttachment, mMenuRequest);
 }
 
@@ -335,6 +364,8 @@
 */
 void NmBaseClientPlugin::search()
 {
+    NM_FUNCTION;
+    
     handleRequest(NmActionResponseCommandSearch, mViewerToolBarRequest);
 }
 
@@ -347,6 +378,8 @@
 void NmBaseClientPlugin::mailboxListChanged(const NmId &mailboxId,
     NmSettings::MailboxEventType type)
 {
+    NM_FUNCTION;
+    
     Q_UNUSED(mailboxId)
     Q_UNUSED(type)
     handleRequest(NmActionResponseCommandMailboxDeleted, mMenuRequest);
@@ -362,15 +395,15 @@
 void NmBaseClientPlugin::mailboxPropertyChanged(const NmId &mailboxId, QVariant property,
     QVariant value)
 {
+    NM_FUNCTION;
+    
     Q_UNUSED(property)
     Q_UNUSED(value)
 
     NmActionObserver *observer = mMenuRequest.observer();
     if (observer) {
         // Force model item to be updated, because framework adapter sends it too slowly.
-        // Data changed signal is not emitted by this change, it is send when ever famework adapter
-        // calls data model's handleMailboxEvent method.
-        mUiEngine->mailboxListModel().refreshModelItem(mailboxId, false);
+        mUiEngine->mailboxListModel().refreshModelItem(mailboxId);
 
         // Notify view of changes.
         NmActionResponse response(NmActionResponseCommandUpdateMailboxName, mMenuRequest);
@@ -384,6 +417,8 @@
 */
 void NmBaseClientPlugin::goOnline(const NmId &mailboxId)
 {
+    NM_FUNCTION;
+    
 		(void) mUiEngine->refreshMailbox(mailboxId);
 }
 /*!
@@ -392,6 +427,8 @@
 */
 void NmBaseClientPlugin::goOffline(const NmId &mailboxId)
 {
+    NM_FUNCTION;
+    
         mUiEngine->goOffline(mailboxId);
 }
 
@@ -405,8 +442,8 @@
     const NmActionRequest &request,
     QList<NmAction *> &actionList)
 {
-    NMLOG("NmBaseClientPlugin::createMessageListCommands()-->");
-
+    NM_FUNCTION;
+    
     switch (request.menuType()) {
         case NmActionOptionsMenu:
         {
@@ -478,7 +515,7 @@
                         request.requestData().value<NmMessageEnvelope*>();    
                     if (envelope){
                         if (envelope->isRead()){
-                            NMLOG("nmailui: envelope is read");
+                            NM_COMMENT("nmailui: envelope is read");
                             NmAction* unreadAction = new NmAction(0);
                             unreadAction->setObjectName("baseclientplugin_unreadaction");
                             unreadAction->setText(hbTrId("txt_mail_menu_mark_as_unread"));
@@ -491,7 +528,7 @@
                             actionList.append(unreadAction);
                         }
                         else {
-                            NMLOG("nmailui: envelope is unread");
+                            NM_COMMENT("nmailui: envelope is unread");
                             NmAction* readAction = new NmAction(0);
                             readAction->setObjectName("baseclientplugin_readaction");
                             readAction->setText(hbTrId("txt_mail_menu_mark_as_read"));
@@ -510,11 +547,10 @@
         }
         default:
         {
-            NMLOG(QString("NmBaseClientPlugin::createMessageListCommands(): Unknown menuType()=%1").arg(request.menuType()));
+            NM_COMMENT(QString("NmBaseClientPlugin::createMessageListCommands(): unknown menuType()=%1").arg(request.menuType()));
             break;
         }
     }
-    NMLOG("<--NmBaseClientPlugin::createMessageListCommands()");
 }
 
 /*!
@@ -527,8 +563,8 @@
     const NmActionRequest &request,
     QList<NmAction *> &actionList)
 {
-    NMLOG("NmBaseClientPlugin::createViewerViewCommands()-->");
-
+    NM_FUNCTION;
+    
     switch (request.menuType()) {
     	case NmActionOptionsMenu:
 		{
@@ -621,7 +657,7 @@
         }
         default:
         {
-            NMLOG(QString("NmBaseClientPlugin::createViewerViewCommands(): Unknown menuType()=%1").arg(request.menuType()));
+            NM_COMMENT(QString("NmBaseClientPlugin::createViewerViewCommands(): unknown menuType()=%1").arg(request.menuType()));
             break;
         }
     }
@@ -638,8 +674,8 @@
     const NmActionRequest &request,
     QList<NmAction *> &actionList)
 {
-    NMLOG("NmBaseClientPlugin::createEditorViewCommands()-->");
-
+    NM_FUNCTION;
+    
     switch (request.menuType()) {
         case NmActionToolbar:
         {
@@ -723,12 +759,10 @@
         }
         default:
         {
-            NMLOG(QString("NmBaseClientPlugin::createEditorViewCommands(): Unknown menuType()=%1").arg(request.menuType()));
+            NM_COMMENT(QString("NmBaseClientPlugin::createEditorViewCommands(): unknown menuType()=%1").arg(request.menuType()));
             break;
         }
     }
-
-    NMLOG("<--NmBaseClientPlugin::createEditorViewCommands()");
 }
 
 /*!
@@ -736,9 +770,9 @@
 */
 void NmBaseClientPlugin::markAsRead()
 {
-    NMLOG("NmBaseClientPlugin::markAsRead()-->");
+    NM_FUNCTION;
+    
     updateEnvelopeProperty(MarkAsRead);
-    NMLOG("<--NmBaseClientPlugin::markAsRead()");
 }
 
 /*!
@@ -746,9 +780,9 @@
 */
 void NmBaseClientPlugin::markAsUnread()
 {
-    NMLOG("NmBaseClientPlugin::markAsUnread()-->");
+    NM_FUNCTION;
+    
     updateEnvelopeProperty(MarkAsUnread);
-    NMLOG("<--NmBaseClientPlugin::markAsUnread()");
 }
 
 /*!
@@ -756,6 +790,8 @@
 */
 void NmBaseClientPlugin::handleRequest(NmActionResponseCommand command, const NmActionRequest &request)
 {
+    NM_FUNCTION;
+    
     NmActionObserver *observer = request.observer();
     if (observer) {
         NmActionResponse response(command, request);
@@ -767,8 +803,8 @@
 */
 void NmBaseClientPlugin::updateEnvelopeProperty(NmEnvelopeProperties property)
 {
-    NMLOG("NmBaseClientPlugin::updateEnvelopeProperty()-->");
-
+    NM_FUNCTION;
+    
     QList<const NmMessageEnvelope*> envelopeList;
     NmMessageEnvelope *envelope =
             mMenuRequest.requestData().value<NmMessageEnvelope*>();
@@ -783,5 +819,4 @@
                                         envelopeList);
     }
     envelopeList.clear();
-    NMLOG("<--NmBaseClientPlugin::updateEnvelopeProperty()");
 }