locationsystemui/locationsysui/posindicator/posindicatorplugin/inc/posindicator.h
changeset 33 834e27cad510
child 52 4d26d2f138a3
equal deleted inserted replaced
32:b12ea03c50a3 33:834e27cad510
       
     1 /*
       
     2 * Copyright (c) 2003-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:  Implementation for positioning indicator plugin class
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef POS_INDICATOR_PLUGIN_H
       
    19 #define POS_INDICATOR_PLUGIN_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QStringList>
       
    23 #include <QVariant>
       
    24 
       
    25 #include <hbindicatorplugininterface.h>
       
    26 #include <hbindicatorinterface.h>
       
    27 
       
    28 
       
    29 class PosIndicatorInfo;
       
    30 class PosGeoAddress;
       
    31 class QTranslator;
       
    32 
       
    33 // Indicator Plugin class
       
    34 class PosIndicatorPlugin : public QObject, public HbIndicatorPluginInterface
       
    35 {
       
    36     Q_OBJECT
       
    37     Q_INTERFACES(HbIndicatorPluginInterface)
       
    38 
       
    39 public:
       
    40 	 /**
       
    41     * Constructor 
       
    42     */
       
    43     PosIndicatorPlugin();
       
    44 	 /**
       
    45     * Destructor 
       
    46     */    
       
    47     ~PosIndicatorPlugin();
       
    48 
       
    49    /**
       
    50     * Returns indicator types implemented by this plugin
       
    51     * @return List of strings that denote indicator types implemented
       
    52     */
       
    53     QStringList indicatorTypes() const;
       
    54     
       
    55    /**
       
    56     * creates an indicator of type indicatorType
       
    57     * @param[in] String representing indicator type
       
    58     * @return Pointer to HbIndicatorInterface
       
    59     */
       
    60     HbIndicatorInterface* createIndicator(const QString &indicatorType);
       
    61  
       
    62     /**
       
    63     * Virtual function to check for capabilities for calling client
       
    64     * @return true if client has Location capability
       
    65 			  false if client does not have Location capability
       
    66     */
       
    67 	bool accessAllowed(const QString &indicatorType, const QVariantMap &securityInfo) const;
       
    68 
       
    69    /**
       
    70     * Returns the last error code
       
    71     * @return error code integer
       
    72     */
       
    73     int error() const;
       
    74     
       
    75 private:
       
    76     Q_DISABLE_COPY(PosIndicatorPlugin)
       
    77     int mError;
       
    78     QStringList mIndicatorTypes;
       
    79     /**
       
    80        * Holds localization translator handle
       
    81        * OWns
       
    82        */
       
    83     QTranslator* mTranslator;  
       
    84 };
       
    85 
       
    86 // Indicator class that the indicator plugin implements
       
    87 class PosIndicator : public HbIndicatorInterface
       
    88 {
       
    89     Q_OBJECT
       
    90 public:
       
    91 	 /**
       
    92     * Constructor 
       
    93     */
       
    94     PosIndicator(const QString &indicatorType);
       
    95 	 
       
    96 	 /**
       
    97     * Destructor 
       
    98     */
       
    99     ~PosIndicator();
       
   100 	 
       
   101    /**
       
   102     * Returns the data element store based on role 
       
   103     * @param[in] role
       
   104     * @return Data stored for the role.
       
   105     */
       
   106     QVariant indicatorData(int role) const;
       
   107 
       
   108     /*
       
   109      * Called when Indicator menu is about to be shown
       
   110      */
       
   111     bool refreshData();
       
   112     
       
   113 private slots:
       
   114     /*
       
   115      * Refreshes indicator pane when new position information is available
       
   116      */
       
   117     void refreshPosIndicatorPane(PosGeoAddress& posGeoAddress, int error);
       
   118 
       
   119 private : 
       
   120     /*
       
   121      * Converts decimal coordinate information to Degrees, Minutes, 
       
   122      * Seconds value
       
   123      */
       
   124     void ConvertToDMSFormat(QString &dDisplayString, double decimal);
       
   125     
       
   126 private :
       
   127     
       
   128     /**
       
   129      * String containing information to be displayed
       
   130      */    
       
   131     QString mDisplayString;
       
   132     
       
   133     /**
       
   134      * Owns
       
   135     **/
       
   136     PosIndicatorInfo* mPosIndicatorInfo;    
       
   137  
       
   138     /*
       
   139      * Toggle flag to check whether current signal is returns address or co-ordinates
       
   140      */
       
   141     bool processedAddess;
       
   142 };
       
   143 
       
   144 #endif // POS_INDICATOR_PLUGIN_H
       
   145