phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/src/infowidgetengine.cpp
changeset 22 6bb1b21d2484
child 27 2f8f8080a020
equal deleted inserted replaced
21:92ab7f8d0eab 22:6bb1b21d2484
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
       
    17 
       
    18 #include "infowidgetengine.h"
       
    19 #include "infowidgetnetworkhandler.h"
       
    20 #include <networkhandlingproxy.h>
       
    21 #include "infowidgetlogging.h"
       
    22 #include <xqsettingsmanager.h>
       
    23 #include <xqsettingskey.h>
       
    24 #include <settingsinternalcrkeys.h>
       
    25 
       
    26 /*!
       
    27    InfoWidgetEngine::InfoWidgetEngine
       
    28  */
       
    29 InfoWidgetEngine::InfoWidgetEngine(QObject *parent): 
       
    30     QObject(parent),
       
    31     m_networkHandler(new InfoWidgetNetworkHandler)
       
    32 {
       
    33     DPRINT << ": IN";
       
    34     
       
    35     QObject::connect(
       
    36         m_networkHandler.data(), SIGNAL(networkError(int, int)),
       
    37         this, SLOT(handleNetworkError(int, int))); 
       
    38     
       
    39     QObject::connect(
       
    40         m_networkHandler.data(), SIGNAL(networkDataChanged()),
       
    41         this, SLOT(updateNetworkDataToModel()));
       
    42     
       
    43     XQSettingsManager *settingsManager = new XQSettingsManager(0); 
       
    44     XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, 
       
    45         KCRUidNetworkSettings.iUid, KSettingsMcnDisplay); 
       
    46     bool result = settingsManager->writeItemValue(settingsKey, 1 );
       
    47     delete settingsManager;
       
    48 
       
    49     updateNetworkDataToModel(); 
       
    50     
       
    51     DPRINT << ": OUT";
       
    52 }
       
    53 
       
    54 /*!
       
    55    InfoWidgetEngine::~InfoWidgetEngine
       
    56  */
       
    57 InfoWidgetEngine::~InfoWidgetEngine()
       
    58 {
       
    59     DPRINT;
       
    60 }    
       
    61 
       
    62 /*!
       
    63    InfoWidgetEngine::logModelData
       
    64    
       
    65    Utility function for logging model data
       
    66  */
       
    67 void InfoWidgetEngine::logModelData()
       
    68 {
       
    69     DPRINT << ": mcn name: " << m_modelData.mcnName(); 
       
    70     DPRINT << ": service provider name: " << m_modelData.serviceProviderName();
       
    71     DPRINT << ": homezone text tag: " << m_modelData.homeZoneTextTag();
       
    72     
       
    73     DPRINT << ": mcn type: " << m_modelData.mcnIndicatorType(); 
       
    74     DPRINT << ": active line: " << m_modelData.activeLine(); 
       
    75     DPRINT << ": homezone indicator type: " << m_modelData.homeZoneIndicatorType(); 
       
    76 } 
       
    77 
       
    78 /*!
       
    79    InfoWidgetEngine::modelData
       
    80    
       
    81    Getter for model data. 
       
    82  */
       
    83 const InfoWidgetEngine::ModelData& InfoWidgetEngine::modelData() const
       
    84 {
       
    85     DPRINT;
       
    86     return m_modelData; 
       
    87 }
       
    88 
       
    89 /*!
       
    90    InfoWidgetEngine::updateNetworkDataToModel
       
    91  */
       
    92 void InfoWidgetEngine::updateNetworkDataToModel()
       
    93 {
       
    94     DPRINT << ": IN"; 
       
    95     
       
    96     m_networkHandler->logCurrentInfo();
       
    97     
       
    98     // Read network handler data to model data
       
    99     m_modelData.setHomeZoneIndicatorType(
       
   100         m_networkHandler->homeZoneIndicatorType());
       
   101     m_modelData.setHomeZoneTextTag(m_networkHandler->homeZoneTextTag()); 
       
   102     m_modelData.setMcnName(m_networkHandler->mcnName()); 
       
   103     m_modelData.setMcnIndicatorType(m_networkHandler->mcnIndicatorType());
       
   104     
       
   105     emit modelChanged();
       
   106     
       
   107     DPRINT << ": OUT";
       
   108 }
       
   109 
       
   110 /*!
       
   111    InfoWidgetEngine::updateSatDataToModel
       
   112  */
       
   113 void InfoWidgetEngine::updateSatDataToModel()
       
   114 {
       
   115     DPRINT;
       
   116 }
       
   117 
       
   118 /*!
       
   119    InfoWidgetEngine::updateLineDataToModel
       
   120  */
       
   121 void InfoWidgetEngine::updateLineDataToModel()
       
   122 {
       
   123     DPRINT;
       
   124 }
       
   125 
       
   126 /*!
       
   127    InfoWidgetEngine::handleNetworkError
       
   128  */
       
   129 void InfoWidgetEngine::handleNetworkError(int operation, int errorCode)
       
   130 {
       
   131     DPRINT << ": operation: " << operation << " error code: " << errorCode; 
       
   132 }
       
   133 
       
   134 /*!
       
   135    InfoWidgetEngine::handleSatError
       
   136  */
       
   137 void InfoWidgetEngine::handleSatError(int operation, int errorCode)
       
   138 {
       
   139     DPRINT << ": operation: " << operation << " error code: " << errorCode; 
       
   140 }
       
   141 
       
   142 /*!
       
   143    InfoWidgetEngine::handleLineError
       
   144  */
       
   145 void InfoWidgetEngine::handleLineError(int operation, int errorCode)
       
   146 {
       
   147     DPRINT << ": operation: " << operation << " error code: " << errorCode; 
       
   148 }
       
   149 
       
   150 // End of File. 
       
   151