calendarwidgetplugin/src/contentlayouthandler.cpp
changeset 3 b2d662d68a49
parent 2 a4a7966c042b
child 4 6ea82847f1b7
equal deleted inserted replaced
2:a4a7966c042b 3:b2d662d68a49
   331     setLabelVisible(mMiddleLabel, false);
   331     setLabelVisible(mMiddleLabel, false);
   332     setLabelVisible(mUpperLabelShort, false);
   332     setLabelVisible(mUpperLabelShort, false);
   333     setLabelVisible(mUpperLabelLong, false);
   333     setLabelVisible(mUpperLabelLong, false);
   334     setLabelVisible(mLowerLabel, false);
   334     setLabelVisible(mLowerLabel, false);
   335     setLabelVisible(mReminderLabel, false);
   335     setLabelVisible(mReminderLabel, false);
       
   336     mReminderVisible = false;
       
   337     mUpperLabelLongVisible = false;
       
   338     mUpperLabelShortVisible = false;
   336 }
   339 }
   337 
   340 
   338 /*
   341 /*
   339  * ContentLayoutHandler::setLabelsColor()
   342  * ContentLayoutHandler::setLabelsColor()
   340  */
   343  */
   878     LOGS("ContentLayoutHandler::checkOverlappingEvents");
   881     LOGS("ContentLayoutHandler::checkOverlappingEvents");
   879     int overlappingEvents = 0;
   882     int overlappingEvents = 0;
   880     AgendaEntry entry = mAgendaEntryList.at(id);
   883     AgendaEntry entry = mAgendaEntryList.at(id);
   881     for (int i = id + 1; i < mAgendaEntryList.count(); i++) {
   884     for (int i = id + 1; i < mAgendaEntryList.count(); i++) {
   882         if ((entry.startTime() <= mAgendaEntryList.at(i).startTime())
   885         if ((entry.startTime() <= mAgendaEntryList.at(i).startTime())
   883             && (entry.endTime() >= mAgendaEntryList.at(i).startTime())
   886             && (entry.endTime() > mAgendaEntryList.at(i).startTime())
   884             && entry.startTime().date() == mAgendaEntryList.at(i).startTime().date()) {
   887             && entry.startTime().date() == mAgendaEntryList.at(i).startTime().date()) {
   885             aEndEventIndex = i;
   888             aEndEventIndex = i;
   886             overlappingEvents++;
   889             overlappingEvents++;
   887         }
   890         }
   888     }
   891     }
  1107     // Logic for showing correct upper label
  1110     // Logic for showing correct upper label
  1108     if (label == mUpperLabelShort || label == mReminderLabel) {
  1111     if (label == mUpperLabelShort || label == mReminderLabel) {
  1109         // Make sure all three labels exists
  1112         // Make sure all three labels exists
  1110         if (mUpperLabelShort && mUpperLabelLong && mReminderLabel) {
  1113         if (mUpperLabelShort && mUpperLabelLong && mReminderLabel) {
  1111             int currentState = 0;
  1114             int currentState = 0;
  1112             currentState += (mReminderLabel->isVisible() ? 1 : 0);
  1115             bool reminderVisible = mReminderLabel->isVisible();
  1113             currentState += (mUpperLabelLong->isVisible()  ? 2 : 0);
  1116             bool upperLabelLong = mUpperLabelLong->isVisible();
  1114             currentState += (mUpperLabelShort->isVisible() ? 4 : 0);
  1117             bool upperLabelShort = mUpperLabelShort->isVisible();
       
  1118             currentState += (/*mReminderLabel->isVisible()*/mReminderVisible ? 1 : 0);
       
  1119             currentState += (/*mUpperLabelLong->isVisible()*/mUpperLabelLongVisible  ? 2 : 0);
       
  1120             currentState += (/*mUpperLabelShort->isVisible()*/mUpperLabelShortVisible ? 4 : 0);
  1115 
  1121 
  1116             int action = -1;
  1122             int action = -1;
  1117             if (label == mReminderLabel) {
  1123             if (label == mReminderLabel) {
  1118                 if (visible) {
  1124                 if (visible) {
  1119                     action = 1;
  1125                     action = 1;
  1132             }
  1138             }
  1133             
  1139             
  1134             int newState = stateTransition[currentState * 4 + action];
  1140             int newState = stateTransition[currentState * 4 + action];
  1135             
  1141             
  1136             if (newState != currentState) {
  1142             if (newState != currentState) {
       
  1143                 mReminderVisible = newState & 1;
       
  1144                 mUpperLabelLongVisible = newState & 2;
       
  1145                 mUpperLabelShortVisible = newState & 4;
  1137                 mReminderLabel->setVisible(newState & 1);
  1146                 mReminderLabel->setVisible(newState & 1);
  1138                 mUpperLabelLong->setVisible(newState & 2);
  1147                 mUpperLabelLong->setVisible(newState & 2);
  1139                 mUpperLabelShort->setVisible(newState & 4);
  1148                 mUpperLabelShort->setVisible(newState & 4);
  1140             }
  1149             }
  1141         }
  1150         }
  1170     }
  1179     }
  1171 }
  1180 }
  1172 
  1181 
  1173 void ContentLayoutHandler::setLowerLabelOverlapping(int numberOfEvents)
  1182 void ContentLayoutHandler::setLowerLabelOverlapping(int numberOfEvents)
  1174 {
  1183 {
  1175     QString trString(hbTrId("txt_calendar_widget_v_dblist_val_l1_events"));
  1184     setLabelText(mLowerLabel, hbTrId("txt_calendar_widget_v_dblist_val_l1_events", numberOfEvents));
  1176     // TODO: Remove the replacing of the parameter, once localized
       
  1177     //       string is corrected.
       
  1178     setLabelText(mLowerLabel, trString.replace("%Ln", "%L1").arg(numberOfEvents));
       
  1179 }
  1185 }
  1180 
  1186 
  1181 //from DateIconLayoutHandler
  1187 //from DateIconLayoutHandler
  1182 /*
  1188 /*
  1183  * ContentLayoutHandler::setCalendarIconContent()
  1189  * ContentLayoutHandler::setCalendarIconContent()