phoneapp/phoneuiqtviewadapter/src/phoneindicatorcontroller.cpp
changeset 56 5bcb308bd24d
parent 46 bc5a64e5bc3c
child 60 1eef62f5c541
equal deleted inserted replaced
46:bc5a64e5bc3c 56:5bcb308bd24d
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "phoneindicatorcontroller.h"
    18 #include "phoneindicatorcontroller.h"
    19 #include "phoneindicators.h"
    19 #include "phoneindicators.h"
       
    20 #include "phonevisibilityhandler.h"
    20 #include "qtphonelog.h"
    21 #include "qtphonelog.h"
    21 
    22 
    22 #include <QByteArray>
    23 #include <QByteArray>
    23 #include <hbicon.h>
    24 #include <hbicon.h>
    24 
    25 
    25 #ifdef Q_OS_SYMBIAN
    26 #ifdef Q_OS_SYMBIAN
    26 #include <logsmodel.h>
    27 #include <logsmodel.h>
    27 #include <logsfilter.h>
    28 #include <logsfilter.h>
    28 #include <LogsDomainCRKeys.h>
    29 #include <LogsDomainCRKeys.h>
    29 #include <ctsydomaincrkeys.h>
    30 #include <ctsydomaincrkeys.h>
       
    31 #include <xqaiwrequest.h>
       
    32 #include <xqappmgr.h>
       
    33 #include <logsservices.h>
    30 #endif
    34 #endif
    31 
    35 
    32 namespace PhoneIndicatorControllerKeys{
    36 namespace PhoneIndicatorControllerKeys{
    33     const XQSettingsKey missedCallsSettingsKey( XQSettingsKey::TargetCentralRepository, 
    37     const XQSettingsKey missedCallsSettingsKey( XQSettingsKey::TargetCentralRepository, 
    34         KCRUidLogs.iUid, KLogsNewMissedCalls );
    38         KCRUidLogs.iUid, KLogsNewMissedCalls );
    40             KCRUidCtsyCallForwardingIndicator.iUid, KCtsyCallForwardingIndicator );     
    44             KCRUidCtsyCallForwardingIndicator.iUid, KCtsyCallForwardingIndicator );     
    41 }
    45 }
    42 
    46 
    43 
    47 
    44 
    48 
    45 PhoneIndicatorController::PhoneIndicatorController(QObject *parent):
    49 PhoneIndicatorController::PhoneIndicatorController(
    46     QObject(parent), m_logsModel(0), m_missedCallsFilter(0)
    50     PhoneVisibilityHandler& visibilityHandler, QObject *parent):
       
    51     QObject(parent), m_logsModel(0), m_missedCallsFilter(0), 
       
    52     m_request(0), m_phoneVisibilityHandler(visibilityHandler)
    47 {
    53 {
    48     PHONE_TRACE
    54     PHONE_TRACE
    49 #ifdef Q_OS_SYMBIAN
    55 #ifdef Q_OS_SYMBIAN
    50     m_setManager = new XQSettingsManager(this);
    56     m_setManager = new XQSettingsManager(this);
    51     connect( m_setManager, 
    57     connect( m_setManager, 
    71         int cfStatus=0;
    77         int cfStatus=0;
    72         memcpy(&cfStatus, bytes.data_ptr()->array, sizeof(int));
    78         memcpy(&cfStatus, bytes.data_ptr()->array, sizeof(int));
    73         updateDiverIndicator(cfStatus & KCFVoiceForwarded);
    79         updateDiverIndicator(cfStatus & KCFVoiceForwarded);
    74     }
    80     }
    75 #endif
    81 #endif
       
    82     
       
    83     connect(&m_indicator,SIGNAL(userActivated(QString,QVariantMap)),
       
    84             this,SLOT(handleInteraction(QString,QVariantMap)));
    76 }
    85 }
    77 
    86 
    78 PhoneIndicatorController::~PhoneIndicatorController()
    87 PhoneIndicatorController::~PhoneIndicatorController()
    79 {   
    88 {   
    80 #ifdef Q_OS_SYMBIAN
    89 #ifdef Q_OS_SYMBIAN
   252         const XQSettingsKey &first, const XQSettingsKey &second)
   261         const XQSettingsKey &first, const XQSettingsKey &second)
   253 {   
   262 {   
   254     PHONE_TRACE
   263     PHONE_TRACE
   255     return ( first.key() == second.key() && first.uid() == second.uid() );
   264     return ( first.key() == second.key() && first.uid() == second.uid() );
   256 }
   265 }
       
   266 
       
   267 void PhoneIndicatorController::handleInteraction(QString type,QVariantMap data)
       
   268 {
       
   269     PHONE_TRACE
       
   270     
       
   271     if (data.contains(QLatin1String("interaction")) && 
       
   272         data.value(QLatin1String("interaction")).canConvert<int>()) {
       
   273         
       
   274         XQApplicationManager appManager;
       
   275         QList<QVariant> args;
       
   276         QString service;
       
   277         QString interface;
       
   278         QString operation;
       
   279         QVariantHash hash;
       
   280         QVariantMap map;
       
   281         int interaction = data.value("interaction").toInt();                
       
   282         
       
   283         switch(interaction){
       
   284             case OpenMissedCallView:
       
   285                 service = "logs";
       
   286                 interface = "com.nokia.symbian.ILogsView";
       
   287                 operation = "show(QVariantMap)";
       
   288                 map.insert("view_index",QVariant((int)LogsServices::ViewMissed));
       
   289                 map.insert("show_dialpad",QVariant(false));
       
   290                 map.insert("dialpad_text", QVariant(QString()));
       
   291                 args.append(QVariant(map));
       
   292                 break;
       
   293             case OpenCallUi:            
       
   294                 m_phoneVisibilityHandler.bringToForeground();
       
   295                 break;
       
   296             case OpenDiverSettingsView:
       
   297                 interface = "com.nokia.symbian.ICpPluginLauncher";
       
   298                 operation = "launchSettingView(QString,QVariant)";
       
   299                 args << QVariant("cptelephonyplugin.dll");            
       
   300                 hash["view"] = "divert_view";
       
   301                 hash["heading"] = "txt_phone_subhead_telephone";
       
   302                 args << hash;
       
   303                 break;
       
   304             default:            
       
   305                 break;
       
   306         }
       
   307         
       
   308         delete m_request;
       
   309         m_request = service.isEmpty() ? 
       
   310             appManager.create( interface, operation, false):
       
   311             appManager.create(service, interface, operation, false);
       
   312         if ( m_request == NULL ){
       
   313             return;       
       
   314         }   
       
   315         m_request->setArguments(args);
       
   316         m_request->send();    
       
   317         
       
   318     }
       
   319 }