devicemgmtindicatorsplugin/src/dmpronoteindicators.cpp
branchRCL_3
changeset 57 6757f1e2efd2
equal deleted inserted replaced
55:c4687ff85147 57:6757f1e2efd2
       
     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: DM Progress and Notification indicators implementation
       
    15  *
       
    16  */
       
    17 
       
    18 #include <QByteArray>
       
    19 #include <QVariant>
       
    20 #include <e32base.h>
       
    21 #include <w32std.h>
       
    22 #include <apgtask.h>
       
    23 #include <apgtask.h>
       
    24 #include <hbindicator.h>
       
    25 #include <eikenv.h>
       
    26 #include "dmindicator.h" 
       
    27 #include "dmpronoteindicators.h" 
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // DMProNoteIndicator::DMProNoteIndicator
       
    31 // @see dmpronoteindicators.h
       
    32 // ----------------------------------------------------------------------------
       
    33 DMProNoteIndicator::DMProNoteIndicator(const QString &indicatorType,
       
    34         HbIndicatorInterface::Category category,
       
    35         HbIndicatorInterface::InteractionTypes interactionTypes) :
       
    36     DMIndicator(indicatorType, category, interactionTypes)
       
    37     {
       
    38 
       
    39     }
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // DMProNoteIndicator::indicatorData
       
    43 // @see dmpronoteindicators.h
       
    44 // ----------------------------------------------------------------------------
       
    45 QVariant DMProNoteIndicator::indicatorData(int role) const
       
    46     {
       
    47     qDebug("DMProNoteIndicator::indicatorData()");
       
    48     switch (role)
       
    49         {
       
    50         case PrimaryTextRole:
       
    51             {
       
    52             QString text = hbTrId("txt_device_update_dblist_device_updates");
       
    53             return text;
       
    54             }
       
    55         case SecondaryTextRole:
       
    56             {
       
    57             QString text = mParameter.toString();
       
    58             return text;
       
    59             }
       
    60         case MonoDecorationNameRole:
       
    61             {
       
    62             //QString iconName("C:/resource/devicemanagement/qtg_small_smiley_kissing.svg");
       
    63             QString iconName("qtg_small_smiley_kissing");
       
    64             return iconName;
       
    65             }
       
    66 
       
    67         case DecorationNameRole:
       
    68             {
       
    69             //QString iconName("C:/resource/devicemanagement/qtg_small_smiley_kissing.svg");
       
    70             QString iconName("qtg_small_smiley_kissing");
       
    71             return iconName;
       
    72             }
       
    73         default:
       
    74             qDebug(
       
    75                     "DMProNoteIndicator::indicatorData() returning Null QVariant");
       
    76             return QVariant();
       
    77 
       
    78         }
       
    79     }
       
    80 
       
    81 // ----------------------------------------------------------------------------
       
    82 // DMProNoteIndicator::handleInteraction
       
    83 // @see dmpronoteindicators.h
       
    84 // ----------------------------------------------------------------------------
       
    85 bool DMProNoteIndicator::handleInteraction(InteractionType type)
       
    86     {
       
    87     qDebug("DMProNoteIndicator::handleInteraction() Start");
       
    88 	QVariantMap map;
       
    89     map.insert("data", indicatorType());
       
    90     emit userActivated(map);
       
    91     emit deactivate();
       
    92     qDebug("DMProNoteIndicator::handleInteraction() End");
       
    93     return true;
       
    94     }
       
    95 
       
    96 // ----------------------------------------------------------------------------
       
    97 // ScomoProNoteIndicator::ScomoProNoteIndicator
       
    98 // @see dmpronoteindicators.h
       
    99 // ----------------------------------------------------------------------------
       
   100 ScomoProNoteIndicator::ScomoProNoteIndicator(const QString &indicatorType,
       
   101         HbIndicatorInterface::Category category,
       
   102         HbIndicatorInterface::InteractionTypes interactionTypes) :
       
   103 DMProNoteIndicator(indicatorType, category, interactionTypes)
       
   104     {
       
   105 
       
   106     }
       
   107 
       
   108 // ----------------------------------------------------------------------------
       
   109 // ScomoProNoteIndicator::handleInteraction
       
   110 // @see dmpronoteindicators.h
       
   111 // ----------------------------------------------------------------------------
       
   112 bool ScomoProNoteIndicator::handleInteraction(InteractionType type)
       
   113     {
       
   114     qDebug("ScomoProNoteIndicator::handleInteraction() Start");
       
   115     bool handled = false;
       
   116     
       
   117     emit deactivate();
       
   118     CCoeEnv* coe = CCoeEnv::Static(); 
       
   119     TApaTaskList taskList(coe->WsSession());
       
   120     TApaTask task=taskList.FindApp(TUid::Uid(0x200267FB));
       
   121     if(task.Exists())
       
   122         {
       
   123         task.BringToForeground();
       
   124         }
       
   125     qDebug("ScomoProNoteIndicator::handleInteraction() End");
       
   126     return handled;
       
   127     }
       
   128 
       
   129