phoneplugins/infowidgetplugin/infowidget/inc/infowidgetengine.h
changeset 45 6b911d05207e
child 50 377c906a8701
equal deleted inserted replaced
37:ba76fc04e6c2 45:6b911d05207e
       
     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 #ifndef INFOWIDGETENGINE_H_
       
    19 #define INFOWIDGETENGINE_H_
       
    20 
       
    21 #include <QObject>
       
    22 #include <QString>
       
    23 #include "infowidgetpreferences.h"
       
    24 
       
    25 // Forward declarations 
       
    26 class InfoWidgetNetworkHandler;
       
    27 class InfoWidgetSatHandler;
       
    28 class InfoWidgetLineHandler;
       
    29 
       
    30 // Class declaration
       
    31 class InfoWidgetEngine : public QObject 
       
    32     {
       
    33     Q_OBJECT
       
    34     
       
    35 public:     
       
    36     
       
    37     enum HandlerEntity {
       
    38         NotDefined = 0, 
       
    39         NetworkHandler, 
       
    40         SatHandler, 
       
    41         LineHandler
       
    42     };
       
    43     
       
    44     class ModelData {    
       
    45     public: 
       
    46         int mcnIndicatorType() const { return m_mcnIndicatorType; }; 
       
    47         void setMcnIndicatorType(const int type){ m_mcnIndicatorType = type; };
       
    48         
       
    49         int homeZoneIndicatorType() const { return m_homeZoneIndicatorType; }; 
       
    50         void setHomeZoneIndicatorType(const int type){ m_homeZoneIndicatorType = type; };
       
    51 
       
    52         int activeLine() const { return m_activeLine; }; 
       
    53         void setActiveLine(const int line){ m_activeLine = line; };
       
    54 
       
    55         const QString& mcnName() const { return m_mcnName; };
       
    56         void setMcnName(const QString& name){ m_mcnName = name; };
       
    57 
       
    58         const QString& serviceProviderName() const { return m_serviceProviderName; };
       
    59         void setServiceProviderName(const QString& name){ m_serviceProviderName = name; };
       
    60         
       
    61         bool serviceProviderNameDisplayRequired() const { 
       
    62             return m_serviceProviderNameDisplayRequired; };
       
    63         void setServiceProviderNameDisplayRequired(bool required){ 
       
    64             m_serviceProviderNameDisplayRequired = required; };
       
    65         
       
    66         const QString& homeZoneTextTag() const { return m_homeZoneTextTag; };
       
    67         void setHomeZoneTextTag(const QString& tag){ m_homeZoneTextTag = tag; };
       
    68 
       
    69         const QString& satDisplayText() const { return m_satDisplayText; };
       
    70         void setSatDisplayText(const QString& text){ m_satDisplayText = text; };
       
    71         
       
    72     private: 
       
    73         int m_mcnIndicatorType; 
       
    74         int m_homeZoneIndicatorType;
       
    75         int m_activeLine; 
       
    76         bool m_serviceProviderNameDisplayRequired; 
       
    77         
       
    78         QString m_mcnName;
       
    79         QString m_serviceProviderName;
       
    80         QString m_homeZoneTextTag;
       
    81         QString m_satDisplayText;
       
    82     }; 
       
    83     
       
    84 public:
       
    85     InfoWidgetEngine(QObject *parent = NULL);
       
    86     ~InfoWidgetEngine();
       
    87     
       
    88     const InfoWidgetEngine::ModelData &modelData() const;  
       
    89     
       
    90 signals:
       
    91     void modelError(int operation, int errorCode);
       
    92     void modelChanged(); 
       
    93     
       
    94 public slots: 
       
    95     void updateNetworkDataToModel();
       
    96     void updateSatDataToModel();
       
    97     void updateLineDataToModel();
       
    98 
       
    99     void handleNetworkError(
       
   100             int operation, 
       
   101             int errorCode); 
       
   102     void handleSatError(int operation, int errorCode); 
       
   103     void handleLineError(int operation, int errorCode);
       
   104     
       
   105     void suspend(); 
       
   106     void resume();
       
   107     
       
   108     void handlePreferencesChanged(
       
   109             InfoWidgetPreferences::Options options);
       
   110     
       
   111 private: 
       
   112     ModelData m_modelData;
       
   113     
       
   114     // Own
       
   115     QScopedPointer<InfoWidgetNetworkHandler> m_networkHandler;
       
   116     QScopedPointer<InfoWidgetSatHandler> m_satHandler;
       
   117     }; 
       
   118 
       
   119 #endif /* INFOWIDGETENGINE_H_ */
       
   120 
       
   121