--- a/layers.sysdef.xml Tue Jan 26 12:55:41 2010 +0200
+++ b/layers.sysdef.xml Fri Apr 23 23:17:21 2010 +0300
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
<!ENTITY layer_real_source_path "sf/mw/usbservices" >
]>
-<SystemDefinition name="usbservices" schema="1.4.0">
+<SystemDefinition name="usbservices" schema="1.5.1">
<systemModel>
<layer name="mw_layer">
<module name="usbservices">
@@ -11,14 +11,10 @@
</module>
<module name="">
<unit unitID="lcdo.usbservices.usbclasses.usbosdescriptorhandler" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbosdescriptorhandler/group" filter="!sf_build" name="usbservices_usbclasses_usbosdescriptorhandler" />
- <unit unitID="lcdo.usbservices.usbclasses.msmmplugin" mrp="" bldFile="&layer_real_source_path;/usbclasses/msmmplugin/group" filter="!sf_build" name="usbservices_usbclasses_msmmplugin" />
- <unit unitID="lcdo.usbservices.usbclasses.usbhidclassdriver" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbhidclassdriver/group" filter="!sf_build" name="usbservices_usbclasses_usbhidclassdriver" />
- </module>
+ </module>
+ <module name="usbuiqt">
+ <unit unitID="lcdo.usbservices.usbclasses.usbuiqt" mrp="" bldFile="&layer_real_source_path;/usbuis/usbuiqt" name="usbservices_usbuis_usbapplication" proFile="usbapplication.pro" qmakeArgs="" />
+ </module>
</layer>
- <layer name="api_test_layer">
- <module name="usbservices_test">
- <unit unitID="lcdo.usbservices_test" mrp="" bldFile="&layer_real_source_path;/tsrc/group" name="usbservices_test" />
- </module>
- </layer>
</systemModel>
</SystemDefinition>
--- a/package_definition.xml Tue Jan 26 12:55:41 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
- <package id="usbservices" name="USB Services" levels="framework server generic specific plugin">
- <collection id="usbclasses" name="USB Classes" level="framework">
- <component id="usbobexclasscontroller" filter="s60" name="USB OBEX Class Controller" class="plugin">
- <unit bldFile="usbclasses/usbobexclasscontroller/group"/>
- <!-- <unit bldFile="usbclasses/usbobexclasscontroller/tsrc/group"/> -->
- </component>
- <component id="usbbasicpersonality" filter="s60" name="USB Basic Personality" class="plugin">
- <unit bldFile="usbclasses/usbbasicpersonality/group"/>
- </component>
- <component id="usbmscpersonality" filter="s60" name="USB MSC Personality" class="plugin">
- <unit bldFile="usbclasses/usbmscpersonality/group"/>
- </component>
- <component id="ptpstack" filter="s60" name="Picture Transfer Protocol Stack">
- <unit bldFile="usbclasses/ptpstack/group"/>
- </component>
- <component id="sicdusbplugin" filter="s60" name="SICD USB Plugin" class="plugin">
- <unit bldFile="usbclasses/sicdusbplugin/group"/>
- </component>
- <component id="ptpserver" filter="s60" name="Picture Transfer Protocol Server">
- <unit bldFile="usbclasses/ptpserver/group"/>
- <!-- <unit bldFile="usbclasses/ptpserver/ptpclasscontroller/group"/> -->
- </component>
- <component id="pictbridgeengine" filter="s60" name="PictBridge Engine">
- <unit bldFile="usbclasses/pictbridgeengine/group"/>
- </component>
- </collection>
- <collection id="usbengines" name="USB Engines" level="generic">
- <component id="usbwatcher" filter="s60" name="USB Watcher">
- <unit bldFile="usbengines/usbwatcher/group"/>
- </component>
- <component id="usblocodplugin" filter="s60" name="USB Local Connectivity Domain Plugin" class="plugin">
- <unit bldFile="usbengines/usblocodplugin/group"/>
- <!-- <unit bldFile="usbengines/usblocodplugin/tsrc/group"/> -->
- </component>
- <component id="usbdevcon" filter="s60" name="USB Device Control">
- <unit bldFile="usbengines/usbdevcon/group"/>
- </component>
- <component id="usbremotepersonality" filter="s60" name="USB Remote Personality">
- <unit bldFile="usbengines/usbremotepersonality/group"/>
- </component>
- </collection>
- <collection id="usbuis" name="USB UIs" level="specific">
- <component id="usbui" filter="s60" name="USB UI">
- <unit bldFile="usbuis/usbui/group"/>
- <!-- <unit bldFile="usbuis/usbui/tsrc/usbuiapitest/group"/> -->
- </component>
- <component id="usbuinotif" filter="s60" name="USB UI Notifiers">
- <unit bldFile="usbuis/usbuinotif/group"/>
- <!-- <unit bldFile="usbuis/usbuinotif/tsrc/usbuinotifapitest/group"/> -->
- </component>
- <component id="imageprintuiprovider" filter="s60" name="ImagePrint UI Provider" class="plugin">
- <unit bldFile="usbuis/imageprintuiprovider/group"/>
- </component>
- <component id="usbimageprintui" filter="s60" name="ImagePrint UI">
- <unit bldFile="usbuis/imageprintui/group"/>
- </component>
- </collection>
- </package>
-</SystemDefinition>
--- a/sysdef_1_4_0.dtd Tue Jan 26 12:55:41 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
- <!ELEMENT SystemDefinition (systemModel?, build?)>
- <!ATTLIST SystemDefinition
- name CDATA #REQUIRED
- schema CDATA #REQUIRED>
- <!ELEMENT systemModel (layer+)>
- <!ELEMENT layer (logicalset* | module*)*>
- <!ATTLIST layer
- name CDATA #REQUIRED
- levels CDATA #IMPLIED
- span CDATA #IMPLIED>
- <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalset name CDATA #REQUIRED>
- <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalsubset name CDATA #REQUIRED>
- <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
- <!ATTLIST module
- name CDATA #REQUIRED
- level CDATA #IMPLIED>
- <!ELEMENT component (unit* | package* | prebuilt*)*>
- <!ATTLIST component name CDATA #REQUIRED>
- <!ELEMENT unit EMPTY>
- <!ATTLIST unit
- unitID ID #REQUIRED
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- bldFile CDATA #REQUIRED
- priority CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT package EMPTY>
- <!ATTLIST package
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT prebuilt EMPTY>
- <!ATTLIST prebuilt
- name CDATA #REQUIRED
- version CDATA #REQUIRED
- late (Y|N) #IMPLIED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
- <!ELEMENT unitList (unitRef+)>
- <!ATTLIST unitList
- name ID #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT unitRef EMPTY>
- <!ATTLIST unitRef unit IDREF #REQUIRED>
- <!ELEMENT targetList EMPTY>
- <!ATTLIST targetList
- name ID #REQUIRED
- description CDATA #REQUIRED
- target IDREFS #REQUIRED>
- <!ELEMENT target EMPTY>
- <!ATTLIST target
- name ID #REQUIRED
- abldTarget CDATA #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT option EMPTY>
- <!ATTLIST option
- name ID #REQUIRED
- abldOption CDATA #REQUIRED
- description CDATA #REQUIRED
- enable (Y | N | y | n) #REQUIRED>
- <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
- <!ATTLIST configuration
- name ID #REQUIRED
- description CDATA #REQUIRED
- filter CDATA #REQUIRED>
- <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
- <!ELEMENT unitListRef EMPTY>
- <!ATTLIST unitListRef unitList IDREF #REQUIRED>
- <!ELEMENT layerRef EMPTY>
- <!ATTLIST layerRef layerName CDATA #REQUIRED>
- <!ELEMENT buildLayer EMPTY>
- <!ATTLIST buildLayer
- command CDATA #REQUIRED
- targetList IDREFS #IMPLIED
- unitParallel (Y | N | y | n) #REQUIRED
- targetParallel (Y | N | y | n) #IMPLIED>
- <!ELEMENT specialInstructions EMPTY>
- <!ATTLIST specialInstructions
- name CDATA #REQUIRED
- cwd CDATA #REQUIRED
- command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ proFile CDATA #IMPLIED
+ qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- a/usbclasses/group/bld.inf Tue Jan 26 12:55:41 2010 +0200
+++ b/usbclasses/group/bld.inf Fri Apr 23 23:17:21 2010 +0300
@@ -23,9 +23,4 @@
//#include "../sicdusbplugin/group/bld.inf"
//#include "../ptpserver/group/bld.inf"
#include "../pictbridgeengine/group/bld.inf"
-//Wusan@20091210: DEF143281: sf build break because of
-// msmmplugin & usbhidclassdriver do not contribute to.
-//PS, this comment and the below 2 line will be deleted after review!
-//#include "../msmmplugin/group/bld.inf"
-//#include "../usbhidclassdriver/group/bld.inf"
#include "../usbphoneasmodem/group/bld.inf"
--- a/usbengines/usbwatcher/group/usbwatcherserver.mmp Tue Jan 26 12:55:41 2010 +0200
+++ b/usbengines/usbwatcher/group/usbwatcherserver.mmp Fri Apr 23 23:17:21 2010 +0300
@@ -37,6 +37,8 @@
SOURCE cusbdevicelock.cpp
SOURCE cusbdevconstarter.cpp
SOURCE cusbglobalsystemstateobserver.cpp
+SOURCE tusbindicatorhandler.cpp
+
USERINCLUDE ../inc
--- a/usbengines/usbwatcher/inc/cusbwatcher.h Tue Jan 26 12:55:41 2010 +0200
+++ b/usbengines/usbwatcher/inc/cusbwatcher.h Fri Apr 23 23:17:21 2010 +0300
@@ -30,7 +30,7 @@
#include "debug.h"
#include "musbwatchernotify.h"
#include "cusbwatchersession.h"
-
+#include "tusbindicatorhandler.h"
class CUsbActiveState;
@@ -438,7 +438,16 @@
* OTG Watcher
*/
CUsbOtgWatcher* iOtgWatcher; //OTG
-
+
+ /*
+ * USB indicator handler to handle device side indicator
+ */
+ TUsbIndicatorHandler iUsbIndicatorHandler;
+
+ /*
+ * Starting mode is normal?
+ */
+ TBool iNormalStart;
};
#include "cusbwatcher.inl"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/inc/tusbindicatorhandler.h Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header file for class TUsbIndicatorHandler
+*
+*/
+
+
+#ifndef TUSBINDICATORHANDLER_H
+#define TUSBINDICATORHANDLER_H
+
+#include <bldvariant.hrh>
+#include <usbstates.h>
+
+
+/**
+* USB indicator handler class for device side.
+*
+* This class shows USB indicator when device state changes to Configured,
+* and hides USB indicator when device leaves Configured state. Suspended
+ * state does not change the indicator.
+*
+* @since TB9.2
+*/
+NONSHARABLE_CLASS( TUsbIndicatorHandler )
+ {
+
+public:
+ /**
+ * Constructor
+ */
+ TUsbIndicatorHandler();
+
+ /**
+ * Set USB indicator (On/Off, maybe more in future) according to
+ * the change of USB device state
+ *
+ * @param aStateOld previous USB device state
+ * @param aStateNew current USB device state
+ */
+ void HandleDeviceStateChange( TUsbDeviceState aStateOld,
+ TUsbDeviceState aStateNew );
+
+private:
+ /**
+ * Show USB indicator (On/Off, maybe more in future)
+ *
+ * @since TB9.2
+ * @param aUsbIndicatorState the state of the indicator, 0: OFF, 1: ON
+ */
+ void ShowUsbIndicator( TInt aUsbIndicatorState );
+
+private:
+ /**
+ * The device state before suspend.
+ * Used to filter out suspend from others;
+ */
+ TUsbDeviceState iDevStateB4Suspend;
+
+ /////////////////////////////////////////////////////////////////////////
+ // Test code
+ friend class CtTUsbIndicatorHandler;
+ TBool iUsbIndicator;
+ //
+ /////////////////////////////////////////////////////////////////////////
+
+ };
+
+
+#endif // TUSBINDICATORHANDLER_H
+
+// End of File
--- a/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Tue Jan 26 12:55:41 2010 +0200
+++ b/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Fri Apr 23 23:17:21 2010 +0300
@@ -185,18 +185,6 @@
#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_TASKDP_IBY
-// contactdp
-#ifndef MTP_CONTACTDP_IBY
-#define MTP_CONTACTDP_IBY
-#if !defined(SYMBIAN_EXCLUDE_MTP)
-// MTP Data Provider API
-ECOM_PLUGIN(mtpcontactdp.dll, mtpcontactdp.rsc)
-// MTP plugin registration resource file
-data=EPOCROOT##epoc32\data\Z\resource\mtp\102872bd.rsc resource\mtp\102872bd.rsc
-data=EPOCROOT##epoc32\data\Z\resource\apps\mtpcontactviewdefinition.rsc resource\apps\mtpcontactviewdefinition.rsc
-#endif // SYMBIAN_EXCLUDE_MTP
-#endif // MTP_CONTACTDP_IBY
-
// bluetooth
#ifndef MTP_BT_IBY
#define MTP_BT_IBY
--- a/usbengines/usbwatcher/src/cusbactivestate.cpp Tue Jan 26 12:55:41 2010 +0200
+++ b/usbengines/usbwatcher/src/cusbactivestate.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -95,13 +95,25 @@
LOG_FUNC
LEAVEIFERROR( iStatus.Int() ); // Close process if error happens here
- LOG2( "DeviceState change: %d ==> %d", iPreviousState, iCurrentState );
+
TUsbDeviceState newState = iCurrentState;
iUsbMan.DeviceStateNotification( KUsbAllStates, iCurrentState,
iStatus );
SetActive();
- iOwner.StateChangeNotify( iPreviousState, newState );
- iPreviousState = newState;
+
+ // Notify only if there is a change
+ if ( newState != iPreviousState )
+ {
+ LOG2( "USB device state changed: %d ==> %d", iPreviousState,
+ newState );
+ iOwner.StateChangeNotify( iPreviousState, newState );
+ iPreviousState = newState;
+ }
+ else
+ {
+ LOG2("USB device change ignored: %d -> %d", iPreviousState,
+ newState );
+ }
}
// ----------------------------------------------------------------------------
--- a/usbengines/usbwatcher/src/cusbwatcher.cpp Tue Jan 26 12:55:41 2010 +0200
+++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -222,7 +222,14 @@
{
LOG_FUNC
- if( IsDeviceA() ) // Will be handled by UsbOtgWatcher
+ // Handling USB indicator. This is valid for both A- and B-device cases.
+ // Not show USB indicator in charging mode
+ if ( iNormalStart )
+ {
+ iUsbIndicatorHandler.HandleDeviceStateChange( aStateOld, aStateNew );
+ }
+
+ if ( IsDeviceA() ) // Will be handled by UsbOtgWatcher
{
LOG( "Device state change ignored by UsbWatcher in A-device state" );
return;
@@ -533,13 +540,6 @@
LOG2( "aPersonalityId=%d, aNonBlocking=%d", aPersonalityId, aNonBlocking );
- if( IsDeviceA() )
- {
- LOG( "SetPersonality not allowed in A-device state" );
- Notify( KErrAccessDenied );
- return;
- }
-
// Check if personality is exist
TBool found = EFalse;
@@ -679,17 +679,21 @@
{
LOG_FUNC
- if( IsDeviceA() )
- {
- LOG( "Not allowed in A-device state" );
- Notify( KErrAccessDenied );
- return;
- }
TUsbDeviceState state = iActiveState->CurrentState();
- LOG1( "Device state : %d", state );
+ LOG2( "IsDeviceA: %d, Device state : %d", IsDeviceA(), state );
- if( state != EUsbDeviceStateUndefined )
+ // As A-device, only cenrep will be updated for the reasons of
+ // - In A-host state, device state will be undefined
+ // - In A-peripheral state, personality change can not happen otherwise
+ // the connection will be lost
+ if ( IsDeviceA() || ( EUsbDeviceStateUndefined == state ) )
+ {
+ // if no connection -> just save the setting
+ LOG( "CUsbWatcher::SwitchPersonality: Notify" );
+ Notify( KErrNone );
+ }
+ else
{
switch ( iState )
{
@@ -722,12 +726,6 @@
break;
}
}
- else
- {
- // if no connection -> just save the setting
- LOG( "CUsbWatcher::SwitchPersonality: Notify" );
- Notify( KErrNone );
- }
}
// ----------------------------------------------------------------------------
@@ -743,6 +741,7 @@
if( iState == EUsbIdle )
{
iStarted = EFalse;
+ iNormalStart = EFalse;
if( globalState == ESwStateCharging )
{
LOG( "Global state: charging" );
@@ -770,6 +769,7 @@
( ESwStateNormalBTSap == globalState ) ))
{
LOG( "Global state: normal" );
+ iNormalStart = ETrue;
if( ! iUsbDeviceLock->Locked() )
{
iGlobalStateObserver->Cancel();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/src/tusbindicatorhandler.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This implements TUsbIndicatorHandler class.
+*
+*/
+
+
+#include <e32std.h>
+#include <AknNotifySignature.h> // SAknNotifierPackage
+#include <avkon.hrh> //EAknIndicatorUSBConnection
+#include "tusbindicatorhandler.h"
+#include "debug.h"
+
+// ---------------------------------------------------------------------------
+// C++ Constructor
+// ---------------------------------------------------------------------------
+//
+TUsbIndicatorHandler::TUsbIndicatorHandler()
+ : iDevStateB4Suspend( EUsbDeviceStateUndefined )
+ , iUsbIndicator(EFalse)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Change USB Indicator
+// ---------------------------------------------------------------------------
+//
+void TUsbIndicatorHandler::HandleDeviceStateChange( TUsbDeviceState aStateOld,
+ TUsbDeviceState aStateNew )
+ {
+ LOG_FUNC
+
+ LOG2( "USB device state changed: %d ==> %d", aStateOld, aStateNew );
+
+ if ( EUsbDeviceStateConfigured == aStateNew ) // Entering configed state
+ {
+ // filter out case of configed -> suspended -> configed
+ if ( ( EUsbDeviceStateSuspended != aStateOld ) ||
+ ( EUsbDeviceStateConfigured != iDevStateB4Suspend) )
+ {
+ ShowUsbIndicator( ETrue );
+ }
+ }
+ else if ( EUsbDeviceStateSuspended == aStateNew )
+ // If current state is suspend, we do not change the indicator, but save
+ // the previous state
+ {
+ iDevStateB4Suspend = aStateOld;
+ }
+ else // New device state is not configured, nor suspended
+ {
+ // Hide USB indicator if previous state is either configured, or
+ // suspended AND state before is not configured
+ if( ( EUsbDeviceStateConfigured == aStateOld ) ||
+ ( ( EUsbDeviceStateSuspended == aStateOld ) &&
+ ( EUsbDeviceStateConfigured == iDevStateB4Suspend ) ) )
+ {
+ ShowUsbIndicator( EFalse );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Show USB Indicator
+// ---------------------------------------------------------------------------
+//
+void TUsbIndicatorHandler::ShowUsbIndicator( TInt aUsbIndicatorState )
+ {
+ LOG_FUNC
+
+ iUsbIndicator = aUsbIndicatorState;
+ LOG1( "USB indicator state %d", aUsbIndicatorState );
+ RNotifier notifier;
+ TInt err = notifier.Connect();
+ if ( KErrNone == err )
+ {
+ TPckgBuf< SAknNotifierPackage<SAknSmallIndicatorParams> > pckg;
+ pckg().iParamData.iSmallIndicatorUid =
+ TUid::Uid( EAknIndicatorUSBConnection );
+ pckg().iParamData.iValue = aUsbIndicatorState ?
+ EAknIndicatorStateOn : EAknIndicatorStateOff ;
+ notifier.StartNotifier( KAknSmallIndicatorUid, pckg );
+ notifier.Close();
+ }
+ else
+ {
+ LOG1( "RNotifier::Connect error: %d", err );
+ }
+ }
+
+// End of file
--- a/usbuis/usbuinotif/group/bld.inf Tue Jan 26 12:55:41 2010 +0200
+++ b/usbuis/usbuinotif/group/bld.inf Fri Apr 23 23:17:21 2010 +0300
@@ -28,7 +28,6 @@
PRJ_MMPFILES
usbuinotif.mmp
-usbavkonnotif.mmp
PRJ_TESTMMPFILES
--- a/usbuis/usbuinotif/group/usbavkonnotif.mmp Tue Jan 26 12:55:41 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Project definition file for project USBUINotif.
- *
- */
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh> //this is needed for RESOURCE_FILES_DIR
-
-TARGET usbavkonnotif.dll
-TARGETTYPE dll
-UID 0x101fdfae 0x102068DD
-TARGETPATH SHARED_LIB_DIR
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-
-SOURCE usbuincableconnectednotifier.cpp usbavkonmain.cpp
-SOURCE usbnotifier.cpp
-
-USERINCLUDE ../inc
-
-SYSTEMINCLUDE ../../inc ../../../inc MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/) //for internal and private API headers
-
-MW_LAYER_SYSTEMINCLUDE
-LIBRARY ECOM.LIB // Symbian E-Com Plugin definitions and types
-LIBRARY euser.lib cone.lib // Symbian OS frameworklibraries
-LIBRARY avkon.lib // UI library
-LIBRARY bafl.lib // Basic Application Framework
-LIBRARY commonengine.lib // Series 60 common components
-LIBRARY eikcoctl.lib eiksrv.lib // Eikon libraries
-LIBRARY eikdlg.lib // Eikon dialogs
-LIBRARY estor.lib // for Cover Display UI support
-LIBRARY FeatMgr.lib // for fetching if Cover Display is supported
-LIBRARY centralrepository.lib // Central Repository
-LIBRARY aknmemorycardui.lib // for unlocking the MMC
-LIBRARY efsrv.lib // File server
-LIBRARY eikcore.lib // for icons
-LIBRARY aknskins.lib
-LIBRARY aknskinsrv.lib
-LIBRARY aknicon.lib
-LIBRARY egul.lib
-LIBRARY usbman.lib // for personality IDs and descriptions
-LIBRARY aknnotifierwrapper.lib // Avkon's notifier wrapper
-LIBRARY apparc.lib
-LIBRARY akncapserverclient.lib // for suppressing the application key
-
-DEBUGLIBRARY flogger.lib // File logging services
--- a/usbuis/usbuinotif/group/usbuinotif.mmp Tue Jan 26 12:55:41 2010 +0200
+++ b/usbuis/usbuinotif/group/usbuinotif.mmp Fri Apr 23 23:17:21 2010 +0300
@@ -29,6 +29,7 @@
SOURCEPATH ../src
SOURCE usbuinmain.cpp
SOURCE usbnotifier.cpp
+SOURCE usbuincableconnectednotifier.cpp
SOURCE usbuinqueriesnotifiermdrv.cpp
SOURCE usbuinotifotgwarning.cpp
SOURCE usbuinotifotgerror.cpp
@@ -47,8 +48,9 @@
USERINCLUDE ../inc
-SYSTEMINCLUDE ../../inc ../../../inc MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/) //for internal and private API headers
-SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../inc ../../../inc MW_LAYER_PLATFORM_EXPORT_PATH(secondarydisplay/) //for internal and private API headers
+SYSTEMINCLUDE /EPOC32/INCLUDE/ECOM
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore
MW_LAYER_SYSTEMINCLUDE
@@ -74,6 +76,7 @@
LIBRARY aknnotifierwrapper.lib // Avkon's notifier wrapper
LIBRARY apparc.lib
LIBRARY akncapserverclient.lib // for suppressing the application key
+LIBRARY hbcore.lib
DEBUGLIBRARY flogger.lib // File logging services
--- a/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Tue Jan 26 12:55:41 2010 +0200
+++ b/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Fri Apr 23 23:17:21 2010 +0300
@@ -20,8 +20,8 @@
// INCLUDES
-#include <aknlistquerydialog.h>
-#include <AknQueryDialog.h>
+#include <hbsymbiandevicedialog.h>
+#include <hbsymbianvariant.h>
#include "usbnotifier.h" // Base class
// CLASS DECLARATION
@@ -31,8 +31,8 @@
*
* @lib
*/
-NONSHARABLE_CLASS(CUSBUICableConnectedNotifier) : public CUSBUINotifierBase,
- public MEikCommandObserver
+NONSHARABLE_CLASS(CUSBUICableConnectedNotifier) : public CUSBUINotifierBase,
+ public MHbDeviceDialogObserver
{
public:
// Constructors and destructor
@@ -84,10 +84,22 @@
void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
+
+private:
+ // functions from MHbDeviceDialogObserver
+
/**
- * Handles the command on USB connected note
- */
- void ProcessCommandL(TInt aCommandId);
+ * lunches the QT usb ui setting
+ * @param aData is a CHbSymbianVariantMap daya which contains the keys
+ */
+ void DataReceived(CHbSymbianVariantMap& aData);
+ /*
+ * Virtual function from MHbDeviceDialogObserver
+ * Not implemented
+ */
+ void DeviceDialogClosed(TInt aCompletionCode);
+
+
private:
//New functions
@@ -98,10 +110,12 @@
void GetCurrentIdL(TInt& aCurrentPersonality);
/**
* Get the mode name and header for current personality
+ * The parameters are pushed to the cleanup stack in order
+ * aDescription, aHeader.
* @param aDescription The returned current personality string.
* @param aHeader The header string for message query.
*/
- void GetPersonalityStringL(HBufC*& aHeader,HBufC*& aDescription );
+ void GetPersonalityStringLC(HBufC*& aHeader,HBufC*& aDescription );
/**
* Runs the connected discreet note
@@ -110,16 +124,28 @@
/**
- * creates the USB UI setting view
- * @param aProcessName The process name (USBClassChangeUI.exe)
+ * launches the (USB) application
+ * @param aProcessName The process name (*.exe)
* @param TUidType
*/
- void CreateChosenViewL(const TDesC & aProcessName,const TUidType & aUidType) const;
+ void LaunchApplication(const TDesC & aProcessName,const TUidType & aUidType) const;
+
+ /**
+ * Adds a parameter to the dialog parameters.
+ */
+ void AddParameterL(
+ CHbSymbianVariantMap* aParameters,
+ const TDesC& aKey,
+ const TAny* aData,
+ CHbSymbianVariant::TType aDataType);
+
private:
/**
* C++ default constructor.
*/
CUSBUICableConnectedNotifier();
+
+ CHbDeviceDialog* iDialog;
};
#endif // USBUINCABLECONNECTEDNOTIFIER_H
--- a/usbuis/usbuinotif/rom/usbuinotif.iby Tue Jan 26 12:55:41 2010 +0200
+++ b/usbuis/usbuinotif/rom/usbuinotif.iby Fri Apr 23 23:17:21 2010 +0300
@@ -22,7 +22,6 @@
#ifdef __USB_MULTIPERSONALITY
ECOM_PLUGIN(usbuinotif.dll, 102068DC.rsc)
-file=ABI_DIR\BUILD_DIR\usbavkonnotif.dll SHARED_LIB_DIR\usbavkonnotif.dll
#endif //__USB_MULTIPERSONALITY
#endif //__USBUINOTIF_IBY__
\ No newline at end of file
--- a/usbuis/usbuinotif/src/usbavkonmain.cpp Tue Jan 26 12:55:41 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Methods for USB UI notifiers.
- *
- */
-
-// INCLUDE FILES
-#include <eiknotapi.h>
-#include <eikenv.h>
-
-#include "usbuincableconnectednotifier.h"
-#include "usbuinqueriesnotifier.h"
-#include "usbuinotifdebug.h"
-
-// CONSTANTS
-const TInt KUSBUINotifierArrayIncrement = 1;
-
-
-// ================= EXPORTED FUNCTIONS =======================================
-
-// ----------------------------------------------------------------------------
-//
-// Instantiate notifiers
-//
-// ----------------------------------------------------------------------------
-
-LOCAL_C void CreateUSBUINotifiersL(
- CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
- {
- FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL"));
-
- CUSBUICableConnectedNotifier* cableConnectedNotifier =
- CUSBUICableConnectedNotifier::NewL();
- CleanupStack::PushL( cableConnectedNotifier );
- aNotifiers->AppendL( cableConnectedNotifier );
- CleanupStack::Pop( cableConnectedNotifier );
-
-
- FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL completed"));
- }
-
-// ----------------------------------------------------------------------------
-//
-// Lib main entry point: Creates a notifiers array.
-//
-// ----------------------------------------------------------------------------
-
-EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
- {
- FLOG(_L("[USBUINOTIF]\t NotifierArray"));
-
- CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = NULL;
-
- TRAPD( err, notifiers =
- new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(
- KUSBUINotifierArrayIncrement ));
-
- if ( err == KErrNone )
- {
- if( notifiers )
- {
- TRAPD( errCreate, CreateUSBUINotifiersL( notifiers ));
- if( errCreate )
- {
- TInt count = notifiers->Count();
- while(count--)
- {
- (*notifiers)[count]->Release();
- }
- delete notifiers;
- notifiers = NULL;
- }
-
- FLOG(_L("[USBUINOTIF]\t NotifierArray completed"));
- }
- }
- else
- {
- FLOG(_L("[USBUINOTIF]\t NotifierArray Failed!!!"));
- }
-
- return notifiers;
- }
-
-// End of File
--- a/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp Tue Jan 26 12:55:41 2010 +0200
+++ b/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -21,32 +21,20 @@
#include <aknPopup.h>
#include <StringLoader.h> // Localisation stringloader
#include <utf.h> // Unicode character conversion utilities
-#include <AknsUtils.h>
-#include <usb.h>
+#include <usbman.h>
#include <usbuinotif.rsg> // Own resources
#include <centralrepository.h>
#include <e32property.h>
-//for loading icons USB fork and empty
-#include <AknIconArray.h>
-#include <avkon.mbg>
-#include <AknsConstants.h>
-#include <aknmessagequerydialog.h>
-//for cover display support
-#include <AknMediatorFacade.h>
-#include <SecondaryDisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI
-#include <akndiscreetpopup.h>
#include <e32uid.h> // KExecutableImageUid
-#include <usbui.mbg>
#include "usbuincableconnectednotifier.h" // Own class definition
#include "usbuinotifdebug.h" // Debugging macros
#include "UsbWatcherInternalCRKeys.h"
-#include "usbpersonalityids.h"
#include "usbuinotif.hrh"
// Literals
-_LIT(KUSBExe, "usbclasschangeui.exe");
-const TInt KUSBUIUid = 0x102068E2;
+_LIT(KUSBExe, "usbapplication.exe");
+const TInt KUSBUIUid = 0x2002BCA3;
_LIT(KFileDrive,"z:");
_LIT(KUSBUIconFileName, "usbui.mif");
@@ -91,6 +79,8 @@
//this virtual function call is to the local CUSBUICableConnectedNotifier::
//Cancel, not to any possibly derived class implementation.
Cancel();
+ delete iDialog;
+
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::destructor completed"));
}
@@ -175,7 +165,7 @@
// Get the strings for ask on connection message query
// -----------------------------------------------------------------------------------------------------------
//
-void CUSBUICableConnectedNotifier::GetPersonalityStringL(
+void CUSBUICableConnectedNotifier::GetPersonalityStringLC(
HBufC*& aHeader,HBufC*& aDescription )
{
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL"));
@@ -187,9 +177,9 @@
User::LeaveIfError(usbman.GetDescription(CurrentPersonalityID,
aDescription));
CleanupStack::PopAndDestroy(&usbman);
-
+ CleanupStack::PushL(aDescription);
aHeader = StringLoader::LoadL(R_USB_MODE_MSG_HEADER);
-
+ CleanupStack::PushL(aHeader);
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL completed"));
}
@@ -201,24 +191,45 @@
void CUSBUICableConnectedNotifier::RunQueryL()
{
FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL()"));
-
- HBufC* header = NULL;
- HBufC* description =NULL;
- GetPersonalityStringL(header, description);
-
- CleanupStack::PushL(header);
- CleanupStack::PushL(description);
-
- TFileName usbUiIconFilename( KFileDrive );
- usbUiIconFilename += KDC_APP_BITMAP_DIR;
- usbUiIconFilename += KUSBUIconFileName;
- CAknDiscreetPopup::ShowGlobalPopupL(*header,*description, KAknsIIDQgnPropUsb, AknIconUtils::AvkonIconFileName(),
- EMbmAvkonQgn_prop_usb, EMbmAvkonQgn_prop_usb_mask,KAknDiscreetPopupDurationLong, EUSBUICmdDiscreetTapped,( MEikCommandObserver* ) this);
- CompleteMessage(KErrCancel);
+ _LIT(KNotificationType,"com.nokia.hb.devicenotificationdialog/1.0");
+ _LIT(KTouchActivation, "touchActivation");
+ _LIT(KIconName, "iconName");
+ _LIT(KTitle, "title");
+ _LIT(KText, "text");
+
+ HBufC* header = NULL;
+ HBufC* description =NULL;
+ GetPersonalityStringLC(header, description);
+
+ TFileName usbUiIconFilename( KFileDrive );
+ usbUiIconFilename += KDC_APP_BITMAP_DIR;
+ usbUiIconFilename += KUSBUIconFileName;
+ if( iDialog )
+ {
+ delete iDialog;
+ iDialog = NULL;
+ }
+ iDialog = CHbDeviceDialog::NewL();
+ CHbSymbianVariantMap *parameters =CHbSymbianVariantMap::NewL();
+ CleanupStack::PushL(parameters);
+
+ AddParameterL(parameters, KTitle, header, CHbSymbianVariant::EDes);
+ AddParameterL(parameters, KText, description, CHbSymbianVariant::EDes);
+ AddParameterL(parameters, KIconName, &usbUiIconFilename, CHbSymbianVariant::EDes);
+ TBool activation=ETrue;
+ AddParameterL(parameters, KTouchActivation, &activation, CHbSymbianVariant::EBool);
+
+ FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL() show") );
+ TBool error = iDialog->Show(KNotificationType ,*parameters, this);
+ FTRACE( FPrint(
+ _L( "[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL() error = %d" ),
+ error ) );
+
+ CleanupStack::PopAndDestroy(parameters);
+ CleanupStack::PopAndDestroy(header);
CleanupStack::PopAndDestroy(description);
- CleanupStack::PopAndDestroy(header);
-
+
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed"));
}
// ----------------------------------------------------------------------------
@@ -233,44 +244,100 @@
CRepository* repository = CRepository::NewL(KCRUidUsbWatcher);
CleanupStack::PushL(repository);
// Get the current USB mode
- repository->Get(KUsbWatcherPersonality, aCurrentPersonality);
+ TInt ret = repository->Get(KUsbWatcherPersonality, aCurrentPersonality);
+ FTRACE( FPrint(
+ _L( "[USBWATCHER]\t CUSBUICableConnectedNotifier::GetCurrentIdL() ret = %d" ),
+ ret ) );
CleanupStack::PopAndDestroy(repository);
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetCurrentIdL completed"));
}
// ----------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::ProcessCommandL()
-// when discreet pop up is tapped the command will be handled here
+// CUSBUICableConnectedNotifier::DataReceived
+// launches the QT usb ui setting
// ----------------------------------------------------------------------------
//
-void CUSBUICableConnectedNotifier::ProcessCommandL(TInt aCommandId)
+void CUSBUICableConnectedNotifier::DataReceived(CHbSymbianVariantMap& aData)
{
- switch ( aCommandId )
- {
- case EUSBUICmdDiscreetTapped:
- {
- TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),TUid::Uid(KUSBUIUid));
- CreateChosenViewL(KUSBExe(),uidtype);
- }
- break;
- default:
-
- break;
- }
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::DataReceived"));
+ _LIT(KResult, "result");
+ _LIT(KActivated, "activated");
+ TInt result = 0;
+ MDesCArray& keys = aData.Keys();
+ HBufC* key = NULL;
+ for(TInt i = 0; i < keys.MdcaCount(); i++)
+ {
+ result = keys.MdcaPoint(i).Compare(KResult);
+ if (result == 0)
+ {
+ key = HBufC::New(KResult().Length());
+ if (key)
+ {
+ *key = KResult;
+ const CHbSymbianVariant* variant = aData.Get(*key);
+ delete key;
+ HBufC* value = static_cast<HBufC*>(variant->Data());
+ result = value->Des().Compare(KActivated);
+ if (result == 0)
+ {
+ TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
+ TUid::Uid(KUSBUIUid));
+ LaunchApplication(KUSBExe(), uidtype);
+ }
+ break;
+ }
+ }
+ }
}
+
+// ----------------------------------------------------------------------------
+// CUSBUICableConnectedNotifier::DeviceDialogClosed
+// Not implemented
+// ----------------------------------------------------------------------------
+//
+ void CUSBUICableConnectedNotifier::DeviceDialogClosed(TInt /*aCompletionCode*/)
+ {
+ // no implementation
+ }
+
// ---------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::CreateChosenViewL()
-// creates the USB UI setting view
+// CUSBUICableConnectedNotifier::LaunchApplication()
+// launches the application
// ---------------------------------------------------------------------------
//
- void CUSBUICableConnectedNotifier::CreateChosenViewL(const TDesC & aProcessName,const TUidType & aUidType) const
+void CUSBUICableConnectedNotifier::LaunchApplication(const TDesC & aProcessName,
+ const TUidType & aUidType) const
{
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() "));
- RProcess usbUiProcess;
- User::LeaveIfError(usbUiProcess.Create(aProcessName, KNullDesC, aUidType));
- usbUiProcess.Resume();
- usbUiProcess.Close();
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() "));
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication()"));
+ RProcess usbUiProcess;
+ TInt result = usbUiProcess.Create(aProcessName, KNullDesC, aUidType);
+ FTRACE( FPrint(
+ _L( "[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() result = %d" ),
+ result ) );
+ usbUiProcess.Resume();
+ usbUiProcess.Close();
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() completed"));
+ }
+// ---------------------------------------------------------------------------
+// CUSBUICableConnectedNotifier::AddParameter()
+// Adds a string parameter to the dialog parameters.
+// ---------------------------------------------------------------------------
+//
+void CUSBUICableConnectedNotifier::AddParameterL(
+ CHbSymbianVariantMap* aParameters,
+ const TDesC& aKey,
+ const TAny* aData,
+ CHbSymbianVariant::TType aDataType)
+ {
+ FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::AddStringParameter()") );
+ FTRACE( FPrint(
+ _L( "[USBWATCHER]\t CUSBUICableConnectedNotifier::RunQueryL() aKey = %S" ),
+ &aKey ) );
+ CHbSymbianVariant* variant = CHbSymbianVariant::NewL(aData, aDataType);
+ //aParameters takes variant ownership
+ User::LeaveIfError(aParameters->Add(aKey, variant));
+ FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::AddStringParameter() completed") );
}
+
// End of File
--- a/usbuis/usbuinotif/src/usbuinmain.cpp Tue Jan 26 12:55:41 2010 +0200
+++ b/usbuis/usbuinotif/src/usbuinmain.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -20,21 +20,17 @@
#include <ecom/implementationproxy.h>
#include <eiknotapi.h>
#include <eikenv.h>
-#include <AknNotifierWrapper.h>
-#include <usbuinotif.h>
#include "usbuincableconnectednotifier.h"
#include "usbuinqueriesnotifier.h"
-
-
#include "usbuinotifdebug.h"
#include "usbuinotifotgwarning.h"
#include "usbuinotifotgerror.h"
#include "usbuinotifmsmmerror.h"
// CONSTANTS
-const TInt KUSBUINotifierArrayIncrement = 4;
-_LIT( KUSBUINotifdll, "usbavkonnotif.dll" );
+const TInt KUSBUINotifierArrayIncrement = 5;
+
// ================= EXPORTED FUNCTIONS =======================================
// ----------------------------------------------------------------------------
//
@@ -46,20 +42,12 @@
{
FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL"));
- /* The CableconnectionNotifier is created on the Avkon Wrapper
- * because it contains the discreet popups which are only possible
- * to be launched in a UI framework
- */
- CAknCommonNotifierWrapper* master =
- CAknCommonNotifierWrapper::NewL(KCableConnectedNotifierUid,
- KCableConnectedNotifierUid,
- MEikSrvNotifierBase2::ENotifierPriorityVHigh,
- KUSBUINotifdll,
- 1); // no synchronous reply used.
- CleanupStack::PushL(master);
-
- aNotifiers->AppendL(master );
- CleanupStack::Pop( master );
+ CUSBUICableConnectedNotifier* cableConnectedNotifier =
+ CUSBUICableConnectedNotifier::NewL();
+ CleanupStack::PushL( cableConnectedNotifier );
+ aNotifiers->AppendL( cableConnectedNotifier );
+ CleanupStack::Pop( cableConnectedNotifier );
+
CUSBUIQueriesNotifier* queriesNotifier = CUSBUIQueriesNotifier::NewL();
CleanupStack::PushL( queriesNotifier );
aNotifiers->AppendL( queriesNotifier );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/icons/usb_icon_mode_2.svg Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="-0.014 0.037 42 36">
+<rect fill="none" height="36" width="42" x="-0.014" y="0.037"/>
+<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="18.75" y1="11.54" x2="24.96" y2="27.67">
+<stop stop-color="#AABBD7" offset="0"/>
+<stop stop-color="#92A5CC" offset="0.26"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#637DB5" offset="0.76"/>
+<stop stop-color="#4C6EA4" offset="0.83"/>
+<stop stop-color="#265689" offset="0.91"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M18.823,33.49c-0.028-0.01-0.053-0.021-0.077-0.037l0,0L8.569,28.85 c-0.093-0.043-0.157-0.125-0.171-0.225l0,0L7.83,25.033c-0.012-0.076,0.006-0.154,0.05-0.217l0,0l2.553-3.664l-0.393-3.671 c-0.01-0.082,0.016-0.164,0.068-0.226l0,0l9.84-11.568c1.962-1.956,4.492-2.737,6.807-2.735l0,0c0.896,0,1.76,0.117,2.553,0.329l0,0 c1.481,0.4,2.965,1.106,3.795,2.34l0,0c0.041,0.019,0.078,0.046,0.107,0.081l0,0c0.023,0.029,1.199,1.456,1.201,3.82l0,0 c0,0.34-0.022,0.699-0.078,1.077l0,0c-0.18,1.202-0.634,2.678-0.921,3.342l0,0l-7.986,14.282c-0.018,0.072-0.062,0.135-0.124,0.178 l0,0c-0.053,0.033-0.115,0.051-0.176,0.049l0,0c-0.025,0-0.05-0.004-0.074-0.01l0,0c-0.035-0.008-0.067-0.023-0.096-0.043l0,0 l-1.992-0.879l-3.774,5.799c-0.023,0.059-0.065,0.107-0.119,0.141l0,0c-0.034,0.02-0.07,0.033-0.107,0.039l0,0 c-0.001,0.002-0.003,0.002-0.004,0.002l0,0c-0.002,0-0.004,0-0.006,0l0,0c-0.015,0.002-0.03,0.004-0.045,0.004l0,0 C18.879,33.502,18.851,33.498,18.823,33.49L18.823,33.49z M32.753,6.081l0.179-0.148L32.753,6.081L32.753,6.081z" fill="url(#SVGID_1)"/>
+<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="27.94" y1="30.01" x2="8.42" y2="15.5">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#E0EAF3" offset="0.11"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#8CA9CF" offset="0.48"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#637DB5" offset="0.75"/>
+<stop stop-color="#4C6EA4" offset="0.82"/>
+<stop stop-color="#265689" offset="0.91"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<polygon fill="url(#SVGID_2)" points="25.137,28.184 10.806,21.869 10.334,17.479 25.108,23.307 "/>
+<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="35.78" y1="4.5" x2="22.33" y2="31.13">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#E0EAF3" offset="0.11"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#8CA9CF" offset="0.48"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#637DB5" offset="0.75"/>
+<stop stop-color="#4C6EA4" offset="0.82"/>
+<stop stop-color="#265689" offset="0.91"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M25.117,23.307l7.864-17.383c0,0,1.487,1.795,1.058,4.664c-0.174,1.164-0.627,2.644-0.887,3.241 l-8.027,14.355L25.117,23.307z" fill="url(#SVGID_3)"/>
+<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="15.76" y1="-3.13" x2="28.63" y2="29.22">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#F4F8FB" offset="0.19"/>
+<stop stop-color="#D6E4F0" offset="0.52"/>
+<stop stop-color="#A7C5DF" offset="0.96"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<path d="M29.23,3.599c-2.747-0.735-6.439-0.292-9.072,2.331l-9.825,11.549l14.774,5.828l7.753-13.183 C34.642,6.166,31.987,4.338,29.23,3.599z" fill="url(#SVGID_4)"/>
+<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="25.22" y1="23.12" x2="19.08" y2="11.35">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#C6DCC1" offset="0.08"/>
+<stop stop-color="#91C06F" offset="0.21"/>
+<stop stop-color="#6BAB33" offset="0.32"/>
+<stop stop-color="#539E0E" offset="0.4"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#398419" offset="0.55"/>
+<stop stop-color="#22663B" offset="0.71"/>
+<stop stop-color="#135550" offset="0.85"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path d="M22.05,10.979l-0.616,0.813l3.756,1.229l-2.353,3.107l1.332,0.439l0.696-0.922l2.916,0.965 l-2.067,2.724l-2.899-0.958l0.688-0.923l-6.795-2.236l-0.678,0.935c-0.483-0.736-1.019-1.479-1.515-2.136 c1.078-0.14,2.283-0.313,3.448-0.509l-0.601,0.818l4.521,1.486l1.672-2.219l-2.791-0.916l-0.61,0.814 c-0.477-0.732-1.006-1.473-1.5-2.13C19.741,11.225,20.968,11.053,22.05,10.979z" fill="url(#SVGID_5)"/>
+<linearGradient id="SVGID_6" gradientUnits="userSpaceOnUse" x1="19.37" y1="27.94" x2="-19.75" y2="-11.18">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#000000" offset="1"/>
+</linearGradient>
+<polygon fill="url(#SVGID_6)" points="23.084,23.328 18.86,29.619 8.123,25.02 12.285,19.045 "/>
+<polygon fill="#4D4D4D" points="14.777,23.287 13.833,24.76 11.07,23.572 12.019,22.139 "/>
+<polygon fill="#4D4D4D" points="20.001,25.482 19.064,27.021 16.364,25.848 17.304,24.344 "/>
+<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="17.97" y1="37.85" x2="26.77" y2="9.05">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#000000" offset="1"/>
+</linearGradient>
+<polygon fill="url(#SVGID_7)" points="18.873,29.617 23.084,23.328 22.852,27.178 18.908,33.236 "/>
+<linearGradient id="SVGID_8" gradientUnits="userSpaceOnUse" x1="18.44" y1="33.76" x2="-1.24" y2="14.08">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#000000" offset="1"/>
+</linearGradient>
+<polygon fill="url(#SVGID_8)" points="18.915,33.236 8.691,28.611 8.123,25.02 18.879,29.602 "/>
+<polygon fill="#FFFFFF" points="18.23,32.199 9.25,28.139 9.049,27.063 18.177,31.076 "/>
+<linearGradient id="SVGID_9" gradientUnits="userSpaceOnUse" x1="19.28" y1="1.82" x2="32.69" y2="8.11">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M24.564,5.472l6.489,1.948c0,0,0.749-1.301-2.161-2.179C25.981,4.364,24.564,5.472,24.564,5.472z" fill="url(#SVGID_9)"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/icons/usb_icon_mode_4.svg Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="0 0 42 36">
+<rect fill="none" height="36" width="42"/>
+<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="4.34" y1="18" x2="37.66" y2="18">
+<stop stop-color="#A1C1DC" offset="0.1"/>
+<stop stop-color="#6C82B9" offset="0.71"/>
+<stop stop-color="#173F6C" offset="0.99"/>
+</linearGradient>
+<path d="M12.842,34.012l-0.057-0.078l-6.937-9.3l-0.042-0.059l-1.405-1.881L4.37,22.653v-0.052l-0.027-0.858 L4.34,21.59l0.149-0.015c1.725-0.188,3.256-0.634,4.676-1.372c0.68-1.623,2.405-2.95,4.057-3.121 c0.235-0.238,0.481-0.492,0.747-0.774L11.079,2.388L11.044,2.23l0.157-0.033l0.762-0.172l0.159-0.036l0.037,0.159 c0.482,2.094,1.557,2.859,2.694,3.67l0.098,0.07c0.172,0.12,0.348,0.243,0.523,0.364c1.704,1.185,3.464,2.408,3.86,5.01 c1.691-1.087,3.54-1.699,5.645-1.868l0.047-0.002l0.042,0.024l1.62,0.889l0.319,0.174l0.527,0.289l1.251,0.686l8.768,4.814 l0.106,0.057l-0.018,0.131l-0.219,1.099l-0.022,0.118l-0.125,0.013c-5.685,0.518-8.448,3.993-11.377,7.671 c-3.057,3.844-6.22,7.818-12.963,8.643L12.842,34.012L12.842,34.012z M13.666,8.596L15,15.196c0.997-1.081,2.029-2.183,3.198-3.116 C17.83,10.181,16.425,9.099,13.666,8.596L13.666,8.596z" fill="url(#SVGID_1)"/>
+<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="25.09" y1="3.25" x2="18.28" y2="29.64">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M4.504,21.748c10.374-1.113,10.566-11.391,20.483-12.18l12.506,6.863 c-12.585,1.681-11.545,14.341-24.322,16.136L4.504,21.748z" fill="url(#SVGID_2)"/>
+<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="11.67" y1="27.2" x2="22.42" y2="12.96">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M6.254,23.966c1.579-0.102,5.475-0.806,8.816-4.604l6.127,5.619c-2.307,2.884-6.286,5.21-9.765,5.507 L6.254,23.966z" fill="url(#SVGID_3)"/>
+<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="22.63" y1="18.3" x2="16.39" y2="28">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M15.837,18.577c1.691-1.97,3.833-4.857,7.662-6.644l7.04,4.334c-2.24,1.156-4.458,2.596-8.474,7.792 L15.837,18.577z" fill="url(#SVGID_4)"/>
+<path d="M24.679,11.449c0,0,2.42-0.559,2.777-0.528l7.598,4.183c0,0-1.459-0.021-3.218,0.643L24.679,11.449z" fill="#D6E3F1"/>
+<polygon fill="#FFFFFF" points="5.01,22.433 6.175,22.295 6.975,23.324 5.913,23.549 "/>
+<polygon fill="#FFFFFF" points="7.375,21.997 8.266,23.043 9.482,22.64 8.574,21.615 "/>
+<polygon fill="#FFFFFF" points="9.574,21.165 10.499,22.191 11.537,21.608 10.586,20.609 "/>
+<polygon fill="#FFFFFF" points="11.421,20.037 12.384,21.011 13.269,20.314 12.271,19.342 "/>
+<polygon fill="#FFFFFF" points="13.02,18.701 14.011,19.635 14.791,18.83 13.778,17.914 "/>
+<polygon fill="#FFFFFF" points="14.442,17.202 15.475,18.118 16.197,17.266 15.179,16.398 "/>
+<polygon fill="#FFFFFF" points="15.844,15.668 16.866,16.522 17.604,15.706 16.559,14.862 "/>
+<polygon fill="#FFFFFF" points="17.244,14.166 18.299,14.983 19.106,14.222 18.006,13.415 "/>
+<polygon fill="#FFFFFF" points="18.777,12.774 19.879,13.55 20.761,12.867 19.676,12.108 "/>
+<polygon fill="#FFFFFF" points="20.562,11.561 21.648,12.29 22.73,11.758 21.609,11.037 "/>
+<polygon fill="#FFFFFF" points="22.604,10.648 23.753,11.323 25.063,10.971 23.888,10.287 "/>
+<polygon fill="#FFFFFF" points="25.024,10.068 26.227,10.754 26.93,10.631 25.677,9.949 "/>
+<polygon fill="#FFFFFF" points="11.811,30.928 13.116,30.698 13.985,31.78 12.649,32.004 "/>
+<polygon fill="#FFFFFF" points="14.498,30.351 15.391,31.409 16.816,30.875 15.881,29.832 "/>
+<polygon fill="#FFFFFF" points="17.029,29.287 18.192,28.574 19.174,29.579 17.976,30.306 "/>
+<polygon fill="#FFFFFF" points="19.158,27.871 20.135,28.861 21.14,27.983 20.148,27.013 "/>
+<polygon fill="#FFFFFF" points="20.978,26.184 21.984,27.14 22.859,26.174 21.842,25.253 "/>
+<polygon fill="#FFFFFF" points="22.612,24.36 23.645,25.271 24.468,24.251 23.416,23.373 "/>
+<polygon fill="#FFFFFF" points="24.171,22.477 25.218,23.341 26.04,22.319 24.979,21.479 "/>
+<polygon fill="#FFFFFF" points="25.762,20.613 26.828,21.433 27.736,20.487 26.656,19.675 "/>
+<polygon fill="#FFFFFF" points="27.506,18.885 28.624,19.658 29.642,18.824 28.518,18.066 "/>
+<polygon fill="#FFFFFF" points="29.538,17.391 30.671,18.123 31.874,17.434 30.726,16.714 "/>
+<polygon fill="#FFFFFF" points="31.916,16.199 33.104,16.899 34.571,16.434 33.386,15.741 "/>
+<polygon fill="#FFFFFF" points="34.844,15.44 36.06,16.109 36.745,16.033 35.5,15.349 "/>
+<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="14.3" y1="2.22" x2="26.79" y2="28.48">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M13.232,32.458c12.06-1.605,12.525-15.277,24.25-16.038l-0.223,1.113 C25.511,18.605,26.003,32.25,12.916,33.847L13.232,32.458z" fill="url(#SVGID_5)"/>
+<polygon fill="url(#SVGID_2)" points="13.232,32.458 4.504,21.748 4.532,22.606 12.916,33.847 "/>
+<polygon fill="#7D96C5" points="12.839,31.979 12.556,33.363 11.799,32.325 11.973,30.891 "/>
+<polygon fill="#7D96C5" points="5.063,22.42 5.147,23.398 5.977,24.548 5.953,23.545 "/>
+<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="12.63" y1="30.81" x2="13.51" y2="19.84">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A1C1DC" offset="1"/>
+</linearGradient>
+<path d="M16.126,24.422c-0.565,1.555-2.365,2.897-4.022,3.002c-1.654,0.103-2.539-1.072-1.975-2.624 c0.563-1.555,2.364-2.897,4.021-3.004C15.805,21.694,16.689,22.867,16.126,24.422z" fill="url(#SVGID_7)"/>
+<path d="M14.487,18.025l-3.252-15.66l0.762-0.171c0.51,2.215,1.676,2.994,2.856,3.836 c2.69,1.907,5.913,3.547,3.617,10.54l-0.544-0.218c1.583-5.44-0.518-7.292-4.471-7.949l2.114,10.467L14.487,18.025z" fill="#6D5723"/>
+<radialGradient id="SVGID_8" gradientUnits="userSpaceOnUse" cx="13.33" cy="18.95" fx="12.7" fy="19.13" r="2.87">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#A2762B" offset="0.44"/>
+<stop stop-color="#474219" offset="0.94"/>
+</radialGradient>
+<path d="M15.434,20.15c-0.58,1.712-2.439,3.188-4.158,3.292c-1.717,0.11-2.644-1.193-2.063-2.906 c0.578-1.709,2.438-3.184,4.158-3.292C15.087,17.136,16.014,18.437,15.434,20.15z" fill="url(#SVGID_8)"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/icons/usb_icon_mode_5.svg Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="0 0 42 36">
+<rect fill="none" height="36" width="42"/>
+<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="-0.54" y1="15.57" x2="35.4" y2="15.57">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A1C1DC" offset="0.35"/>
+<stop stop-color="#6C82B9" offset="0.7"/>
+<stop stop-color="#173F6C" offset="1"/>
+</linearGradient>
+<path d="M24.067,29.803c-0.456,0-0.918-0.07-1.381-0.207l-12.552-3.74c-2.362-0.703-3.827-2.558-3.919-4.957 L5.74,8.165C5.673,6.397,6.431,4.892,7.82,4.036c1.797-1.579,3.234-2.693,5.342-2.693c0.377,0,0.778,0.038,1.19,0.114l11.474,1.836 c3.21,0.579,5.817,3.865,5.817,7.33l-0.161,12.044c0,3.272-2.31,4.707-4.984,6.37c-0.135,0.096-0.275,0.184-0.425,0.265 l-0.009,0.008l-0.15,0.092l-0.018,0.011l-0.014-0.013C25.321,29.666,24.71,29.803,24.067,29.803L24.067,29.803z" fill="url(#SVGID_1)"/>
+<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="19.15" y1="2.32" x2="19.15" y2="26.35">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A1C1DC" offset="0.35"/>
+<stop stop-color="#6C82B9" offset="0.7"/>
+<stop stop-color="#173F6C" offset="1"/>
+</linearGradient>
+<path d="M25.729,29.107c2.868-1.805,5.439-3.154,5.439-6.506l0.161-12.039c0-3.337-2.497-6.497-5.583-7.052 L14.27,1.672c-3.083-0.557-4.703,1.116-7.302,3.402l6.56,0.938l11.324,2.309l1.155,12.016L25.729,29.107z" fill="url(#SVGID_2)"/>
+<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="6.6" y1="5.55" x2="28.55" y2="27.5">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A1C1DC" offset="1"/>
+</linearGradient>
+<path d="M22.733,29.269c2.822,0.841,5.375-1.101,5.375-4.449V12.715c0-3.336-2.498-6.496-5.58-7.052 L11.366,3.65C8.277,3.094,5.871,5.092,5.986,8.095L6.461,20.83c0.084,2.214,1.425,4.015,3.72,4.696L22.733,29.269z" fill="url(#SVGID_3)"/>
+<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="12.92" y1="1.63" x2="32.49" y2="21.2">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#ADCEB3" offset="0.14"/>
+<stop stop-color="#78B277" offset="0.28"/>
+<stop stop-color="#57A052" offset="0.39"/>
+<stop stop-color="#4A9944" offset="0.44"/>
+<stop stop-color="#428E47" offset="0.5"/>
+<stop stop-color="#286C50" offset="0.68"/>
+<stop stop-color="#185756" offset="0.84"/>
+<stop stop-color="#124F58" offset="0.94"/>
+</linearGradient>
+<path d="M21.698,10.582c0.828,0.164,1.505,1.017,1.511,1.903l0.024,4.707l3.752,0.795v-4.86 c0-2.416-1.466-4.727-3.488-5.776c-0.465-0.24-0.96-0.414-1.471-0.506l-3.731-0.671v3.73L21.698,10.582z" fill="url(#SVGID_4)"/>
+<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="2.57" y1="1.96" x2="33.99" y2="39.18">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#B8CAE2" offset="0.11"/>
+<stop stop-color="#7C9DCD" offset="0.27"/>
+<stop stop-color="#5782BF" offset="0.38"/>
+<stop stop-color="#4977BA" offset="0.44"/>
+<stop stop-color="#3F6CAB" offset="0.51"/>
+<stop stop-color="#295489" offset="0.69"/>
+<stop stop-color="#1C4474" offset="0.84"/>
+<stop stop-color="#173F6C" offset="0.94"/>
+</linearGradient>
+<path d="M23.261,22.141c0.014,1.256-0.801,1.385-1.456,1.206l-9.833-2.939c-0.59-0.401-0.48-1.005-0.5-1.546 c-0.018-0.545-0.231-8.875-0.231-8.875c-0.023-0.829,0.626-1.365,1.458-1.197l5.035,1.004V6.072l-5.656-1.02 C9.324,4.556,7.178,6.336,7.281,9.014l0.423,11.352c0.075,1.974,1.269,3.58,3.314,4.187l11.191,3.335 c2.514,0.751,4.791-0.979,4.791-3.965v-5.36l-3.764-0.797L23.261,22.141z" fill="url(#SVGID_5)"/>
+<linearGradient id="SVGID_6" gradientUnits="userSpaceOnUse" x1="11.3" y1="22.66" x2="36.26" y2="22.66">
+<stop stop-color="#A1C1DC" offset="0.1"/>
+<stop stop-color="#6C82B9" offset="0.71"/>
+<stop stop-color="#173F6C" offset="0.99"/>
+</linearGradient>
+<path d="M17.672,34.657l-0.042-0.057l-5.196-6.966l-0.033-0.045l-1.052-1.408l-0.023-0.031v-0.039 l-0.021-0.645l-0.002-0.111l0.111-0.013c1.292-0.14,2.439-0.475,3.503-1.025c0.51-1.218,1.801-2.212,3.04-2.341 c0.176-0.176,0.36-0.367,0.559-0.578l-2.166-10.429l-0.025-0.118l0.118-0.026l0.57-0.128l0.119-0.026l0.027,0.119 c0.361,1.568,1.168,2.142,2.019,2.75l0.073,0.051c0.129,0.091,0.261,0.183,0.392,0.273c1.278,0.887,2.598,1.803,2.894,3.753 c1.265-0.815,2.649-1.272,4.229-1.399l0.034-0.001l0.032,0.017l1.212,0.667l0.24,0.129l0.395,0.216l0.938,0.515l6.568,3.605 l0.079,0.043l-0.013,0.099l-0.166,0.823l-0.016,0.09l-0.092,0.008c-4.26,0.389-6.33,2.992-8.523,5.748 c-2.289,2.879-4.659,5.857-9.711,6.474L17.672,34.657L17.672,34.657z M18.289,15.62l1,4.945c0.747-0.811,1.52-1.635,2.396-2.335 C21.408,16.807,20.356,15.997,18.289,15.62L18.289,15.62z" fill="url(#SVGID_6)"/>
+<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="26.85" y1="11.62" x2="21.75" y2="31.39">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M11.427,25.473c7.77-0.837,7.915-8.534,15.346-9.126l9.365,5.143 c-9.428,1.259-8.646,10.743-18.22,12.087L11.427,25.473z" fill="url(#SVGID_7)"/>
+<linearGradient id="SVGID_8" gradientUnits="userSpaceOnUse" x1="16.79" y1="29.56" x2="24.85" y2="18.89">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M12.737,27.133c1.182-0.074,4.101-0.602,6.604-3.449l4.59,4.212 c-1.728,2.159-4.709,3.901-7.315,4.124L12.737,27.133z" fill="url(#SVGID_8)"/>
+<linearGradient id="SVGID_9" gradientUnits="userSpaceOnUse" x1="25" y1="22.89" x2="20.33" y2="30.15">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M19.915,23.097c1.268-1.476,2.872-3.64,5.741-4.977l5.272,3.245 c-1.678,0.867-3.339,1.945-6.347,5.839L19.915,23.097z" fill="url(#SVGID_9)"/>
+<path d="M26.538,17.757c0,0,1.814-0.419,2.082-0.396l5.691,3.135c0,0-1.094-0.018-2.411,0.48L26.538,17.757z" fill="#D6E3F1"/>
+<polygon fill="#FFFFFF" points="11.806,25.985 12.678,25.883 13.278,26.651 12.481,26.82 "/>
+<polygon fill="#FFFFFF" points="13.576,25.66 14.246,26.442 15.155,26.141 14.475,25.371 "/>
+<polygon fill="#FFFFFF" points="15.224,25.035 15.917,25.804 16.695,25.367 15.982,24.619 "/>
+<polygon fill="#FFFFFF" points="16.608,24.189 17.33,24.92 17.991,24.398 17.245,23.671 "/>
+<polygon fill="#FFFFFF" points="17.805,23.189 18.548,23.891 19.132,23.285 18.373,22.6 "/>
+<polygon fill="#FFFFFF" points="18.871,22.067 19.646,22.753 20.185,22.115 19.422,21.465 "/>
+<polygon fill="#FFFFFF" points="19.922,20.918 20.687,21.559 21.24,20.945 20.457,20.313 "/>
+<polygon fill="#FFFFFF" points="20.969,19.792 21.76,20.404 22.364,19.834 21.541,19.23 "/>
+<polygon fill="#FFFFFF" points="22.118,18.75 22.944,19.331 23.603,18.82 22.793,18.25 "/>
+<polygon fill="#FFFFFF" points="23.455,17.841 24.271,18.387 25.08,17.988 24.239,17.447 "/>
+<polygon fill="#FFFFFF" points="24.985,17.157 25.847,17.663 26.827,17.399 25.946,16.886 "/>
+<polygon fill="#FFFFFF" points="26.8,16.723 27.699,17.236 28.225,17.144 27.287,16.633 "/>
+<polygon fill="#FFFFFF" points="16.898,32.349 17.878,32.177 18.529,32.987 17.528,33.154 "/>
+<polygon fill="#FFFFFF" points="18.911,31.916 19.581,32.709 20.65,32.309 19.949,31.528 "/>
+<polygon fill="#FFFFFF" points="20.808,31.118 21.681,30.585 22.415,31.339 21.518,31.885 "/>
+<polygon fill="#FFFFFF" points="22.404,30.058 23.138,30.801 23.888,30.143 23.146,29.416 "/>
+<polygon fill="#FFFFFF" points="23.767,28.795 24.522,29.512 25.178,28.787 24.414,28.098 "/>
+<polygon fill="#FFFFFF" points="24.992,27.429 25.765,28.111 26.38,27.348 25.595,26.689 "/>
+<polygon fill="#FFFFFF" points="26.159,26.018 26.943,26.666 27.558,25.899 26.766,25.271 "/>
+<polygon fill="#FFFFFF" points="27.351,24.623 28.149,25.235 28.829,24.527 28.021,23.921 "/>
+<polygon fill="#FFFFFF" points="28.657,23.328 29.494,23.908 30.257,23.281 29.415,22.713 "/>
+<polygon fill="#FFFFFF" points="30.181,22.209 31.028,22.756 31.93,22.24 31.069,21.701 "/>
+<polygon fill="#FFFFFF" points="31.96,21.314 32.851,21.84 33.95,21.492 33.063,20.973 "/>
+<polygon fill="#FFFFFF" points="34.155,20.746 35.064,21.25 35.579,21.19 34.646,20.68 "/>
+<linearGradient id="SVGID_10" gradientUnits="userSpaceOnUse" x1="18.78" y1="10.86" x2="28.12" y2="30.5">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M17.964,33.494c9.035-1.201,9.381-11.443,18.168-12.012l-0.169,0.832 c-8.802,0.803-8.433,11.025-18.236,12.22L17.964,33.494z" fill="url(#SVGID_10)"/>
+<polygon fill="url(#SVGID_7)" points="17.964,33.494 11.427,25.473 11.446,26.115 17.727,34.534 "/>
+<polygon fill="#7D96C5" points="17.669,33.137 17.458,34.173 16.892,33.395 17.022,32.322 "/>
+<polygon fill="#7D96C5" points="11.844,25.977 11.908,26.709 12.529,27.569 12.512,26.818 "/>
+<linearGradient id="SVGID_12" gradientUnits="userSpaceOnUse" x1="17.52" y1="32.26" x2="18.17" y2="24.05">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A1C1DC" offset="1"/>
+</linearGradient>
+<path d="M20.134,27.476c-0.425,1.165-1.773,2.171-3.014,2.247c-1.239,0.079-1.903-0.801-1.48-1.965 c0.421-1.164,1.771-2.172,3.012-2.25C19.891,25.431,20.554,26.31,20.134,27.476z" fill="url(#SVGID_12)"/>
+<path d="M18.905,22.685l-2.436-11.732l0.57-0.127c0.382,1.659,1.256,2.242,2.14,2.874 c2.016,1.427,4.429,2.657,2.709,7.895l-0.407-0.162c1.186-4.076-0.389-5.463-3.35-5.955l1.583,7.84L18.905,22.685z" fill="#6D5723"/>
+<radialGradient id="SVGID_13" gradientUnits="userSpaceOnUse" cx="18.04" cy="23.37" fx="17.57" fy="23.5" r="2.14">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#A2762B" offset="0.44"/>
+<stop stop-color="#474219" offset="0.94"/>
+</radialGradient>
+<path d="M19.613,24.275c-0.434,1.281-1.827,2.387-3.115,2.466c-1.285,0.083-1.98-0.895-1.544-2.177 c0.433-1.28,1.827-2.386,3.114-2.467C19.354,22.018,20.048,22.99,19.613,24.275z" fill="url(#SVGID_13)"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/mydebug.h Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef MYDEBUG_H
+#define MYDEBUG_H
+
+#include <QtDebug>
+
+#if defined(_DEBUG)
+ inline QDebug myDebug()
+ {
+ return qDebug();
+ }
+#else
+ inline QNoDebug myDebug()
+ {
+ return QNoDebug();
+ }
+#endif
+
+
+#endif // MYDEBUG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbmainview.h Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef USBMAINVIEW_H
+#define USBMAINVIEW_H
+
+#include <hbview.h>
+#include <QObject>
+
+class UsbUiSettingModel;
+class QGraphicsLinearLayout;
+class HbListWidgetItem;
+class HbListWidget;
+class HbTextEdit;
+class HbRadioButtonList;
+
+class UsbMainView : public HbView
+{
+ Q_OBJECT
+ friend class TestUsbUiModelActive;
+
+public:
+ explicit UsbMainView( QObject *parent = 0 );
+ virtual ~UsbMainView();
+
+public slots:
+ /**
+ * Update view item(s) between the selected rows.
+ * @param topLeft The top row index
+ * @param bottomRight The bottom row index
+ */
+ void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+
+ /*
+ * Set the personality user has selected in the radio button list
+ * @param personalityIndex The selection index in the radio button list
+ */
+ void setPersonality( int personalityIndex );
+
+signals:
+
+private:
+ /*
+ * creates the main view window row by row
+ */
+ void createMainView();
+ /*
+ * creates the first row in the view containing an icon and a mode name
+ * @param localPropertiesGroup main view layout
+ */
+ void createIconNameRow(QGraphicsLinearLayout *localPropertiesGroup);
+ /*
+ * creates the second row from the view containing the description of the selected mode
+ * @param localPropertiesGroup main view layout
+ */
+ void createDescriptionArea(QGraphicsLinearLayout *localPropertiesGroup);
+ /*
+ * creates the third row from the view containing the radio button list of the existing usb modes
+ * @param localPropertiesGroup main view layout
+ */
+ void createRadioButtonArea(QGraphicsLinearLayout *localPropertiesGroup);
+
+private:
+ // main view layout owned by this class
+ QGraphicsLinearLayout *mMainLayout;
+ // setting model not owned by the view,
+ // has to be deleted
+ UsbUiSettingModel *mModel;
+ //owned by the view
+ HbListWidgetItem *mListItem;
+ // owned by the view
+ HbListWidget *mlist;
+ // owned by the view
+ HbTextEdit *mlabel;
+ // owned by the view
+ HbRadioButtonList *mradio;
+ // not owned by the view
+ // need to be deleted
+ HbIcon *mIcon ;
+};
+
+#endif /* USBMAINVIEW_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbuimodelactive.h Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef USBUIMODELACTIVE_H
+#define USBUIMODELACTIVE_H
+
+#include <QObject>
+#include <e32base.h>
+#include <usbwatcher.h>
+
+class UsbUiModelActivePrivate;
+
+/*!
+ \class UsbUiModelActive
+ \brief Helper class for using active objects in Qt classes.
+
+ UsbUiModelActive is a helper class for using active objects
+ from any Qt class. It wraps a CActive-derived class in an interface
+ that uses Qt's signal-slot mechanism for communicating status changes
+ of the active object.
+
+ */
+class UsbUiModelActive : public QObject
+{
+ Q_OBJECT
+ friend class UsbUiModelActivePrivate;
+
+public:
+ explicit UsbUiModelActive( int priority = CActive::EPriorityStandard,
+ QObject *parent = NULL );
+ ~UsbUiModelActive();
+
+ inline TRequestStatus &RequestStatus();
+ inline void SetActive();
+ inline void Cancel();
+ inline bool IsActive();
+
+public:
+ int SetUsbPersonality(int personality);
+ void CancelSetPersonality();
+
+signals:
+ void requestCompleted( int status );
+
+private:
+ /*!
+ * emits a signal when the request is completed
+ * @param status is the error
+ */
+ void emitRequestCompleted( int status );
+
+private:
+ UsbUiModelActivePrivate *d;
+
+ /** Handle to USBWatcher for setting the personality */
+ RUsbWatcher iUsbWatcher;
+};
+
+
+/*!
+ \class UsbUiModelActivePrivate
+ \brief Private class of UsbUiModelActive, for using active objects in Qt classes.
+
+ UsbUiModelActivePrivate is a helper class for using active objects
+ from any Qt class. It derives from CActive and allows other classes to use
+ it for passing to asynchronous function calls through its RequestStatus method.
+
+ */
+class UsbUiModelActivePrivate : public CActive
+{
+ friend class UsbUiModelActive;
+
+public:
+ explicit UsbUiModelActivePrivate( UsbUiModelActive *parent, int priority );
+ ~UsbUiModelActivePrivate();
+
+private:
+ virtual void RunL();
+ virtual void DoCancel();
+ virtual TInt RunError( TInt aError );
+
+private:
+ UsbUiModelActive *q;
+
+};
+
+inline bool UsbUiModelActive::IsActive()
+{
+ return d->IsActive();
+}
+
+inline TRequestStatus &UsbUiModelActive::RequestStatus()
+{
+ return d->iStatus;
+}
+
+inline void UsbUiModelActive::SetActive()
+{
+ d->SetActive();
+}
+
+inline void UsbUiModelActive::Cancel()
+{
+ d->Cancel();
+}
+
+#endif /* USBUIMODELACTIVE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbuisettingmodel.h Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef USBUISETTINGMODEL_H
+#define USBUISETTINGMODEL_H
+
+
+#include <e32base.h>
+#include <e32property.h>
+#include <QStringList>
+#include <QAbstractItemModel>
+#include <XQSettingsManager>
+
+const int KDefaultColumn = 0;
+typedef QList< QMap< int, QVariant > > UsbUiModelDataSource;
+
+class RUsb;
+class UsbUiModelActive;
+
+class UsbUiSettingModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ friend class TestUsbUiModelActive;
+
+public:
+enum usbSettingsIndex {
+ DefaultMode,
+ Description,
+ UsbModeList,
+ EndOfSettings
+ };
+enum SettingsRoleValues {
+ SettingType = Qt::UserRole,
+ SettingsModeNameList,
+ };
+public:
+ UsbUiSettingModel( QObject *parent = 0 );
+ virtual ~UsbUiSettingModel();
+
+ /*
+ * Returns the index of the item in the model specified by the given row, column and parent index.
+ * @param row is the row number of the specified item
+ * @param column is the column number of the specified item
+ * @param parent QModelIndex parent
+ */
+ virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
+ /*
+ * Returns QModelIndex() because this model item has no parent
+ * @param child is the index of item model, the parent of which is going to be returned
+ * @param child is not used in here
+ */
+ virtual QModelIndex parent( const QModelIndex &child ) const;
+ /*
+ * Returns the number of rows under the given parent
+ * @param parent QModelIndex parent
+ */
+ virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
+ /*
+ * Returns the number of columns for the children of the given parent.
+ * @param parent QModelIndex parent
+ */
+ virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
+ /*
+ *Returns the data stored under the given role for the item referred to by the index.
+ */
+ virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
+ /*
+ * Sets the role data for the item at index to value. Returns true if successful; otherwise returns false.
+ */
+ virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
+
+ const QModelIndex* sourceData() const;
+
+public slots:
+ /*
+ * Provides notification of changes in selected usb mode
+ * @param key is not used
+ * @param value is the value read from cenrep key
+ */
+ void usbModeChanged( const XQSettingsKey &key, const QVariant &value );
+ /*
+ * it checks the response from usbwatcher to see if the new mode change has been successful
+ * it will go back to the previous personality if it has not been successfull
+ * @param status is the error code returned from usbwatcher
+ */
+ void setPersonalityCompleted (int status );
+
+private:
+ /*
+ * creats the logical name of the modename string for the list
+ * @param modeId is the usb personality id
+ */
+ QString modeListName( int modeId );
+ /*
+ * Get the current USB personality ID
+ * Returns 0, if the key is missing or the value cannot be converted
+ * to integer.
+ * @return The current personality id
+ */
+ int currentMode();
+ /*
+ * sets the value to different roles of the model's first row
+ */
+ void setDefaultModeSetting();
+ /*
+ * sets the value to different roles of the model's description row
+ */
+ void setDescriptionSetting();
+ /**
+ * Set the USB mode list and the current selection in the list.
+ * The personality IDs are stored to mPersonalityIds and the personality names
+ * to mSettingsList.
+ * @param modeId The current mode ID
+ */
+ bool setUsbModelistSetting( int modeId );
+ /**
+ * calls the model's set functions
+ * @param modeId The current mode ID
+ */
+ void setUsbSettings( int modeId );
+ /**
+ * updates the model rows and emits signal datachanged
+ * @param newPersonality is the new personality id
+ */
+ void setNewUsbMode(int newPersonality);
+
+ /**
+ * Check from the USB Manager if the USB personality is hidden.
+ * @param usbman Already opened USB Manager session
+ * @param personalityId The ID of the personality to be checked.
+ * @return For hidden personality, true is returned.
+ */
+ bool isPersonalityHidden(RUsb &usbman, TInt personalityId);
+
+ /**
+ * Check if the USB personality is hidden.
+ * The personality is hidden, if it does not exist in mPersonalityIds.
+ * @param personalityId The ID of the personality to be checked.
+ * @return For hidden personality, true is returned.
+ */
+ bool isPersonalityHidden(TInt personalityId);
+ private:
+
+ UsbUiModelDataSource mSettingsList;
+ int mCurrentMode;
+ // stored, so that we can show the correct personality when it fails to set the new one
+ int mPreviousMode;
+
+ XQSettingsManager mSettingsManager;
+ QList<int> mPersonalityIds;
+ UsbUiModelActive *mModelActive;
+};
+
+#endif // USBUISETTINGMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbviewmanager.h Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef USBVIEWMANAGER_H
+#define USBVIEWMANAGER_H
+
+#include "usbmainview.h"
+
+
+class HbMainWindow;
+
+class UsbViewManager : public QObject
+ {
+ Q_OBJECT
+
+public:
+ explicit UsbViewManager(HbMainWindow* mainWindow, QObject *parent = 0 );
+ ~UsbViewManager();
+
+ void addView();
+
+private:
+ HbMainWindow* mWindow;
+ UsbMainView* mMainView; // owned
+
+ };
+
+
+#endif /* USBVIEWMANAGER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/rom/usbsettings.iby Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef USBSETTING_IBY
+#define USBSETTING_IBY
+// Use standard macros
+#include <data_caging_paths_for_iby.hrh>
+
+file=/epoc32/release/armv5/urel/usbapplication.exe PROGRAMS_DIR/usbapplication.exe
+data=/epoc32/data/z/resource/apps/usbapplication.rsc APP_RESOURCE_DIR/usbapplication.rsc
+data=/epoc32/data/z/private/10003a3f/import/apps/usbapplication_reg.rsc /private/10003a3f/import/apps/usbapplication_reg.rsc
+data=/epoc32/data/z/resource/usbapplication.qm RESOURCE_FILES_DIR/usbapplication.qm
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/main.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <QTranslator>
+#include <eikenv.h>
+#include "usbviewmanager.h"
+
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ // add translator for application library
+ QString locale = QLocale::system().name();
+ QTranslator translator;
+ QString filename = QString("usbapplication_") + locale;
+#ifdef Q_OS_SYMBIAN
+ // TRAP is must here, otherwise it crashes
+TRAP_IGNORE(
+ bool loaded(false);
+ loaded = translator.load( filename, QString("z:/resource") );
+ if (!loaded)
+ translator.load(filename, QString("c:/resource") );
+);
+#else
+ translator.load(filename, QString("resource") );
+#endif //Q_OS_SYMBIAN
+ app.installTranslator(&translator);
+
+ HbMainWindow mainWindow;
+
+ // create the view manager, which handles 3 HbViews and add into mainWindow.
+ UsbViewManager* mViewManager = new UsbViewManager( &mainWindow, &app );
+ mViewManager->addView();
+
+ mainWindow.show();
+ return app.exec();
+}
Binary file usbuis/usbuiqt/src/usbapplication.qm has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbapplication.qrc Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RCC>
+ <qresource prefix="/xml">
+ <file>usbview.docml</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbapplication.ts Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="3.0" language="en_GB" sourcelanguage="en_GB">
+<context>
+<message numerus="no" id="txt_usb_description_5">
+ <comment>Description for USB Ovi Suite personality. This gives user help about the selected personality.</comment>
+ <source>Manage your phone with Ovi Suite and sync your media content.</source>
+ <translation variants="no">Manage your phone with Ovi Suite and sync your media content.</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Text ID</extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature>Te</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_5">
+ <comment>USB mode name for Ovi Suite personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_5.</comment>
+ <source>Ovi Suite</source>
+ <translation variants="no">Ovi Suite</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Comment</extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature>Co</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_2">
+ <comment>USB mode name for Mass storage personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_2.</comment>
+ <source>Mass storage</source>
+ <translation variants="no">Mass storage</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Layout ID</extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature>La</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_2">
+ <comment>USB mode name for Mass storage personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Mass storage</source>
+ <translation variants="no">Mass storage</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>View ID (draft)</extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature>Vi</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_6">
+ <comment>USB mode name for Phone as modem personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_6.</comment>
+ <source>Connect PC to Web</source>
+ <translation variants="no">Connect PC to Web</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_description_2">
+ <comment>Description for USB Mass storage personality. This gives user help about the selected personality.</comment>
+ <source>Access your phoneÂ’s memory card from the device you are connected to.</source>
+ <translation variants="no">Access your phoneÂ’s memory card from the device you are connected to.</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Position ID</extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature>Po</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_4">
+ <comment>USB mode name for MTP personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_4.</comment>
+ <source>Media transfer</source>
+ <translation variants="no">Media transfer</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_5">
+ <comment>USB mode name for Ovi Suite personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Ovi Suite</source>
+ <translation variants="no">Ovi Suite</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>File name</extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature>Fi</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_description_6">
+ <comment>Description for USB Phone as Modem personality. This gives user help about the selected personality.</comment>
+ <source>Use your mobile phone as a modem</source>
+ <translation variants="no">Use your mobile phone as a modem</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_description_4">
+ <comment>Description for USB MTP personality. This gives user help about the selected personality.</comment>
+ <source>Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos.</source>
+ <translation variants="no">Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos.</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_6">
+ <comment>USB mode name for Phone as Modem personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Connect PC to Web</source>
+ <translation variants="no">Connect PC to Web</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_4">
+ <comment>USB mode name for MTP personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Media transfer</source>
+ <translation variants="no">Media transfer</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+</context>
+</TS>
Binary file usbuis/usbuiqt/src/usbapplication.xls has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbapplication_reg.rss Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,18 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.6.0) on: 2009-12-16T13:39:42
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#include <usbapplication.rsg>
+#include <appinfo.rh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0xECD2B4FE
+
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file="usbapplication";
+ localisable_resource_file="\\resource\\apps\\usbapplication";
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbicons.qrc Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/" >
+ <file>../icons/usb_icon_mode_2.svg</file>
+ <file>../icons/usb_icon_mode_4.svg</file>
+ <file>../icons/usb_icon_mode_5.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbmainview.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "usbmainview.h"
+#include <QModelIndex>
+#include <QtGui/QGraphicsLinearLayout>
+#include <hblistwidget.h>
+#include <hblistwidgetitem.h>
+#include <hbradiobuttonlist.h>
+#include <hbtextedit.h>
+
+#include "usbuisettingmodel.h"
+#include "mydebug.h"
+/*!
+ * default constructor
+ */
+UsbMainView::UsbMainView( QObject *parent )
+: HbView(), mModel(NULL)
+{
+ myDebug() << ">>> UsbMainView::UsbMainView";
+ setParent( parent );
+ setTitle( qtTrId("USB") );
+ mMainLayout = new QGraphicsLinearLayout( Qt::Vertical, this );
+ mModel = new UsbUiSettingModel();
+ createMainView();
+ setLayout( mMainLayout );
+ myDebug() << "<<< UsbMainView::UsbMainView";
+}
+
+/*!
+ * creates the main view
+ */
+void UsbMainView::createMainView()
+{
+ myDebug() << ">>> UsbMainView::createMainView";
+ QGraphicsLinearLayout *mainViewLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ mListItem = NULL;
+ mlist = NULL;
+ mlabel = NULL;
+ mradio = NULL;
+ mIcon = NULL;
+ createIconNameRow( mainViewLayout );
+ createDescriptionArea( mainViewLayout );
+ createRadioButtonArea( mainViewLayout );
+ mMainLayout->addItem( mainViewLayout );
+ bool connected = connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
+ this, SLOT( updateSettingItems( QModelIndex, QModelIndex ) ) );
+ myDebug() << "<<< UsbMainView::createMainView model connected=" << connected;
+ connected = connect(mradio, SIGNAL( itemSelected( int ) ),
+ this, SLOT( setPersonality( int ) ) );
+ myDebug() << "<<< UsbMainView::createMainView mradio connected=" << connected;
+ myDebug() << "<<< UsbMainView::createMainView";
+}
+/*!
+ * creating the creates the first row in the view containing an icon and a mode name
+ */
+void UsbMainView::createIconNameRow( QGraphicsLinearLayout *aLocalPropertiesGroup )
+{
+ myDebug() << ">>> UsbMainView::createIconNameRow";
+ QGraphicsLinearLayout *listLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ mlist = new HbListWidget( this );
+ mlist->setMaximumSize( 300, 50 ); //todo
+ mListItem= new HbListWidgetItem();
+ QModelIndex index = mModel->index( UsbUiSettingModel::DefaultMode, KDefaultColumn );
+ // QVariant iconName = mModel->data( index, Qt::DecorationRole );
+ mIcon = new HbIcon( mModel->data( index, Qt::DecorationRole ).toString() );
+ mListItem->setDecorationIcon( *mIcon );
+ mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
+ mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
+ mlist->insertItem( 1, mListItem );
+ listLayout->addItem( mlist );
+ aLocalPropertiesGroup->addItem( listLayout );
+ myDebug() << "<<< UsbMainView::createIconNameRow";
+}
+/*!
+ * creates the second row from the view containing the description of the selected mode
+ */
+void UsbMainView::createDescriptionArea( QGraphicsLinearLayout *aLocalPropertiesGroup )
+{
+ myDebug() << ">>> UsbMainView::createDescriptionArea";
+ QGraphicsLinearLayout *desLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ QModelIndex index = mModel->index( UsbUiSettingModel::Description, KDefaultColumn );
+ mlabel = new HbTextEdit( mModel->data( index, Qt::DisplayRole ).toString() );
+ mlabel->setReadOnly( true );
+ mlabel->setCursorVisibility( Hb::TextCursorHidden );
+ desLayout->addItem( mlabel );
+ desLayout->setAlignment( mlabel, Qt::AlignTop );
+ aLocalPropertiesGroup->addItem( desLayout );
+ myDebug() << "<<< UsbMainView::createDescriptionArea";
+}
+
+/*!
+ * creates the third row from the view containing the radio button list of the existing usb modes
+ */
+void UsbMainView::createRadioButtonArea(QGraphicsLinearLayout *aLocalPropertiesGroup)
+{
+ myDebug() << ">>> UsbMainView::createRadioButtonArea";
+ QGraphicsLinearLayout *radioLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ QModelIndex index = mModel->index( UsbUiSettingModel::UsbModeList, KDefaultColumn );
+ QStringList radioList = mModel->data( index, UsbUiSettingModel::SettingsModeNameList ).toStringList();
+ int selectedIndex = mModel->data( index, Qt::EditRole ).toInt();
+ mradio = new HbRadioButtonList( radioList, selectedIndex );
+ radioLayout->addItem( mradio );
+ radioLayout->setAlignment( mradio, Qt::AlignBottom );
+ aLocalPropertiesGroup->addItem(radioLayout);
+ myDebug() << "<<< UsbMainView::createRadioButtonArea";
+}
+
+/*!
+ Slot for receiving notification of data changes from the model.
+ Identify the setting changed and update the corresponding UI item.
+ */
+void UsbMainView::updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+{
+ myDebug() << ">>> UsbMainView::updateSettingItems";
+ // update only the part of the view specified by the model row(s)
+ for ( int row = topLeft.row(); row <= bottomRight.row(); row++ ) {
+ myDebug() << " UsbMainView::updateSettingItems row=" << row;
+ QModelIndex index = mModel->index( row, KDefaultColumn );
+ // Distinguish which setting value is changed.
+ switch ( row ) {
+ case UsbUiSettingModel::DefaultMode :
+ // set the selected personality icon and name
+ mIcon->setIconName( mModel->data( index, Qt::DecorationRole ).toString() );
+ mListItem->setDecorationIcon( *mIcon );
+ mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
+ break;
+ case UsbUiSettingModel::Description :
+ // set the description of the selected personality.
+ mlabel->setPlainText( mModel->data( index, Qt::DisplayRole ).toString() );
+ mlabel->setReadOnly( true );
+ mlabel->setCursorVisibility( Hb::TextCursorHidden );
+ break;
+ case UsbUiSettingModel::UsbModeList :
+ // only the selection can change, no changes in the list of personalities
+ mradio->setSelected( mModel->data( index, Qt::EditRole ).toInt() );
+ break;
+ default :
+ myDebug() << " UsbMainView::updateSettingItems unknown row " << row;
+ break;
+ }
+ }
+ myDebug() << "<<< UsbMainView::updateSettingItems";
+}
+
+/*
+ * Slot for receiving notification from the change in radio button list
+ */
+void UsbMainView::setPersonality( int personalityIndex )
+{
+ myDebug() << ">>> UsbMainView::setPersonality";
+ QModelIndex index = mModel->index( UsbUiSettingModel::UsbModeList, KDefaultColumn );
+ mModel->setData( index, personalityIndex, Qt::EditRole );
+ myDebug() << "<<< UsbMainView::setPersonality";
+}
+
+/*!
+ * Destructor
+ * destructs the items which are not owned by this class
+ */
+UsbMainView::~UsbMainView()
+{
+ myDebug() << ">>> UsbMainView::~UsbMainView";
+ delete mModel;
+ delete mIcon;
+ myDebug() << "<<< UsbMainView::~UsbMainView";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbuimodelactive.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "usbuimodelactive.h"
+#include "mydebug.h"
+
+//const ?type ?constant_var = ?constant;
+
+
+/*!
+ Constructor.
+ */
+UsbUiModelActive::UsbUiModelActive( int priority, QObject *parent )
+: QObject( parent )
+{
+ myDebug() << ">>> UsbUiModelActive::UsbUiModelActive";
+ d = new UsbUiModelActivePrivate( this, priority );
+ int err= iUsbWatcher.Connect();
+ myDebug() << "iUsbWatcher.Connect() returned ";
+ myDebug() << err;
+ myDebug() << "<<< UsbUiModelActive::UsbUiModelActive";
+}
+
+/*!
+ Destructor.
+ */
+UsbUiModelActive::~UsbUiModelActive()
+{
+ myDebug() << ">>> UsbUiModelActive::~UsbUiModelActive";
+ delete d;
+ iUsbWatcher.Close();
+ myDebug() << "<<< UsbUiModelActive::~UsbUiModelActive";
+}
+/*!
+ * emits a signal when the request is completed
+ */
+void UsbUiModelActive::emitRequestCompleted( int status )
+{
+ myDebug() << ">>> UsbUiModelActive::emitRequestCompleted status: ";
+ myDebug() << status;
+ emit requestCompleted( status );
+ myDebug() << "<<< UsbUiModelActive::emitRequestCompleted";
+}
+
+/*!
+ * UsbUiModelActive::SetUSBModeL
+ * Sets the Central Repository key to the parameter.
+ */
+int UsbUiModelActive::SetUsbPersonality(int personality)
+ {
+ myDebug() << ">>> UsbUiModelActive::SetUsbPersonality";
+ myDebug() << "requested personality is ";
+ myDebug() << personality;
+ // Change the personality asynchrously, result checked in RunL()
+ if( IsActive() )
+ {
+ Cancel();
+ }
+ myDebug() << "setting new personality";
+ iUsbWatcher.SetPersonality(RequestStatus(), personality);
+ SetActive();
+ myDebug() << "<<< UsbUiModelActive::SetUsbPersonality, returns 0";
+ return 0;
+ }
+/*!
+ * cancles the personality set in usbwatcher
+ */
+void UsbUiModelActive::CancelSetPersonality()
+ {
+ iUsbWatcher.CancelSetPersonality();
+ }
+
+/*!
+ Constructor.
+ */
+UsbUiModelActivePrivate::UsbUiModelActivePrivate(
+ UsbUiModelActive *parent, int priority )
+: CActive( (TInt) priority ), q( parent )
+{
+ myDebug() << ">>> UsbUiModelActivePrivate::UsbUiModelActivePrivate";
+ CActiveScheduler::Add( this );
+ myDebug() << "<<< UsbUiModelActivePrivate::UsbUiModelActivePrivate";
+}
+
+
+/*!
+ Destructor.
+ */
+UsbUiModelActivePrivate::~UsbUiModelActivePrivate()
+{
+ Cancel();
+}
+
+
+/*!
+ * Called by the active scheduler when the request has been completed.
+ */
+void UsbUiModelActivePrivate::RunL()
+{
+ myDebug() << ">>> UsbUiModelActivePrivate::RunL";
+ q->emitRequestCompleted( iStatus.Int() );
+ myDebug() << "<<< UsbUiModelActivePrivate::RunL";
+}
+
+
+/*!
+ Called by the active scheduler when the request has been cancelled.
+ */
+void UsbUiModelActivePrivate::DoCancel()
+{
+ q->CancelSetPersonality();
+}
+
+
+/*!
+ Called by the active scheduler when an error in RunL has occurred.
+ */
+TInt UsbUiModelActivePrivate::RunError( TInt aError )
+{
+ q->emitRequestCompleted( aError );
+ return KErrNone;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbuisettingmodel.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,362 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "usbuisettingmodel.h"
+#include "usbuimodelactive.h"
+#include "mydebug.h"
+#include <QStringList>
+#include <UsbWatcherInternalCRKeys.h>
+#include <XQSettingsKey>
+#include <usbman.h>
+
+const QString TextIdPrefix = ("txt_usb_");
+const QString ModeIconNamePrefix = (":/icons/usb_icon_mode_");
+
+/*!
+ Constructor.
+ */
+UsbUiSettingModel::UsbUiSettingModel( QObject *parent )
+ : QAbstractItemModel( parent )
+{
+ mModelActive = new UsbUiModelActive();
+
+ for ( int i = 0; i < UsbUiSettingModel::EndOfSettings; i++ ) {
+ // Initialize the list with empty values.
+ mSettingsList.append( QMap< int, QVariant >() );
+ }
+
+ mCurrentMode = currentMode();
+ mPreviousMode = mCurrentMode;
+ setUsbSettings(mCurrentMode);
+ bool ret = mSettingsManager.startMonitoring(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
+ myDebug() << ">>> UsbUiSettingModel::startMonitoring value="
+ << ret;
+
+ // signal: personality changed in the central repository
+ connect( &mSettingsManager,
+ SIGNAL( valueChanged( const XQSettingsKey&, const QVariant& ) ),
+ this,
+ SLOT( usbModeChanged( const XQSettingsKey&, const QVariant& ) ) );
+
+ // signal: response from usbwatcher to our attempt to set the personality
+ connect( mModelActive,
+ SIGNAL( requestCompleted( int status ) ),
+ this,
+ SLOT( setPersonalityCompleted (int status )));
+
+}
+/*!
+ * calls the model's set functions to initialize the model's data
+ */
+void UsbUiSettingModel::setUsbSettings( int aModeId )
+ {
+ setUsbModelistSetting( aModeId );
+ setDefaultModeSetting();
+ setDescriptionSetting();
+ }
+
+/*!
+ Destructor.
+ */
+UsbUiSettingModel::~UsbUiSettingModel()
+{
+ myDebug() << ">>> UsbUiSettingModel::~UsbUiSettingModel";
+ mSettingsManager.stopMonitoring(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
+ delete mModelActive;
+ myDebug() << "<<< UsbUiSettingModel::~UsbUiSettingModel";
+}
+
+/*!
+ Provides notification of changes in selected usb mode
+ */
+void UsbUiSettingModel::usbModeChanged( const XQSettingsKey &key,
+ const QVariant &value )
+{
+Q_UNUSED(key);
+ myDebug() << ">>> UsbUiSettingModel::usbModeChanged";
+ // key is not checked, as we monitor only one key
+
+ setNewUsbMode(value.toInt());
+
+ myDebug() << "<<< UsbUiSettingModel::usbModeChanged";
+}
+/*!
+ * updates the model rows and emits signal datachanged
+ */
+void UsbUiSettingModel::setNewUsbMode(int newPersonality)
+
+ {
+ myDebug() << ">>> UsbUiSettingModel::setNewUsbMode value="
+ << newPersonality;
+
+ mCurrentMode = newPersonality;
+ setUsbSettings(mCurrentMode);
+
+ emit dataChanged( createIndex( DefaultMode, KDefaultColumn ),
+ createIndex( UsbModeList, KDefaultColumn ) );
+
+ myDebug() << "<<< UsbUiSettingModel::setNewUsbMode";
+ }
+/*!
+ * Returns the index of the item in the model specified by the given row, column and parent index.
+ */
+QModelIndex UsbUiSettingModel::index( int row, int column, const QModelIndex &parent ) const
+{
+ return hasIndex( row, column, parent ) ? createIndex( row, column ) : QModelIndex();
+}
+
+
+/*
+ This model does not support hierarchy, so this returns an empty model index.
+ */
+QModelIndex UsbUiSettingModel::parent( const QModelIndex &child ) const
+{
+ Q_UNUSED( child );
+ return QModelIndex();
+}
+/*!
+ * Returns the number of rows under the given parent
+ */
+int UsbUiSettingModel::rowCount( const QModelIndex &parent ) const
+{
+ Q_UNUSED( parent );
+ return mSettingsList.count();
+}
+
+
+/*!
+ * Returns the number of columns for the children of the given parent.
+ * This model is one-dimensional, so this returns 1.
+ */
+int UsbUiSettingModel::columnCount( const QModelIndex &parent ) const
+{
+ Q_UNUSED( parent );
+ return 1;
+}
+/*!
+ * Returns the data stored under the given role for the item referred to by the index.
+ */
+QVariant UsbUiSettingModel::data( const QModelIndex &index, int role ) const
+{
+ return mSettingsList.value( index.row() ).value( role );
+}
+
+
+/*!
+ * This is called when usb mode is changed, it only sets the personality when the given role is EditRole
+ */
+bool UsbUiSettingModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ myDebug() << ">>> UsbUiSettingModel::setData";
+ bool success = false;
+ if ( role == Qt::EditRole ) {
+ // Only allow changes on the value with role EditRole. Others are managed here.
+ switch ( index.row() ) {
+ case UsbModeList: {
+ mModelActive->SetUsbPersonality( mPersonalityIds.at( value.toInt() ) );
+ success = true;
+ // also update the rest of the model with the about to be selected mode right away
+ setNewUsbMode(mPersonalityIds.at( value.toInt() ));
+ break;
+ }
+ case DefaultMode:
+ //no break
+ case Description:
+ //no break
+ default:
+ myDebug() << " UsbUiSettingModel::setData not supported row " << index.row();
+ break;
+ }
+ }
+ myDebug() << "<<< UsbUiSettingModel::setData return " << success;
+ return success;
+}
+
+/*!
+ * Getter for the source data.
+ */
+const QModelIndex* UsbUiSettingModel::sourceData() const
+{
+ return new QModelIndex( createIndex( 0, 0 ) );
+}
+
+/*!
+ * creats the logical name of the modename string for the list
+ */
+QString UsbUiSettingModel::modeListName( int modeId )
+{
+ QString textId = TextIdPrefix + "modelistname_" + QString::number( modeId );
+ QString modeName = qtTrId( textId.toAscii() );
+ return modeName;
+}
+
+/*!
+ * Get the current USB mode (personality) ID
+ */
+int UsbUiSettingModel::currentMode()
+{
+ myDebug() << ">>> UsbUiSettingModel::CurrentMode";
+ int currentMode = mSettingsManager.readItemValue(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) ).toInt();
+ myDebug() << "<<< UsbUiSettingModel::CurrentMode " << currentMode;
+ return currentMode;
+}
+
+/*!
+ * sets the value to different roles of the model's first row
+ */
+void UsbUiSettingModel::setDefaultModeSetting()
+{
+ QString iconName;
+ QString modeName;
+ //empty iconName and modeName are used for a hidden personality
+ if ( !isPersonalityHidden(mCurrentMode) ) {
+ iconName = ModeIconNamePrefix + QString::number( mCurrentMode ) + ".svg";
+ QString textId = TextIdPrefix + "modename_" + QString::number( mCurrentMode );
+ modeName = qtTrId( textId.toAscii() );
+ }
+
+ myDebug() << ">>> UsbUiSettingModel::setDefaultModeSetting iconName="
+ << iconName << " modeName=" << modeName;
+ QMap< int, QVariant > val = mSettingsList.at( DefaultMode );
+ if ( val.isEmpty() ) {
+ val[ SettingType ] = QVariant( DefaultMode );
+ }
+ val[ Qt::DecorationRole ] = QVariant(iconName) ;
+ val[ Qt::DisplayRole ]= QVariant(modeName) ;
+ mSettingsList.replace( DefaultMode, val );
+ myDebug() << "<<< UsbUiSettingModel::setDefaultModeSetting";
+}
+
+/*!
+ Updates all values related to the mode description.
+ */
+void UsbUiSettingModel::setDescriptionSetting()
+{
+ QString description;
+ //the description will be empty for a hidden personality
+ if ( !isPersonalityHidden(mCurrentMode) ) {
+ QString textId = TextIdPrefix + "description_"
+ + QString::number( mCurrentMode );
+ description = qtTrId( textId.toAscii() );
+ }
+ myDebug() << ">>> UsbUiSettingModel::setDescriptionSetting description="
+ << description;
+ QMap< int, QVariant > val = mSettingsList.at( Description );
+ if ( val.isEmpty() ) {
+
+ val[ SettingType ] = QVariant( Description );
+
+ }
+ // The display role stores the string representation of the actual value.
+ val[ Qt::DisplayRole ] = QVariant( description );
+ mSettingsList.replace( Description, val );
+ myDebug() << "<<< UsbUiSettingModel::setDescriptionSetting";
+}
+
+/*!
+ Updates all values related to the visibility setting.
+ Updates the selectable USB modes only in the 1st call.
+ */
+bool UsbUiSettingModel::setUsbModelistSetting( int aModeId )
+{
+ myDebug() << ">>> UsbUiSettingModel::setUsbModelistSetting aModeIndex="
+ << aModeId;
+ bool ret = true;
+ QMap< int, QVariant > val = mSettingsList.at(UsbModeList);
+ if ( val.isEmpty() ) {
+ val[ SettingType ] = QVariant( UsbModeList );
+
+ RUsb iUsbman;
+ if ( iUsbman.Connect() == KErrNone ) {
+
+ RArray<TInt> personalityIds;
+ mPersonalityIds.clear();
+ if ( iUsbman.GetPersonalityIds( personalityIds ) == KErrNone ) {
+ QStringList modeList;
+ for ( int i = 0; i < personalityIds.Count(); i++ ) {
+ if ( !isPersonalityHidden(iUsbman, personalityIds[i]) ) {
+ mPersonalityIds.append( personalityIds[i] );
+ modeList.append( modeListName( mPersonalityIds[i] ) );
+ }
+ }
+ val[ SettingsModeNameList ] = QVariant( modeList );
+ }
+ }
+ else{
+ ret = false;
+ }
+ iUsbman.Close();
+ }
+ //index will be -1 for hidden personality
+ val[ Qt::EditRole ] = QVariant( mPersonalityIds.indexOf(aModeId) );
+ mSettingsList.replace( UsbModeList, val );
+ myDebug() << "<<< UsbUiSettingModel::setUsbModelistSetting";
+ return ret;
+}
+
+/*!
+ * it checks the response from usbwatcher to see if the new mode change has been successful
+ * it will go back to the previous personality if it has not been successfull
+ */
+void UsbUiSettingModel::setPersonalityCompleted (int status )
+{
+ myDebug() << ">>> UsbUiSettingModel::setPersonalityCompleted status= "
+ << status;
+ // status contains Symbian error code from usbwatcher
+ // if the status is KErrNone, we are ready to process the next request
+ if (status != KErrNone)
+ {
+ // changing the personality failed, so we need to set back the previous personality
+ // the value will be read from central repository and also updates mCurrentMode
+ mPreviousMode = mSettingsManager.readItemValue(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) ).toInt();
+ setNewUsbMode(mPreviousMode);
+ }
+
+ // after handling the return code we know the the current personality works
+ // and we will not go back to the previous one
+ mPreviousMode = mCurrentMode;
+ myDebug() << "<<< UsbUiSettingModel::setPersonalityCompleted";
+}
+
+bool UsbUiSettingModel::isPersonalityHidden(RUsb &usbman, TInt personalityId)
+{
+ myDebug() << ">>> UsbUiSettingModel::isPersonalityHidden from USB Manager";
+ bool hidden = false;
+ TUint32 property = 0;
+ TInt ret = usbman.GetPersonalityProperty(personalityId, property);
+ if (ret == KErrNone) {
+ myDebug() << "property " << property;
+ if (property & KUsbPersonalityPropertyHidden) {
+ hidden = true;
+ }
+ }
+ myDebug() << "<<< UsbUiSettingModel::isPersonalityHidden " << hidden;
+ return hidden;
+}
+
+bool UsbUiSettingModel::isPersonalityHidden(TInt personalityId)
+{
+ return ( mPersonalityIds.indexOf(personalityId) == -1 );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbview.docml Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.1">
+ <widget name="viewMain" type="HbView">
+ <widget name="content" role="HbView:widget" type="HbWidget">
+ <widget name="container" type="HbWidget">
+ <sizehint height="18.0" type="MINIMUM" width="18.0"/>
+ <sizehint height="160.0" type="PREFERRED" width="363.0"/>
+ <zvalue value="0.0017000000000000006"/>
+ <layout orientation="Vertical" type="linear"/>
+ </widget>
+ <widget name="container_1" type="HbWidget">
+ <sizehint height="18.0" type="MINIMUM" width="18.0"/>
+ <sizehint height="160.0" type="PREFERRED" width="363.0"/>
+ <zvalue value="0.0016000000000000005"/>
+ <layout orientation="Vertical" type="linear"/>
+ </widget>
+ <widget name="container_2" type="HbWidget">
+ <sizehint height="18.0" type="MINIMUM" width="18.0"/>
+ <sizehint height="160.0" type="PREFERRED" width="363.0"/>
+ <zvalue value="0.0018000000000000006"/>
+ <layout orientation="Vertical" type="linear"/>
+ </widget>
+ <layout type="anchor" widget="content">
+ <anchoritem dst="container" dstEdge="LEFT" spacing="0.0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="container" dstEdge="TOP" spacing="0.0" src="" srcEdge="TOP"/>
+ <anchoritem dst="container" dstEdge="RIGHT" spacing="0.0" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="container_1" dstEdge="LEFT" spacing="0.0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="container_1" dstEdge="TOP" spacing="0.0" src="container" srcEdge="BOTTOM"/>
+ <anchoritem dst="container_1" dstEdge="RIGHT" spacing="0.0" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="container_2" dstEdge="LEFT" spacing="-3.0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="container_2" dstEdge="TOP" spacing="0.0" src="container_1" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ <string name="title" value="USB"/>
+ </widget>
+ <metadata>
+ <resource location="usbapplication.qrc"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbviewmanager.cpp Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <HbMainWindow.h>
+#include "UsbViewManager.h"
+#include "UsbMainView.h"
+
+
+UsbViewManager::UsbViewManager( HbMainWindow* mainWindow, QObject *parent )
+: QObject( parent ),
+ mWindow(mainWindow)
+ {
+ }
+
+UsbViewManager::~UsbViewManager()
+ {
+
+ }
+
+/*!
+ Create views(main view, gadget gallery view and gadget details view).
+ Add them to MainWindow.
+ */
+void UsbViewManager::addView()
+ {
+ // Create main view and add
+ mMainView = new UsbMainView( this );
+ mWindow->addView(mMainView);
+
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/usbapplication.pro Fri Apr 23 23:17:21 2010 +0300
@@ -0,0 +1,74 @@
+#
+# ============================================================================
+# Name : usbapplication.pro
+# Part of : USB / USB Settings Application *** Info from the SWAD
+# Description : Project definition file for project USB Settings Application
+# Version : %version: 3 % << Don't touch! Updated by Synergy at check-out.
+#
+# Copyright © 2009 Nokia. All rights reserved.
+# This material, including documentation and any related computer
+# programs, is protected by copyright controlled by Nokia. All
+# rights are reserved. Copying, including reproducing, storing,
+# adapting or translating, any or all of this material requires the
+# prior written consent of Nokia. This material also contains
+# confidential information which may not be disclosed to others
+# without the prior written consent of Nokia.
+# ============================================================================
+#
+
+TEMPLATE = app
+TARGET = usbapplication
+QT += core \
+ gui \
+ xml
+HEADERS += inc/usbuisettingmodel.h \
+ inc/usbuimodelactive.h \
+ inc/usbviewmanager.h \
+ inc/usbmainview.h
+SOURCES += src/usbuisettingmodel.cpp \
+ src/usbuimodelactive.cpp \
+ src/usbviewmanager.cpp \
+ src/usbmainview.cpp \
+ src/main.cpp \
+ src/usbapplication_reg.rss
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+LIBS += -lcentralrepository
+LIBS += -lusbwatcher
+LIBS += -lxqsettingsmanager
+LIBS += -lusbman
+LIBS += -lhbcore
+LIBS += -lhbwidgets
+LIBS += -lhbtools
+FORMS +=
+RESOURCES += src/usbicons.qrc \
+ src/usbapplication.qrc
+CONFIG += qt \
+ hb
+
+TRANSLATIONS=usbapplication.ts
+
+symbian: {
+
+ TARGET.UID3 = 0x2002BCA3
+ TARGET.CAPABILITY = LocalServices \
+ WriteDeviceData
+
+ # for pkg
+ usbuitranslation.sources = src/usbapplication.qm
+ usbuitranslation.path = /resource
+ DEPLOYMENT += usbuitranslation
+
+ BLD_INF_RULES.prj_exports += "./src/usbapplication.qm z:/resource/usbapplication.qm"
+
+}
+
+# placeholder for creating sis file
+createsis.commands += ( makesis -v usbapplication.pkg ); \
+ && \
+ ( signsis.exe usbapplication.sis usbapplication_signed.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key ); \
+ && \
+ ( del usbapplication.sis );
+QMAKE_EXTRA_TARGETS += createsis
+
+BLD_INF_RULES.prj_exports += \
+ "rom/usbsettings.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbsettings.iby)" \
\ No newline at end of file