logsui/logsengine/src/logscontact.cpp
changeset 19 e4c884866116
parent 16 c5af8598d22c
child 21 2f0af9ba7665
equal deleted inserted replaced
16:c5af8598d22c 19:e4c884866116
    25 #include "logscommondata.h"
    25 #include "logscommondata.h"
    26 
    26 
    27 //SYSTEM
    27 //SYSTEM
    28 #include <QVariant>
    28 #include <QVariant>
    29 #include <qcontactmanager.h>
    29 #include <qcontactmanager.h>
       
    30 #include <qcontactonlineaccount.h>
       
    31 #include <qcontactphonenumber.h>
    30 #include <xqappmgr.h>
    32 #include <xqappmgr.h>
    31 #include <cntservicescontact.h>
    33 #include <cntservicescontact.h>
    32 
    34 
    33 // -----------------------------------------------------------------------------
    35 // -----------------------------------------------------------------------------
    34 //
    36 //
    88 {
    90 {
    89     LOGS_QDEBUG( "logs [ENG] -> LogsContact::allowedRequestType()" )
    91     LOGS_QDEBUG( "logs [ENG] -> LogsContact::allowedRequestType()" )
    90     LogsContact::RequestType type = TypeLogsContactSave;
    92     LogsContact::RequestType type = TypeLogsContactSave;
    91     
    93     
    92     if ( isContactInPhonebook() ) {
    94     if ( isContactInPhonebook() ) {
    93         type = TypeLogsContactOpen;
    95         if (isContactGroup()) {
       
    96             type = TypeLogsContactOpenGroup;
       
    97             LOGS_QDEBUG( "logs [ENG] -> TypeLogsContactOpenGroup" )
       
    98         } else {
       
    99             type = TypeLogsContactOpen;
       
   100             LOGS_QDEBUG( "logs [ENG] -> TypeLogsContactOpenGroup" )
       
   101         }
    94     }
   102     }
    95     
   103     
    96     LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::allowedRequestType(): ", type )
   104     LOGS_QDEBUG_2( "logs [ENG] <- LogsContact::allowedRequestType(): ", type )
    97     return type;
   105     return type;
    98 }
   106 }
   112 //
   120 //
   113 bool LogsContact::open()
   121 bool LogsContact::open()
   114 {
   122 {
   115     LOGS_QDEBUG( "logs [ENG] -> LogsContact::open()")
   123     LOGS_QDEBUG( "logs [ENG] -> LogsContact::open()")
   116     bool ret = false;
   124     bool ret = false;
   117     if ( allowedRequestType() == TypeLogsContactOpen ) {
   125     LogsContact::RequestType type = allowedRequestType();
   118         mCurrentRequest = TypeLogsContactOpen;
   126     if ( type == TypeLogsContactOpen || type == TypeLogsContactOpenGroup) {
   119 
   127         mCurrentRequest = type;
   120         QString interface("com.nokia.symbian.IContactsView");
   128         QString interface("com.nokia.symbian.IContactsView");
   121         QString operation("openContactCard(int)");
   129         QString operation("openContactCard(int)");
       
   130         if (type == TypeLogsContactOpenGroup) {
       
   131             operation = "openGroup(int)";
       
   132         }
   122         QList<QVariant> arguments;
   133         QList<QVariant> arguments;
   123         arguments.append( QVariant(mContactId) );
   134         arguments.append( QVariant(mContactId) );
   124         ret = requestPhonebookService( interface, operation, arguments );
   135         ret = requestPhonebookService( interface, operation, arguments );
   125     }
   136     }
   126     
   137     
   165     LOGS_QDEBUG( "logs [ENG] -> LogsContact::cancelServiceRequest()" )
   176     LOGS_QDEBUG( "logs [ENG] -> LogsContact::cancelServiceRequest()" )
   166     delete mAiwRequest;
   177     delete mAiwRequest;
   167     mAiwRequest = 0;
   178     mAiwRequest = 0;
   168     LOGS_QDEBUG( "logs [ENG] <- LogsContact::cancelServiceRequest()" )
   179     LOGS_QDEBUG( "logs [ENG] <- LogsContact::cancelServiceRequest()" )
   169 }
   180 }
       
   181 
       
   182 
       
   183 // ----------------------------------------------------------------------------
       
   184 //
       
   185 // ----------------------------------------------------------------------------
       
   186 //
       
   187 bool LogsContact::isContactGroup()
       
   188 {
       
   189     bool isGroup = (mContact.type() == QContactType::TypeGroup);    
       
   190     LOGS_QDEBUG_2( "logs [ENG] <-> LogsContact::isContactGroup(): ", isGroup )
       
   191     return isGroup;
       
   192 }
       
   193 
   170 
   194 
   171 // ----------------------------------------------------------------------------
   195 // ----------------------------------------------------------------------------
   172 //
   196 //
   173 // ----------------------------------------------------------------------------
   197 // ----------------------------------------------------------------------------
   174 //
   198 //
   259     
   283     
   260     //If existing contact was modified, cached match for the contact should be 
   284     //If existing contact was modified, cached match for the contact should be 
   261     //cleaned up, since remote party info might have been changed.
   285     //cleaned up, since remote party info might have been changed.
   262     //However, if remote party info is taken from symbian DB, it won't be 
   286     //However, if remote party info is taken from symbian DB, it won't be 
   263     //updated
   287     //updated
   264     bool clearCached = ( mCurrentRequest == TypeLogsContactOpen );
   288     bool clearCached = ( mCurrentRequest == TypeLogsContactOpen
       
   289                          || mCurrentRequest == TypeLogsContactOpenGroup ); 
   265     if ( modified ) {
   290     if ( modified ) {
   266         mContact = contact();
   291         mContact = contact();
   267         mDbConnector.updateDetails(clearCached);
   292         mDbConnector.updateDetails(clearCached);
   268     }
   293     }
   269     
   294     
   291 //
   316 //
   292 // ----------------------------------------------------------------------------
   317 // ----------------------------------------------------------------------------
   293 //
   318 //
   294 bool LogsContact::isContactInPhonebook()
   319 bool LogsContact::isContactInPhonebook()
   295 {
   320 {
   296     QContactLocalId localId = mContactId;    
   321     return ( mContactId && mContactId == mContact.localId() );
   297     return ( localId && localId == mContact.localId() );
       
   298 }
   322 }
   299 
   323 
   300 // End of file
   324 // End of file
   301 
   325