calendarui/views/src/calenpreviewpane.cpp
changeset 63 a3cb48f6c889
parent 57 bb2d3e476f29
child 64 1881ad52dc45
equal deleted inserted replaced
57:bb2d3e476f29 63:a3cb48f6c889
    72 	mIsNoEntriesAdded = true;
    72 	mIsNoEntriesAdded = true;
    73 	mIsGestureHandled = false;
    73 	mIsGestureHandled = false;
    74 	mNoEntriesLabel = 0;
    74 	mNoEntriesLabel = 0;
    75 	mHtDiff = 0.0;
    75 	mHtDiff = 0.0;
    76 	mScrollDuration = 0;
    76 	mScrollDuration = 0;
       
    77 	mPreviewTextColor = HbColorScheme::color("qtc_cal_day_preview_text");
       
    78 	
    77 	setAcceptDrops(true);
    79 	setAcceptDrops(true);
    78 	setScrollDirections(Qt::Vertical);
    80 	setScrollDirections(Qt::Vertical);
    79 	setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
    81 	setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
    80 	
    82 	
    81 	// Connect the scrollig finished signal
    83 	// Connect the scrollig finished signal
   105 {
   107 {
   106     OstTraceFunctionEntry0( CALENPREVIEWPANE_SETNOENTRIESLABEL_ENTRY );
   108     OstTraceFunctionEntry0( CALENPREVIEWPANE_SETNOENTRIESLABEL_ENTRY );
   107     
   109     
   108 	mNoEntriesLabel = label;
   110 	mNoEntriesLabel = label;
   109 	
   111 	
       
   112 	if (mPreviewTextColor.isValid()) {
       
   113 		mNoEntriesLabel->setTextColor(mPreviewTextColor);
       
   114 	}
   110 	OstTraceFunctionExit0( CALENPREVIEWPANE_SETNOENTRIESLABEL_EXIT );
   115 	OstTraceFunctionExit0( CALENPREVIEWPANE_SETNOENTRIESLABEL_EXIT );
   111 }
   116 }
   112 
   117 
   113 /*!
   118 /*!
   114  Populates the preview with proper data
   119  Populates the preview with proper data
   136 															(content->layout());
   141 															(content->layout());
   137 	int instanceCount = mInstanceArray.count();
   142 	int instanceCount = mInstanceArray.count();
   138 	HbFontSpec font(HbFontSpec::Secondary);
   143 	HbFontSpec font(HbFontSpec::Secondary);
   139 	if (mIsNoEntriesAdded) {
   144 	if (mIsNoEntriesAdded) {
   140 		if (!instanceCount) {
   145 		if (!instanceCount) {
       
   146 			if (mPreviewTextColor.isValid()) {
       
   147 				mNoEntriesLabel->setTextColor(mPreviewTextColor);
       
   148 			}
   141 		    mNoEntriesLabel->setVisible(true);
   149 		    mNoEntriesLabel->setVisible(true);
   142 		    OstTraceFunctionExit0( CALENPREVIEWPANE_POPULATELABEL_EXIT );
   150 		    OstTraceFunctionExit0( CALENPREVIEWPANE_POPULATELABEL_EXIT );
   143 		    return;
   151 		    return;
   144 		} else {
   152 		} else {
   145 			// Remove the no entries label
   153 			// Remove the no entries label
   160 				label = new HbLabel(this);
   168 				label = new HbLabel(this);
   161 				
   169 				
   162 				// Set the required font
   170 				// Set the required font
   163 				label->setFontSpec(font);
   171 				label->setFontSpec(font);
   164 				
   172 				
   165 				// Set the text color from the theme
       
   166 				QColor previewPaneColor = HbColorScheme::color(
       
   167 												"qtc_cal_day_preview_text");
       
   168 				if (previewPaneColor.isValid()) {
       
   169 				    label->setTextColor(previewPaneColor);
       
   170 				}
       
   171 				
       
   172 				// Set the elide mode to right
   173 				// Set the elide mode to right
   173 				label->setElideMode(Qt::ElideRight);
   174 				label->setElideMode(Qt::ElideRight);
   174 				// Add the label to the list
   175 				// Add the label to the list
   175 				mLabelList.append(label);
   176 				mLabelList.append(label);
   176 				layout->addItem(label);
   177 				layout->addItem(label);
   177 			} else {
   178 			} else {
   178 				// Reuse the same label
   179 				// Reuse the same label
   179 				label = mLabelList.at(i);
   180 				label = mLabelList.at(i);
   180 				count--;
   181 				count--;
       
   182 			}
       
   183 			
       
   184 			if (mPreviewTextColor.isValid()) {
       
   185 				label->setTextColor(mPreviewTextColor);
   181 			}
   186 			}
   182 			QString summary = mInstanceArray[i].summary();
   187 			QString summary = mInstanceArray[i].summary();
   183 			if(!summary.length()) {
   188 			if(!summary.length()) {
   184 				// No summary display "Unnamed"
   189 				// No summary display "Unnamed"
   185 				summary.append(hbTrId("txt_calendar_preview_unnamed"));
   190 				summary.append(hbTrId("txt_calendar_preview_unnamed"));
   232 			}
   237 			}
   233 		}
   238 		}
   234 		// Clear the list
   239 		// Clear the list
   235 		mLabelList.clear();
   240 		mLabelList.clear();
   236 		
   241 		
       
   242 		if (mPreviewTextColor.isValid()) {
       
   243 			mNoEntriesLabel->setTextColor(mPreviewTextColor);
       
   244 		}
   237 		// Add the no entries text to the preview pane
   245 		// Add the no entries text to the preview pane
   238 		mNoEntriesLabel->setVisible(true);
   246 		mNoEntriesLabel->setVisible(true);
   239 		mIsNoEntriesAdded = true;
   247 		mIsNoEntriesAdded = true;
   240 	}
   248 	}
   241 	layout->activate();
   249 	layout->activate();
   429     } else if(QTapGesture *tapGesture = qobject_cast<QTapGesture *>(event->gesture(Qt::TapGesture))) {
   437     } else if(QTapGesture *tapGesture = qobject_cast<QTapGesture *>(event->gesture(Qt::TapGesture))) {
   430         if (tapGesture && tapGesture->state() == Qt::GestureFinished) {
   438         if (tapGesture && tapGesture->state() == Qt::GestureFinished) {
   431             	HbInstantFeedback::play(HbFeedback::Basic);
   439             	HbInstantFeedback::play(HbFeedback::Basic);
   432                 // Preview pane tapped
   440                 // Preview pane tapped
   433                 mServices.IssueCommandL(ECalenAgendaView);
   441                 mServices.IssueCommandL(ECalenAgendaView);
       
   442                 mView->disconnectAboutToQuitEvent();
   434                 event->accept(Qt::TapGesture);
   443                 event->accept(Qt::TapGesture);
   435         }
   444         }
   436     }
   445     }
   437     
   446     
   438     OstTraceFunctionExit0( DUP2_CALENPREVIEWPANE_GESTUREEVENT_EXIT );
   447     OstTraceFunctionExit0( DUP3_CALENPREVIEWPANE_GESTUREEVENT_EXIT );
   439 }
   448 }
   440 
   449 
   441 /*!
   450 /*!
   442  Set monthview pointer
   451  Set monthview pointer
   443  */
   452  */
   497 void CalenPreviewPane::effectFinished()
   506 void CalenPreviewPane::effectFinished()
   498 {
   507 {
   499     mIsGestureHandled = false;
   508     mIsGestureHandled = false;
   500 }
   509 }
   501 
   510 
       
   511 /*!
       
   512  Slot to handle the change in theme
       
   513  */
       
   514 void CalenPreviewPane::handleThemeChange()
       
   515 {
       
   516     OstTraceFunctionEntry0( CALENPREVIEWPANE_HANDLETHEMECHANGE_ENTRY );
       
   517     
       
   518     mPreviewTextColor = HbColorScheme::color("qtc_cal_day_preview_text");
       
   519     
       
   520     OstTraceFunctionExit0( CALENPREVIEWPANE_HANDLETHEMECHANGE_EXIT );
       
   521 }
       
   522 
   502 // End of file  --Don't remove this.
   523 // End of file  --Don't remove this.