calendarui/regionalplugins/lunarchinese/src/CalenLunarChinesePlugin.cpp
changeset 70 a5ed90760192
parent 64 1881ad52dc45
child 89 b57382753122
equal deleted inserted replaced
64:1881ad52dc45 70:a5ed90760192
   128 // -----------------------------------------------------------------------------
   128 // -----------------------------------------------------------------------------
   129 //
   129 //
   130 void CCalenLunarChinesePlugin::ConstructL()
   130 void CCalenLunarChinesePlugin::ConstructL()
   131 	{
   131 	{
   132     OstTraceFunctionEntry0( CCALENLUNARCHINESEPLUGIN_CONSTRUCTL_ENTRY );
   132     OstTraceFunctionEntry0( CCALENLUNARCHINESEPLUGIN_CONSTRUCTL_ENTRY );
   133     iServices->RegisterForNotificationsL( this, ECalenNotifyContextChanged );
   133     
       
   134     RArray<TCalenNotification> notifications;
       
   135     notifications.Append(ECalenNotifyContextChanged);
       
   136     notifications.Append(ECalenNotifyCloseDialogs);
       
   137     
       
   138     iServices->RegisterForNotificationsL( this, notifications );
       
   139     
       
   140     notifications.Close();
       
   141     
       
   142     
   134 	iServices->GetCommandRange( iStart, iEnd );
   143 	iServices->GetCommandRange( iStart, iEnd );
   135 	
   144 	
   136 	// Install the translator before the CCalenLunarLocalizer is constructed
   145 	// Install the translator before the CCalenLunarLocalizer is constructed
   137 	iTranslator = new HbTranslator("calenregional");
   146 	iTranslator = new HbTranslator("calenregional");
   138 	
   147 	
   297 //	
   306 //	
   298 void CCalenLunarChinesePlugin::HandleNotification( 
   307 void CCalenLunarChinesePlugin::HandleNotification( 
   299 										const TCalenNotification aNotification )
   308 										const TCalenNotification aNotification )
   300 	{
   309 	{
   301 	OstTraceFunctionEntry0( CCALENLUNARCHINESEPLUGIN_HANDLENOTIFICATION_ENTRY );
   310 	OstTraceFunctionEntry0( CCALENLUNARCHINESEPLUGIN_HANDLENOTIFICATION_ENTRY );
   302 	if (aNotification == ECalenNotifyContextChanged)
   311 	if (aNotification == ECalenNotifyContextChanged) {
   303         {
   312 		TRAP_IGNORE(UpdateLocalizerInfoL());
   304         TRAP_IGNORE(UpdateLocalizerInfoL());
   313 	} else if(aNotification == ECalenNotifyCloseDialogs) {
   305         }
   314 		if(mPopup){
       
   315 			//close the popup
       
   316 			mPopup->done(0);
       
   317 		}
       
   318 	}
   306 	OstTraceFunctionExit0( CCALENLUNARCHINESEPLUGIN_HANDLENOTIFICATION_EXIT );
   319 	OstTraceFunctionExit0( CCALENLUNARCHINESEPLUGIN_HANDLENOTIFICATION_EXIT );
   307 	}
   320 	}
   308 
   321 
   309 // -----------------------------------------------------------------------------
   322 // -----------------------------------------------------------------------------
   310 // CCalenLunarChinesePlugin::ShowDetailsL
   323 // CCalenLunarChinesePlugin::ShowDetailsL
   357 // CCalenLunarChinesePlugin::ExecuteMessageDialogL
   370 // CCalenLunarChinesePlugin::ExecuteMessageDialogL
   358 // -----------------------------------------------------------------------------
   371 // -----------------------------------------------------------------------------
   359 //
   372 //
   360 void CCalenLunarChinesePlugin::ExecuteMessageDialogL(QString aMsgText)
   373 void CCalenLunarChinesePlugin::ExecuteMessageDialogL(QString aMsgText)
   361 	{
   374 	{
   362 	OstTraceFunctionEntry0( CCALENLUNARCHINESEPLUGIN_EXECUTEMESSAGEDIALOGL_ENTRY );
   375     OstTraceFunctionEntry0( CCALENLUNARCHINESEPLUGIN_EXECUTEMESSAGEDIALOGL_ENTRY );
   363 	// Instantiate a popup
   376 
   364 	HbMessageBox *popup = new HbMessageBox();
   377     // Instantiate a popup
   365 	popup->setDismissPolicy(HbDialog::NoDismiss);
   378     mPopup = new HbMessageBox();
   366 	popup->setTimeout(HbDialog::NoTimeout);
   379     mPopup->setDismissPolicy(HbDialog::NoDismiss);
   367 	popup->setIconVisible(false);
   380     mPopup->setTimeout(HbDialog::NoTimeout);
   368 	popup->setAttribute( Qt::WA_DeleteOnClose, true );
   381     mPopup->setIconVisible(false);
   369 	
   382     mPopup->setAttribute(Qt::WA_DeleteOnClose, true);
   370 	popup->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_title_lunar_calendar")));
   383 
   371 	popup->setText(aMsgText);
   384     mPopup->setHeadingWidget(new HbLabel(hbTrId(
   372 	
   385             "txt_calendar_title_lunar_calendar")));
   373 	// Remove the default actions
   386     mPopup->setText(aMsgText);
   374 	QList<QAction*> list = popup->actions();
   387 
   375 	for(int i=0; i < list.count(); i++)
   388     // Remove the default actions
   376 	{
   389     QList<QAction*> list = mPopup->actions();
   377 		popup->removeAction(list[i]);
   390     for (int i = 0; i < list.count(); i++)
   378 	}
   391         {
   379 	// Sets the primary action
   392         mPopup->removeAction(list[i]);
   380 	popup->addAction(new HbAction(hbTrId("txt_common_button_close_singledialog"), popup));
   393         }
   381 
   394     // Sets the primary action
   382 	// Launch popup
   395     mPopup->addAction(new HbAction(hbTrId(
   383 	popup->open();
   396             "txt_common_button_close_singledialog"), mPopup));
   384 	OstTraceFunctionExit0( CCALENLUNARCHINESEPLUGIN_EXECUTEMESSAGEDIALOGL_EXIT );
   397 
   385 	}
   398     // Launch popup
       
   399     mPopup->open();
       
   400 
       
   401     OstTraceFunctionExit0( CCALENLUNARCHINESEPLUGIN_EXECUTEMESSAGEDIALOGL_EXIT );
       
   402     }
   386 //EOF
   403 //EOF
   387 
   404 
   388 
   405