usbuis/usbindicatorplugin/src/usbindicator.cpp
changeset 56 f45583a69686
parent 38 218231f2b3b3
equal deleted inserted replaced
38:218231f2b3b3 56:f45583a69686
    13 *
    13 *
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 #include "usbindicator.h" 
    17 #include "usbindicator.h" 
    18 #include <QVariant.h>
    18 #include <QVariant>
    19 #include <e32uid.h>
    19 #include <e32uid.h>
    20 #include <apadef.h>
    20 #include <apadef.h>
    21 
    21 #include "usbdebug.h"
    22 
    22 
    23 const QString TextIdPrefix = ("txt_usb_dblist_usb_connected_val_");
    23 const QString TextIdPrefix = ("txt_usb_dblist_usb_connected_val_");
    24 /*!
    24 /*!
    25    USBIndicator::USBIndicator
    25    USBIndicator::USBIndicator
    26 */ 
    26 */ 
    42 /*!
    42 /*!
    43    USBIndicator::handleInteraction
    43    USBIndicator::handleInteraction
    44 */
    44 */
    45 bool USBIndicator::handleInteraction(InteractionType type)
    45 bool USBIndicator::handleInteraction(InteractionType type)
    46 {
    46 {
       
    47     myDebug() << ">>> USBIndicator::handleInteraction";
    47     bool handled = false;
    48     bool handled = false;
    48     TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
    49     TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
    49                             TUid::Uid(KUSBUIUid));    
    50                             TUid::Uid(KUSBUIUid));    
    50     if (type == InteractionActivated) {
    51     if (type == InteractionActivated) {
    51         RProcess usbUiProcess;                
    52         RProcess usbUiProcess;                
    54             usbUiProcess.Resume();
    55             usbUiProcess.Resume();
    55         }
    56         }
    56         usbUiProcess.Close();         
    57         usbUiProcess.Close();         
    57         handled = true;                
    58         handled = true;                
    58     }
    59     }
       
    60     myDebug() << "<<< USBIndicator::handleInteraction";
    59     return handled;
    61     return handled;
    60 }
    62 }
    61 
    63 
    62 /*!
    64 /*!
    63    USBIndicator::indicatorData
    65    USBIndicator::indicatorData
    64    returns the data and icon that needs to be displayed in the universal pop up and indicator menu 
    66    returns the data and icon that needs to be displayed in the universal pop up and indicator menu 
    65 */
    67 */
    66 QVariant USBIndicator::indicatorData(int role) const
    68 QVariant USBIndicator::indicatorData(int role) const
    67 {
    69 {
       
    70     myDebug() << ">>> USBIndicator::indicatorData, role is " << role;
    68     switch(role) {
    71     switch(role) {
    69     case PrimaryTextRole: 
    72     	case PrimaryTextRole: 
    70         {
    73         {
    71         QString text = QString(hbTrId("txt_usb_dblist_usb_connected"));
    74         	QString text = QString(hbTrId("txt_usb_dblist_usb_connected"));
    72         return text;
    75         	return text;
    73         }
    76         }
    74     case SecondaryTextRole:
    77     	case SecondaryTextRole:
    75         {
    78         {
    76         return mSecDisplayName;
    79         	return mSecDisplayName;
    77         }
    80         }
    78     case DecorationNameRole:
    81    	 	case DecorationNameRole:
    79         {
    82         {
    80         QString iconName(KUsbIconFile);
    83         	QString iconName(KUsbIconFile);
    81         return iconName;
    84         	return iconName;
    82         }
    85         }
    83     default: 
    86     	default: 
    84         return QVariant();      
    87         	return QVariant();      
    85     }
    88     }
    86 }
    89 }
    87 
    90 
    88 /*!
    91 /*!
    89    USBIndicator::handleClientRequest
    92    USBIndicator::handleClientRequest
    90    handles client's activate and deactivate request
    93    handles client's activate and deactivate request
    91 */
    94 */
    92 bool USBIndicator::handleClientRequest( RequestType type, 
    95 bool USBIndicator::handleClientRequest( RequestType type, 
    93         const QVariant &parameter)
    96         const QVariant &parameter)
    94 { 
    97 { 
       
    98     myDebug() << ">>> USBIndicator::handleClientRequest";
    95     switch (type) {
    99     switch (type) {
    96         case RequestActivate:
   100         case RequestActivate:
    97             {
   101             {
    98             QString friendlyName = parameter.toString();
   102             QString friendlyName = parameter.toString();
    99             friendlyName.replace( QChar(' '), QChar('_') );
   103             friendlyName.replace( QChar(' '), QChar('_') );
   106             mSecDisplayName.clear();
   110             mSecDisplayName.clear();
   107             emit deactivate();
   111             emit deactivate();
   108             break;
   112             break;
   109     }
   113     }
   110     //request always handled
   114     //request always handled
       
   115    	myDebug() << "<<< USBIndicator::handleClientRequest";
   111     return true;
   116     return true;
   112 }
   117 }