39 #include "calenagendaview.h" |
39 #include "calenagendaview.h" |
40 #include "calendocloader.h" |
40 #include "calendocloader.h" |
41 #include "calenservices.h" |
41 #include "calenservices.h" |
42 #include "calencontext.h" |
42 #include "calencontext.h" |
43 #include "calendateutils.h" |
43 #include "calendateutils.h" |
|
44 #include "calenagendautils.h" |
44 #include "CalenUid.h" |
45 #include "CalenUid.h" |
45 #include "caleneventlistviewitem.h" |
46 #include "caleneventlistviewitem.h" |
46 #include "calenpluginlabel.h" |
47 #include "calenpluginlabel.h" |
47 #include "calendarprivatecrkeys.h" |
48 #include "calendarprivatecrkeys.h" |
48 #include "OstTraceDefinitions.h" |
49 #include "OstTraceDefinitions.h" |
371 } else if (mInstanceArray.count() < mListModel->rowCount()) { |
372 } else if (mInstanceArray.count() < mListModel->rowCount()) { |
372 // There are less number of events than the number |
373 // There are less number of events than the number |
373 // of items in the list. Remove the extra rows |
374 // of items in the list. Remove the extra rows |
374 mListModel->removeRows(0, mListModel->rowCount() - mInstanceArray.count()); |
375 mListModel->removeRows(0, mListModel->rowCount() - mInstanceArray.count()); |
375 } |
376 } |
|
377 //to set the index to first item of the list , when view refresh |
376 mIndex = 0; |
378 mIndex = 0; |
|
379 //status reset for not setting any property |
377 mIconCheck = false; |
380 mIconCheck = false; |
378 mListModel->setColumnCount(singleColumn); |
381 mListModel->setColumnCount(singleColumn); |
379 mIconCheck = true; |
382 mIconCheck = true; |
380 // Add all the events to the list |
383 // Add all the events to the list |
381 for (int index = 0; index < mInstanceArray.count(); index++) { |
384 for (int index = 0; index < mInstanceArray.count(); index++) { |
464 if (index < 0 || entry.isNull()) { |
467 if (index < 0 || entry.isNull()) { |
465 // Not a valid index or entry. Dont do anything |
468 // Not a valid index or entry. Dont do anything |
466 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CREATELISTITEM_EXIT ); |
469 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CREATELISTITEM_EXIT ); |
467 return; |
470 return; |
468 } |
471 } |
469 // Check if the entry is a timed entry |
472 // Check if the entry is a timed entry and not all day event |
470 // TODO: Right now, only appointment/meeting type is being handled |
473 // an all-day event when it is synched from OUTLOOK then entry type will be EAppt |
471 // Handle other timed entry types like reminder etc |
474 if (!CalenAgendaUtils::isAlldayEvent(entry) && entry.isTimedEntry()) { |
472 if (entry.isTimedEntry()) { |
|
473 // Get the text and icon data for the entry |
475 // Get the text and icon data for the entry |
474 addTimedEventToList(index, entry); |
476 addTimedEventToList(index, entry); |
475 } else { |
477 } else { |
476 addNonTimedEventToList(index, entry); |
478 addNonTimedEventToList(index, entry); |
477 } |
479 } |
613 // only if valid geo-coordinates are present |
615 // only if valid geo-coordinates are present |
614 if (!entry.geoValue().isNull()){ |
616 if (!entry.geoValue().isNull()){ |
615 iconData << HbIcon(locationIcon); |
617 iconData << HbIcon(locationIcon); |
616 } |
618 } |
617 else { |
619 else { |
618 iconData << HbIcon(); |
620 iconData << QVariant(); |
619 } |
621 } |
620 textData << entry.location(); |
622 textData << entry.location(); |
621 } |
623 } |
622 // Add the end time to the list item |
624 // Add the end time to the list item |
623 if (eventStartTime < eventEndTime) { |
625 if (eventStartTime < eventEndTime) { |
689 |
691 |
690 if (entryType == AgendaEntry::TypeAnniversary) { |
692 if (entryType == AgendaEntry::TypeAnniversary) { |
691 // Nothing to do as of now as anniversary events |
693 // Nothing to do as of now as anniversary events |
692 // cannot be created |
694 // cannot be created |
693 // TODO: To be handled in case of sync |
695 // TODO: To be handled in case of sync |
694 } else if (entryType == AgendaEntry::TypeEvent) { |
696 } else if (CalenAgendaUtils::isAlldayEvent(entry)) { |
695 // This is an all day event |
697 // This is an all day event |
696 // Append the all-day icon |
698 // Append the all-day icon |
697 iconData << HbIcon(allDayIcon); |
699 iconData << HbIcon(allDayIcon); |
698 |
700 |
699 // Check if alarm is enabled for the entry |
701 // Check if alarm is enabled for the entry |
700 if (entry.alarm().isNull()) { |
702 if (entry.alarm().isNull()) { |
701 // Insert a blank icon. Else next text item will get shifted to left |
703 // Insert a blank icon. Else next text item will get shifted to left |
702 iconData << HbIcon(); |
704 iconData << QVariant(); |
703 } else { |
705 } else { |
704 // if entry is not repeating in place of reminder icon put a blank |
706 // if entry is not repeating in place of reminder icon put a blank |
705 // icon and move reminder icon to the place of repeating icon |
707 // icon and move reminder icon to the place of repeating icon |
706 if (!entry.isRepeating()) { |
708 if (!entry.isRepeating()) { |
707 iconData << HbIcon(); |
709 iconData << QVariant(); |
708 } |
710 } |
709 iconData << HbIcon(reminderIcon); |
711 iconData << HbIcon(reminderIcon); |
710 } |
712 } |
711 |
713 |
712 // Check if the entry is recurring |
714 // Check if the entry is recurring |
729 // TODO: Location icon must be shown |
731 // TODO: Location icon must be shown |
730 // only if valid geo-coordinates are present |
732 // only if valid geo-coordinates are present |
731 if (!entry.geoValue().isNull()){ |
733 if (!entry.geoValue().isNull()){ |
732 iconData << HbIcon(locationIcon); |
734 iconData << HbIcon(locationIcon); |
733 }else { |
735 }else { |
734 iconData << HbIcon(); |
736 iconData << QVariant(); |
|
737 |
735 } |
738 } |
736 } else { |
739 } else { |
737 textData << QVariant(); |
740 textData << QVariant(); |
738 } |
741 } |
739 // The fourth text item has to be empty |
742 // The fourth text item has to be empty |
769 textData << QVariant(); |
772 textData << QVariant(); |
770 |
773 |
771 // Check if alarm is enabled for the entry |
774 // Check if alarm is enabled for the entry |
772 if (entry.alarm().isNull()) { |
775 if (entry.alarm().isNull()) { |
773 // Insert a blank icon. Else next text item will get shifted to left |
776 // Insert a blank icon. Else next text item will get shifted to left |
774 iconData << HbIcon(); |
777 iconData << QVariant(); |
775 } else { |
778 } else { |
776 // if entry is not repeating in place of reminder icon put a blank |
779 // if entry is not repeating in place of reminder icon put a blank |
777 // icon and move reminder icon to the place of repeating icon |
780 // icon and move reminder icon to the place of repeating icon |
778 if (!entry.isRepeating()) { |
781 if (!entry.isRepeating()) { |
779 iconData << HbIcon(); |
782 iconData << QVariant(); |
780 } |
783 } |
781 iconData << HbIcon(reminderIcon); |
784 iconData << HbIcon(reminderIcon); |
782 } |
785 } |
783 |
786 |
784 // Check if the entry is recurring |
787 // Check if the entry is recurring |
832 } |
835 } |
833 for(int index = 0; index < mInstanceArray.count() ; index ++) { |
836 for(int index = 0; index < mInstanceArray.count() ; index ++) { |
834 AgendaEntry entry = mInstanceArray[index]; |
837 AgendaEntry entry = mInstanceArray[index]; |
835 if (!entry.isNull()) { |
838 if (!entry.isNull()) { |
836 AgendaEntry::Type eventType = entry.type(); |
839 AgendaEntry::Type eventType = entry.type(); |
|
840 // Need to check explicitly for Appt that got synched from OUTLOOK |
|
841 // that can be an all-day event |
|
842 if (AgendaEntry::TypeAppoinment == eventType) { |
|
843 if (CalenAgendaUtils::isAlldayEvent(entry)) { |
|
844 eventType = AgendaEntry::TypeEvent; |
|
845 } |
|
846 } |
837 switch(eventType) { |
847 switch(eventType) { |
838 // Apply the stretching to only to-do's, |
848 // Apply the stretching to only to-do's, |
839 // anniversary and all-day event types |
849 // anniversary and all-day event types |
840 case AgendaEntry::TypeTodo: |
850 case AgendaEntry::TypeTodo: |
841 case AgendaEntry::TypeEvent: |
851 case AgendaEntry::TypeEvent: |
1266 mListModel->clear(); |
1277 mListModel->clear(); |
1267 |
1278 |
1268 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CLEARLISTMODEL_EXIT ); |
1279 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CLEARLISTMODEL_EXIT ); |
1269 } |
1280 } |
1270 |
1281 |
|
1282 // ---------------------------------------------------------------------------- |
|
1283 // CalenAgendaViewWidget::hasAllDayIcon |
|
1284 // return true if property for all day icon to set |
|
1285 // ---------------------------------------------------------------------------- |
|
1286 // |
1271 bool CalenAgendaViewWidget::hasAllDayIcon() |
1287 bool CalenAgendaViewWidget::hasAllDayIcon() |
1272 { |
1288 { |
1273 return mIconCheck; |
1289 return mIconCheck; |
1274 } |
1290 } |
1275 |
1291 |
1276 |
1292 |
1277 |
1293 // ---------------------------------------------------------------------------- |
|
1294 // CalenAgendaViewWidget::checkEntryIcons |
|
1295 // check if all day icon is present |
|
1296 // ---------------------------------------------------------------------------- |
|
1297 // |
1278 void CalenAgendaViewWidget::checkEntryIcons() |
1298 void CalenAgendaViewWidget::checkEntryIcons() |
1279 { |
1299 { |
1280 // return allDayLeftIcon; |
|
1281 int index = 0; |
1300 int index = 0; |
1282 //check the number of entries |
1301 //check the number of entries |
1283 index = mInstanceArray.count(); |
1302 index = mInstanceArray.count(); |
1284 // Get each of the entry details |
1303 // Get each of the entry details |
1285 AgendaEntry entry; |
1304 AgendaEntry entry; |
1286 if(mIndex < index ) |
1305 if(mIndex < index ) |
1287 entry = mInstanceArray[mIndex]; |
1306 entry = mInstanceArray[mIndex]; |
1288 |
1307 |
1289 mRightAlarmIcon = false; |
|
1290 mRightRepeatIcon = false; |
|
1291 mRightExceptionIcon = false; |
|
1292 mLeftAllDayIcon = false; |
1308 mLeftAllDayIcon = false; |
|
1309 mLocationData = false; |
1293 |
1310 |
1294 if(!entry.alarm().isNull()){ |
1311 if(!entry.isTimedEntry() || CalenAgendaUtils::isAlldayEvent(entry)){ |
1295 mRightAlarmIcon = true; |
|
1296 } |
|
1297 if (entry.isRepeating()){ |
|
1298 mRightRepeatIcon = true; |
|
1299 } |
|
1300 if (!entry.recurrenceId().isNull()){ |
|
1301 mRightExceptionIcon = true; |
|
1302 } |
|
1303 |
|
1304 if(!entry.isTimedEntry()){ |
|
1305 //all day icon is not there if its a timed entry |
1312 //all day icon is not there if its a timed entry |
1306 mLeftAllDayIcon = true; |
1313 mLeftAllDayIcon = true; |
1307 } |
1314 } |
|
1315 |
|
1316 if (!entry.location().isEmpty()) { |
|
1317 mLocationData = true ; |
|
1318 } |
1308 //check if shift to next entry |
1319 //check if shift to next entry |
1309 if(mNextEntry) |
1320 if(mNextEntry) |
1310 mIndex++; |
1321 mIndex++; |
1311 |
1322 |
1312 } |
1323 } |
1313 |
1324 |
|
1325 // ---------------------------------------------------------------------------- |
|
1326 // CalenAgendaViewWidget::isAllDayIcon |
|
1327 // retirn true if all day icon is present |
|
1328 // ---------------------------------------------------------------------------- |
|
1329 // |
1314 bool CalenAgendaViewWidget::isAllDayIcon() |
1330 bool CalenAgendaViewWidget::isAllDayIcon() |
1315 { |
1331 { |
1316 return mLeftAllDayIcon; |
1332 return mLeftAllDayIcon; |
1317 } |
1333 } |
1318 |
1334 |
1319 bool CalenAgendaViewWidget::isExceptionIcon() |
1335 // ---------------------------------------------------------------------------- |
|
1336 // CalenAgendaViewWidget::isLocationData |
|
1337 // return true if location entry is present |
|
1338 // ---------------------------------------------------------------------------- |
|
1339 // |
|
1340 bool CalenAgendaViewWidget::isLocationData() |
1320 { |
1341 { |
1321 return mRightExceptionIcon; |
1342 return mLocationData; |
1322 } |
1343 } |
1323 |
|
1324 bool CalenAgendaViewWidget::isAlarmIcon() |
|
1325 { |
|
1326 return mRightAlarmIcon; |
|
1327 } |
|
1328 |
|
1329 bool CalenAgendaViewWidget::isRepeatingIcon() |
|
1330 { |
|
1331 return mRightRepeatIcon; |
|
1332 } |
|
1333 |
|
1334 // End of file --Don't remove this. |
1344 // End of file --Don't remove this. |