controlpanelui/src/silenceindicatorplugin/src/cpsilenceindicatorplugin.cpp
changeset 42 3487b2ea501a
parent 39 5aa7c7ec6b8e
equal deleted inserted replaced
39:5aa7c7ec6b8e 42:3487b2ea501a
    78 */
    78 */
    79 HbIndicatorInterface* CpSilenceIndicatorPlugin::createIndicator(
    79 HbIndicatorInterface* CpSilenceIndicatorPlugin::createIndicator(
    80     const QString &indicatorType)
    80     const QString &indicatorType)
    81 {
    81 {
    82     Q_UNUSED(indicatorType)
    82     Q_UNUSED(indicatorType)
       
    83 	// Install localization
       
    84 	HbTranslator translator("control_panel");
       
    85     translator.loadCommon();
    83     mEngine = CreateProfileEngineExtended2L();    
    86     mEngine = CreateProfileEngineExtended2L();    
    84     return this;
    87     return this;
    85 }
    88 }
    86 
    89 
    87 /*!
    90 /*!
    91 {
    94 {
    92      return mError;
    95      return mError;
    93 }
    96 }
    94 
    97 
    95 /*!
    98 /*!
    96     The handleInteraction is used launch WLAN list view.
    99     The handleInteraction is used to emit dataChange signal.
    97 */
   100 */
    98 bool CpSilenceIndicatorPlugin::handleInteraction(InteractionType type)
   101 bool CpSilenceIndicatorPlugin::handleInteraction(InteractionType type)
    99 {
   102 {
   100    bool handled = false;
   103     bool handled = false;
   101     switch (type) {
   104         switch (type) {
   102     case InteractionActivated: 
   105         case InteractionActivated: 
   103         // set silence mode or disable silence mode                
   106             emit dataChanged();        
   104         bool isSilence = false;
   107             handled = true;
   105         TRAP(mError,
   108             break;
   106                 isSilence = mEngine->SilenceModeL();
   109         default:
   107                 mEngine->SetSilenceModeL(!isSilence);
   110             break;
   108         )
   111         }
   109         emit dataChanged();        
   112         return handled;
   110         handled = true;
       
   111         break;
       
   112     default:
       
   113         break;
       
   114     }
       
   115     return handled;
       
   116 }
   113 }
   117 
   114 
   118 /*!
   115 /*!
   119     The handleClientRequest handles client request to change indicators paramters.
   116     The handleClientRequest handles client request to change indicators paramters.
   120 */
   117 */
   122 {
   119 {
   123     Q_UNUSED(parameter)
   120     Q_UNUSED(parameter)
   124     bool handled(false);
   121     bool handled(false);
   125     switch (type) {
   122     switch (type) {
   126     case RequestActivate:
   123     case RequestActivate:
   127         TRAP(mError, mEngine->SetSilenceModeL(true);)
       
   128         handled = true;
       
   129         emit dataChanged();
       
   130         break;
       
   131         
       
   132     case RequestDeactivate:
   124     case RequestDeactivate:
   133         TRAP(mError, mEngine->SetSilenceModeL(false);)
       
   134         handled = true;
   125         handled = true;
   135         emit dataChanged();
   126         emit dataChanged();
   136         break;
   127         break;
   137     default:     
   128     default:     
   138         break;
   129         break;
   149     QVariant variant;
   140     QVariant variant;
   150     switch (role) {
   141     switch (role) {
   151         // this is the statusbar icon, which is shown only when silence mode is on
   142         // this is the statusbar icon, which is shown only when silence mode is on
   152     case MonoDecorationNameRole:
   143     case MonoDecorationNameRole:
   153         if (mEngine->SilenceModeL()) {
   144         if (mEngine->SilenceModeL()) {
   154             variant = HbIcon("qtg_status_profile_silent");
   145             variant = QString("qtg_status_profile_silent");
   155         } else {
   146         } else {
   156             variant = HbIcon();
   147             variant = QString();
   157         }        
   148         }        
   158         break;
   149         break;
   159     default:
   150     default:
   160         break;
   151         break;
   161     }
   152     }