diff -r 12af337248b1 -r bd7edf625bdd calendarui/regionalplugins/Thai/src/CalenThaiPlugin.cpp --- a/calendarui/regionalplugins/Thai/src/CalenThaiPlugin.cpp Tue Aug 31 15:13:43 2010 +0300 +++ b/calendarui/regionalplugins/Thai/src/CalenThaiPlugin.cpp Wed Sep 01 12:32:31 2010 +0100 @@ -11,19 +11,25 @@ * * Contributors: * -* Description: +* Description: Calendar Thai Plugin. * */ + #include "calendarui_debug.h" -#include - #include +#include #include -#include -#include -#include +#include +#include +#include + +#include +#include +#include + + #include "CalenThaiPlugin.h" @@ -71,13 +77,25 @@ CCalenThaiPlugin::~CCalenThaiPlugin() { TRACE_ENTRY_POINT; - - if (iServices) + + if(iLabelControl) + { + delete iLabelControl; + iLabelControl = NULL; + } + + if(iInfoBarText) + { + delete iInfoBarText; + iInfoBarText = NULL; + } + + if ( iServices ) { iServices->CancelNotifications(this); iServices->Release(); } - + TRACE_EXIT_POINT; } @@ -86,7 +104,8 @@ // ---------------------------------------------------------------------------- // CCalenThaiPlugin::CCalenThaiPlugin(MCalenServices* aServices) - : iServices(aServices) + : iServices(aServices), + iInfoBarText(NULL) { TRACE_ENTRY_POINT; TRACE_EXIT_POINT; @@ -99,7 +118,31 @@ void CCalenThaiPlugin::ConstructL() { TRACE_ENTRY_POINT; - iServices->RegisterForNotificationsL(this, ECalenNotifyContextChanged); + iServices->RegisterForNotificationsL( this, ECalenNotifyContextChanged ); + iLabelControl = CCalenPluginLabel::NewL(*this); + TRACE_EXIT_POINT; + } + +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::SetLabelContentL +// ---------------------------------------------------------------------------- +// +void CCalenThaiPlugin::SetLabelContentL( CEikLabel& aLabel ) + { + TRACE_ENTRY_POINT; + const CFont* labelFont = NULL; + labelFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont,NULL); + aLabel.SetFont( labelFont ); + aLabel.SetLabelAlignment(ELayoutAlignCenter); + aLabel.SetTextL( iThaiYearText ); + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + TRgb color; + TInt error = AknsUtils::GetCachedColor(skin, color, + KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); + if (error == KErrNone) + { + aLabel.OverrideColorL(EColorLabelText, color); + } TRACE_EXIT_POINT; } @@ -115,6 +158,26 @@ TRACE_EXIT_POINT; } +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::GetCustomViewsL +// ---------------------------------------------------------------------------- +// +void CCalenThaiPlugin::GetCustomViewsL( RPointerArray& + /*aCustomViewArray */) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + } +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::GetCustomSettingsL +// ---------------------------------------------------------------------------- +// +void CCalenThaiPlugin::GetCustomSettingsL( RPointerArray& + /*aCustomSettingArray */) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + } // ---------------------------------------------------------------------------- // CCalenThaiPlugin::HandleCommandL @@ -127,50 +190,97 @@ TRACE_EXIT_POINT; return EFalse; } + +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::CalenCommandHandlerExtensionL +// +// ---------------------------------------------------------------------------- +// +TAny* CCalenThaiPlugin::CalenCommandHandlerExtensionL( TUid /*aExtensionUid*/ ) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + return NULL; + } + // ---------------------------------------------------------------------------- // CCalenThaiPlugin::InfobarL // This function is called in case of Avkon views // ---------------------------------------------------------------------------- // -HbWidget* CCalenThaiPlugin::InfobarL( ) +CCoeControl* CCalenThaiPlugin::InfobarL( const TRect& aRect ) { TRACE_ENTRY_POINT; - - CalenPluginLabel* labelControl = new CalenPluginLabel(); - TRAP_IGNORE(UpdateLocalizerInfoL()); - QString text = QString::fromUtf16(iThaiYearText.Ptr(), - iThaiYearText.Length()); - labelControl->setPlainText(text); + if(!iLabelControl) + { + return NULL; + } + + //Update the local information based on current context + //from framework. + UpdateLocalizerInfoL(); + //Set the content for the label + iLabelControl->SetRect(aRect); + SetLabelContentL(*iLabelControl); TRACE_EXIT_POINT; - return labelControl; - + return iLabelControl; } // ---------------------------------------------------------------------------- -// CCalenThaiPlugin::InfobarTextL -// This function is called to get Infobar text +// CCalenThaiPlugin::InfobarL +// This function is called in case of Hitchcock views // ---------------------------------------------------------------------------- // -QString* CCalenThaiPlugin::InfobarTextL() +const TDesC& CCalenThaiPlugin::InfobarL() { - TRACE_ENTRY_POINT; - TRAP_IGNORE(UpdateLocalizerInfoL()); - QString text = QString::fromUtf16(iThaiYearText.Ptr(),iThaiYearText.Length()); - TRACE_EXIT_POINT; - return (new QString(text)); + TRACE_ENTRY_POINT; + if(iInfoBarText) + { + delete iInfoBarText; + iInfoBarText = NULL; + } + + //Update the local information based on current context + //from framework. + UpdateLocalizerInfoL(); + iInfoBarText = iThaiYearText.AllocLC(); + CleanupStack::Pop(); + + TRACE_EXIT_POINT; + return *iInfoBarText; } // ---------------------------------------------------------------------------- -// CCalenThaiPlugin::CustomiseMenu -// This function is called to add menuitem +// CCalenThaiPlugin::CustomPreviewPaneL +// ---------------------------------------------------------------------------- +// +MCalenPreview* CCalenThaiPlugin::CustomPreviewPaneL( TRect& /*aRect*/ ) + { + TRACE_ENTRY_POINT + TRACE_EXIT_POINT + return NULL; + } + +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::PreviewPaneL // ---------------------------------------------------------------------------- // -void CCalenThaiPlugin::CustomiseMenu(HbMenu* aHbMenu) - { - TRACE_ENTRY_POINT; - Q_UNUSED(aHbMenu); - TRACE_EXIT_POINT; - } +CCoeControl* CCalenThaiPlugin::PreviewPaneL( TRect& /*aRect*/ ) + { + TRACE_ENTRY_POINT; + UpdateLocalizerInfoL(); + if(iLabelControl) + { + delete iLabelControl; + iLabelControl = NULL; + } + iLabelControl = CCalenPluginLabel::NewL(*this); + SetLabelContentL(*iLabelControl); + + TRACE_EXIT_POINT; + return iLabelControl; + } + // ---------------------------------------------------------------------------- // CCalenThaiPlugin::HandleNotification // ---------------------------------------------------------------------------- @@ -186,44 +296,122 @@ } // ---------------------------------------------------------------------------- -// CCalenEditorsPlugin::CommandHandlerL +// CCalenThaiPlugin::CommandHandlerL // ---------------------------------------------------------------------------- - -MCalenCommandHandler* CCalenThaiPlugin::CommandHandlerL( TInt aCommand ) +// +MCalenCommandHandler* CCalenThaiPlugin::CommandHandlerL( TInt + /*aCommand*/) { TRACE_ENTRY_POINT; - Q_UNUSED(aCommand); - TRACE_EXIT_POINT; - return NULL; + TRACE_EXIT_POINT; + return NULL; + } +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::RemoveViewsFromCycle +// ---------------------------------------------------------------------------- +// +void CCalenThaiPlugin::RemoveViewsFromCycle( RArray& /*aViews*/ ) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; } - -CalenPluginLabel::CalenPluginLabel(QGraphicsItem* parent) - :HbLabel(parent) +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::CanBeEnabledDisabled +// ---------------------------------------------------------------------------- +// +TBool CCalenThaiPlugin::CanBeEnabledDisabled() { - TRACE_ENTRY_POINT; - - setAlignment(Qt::AlignCenter); - setTextColor(Qt::blue); - setTextWrapping(Hb::TextWrapping); - setOpacity(12); - TRACE_EXIT_POINT; + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + return ETrue; } -CalenPluginLabel::~CalenPluginLabel() +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::CalenCustomisationExtensionL +// ---------------------------------------------------------------------------- +// +TAny* CCalenThaiPlugin::CalenCustomisationExtensionL( TUid /*aExtensionUid*/ ) { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + return NULL; + } +// ---------------------------------------------------------------------------- +// CCalenThaiPlugin::CustomiseMenuPaneL +// ---------------------------------------------------------------------------- +// +TBool CCalenThaiPlugin::CustomiseMenuPaneL( TInt /*aResourceId*/, + CEikMenuPane* /*aMenuPane*/) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + return EFalse; + } +// ---------------------------------------------------------------------------- +// CCalenPluginLabel::NewL +// ---------------------------------------------------------------------------- +// +CCalenPluginLabel* CCalenPluginLabel::NewL(CCalenThaiPlugin& aPlugin) + { + TRACE_ENTRY_POINT; + CCalenPluginLabel* self = new(ELeave)CCalenPluginLabel(aPlugin); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + TRACE_EXIT_POINT; + return self; + } + +// ---------------------------------------------------------------------------- +// CCalenPluginLabel::CCalenPluginLabel +// ---------------------------------------------------------------------------- +// +CCalenPluginLabel::CCalenPluginLabel(CCalenThaiPlugin& aPlugin) : iPlugin(aPlugin) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + } + +// ---------------------------------------------------------------------------- +// CCalenPluginLabel::ConstructL +// ---------------------------------------------------------------------------- +// +void CCalenPluginLabel::ConstructL() + { TRACE_ENTRY_POINT; TRACE_EXIT_POINT; - } - -void CalenPluginLabel::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget ) - { + } +// ---------------------------------------------------------------------------- +// CCalenPluginLabel::~CCalenPluginLabel +// ---------------------------------------------------------------------------- +// +CCalenPluginLabel::~CCalenPluginLabel() + { TRACE_ENTRY_POINT; - Q_UNUSED(painter); - Q_UNUSED(option); - Q_UNUSED(widget); - TRACE_EXIT_POINT; - } + TRACE_EXIT_POINT; + } +// ---------------------------------------------------------------------------- +// CCalenPluginLabel::Draw +// ---------------------------------------------------------------------------- +// +void CCalenPluginLabel::Draw( const TRect& aRect) const + { + TRACE_ENTRY_POINT; + CEikLabel::Draw(aRect); + TRACE_EXIT_POINT; + } +// ---------------------------------------------------------------------------- +// CCalenPluginLabel::HandlePointerEventL +// ---------------------------------------------------------------------------- +// +void CCalenPluginLabel::HandlePointerEventL(const TPointerEvent& + /*aPointerEvent*/) + { + TRACE_ENTRY_POINT; + TRACE_EXIT_POINT; + } + //EOF