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