--- a/idlehomescreen/xmluirendering/renderingplugins/xnclockfactory/src/xnclockcontrol.cpp Wed Sep 15 12:00:00 2010 +0300
+++ b/idlehomescreen/xmluirendering/renderingplugins/xnclockfactory/src/xnclockcontrol.cpp Wed Oct 13 14:18:30 2010 +0300
@@ -24,7 +24,7 @@
#include "xncontroladapter.h"
#include "xnclockadapter.h"
#include "xnclockface.h"
-#include "xnnodepluginif.h"
+
#include "xnclockcontrol.h"
// Constants
@@ -39,12 +39,12 @@
// might leave.
// -----------------------------------------------------------------------------
//
-CXnClockControl::CXnClockControl( CXnClockAdapter& aAdapter,
+CXnClockControl::CXnClockControl( CXnClockAdapter* aAdapter,
const TBool aFormatFromLocale,
const TClockFormat aFormat )
: iAdapter( aAdapter ),
iClockFormat( aFormat ),
- iFormatFromLocale ( aFormatFromLocale )
+ iFormatFromLocale ( aFormatFromLocale )
{
}
@@ -56,7 +56,7 @@
void CXnClockControl::ConstructL()
{
iTimer = CPeriodic::NewL( CActive::EPriorityHigh );
- iTimeFormat = TLocale().TimeFormat();
+
SetFormatL( iFormatFromLocale, iClockFormat );
}
@@ -65,20 +65,24 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CXnClockControl* CXnClockControl::NewL( CXnClockAdapter& aAdapter,
+CXnClockControl* CXnClockControl::NewL( CXnClockAdapter* aAdapter,
const TBool aFormatFromLocale,
const TClockFormat aFormat )
{
CXnClockControl* self =
new (ELeave) CXnClockControl( aAdapter, aFormatFromLocale, aFormat );
+
CleanupStack::PushL( self );
self->ConstructL();
+
CleanupStack::Pop( self );
+
return self;
}
// -----------------------------------------------------------------------------
// Destructor
+//
// -----------------------------------------------------------------------------
//
CXnClockControl::~CXnClockControl()
@@ -89,6 +93,7 @@
// -----------------------------------------------------------------------------
// CXnClockControl::UpdateDisplay
+// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CXnClockControl::UpdateDisplay()
@@ -98,11 +103,12 @@
return;
}
- iAdapter.UpdateDisplay();
+ iAdapter->UpdateDisplay();
}
// -----------------------------------------------------------------------------
// CXnClockControl::SetFormatL
+// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CXnClockControl::SetFormatL( const TBool aFormatFromLocale,
@@ -116,17 +122,14 @@
}
iFormatFromLocale = aFormatFromLocale;
-
- TTimeFormat timeFormat = TLocale().TimeFormat();
- if( format == iClockFormat && iFace && timeFormat == iTimeFormat )
+ if( format == iClockFormat && iFace )
{
// Already correct face
return;
}
iClockFormat = format;
- iTimeFormat = timeFormat;
delete iFace;
iFace = NULL;
@@ -138,22 +141,12 @@
else if( format == EClockDigital )
{
iFace = CXnClockFaceDigital::NewL();
- }
-
- iAdapter.SetClockFormatL( format );
- }
-
-// -----------------------------------------------------------------------------
-// CXnClockControl::CheckClockFormatL
-// -----------------------------------------------------------------------------
-//
-void CXnClockControl::CheckClockFormatL()
- {
- SetFormatL( iFormatFromLocale, iClockFormat );
+ }
}
// -----------------------------------------------------------------------------
// CXnClockControl::Format
+// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TClockFormat CXnClockControl::Format() const
@@ -163,38 +156,28 @@
// -----------------------------------------------------------------------------
// CXnClockControl::Draw
+// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
-void CXnClockControl::Draw( CWindowGc& aGc, CXnNodePluginIf* aNode,
- CXnNodePluginIf* aAmpm )
+void CXnClockControl::Draw( CWindowGc& aGc, const TRect& aRect )
{
- if ( !aNode )
- {
- return;
- }
+ // Ensure correct appearance
+ TRAP_IGNORE( SetFormatL( iFormatFromLocale, iClockFormat ) );
- if( iFace && !aNode->Rect().IsEmpty() )
+ if( iFace && !aRect.IsEmpty() )
{
__PRINT( __DBG_FORMAT( "CXnClockControl::Draw: 0x%X" ), this );
TTime homeTime;
homeTime.HomeTime();
- TRAP_IGNORE( iFace->DrawL( iAdapter, aGc, *aNode, homeTime, aAmpm ) );
+ TRAP_IGNORE( iFace->DrawL( *iAdapter, aGc, aRect, homeTime ) );
}
}
// -----------------------------------------------------------------------------
-// CXnClockControl::ResetFont
-// -----------------------------------------------------------------------------
-//
-void CXnClockControl::ResetFont()
- {
- iFace->ResetFont();
- }
-
-// -----------------------------------------------------------------------------
// CXnClockControl::TimerCallback
+// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CXnClockControl::TimerCallback( TAny* aThis )
@@ -223,6 +206,7 @@
// -----------------------------------------------------------------------------
// CXnClockControl::StartTimer
+// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CXnClockControl::StartTimer()
@@ -246,6 +230,7 @@
// -----------------------------------------------------------------------------
// CXnClockControl::StopTimer
+// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CXnClockControl::StopTimer()