Revision: 201033
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 02 Sep 2010 20:36:53 +0300
changeset 65 8a530a83576a
parent 56 11a052f4b02e
child 69 dcd4152cfe55
Revision: 201033 Kit: 201035
appsupport.pro
appsupport_plat/system_application_notification_api/inc/coreapplicationuisdomainpskeys.h
commonappservices/alarmserver/Server/Source/ASSrvAlarmQueue.cpp
coreapplicationuis/SysAp/Group/SysAp.mmp
coreapplicationuis/SysAp/Inc/SysApAppUi.h
coreapplicationuis/SysAp/Inc/hbdeviceinputdialogsymbian.h
coreapplicationuis/SysAp/Src/SysApAppUi.cpp
coreapplicationuis/SysAp/Src/SysApPubSubObserver.cpp
coreapplicationuis/SysAp/Src/hbdeviceinputdialogsymbian.cpp
coreapplicationuis/SysAp/Src/memorycard/sysapdriveejecthandler.cpp
coreapplicationuis/SysAp/Src/memorycard/sysapdrivelist.cpp
coreapplicationuis/SysAp/Src/memorycard/sysapdriveunlockhandler.cpp
coreapplicationuis/SysAp/Src/memorycard/sysapdriveunlockhandler.h
coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp
coreapplicationuis/hbdeviceinputdialogplugin/hbdeviceinputdialogplugin.pro
coreapplicationuis/hbdeviceinputdialogplugin/inc/hbdeviceinputdialogplugin_p.h
coreapplicationuis/hbdeviceinputdialogplugin/inc/hbdeviceinputdialogpluginerrors_p.h
coreapplicationuis/hbdeviceinputdialogplugin/inc/hbdeviceinputdialogwidget_p.h
coreapplicationuis/hbdeviceinputdialogplugin/rom/hbdeviceinputdialogplugin.iby
coreapplicationuis/hbdeviceinputdialogplugin/rom/hbdeviceinputdialogplugin_resources.iby
coreapplicationuis/hbdeviceinputdialogplugin/src/hbdeviceinputdialogplugin.cpp
coreapplicationuis/hbdeviceinputdialogplugin/src/hbdeviceinputdialogwidget.cpp
coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/formatterrfsplugin.mmp
coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/secureformatter.mmp
coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/formatterrfsplugincommon.h
coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/selectiveformatter.h
coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp
coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/selectiveformatter.cpp
sysresmonitoring/oommonitor/src/oomclientrequestqueue.cpp
sysresmonitoring/oommonitor/src/oomcloseapp.cpp
sysresmonitoring/oommonitor/src/oommemorymonitorsession.cpp
--- a/appsupport.pro	Wed Aug 18 09:58:19 2010 +0300
+++ b/appsupport.pro	Thu Sep 02 20:36:53 2010 +0300
@@ -25,4 +25,5 @@
 SUBDIRS += systemsettings\accindicatorplugin\accindicatorsettings
 SUBDIRS += coreapplicationuis\powersaveutilities
 SUBDIRS += coreapplicationuis\Rfs\Plugins\cprfsplugin
+SUBDIRS += coreapplicationuis\hbdeviceinputdialogplugin
 }
--- a/appsupport_plat/system_application_notification_api/inc/coreapplicationuisdomainpskeys.h	Wed Aug 18 09:58:19 2010 +0300
+++ b/appsupport_plat/system_application_notification_api/inc/coreapplicationuisdomainpskeys.h	Thu Sep 02 20:36:53 2010 +0300
@@ -224,7 +224,9 @@
      {
      ECoreAppUIsPowerMenuCustomDialogUninitialized = 0,
      ECoreAppUIsPowerMenuCustomDialogOff,
-     ECoreAppUIsPowerMenuCustomDialogOn
+     ECoreAppUIsPowerMenuCustomDialogOn,
+     ECoreAppUIsMemoryCardCustomDialogOk,
+     ECoreAppUIsMemoryCardCustomDialogCancel
      };
 
 // =============================================================================
--- a/commonappservices/alarmserver/Server/Source/ASSrvAlarmQueue.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/commonappservices/alarmserver/Server/Source/ASSrvAlarmQueue.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -96,7 +96,7 @@
 	iASSrvDSTChange = CASSrvDSTChange::NewL(*this);
 
 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
-	iSsmRtcAdaptation.Connect();
+	User::LeaveIfError(iSsmRtcAdaptation.Connect());
 	// Notify the listeners of 'KWakeupAlarmPubSubKey' key that the alarm queue is yet  to be internalized 
 	// by Alarm Server on its start-up at the device boot time.
 	RProperty::Define(KAlarmServerPubSubCategory, KWakeupAlarmPubSubKey, RProperty::EInt, KReadPolicy, KWritePolicy);
--- a/coreapplicationuis/SysAp/Group/SysAp.mmp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Group/SysAp.mmp	Thu Sep 02 20:36:53 2010 +0300
@@ -52,6 +52,7 @@
 SOURCE sysapdefaultkeyhandler.cpp SysApStartupController.cpp
 SOURCE SysApShutdownImage.cpp
 SOURCE hbdevicepowermenusymbian.cpp
+SOURCE hbdeviceinputdialogsymbian.cpp
 
 #ifdef __OFFLINE_MODE
 SOURCE OfflineModeController/SysApOfflineModeControllerImpl.cpp
@@ -60,8 +61,9 @@
 
 SYSTEMINCLUDE		/epoc32/include/mw/hb/hbwidgets
 SYSTEMINCLUDE		/epoc32/include/mw/hb/hbcore
-//SYSTEMINCLUDE		/epoc32/include/mw/QtCore
-SYSTEMINCLUDE      /epoc32/include/mw
+
+SYSTEMINCLUDE      	/epoc32/include/mw
+
 
 USERINCLUDE        . 
 USERINCLUDE        ../Inc
@@ -72,9 +74,10 @@
 USERINCLUDE        ../../../inc // ado headers
 USERINCLUDE        ../CenRep
 USERINCLUDE        ../PubSub
+USERINCLUDE        ../Src/memorycard
 
 MW_LAYER_SYSTEMINCLUDE 
-
+APP_LAYER_SYSTEMINCLUDE
 
 START RESOURCE ../Data/SysAp.rss
 HEADER
@@ -123,7 +126,6 @@
 LIBRARY hbwidgets.lib
 //LIBRARY qtcore.lib
 
-//LIBRARY HbDeviceInputDialogWidget.lib
 
 //For CHbIndicatorSymbian and for CHbPowereMenusymbian
 LIBRARY hbcore.lib
@@ -178,8 +180,7 @@
 
 LIBRARY secui.lib
 LIBRARY bsutil.lib
-//LIBRARY batterypopupcontrol.lib
-//LIBRARY CommonEngine.lib
+LIBRARY CommonEngine.lib
 SOURCEPATH ../Src/Bt
 SOURCE SysApBtControllerImpl.cpp
 SOURCEPATH ../Src/BtSap
@@ -207,6 +208,21 @@
 LIBRARY	    SVGEngine.lib
 LIBRARY	    gdi.lib
 
+SOURCEPATH  ../Src
+
+SOURCE memorycard/SysApMMCObserver.cpp
+#ifdef RD_MULTIPLE_DRIVE
+SOURCE memorycard/sysapdrivelist.cpp
+SOURCE memorycard/sysapdriveunlockhandler.cpp
+SOURCE memorycard/sysapdriveejecthandler.cpp
+#endif // RD_MULTIPLE_DRIVE
+
+#ifdef RD_MULTIPLE_DRIVE
+LIBRARY platformenv.lib
+LIBRARY disknotifyhandler.lib
+#endif // RD_MULTIPLE_DRIVE
+
+
 LIBRARY avkon.lib
 
 LIBRARY customapi.lib
--- a/coreapplicationuis/SysAp/Inc/SysApAppUi.h	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Inc/SysApAppUi.h	Thu Sep 02 20:36:53 2010 +0300
@@ -17,9 +17,7 @@
 
 #ifndef SYSAPAPPUI_H
 #define SYSAPAPPUI_H
-//#include <QObject>
-//#include <aknappui.h>
-//#include <hbmessagebox.h>
+
 #include <aknappui.h>
 #include "SysAp.hrh"
 #include <f32file.h> 
@@ -42,22 +40,15 @@
 #include "hbdevicepowermenusymbian.h"
 
 #include "sysappsmcontroller.h"
+#include "SysApMMCObserver.h"
 
-//CLASS DECLARATION
-/**
-*  CSysApAppUi class. This class serves as a link between the other
-*  SysAp classes and performs the most UI specific operations on SysAp's
-*  responsibility.
-*
-*  @lib   sysap
-*  @since 1.0
-*/
+#ifdef RD_MULTIPLE_DRIVE
+#include "sysapdrivelist.h"
+#endif // RD_MULTIPLE_DRIVE
+
 #include <eikappui.h>
 
 
-//class CAknAppUiBase;
-//class CSysApKeySndHandler;
-//class  CSysApWsClient;
 class CSysApFeatureManager;
 class CSysApNspsHandler;
 class CSysApPubSubObserver;
@@ -86,14 +77,27 @@
 class CSysApShutdownAnimation;
 
 class CSysApDefaultKeyHandler;
+class CSysApDriveUnlockHandler;
+class CSysApDriveEjectHandler;
+class CHbDeviceInputDialogSymbian;
 class CSysApEtelConnector;
 
 const TInt KBluetoothModulePowerModeOn ( 1 );
 const TInt KDummyReason( -1 );
 
-//class HbMessageBox;
+
+//CLASS DECLARATION
+/**
+*  CSysApAppUi class. This class serves as a link between the other
+*  SysAp classes and performs the most UI specific operations on SysAp's
+*  responsibility.
+*
+*  @lib   sysap
+*  @since 1.0
+*/
 
 class CSysApAppUi : public CAknAppUi,
+                    public MSysApMemoryCardObserver,
                     public MSysApTimerResponder,
                     public MSysapCallback,
                     public MSysApPsmControllerNotifyCallback
@@ -328,10 +332,97 @@
         void SetLightsOnSecurityQueryL();  
         TBool CheckLongPowerKeyPressed();
         TBool ReleasePowerMenuCustomDialogMemory();
-//        TBool ReleaseMemoryCardCustomDialogMemory();
+        TBool NotifiedDialogIfRequiredAndReleaseMemory();
         static TInt DoStopAnimTiming( TAny* aObject );
         CEikStatusPane* StatusPane();
         
+        void EjectUsed( TInt aDrive );
+        
+        void EjectMMCL();
+        
+#ifndef RD_MULTIPLE_DRIVE
+        /**
+        * Mounts MMC drive
+        * @param None
+        * @return TInt : error value from RFs::MountFileSystem()
+        */
+        TInt MountMMC();
+
+        /**
+        * Dismounts MMC drive
+        * @param None
+        * @return TInt : error value from RFs::MountFileSystem()
+        */
+        TInt DismountMMC();
+#endif // RD_MULTIPLE_DRIVE
+        
+#ifndef RD_MULTIPLE_DRIVE
+        /**
+        * Unlocks MMC
+        * @param None
+        * @return void
+        */
+        void RunUnlockNotifierL( TSysApMemoryCardStatus aMemoryCardStatus = ESysApMemoryCardStatusNotKnown );
+
+        /**
+        * From MSysApMemoryCardObserver.
+        * Gets called by CSysApMMCObserver when an MMC is inserted/removed
+        * @return void
+        */
+        void MMCStatusChangedL();
+
+        /**
+        * Shows "MMC removed..." dialogs
+        * @param None
+        * @return void
+        */
+        void ShowMMCDismountedDialogL();
+#else // RD_MULTIPLE_DRIVE
+
+        /**
+        * Updates PS key during boot
+        * @return void
+        */
+        void MMCInsertedL();
+
+        /**
+        * Unlocks MMC
+        * @param None
+        * @return void
+        */
+        void RunUnlockNotifierL();
+
+        /**
+        * From MSysApMemoryCardObserver.
+        * Gets called by CSysApMMCObserver when an MMC is inserted/removed
+        * @param aDrive Changed drive
+        * @return void
+        */
+        void MMCStatusChangedL( TInt aDrive );
+
+        /**
+        * Shows "MMC removed..." dialogs
+        * @param aDrive Drive to dismount
+        * @param aEjectType Eject type used for the drive
+        * @return void
+        */
+        TBool ShowMMCDismountedDialogL(
+            TInt aDrive, CSysApDriveList::TDriveEjectType aEjectType );
+#endif // RD_MULTIPLE_DRIVE
+        
+#ifdef RD_MULTIPLE_DRIVE
+        /*
+        * Starts wait note for eject
+        */
+        void ShowEjectWaitNoteL(  TInt aDriveToEject );
+
+        /*
+        * Checks is eject query visible
+        */
+        TBool IsEjectQueryVisible();
+#endif // RD_MULTIPLE_DRIVE
+        
+        
 #ifdef SYSAP_USE_STARTUP_UI_PHASE        
         /**
         * Called when UI is ready after boot.
@@ -340,7 +431,12 @@
 
 #endif // SYSAP_USE_STARTUP_UI_PHASE
 
-
+       
+        void MMCDismountedDialogConfirmed();
+        
+        void EjectStarted( TBool ejectStarted );
+        
+        void EjectMMCCanceled();
         
         void HandleNspsRawKeyEventL();
 
@@ -352,7 +448,7 @@
         
         void UpdateSignalBarsL();
         
-
+        void ReleaseMemoryForMemoryCardDialog();
         
      private:
          /**
@@ -381,7 +477,10 @@
          
          CSysApCenRepLogsObserver& CSysApAppUi::LogsObserverL();
          void ContinueShutdown();
-
+         
+#ifdef RD_MULTIPLE_DRIVE
+        void UpdateInsertedMemoryCardsL();
+#endif // RD_MULTIPLE_DRIVE
         
      private:
 //          CSysApWsClient*                 iSysApWsClient;
@@ -420,7 +519,7 @@
 		  CKeyguardAccessApi*             iKeyguardController;
 		  CHbDevicePowerMenuSymbian*            iPowerMenuDialog;
 	      CSysApKeyManagement*            iSysApKeyManagement;
-
+	      CSysApMMCObserver*              iSysApMMCObserver;
 	      CSysApEtelConnector*            iSysApEtelConnector;
 		  
 	public:		  
@@ -466,7 +565,69 @@
         TBool                           iShutdownContinued;
         TBool                           iNsps;
         
-//        friend class CSysApWsClient;
+        
+        //CPeriodic*                      iTimer;
+#ifndef RD_MULTIPLE_DRIVE
+        TInt                            iPowerkeyMenuEjectSelection;
+#endif // RD_MULTIPLE_DRIVE
+        
+#ifndef RD_MULTIPLE_DRIVE
+        TBool                           iHideFirstBeep;
+#endif // RD_MULTIPLE_DRIVE
+        
+#ifndef RD_MULTIPLE_DRIVE
+        TBool                           iTimeToKill;                     // MMC Hot Swap
+        TInt                            iApplicationScanningRoundNumber; // MMC Hot Swap
+#endif // RD_MULTIPLE_DRIVE
+        
+#ifndef RD_MULTIPLE_DRIVE
+        TBool                           iMMCPowerMenuEjectUsed;
+        TBool                           iMMCInserted;
+#endif // RD_MULTIPLE_DRIVE
+        
+#ifndef RD_MULTIPLE_DRIVE
+        TBool iHideNextBeep; // Prevents double beep when USB file transfer gets activated
+        TBool iFileManagerCloseDisabled; // Prevents File Manager to close on hotswap
+#endif // RD_MULTIPLE_DRIVE
+        
+#ifdef RD_MULTIPLE_DRIVE
+        // First power menu index used for eject
+        TInt iPowerkeyMenuEjectSelectionBase;
+
+        /**
+        * Drive list container
+        * Own.
+        */
+        CSysApDriveList* iSysApDriveList;
+
+        /**
+        * Drive unlock handler.
+        * Own.
+        */
+        CSysApDriveUnlockHandler* iSysApDriveUnlockHandler;
+
+        /**
+        * Drive eject handler.
+        * Own.
+        */
+        CSysApDriveEjectHandler* iSysApDriveEjectHandler;
+
+        /**
+        * Array for storing inserted memory cards.
+        * Own.
+        */
+        RArray< CSysApDriveList::TMemoryCardEntry > iInsertedMemoryCards;
+
+        // Stores drive for dismount query
+        TInt iDriveToDismount;
+
+        // Stores drive for eject query
+        TInt iDriveToEject;
+#endif // RD_MULTIPLE_DRIVE
+        
+        TBool                           iMMCEjectUsed;
+        CHbDeviceInputDialogSymbian* iMemCardPwdDialog;
+        
 	};
 	
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/SysAp/Inc/hbdeviceinputdialogsymbian.h	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (developer.feedback@nokia.com)
+**
+** This file is part of the HbWidgets module of the UI Extensions for Mobile.
+**
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at developer.feedback@nokia.com.
+**
+****************************************************************************/
+
+#ifndef HBDEVICEINPUTDIALOGSYMBIAN_H
+#define HBDEVICEINPUTDIALOGSYMBIAN_H
+
+#if defined(__SYMBIAN32__) || defined(SYMBIAN) || defined(HB_DOXYGEN)
+
+#include <e32base.h>
+#include <hbsymbianvariant.h>
+#include <e32debug.h>
+#ifdef _DEBUG
+
+    #define TRACES( x ) x
+
+#else
+
+    #define TRACES( x )
+
+#endif
+
+class CHbDeviceInputDialogPrivate;
+class MHbDeviceInputDialogObserver;
+
+class CHbDeviceInputDialogSymbian : public CBase
+{
+public:
+      enum InputMode {
+            TextInput,
+            IntInput,
+            RealInput,
+            IpInput 
+      };
+    
+    enum TButtonId {
+        EAcceptButton,
+        ERejectButton
+    };
+
+public:
+
+    static CHbDeviceInputDialogSymbian* NewL(MHbDeviceInputDialogObserver *aObserver = 0);
+    ~CHbDeviceInputDialogSymbian();
+    
+    TPtrC getTextL();
+   
+    void ShowL();
+    void Close(); 
+
+    void SetObserver(MHbDeviceInputDialogObserver *aObserver);
+    
+private:
+    friend class CHbDeviceInputDialogPrivate;
+    CHbDeviceInputDialogSymbian();
+    CHbDeviceInputDialogPrivate* d;
+    TBuf<16> iPassword;
+    TBuf8<16> iTemp;
+    
+};
+
+class MHbDeviceInputDialogObserver
+{
+public:
+    virtual void InputDialogClosed(const CHbDeviceInputDialogSymbian* aInputDialog,
+        CHbDeviceInputDialogSymbian::TButtonId aButton) = 0;
+    virtual void DataReceived(CHbSymbianVariantMap data) = 0; 
+};
+
+#endif // defined(__SYMBIAN32__) || defined(SYMBIAN) || defined(HB_DOXYGEN)
+#endif // HBDEVICEINPUTDIALOGSYMBIAN_H
--- a/coreapplicationuis/SysAp/Src/SysApAppUi.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/SysApAppUi.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -30,7 +30,6 @@
 #include <hwrmpowerstatesdkpskeys.h>
 #include <wlaninternalpskeys.h> 
 #include <HbDeviceNotificationDialogSymbian.h>
-//#include <HbDeviceInputDialogSymbian.h>
 #include <hbsymbianvariant.h>
 #include <hbtextresolversymbian.h>
 #include <UikonInternalPSKeys.h>
@@ -53,7 +52,6 @@
 #include "MSysApBtSapController.h"
 #include "MSysApBtController.h"
 #include "MSysApUsbIndicator.h"
-
 #include "sysapkeymanagement.h"
 #include "SysApShutdownImage.h"
 #include "SysApKeySndHandler.h"
@@ -61,7 +59,12 @@
 #include "SysApShutdownAnimation.h"
 #include "SysApEtelConnector.h"
 
-
+#ifdef RD_MULTIPLE_DRIVE
+#include "sysapdrivelist.h"
+#include "sysapdriveunlockhandler.h"
+#include "sysapdriveejecthandler.h"
+#include "hbdeviceinputdialogsymbian.h"
+#endif // RD_MULTIPLE_DRIVE
 
 #include <settingsinternalcrkeys.h>
 #include <keyguardaccessapi.h>
@@ -120,7 +123,9 @@
      iSysApUsbIndicatorController(NULL),
      iKeyguardController (NULL),
      iKeyLockOnBeforeCall (EFalse),
-     iCheckLongPowerKeyEvent (EFalse)
+     iCheckLongPowerKeyEvent (EFalse),
+     iMMCEjectUsed( EFalse ),               
+     iMemCardPwdDialog(NULL)
 	{
 	TRACES( RDebug::Print( _L("CSysApAppUi::CSysApAppUi()") ) );
     }
@@ -251,6 +256,24 @@
     TRACES( RDebug::Print( _L("CCSysApAppUi::ConstructL  trying CSysApCenRepHacSettingObserver::NewL") ) );
     iSysApCenRepHacSettingObserver = CSysApCenRepHacSettingObserver::NewL( *this ); 
     
+#ifndef RD_MULTIPLE_DRIVE
+    if ( iSysApFeatureManager->MmcSupported() )
+        {
+        iSysApMMCObserver = CSysApMMCObserver::NewL( this, &iEikonEnv->FsSession(), iSysApFeatureManager->MmcHotSwapSupported() );
+        }
+#else // RD_MULTIPLE_DRIVE
+    iSysApDriveList = CSysApDriveList::NewL( iEikonEnv->FsSession() );
+    if ( iSysApFeatureManager->MmcSupported() )
+        {
+        iSysApMMCObserver = CSysApMMCObserver::NewL(
+            iEikonEnv->FsSession(), *iSysApDriveList, *this, iSysApFeatureManager->MmcHotSwapSupported() );
+        iSysApDriveUnlockHandler = CSysApDriveUnlockHandler::NewL(
+            *iSysApDriveList, *this, iSysApFeatureManager->MemoryCardLockSupported() );
+        iSysApDriveEjectHandler = CSysApDriveEjectHandler::NewL(
+            *iSysApDriveList, *this, iEikonEnv->FsSession() );
+        }
+#endif // RD_MULTIPLE_DRIVE
+    
     //Instantiate the KEF plugin manager
     //Trap constuction, since Sysap may live without iSysApKeyManagement
     TRAPD(keyManagementErr, iSysApKeyManagement=CSysApKeyManagement::NewL(CCoeEnv::Static()->RootWin(), *this));
@@ -297,7 +320,14 @@
     delete iVariantAccState; 
 
     delete iSysApAudioRoutingObserver;
-
+    
+    if (iMemCardPwdDialog!=NULL)
+        {
+        //PowerMenu already exist
+        delete iMemCardPwdDialog;
+        iMemCardPwdDialog = NULL;
+        }
+    
     if ( iSapTimer )
         {
         iSapTimer->Cancel();
@@ -428,9 +458,22 @@
     DoSwStateNormalConstructionL();
     HandleAccessoryProfileInStartupL();
           
-
-      
-       
+    if ( iSysApFeatureManager->MmcSupported() )
+        {
+#ifndef RD_MULTIPLE_DRIVE
+        MountMMC();
+        MMCStatusChangedL();
+        iHideFirstBeep = EFalse;
+#else // RD_MULTIPLE_DRIVE
+        iSysApDriveList->MountDrive( iSysApDriveList->DefaultMemoryCard() );
+        UpdateInsertedMemoryCardsL();
+#endif // RD_MULTIPLE_DRIVE
+        }
+		
+	if ( iSysApFeatureManager->MmcHotSwapSupported() )
+        {
+        iSysApMMCObserver->StartMountObserver();
+        }    
    
     if ( !iSysApPsmController ) // created here if first state change has not occurred yet
        {
@@ -522,7 +565,23 @@
     if( IsStateNormal() )
         {
         TRACES( RDebug::Print(_L("CSysApAppUi::DoStateChangedL to normal state.") ) );
-
+        
+        if ( iSysApFeatureManager->MmcSupported() )
+            {
+#ifndef RD_MULTIPLE_DRIVE
+            MountMMC();
+            MMCStatusChangedL();
+            iHideFirstBeep = EFalse;
+#else // RD_MULTIPLE_DRIVE
+            iSysApDriveList->MountDrive( iSysApDriveList->DefaultMemoryCard() );
+            UpdateInsertedMemoryCardsL();
+#endif // RD_MULTIPLE_DRIVE
+            }
+        if ( iSysApFeatureManager->MmcHotSwapSupported() )
+            {
+            iSysApMMCObserver->StartMountObserver();
+            }
+        
         iSysApBtController = CreateSysApBtControllerL( *this );
         iSysApBtSapController = CreateSysApBtSapControllerL( *this );
 
@@ -559,6 +618,10 @@
 
 #endif // SYSAP_USE_STARTUP_UI_PHASE
 
+// ----------------------------------------------------------------------------
+// CSysApAppUi::~CSysApAppUi()
+// ----------------------------------------------------------------------------
+
 CSysApAppUi::~CSysApAppUi()
     {
     TRACES( RDebug::Print( _L("~CSysApAppUi() started") ) );
@@ -593,6 +656,14 @@
 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
 
     delete iSysApStartupController;
+
+#ifdef RD_MULTIPLE_DRIVE
+    iInsertedMemoryCards.Close();
+    delete  iSysApDriveEjectHandler;
+    delete iSysApDriveUnlockHandler;
+    delete iSysApDriveList;
+#endif // RD_MULTIPLE_DRIVE
+
     TRACES( RDebug::Print( _L("~CSysApAppUi() completed") ) );
     }
         
@@ -603,15 +674,12 @@
 
 void CSysApAppUi::ShowExampleUiNoteL( const TDesC& noteText )const
     {          
-    //   QString msg  = QString::fromUtf16(aStringPointer.Ptr(),aStringPointer.Length());
  	TRACES( RDebug::Print( _L("CSysApAppUi::ShowExampleUiNoteL:: constructing CHbDeviceMessageBoxSymbian:BeGIN") ) );    
     CHbDeviceMessageBoxSymbian *note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
  	CleanupStack::PushL(note);
     TRACES( RDebug::Print( _L("CSysApAppUi::ShowExampleUiNoteL:: construction of CHbDeviceMessageBoxSymbian:END") ) ); 
-	//	HbMessageBox *note = new HbMessageBox (HbMessageBox ::MessageTypeInformation);
     note->SetTextL(noteText);
-    //  note->SetTimeout(HbPopup::NoTimeout);
-	note->SetTimeout(5);
+	note->SetTimeout(300);
  	TRACES( RDebug::Print( _L("CSysApAppUi:: Display of  CHbDeviceMessageBoxSymbian::Begin") ) );    
     note->ShowL();
 	TRACES( RDebug::Print( _L("CSysApAppUi:: Display of  CHbDeviceMessageBoxSymbian::End") ) );
@@ -1229,10 +1297,9 @@
     if ( aUsbAttached )
         {
           // For ignoring extra beeps caused by USB file transfer
-/*        iSysApDriveList->ResetDrivesInsertBeepIgnored();
+        iSysApDriveList->ResetDrivesInsertBeepIgnored();
         iSysApDriveList->MarkDrivesInsertBeepIgnored( iInsertedMemoryCards );
-        // Will take care in next sub
-*/        }
+        }
     }
 #endif // RD_MULTIPLE_DRIVE
 
@@ -1488,6 +1555,20 @@
     }
 
 // ----------------------------------------------------------------------------
+// CSysApAppUi::EjectStarted()
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::EjectStarted( TBool ejectStarted )
+    {
+    TRACES( RDebug::Print( _L( "CSysApAppUi::EjectStarted" ) ) );
+    iMMCEjectUsed = ejectStarted;
+    
+#ifndef RD_MULTIPLE_DRIVE
+    iFileManagerCloseDisabled = ejectStarted;
+#endif // RD_MULTIPLE_DRIVE
+}
+
+// ----------------------------------------------------------------------------
 // CSysApAppUi::DoLightsTimeoutChangedL
 // ----------------------------------------------------------------------------
 void CSysApAppUi::DoLightsTimeoutChangedL( const TInt aTimeout )
@@ -1895,7 +1976,7 @@
         // Memory card needs to be unlocked when device is unlocked
         if ( iSysApFeatureManager->MmcHotSwapSupported() )
             {
-            // RunUnlockNotifierL();
+             RunUnlockNotifierL();
             // Need to handle feature for unlocking the MMC card
             }
         }
@@ -2640,7 +2721,7 @@
             {
             if ( StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) !=  EPSCTsyCallStateRinging && StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) !=  EPSCTsyCallStateAlerting )
                 {
-                // RunUnlockNotifierL();
+                 RunUnlockNotifierL();
                 // need to handle MMC unlock query in next sub
                 }
             }
@@ -2715,15 +2796,15 @@
                         iLastPowerKeyWasShort = ETrue;
                         TRACES( RDebug::Print( _L("CSysApAppUi::Key was consumed by pressing short power") ) );          
                         //Powermenu
-                        if (iPowerMenuDialog != NULL)
+                        if (iPowerMenuDialog!=NULL)
                             {
                             //PowerMenu already exist
                             delete iPowerMenuDialog;
                             iPowerMenuDialog = NULL;
-                            } 
-                            
-                        iPowerMenuDialog = CHbDevicePowerMenuSymbian::NewL(*this);
-                        iPowerMenuDialog->ShowL();                        
+                            }                                               
+                        iPowerMenuDialog = CHbDevicePowerMenuSymbian::NewL(*this);  
+                        iPowerMenuDialog->ShowL();           
+                                         
                         iIgnoreNextPowerKeyRepeats = EFalse;
                         }
                     //Long power key press
@@ -2828,6 +2909,32 @@
     return EFalse;
     }
 
+TBool CSysApAppUi::NotifiedDialogIfRequiredAndReleaseMemory()
+    {
+    TRACES( RDebug::Print(_L("CSysApAppUi::NotifiedDialogIfRequiredAndReleaseMemory(): Begin") ) );
+    TRACES( RDebug::Print(_L("CSysApAppUi::NotifiedDialogIfRequiredAndReleaseMemory(): Enter for popping another dialog") ) );
+    TInt popUpError = iSysApDriveUnlockHandler->CheckMemoryDialogIfNeeded();
+    
+    //Deside if dialog required again !!    
+    if(popUpError)
+        {
+        iSysApDriveUnlockHandler->ReleaseMemoryForInputCardDialog();  // check memory has released.
+        iSysApDriveUnlockHandler->UnlockComplete(KErrNone);
+        }
+    else
+        {
+        iSysApDriveUnlockHandler->StartUnlock();// pop up the dialog again !!        
+        }
+    
+    TRACES( RDebug::Print(_L("CSysApAppUi::NotifiedDialogIfRequiredAndReleaseMemory(): End")) );    
+    return popUpError;
+    }
+
+void CSysApAppUi::ReleaseMemoryForMemoryCardDialog()
+    {
+    TRACES( RDebug::Print(_L("CSysApAppUi::CSysApAppUi::ReleaseMemoryForMemoryCardDialog()")) );                                    
+    iSysApDriveUnlockHandler->ReleaseMemoryForInputCardDialog();
+    }
 
 // ----------------------------------------------------------------------------
 // CSysApAppUi::ShowAnimationL()
@@ -2990,14 +3097,25 @@
 }
  
 
+#ifndef RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::EjectUsed
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::EjectUsed( TInt /*aDrive*/ )
+    {
+    }
+
+#else // RD_MULTIPLE_DRIVE
 
 // ----------------------------------------------------------------------------
 // CSysApAppUi::ShowEjectWaitNoteL
 // ----------------------------------------------------------------------------
 
-//void CSysApAppUi::ShowEjectWaitNoteL( TInt /* aDriveToEject */ )
- /*{
-   if ( iSysApWaitNote )
+void CSysApAppUi::ShowEjectWaitNoteL( TInt /* aDriveToEject */ )
+    {
+ /*   if ( iSysApWaitNote )
         {
         return;
         }
@@ -3009,7 +3127,801 @@
         iSysApFeatureManager->CoverDisplaySupported() );
     iSysApWaitNote->ShowNoteL( EClosingApplicationsNote, text );
     CleanupStack::PopAndDestroy( text );
-    }*/
+ */   }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::IsEjectQueryVisible
+// ----------------------------------------------------------------------------
+
+TBool CSysApAppUi::IsEjectQueryVisible()
+    {
+//    if ( !iSysApConfirmationQuery )
+        {
+        return EFalse;
+        }
+//    TInt queryId( iSysApConfirmationQuery->CurrentQuery() );
+//    return ( queryId == ESysApEjectMmcQuery || queryId == ESysApRemoveMmcNote );
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::UpdateInsertedMemoryCardsL
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::UpdateInsertedMemoryCardsL()
+    {
+    // Update inserted memory cards
+    iSysApDriveList->GetMemoryCardsL(
+        iInsertedMemoryCards, CSysApDriveList::EIncludeInserted );
+
+    // Update memory card indicator status
+//    SetMemoryCardIndicatorL();
+
+    // Handle unlock
+    RunUnlockNotifierL();
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::EjectUsed
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::EjectUsed( TInt aDrive )
+    {
+    // Check drive inserted before starting eject confirm query
+    TInt insertedIndex( CSysApDriveList::Find( iInsertedMemoryCards, aDrive ) );
+
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::EjectUsed: drive: %d, index: %d" ),
+        aDrive, insertedIndex ) );
+
+    if ( insertedIndex == KErrNotFound )
+        {
+        return;
+        }
+
+    iMMCEjectUsed = ETrue;
+    iDriveToEject = aDrive;
+    iSysApDriveList->ResetDrivesToEject();
+    TRAPD( err, EjectMMCL() );
+    if ( err != KErrNone )
+        {
+        TRACES( RDebug::Print(
+            _L( "CSysApAppUi::EjectUsed: err: %d" ), err ) );
+        iMMCEjectUsed = EFalse;
+        }
+    }
+#endif // RD_MULTIPLE_DRIVE
+
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::EjectMMCCanceled
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::EjectMMCCanceled()
+    {
+    // Called from eject confirm query, reset eject status
+#ifdef RD_MULTIPLE_DRIVE
+    iMMCEjectUsed = EFalse;
+#endif // RD_MULTIPLE_DRIVE
+    }
+
+
+
+#ifndef RD_MULTIPLE_DRIVE
+// ----------------------------------------------------------------------------
+// CSysApAppUi::MountMMC()
+// ----------------------------------------------------------------------------
+
+TInt CSysApAppUi::MountMMC()
+    {
+    TRACES( RDebug::Print( _L("CSysApAppUi::MountMMC") ) );
+    TInt err ( KErrNotSupported );
+    if ( iSysApFeatureManager->MmcSupported() )
+        {
+#ifdef __WINS__ // Let's sleep a second in WINS
+        User::After( 1000000 );
+#endif
+        err = iEikonEnv->FsSession().MountFileSystem( KFSName, KMMCDrive );
+        TRACES( RDebug::Print( _L("CSysApAppUi::MountMMC: RFs::MountFileSystem() returned: %d"), err ) );
+        if ( err == KErrInUse )
+            {
+            User::After( 1000000 );
+            err = iEikonEnv->FsSession().MountFileSystem( KFSName, KMMCDrive );
+            TRACES( RDebug::Print( _L("CSysApAppUi::MountMMC: RFs::MountFileSystem() returned: %d"), err ) );
+            }
+        }
+    return err;
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::DismountMMC()
+// ----------------------------------------------------------------------------
+
+TInt CSysApAppUi::DismountMMC()
+    {
+    TRACES( RDebug::Print( _L("CSysApAppUi::DismountMMC") ) );
+#ifdef __WINS__ // Let's sleep a second in WINS
+        User::After( 1000000 );
+#endif
+
+    TInt err ( KErrNotSupported );
+    if ( iSysApFeatureManager->MmcSupported() )
+        {
+        err = iEikonEnv->FsSession().DismountFileSystem( KFSName, KMMCDrive );
+        TRACES( RDebug::Print( _L("CSysApAppUi::DismountMMC: RFs::DismountFileSystem() returned: %d"), err ) );
+        }
+    return err;
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::EjectMMCL()
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::EjectMMCL()
+    {
+    TRACES( RDebug::Print( _L("CSysApAppUi::EjectMMCL") ) );
+    iMMCEjectUsed = ETrue;
+    iMMCPowerMenuEjectUsed = ETrue;
+    iTimeToKill = EFalse;
+    iApplicationScanningRoundNumber = 0;
+    CloseUIAppsInHotSwapL();
+    }
+
+#else // RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::EjectMMCL()
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::EjectMMCL()
+    {
+    // Called from eject confirm query, check drive inserted before start
+    TInt insertedIndex( CSysApDriveList::Find(
+        iInsertedMemoryCards, iDriveToEject ) );
+
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::EjectMMCL: iMMCEjectUsed: %d, drive: %d, index: %d "),
+        iMMCEjectUsed, iDriveToEject, insertedIndex ) );
+
+    if ( insertedIndex != KErrNotFound )
+        {
+        iSysApDriveList->MarkDriveToEject(
+            iDriveToEject, CSysApDriveList::EEjectFromMenu );
+        iSysApDriveEjectHandler->StartEject();
+        }
+    iMMCEjectUsed = EFalse;
+    }
+
+#endif // RD_MULTIPLE_DRIVE
+
+#ifndef RD_MULTIPLE_DRIVE
+// ----------------------------------------------------------------------------
+// CSysApAppUi::RunUnlockNotifierL()
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::RunUnlockNotifierL( TSysApMemoryCardStatus aMemoryCardStatus )
+    {
+    TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: START") ) );
+    if ( iSysApFeatureManager->MmcSupported() )
+        {
+        if ( UiReady() )
+            {
+            TSysApMemoryCardStatus memoryCardStatus;
+            if ( aMemoryCardStatus == ESysApMemoryCardStatusNotKnown )
+                {
+                memoryCardStatus = iSysApMMCObserver->MemoryCardStatus();
+                }
+            else
+                {
+                memoryCardStatus = aMemoryCardStatus;
+                }
+
+            TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: memoryCardStatus=%d"), memoryCardStatus ) );
+
+            switch ( memoryCardStatus )
+                {
+                case ESysApMemoryCardInserted:
+                    TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL MMC inserted") ) );
+                    if ( aMemoryCardStatus == ESysApMemoryCardInserted )
+                        {
+                        RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
+                        }
+                    break;
+                case ESysApMemoryCardLocked:
+                    {
+                    TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL MMC locked") ) );
+                    RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
+                    TInt callState = StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState );
+
+                    if (  (! ( iDeviceLockEnabled || iKeyLockEnabled ) ) &&
+                          callState != EPSCTsyCallStateRinging && // We don't want to see the MMC passwd query
+                          callState != EPSCTsyCallStateAlerting ) // when the user is e.g. making an emergency call
+                        {
+                        if ( iSysApFeatureManager->MemoryCardLockSupported() )
+                            {
+                            if ( ! iMemoryCardDialog )
+                                {
+                                TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: ACTIVATE MMC passwd query") ) );
+                                CAknMemoryCardDialog* mmcDialog = CAknMemoryCardDialog::NewLC( this );
+                                iMemoryCardDialog = mmcDialog; // temporary variable used for hiding codescanner error 
+                                iMemoryCardDialog->SetSelfPointer( &iMemoryCardDialog );
+                                iMemoryCardDialog->UnlockCardLD(); // when UnlockCardLD completes it calls UnlockComplete()
+                                }
+                            }
+                        else
+                            {
+                            // Since locked cards are not supported, notify user that card is locked.
+                            ShowQueryL( ESysApMemoryCardLockedNote );
+                            }
+                        }
+                    }
+                    break;
+
+                case ESysApMemoryCardNotInserted:
+                default:
+                    TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL MMC not inserted") ) );
+                    if ( aMemoryCardStatus == ESysApMemoryCardNotInserted )
+                        {
+                        RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
+                        }
+                }
+            }
+        }
+    TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: END") ) );
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::UnlockComplete() from MAknMemoryCardDialogObserver
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::UnlockComplete( TInt aResult )
+    {
+    TRACES( RDebug::Print( _L("CSysApAppUi::UnlockComplete result: %d"), aResult ) );
+    if ( aResult == KErrNone )
+        {
+        RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::MMCStatusChangedL() from MSysApMemoryCardObserver
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::MMCStatusChangedL()
+    {
+    TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL START: iMMCInserted: %d, iMMCEjectUsed: %d, iHideFirstBeep: %d, iHideNextBeep: %d" ), iMMCInserted, iMMCEjectUsed, iHideFirstBeep, iHideNextBeep ) );
+
+    if ( iSysApFeatureManager->MmcSupported() && !iShutdownStarted )
+        {
+        TSysApMemoryCardStatus memoryCardStatus = iSysApMMCObserver->MemoryCardStatus();
+        TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL memoryCardStatus=%d" ), memoryCardStatus ) );
+
+        switch ( memoryCardStatus )
+            {
+            case ESysApMemoryCardInserted:
+            case ESysApMemoryCardLocked:
+                TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: MMC drive mounted" ) ) );
+                if ( ! iMMCInserted ) // MMC was not inserted before
+                    {
+                    TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: MMC newly inserted" ) ) );
+                    CancelWaitNote(); // just to be sure, the user might keep on closing and opening the MMC latch
+                    // An MMC has been newly inserted, so play a sound and check if its password protected
+
+                    if ( UiReady() )
+                        {
+                        if ( !iHideFirstBeep && !iHideNextBeep ) // starting up
+                            {
+                            Beep();
+                            // Switch lights on
+                            iSysApLightsController->MemoryCardInsertedL();
+                            }
+                        iHideNextBeep = EFalse;
+                        }
+
+                    iMMCPowerMenuEjectUsed = EFalse;
+                    iMMCEjectUsed = EFalse;
+                    iMMCInserted = ETrue;
+
+                    // No need to show ESysApRemoveMmcNote after MMC already mounted
+                    if ( iSysApConfirmationQuery )
+                        {
+                        if ( iSysApConfirmationQuery->CurrentQuery() == ESysApRemoveMmcNote )
+                            {
+                            iSysApConfirmationQuery->Cancel();
+                            }
+                        }
+
+                    // Check if the MMC is locked and unlock it if necessary
+                    RunUnlockNotifierL( memoryCardStatus );
+                    }
+                break;
+            default:
+                TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: MMC drive not mounted" ) ) );
+                delete iMemoryCardDialog; // sets itself to null
+                RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
+                if ( iMMCInserted )
+                    {
+                    // No need to show ESysApEjectMmcQuery after MMC already removed
+                    if ( iSysApConfirmationQuery )
+                        {
+                        if ( iSysApConfirmationQuery->CurrentQuery() == ESysApEjectMmcQuery )
+                            {
+                            iSysApConfirmationQuery->Cancel();
+                            }
+                        }
+
+                    iMMCInserted = EFalse;
+
+                    TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) );
+                    if ( !iMMCEjectUsed && propertyValue != KUsbPersonalityIdMS )
+                        {
+                        // if USB file transfer active, do not close applications
+                        // if eject selected in MMC App, MMC App takes care of the following and
+                        // if eject selected from powerkeymenu, applications have already been shutdown
+                        iTimeToKill = EFalse;
+                        iApplicationScanningRoundNumber = 0;
+                        CloseUIAppsInHotSwapL();
+                        }
+                    }
+                else
+                    {
+                    // If MMC was not previously inserted and eject was chosed from power key menu, attempt to remount.
+                    if ( iMMCPowerMenuEjectUsed )
+                        {
+                        TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: Attempt to remount" ) ) );
+                        MountMMC();
+                        // If mount was successful, unnecessary note will be canceled in insert notification handling.
+                        }
+                    }
+                break;
+            }
+
+        // Update memory card indicator status
+        SetMemoryCardIndicatorL();
+        }
+    TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL   END: iMMCInserted: %d, iMMCEjectUsed: %d, iHideFirstBeep: %d, iHideNextBeep: %d" ), iMMCInserted, iMMCEjectUsed, iHideFirstBeep, iHideNextBeep ) );
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::ShowMMCDismountedDialogL()
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::ShowMMCDismountedDialogL()
+    {
+    TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) );
+
+    // Do not show any note if USB file transfer is active.
+    if ( propertyValue != KUsbPersonalityIdMS )
+        {
+        if ( iSysApFeatureManager->MemoryCardHatchSupported() )
+            { // MMC hatch has been opened and MMC has been dismounted
+            TRACES( RDebug::Print( _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: Remove MMC and press OK." ) ) );
+            ShowQueryL( ESysApRemoveMmcNote );
+            }
+        else
+            {
+            // MMC has been removed and dismounted
+            TRACES( RDebug::Print( _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: You might have lost some data." ) ) );
+            // No confirmation but let's set this true to enable MMC passwd query
+            ShowUiNoteL( EMemoryCardRemovedWithoutEjectNote );
+            }
+        }
+    else
+        {
+        TRACES( RDebug::Print( _L( "CSysApAppUi::ShowMMCDismountedDialogL: No note shown, USB file transfer caused dismount." ) ) );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::MMCDismountedDialogConfirmed
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::MMCDismountedDialogConfirmed()
+    {
+    TRACES( RDebug::Print( _L( "CSysApAppUi::MMCDismountedDialogConfirmed") ) );
+
+    // Try to remount just in case when eject was chosen from power key menu
+    if ( iMMCPowerMenuEjectUsed )
+        {
+        iMMCPowerMenuEjectUsed = EFalse;
+
+        if ( MountMMC() == KErrLocked ) // In case a locked card was not removed after all
+            {
+            TRAPD( err, MMCStatusChangedL() ); // This will update power menu and memory card icon. Also memory card password is requeried.
+            if ( err != KErrNone )
+                {
+                TRACES( RDebug::Print( _L( "CSysApAppUi::MMCDismountedDialogConfirmed: MMCStatusChangedL failed, err=%d"), err ) );
+                }
+            }
+        }
+
+    }
+
+#else // RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::MMCInsertedL
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::MMCInsertedL()
+    {
+    TRACES( RDebug::Print( _L( "CSysApAppUi::MMCInsertedL") ) );
+
+    if ( iSysApFeatureManager->MmcSupported() && !iShutdownStarted )
+        {
+        TBool normalState( UiReady() );
+
+        if ( normalState )
+            {
+            TInt defaultMemoryCard( iSysApDriveList->DefaultMemoryCard() );
+            TSysApMemoryCardStatus memoryCardStatus( iSysApDriveList->MemoryCardStatus( defaultMemoryCard ) );
+
+            TRACES( RDebug::Print(
+                _L( "CSysApAppUi::MMCInsertedL: drive: %d, memoryCardStatus: %d" ), defaultMemoryCard, memoryCardStatus ) );
+
+            switch ( memoryCardStatus )
+                {
+                case ESysApMemoryCardInserted: // Fall through
+                case ESysApMemoryCardLocked:
+                    {
+                    // Reset eject and unlock of inserted memory card
+                    iSysApDriveList->ResetDriveToEject( defaultMemoryCard );
+                    iSysApDriveList->ResetDriveUnlockQueryShown( defaultMemoryCard );
+
+//                    CancelWaitNote();
+
+                    if ( memoryCardStatus == ESysApMemoryCardInserted )
+                        {
+                        TRACES( RDebug::Print(
+                            _L( "CSysApAppUi::MMCInsertedL: memoryCardStatus ESysApMemoryCardInserted: %d" ), memoryCardStatus ) );
+                        RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
+                        }
+                    else
+                        {
+                        TRACES( RDebug::Print(
+                            _L( "CSysApAppUi::MMCInsertedL: memoryCardStatus ESysApMemoryCardLocked: %d" ), memoryCardStatus ) );
+                        RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
+                        }
+                    break;
+                    }
+                case ESysApMemoryCardNotInserted:
+                    {
+                    // Always reset eject and unlock of removed memory card
+                    TBool isEject( iSysApDriveList->IsDriveToEject( defaultMemoryCard ) );
+
+                    TRACES( RDebug::Print(
+                        _L( "CSysApAppUi::MMCInsertedL: isEject: %d, drive: %d" ),
+                        isEject, defaultMemoryCard ) );
+
+                    iSysApDriveList->ResetDriveToEject( defaultMemoryCard );
+                    iSysApDriveList->ResetDriveUnlockQueryShown( defaultMemoryCard );
+
+                    TRACES( RDebug::Print(
+                        _L( "SysApAppUi::MMCInsertedL: memoryCardStatus ESysApMemoryCardNotInserted: %d" ), memoryCardStatus ) );
+
+                    RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
+                    break;
+                    }
+                case ESysApMemoryCardStatusNotKnown: // Fall through
+                default:
+                    {
+                    break;
+                    }
+                }
+                RunUnlockNotifierL();
+            }
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::RunUnlockNotifierL()
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::RunUnlockNotifierL()
+    {
+    TRACES( RDebug::Print(
+        _L("CSysApAppUi::RunUnlockNotifierL: START iDeviceLockEnabled: %d, iKeyLockEnabled: %d" ),
+         iDeviceLockEnabled, iKeyLockEnabled ) );
+
+    if ( !iSysApFeatureManager->MmcSupported() ||
+         iDeviceLockEnabled ||
+         iKeyLockEnabled ||
+         !UiReady() )
+        {
+        TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: END") ) );
+        return;
+        }
+
+    // We don't want to see the MMC passwd query
+    // when the user is e.g. making an emergency call
+    TInt callState( StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) );
+    if ( callState != EPSCTsyCallStateRinging &&
+        callState != EPSCTsyCallStateAlerting )
+        {
+        TInt defaultMemoryCard( iSysApDriveList->DefaultMemoryCard() );
+        TSysApMemoryCardStatus memoryCardStatus( iSysApDriveList->MemoryCardStatus( defaultMemoryCard ) );
+        if ( memoryCardStatus == ESysApMemoryCardLocked)
+            {
+            iSysApDriveUnlockHandler->StartUnlock();
+            }
+        }
+
+    TRACES( RDebug::Print(
+        _L("CSysApAppUi::RunUnlockNotifierL: END callState: %d"), callState ) );
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::MMCStatusChangedL() from MSysApMemoryCardObserver
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::MMCStatusChangedL( TInt aDrive )
+    {
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::MMCStatusChangedL START: MMCCount: %d, iMMCEjectUsed: %d" ),
+        iInsertedMemoryCards.Count(), iMMCEjectUsed ) );
+
+    if ( iShutdownStarted || !iSysApFeatureManager->MmcSupported() )
+        {
+        TRACES( RDebug::Print(
+            _L( "CSysApAppUi::MMCStatusChangedL iShutdownStarted: %d END" ),
+            iShutdownStarted ) );
+        return;
+        }
+
+    TBool normalState( UiReady() );
+
+    TInt defaultMemoryCard( iSysApDriveList->DefaultMemoryCard() );
+    TSysApMemoryCardStatus memoryCardStatus( iSysApDriveList->MemoryCardStatus( aDrive ) );
+    TInt insertedIndex( CSysApDriveList::Find( iInsertedMemoryCards, aDrive ) );
+
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::MMCStatusChangedL: normalState: %d, index: %d, drive: %d, memoryCardStatus: %d" ),
+        normalState, insertedIndex, aDrive, memoryCardStatus ) );
+
+    switch ( memoryCardStatus )
+        {
+        case ESysApMemoryCardInserted: // Fall through
+        case ESysApMemoryCardLocked:
+            {
+            if ( insertedIndex == KErrNotFound ) // Not inserted before
+                {
+                // Reset eject and unlock of inserted memory card
+                iSysApDriveList->ResetDriveToEject( aDrive );
+                iSysApDriveList->ResetDriveUnlockQueryShown( aDrive );
+
+//                CancelWaitNote();
+
+                if ( aDrive == defaultMemoryCard )
+                    {
+                    if ( memoryCardStatus == ESysApMemoryCardInserted )
+                        {
+                         RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
+                        }
+                    else
+                        {
+                        RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
+                        }
+                    }
+
+                if ( normalState )
+                    {
+                    // Ignore extra beep from USB file transfer
+                    TBool ignoreBeep(
+                        iSysApDriveList->IsDriveInsertBeepIgnored( aDrive ) );
+
+                    TRACES( RDebug::Print(
+                        _L( "CSysApAppUi::MMCStatusChangedL: ignoreBeep: %d, drive: %d" ),
+                        ignoreBeep, aDrive ) );
+
+                    if ( !ignoreBeep )
+                        {
+//                        Beep();
+                        iSysApLightsController->MemoryCardInsertedL();
+                        }
+
+                    iSysApDriveList->ResetDriveInsertBeepIgnored( aDrive );
+
+                    // Keep ignoring extra beep if USB file transfer is active
+                    TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) );
+
+                    TRACES( RDebug::Print(
+                        _L( "CSysApAppUi::MMCStatusChangedL: usbState: %d" ), propertyValue ) );
+
+                    if ( propertyValue == KUsbPersonalityIdMS )
+                        {
+                        iSysApDriveList->MarkDriveInsertBeepIgnored( aDrive );
+                        }
+                    }
+
+//                if ( iDriveToDismount == aDrive && iSysApConfirmationQuery )
+                    {
+//                    if ( iSysApConfirmationQuery->CurrentQuery() == ESysApRemoveMmcNote )
+                        {
+                        // User put back ejected memory card or did not remove it
+//                        iSysApConfirmationQuery->Cancel();
+                        }
+                    }
+                RunUnlockNotifierL();
+                }
+            break;
+            }
+        case ESysApMemoryCardNotInserted:
+            {
+            // Always reset eject and unlock of removed memory card
+            TBool isEject( iSysApDriveList->IsDriveToEject( aDrive ) );
+
+            TRACES( RDebug::Print(
+                _L( "CSysApAppUi::MMCStatusChangedL: isEject: %d, drive: %d" ),
+                isEject, aDrive ) );
+
+            iSysApDriveList->ResetDriveToEject( aDrive );
+            iSysApDriveList->ResetDriveUnlockQueryShown( aDrive );
+
+            if ( insertedIndex != KErrNotFound ) // Inserted before
+                {
+                if ( memoryCardStatus == ESysApMemoryCardNotInserted )
+                    {
+                    // Reset extra beep ignore if memory card was removed without eject
+                    iSysApDriveList->ResetDriveInsertBeepIgnored( aDrive );
+                    }
+
+//                CancelGlobalListQuery(); // Cancel power menu
+
+                if ( aDrive == defaultMemoryCard )
+                    {
+                    RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
+                    }
+
+//                if ( iSysApConfirmationQuery )
+                    {
+//                    if ( iSysApConfirmationQuery->CurrentQuery() == ESysApEjectMmcQuery )
+                        {
+                        // User removed memory card too early
+//                        iSysApConfirmationQuery->Cancel();
+                        // Allow application closing to execute.
+                        // Also FileManager is closed in this case, regardless where the eject was initiated from.
+                        iMMCEjectUsed = EFalse;
+                        }
+                    }
+
+                // Stop unlock of removed memory card
+                iSysApDriveUnlockHandler->StopUnlock( aDrive );
+
+                if ( !iMMCEjectUsed && !isEject )
+                    {
+                    TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) );
+
+                    TRACES( RDebug::Print(
+                        _L( "CSysApAppUi::MMCStatusChangedL: usbState: %d" ), propertyValue ) );
+
+                    if ( propertyValue != KUsbPersonalityIdMS )
+                        {
+                        if ( iSysApFeatureManager->MemoryCardHatchSupported() )
+                            {
+                            // Store drive removed without eject and start eject handling
+                            iSysApDriveList->MarkDriveToEject(
+                                aDrive, CSysApDriveList::EEjectRemovedWithoutEject );
+                            iSysApDriveEjectHandler->StartEject();
+                            }
+                        else
+                            {
+                            // Just show the note
+                            ShowUiNoteL( EMemoryCardRemovedWithoutEjectNote );
+                            }
+                        }
+                    }
+                iMMCEjectUsed = EFalse;
+                }
+            break;
+            }
+        case ESysApMemoryCardStatusNotKnown: // Fall through
+        default:
+            {
+            break;
+            }
+        }
+
+    // Update inserted memory cards
+    iSysApDriveList->GetMemoryCardsL(
+        iInsertedMemoryCards, CSysApDriveList::EIncludeInserted );
+
+    // Update memory card indicator status
+//    SetMemoryCardIndicatorL();
+
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::MMCStatusChangedL END: MMCCount: %d, iMMCEjectUsed: %d" ),
+        iInsertedMemoryCards.Count(), iMMCEjectUsed ) );
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::ShowMMCDismountedDialogL()
+// ----------------------------------------------------------------------------
+
+TBool CSysApAppUi::ShowMMCDismountedDialogL(
+        TInt aDrive, CSysApDriveList::TDriveEjectType aEjectType )
+    {
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::ShowMMCDismountedDialogL: aDrive: %d, aEjectType: %d" ),
+        aDrive, aEjectType ) );
+
+    TBool ret( EFalse );
+    iDriveToDismount = aDrive;
+    HBufC* driveName = iSysApDriveList->GetFormattedDriveNameLC(
+        aDrive,
+        R_QTN_EJECT_REMOVE_MEMORY_INFO );
+
+    if ( aEjectType == CSysApDriveList::EEjectFromMenu )
+        {
+        TRACES( RDebug::Print(
+            _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: Remove MMC and press OK...." ) ) );
+        ShowQueryL( ESysApRemoveMmcNote, *driveName );
+        ret = ETrue;
+        }
+    else
+        {
+        // Memory card was removed without eject
+        TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) );
+
+        // Do not show any note if USB file transfer is active.
+        if ( propertyValue != KUsbPersonalityIdMS )
+            {
+            if ( iSysApFeatureManager->MemoryCardHatchSupported() )
+                {
+                // MMC hatch has been opened and MMC has been dismounted
+                TRACES( RDebug::Print(
+                    _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: Remove MMC and press OK." ) ) );
+                ShowQueryL( ESysApRemoveMmcNote, *driveName );
+                ret = ETrue;
+                }
+            else
+                {
+                iSysApDriveList->ResetDrivesToEject();
+
+                // MMC has been removed and dismounted
+                TRACES( RDebug::Print( _L(
+                    "CSysApAppUi::ShowMMCDismountedDialogL: Show note: You might have lost some data." ) ) );
+
+                // No confirmation but let's set this true to enable MMC passwd query
+                ShowUiNoteL( EMemoryCardRemovedWithoutEjectNote );
+                }
+            }
+        else
+            {
+            iSysApDriveList->ResetDrivesToEject();
+            TRACES( RDebug::Print(
+                _L( "CSysApAppUi::ShowMMCDismountedDialogL: No note shown, USB file transfer caused dismount." ) ) );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( driveName );
+
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::ShowMMCDismountedDialogL: ret: %d" ), ret ) );
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CSysApAppUi::MMCDismountedDialogConfirmed
+// ----------------------------------------------------------------------------
+
+void CSysApAppUi::MMCDismountedDialogConfirmed()
+    {
+    TRACES( RDebug::Print(
+        _L( "CSysApAppUi::MMCDismountedDialogConfirmed: iDriveToDismount: %d" ),
+        iDriveToDismount ) );
+
+    // Try remount to check if drive was put back
+    iSysApDriveList->MountDrive( iDriveToDismount );
+    if ( !iSysApDriveEjectHandler->CompleteDismount( iDriveToDismount ) )
+        {
+        // When ready, check for locked memory cards and update indicators
+ //       TRAP_IGNORE( SetMemoryCardIndicatorL() );
+        TRAP_IGNORE( RunUnlockNotifierL() );
+        }
+    }
+
+#endif // RD_MULTIPLE_DRIVE
 
 
 // ----------------------------------------------------------------------------
@@ -3047,7 +3959,7 @@
                     {
                     if ( StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) !=  EPSCTsyCallStateRinging && StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) !=  EPSCTsyCallStateAlerting )
                         {
-                        //RunUnlockNotifierL();
+                        RunUnlockNotifierL();
                         }
                     }
                 }
--- a/coreapplicationuis/SysAp/Src/SysApPubSubObserver.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/SysApPubSubObserver.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -52,7 +52,7 @@
 const TUint KCoreAppUIsMmcRemovedWithoutEjectCmdMask = 0xFFFF;
 const TUint KCoreAppUIsMmcRemovedWithoutEjectValShift = 16;
 
-_LIT(KGpsIndicatorPlugin, "PositioningIndicator");
+_LIT(KGpsIndicatorPlugin, "com.nokia.positioning.indicatorplugin/1.0");
 const TUid KPSUidSecurityUIs = { 0x100059b5 };
 const TUint32 KSecurityUIsLights  = 0x00000308;
 
@@ -410,16 +410,16 @@
             TUint cmd( aValue & KCoreAppUIsMmcRemovedWithoutEjectCmdMask );
             if ( cmd == ECoreAppUIsEjectCommandUsed )
                 {
- //               iSysApAppUi.EjectStarted( ETrue );
+                iSysApAppUi.EjectStarted( ETrue );
                 }
             else if ( cmd == ECoreAppUIsEjectCommandNotUsed )
                 {
- //               iSysApAppUi.EjectStarted( EFalse );
+                iSysApAppUi.EjectStarted( EFalse );
                 }
             else if ( cmd == ECoreAppUIsEjectCommandUsedToDrive )
                 {
                 TInt drive( aValue >> KCoreAppUIsMmcRemovedWithoutEjectValShift );
- //               iSysApAppUi.EjectUsed( drive );
+                iSysApAppUi.EjectUsed( drive );
                 }
             break;
             }
@@ -520,6 +520,26 @@
                     RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogOff );
                     }
                 }
+            else if(aValue == ECoreAppUIsMemoryCardCustomDialogOk)
+                {
+                TRACES( RDebug::Print(_L("CSysApAppUi::ECoreAppUIsMemoryCardCustomDialogOk") ) );
+                TBool memoryCardStatus = EFalse;
+                memoryCardStatus = iSysApAppUi.NotifiedDialogIfRequiredAndReleaseMemory();
+                if(memoryCardStatus)
+                    {
+                    TRACES( RDebug::Print(_L("CSysApAppUi::ECoreAppUIsMemoryCardCustomDialogOn: memoryCardStatus Begin") ) );                                       
+                    RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogOff );
+                    TRACES( RDebug::Print(_L("CSysApAppUi::ECoreAppUIsMemoryCardCustomDialogOn: memoryCardStatus end") ) );
+                    }
+                TRACES( RDebug::Print(_L("CSysApAppUi::ECoreAppUIsMemoryCardCustomDialogOn: memoryCardStatus final end") ) );
+                                    
+                }
+            else if(aValue == ECoreAppUIsMemoryCardCustomDialogCancel)
+                {
+                TRACES( RDebug::Print(_L("CSysApAppUi::ECoreAppUIsMemoryCardCustomDialogCancel") ) );
+                iSysApAppUi.ReleaseMemoryForMemoryCardDialog();
+                RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogOff );
+                }
             else if ( aValue == ECoreAppUIsPowerMenuCustomDialogOff || aValue == ECoreAppUIsPowerMenuCustomDialogUninitialized )
                 {
                    // do nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/SysAp/Src/hbdeviceinputdialogsymbian.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (developer.feedback@nokia.com)
+**
+** This file is part of the HbWidgets module of the UI Extensions for Mobile.
+**
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at developer.feedback@nokia.com.
+**
+****************************************************************************/
+
+#include "hbdeviceinputdialogsymbian.h"
+
+#include <hbsymbianvariant.h>
+#include <hbdevicedialogsymbian.h>
+#include <coreapplicationuisdomainpskeys.h>
+
+#define ARG_UNUSED(x) (void)x;
+
+//_LIT(KDialogText, "text");
+
+enum TInputDialogPanic {
+    ELineEditPanic,
+    EPropertyPanic,
+    EButtonIdPanic
+};
+
+NONSHARABLE_CLASS(CHbDeviceInputDialogPrivate)  : public CBase, public MHbDeviceDialogObserver
+{
+public:
+
+    void ConstructL(MHbDeviceInputDialogObserver *aObserver);
+    ~CHbDeviceInputDialogPrivate();
+    
+    void SetButtonNull(CHbDeviceInputDialogSymbian::TButtonId aButtonId, bool aValue);
+    void SetButtonTextL(CHbDeviceInputDialogSymbian::TButtonId aButtonId, const TDesC &aValue);
+    void SendToServerL(bool aShow = false);
+    void Close();
+    bool WaitForClosed();
+    void AddVariantL(const TDesC& aKey, const TAny* aData,CHbSymbianVariant::TType aDataType, CHbSymbianVariantMap* map);
+
+public: // MHbDeviceDialogObserver
+    void DataReceived(CHbSymbianVariantMap& aData);
+    void DeviceDialogClosed(TInt aCompletionCode);
+
+public: // data
+
+    CHbDeviceInputDialogSymbian *q;
+    CHbDeviceDialogSymbian *mDeviceDialog;
+    bool mShowCalled;
+    CHbDeviceInputDialogSymbian::TButtonId mReceivedButton;
+    MHbDeviceInputDialogObserver *mObserver;
+    CHbSymbianVariantMap* iVariantMap;
+    
+    bool *mDeleted;
+    CActiveSchedulerWait mActiveSchedulerWait;
+};
+
+
+void CHbDeviceInputDialogPrivate::ConstructL(MHbDeviceInputDialogObserver *aObserver)
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::ConstructL::Begin") ) );
+    mDeviceDialog = CHbDeviceDialogSymbian::NewL();
+    iVariantMap = CHbSymbianVariantMap::NewL();
+    
+    
+
+    mReceivedButton = CHbDeviceInputDialogSymbian::ERejectButton;
+    mObserver = aObserver;
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::ConstructL::End") ) );
+}
+
+// Destructor
+CHbDeviceInputDialogPrivate::~CHbDeviceInputDialogPrivate()
+{
+    // If no observer, remove observer from device dialog. This leaves the
+    // dialog widget executing at server when client closes connection.
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::Destructor::Begin") ) );
+    if (!mObserver) {
+        mDeviceDialog->SetObserver(0);
+    }
+    
+    delete mDeviceDialog;
+    delete iVariantMap;
+
+    // Set object deleted flag
+    if (mDeleted) {
+        // Mark the object as deleted.
+        *mDeleted = true;
+        mDeleted = 0;
+    }
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::Destructor::End") ) );
+}
+
+void CHbDeviceInputDialogPrivate::AddVariantL(const TDesC& aKey,const TAny* aData,CHbSymbianVariant::TType aDataType,CHbSymbianVariantMap* map )
+    {
+    CHbSymbianVariant *variant = CHbSymbianVariant::NewL(aData, aDataType);
+    CleanupStack::PushL(variant);
+    User::LeaveIfError(map->Add(aKey, variant));
+    CleanupStack::Pop(variant);
+    }
+
+// Send properties to server. Show or update.
+void CHbDeviceInputDialogPrivate::SendToServerL(bool /* aShow */)
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::SendToServerL::Begin") ) );
+    _LIT(KDeviceDialogType, "com.nokia.hb.deviceinputdialog/1.0");
+    TInt error;
+    mReceivedButton = CHbDeviceInputDialogSymbian::ERejectButton;
+    error = mDeviceDialog->Show(KDeviceDialogType, *iVariantMap, this);
+    User::LeaveIfError(error);
+    mShowCalled = true;
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::SendToServerL::End") ) );
+}
+
+
+// Close input dialog
+void CHbDeviceInputDialogPrivate::Close()
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::Close::Begin") ) );
+    mDeviceDialog->Cancel();
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::Close::End") ) );
+}
+
+// Wait for input dialog to close
+bool CHbDeviceInputDialogPrivate::WaitForClosed()
+{
+    // Returns true if object was not deleted during wait
+    if (!mShowCalled) {
+        return true;
+    }
+    return true;
+}
+
+// Observer, data received from device input dialog
+void CHbDeviceInputDialogPrivate::DataReceived(CHbSymbianVariantMap& aData)
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::DataReceived::Begin") ) );
+    mReceivedButton = CHbDeviceInputDialogSymbian::ERejectButton;
+    _LIT(KKeyOk, "ok");
+    _LIT(KKeyCancel, "cancel");
+    const CHbSymbianVariant* variantOk = aData.Get(KKeyOk);
+    const CHbSymbianVariant* variantCancel = aData.Get(KKeyCancel);
+    if (variantOk) 
+    {
+        const TDesC *value = variantOk->Value<const TDesC>();
+        q->iPassword = *value;
+        mReceivedButton = CHbDeviceInputDialogSymbian::EAcceptButton;
+        RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsMemoryCardCustomDialogOk );
+    }
+    else if(variantCancel)
+    {
+      const TDesC *value = variantCancel->Value<const TDesC>();
+    q->iPassword = *value;
+    mReceivedButton = CHbDeviceInputDialogSymbian::EAcceptButton;
+    RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsMemoryCardCustomDialogCancel);
+    }
+    	    	
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::DataReceived::End") ) );
+}
+
+// Observer, device input dialog closed
+void CHbDeviceInputDialogPrivate::DeviceDialogClosed(TInt aCompletionCode)
+{
+    ARG_UNUSED(aCompletionCode)
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::DeviceDialogClosed::Begin") ) );
+
+    mShowCalled = false;
+    
+        
+    if (mObserver) {
+        mObserver->InputDialogClosed(q, mReceivedButton);
+            return; // observer callback deleted this object. Do not touch it anymore.
+    }
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogPrivate::DeviceDialogClosed::End") ) );
+}
+
+// Constructor
+CHbDeviceInputDialogSymbian::CHbDeviceInputDialogSymbian()
+{
+}
+
+// Destructor
+CHbDeviceInputDialogSymbian::~CHbDeviceInputDialogSymbian()
+{
+    delete d;
+}
+
+CHbDeviceInputDialogSymbian* CHbDeviceInputDialogSymbian::NewL(MHbDeviceInputDialogObserver *aObserver)
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogSymbian::NewL::Begin") ) );
+    ARG_UNUSED(aObserver)
+    CHbDeviceInputDialogSymbian *inputDialog = new (ELeave) CHbDeviceInputDialogSymbian;
+    CleanupStack::PushL(inputDialog);
+    CHbDeviceInputDialogPrivate *idialogPrivate = new (ELeave) CHbDeviceInputDialogPrivate;
+    idialogPrivate->q = inputDialog;
+    CleanupStack::PushL(idialogPrivate);
+    idialogPrivate->ConstructL( aObserver);
+    inputDialog->d = idialogPrivate;
+    CleanupStack::Pop(2); // inputDialog, idialogPrivate
+    inputDialog->SetObserver(aObserver);
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogSymbian::NewL::End") ) );
+    return inputDialog;
+}
+
+
+void CHbDeviceInputDialogSymbian::ShowL()
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogSymbian::ShowL::Begin") ) );
+    d->SendToServerL(true);
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogSymbian::ShowL::End") ) );
+}
+
+
+TPtrC CHbDeviceInputDialogSymbian::getTextL()
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogSymbian::getTextL::Begin") ) );
+    TRACES( RDebug::Print(_L( "CHbDeviceInputDialogSymbian::getTextL::Begin %S" ),&iPassword));
+    HBufC* sample1 = HBufC::NewLC(iPassword.Length());
+    TPtrC aStringPointer = sample1->Des();
+    aStringPointer.Set(iPassword);
+    CleanupStack::PopAndDestroy();       
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogSymbian::getTextL::End") ) );
+    return aStringPointer;
+}
+
+void CHbDeviceInputDialogSymbian::Close()
+{
+    TRACES( RDebug::Print( _L("CHbDeviceInputDialogSymbian::Close::Begin") ) );
+    d->Close();
+}
+
+void CHbDeviceInputDialogSymbian::SetObserver(MHbDeviceInputDialogObserver *aObserver)
+{
+    d->mObserver = aObserver;
+}
--- a/coreapplicationuis/SysAp/Src/memorycard/sysapdriveejecthandler.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/memorycard/sysapdriveejecthandler.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -163,7 +163,6 @@
             aError ) );
         }
     // Ensure that the wait note without softkeys gets closed
-    iSysApAppUi.CancelWaitNote();
     iSysApDriveList.ResetDrivesToEject();
 	iDriveToEject = KErrNotFound;
     iDiskNotifyHandler->CancelStartedDismount();
@@ -185,7 +184,6 @@
         aError, aEvent.iDrive, aEvent.iForcedDismount ) );
 
     iDriveToEject = KErrNotFound;
-    iSysApAppUi.CancelWaitNote();
 
     // Show dismount ready note
     TBool dialogShown( EFalse );
--- a/coreapplicationuis/SysAp/Src/memorycard/sysapdrivelist.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/memorycard/sysapdrivelist.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -55,6 +55,8 @@
     {
     // Get the default memory card. If memory card is unavailable,
     // then get the next best suitable drive.
+    iDefaultMemoryCard = 0;
+    
     TInt err( DriveInfo::GetDefaultDrive(
         DriveInfo::EDefaultRemovableMassStorage, iDefaultMemoryCard ) );
     if ( err != KErrNone )
--- a/coreapplicationuis/SysAp/Src/memorycard/sysapdriveunlockhandler.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/memorycard/sysapdriveunlockhandler.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -53,7 +53,8 @@
         const TBool aMemoryCardLockSupported ) :
     iSysApDriveList( aSysApDriveList ),
     iSysApAppUi( aSysApAppUi ),
-    iMemoryCardLockSupported( aMemoryCardLockSupported )
+    iMemoryCardLockSupported( aMemoryCardLockSupported ),
+    iMemCardPwdDialog(NULL)
     {
     }
 
@@ -67,8 +68,12 @@
         _L( "CSysApDriveUnlockHandler::~CSysApDriveUnlockHandler" ) ) );
 
     iIgnoreQueryResult = ETrue;
-    delete iQueryShowCB;
-    delete iMemoryCardDialog;
+    if (iMemCardPwdDialog!=NULL)
+        {
+        //MemoryCardDialog already exist
+        delete iMemCardPwdDialog;
+        iMemCardPwdDialog = NULL;
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -77,16 +82,6 @@
 //
 void CSysApDriveUnlockHandler::StartUnlock()
     {
-    TBool isOngoing( IsQueryOngoing() );
-
-    TRACES( RDebug::Print(
-        _L( "CSysApMCSysApMMCUnlockObserver::StartUnlock: ongoing: %d" ),
-        isOngoing ) );
-
-    if ( isOngoing )
-        {
-        return;
-        }
     TRAPD( err, DoStartQueryIfNeededL() );
     if ( err != KErrNone )
         {
@@ -150,7 +145,6 @@
 
     // Mark handled and start next query
     iSysApDriveList.MarkDriveUnlockQueryShown( iDriveToUnlock );
-    DoStartQueryAsyncIfNeeded();
     }
 
 // ---------------------------------------------------------------------------
@@ -175,19 +169,23 @@
 //
 void CSysApDriveUnlockHandler::ShowUnlockQueryL()
     {
+    iDriveToUnlock = iSysApDriveList.DriveToUnlock();
     TRACES( RDebug::Print(
         _L( "CSysApMCSysApMMCUnlockObserver::ShowUnlockQueryL: drive: %d" ),
         iDriveToUnlock ) );
 
-    if ( !iMemoryCardDialog )
+    if (iMemCardPwdDialog!=NULL)
         {
-        CAknMemoryCardDialog* mmcDialog = CAknMemoryCardDialog::NewLC( this );
-        iMemoryCardDialog = mmcDialog; // temporary variable used for hiding codescanner error 
-        iMemoryCardDialog->SetSelfPointer( &iMemoryCardDialog );
-        TDriveNumber drive( static_cast< TDriveNumber >( iDriveToUnlock ) );
-        iMemoryCardDialog->UnlockCardLD( drive, ETrue );
-        }
-    }
+        //PowerMenu already exist
+        delete iMemCardPwdDialog;
+        iMemCardPwdDialog = NULL;
+        } 
+    TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, JEELani 01") ) );
+    iMemCardPwdDialog = CHbDeviceInputDialogSymbian::NewL();
+    TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, JEELani 02") ) );
+    iMemCardPwdDialog->ShowL();
+    TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, JEELani 03") ) );    
+}
 
 // ---------------------------------------------------------------------------
 // CSysApDriveUnlockHandler::IsQueryOngoing
@@ -195,7 +193,7 @@
 //
 TBool CSysApDriveUnlockHandler::IsQueryOngoing() const
     {
-    return ( iMemoryCardDialog || iQueryShowCB );
+    return 0; 
     }
 
 // ---------------------------------------------------------------------------
@@ -205,10 +203,19 @@
 void CSysApDriveUnlockHandler::DoStartQueryIfNeededL()
     {
     iDriveToUnlock = iSysApDriveList.DriveToUnlock();
+
     if ( iDriveToUnlock == KErrNotFound )
         {
+        _LIT(KChargingNote,"Phone does not found drive to unlock");
+        HBufC* aString = HBufC16::NewLC(150);
+        TPtrC aStringPointer = aString->Des();
+        aStringPointer.Set(KChargingNote);
+        TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
+        iSysApAppUi.ShowExampleUiNoteL( aStringPointer );
+        CleanupStack::PopAndDestroy(); // aString         
         return;
         }
+
     if ( iMemoryCardLockSupported )
         {
         ShowUnlockQueryL();
@@ -216,6 +223,13 @@
     else
         {
         iSysApAppUi.ShowQueryL( ESysApMemoryCardLockedNote );
+        _LIT(KChargingNote,"Phone does not support locked memory cards");
+        HBufC* aString = HBufC16::NewLC(150);
+        TPtrC aStringPointer = aString->Des();
+        aStringPointer.Set(KChargingNote);
+        TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
+        iSysApAppUi.ShowExampleUiNoteL( aStringPointer );
+        CleanupStack::PopAndDestroy(); // aString    
         iSysApDriveList.MarkDriveUnlockQueryShown( iDriveToUnlock );
         }
     }
@@ -232,18 +246,6 @@
         DoStopUnlock( KErrNone );
         return;
         }
-    delete iQueryShowCB;
-    iQueryShowCB = NULL;
-    iQueryShowCB = new CAsyncCallBack(
-        TCallBack( QueryShowCB, this ), CActive::EPriorityStandard );
-    if ( iQueryShowCB )
-        {
-        iQueryShowCB->CallBack();
-        }
-    else
-        {
-        DoStopUnlock( KErrNoMemory );
-        }
     }
 
 // ---------------------------------------------------------------------------
@@ -258,12 +260,117 @@
             _L( "CSysApMCSysApMMCUnlockObserver::DoStopUnlock: error: %d" ),
             aError ) );
         }
+    ReleaseMemoryForInputCardDialog();
     iIgnoreQueryResult = ETrue;
-    delete iMemoryCardDialog;
-    iMemoryCardDialog = NULL;
-    delete iQueryShowCB;
-    iQueryShowCB = NULL;
     iIgnoreQueryResult = EFalse;
     }
 
+void CSysApDriveUnlockHandler::ReleaseMemoryForInputCardDialog()
+    {
+    if (iMemCardPwdDialog!=NULL)
+        {
+        //MemoryCardDialog already exist
+        delete iMemCardPwdDialog;
+        iMemCardPwdDialog = NULL;
+        }
+    }
+
+TInt CSysApDriveUnlockHandler::CheckMemoryDialogIfNeeded()
+  {
+    TRACES( RDebug::Print(_L( "CSysApDriveUnlockHandler::CheckMemoryDialogIfNeeded(): Begin" )));
+    TDriveNumber drive( static_cast< TDriveNumber >( iDriveToUnlock ) );
+    TRACES( RDebug::Print(_L( "CSysApDriveUnlockHandler::CheckMemoryDialogIfNeeded()" )));
+    TPtrC aStringPointer11 = iMemCardPwdDialog->getTextL();           
+    ConvertCharactersToPwd(aStringPointer11,iPassword);
+    
+    if(!aStringPointer11.Length())
+        {
+        return EFalse;  // It meant user has pressed OK without password
+        }
+
+    TRACES( RDebug::Print(_L( "CSysApMCSysApMMCUnlockObserver::RunL; iPassword %S" ),&iPassword));              
+    CEikonEnv* eikEnv = CEikonEnv:: Static();
+    TInt err = eikEnv->FsSession().UnlockDrive(drive,iPassword,ETrue);
+    ReleaseMemoryForInputCardDialog();
+    
+    if ( err == KErrNone)
+        {
+        TRACES( RDebug::Print(_L( "CSysApAppUi::ReleaseMemoryCardCustomDialogMemory(), Drive Unlocked Succesfully" )));
+        _LIT(KUnlockNote,"The memory is unlocked!");
+        HBufC* aString = HBufC16::NewLC(150);
+        TPtrC aStringPointer = aString->Des();
+        aStringPointer.Set(KUnlockNote);   
+        iSysApAppUi.ShowExampleUiNoteL( aStringPointer );
+        CleanupStack::PopAndDestroy(); // aString
+        return ETrue;
+        }
+    else if( err == KErrAccessDenied ) 
+        {
+        TRACES( RDebug::Print(_L( "CSysApAppUi::ReleaseMemoryCardCustomDialogMemory(), Password InCorrect" )));
+        _LIT(KUnlockDeniedNote,"The password is incorrect, try again!");
+        HBufC* aString = HBufC16::NewLC(150);
+        TPtrC aStringPointer = aString->Des();
+        aStringPointer.Set(KUnlockDeniedNote);   
+        iSysApAppUi.ShowExampleUiNoteL( aStringPointer );
+        CleanupStack::PopAndDestroy(); // aString
+        return EFalse;
+        }
+    else if( err == KErrAlreadyExists ) 
+        {
+        TRACES( RDebug::Print(_L( "CSysApAppUi::ReleaseMemoryCardCustomDialogMemory(), Already been Drive Unlocked" )));
+        _LIT(KUnlockAlreadyExistNote,"The disk has already been unlocked!");
+        HBufC* aString = HBufC16::NewLC(150);
+        TPtrC aStringPointer = aString->Des();
+        aStringPointer.Set(KUnlockAlreadyExistNote);
+        iSysApAppUi.ShowExampleUiNoteL( aStringPointer );
+        CleanupStack::PopAndDestroy(); // aString
+        return ETrue;
+        }
+    else if( err == KErrNotSupported ) 
+        {
+        TRACES( RDebug::Print(_L( "CSysApAppUi::ReleaseMemoryCardCustomDialogMemory(), Media does not support password locking." )));
+        _LIT(KUnlockNotSupporrtedNote,"The media does not support password locking!");
+        HBufC* aString = HBufC16::NewLC(150);
+        TPtrC aStringPointer = aString->Des();
+        aStringPointer.Set(KUnlockNotSupporrtedNote);
+        TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
+        iSysApAppUi.ShowExampleUiNoteL( aStringPointer );
+        CleanupStack::PopAndDestroy(); // aString
+        return ETrue;
+        }
+    else
+        {
+        // check for error -18 what it is . 
+        _LIT(KUnlockOperationCancelNote,"Error occurred, operation cancelled!");
+        HBufC* aString = HBufC16::NewLC(150);
+        TPtrC aStringPointer = aString->Des();
+        aStringPointer.Set(KUnlockOperationCancelNote);
+        TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
+        iSysApAppUi.ShowExampleUiNoteL( aStringPointer );
+        CleanupStack::PopAndDestroy(); // aString
+        return ETrue;
+        }
+}
+        
+HBufC8* CSysApDriveUnlockHandler::Convert16to8L(TDesC16& aStr)//const
+    {
+    
+    HBufC8* newFrom1 = HBufC8::NewL(aStr.Length());
+    
+    newFrom1->Des().Copy(aStr);
+    
+    return newFrom1;
+    }
+
+void CSysApDriveUnlockHandler::ConvertCharactersToPwd(TDesC& aWord, TDes8& aConverted)
+{
+    aConverted.FillZ(aConverted.MaxLength());
+    aConverted.Zero();
+     
+    if (aWord.Length())
+    {
+    aConverted.Copy( (TUint8*)(&aWord[0]), aWord.Size() );
+    }
+}
+
 // End of File
--- a/coreapplicationuis/SysAp/Src/memorycard/sysapdriveunlockhandler.h	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/memorycard/sysapdriveunlockhandler.h	Thu Sep 02 20:36:53 2010 +0300
@@ -22,14 +22,14 @@
 // INCLUDES
 #include <e32std.h>
 #include <aknmemorycarddialog.h>
+#include "hbdeviceinputdialogsymbian.h"
 
 // FORWARD DECLARATIONS
 class CSysApDriveList;
 class CSysApAppUi;
 
 // CLASS DECLARATION
-class CSysApDriveUnlockHandler : public CBase,
-                                 public MAknMemoryCardDialogObserver
+class CSysApDriveUnlockHandler : public CBase                             
 {
 public:
     /**
@@ -57,6 +57,17 @@
      * @param aDrive Drive to stop unlock notifier if ongoing
      */
     void StopUnlock( TInt aDrive );
+    
+    void ReleaseMemoryForInputCardDialog();
+    TInt CheckMemoryDialogIfNeeded();
+    void ConvertCharactersToPwd(TDesC& aWord, TDes8& aConverted);
+    
+    /**
+    * Shows unlock query.
+    */
+    void ShowUnlockQueryL();
+    HBufC8* Convert16to8L(TDesC16& aStr);
+    void UnlockComplete( TInt aResult );
 
 private:
     /**
@@ -66,18 +77,13 @@
         CSysApDriveList& aSysApDriveList,
         CSysApAppUi& aSysApAppUi,
         const TBool aMemoryCardLockSupported );
-
+    
     /**
     * Handles query show from CAsyncCallBack.
     */
     static TInt QueryShowCB( TAny* aPtr );
 
     /**
-    * Shows unlock query.
-    */
-    void ShowUnlockQueryL();
-
-    /**
     * Checks is unlock query ongoing.
     */
     TBool IsQueryOngoing() const;
@@ -97,9 +103,6 @@
     */
     void DoStopUnlock( TInt aError );
 
-private: // From MAknMemoryCardDialogObserver
-    void UnlockComplete( TInt aResult );
-
 private: // Data
     // Reference to the drive list
     CSysApDriveList& iSysApDriveList;
@@ -109,19 +112,16 @@
 
     // Indicates if memory card locking is supported
     TBool iMemoryCardLockSupported;
-
-    // Pointer to unlock query. Own,
-    CAknMemoryCardDialog* iMemoryCardDialog;
-
-    // Current drive to be unlocked
+	
+	CHbDeviceInputDialogSymbian* iMemCardPwdDialog;
+    
+	// Current drive to be unlocked
     TInt iDriveToUnlock;
 
-    // Pointer to the callback. Own.
-    CAsyncCallBack* iQueryShowCB;
-
     // Indicates if the query result can be ignored i.e. query was canceled
     TBool iIgnoreQueryResult;
-
+    
+    TMediaPassword iPassword;
 };
 
 #endif // SYSAPDRIVEUNLOCKHANDLER_H
--- a/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -214,7 +214,6 @@
 //
 void CSysApDefaultKeyHandler::ActivateApplicationL( const TUid aUid ) const
     {
-    TUid check = aUid;
     
     TRACES( RDebug::Print( _L( "CSysApDefaultKeyHandler::ActivateApplicationL") ) );
     
@@ -333,7 +332,7 @@
     {
     TRACES( RDebug::Print( _L("CSysApDefaultKeyHandler::DoShowKeysLockedNote: iAknUiServerConnected=%d"), iAknUiServerConnected ) );
     
-    TInt err(KErrNone);
+//    TInt err(KErrNone);
     
     if ( !iAknUiServerConnected )
         {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/hbdeviceinputdialogplugin.pro	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,60 @@
+#
+#############################################################################
+##
+## Copyright (c) 2010 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:
+##
+#############################################################################
+#
+
+TEMPLATE = lib
+TARGET = HbDeviceInputDialogPlugin
+CONFIG += hb plugin
+
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+
+
+
+HEADERS += .\inc\hbdeviceinputdialogplugin_p.h \
+		   .\inc\hbdeviceinputdialogpluginerrors_p.h \
+           .\inc\hbdeviceinputdialogwidget_p.h
+
+SOURCES += .\src\hbdeviceinputdialogplugin.cpp \
+           .\src\hbdeviceinputdialogwidget.cpp
+
+MOC_DIR = ./tmp
+
+TRANSLATIONS	+=	filemanager.ts
+symbian: {
+    TARGET.UID3 = 0x2002F376
+    TARGET.CAPABILITY = ALL -TCB
+    TARGET.EPOCALLOWDLLDATA = 1
+
+    pluginstub.sources = HbDeviceInputDialogPlugin.dll
+    pluginstub.path = /resource/plugins/devicedialogs
+    DEPLOYMENT += pluginstub
+}
+
+symbian:
+{ 
+BLD_INF_RULES.prj_exports += \
+  "$${LITERAL_HASH}include <platform_paths.hrh>" \
+  "qmakepluginstubs/HbDeviceInputDialogPlugin.qtplugin   		/epoc32/data/z/pluginstub/HbDeviceInputDialogPlugin.qtplugin"\
+  ".\rom\hbdeviceinputdialogplugin.iby             				CORE_MW_LAYER_IBY_EXPORT_PATH(hbdeviceinputdialogplugin.iby)" \
+  ".\rom\hbdeviceinputdialogplugin_resources.iby 						LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(hbdeviceinputdialogplugin_resources.iby)"
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/inc/hbdeviceinputdialogplugin_p.h	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * Copyright (c) 2010 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 HBDEVICEINPUTDIALOGPLUGIN_P_H
+#define HBDEVICEINPUTDIALOGPLUGIN_P_H
+
+#include <QObject>
+#include <QVariantMap>
+
+#include <hbdevicedialogplugin.h>
+
+class HbDeviceInputDialogPluginPrivate;
+
+class HbDeviceInputDialogPlugin : public HbDeviceDialogPlugin
+{
+    Q_OBJECT
+
+public:
+    friend class HbDeviceInputDialogPluginPrivate;
+
+    HbDeviceInputDialogPlugin();
+    ~HbDeviceInputDialogPlugin();
+
+    bool accessAllowed(const QString &deviceDialogType,const QVariantMap &parameters, const QVariantMap &securityInfo) const;
+    HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType,const QVariantMap &parameters);
+    bool deviceDialogInfo(const QString &deviceDialogType,const QVariantMap &parameters, DeviceDialogInfo *info) const;
+    QStringList deviceDialogTypes() const;
+    PluginFlags pluginFlags() const;
+    int error() const;
+
+private:
+    Q_DISABLE_COPY(HbDeviceInputDialogPlugin)
+    HbDeviceInputDialogPluginPrivate *d;
+};
+
+#endif // HBDEVICEINPUTDIALOGPLUGIN_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/inc/hbdeviceinputdialogpluginerrors_p.h	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * Copyright (c) 2010 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 HBDEVICEINPUTDIALOGPLUGINERRORS_P_H
+#define HBDEVICEINPUTDIALOGPLUGINERRORS_P_H
+
+#include <hbdevicedialog.h>
+#include <e32debug.h>
+#ifdef _DEBUG
+
+    #define TRACES( x ) x
+
+#else
+
+    #define TRACES( x )
+
+#endif
+
+
+// No error
+const int NoError = 0;
+// Illegal parameter error
+const int ParameterError = HbDeviceDialog::PluginErrors + 1;
+// Unknown device dialog error
+const int UnknownDeviceDialogError = HbDeviceDialog::PluginErrors + 2;
+
+#endif // HBDEVICEINPUTDIALOGPLUGINERRORS_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/inc/hbdeviceinputdialogwidget_p.h	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,97 @@
+/****************************************************************************
+ * Copyright (c) 2010 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 HBDEVICEINPUTDIALOGWIDGET_P_H
+#define HBDEVICEINPUTDIALOGWIDGET_P_H
+
+#include <QObject>
+#include <QVariantMap>
+
+#include <hbdevicedialoginterface.h>
+#include <hbdevicedialog.h>
+#include <hbinputdialog.h>
+#include <hbTranslator.h>
+
+class HbDialog;
+
+class HbDeviceInputDialogWidget : public HbInputDialog, public HbDeviceDialogInterface
+{
+    Q_OBJECT
+    Q_PROPERTY(QString primaryActionText READ primaryActionText WRITE setPrimaryActionText)
+    Q_PROPERTY(QString secondaryActionText READ secondaryActionText WRITE setSecondaryActionText)
+    Q_PROPERTY(bool primaryActionNull READ primaryActionNull WRITE setPrimaryActionNull)
+    Q_PROPERTY(bool secondaryActionNull READ secondaryActionNull WRITE setSecondaryActionNull)
+    Q_PROPERTY(QString animationDefinition READ animationDefinition WRITE setAnimationDefinition)
+
+public:
+    HbDeviceInputDialogWidget(const QVariantMap &parameters);
+    ~HbDeviceInputDialogWidget();
+
+    bool setDeviceDialogParameters(const QVariantMap &parameters);
+    int deviceDialogError() const;
+    void closeDeviceDialog(bool byClient);
+    HbDialog *deviceDialogWidget() const;
+
+public slots:
+    void primaryActionTriggered();
+    void secondaryActionTriggered();
+    void closeDialog();
+
+private:
+    bool preConstructDialog();
+    bool constructDialog(const QVariantMap &parameters);
+    bool checkProperties(const QVariantMap &parameters);
+    void setProperties(const QVariantMap &parameters);
+    void resetProperties();
+    QString primaryActionText() const;
+    void setPrimaryActionText(QString &actionText);
+    QString secondaryActionText() const;
+    void setSecondaryActionText(QString &actionText);
+    bool primaryActionNull() const;
+    void setPrimaryActionNull(bool null);
+    bool secondaryActionNull() const;
+    void setSecondaryActionNull(bool null);
+    void hideEvent(QHideEvent *event);
+    void showEvent(QShowEvent *event);
+    void setAnimationDefinition(QString &animationDefinition);
+    QString animationDefinition() const;
+
+signals:
+    void deviceDialogClosed();
+    void deviceDialogData(QVariantMap data);  //used to send the inputted text from server to client
+
+private:
+    Q_DISABLE_COPY(HbDeviceInputDialogWidget)
+
+    int             mLastError;
+    int             mDeviceDialogError;             //DeviceDialogError
+    int 						mHack;
+
+    QString         mPrimaryActionText;
+    QString         mSecondaryActionText;
+    bool            mPrimaryActionNull;
+    bool            mSecondaryActionNull;
+    int             mSendAction;
+    bool            mShowEventReceived;
+    QString         mAnimationDefinition;
+    QVariantMap     data;
+    HbAction*       mPrimaryAction;
+    HbAction*       mSecondaryAction;
+    HbTranslator*   mHbTranslator;     
+};
+
+#endif // HBDEVICEINPUTDIALOGWIDGET_P_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/rom/hbdeviceinputdialogplugin.iby	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010 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 __HBDEVICEINPUTDIALOGPLUGIN_IBY__
+#define __HBDEVICEINPUTDIALOGPLUGIN_IBY__
+
+
+file = \epoc32\release\armv5\urel\HbDeviceInputDialogPlugin.dll  \sys\bin\HbDeviceInputDialogPlugin.dll UNPAGED
+data=\epoc32\data\z\pluginstub\HbDeviceInputDialogPlugin.qtplugin \resource\plugins\devicedialogs\HbDeviceInputDialogPlugin.qtplugin
+
+
+#endif //__HBDEVICEINPUTDIALOGPLUGIN_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/rom/hbdeviceinputdialogplugin_resources.iby	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010 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 __HBDEVICEINPUTDIALOGPLUGIN_RESOURCES_IBY__
+#define __HBDEVICEINPUTDIALOGPLUGIN_RESOURCES_IBY__
+
+//this iby is required for language specific things to be exported to Language iby layer
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\QT_TRANSLATIONS_DIR\device_input_dialog.qm	QT_TRANSLATIONS_DIR\device_input_dialog.qm
+
+
+#endif //__HBDEVICEINPUTDIALOGPLUGIN_RESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/src/hbdeviceinputdialogplugin.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,147 @@
+/****************************************************************************
+ * Copyright (c) 2010 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 <QtPlugin>
+
+#include <hbdevicedialog.h>
+//#include <hbdevicedialogtrace_p.h>
+#include "hbdeviceinputdialogplugin_p.h"
+#include "hbdeviceinputdialogwidget_p.h"
+#include "hbdeviceinputdialogpluginerrors_p.h"
+
+Q_EXPORT_PLUGIN2(deviceinputdialogplugin, HbDeviceInputDialogPlugin)
+
+// This plugin implements one device dialog type
+static const struct {
+    const char *mTypeString;
+} dialogInfos[] = {
+    {"com.nokia.hb.deviceinputdialog/1.0"}
+};
+
+class HbDeviceInputDialogPluginPrivate
+{
+public:
+    HbDeviceInputDialogPluginPrivate() {mError = NoError;}
+
+    int mError;
+};
+
+// Constructor
+HbDeviceInputDialogPlugin::HbDeviceInputDialogPlugin()
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::Constructor:Begin") ) );
+    d = new HbDeviceInputDialogPluginPrivate;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::Constructor:End") ) );
+}
+
+// Destructor
+HbDeviceInputDialogPlugin::~HbDeviceInputDialogPlugin()
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::Destructor:Begin") ) );
+    delete d;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::Destructor:End") ) );
+}
+
+// Check if client is allowed to use device dialog widget
+bool HbDeviceInputDialogPlugin::accessAllowed(const QString &deviceDialogType,
+    const QVariantMap &parameters, const QVariantMap &securityInfo) const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::AccessAllowed:Begin") ) );
+    Q_UNUSED(deviceDialogType)
+    Q_UNUSED(parameters)
+    Q_UNUSED(securityInfo)
+
+    // This plugin doesn't perform operations that may compromise security.
+    // All clients are allowed to use.
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::AccessAllowed:End") ) );    
+    return true;
+
+}
+
+// Create device dialog widget
+HbDeviceDialogInterface *HbDeviceInputDialogPlugin::createDeviceDialog(const QString &deviceDialogType, const QVariantMap &parameters)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::createDeviceDialog:Begin") ) );
+    d->mError = NoError;
+
+    HbDeviceDialogInterface *ret(0);
+    int i(0);
+    const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
+    for(i = 0; i < numTypes; i++) {
+        if (dialogInfos[i].mTypeString == deviceDialogType) {
+            break;
+        }
+    }
+    if (i < numTypes) {
+        QVariantMap params = parameters;
+        HbDeviceInputDialogWidget *deviceDialog = new HbDeviceInputDialogWidget(params);
+        d->mError = deviceDialog->deviceDialogError();
+        if (d->mError != NoError) {
+            delete deviceDialog;
+            deviceDialog = 0;
+        }
+        ret = deviceDialog;
+    } else {
+        d->mError = UnknownDeviceDialogError;
+        ret = 0;
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::createDeviceDialog:End") ) );
+    return ret;
+}
+
+// Return information of device dialog the plugin creates
+bool HbDeviceInputDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, const QVariantMap &parameters, DeviceDialogInfo *info) const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::deviceDialogInfo:Begin") ) );
+    Q_UNUSED(parameters)
+    Q_UNUSED(deviceDialogType)
+
+    info->group = GenericDeviceDialogGroup;
+    info->flags = NoDeviceDialogFlags;
+    info->priority = DefaultPriority;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::deviceDialogInfo:End") ) );
+    return true;
+    
+}
+
+// Return device dialog types this plugin implements
+QStringList HbDeviceInputDialogPlugin::deviceDialogTypes() const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::deviceDialogTypes:Begin") ) );
+    QStringList types;
+    const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
+    for(int i = 0; i < numTypes; i++) {
+        types.append(dialogInfos[i].mTypeString);
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::deviceDialogTypes:End") ) );
+    return types;
+}
+
+// Return plugin flags
+HbDeviceDialogPlugin::PluginFlags HbDeviceInputDialogPlugin::pluginFlags() const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::pluginFlags:Begin") ) );
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::pluginFlags:End") ) );
+    return NoPluginFlags;
+}
+
+// Return last error
+int HbDeviceInputDialogPlugin::error() const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::error:Begin") ) );
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogPlugin::error:End") ) );
+    return d->mError;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/hbdeviceinputdialogplugin/src/hbdeviceinputdialogwidget.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -0,0 +1,378 @@
+/****************************************************************************
+ * Copyright (c) 2010 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 <hbaction.h>
+#include <hbdialog.h>
+#include <hbinputdialog.h>
+#include<hblineedit.h>
+#include <hbiconanimationmanager.h>
+#include "hbdeviceinputdialogwidget_p.h"
+#include "hbdeviceinputdialogpluginerrors_p.h"
+
+//For Localization
+QString LOCALE_PATH("/resource/qt/translations/"); 
+QString TS_FILE("filemanager");
+
+// Constructor
+HbDeviceInputDialogWidget::HbDeviceInputDialogWidget(const QVariantMap &parameters):HbInputDialog()
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::Constructor:Begin") ) );
+    mLastError = NoError;
+    mShowEventReceived = false;
+    mPrimaryAction = 0;
+    mSecondaryAction = 0;
+    mDeviceDialogError =0;
+    mHack = 1;
+    //resetProperties();
+    if (preConstructDialog())
+       {
+        //Translator loaded succesfully then olny construct widgets
+        constructDialog(parameters);
+        if (!mPrimaryAction) {
+            // If default button provided by HbInputDialog is used, connect into its triggered signal.
+            QAction *action = /*primaryAction()*/this->actions().first();
+            if (action) {
+                connect(action, SIGNAL(triggered()), SLOT(primaryActionTriggered()));
+                }
+        }
+        if (!mSecondaryAction) {
+            // If default button provided by HbInputDialog is used, connect into its triggered signal.
+            QAction *action = /*secondaryAction()*/ this->actions().at(1);
+            if (action) {
+                connect(action, SIGNAL(triggered()), SLOT(secondaryActionTriggered()));
+            }
+        }  
+        connect(this, SIGNAL(visibilityChanged()), SLOT(closeDialog()));
+       }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::Constructor:End") ) );
+}
+
+// Destructor
+HbDeviceInputDialogWidget::~HbDeviceInputDialogWidget()
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::Destrcuctor:Begin") ) );
+    delete mPrimaryAction;
+    delete mSecondaryAction;
+    delete mHbTranslator;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::Destructor:End") ) );
+}
+
+// Set parameters
+bool HbDeviceInputDialogWidget::setDeviceDialogParameters(const QVariantMap &parameters)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setDeviceDialogParameters:Begin") ) );
+    mLastError = NoError;
+    bool ret(false);
+    if (checkProperties(parameters)) {
+        setProperties(parameters);
+        ret = true;
+    }
+    else {
+        mLastError = ParameterError;
+        ret = false;
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setDeviceDialogParameters:End") ) );
+    return ret;
+}
+
+/**
+ * Before creating widgets Translator must be loaded
+ */
+bool HbDeviceInputDialogWidget::preConstructDialog()
+    {
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::preConstructDialog:Begin") ) );
+    //Translator
+    mHbTranslator = new HbTranslator(LOCALE_PATH,TS_FILE);
+    if(!mHbTranslator)
+        {
+        //Translator is failed to create
+        mDeviceDialogError = UnknownDeviceDialogError;
+        TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::preConstructDialog:MemoryAllocation Failed") ) );
+        return false;
+        }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::preConstructDialog:End") ) );
+    return true;
+    }
+
+// Get error
+int HbDeviceInputDialogWidget::deviceDialogError() const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::deviceDialogError:Begin") ) );
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::deviceDialogError:End") ) );
+    return mLastError;
+}
+
+// Close device dialog
+void HbDeviceInputDialogWidget::closeDeviceDialog(bool byClient)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::closeDeviceDialog:Begin") ) );
+    Q_UNUSED(byClient);
+    // Closed by client or internally by server -> no action to be transmitted.
+    mSendAction = false;
+    close();
+    // If show event has been received, close is signalled from hide event. If not,
+    // hide event does not come and close is signalled from here.
+    if (!mShowEventReceived) {
+        emit deviceDialogClosed();
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::closeDeviceDialog:End") ) );
+}
+
+// Return display widget
+HbDialog *HbDeviceInputDialogWidget::deviceDialogWidget() const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::deviceDialogWidget:Begin") ) );
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::deviceDialogWidget:End") ) );
+    return const_cast<HbDeviceInputDialogWidget*>(this);
+}
+
+
+// Construct dialog
+bool HbDeviceInputDialogWidget::constructDialog(const QVariantMap &parameters)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::constructDialog:Begin") ) );
+    bool ret(false);
+    // Check that parameters are valid
+    
+    if (!checkProperties(parameters)) {
+        mLastError = ParameterError;
+        ret = false;
+    }
+    else {
+        setProperties(parameters);
+        resetProperties();
+        ret = true;
+    }
+   
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::constructDialog:End") ) );
+    return ret;
+}
+
+// Check that device dialog parameters are valid
+bool HbDeviceInputDialogWidget::checkProperties(const QVariantMap &parameters)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::checkProperties:Begin") ) );
+    QVariantMap::const_iterator i = parameters.constBegin();
+    while (i != parameters.constEnd()) {
+        QByteArray key = i.key().toAscii();
+        if (!property(key.constData()).isValid()) {
+        TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::checkProperties:End :: returning false") ) );
+            return false;
+        }
+        ++i;
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::checkProperties:End :: returning true") ) );
+    return true;
+}
+
+// Set properties
+void HbDeviceInputDialogWidget::setProperties(const QVariantMap &parameters)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setProperties:Begin") ) );
+    QVariantMap::const_iterator i = parameters.constBegin();
+    while (i != parameters.constEnd()) {
+        QByteArray key = i.key().toAscii();
+        if (property(key.constData()).isValid()) {
+            setProperty(key.constData(), i.value());
+        }
+        ++i;
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setProperties:End") ) );
+    return;
+}
+
+// Reset properties to default values
+void HbDeviceInputDialogWidget::resetProperties()
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::resetProperties:Begin") ) );
+//    mIconName.clear();
+    setModal(true);
+    setPromptText(hbTrId("txt_common_dialog_password"), 0); 
+    setInputMode(TextInput,0);
+    setEchoMode(HbLineEdit::Password,0);
+    setTimeout(HbPopup::NoTimeout);
+    setDismissPolicy(HbPopup::NoDismiss);
+    
+    mPrimaryActionNull = false;
+    mSecondaryActionNull = false;
+    mSendAction = true;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::resetProperties:End") ) );
+    return;
+}
+
+QString HbDeviceInputDialogWidget::primaryActionText() const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::primaryActionText:Begin") ) );
+    QAction *action = /*primaryAction()*/this->actions().first();
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::primaryActionText:End") ) );
+    return action ? action->text() : QString();
+}
+
+void HbDeviceInputDialogWidget::setPrimaryActionText(QString &actionText)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setPrimaryActionText:Begin") ) );
+    QAction *action = /*primaryAction()*/this->actions().first();
+    if (action) {
+        action->setText(actionText);
+    } else {
+        if (!mPrimaryAction) {
+            mPrimaryAction = new HbAction(actionText);
+            connect(mPrimaryAction, SIGNAL(triggered()), this, SLOT(primaryActionTriggered()));
+        } else {
+            mPrimaryAction->setText(actionText);
+        }
+        setPrimaryAction(mPrimaryAction);
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setPrimaryActionText:End") ) );
+}
+
+QString HbDeviceInputDialogWidget::secondaryActionText() const
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::secondaryActionText:Begin") ) );
+    QAction *action = /*secondaryAction()*/ this->actions().at(1);
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::secondaryActionText:End") ) );
+    return action ? action->text() : QString();
+    
+}
+
+void HbDeviceInputDialogWidget::setSecondaryActionText(QString &actionText)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setSecondaryActionText:Begin") ) );
+    QAction *action = /*secondaryAction()*/ this->actions().at(1);
+    if (action) {
+        action->setText(actionText);
+    } else {
+        if (!mSecondaryAction) {
+            mSecondaryAction = new HbAction(actionText);
+            connect(mSecondaryAction, SIGNAL(triggered()), this, SLOT(secondaryActionTriggered()));
+        } else {
+            mSecondaryAction->setText(actionText);
+        }
+        setSecondaryAction(mSecondaryAction);
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setSecondaryActionText:End") ) );
+}
+
+bool HbDeviceInputDialogWidget::primaryActionNull() const
+{
+    return this->actions().first() == 0;
+}
+
+void HbDeviceInputDialogWidget::setPrimaryActionNull(bool isNull)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setPrimaryActionNull:Begin") ) );
+    if (isNull) {
+        // If there is a message box's default action, disconnect from it.
+        QAction *action = /*primaryAction()*/this->actions().first();
+        if (action && mPrimaryAction == 0) {
+            action->disconnect(SIGNAL(triggered()), this, SLOT(primaryActionTriggered()));
+        }
+        setPrimaryAction(0);
+    } else {
+        QString text = mPrimaryAction ? mPrimaryAction->text() : QString();
+        setPrimaryActionText(text);
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setPrimaryActionNull:End") ) );
+}
+
+bool HbDeviceInputDialogWidget::secondaryActionNull() const
+{
+    return this->actions().at(1) == 0;
+}
+
+void HbDeviceInputDialogWidget::setSecondaryActionNull(bool isNull)
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setSecondaryActionNull:Begin") ) );
+    if (isNull) {
+        // If there is a message box's default action, disconnect from it.
+        QAction *action = /*secondaryAction()*/ this->actions().at(1);
+        if (action && mSecondaryAction == 0) {
+            action->disconnect(SIGNAL(triggered()), this, SLOT(secondaryActionTriggered()));
+        }
+        setSecondaryAction(0);
+    } else {
+        QString text = mSecondaryAction ? mSecondaryAction->text() : QString();
+        setSecondaryActionText(text);
+    }
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::setSecondaryActionNull:End") ) );
+}
+
+// Widget is about to hide. Closing effect has ended.
+void HbDeviceInputDialogWidget::hideEvent(QHideEvent *event)
+{
+    Q_UNUSED(event);
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::hideEvent:Begin") ) );
+    HbInputDialog::hideEvent(event);
+    emit deviceDialogClosed();
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::hideEvent:End") ) );
+}
+
+// Widget is about to show
+void HbDeviceInputDialogWidget::showEvent(QShowEvent *event)
+{
+    Q_UNUSED(event);
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::showEvent:Begin") ) );
+    HbInputDialog::showEvent(event);
+    mShowEventReceived = true;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::showEvent:End") ) );
+}
+
+void HbDeviceInputDialogWidget::setAnimationDefinition(QString &animationDefinition)
+{
+    mAnimationDefinition = animationDefinition;
+}
+
+QString HbDeviceInputDialogWidget::animationDefinition() const
+{
+    return mAnimationDefinition;
+}
+
+// Primary action triggered
+void HbDeviceInputDialogWidget::primaryActionTriggered()
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::primaryActionTriggered:Begin") ) );
+    //Get the string enter by user
+    QString myString = this->value().toString();
+    data.insert("ok",myString);
+    emit deviceDialogData(data);
+    mSendAction = true;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::primaryActionTriggered:End") ) );
+}
+
+// Secondary action triggered
+void HbDeviceInputDialogWidget::secondaryActionTriggered()
+{
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::secondaryActionTriggered:Begin") ) );
+    data.insert("cancel","cancel");
+    emit deviceDialogData(data);
+    mSendAction = false;
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::secondaryActionTriggered:End") ) );
+}
+
+
+// Close Dialog when visibility changed
+void HbDeviceInputDialogWidget::closeDialog()
+    {
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::closeDialog:Begin") ) );
+    if(mHack == 1)
+        {
+        emit deviceDialogData(data); // first time plugin didnt called deviceDialogData and hence this hack added.
+        }
+    emit deviceDialogClosed();
+    TRACES( RDebug::Print( _L("HbDeviceInputDialogWidget::closeDialog:End") ) );
+    mHack = 0;
+    }
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/formatterrfsplugin.mmp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/formatterrfsplugin.mmp	Thu Sep 02 20:36:53 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -44,4 +44,3 @@
 LIBRARY         efsrv.lib               // File Server
 LIBRARY         euser.lib               // Base library
 LIBRARY         platformenv.lib         // PathInfo
-LIBRARY			sisregistryclient.lib   // RSisRegistrySession
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/secureformatter.mmp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/secureformatter.mmp	Thu Sep 02 20:36:53 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -23,9 +23,11 @@
 TARGETTYPE      exe
 SECUREID        0x20002486
 
-CAPABILITY      ALLFILES TCB // TCB required to delete c:/sys and c:/resource
+CAPABILITY      ALLFILES TCB ReadUserData // TCB required to delete c:/sys and c:/resource
 VENDORID        VID_DEFAULT
 
+EPOCHEAPSIZE    0x1000 0x200000 // if the excludelist entries are more , we need the heapsize of 2MB
+
 SOURCEPATH      ../src
 SOURCE          dirstackentry.cpp
 SOURCE          excludelistentry.cpp
@@ -39,3 +41,4 @@
 
 LIBRARY         efsrv.lib // File Server
 LIBRARY         euser.lib
+LIBRARY			sisregistryclient.lib   // RSisRegistrySession
\ No newline at end of file
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/formatterrfsplugincommon.h	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/formatterrfsplugincommon.h	Thu Sep 02 20:36:53 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2009-10 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"
@@ -27,12 +27,6 @@
 _LIT( KExcludeList, "\\private\\100059C9\\excludelist.txt" );
 
 /**
-* Exclude list path and file which has the entries of the NR-flagged applications which are installed in c:\ drive and the RFS operation
-* is based on this file itself
-*/
-_LIT( KExcludeListcache, "\\private\\100059C9\\excludelistcache.txt" );
-
-/**
 * Application exclude list path
 */
 _LIT( KApplicationExcludeListPath, "?:\\private\\102073ea\\excludes\\" );
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/selectiveformatter.h	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/selectiveformatter.h	Thu Sep 02 20:36:53 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -115,6 +115,16 @@
     */
     void HandleAppExcludeListsOnDriveL( TPtr aBuf, TChar aDrive );
 
+    /**
+    * Handles NR-Application specific exclude list loading.       
+    */
+    void HandleNrExcludeListsL();
+
+    /**
+    * Append the list of nr-files to the excludelist entry.
+    */
+    void AppendNrlisttoExcludeListL(RPointerArray<HBufC> &nrFileList);
+
 private: // Data
 
     /** File server session. */
@@ -136,4 +146,35 @@
     TBool iValidExcludeListFound;
     };
 
+/** 
+Template class CleanupResetAndDestroy to clean up the array
+of implementation information from the cleanup stack.
+*/
+
+template <class T>
+class CleanupResetAndDestroy
+    {
+public:
+    /**
+    Puts an item on the cleanup stack.
+
+    @param  aRef 
+            The implementation information to be put on the cleanup stack.
+    */
+    inline static void PushL(T& aRef);
+private:
+    static void ResetAndDestroy(TAny *aPtr);
+    };
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef);
+template <class T>
+inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
+    {CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));}
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
+    {(STATIC_CAST(T*,aPtr))->ResetAndDestroy();}
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef)
+    {CleanupResetAndDestroy<T>::PushL(aRef);}
+
 #endif // C_SELECTIVEFORMATTER_H
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -19,11 +19,9 @@
 // SYSTEM INCLUDE
 #include <centralrepository.h>
 #include <driveinfo.h>
-#include <swi/sisregistrysession.h>
-#include <swi/sisregistryentry.h>
-#include <swi/sisregistrypackage.h>
-#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 #include <starterdomaincrkeys.h>
+
 // USER INCLUDE
 #include "formatterrfsplugin.h"
 #include "formatterrfspluginprivatecrkeys.h"
@@ -39,238 +37,17 @@
 
 // ================= LOCAL FUNCTIONS =======================
 
-// ---------------------------------------------------------------------------
-// ExcludeListNameL
-// ---------------------------------------------------------------------------
-//
-static void FileWriteL(RPointerArray<HBufC> &files)
-    {
-    RFs fileSession;
-    RFile file;
-    User::LeaveIfError(fileSession.Connect());
-    TInt err = file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
-        
-    if ( err != KErrNone )
-        {
-        RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , FileWrite : Failed to open the file"));
-        return;
-        }
-
-    TInt pos = 0;
-    file.Seek(ESeekEnd,pos);
-    TInt size = files.Count();
-    RBuf filenameBuf;
-
-    for ( TInt i=0; i < size; i++)
-        {
-        HBufC8* fileName = HBufC8::NewLC(files[i]->Size());
-        TPtr8 fileNamePtr(fileName->Des());
-        fileNamePtr.Copy(*files[i]);
-
-        filenameBuf.Create(fileNamePtr.Length());
-        filenameBuf.Copy(fileNamePtr);
-        TFileText fileText ;
-        fileText.Set(file) ;
-        fileText.Seek(ESeekStart);
-        fileText.Write(filenameBuf);
-        CleanupStack::PopAndDestroy();//Filename
-        file.Flush();
-        }
-
-    file.Close();
-    fileSession.Close();    
-    }
-
-static void MergeFilesL()
-    {
-    
-    RFs fileSession;
-    RFile excludeFileName;
-    
-    RFile fileName;
-    TInt pos = 0;
-    TInt size_of_script( 0 );
-    TInt buffer_size( sizeof(TText) );
-    TInt number_of_chars;
-    
-    User::LeaveIfError(fileSession.Connect());
-    TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
-
-		if(ret != KErrNone)
-			{
-			RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
-			return;
-			}
-    ret = fileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
-    if ( ret != KErrNone)
-            {
-            excludeFileName.Close();
-            RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
-            return;
-            }
-    fileName.Seek(ESeekEnd,pos);
-    
-    HBufC* buffer = HBufC::NewMaxLC( buffer_size );        
-    TPtr8 bufferPtr( (TUint8*)buffer->Ptr(), buffer_size);
-    
-    TInt err(0);
-    err = excludeFileName.Size( size_of_script );
-    number_of_chars = size_of_script / sizeof(TText);
-
-    TInt i(0);
-    for (i = 0; i < number_of_chars; i++)
-       {
-       if ( err == KErrNone )
-            {
-            err = excludeFileName.Read( bufferPtr);                
-            }
-        fileName.Write(bufferPtr);
-        }
-    fileName.Flush();
-    fileName.Close();
-    
-    excludeFileName.Close();
-    fileSession.Close();
-    CleanupStack::PopAndDestroy();//buffer
-
-    }
 
 static HBufC* ExcludeListNameL( TChar aSystemDrive )
     {
     FUNC_LOG;
 		
-    RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL"));
-    
-    RFs fileSession;
-    RFile file;
-    
-    _LIT8(KFileName, "c:\\private\\100059C9\\excludelistcache.txt\n");
-    TBuf8 <50> fileName;
-    fileName.Copy(KFileName);
-
-    User::LeaveIfError(fileSession.Connect());
-    
-    RDir dir;
-    if(dir.Open(fileSession,_L("c:\\private\\100059C9\\"),KEntryAttNormal) != KErrNone)
-        {
-        User::LeaveIfError(fileSession.MkDir(_L("c:\\private\\100059C9\\")));
-        }
-    
-    TInt rev = file.Replace(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
-    
-    RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL, Replace returned %d"),rev);
-    
-    file.Flush();
-    file.Close();
-    dir.Close();
-    fileSession.Close();
-
-    Swi::RSisRegistrySession session;
-    CleanupClosePushL(session);
-    User::LeaveIfError(session.Connect());
-    
-    // Get the installed application UIDs
-    RArray<TUid> uids;
-    CleanupClosePushL(uids);
-    session.InstalledUidsL(uids);
-    TInt uidcount = uids.Count(); 
-    
-    Swi::RSisRegistryEntry entry;
-    Swi::RSisRegistryEntry entry2;
-    CleanupClosePushL(entry);
-    CleanupClosePushL(entry2);
-    
-    RPointerArray<HBufC> registryFiles;
-    RPointerArray<HBufC> augmentedRegistryFiles;
-    RPointerArray<HBufC> nonRemovableFiles;
-    RPointerArray<HBufC> nonRemovableAugmentedFiles;
-    CleanupResetAndDestroyPushL(registryFiles);
-    CleanupResetAndDestroyPushL(augmentedRegistryFiles);
-    CleanupResetAndDestroyPushL(nonRemovableFiles);
-    CleanupResetAndDestroyPushL(nonRemovableAugmentedFiles);
-    
-     TInt count;
-     RPointerArray<Swi::CSisRegistryPackage> augmentationPackages;
-     CleanupResetAndDestroyPushL(augmentationPackages);
-     for ( TInt iter=0; iter<uidcount; iter++)
-         {
-         User::LeaveIfError(entry.Open(session,uids[iter]));
-         if(EFalse == entry.RemovableL())
-             {
-             entry.FilesL(nonRemovableFiles);
-             entry.RegistryFilesL(registryFiles);
-             TInt fileCount = nonRemovableFiles.Count(); 
-             for (TInt z=fileCount-1; z>=0;z--)
-                 {
-                 TPtr firstChar(nonRemovableFiles[z]->Des());
-                 if(firstChar.Mid(0,1) == _L("z"))
-                     {
-                     delete nonRemovableFiles[z];
-                     nonRemovableFiles.Remove(z);
-                     }
-                 }
-             // Look for augmentations.
-             if(entry.IsAugmentationL())
-                 {
-                 entry.AugmentationsL(augmentationPackages);
-                 count = entry.AugmentationsNumberL();
-                 for (TInt i=0; i < count; ++i)
-                     {
-                     User::LeaveIfError(entry2.OpenL(session,*augmentationPackages[i]));
-                     if(EFalse == entry2.RemovableL())
-                         {
-                         entry2.FilesL(nonRemovableAugmentedFiles);
-                         entry2.RegistryFilesL(augmentedRegistryFiles);
-                         for (TInt c=0; c<nonRemovableAugmentedFiles.Count();c++)
-                               {
-                               TPtr firstChar(nonRemovableAugmentedFiles[c]->Des());
-                               if(firstChar.Mid(0,1) == _L("z"))
-                                   {
-                                   delete nonRemovableAugmentedFiles[c];
-                                   nonRemovableAugmentedFiles.Remove(c);
-                                   }
-                               }
-											}
-                     	entry2.Close();
-                     	}
-                 }
-             }
-         entry.Close();
-         }
-     RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL Writing the file names to the excludelist.txt"));
- 
-     MergeFilesL();
-		 FileWriteL(nonRemovableAugmentedFiles);
-		 FileWriteL(augmentedRegistryFiles);
-		 FileWriteL(nonRemovableFiles);
- 		 FileWriteL(registryFiles);
-
-     TInt pos = 0;
-     User::LeaveIfError(fileSession.Connect());
-     User::LeaveIfError(file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText));
-          
-     file.Seek(ESeekEnd,pos);
-
-     TBuf<KMaxFileName> configurationLine ;
-     TFileText fileText ;
-     fileText.Set(file) ;
-     fileText.Seek(ESeekStart);
-     configurationLine.Format(_L("c:\\private\\100059C9\\excludelistcache.txt")) ;
-     fileText.Write(configurationLine);
-     
-     file.Flush();
-     file.Close();
-     fileSession.Close();
-    
-     
-     CleanupStack::PopAndDestroy(9,&session);
-
-     HBufC* buf = HBufC::NewLC( KExcludeListcache().Length() + KExcludeListPathNameLenExt );
-     TPtr bufPtr = buf->Des();
-     bufPtr.Append( aSystemDrive );
-     bufPtr.Append( KDriveDelimiter );
-     bufPtr.Append( KExcludeListcache );
-     CleanupStack::Pop( buf );
+    HBufC* buf = HBufC::NewLC( KExcludeList().Length() + KExcludeListPathNameLenExt );
+    TPtr bufPtr = buf->Des();
+    bufPtr.Append( aSystemDrive );
+    bufPtr.Append( KDriveDelimiter );
+    bufPtr.Append( KExcludeList );
+    CleanupStack::Pop( buf );
     return buf;
     }
 
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/selectiveformatter.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/selectiveformatter.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -17,6 +17,9 @@
 
 
 #include <f32file.h>
+#include <swi/sisregistrysession.h>
+#include <swi/sisregistryentry.h>
+#include <swi/sisregistrypackage.h>
 
 #include "dirstackentry.h"
 #include "selectiveformatter.h"
@@ -24,6 +27,7 @@
 #include "rfsfileman.h"
 #include "trace.h"
 
+_LIT(KZDrive,"z");
 // ================= MEMBER FUNCTIONS =======================
 
 // ---------------------------------------------------------------------------
@@ -125,6 +129,9 @@
     // Handle app specific files
     HandleAppExcludeListsL();
     
+    // Handle NR-Applications
+    //HandleNrExcludeListsL();
+    
     if( !iValidExcludeListFound )
         {
         User::Leave( KErrInvalidExcList );
@@ -329,3 +336,130 @@
         dir = NULL;
         }
     }
+
+// ---------------------------------------------------------------------------
+// CSelectiveFormatter::HandleNrExcludeListsL
+// ---------------------------------------------------------------------------
+//
+void CSelectiveFormatter::HandleNrExcludeListsL()
+    {
+    INFO( "CSelectiveFormatter::HandleNrExcludeListsL() START ");
+    
+    Swi::RSisRegistrySession session;
+    CleanupClosePushL(session);
+    User::LeaveIfError(session.Connect());
+    
+    INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() RSisRegistrySession::Connect() established");
+    // Get the installed application UIDs
+    RArray<TUid> uids;
+    CleanupClosePushL(uids);
+    session.InstalledUidsL(uids);
+    TInt uidcount = uids.Count(); 
+    
+    Swi::RSisRegistryEntry regEntry;
+    Swi::RSisRegistryEntry augmentForRegEntry;
+    CleanupClosePushL(regEntry);
+    CleanupClosePushL(augmentForRegEntry);
+    
+    // Array of registry files i.e., .reg and .ctl for the installed apps
+    RPointerArray<HBufC> registryFiles;
+    
+    // Array of registry files i.e., .reg and .ctl for the augmented apps
+    RPointerArray<HBufC> augmentedRegistryFiles;
+    
+    // Array of files installed through package.
+    RPointerArray<HBufC> nonRemovableFiles;
+    
+    // Array of augmented files installed through package.
+    RPointerArray<HBufC> nonRemovableAugmentedFiles;
+    
+    CleanupResetAndDestroyPushL(registryFiles);
+    CleanupResetAndDestroyPushL(augmentedRegistryFiles);
+    CleanupResetAndDestroyPushL(nonRemovableFiles);
+    CleanupResetAndDestroyPushL(nonRemovableAugmentedFiles);
+    
+    TInt count;
+    
+    //Array of augmented packages
+    RPointerArray<Swi::CSisRegistryPackage> augmentationPackages;
+    CleanupResetAndDestroyPushL(augmentationPackages);
+        
+    for ( TInt iter=0; iter<uidcount; iter++)
+     {
+     User::LeaveIfError(regEntry.Open(session,uids[iter]));
+     if(EFalse == regEntry.RemovableL())
+         {
+         INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() get the nonRemovable and registry files");
+         
+         regEntry.FilesL(nonRemovableFiles);
+         regEntry.RegistryFilesL(registryFiles);
+         TInt fileCount = nonRemovableFiles.Count(); 
+         for (TInt nonRemovableFilesCount=fileCount-1; nonRemovableFilesCount>=0;nonRemovableFilesCount--)
+             {
+             TPtr nrFileName(nonRemovableFiles[nonRemovableFilesCount]->Des());
+             if(nrFileName.Left(1) == KZDrive )
+                 {
+                 delete nonRemovableFiles[nonRemovableFilesCount];
+                 nonRemovableFiles.Remove(nonRemovableFilesCount);
+                 }
+             }
+         // Look for augmentations.
+         if(regEntry.IsAugmentationL())
+             {
+             regEntry.AugmentationsL(augmentationPackages);
+             count = regEntry.AugmentationsNumberL();
+             for (TInt augPkgCount=0; augPkgCount < count; ++augPkgCount)
+                 {
+                 User::LeaveIfError(augmentForRegEntry.OpenL(session,*augmentationPackages[augPkgCount]));
+                 if(EFalse == augmentForRegEntry.RemovableL())
+                     {
+                     INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() get the augmented nonRemovable and registry files");
+                     augmentForRegEntry.FilesL(nonRemovableAugmentedFiles);
+                     augmentForRegEntry.RegistryFilesL(augmentedRegistryFiles);
+                     }
+                 augmentForRegEntry.Close();
+                 }
+             }
+         }
+     AppendNrlisttoExcludeListL(nonRemovableFiles);
+     nonRemovableFiles.ResetAndDestroy();
+     regEntry.Close();
+     }
+    INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() append the list of files to the excludelist ");
+    
+    AppendNrlisttoExcludeListL(nonRemovableAugmentedFiles);
+    AppendNrlisttoExcludeListL(augmentedRegistryFiles);
+    AppendNrlisttoExcludeListL(registryFiles);
+    
+    CleanupStack::PopAndDestroy(9,&session);
+    INFO( "CSelectiveFormatter::HandleNrExcludeListsL() End");
+    }
+
+// ---------------------------------------------------------------------------
+// CSelectiveFormatter::HandleNrExcludeListsL
+// ---------------------------------------------------------------------------
+//
+
+void CSelectiveFormatter::AppendNrlisttoExcludeListL(RPointerArray<HBufC> &aFileNameArr)
+    {
+    INFO( "CSelectiveFormatter::AppendNrlisttoExcludeListL() START ");
+    TInt size = aFileNameArr.Count();
+    CExcludeListEntry* entry;
+    TInt err;
+    for ( TInt i=0; i < size; i++)
+        {
+        entry = CExcludeListEntry::NewL( aFileNameArr[i]->Des() );
+        err = iExcludeList.InsertInOrder( entry, CExcludeListEntry::Compare ); // take ownership
+        if( err != KErrNone )
+            {
+            delete entry; // delete entry if ownership not transferred
+            
+            if( err != KErrAlreadyExists )
+                {
+                INFO_1( "CSelectiveFormatter::AppendNrlisttoExcludeListL() leaves with error code %d",err);
+                User::Leave( err );
+                }
+            }            
+        }
+    INFO( "CSelectiveFormatter::AppendNrlisttoExcludeListL() END ");
+    }
--- a/sysresmonitoring/oommonitor/src/oomclientrequestqueue.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/sysresmonitoring/oommonitor/src/oomclientrequestqueue.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -193,13 +193,17 @@
         {
         RProcess processName;
         err = clientThread.Process(processName);
-        dataPaged = processName.DefaultDataPaged();
+        if(err == KErrNone)
+            {
+            dataPaged = processName.DefaultDataPaged();
+            processName.Close();
+            }
+        clientThread.Close();
         }
     else
         {
         OomMonitorPanic(KInvalidClientRequestType);
-        }
-    
+        }    
     
     switch (request->iClientRequestType)
         {
--- a/sysresmonitoring/oommonitor/src/oomcloseapp.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/sysresmonitoring/oommonitor/src/oomcloseapp.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -59,15 +59,20 @@
     
     RThread thread;
     TInt err=thread.Open(iCurrentTask.ThreadId());
-    if (!err)
+    if (err == KErrNone)
         {
         RProcess process;
-        thread.Process(process);
-        TBool isDataPaged = process.DefaultDataPaged();
-        if((aIsDataPaged && isDataPaged) || (!aIsDataPaged && !isDataPaged ))
+        err = thread.Process(process);
+        if(err == KErrNone)
             {
-            iCurrentTask.EndTask();
+            TBool isDataPaged = process.DefaultDataPaged();
+            if((aIsDataPaged && isDataPaged) || (!aIsDataPaged && !isDataPaged ))
+                {
+                iCurrentTask.EndTask();
+                }                    
+            process.Close();
             }
+        thread.Close();
         }
     }
 
--- a/sysresmonitoring/oommonitor/src/oommemorymonitorsession.cpp	Wed Aug 18 09:58:19 2010 +0300
+++ b/sysresmonitoring/oommonitor/src/oommemorymonitorsession.cpp	Thu Sep 02 20:36:53 2010 +0300
@@ -73,9 +73,12 @@
         if(err == KErrNone)
             {
             dataPaged = processName.DefaultDataPaged();
+            processName.Close();
+            clientThread.Close();
             }
         else
             {
+            clientThread.Close();                        
             PanicClient(aMessage, EPanicIllegalFunction);
             }
         }