calendarwidgetplugin/src/contentlayouthandler.cpp
changeset 1 f8e7eccf5f96
parent 0 db1bf15cefff
child 2 a4a7966c042b
equal deleted inserted replaced
0:db1bf15cefff 1:f8e7eccf5f96
   137     unsigned long int key = (unsigned long int)ECalPubSubEventNotification;
   137     unsigned long int key = (unsigned long int)ECalPubSubEventNotification;
   138     XQSettingsKey calendarKey(XQSettingsKey::TargetPublishAndSubscribe,
   138     XQSettingsKey calendarKey(XQSettingsKey::TargetPublishAndSubscribe,
   139         KCalPubSubCategory.iUid, key);
   139         KCalPubSubCategory.iUid, key);
   140     mCalendarKeyManager->stopMonitoring(calendarKey);
   140     mCalendarKeyManager->stopMonitoring(calendarKey);
   141     delete mCalendarKeyManager;
   141     delete mCalendarKeyManager;
       
   142     delete mDateObserver;
   142 }
   143 }
   143 
   144 
   144 /*
   145 /*
   145  * ContentLayoutHandler::initializeLayout()
   146  * ContentLayoutHandler::initializeLayout()
   146  */
   147  */
   264     LOGS("ContentLayoutHandler::updateLayout");
   265     LOGS("ContentLayoutHandler::updateLayout");
   265     decorateContent();
   266     decorateContent();
   266     setTimerForNextUpdate();
   267     setTimerForNextUpdate();
   267     //From DateIconLayoutHandler
   268     //From DateIconLayoutHandler
   268     setCalendarIconContent();
   269     setCalendarIconContent();
       
   270     
       
   271     //test signal
       
   272     emit calendarChanged();
   269 }
   273 }
   270 
   274 
   271 /*
   275 /*
   272  * ContentLayoutHandler::onThemeChange()
   276  * ContentLayoutHandler::onThemeChange()
   273  */
   277  */
   288     if (mSeparatorLayoutItem) {
   292     if (mSeparatorLayoutItem) {
   289         mSeparatorLayoutItem->frameDrawer().themeChanged();
   293         mSeparatorLayoutItem->frameDrawer().themeChanged();
   290     }
   294     }
   291     
   295     
   292     setLabelsColor();
   296     setLabelsColor();
       
   297     //test results
       
   298     mTestID = 1;
       
   299     emit themeChanged();
   293 }
   300 }
   294 
   301 
   295 /*
   302 /*
   296  * ContentLayoutHandler::createAgendaUtilsInstance()
   303  * ContentLayoutHandler::createAgendaUtilsInstance()
   297  */
   304  */
   405 void ContentLayoutHandler::eventTimerExpired()
   412 void ContentLayoutHandler::eventTimerExpired()
   406 {
   413 {
   407     LOGS("ContentLayoutHandler::eventTimerExpired");
   414     LOGS("ContentLayoutHandler::eventTimerExpired");
   408     decorateContent();
   415     decorateContent();
   409     setTimerForNextUpdate();
   416     setTimerForNextUpdate();
       
   417     //test signal
       
   418     emit timerExpired();
   410 }
   419 }
   411 
   420 
   412 /*
   421 /*
   413  * ContentLayoutHandler::timeToNextCheck()
   422  * ContentLayoutHandler::timeToNextCheck()
   414  */
   423  */
   931             i++;
   940             i++;
   932         }
   941         }
   933     }
   942     }
   934 }
   943 }
   935 
   944 
   936 void ContentLayoutHandler::handleOk(const QVariant& var)
       
   937 {
       
   938     Q_UNUSED(var);
       
   939 
       
   940     LOGS("ContentLayoutHandler::handleOk");
       
   941     mTestResult = 0;
       
   942     emit requestComplete();
       
   943 }
       
   944 
       
   945 void ContentLayoutHandler::handleError(int err, const QString& str)
       
   946 {
       
   947     Q_UNUSED(str);
       
   948 
       
   949     LOGS("ContentLayoutHandler::handleError");
       
   950     mTestResult = err;
       
   951     emit requestError();
       
   952 }
       
   953 
       
   954 void ContentLayoutHandler::highlightOn(QPointF &point)
   945 void ContentLayoutHandler::highlightOn(QPointF &point)
   955 {
   946 {
       
   947     LOGS("ContentLayoutHandler::highlightOn");
   956     // --- Content layout ---
   948     // --- Content layout ---
   957     
   949     
   958     if (mContainer) {
   950     if (mContainer) {
   959         if (mContainer->sceneBoundingRect().contains(point)) {
   951         //traslate the container rect to right position according to the scene
       
   952         QRectF layoutRect( QPointF( mContainer->rect().topLeft().x() + mContainer->pos().x(), mContainer->rect().topLeft().y() + mContainer->pos().y() ), 
       
   953                            QPointF( mContainer->rect().bottomRight().x() + mContainer->pos().x(), mContainer->rect().bottomRight().y() + mContainer->pos().y() ));
       
   954         
       
   955         if ( layoutRect.contains(point) ) {
   960             LOGS("[[[Highlight signal in Content area]]]");
   956             LOGS("[[[Highlight signal in Content area]]]");
   961             if (!mContentHighlightActive) {
   957             if (!mContentHighlightActive) {
   962                 HbFrameDrawer* highlightDrawer = new HbFrameDrawer(HIGHLIGHT_IMAGE_NAME,
   958                 HbFrameDrawer* highlightDrawer = new HbFrameDrawer(HIGHLIGHT_IMAGE_NAME,
   963                     HbFrameDrawer::NinePieces);
   959                     HbFrameDrawer::NinePieces);
   964                 HbFrameItem* highlightItem = new HbFrameItem(highlightDrawer);
   960                 HbFrameItem* highlightItem = new HbFrameItem(highlightDrawer);
   973     // --- Date layout ---
   969     // --- Date layout ---
   974     
   970     
   975     // TODO Don't highlight if already highlighted
   971     // TODO Don't highlight if already highlighted
   976    
   972    
   977     if (mIconContainer) {
   973     if (mIconContainer) {
   978         if (mIconContainer->sceneBoundingRect().contains(point)) {
   974         //traslate the container rect to right position according to the scene        
       
   975         QRectF layoutRect( QPointF( mIconContainer->rect().topLeft().x() + mIconContainer->pos().x(), mIconContainer->rect().topLeft().y() + mIconContainer->pos().y() ), 
       
   976                            QPointF( mIconContainer->rect().bottomRight().x() + mIconContainer->pos().x(), mIconContainer->rect().bottomRight().y() + mIconContainer->pos().y() ));
       
   977         
       
   978         if ( layoutRect.contains(point) ) {
   979             LOGS("[[[Highlight signal in dateicon area]]]");
   979             LOGS("[[[Highlight signal in dateicon area]]]");
   980             if (!mDateHighlightActive) {
   980             if (!mDateHighlightActive) {
   981                 HbFrameDrawer* highlightDrawer = new HbFrameDrawer(HIGHLIGHT_IMAGE_NAME,
   981                 HbFrameDrawer* highlightDrawer = new HbFrameDrawer(HIGHLIGHT_IMAGE_NAME,
   982                     HbFrameDrawer::NinePieces);
   982                     HbFrameDrawer::NinePieces);
   983                 HbFrameItem* highlightItem = new HbFrameItem(highlightDrawer);
   983                 HbFrameItem* highlightItem = new HbFrameItem(highlightDrawer);
   994     }
   994     }
   995 }
   995 }
   996 
   996 
   997 void ContentLayoutHandler::highlightOff()
   997 void ContentLayoutHandler::highlightOff()
   998 {
   998 {
       
   999     LOGS("ContentLayoutHandler::highlightOff");
   999     // --- Content layout ---
  1000     // --- Content layout ---
  1000     
       
  1001     if (mContentHighlightActive) {
  1001     if (mContentHighlightActive) {
  1002         QGraphicsItem* background1 = mContainer->backgroundItem();
  1002         QGraphicsItem* background1 = mContainer->backgroundItem();
  1003         if (background1) {
  1003         if (background1) {
  1004             background1->hide();
  1004             background1->hide();
  1005         }
  1005         }
  1035  * ContentLayoutHandler::setTestId()
  1035  * ContentLayoutHandler::setTestId()
  1036  */
  1036  */
  1037 void ContentLayoutHandler::setTestId(int testID)
  1037 void ContentLayoutHandler::setTestId(int testID)
  1038 {
  1038 {
  1039     mTestID = testID;
  1039     mTestID = testID;
  1040 }
       
  1041 
       
  1042 /*
       
  1043  * ContentLayoutHandler::testResult()
       
  1044  */
       
  1045 int ContentLayoutHandler::testResult()
       
  1046 {
       
  1047     return mTestResult;
       
  1048 }
       
  1049 
       
  1050 /*
       
  1051  * ContentLayoutHandler::setTestResult
       
  1052  */
       
  1053 void ContentLayoutHandler::setTestResult(int testResult)
       
  1054 {
       
  1055     mTestResult = testResult;
       
  1056 }
  1040 }
  1057 
  1041 
  1058 /*
  1042 /*
  1059  * ContentLayoutHandler::setTimerForNextUpdate()
  1043  * ContentLayoutHandler::setTimerForNextUpdate()
  1060  */
  1044  */