messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp
changeset 51 3507212d340e
parent 48 4f501b74aeb1
child 62 fdbe8253b596
equal deleted inserted replaced
49:2a272ef608c4 51:3507212d340e
    24 #include <xqservicerequest.h>
    24 #include <xqservicerequest.h>
    25 #include <QString>
    25 #include <QString>
    26 #include <w32std.h>
    26 #include <w32std.h>
    27 #include <apgtask.h> 
    27 #include <apgtask.h> 
    28 #include <XQSettingsManager>
    28 #include <XQSettingsManager>
       
    29 #include <xqaiwrequest.h>
       
    30 #include <xqappmgr.h>
    29 #include <xqpublishandsubscribeutils.h>
    31 #include <xqpublishandsubscribeutils.h>
    30 #include <xqsystemtoneservice.h>
    32 #include <xqsystemtoneservice.h>
    31 #include <xqconversions.h>
    33 #include <xqconversions.h>
       
    34 #include <QThreadPool>
    32 
    35 
    33 //USER INCLUDES
    36 //USER INCLUDES
    34 #include "msgnotifier.h"
    37 #include "msgnotifier.h"
    35 #include "msgnotifier_p.h"
    38 #include "msgnotifier_p.h"
    36 #include "msgstorehandler.h"
    39 #include "msgstorehandler.h"
   132 // @see MsgNotifierPrivate.h
   135 // @see MsgNotifierPrivate.h
   133 // ----------------------------------------------------------------------------
   136 // ----------------------------------------------------------------------------
   134 void MsgNotifierPrivate::AddConversationList(
   137 void MsgNotifierPrivate::AddConversationList(
   135                   const CCsClientConversation& aClientConversation)
   138                   const CCsClientConversation& aClientConversation)
   136 {
   139 {
   137     QDEBUG_WRITE("MsgNotifierPrivate::AddConversationList : Enter")
   140     QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Enter")
   138 
   141 
   139     processListEntry(aClientConversation);
   142     processListEntry(aClientConversation);
   140     updateUnreadIndications();
   143     updateUnreadIndications();
   141 
   144 
   142     QDEBUG_WRITE("MsgNotifierPrivate::AddConversationList : Exit")
   145     QCRITICAL_WRITE("MsgNotifierPrivate::AddConversationList : Exit")
   143 }
   146 }
   144 
   147 
   145 // ----------------------------------------------------------------------------
   148 // ----------------------------------------------------------------------------
   146 // MsgNotifierPrivate::DeleteConversationList
   149 // MsgNotifierPrivate::DeleteConversationList
   147 // @see MsgNotifierPrivate.h
   150 // @see MsgNotifierPrivate.h
   158 // MsgNotifierPrivate::ModifyConversationList
   161 // MsgNotifierPrivate::ModifyConversationList
   159 // @see MsgNotifierPrivate.h
   162 // @see MsgNotifierPrivate.h
   160 // ----------------------------------------------------------------------------
   163 // ----------------------------------------------------------------------------
   161 void MsgNotifierPrivate::ModifyConversationList(const CCsClientConversation& aClientConversation)
   164 void MsgNotifierPrivate::ModifyConversationList(const CCsClientConversation& aClientConversation)
   162 {
   165 {
   163     QDEBUG_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter")
   166     QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Enter")
   164 
   167 
   165     processListEntry(aClientConversation);
   168     processListEntry(aClientConversation);
   166     updateUnreadIndications();
   169     updateUnreadIndications();
   167 
   170 
   168     QDEBUG_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit")
   171     QCRITICAL_WRITE("MsgNotifierPrivate::ModifyConversationList : Exit")
   169 }
   172 }
   170 
   173 
   171 // ----------------------------------------------------------------------------
   174 // ----------------------------------------------------------------------------
   172 // MsgNotifierPrivate::RefreshConversationList
   175 // MsgNotifierPrivate::RefreshConversationList
   173 // @see MsgNotifierPrivate.h
   176 // @see MsgNotifierPrivate.h
   182 // @see MsgNotifierPrivate.h
   185 // @see MsgNotifierPrivate.h
   183 // ----------------------------------------------------------------------------
   186 // ----------------------------------------------------------------------------
   184 void MsgNotifierPrivate::processListEntry(
   187 void MsgNotifierPrivate::processListEntry(
   185         const CCsClientConversation& aClientConversation)
   188         const CCsClientConversation& aClientConversation)
   186     {
   189     {
   187     QDEBUG_WRITE("MsgNotifierPrivate::processListEntry : Enter")
   190     QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Enter")
   188     
   191     
   189     CCsConversationEntry* convEntry = 
   192     CCsConversationEntry* convEntry = 
   190                                  aClientConversation.GetConversationEntry();
   193                                  aClientConversation.GetConversationEntry();
   191     
   194     
   192     QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Direction",
   195     QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::processListEntry Direction",
   236              QDEBUG_WRITE("processListEntry : Notification display called")
   239              QDEBUG_WRITE("processListEntry : Notification display called")
   237             }
   240             }
   238        
   241        
   239         }
   242         }
   240     
   243     
   241     QDEBUG_WRITE("MsgNotifierPrivate::processListEntry : Exit")
   244     QCRITICAL_WRITE("MsgNotifierPrivate::processListEntry : Exit")
   242     }
   245     }
   243 
   246 
   244 // ----------------------------------------------------------------------------
   247 // ----------------------------------------------------------------------------
   245 // MsgNotifierPrivate::updateUnreadIndications
   248 // MsgNotifierPrivate::updateUnreadIndications
   246 // @see MsgNotifierPrivate.h
   249 // @see MsgNotifierPrivate.h
   383 // ----------------------------------------------------------------------------
   386 // ----------------------------------------------------------------------------
   384 // MsgNotifierPrivate::PartialDeleteConversationList
   387 // MsgNotifierPrivate::PartialDeleteConversationList
   385 // @see mcsconversationclientchangeobserver.h
   388 // @see mcsconversationclientchangeobserver.h
   386 // ----------------------------------------------------------------------------
   389 // ----------------------------------------------------------------------------
   387 void MsgNotifierPrivate::PartialDeleteConversationList(
   390 void MsgNotifierPrivate::PartialDeleteConversationList(
   388         const CCsClientConversation& aClientConversation){/*empty implementation*/}
   391         const CCsClientConversation& /*aClientConversation*/){/*empty implementation*/}
       
   392 
       
   393 
       
   394 // ----------------------------------------------------------------------------
       
   395 // MsgNotifierPrivate::ShowClass0Message
       
   396 // @see msgnotifier_p.h
       
   397 // ----------------------------------------------------------------------------
       
   398 
       
   399 void MsgNotifierPrivate::ShowClass0Message(Class0Info& class0Info)
       
   400 {
       
   401     QCRITICAL_WRITE("flashmsgnotifier BEGIN");
       
   402     QThreadPool::globalInstance()->start(new Class0SmsServiceTask(class0Info));
       
   403     QCRITICAL_WRITE("flashmsgnotifier END");
       
   404 }
       
   405 
       
   406 
       
   407 
       
   408 
       
   409 // ----------------------------------------------------------------------------
       
   410 // Class0SmsServiceTask::Class0SmsServiceTask
       
   411 // @see msgnotifier_p.h
       
   412 // ----------------------------------------------------------------------------  
       
   413 Class0SmsServiceTask::Class0SmsServiceTask(Class0Info& class0Info):
       
   414 mClass0info(class0Info)
       
   415      {     
       
   416      }
       
   417 
       
   418 // ----------------------------------------------------------------------------
       
   419 // Class0SmsServiceTask::~Class0SmsServiceTask
       
   420 // @see msgnotifier_p.h
       
   421 // ----------------------------------------------------------------------------   
       
   422 Class0SmsServiceTask::~Class0SmsServiceTask()
       
   423      {     
       
   424      }
       
   425      
       
   426 // ----------------------------------------------------------------------------
       
   427 // Class0SmsServiceTask::run
       
   428 // @see msgnotifier_p.h
       
   429 // ----------------------------------------------------------------------------   
       
   430 void Class0SmsServiceTask::run()
       
   431      {
       
   432    	  QList<QVariant> args;
       
   433       QString serviceName("flashmsgnotifier");
       
   434       QString interfaceName("com.nokia.symbian.IFlashMsgNotifier");
       
   435       QString operation("displayFlashMsg(QByteArray)");
       
   436       XQAiwRequest* request;
       
   437       XQApplicationManager appManager;
       
   438 
       
   439       request = appManager.create(interfaceName, operation, false); //non-embedded
       
   440 
       
   441       if ( request == NULL )
       
   442       {
       
   443           QCRITICAL_WRITE("flashmsgnotifier request == NULL");
       
   444           return; 
       
   445       }
       
   446 
       
   447       QByteArray ba; 
       
   448       QDataStream stream(&ba, QIODevice::ReadWrite);
       
   449       stream << mClass0info.body;
       
   450       stream << mClass0info.address;
       
   451       stream << mClass0info.alias;
       
   452       stream << mClass0info.time;     
       
   453       stream << mClass0info.messageId;
       
   454        
       
   455       args << ba;
       
   456       request->setArguments(args);    
       
   457        
       
   458       if(!request->send())
       
   459       {
       
   460          QString lastErr;
       
   461           lastErr = request->lastErrorMessage();
       
   462           QDEBUG_WRITE_FORMAT("flashmsgnotifier launch failed", lastErr);
       
   463       }
       
   464        
       
   465       QCRITICAL_WRITE("flashmsgnotifier END");
       
   466       delete request;  
       
   467      }
   389 
   468 
   390 //EOF
   469 //EOF