securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp
branchRCL_3
changeset 50 03674e5abf46
parent 49 09b1ac925e3f
--- a/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp	Tue Aug 31 16:04:40 2010 +0300
+++ b/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp	Wed Sep 01 12:19:59 2010 +0100
@@ -23,8 +23,23 @@
 #include "SecUiAutoLockSettingPage.h"
 #include "secui.hrh"
 #include <featmgr.h>
-
-
+/**
+*CAutolockQuery used in autolock period query
+*/
+class CAutolockQuery
+	: public CAknNumberQueryDialog
+	{
+	public: // Constructors and destructors
+		/**
+		* C++ constructor.
+		*/
+		CAutolockQuery(TInt& aNumber,const TTone aTone = ENoTone);
+	protected: // From base classes
+		/**
+		* From CCAknNumberQueryDialog 
+		*/
+		void PreLayoutDynInitL();
+	};
 //
 // ----------------------------------------------------------
 // CAutoLockSettingPage::CAutoLockSettingPage()
@@ -32,9 +47,10 @@
 // ----------------------------------------------------------
 // 
 CAutoLockSettingPage::CAutoLockSettingPage(TInt aResourceId, TInt& aCurrentSelectionItem, CDesCArrayFlat* aItemArray, TInt& aAutoLockValue) : 
-					CBase(),iAutoLockValue(aAutoLockValue)
+					CAknRadioButtonSettingPage(aResourceId, aCurrentSelectionItem, aItemArray),iAutoLockValue(aAutoLockValue)
 
 	{
+        iOriginalIndex = aCurrentSelectionItem;
 	}
 
 //
@@ -45,6 +61,9 @@
 // 
 void CAutoLockSettingPage::ConstructL()
 	{
+	CAknRadioButtonSettingPage::ConstructL();
+	const TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels();
+	FeatureManager::InitializeLibL();
 	}
 
 //
@@ -55,6 +74,7 @@
 // 
 CAutoLockSettingPage::~CAutoLockSettingPage()
 	{
+	FeatureManager::UnInitializeLib();
 	}
 
 //
@@ -65,7 +85,54 @@
 // 
 void CAutoLockSettingPage::ProcessCommandL(TInt aCommandId)
 	{
-	
+	TInt cur = ListBoxControl()->CurrentItemIndex();
+	// Respond to softkey events
+
+	switch (aCommandId)
+		{
+		case EAknSoftkeySelect:
+		case EAknSoftkeyOk:
+			// autolock off
+			if (cur == 0)
+				{
+				iAutoLockValue = 0;
+				if(iOriginalIndex == 0)
+				    { //User re-selected "Autolock off"; no use in changing lock setting
+				        AttemptExitL(EFalse);
+				    }
+				else
+				    {
+				        AttemptExitL(ETrue);
+				    }
+				
+				}
+			// user defined
+			if (cur == 1)
+				{
+				CAutolockQuery* dlg = new (ELeave) CAutolockQuery(iAutoLockValue);
+				dlg->PrepareLC(R_AUTOLOCK_TIME_QUERY);
+				if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
+				{
+				//set min and max values from SCP server to the dialog.
+				TInt minimum = 0;
+				if(iMaximum <= 0) //maximum value has not been defined; default value used instead.
+				    iMaximum = 1440;
+				dlg->SetMinimumAndMaximum(minimum, iMaximum);
+			}
+				if(dlg->RunLD())
+					{
+					AttemptExitL(ETrue);
+					}
+				else
+					AttemptExitL(EFalse);
+				}
+			break;
+
+		default:
+			CAknSettingPage::ProcessCommandL(aCommandId);
+			break;
+		}
+
 	}
 //
 // ----------------------------------------------------------
@@ -75,6 +142,10 @@
 // 
 void CAutoLockSettingPage::SetPeriodMaximumValue(TInt aMaximumValue)
 	{
+	if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
+	{
+		iMaximum = aMaximumValue;
+}
 	}
 	
 //---------------------------------------------------------------------------------------
@@ -86,6 +157,80 @@
 
 void CAutoLockSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent)
     {
-    }
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        	TInt cur = ListBoxControl()->CurrentItemIndex();
+         	CAknRadioButtonSettingPage::HandlePointerEventL(aPointerEvent);
+         	//only take into account the "Up" event. Otherwise we'll end up having 2 dialogs.
+         	if(aPointerEvent.iType == TPointerEvent::EButton1Up)
+         	{
+
+         	    //only react to the event if the pen is actually inside the dialog.
+         	    if(ListBoxControl()->Rect().Contains(aPointerEvent.iPosition))
+         	        {
+         	            // autolock off
+        				if (cur == 0)
+        					{
+        					    iAutoLockValue = 0;
+        						if(iOriginalIndex == 0)
+                				    { //User re-selected "Autolock off"; no use in changing lock setting
+                				        AttemptExitL(EFalse);
+                				    }
+                				else
+                				    {
+                				        AttemptExitL(ETrue);
+                				    }
+        					}
+        				// user defined
+        				if (cur == 1)
+        					{
+        					CAutolockQuery* dlg = new (ELeave) CAutolockQuery(iAutoLockValue);
+						dlg->PrepareLC(R_AUTOLOCK_TIME_QUERY);
+					if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
+					{
+        					//set min and max values from SCP server to the dialog.
+        					TInt minimum = 0;			
+				          if(iMaximum <= 0) //maximum value has not been defined; default value used instead.
+				            iMaximum = 1440;        						
+        					dlg->SetMinimumAndMaximum(minimum, iMaximum);
+				}
+        					if(dlg->RunLD())
+        						{
+        						AttemptExitL(ETrue);
+        						}
+        					else
+        						AttemptExitL(EFalse);
+         	        }
+         		
+				}
+		    }
+         	}
+        }
+//
+// ---------------------------------------------------------
+// CAutolockQuery::CAutolockQuery()
+// 
+// ---------------------------------------------------------
+//
+CAutolockQuery::CAutolockQuery(TInt& aNumber,const TTone aTone)
+	: CAknNumberQueryDialog( aNumber, aTone)
+	{
+	}
+	
+//
+// ---------------------------------------------------------
+// CAutolockQuery::PreLayoutDynInitL()
+// 
+// ---------------------------------------------------------
+//
+void CAutolockQuery::PreLayoutDynInitL()
+	{
+	CAknNumberQueryDialog::PreLayoutDynInitL();
+	if (iNumber == 0)
+		{
+		MakeLeftSoftkeyVisible(EFalse);
+		}
+	}
+    
 // End of file