# HG changeset patch # User hgs # Date 1287124836 -19800 # Node ID 5aadd1120515b8537f932f4a7db1f81b3e951dbe # Parent dcd0ca396fa1a09a4ffb12d8bb210f90d6fffc89 201041 diff -r dcd0ca396fa1 -r 5aadd1120515 agendainterface/agendautil/src/agendaentry.cpp --- a/agendainterface/agendautil/src/agendaentry.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/agendainterface/agendautil/src/agendaentry.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -2068,6 +2068,7 @@ && d->m_repeatRule == other.d->m_repeatRule && d->m_startTime == other.d->m_startTime && d->m_summaryText == other.d->m_summaryText + && d->m_dtStamp == other.d->m_dtStamp && d->m_lastModTime == other.d->m_lastModTime && d->m_entryStatus == other.d->m_entryStatus && d->m_favourite == other.d->m_favourite @@ -2094,6 +2095,7 @@ m_favourite = 0; m_alarm = AgendaAlarm(); m_geoValue = AgendaGeoValue(); + m_dtStamp = m_completedDateTime= m_lastModTime = m_startTime = m_endTime = QDateTime(); } bool AgendaEntryPrivate::deleteCategory(const AgendaCategory& category) diff -r dcd0ca396fa1 -r 5aadd1120515 agendainterface/agendautil/src/agendautil_p.cpp --- a/agendainterface/agendautil/src/agendautil_p.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/agendainterface/agendautil/src/agendautil_p.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -882,98 +882,87 @@ // Parse thru the list and mark the dates which have events for (int i = 0; i < instanceList.Count(); i++) { - CCalEntry::TType type = instanceList[i]->Entry().EntryTypeL(); - // Get the start time and end time of the events - TCalTime startCalTime = instanceList[i]->StartTimeL(); - TCalTime endCalTime = instanceList[i]->EndTimeL(); - TDateTime startDateTime = startCalTime.TimeLocalL().DateTime(); - TDateTime endDateTime = endCalTime.TimeLocalL().DateTime(); - QDate startDate(startDateTime.Year(), startDateTime.Month()+1, - startDateTime.Day() + 1); - QDate endDate(endDateTime.Year(), endDateTime.Month()+1, - endDateTime.Day() + 1); - if (type == CCalEntry::EEvent || type == CCalEntry::EAppt || - type == CCalEntry::EReminder) { - if(endsAtStartOfDay(instanceList[i], endCalTime.TimeLocalL())) { - TDateTime endDateTime = endCalTime.TimeLocalL().DateTime(); - // prevent problems with items ending tomorrow at 00:00 - endDateTime.SetMinute(endDateTime.Minute() - 1); - TTime time(endDateTime); - // If it is ending before the start of the grid - if (time <= startDateForInstanceSearch.TimeLocalL()) { - continue; - } - } - // Mark the required dates frm start date to end date - int numOfDays = 0; - //check if the start date of the entry is before the start day of the grid - if(startDate < rangeStart.date()){ - if(endDate<=rangeEnd.date()){ - //if the end date of entry is lying in the grid , - //then mark the entry from start day of the grid to the end date of the entry - numOfDays = rangeStart.date().daysTo(endDate); - } - else{ - //if end date of the entry is greater then the last date of grid, - //then mark all the date of the grid with the entry - numOfDays = rangeStart.daysTo(rangeEnd); - } - // Check if the event is all-day - if (instanceList[i]->Entry().EntryTypeL() == CCalEntry::EEvent) { - // no need to consider the date on which it ends - // reduce days count by 1 - numOfDays--; - } - //start the entries from the first day of the grid - for (int j = 0; j <= numOfDays; j++) { - QDate date = rangeStart.date().addDays(j); - if (date <= rangeEnd.date()) { - dates.append(date); - } else { - break; - } - } - } - //if the start date of the entry is lying inside the grid - else{ - if(endDate<=rangeEnd.date()){ - //if the end date of entry is lying in the grid , - //then mark the entry from start date of the entry to the end date of the entry - numOfDays = startDate.daysTo(endDate); - } - else{ - //if end date of the entry is greater then the last date of grid, - //then mark all the date from start date of the entry to the end date of the grid - numOfDays = startDate.daysTo(rangeEnd.date()); - } - // Check if the event is all-day - if (instanceList[i]->Entry().EntryTypeL() == CCalEntry::EEvent) { - // no need to consider the date on which it ends - // reduce days count by 1 - numOfDays--; - } - for (int j = 0; j <= numOfDays; j++) { - QDate date = startDate.addDays(j); - if (date <= rangeEnd.date()) { - dates.append(date); - } else { - break; - } - } - } - } else if (type == CCalEntry::EAnniv) { - if (startDate <= rangeEnd.date()) { - dates.append(startDate); - } - } else if (type == CCalEntry::ETodo) { - // if start time is less that today, then mark it for today - if (startDate < QDate::currentDate()) { - dates.append(QDate::currentDate()); - } else { - dates.append(startDate); - } - } - } + CCalEntry::TType type = instanceList[i]->Entry().EntryTypeL(); + // Get the start time and end time of the events + TCalTime startCalTime = instanceList[i]->StartTimeL(); + TCalTime endCalTime = instanceList[i]->EndTimeL(); + TDateTime startDateTime = startCalTime.TimeLocalL().DateTime(); + TDateTime endDateTime = endCalTime.TimeLocalL().DateTime(); + QDate startDate(startDateTime.Year(), startDateTime.Month()+1, + startDateTime.Day() + 1); + QDate endDate(endDateTime.Year(), endDateTime.Month()+1, + endDateTime.Day() + 1); + if (type == CCalEntry::EEvent || type == CCalEntry::EAppt || + type == CCalEntry::EReminder) { + if(endsAtStartOfDay(instanceList[i], endCalTime.TimeLocalL())) { + TDateTime endDateTime = endCalTime.TimeLocalL().DateTime(); + // prevent problems with items ending tomorrow at 00:00 + endDateTime.SetMinute(endDateTime.Minute() - 1); + TTime time(endDateTime); + endDate = endDate.addDays(-1); + // If it is ending before the start of the grid + if (time <= startDateForInstanceSearch.TimeLocalL()) { + continue; + } + } + // Mark the required dates frm start date to end date + int numOfDays = 0; + //check if the start date of the entry is before the start day of the grid + if(startDate < rangeStart.date()){ + if(endDate<=rangeEnd.date()){ + //if the end date of entry is lying in the grid , + //then mark the entry from start day of the grid to the end date of the entry + numOfDays = rangeStart.date().daysTo(endDate); + } + else{ + //if end date of the entry is greater then the last date of grid, + //then mark all the date of the grid with the entry + numOfDays = rangeStart.daysTo(rangeEnd); + } + //start the entries from the first day of the grid + for (int j = 0; j <= numOfDays; j++) { + QDate date = rangeStart.date().addDays(j); + if (date <= rangeEnd.date()) { + dates.append(date); + } else { + break; + } + } + } + //if the start date of the entry is lying inside the grid + else{ + if(endDate<=rangeEnd.date()){ + //if the end date of entry is lying in the grid , + //then mark the entry from start date of the entry to the end date of the entry + numOfDays = startDate.daysTo(endDate); + } + else{ + //if end date of the entry is greater then the last date of grid, + //then mark all the date from start date of the entry to the end date of the grid + numOfDays = startDate.daysTo(rangeEnd.date()); + } + for (int j = 0; j <= numOfDays; j++) { + QDate date = startDate.addDays(j); + if (date <= rangeEnd.date()) { + dates.append(date); + } else { + break; + } + } + } + } else if (type == CCalEntry::EAnniv) { + if (startDate <= rangeEnd.date()) { + dates.append(startDate); + } + } else if (type == CCalEntry::ETodo) { + // if start time is less that today, then mark it for today + if (startDate < QDate::currentDate()) { + dates.append(QDate::currentDate()); + } else { + dates.append(startDate); + } + } + } CleanupStack::PopAndDestroy(&instanceList); } @@ -2139,7 +2128,7 @@ TDateTime tempDateTime(dateTime.date().year(), static_cast (dateTime.date().month() - 1), dateTime.date().day() - 1, dateTime.time().hour(), - dateTime.time().minute(), 0, 0); + dateTime.time().minute(), dateTime.time().second(), 0); TTime tempTime(tempDateTime); calTime.SetTimeLocalL(tempTime); calEntry.SetLastModifiedDateL(calTime); @@ -2151,7 +2140,7 @@ creationDateTime(dtStamp.date().year(), static_cast (dtStamp.date().month() - 1), dtStamp.date().day() - 1, dtStamp.time().hour(), - dtStamp.time().minute(), 0, 0); + dtStamp.time().minute(), dtStamp.time().second(), 0); TTime creationTTime(creationDateTime); creationCalTime.SetTimeLocalL(creationTTime); calEntry.SetDTStampL(creationCalTime); diff -r dcd0ca396fa1 -r 5aadd1120515 alarmui/alarmalertwidget/alarmalertinterface/src/alarmalertwidget.cpp --- a/alarmui/alarmalertwidget/alarmalertinterface/src/alarmalertwidget.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/alarmui/alarmalertwidget/alarmalertinterface/src/alarmalertwidget.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -37,8 +37,7 @@ // --------------------------------------------------------- // AlarmAlertWidget::AlarmAlertWidget(AlarmAlertObserver *observer) : - mObserver(observer), - mDeviceDialog(NULL) + mDeviceDialog(NULL), mObserver(observer) { OstTraceFunctionEntry0( ALARMALERTWIDGET_ALARMALERTWIDGET_ENTRY ); OstTraceFunctionExit0( ALARMALERTWIDGET_ALARMALERTWIDGET_EXIT ); diff -r dcd0ca396fa1 -r 5aadd1120515 alarmui/src/alarmutils.cpp --- a/alarmui/src/alarmutils.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/alarmui/src/alarmutils.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -260,7 +260,7 @@ TRACE_ENTRY_POINT; StopAlarmSound(); PIM_TRAPD_ASSERT( iAlarmPlayer = CAlmAlarmPlayer::NewL( this ); ) - //SetBackLight( ETrue ); + SetBackLight( ETrue ); TRACE_EXIT_POINT; } @@ -281,7 +281,7 @@ #endif // RD_ALMALERT__SENSOR_SUPPORT delete iAlarmPlayer; iAlarmPlayer = NULL; - //SetBackLight( EFalse ); + SetBackLight( EFalse ); TRACE_EXIT_POINT; } diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/agendaeventviewer/agendaeventviewer.pro --- a/calendarui/agendaeventviewer/agendaeventviewer.pro Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/agendaeventviewer/agendaeventviewer.pro Fri Oct 15 12:10:36 2010 +0530 @@ -70,6 +70,6 @@ RESOURCES += agendaeventviewer.qrc -TRANSLATIONS += caleneventviewer.ts +TRANSLATIONS += eventviewer.ts # End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/agendaeventviewer/src/agendaeventview.cpp --- a/calendarui/agendaeventviewer/src/agendaeventview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/agendaeventviewer/src/agendaeventview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -83,7 +83,7 @@ QObject(parent), mMainWindow(NULL), mOwner(owner), - mTranslator(new HbTranslator("caleneventviewer")), + mTranslator(new HbTranslator("eventviewer")), mReminderWidgetAdded(true), mMaptilePath(NULL), mMaptileService(NULL), @@ -320,9 +320,9 @@ mMarkTodoAction = new HbAction(this); if (mAgendaEntry.status() == AgendaEntry::TodoCompleted) { mMarkTodoAction->setText( - hbTrId("txt_calendar_menu_mark_as_not_done")); + hbTrId("txt_calendar_opt_mark_as_not_done")); } else { - mMarkTodoAction->setText(hbTrId("txt_calendar_menu_mark_as_done")); + mMarkTodoAction->setText(hbTrId("txt_calendar_opt_mark_as_done")); } connect(mMarkTodoAction, SIGNAL(triggered()), this, SLOT(markTodoStatus())); @@ -1005,10 +1005,6 @@ text.append(hbTrId("txt_calendar_info_delete_todo_note")); break; } - case AgendaEntry::TypeNote: { - text.append(hbTrId("txt_calendar_info_delete_anniversary")); - break; - } } popup->setText(text); @@ -1055,14 +1051,14 @@ // Set the to-do status using the agenda util. if (AgendaEntry::TodoCompleted != mAgendaEntry.status()) { // Update the menu text to mark to-do as undone. - mMarkTodoAction->setText(hbTrId("txt_calendar_menu_mark_as_not_done")); + mMarkTodoAction->setText(hbTrId("txt_calendar_opt_mark_as_not_done")); mAgendaEntry.setStatus(AgendaEntry::TodoCompleted); mAgendaEntry.setCompletedDateTime(currentDateTime); mOwner->mAgendaUtil->setCompleted(mAgendaEntry, true, currentDateTime); } else { // Update the menu text to mark to-do as done. - mMarkTodoAction->setText(hbTrId("txt_calendar_menu_mark_as_done")); + mMarkTodoAction->setText(hbTrId("txt_calendar_opt_mark_as_done")); mAgendaEntry.setStatus(AgendaEntry::TodoNeedsAction); mOwner->mAgendaUtil->setCompleted(mAgendaEntry, false, currentDateTime); } diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/application/application.pro --- a/calendarui/application/application.pro Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/application/application.pro Fri Oct 15 12:10:36 2010 +0530 @@ -17,11 +17,11 @@ TEMPLATE = app TARGET = calendar DEPENDPATH += ./src \ - ./inc \ - ../controller/data + ./inc \ + ../controller/data -INCLUDEPATH += ..\controller\inc \ - ..\inc +INCLUDEPATH += ../controller/inc \ + ../inc CONFIG += hb @@ -37,21 +37,18 @@ "../conf/calendarUI.confml APP_LAYER_CONFML(calendarUI.confml)" \ "../conf/calendarUI_101F874B.crml APP_LAYER_CRML(calendarUI_101F874B.crml)" \ # stubsis is added to provide IAD - "../stubsis/calendar_stub.sis /epoc32/data/z/system/install/calendar_stub.sis" \ + "../stubsis/calendar_stub.sis /epoc32/data/z/system/install/calendar_stub.sis" \ # splashml - "resources/calendar.docml /epoc32/data/z/resource/hb/splashml/calendar.docml" \ - "resources/calendar.splashml /epoc32/data/z/resource/hb/splashml/calendar.splashml" \ + "resources/calendar.docml /epoc32/data/z/resource/hb/splashml/calendar.docml" \ + "resources/calendar.splashml /epoc32/data/z/resource/hb/splashml/calendar.splashml" \ # backup_registration.xml - "data/backup_registration.xml /epoc32/data/z/private/10005901/backup_registration.xml" \ - "data/backup_registration.xml /epoc32/release/winscw/urel/z/private/10005901/backup_registration.xml" \ - "data/backup_registration.xml /epoc32/release/winscw/udeb/z/private/10005901/backup_registration.xml" - - - + "data/backup_registration.xml /epoc32/data/z/private/10005901/backup_registration.xml" \ + "data/backup_registration.xml /epoc32/release/winscw/urel/z/private/10005901/backup_registration.xml" \ + "data/backup_registration.xml /epoc32/release/winscw/udeb/z/private/10005901/backup_registration.xml" LIBS += -lcalencontroller \ - -lxqservice \ - -lxqserviceutil + -lxqservice \ + -lxqserviceutil TARGET.UID3 = 0x10005901 @@ -60,7 +57,6 @@ TARGET.EPOCSTACKSIZE = 0x14000 TARGET.EPOCHEAPSIZE = 0x200000 0x4000000 - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE CONFIG += service @@ -72,11 +68,11 @@ # Input HEADERS += calenserviceprovider.h \ - calenapplication.h + calenapplication.h SOURCES += main.cpp \ - calenapplication.cpp \ - calenserviceprovider.cpp + calenapplication.cpp \ + calenserviceprovider.cpp RESOURCES += calendar.qrc diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/caleneditor/caleneditor.pro --- a/calendarui/caleneditor/caleneditor.pro Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/caleneditor/caleneditor.pro Fri Oct 15 12:10:36 2010 +0530 @@ -19,10 +19,12 @@ CONFIG += hb TARGET = caleneditor DEFINES += CALENEDITOR_LIB + INCLUDEPATH += ./src \ ./inc \ ./traces \ - ..\inc + ../inc + DEPENDPATH += ./src \ ./inc \ ./data @@ -35,20 +37,21 @@ LIBS += -lagendainterface \ -lcalencommonutils \ - -lxqservice \ + -lxqservice \ -lcalenlauncher \ - -lbafl + -lbafl\ + -lmaptileservice INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } SOURCES += caleneditor.cpp \ - caleneditorcustomitem.cpp \ - caleneditor_p.cpp \ - caleneditordocloader.cpp \ - caleneditorreminderfield.cpp \ - caleneditorrepeatfield.cpp \ - caleneditordatahandler.cpp + caleneditorcustomitem.cpp \ + caleneditor_p.cpp \ + caleneditordocloader.cpp \ + caleneditorreminderfield.cpp \ + caleneditorrepeatfield.cpp \ + caleneditordatahandler.cpp HEADERS += ../../organizer_plat/calendar_editor_api/inc/caleneditor.h \ caleneditorcustomitem.h \ diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/caleneditor/inc/caleneditor_p.h --- a/calendarui/caleneditor/inc/caleneditor_p.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/caleneditor/inc/caleneditor_p.h Fri Oct 15 12:10:36 2010 +0530 @@ -54,7 +54,7 @@ class CalenEditorRepeatField; class CalenEditorDataHandler; class CEnvironmentChangeNotifier; // Receive system event notifications - +class MapTileService; // Constants const int KNoOfDaysInWeek = 7; @@ -117,7 +117,7 @@ int getReminderCount(); bool isEditRangeThisOnly(); bool isAllDayFieldAdded(); - void forcedSaveEntry(); + /** * Called from CEnvironmentChangeNotifier when the @@ -170,6 +170,7 @@ QDateTime defaultTimeSameDay( ); void refreshTimeForUncheckAllDay(); void launchDialog(QString title); + void updateToMapTileService(); private slots: void handleSubjectChange(const QString subject); @@ -195,6 +196,8 @@ void closeEditor(); void handleLocationEditingFinished(); void selectEditingFinishedAction(HbAction* action); + void forcedSaveEntry(); + void forcedExit(); private: enum EditRange { @@ -234,7 +237,7 @@ HbAction *mDescriptionAction; HbMainWindow *mMainWindow; HbTranslator *mTranslator; - + MapTileService *mMaptileService; bool mNewEntry; bool mDescriptionItemAdded; bool mIsChild; @@ -242,7 +245,8 @@ bool mOwnsAgendaUtil; bool mLaunchCalendar; bool mMenuItemAdded; - + bool mKeepExistingLocation; + bool mForcedExit; // Notifications about locale and time changes CEnvironmentChangeNotifier* iEnvChangeNotifier; bool iIgnoreFirstLocaleChange; diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/caleneditor/src/caleneditor_p.cpp --- a/calendarui/caleneditor/src/caleneditor_p.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/caleneditor/src/caleneditor_p.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -48,12 +48,13 @@ #include #include #include - +#include // User includes #include #include #include #include +#include #include "caleneditor_p.h" #include "caleneditorcustomitem.h" @@ -216,12 +217,14 @@ mOriginalEntry(NULL), mEditedEntry(NULL), mTranslator(new HbTranslator("caleneditor")), + mMaptileService(0), mNewEntry(true), mDescriptionItemAdded(false), mIsChild(false), mIsAllDayItemAdded(false), mLaunchCalendar(false), - mMenuItemAdded(false) + mMenuItemAdded(false), + mKeepExistingLocation(false) { OstTraceFunctionEntry0( CALENEDITORPRIVATE_CALENEDITORPRIVATE_ENTRY ); // First get the q-pointer. @@ -305,6 +308,11 @@ iEnvChangeNotifier = 0; } + if(mMaptileService){ + delete mMaptileService; + mMaptileService=0; + } + OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_CALENEDITORPRIVATE_EXIT ); } @@ -546,7 +554,11 @@ mEditorView->setNavigationAction(mSoftKeyAction); connect(mSoftKeyAction, SIGNAL(triggered()), this, SLOT(saveAndCloseEditor())); - + //if editor is open in background, and user close the app from task switcher + //entry should get saved + connect(qobject_cast(qApp), SIGNAL(aboutToQuit()), + this, SLOT(forcedExit())); + // Create the data handler mDataHandler = new CalenEditorDataHandler(this,mEditedEntry, mOriginalEntry); OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWEDITOR_EXIT ); @@ -1534,15 +1546,46 @@ { OstTraceFunctionEntry0( CALENEDITORPRIVATE_SELECTEDITINGFINISHEDACTION_ENTRY ); HbMessageBox* dlg = static_cast(sender()); - + // mKeepExistingLocation true , if user confirms yes otherwise false. + // This boolean value will be saved into maptile database only when user save the entry. + mKeepExistingLocation = true; if (action == dlg->actions().at(1)) { mEditedEntry->clearGeoValue(); - } + mKeepExistingLocation = false; + } + if(!mMaptileService) + { + mMaptileService= new MapTileService(); + } OstTraceFunctionExit0( CALENEDITORPRIVATE_SELECTEDITINGFINISHEDACTION_EXIT ); } /*! + MapTileService setting. + \A valid location changed , update the user setting to maptileservice + User selected action will be saved as part of location maptile database + */ +void CalenEditorPrivate::updateToMapTileService() +{ + //mMaptileService will be created only when a valid location edited , + //and Confirmation dialog appears with action "yes" and "No" . + if(mMaptileService) { + if (mMaptileService->isLocationFeatureEnabled( + MapTileService::AppTypeCalendar)) { + MapTileService::AddressType addressType; + addressType = MapTileService::AddressPlain; + int eventId = mEntry.id(); + //This exported api takes care to save the user selected action into maptile database. + mMaptileService->keepExistingLocation(eventId, addressType,mKeepExistingLocation); + } + + delete mMaptileService; + mMaptileService = 0; + } +} + +/*! Triggered when the description editor is being edited. \param description Contains the string displayed in the description item. */ @@ -1814,6 +1857,8 @@ // TODO: Need to check entry status here. EntryStillExistsL switch (mDataHandler->shouldSaveOrDeleteOrDoNothing(mLaunchCalendar)) { case CalenEditorPrivate::ActionSave: + //Entry edited , update to maptile service database, + updateToMapTileService(); if (saveEntry()) { OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDONE_EXIT ); return CalenEditorPrivate::ActionSave; @@ -1835,10 +1880,14 @@ void CalenEditorPrivate::launchDialog(QString title) { OstTraceFunctionEntry0( CALENEDITORPRIVATE_LAUNCHDIALOG_ENTRY ); - HbNotificationDialog *notificationDialog = new HbNotificationDialog(); - notificationDialog->setTitle(title); - notificationDialog->setTimeout(HbPopup::ConfirmationNoteTimeout); - notificationDialog->show(); + //dont show any dialog if exit is not normal + //exit app either from task switcher or red key + if(!mForcedExit){ + HbNotificationDialog *notificationDialog = new HbNotificationDialog(); + notificationDialog->setTitle(title); + notificationDialog->setTimeout(HbPopup::ConfirmationNoteTimeout); + notificationDialog->show(); + } OstTraceFunctionExit0( CALENEDITORPRIVATE_LAUNCHDIALOG_EXIT ); } /*! @@ -1859,7 +1908,11 @@ mAgendaUtil->store(*mEditedEntry); } } - if (mNewEntry) { + + //if entry is saved in the background by forced exit, + // no notification should be shown + //handled in launchDialog function + if (mNewEntry ) { if(mEditedEntry->type() == AgendaEntry::TypeAppoinment) { launchDialog(hbTrId("txt_calendar_dpopinfo_new_meeting_saved")); } else if(isAllDayEvent()) { @@ -2176,6 +2229,7 @@ // TInt CalenEditorPrivate::DoEnvChange() { + OstTraceFunctionEntry0( CALENEDITORPRIVATE_DOENVCHANGE_ENTRY ); if( iEnvChangeNotifier && (iEnvChangeNotifier->Change() & EChangesLocale) && !iIgnoreFirstLocaleChange) { mViewFromItem->populateDateTime(mEditedEntry->startTime(), true); @@ -2190,7 +2244,22 @@ else { iIgnoreFirstLocaleChange = EFalse; } + OstTraceFunctionExit0( CALENEDITORPRIVATE_DOENVCHANGE_EXIT ); return EFalse ; + +} + +/*! + Slot to handle entry when app exit from red key or task switcher. + */ +void CalenEditorPrivate::forcedExit() +{ + OstTraceFunctionEntry0( CALENEDITORPRIVATE_FORCEDEXIT_ENTRY ); + mForcedExit = true; + emit q_ptr->forcedExit() ; + //save the created entry + forcedSaveEntry(); + OstTraceFunctionExit0( CALENEDITORPRIVATE_FORCEDEXIT_EXIT ); } // End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/caleneditor/traces/caleneditor_pTraces.h --- a/calendarui/caleneditor/traces/caleneditor_pTraces.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/caleneditor/traces/caleneditor_pTraces.h Fri Oct 15 12:10:36 2010 +0530 @@ -176,6 +176,10 @@ #define CALENEDITORPRIVATE_FORCEDSAVEENTRY_EXIT 0x8a0160 #define CALENEDITORPRIVATE_LAUNCHDIALOG_ENTRY 0x8a0169 #define CALENEDITORPRIVATE_LAUNCHDIALOG_EXIT 0x8a016a +#define CALENEDITORPRIVATE_FORCEDEXIT_ENTRY 0x8a016c +#define CALENEDITORPRIVATE_FORCEDEXIT_EXIT 0x8a016d +#define CALENEDITORPRIVATE_DOENVCHANGE_ENTRY 0x8a016e +#define CALENEDITORPRIVATE_DOENVCHANGE_EXIT 0x8a016f #endif diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/caleneditor/traces/fixed_id.definitions --- a/calendarui/caleneditor/traces/fixed_id.definitions Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/caleneditor/traces/fixed_id.definitions Fri Oct 15 12:10:36 2010 +0530 @@ -129,12 +129,16 @@ [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_DEFAULTTIMESAMEDAY_EXIT=0x151 [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_DISCARDCHANGES_ENTRY=0x70 [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_DISCARDCHANGES_EXIT=0x71 +[TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_DOENVCHANGE_ENTRY=0x16e +[TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_DOENVCHANGE_EXIT=0x16f [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_EDITEDENTRY_ENTRY=0x8a [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_EDITEDENTRY_EXIT=0x8b [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_EDIT_ENTRY=0x17 [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_EDIT_EXIT=0x18 [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_ENABLEFROMTOTIMEFILEDS_ENTRY=0x88 [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_ENABLEFROMTOTIMEFILEDS_EXIT=0x89 +[TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_FORCEDEXIT_ENTRY=0x16c +[TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_FORCEDEXIT_EXIT=0x16d [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_FORCEDSAVEENTRY_ENTRY=0x15f [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_FORCEDSAVEENTRY_EXIT=0x160 [TRACE]TRACE_FLOW[0x8A]_CALENEDITORPRIVATE_GETREMINDERCOUNT_ENTRY=0x15e diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/controller/inc/caleneditui.h --- a/calendarui/controller/inc/caleneditui.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/controller/inc/caleneditui.h Fri Oct 15 12:10:36 2010 +0530 @@ -91,6 +91,7 @@ void handleEntrySaved(); void handleDialogClosed(); + void handleForcedExit(); private: // data diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/controller/inc/calennotificationhandler.h --- a/calendarui/controller/inc/calennotificationhandler.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/controller/inc/calennotificationhandler.h Fri Oct 15 12:10:36 2010 +0530 @@ -67,7 +67,8 @@ ECalenNotifyThaiPluginDisabled, ECalenNotifyUserDefined3, ECalenNotifyUserDefined4, - ECalenNotifyLast + ECalenNotifyLast, + ECalenNotifyForcedExit }; /** diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/controller/src/caleneditui.cpp --- a/calendarui/controller/src/caleneditui.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/controller/src/caleneditui.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -109,12 +109,19 @@ TInt command = aCommand.Command(); MCalenContext& context = iController.Services().Context(); AgendaEntry editedEntry; - QDateTime newEntryDateTime = iController.context().focusDateAndTime(); - - // Check if it is not on same day and set the default time and date accordingly. - bool isSameDay = CalenDateUtils::isOnToday(newEntryDateTime); - if (!isSameDay) { - newEntryDateTime = CalenDateUtils::defaultTime(newEntryDateTime); + + QDateTime newEntryDateTime = iController.context().startDateAndTimeForNewInstance(); + if (newEntryDateTime.isValid()) { + // Use start date and time from context, reset it before next usage + iController.context().setStartDateAndTimeForNewInstance(QDateTime()); + } else { + // Use focused date and time from context + newEntryDateTime = iController.context().focusDateAndTime(); + // Check if it is not on same day and set the default time and date accordingly. + bool isSameDay = CalenDateUtils::isOnToday(newEntryDateTime); + if (!isSameDay) { + newEntryDateTime = CalenDateUtils::defaultTime(newEntryDateTime); + } } switch ( command ) { @@ -123,6 +130,7 @@ iEditor->create(newEntryDateTime, false, CalenEditor::TypeAppointment ); connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved())); connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed())); + connect(iEditor, SIGNAL(forcedExit()), this, SLOT(handleForcedExit())); break; case ECalenEditCurrentEntry: editedEntry = iController.Services().agendaInterface()->fetchById( @@ -139,6 +147,7 @@ iEditor->edit(editedEntry, false); connect(iEditor, SIGNAL(entrySaved()), this, SLOT(handleEntrySaved())); connect(iEditor, SIGNAL(dialogClosed()), this, SLOT(handleDialogClosed())); + connect(iEditor, SIGNAL(forcedExit()), this, SLOT(handleForcedExit())); } break; default: @@ -203,6 +212,20 @@ // void CCalenEditUi::saveAndCloseEditor() { + OstTraceFunctionEntry0( CCALENEDITUI_SAVEANDCLOSEEDITOR_ENTRY ); iEditor->saveAndCloseEditor(); + OstTraceFunctionExit0( CCALENEDITUI_SAVEANDCLOSEEDITOR_EXIT ); + } + +// ---------------------------------------------------------------------------- +// CCalenEditUi::handleForcedExit +// notification for forced exit +// ---------------------------------------------------------------------------- +// +void CCalenEditUi::handleForcedExit() + { + OstTraceFunctionEntry0( CCALENEDITUI_HANDLEFORCEDEXIT_ENTRY ); + iController.Services().IssueNotificationL(ECalenNotifyForcedExit); + OstTraceFunctionExit0( CCALENEDITUI_HANDLEFORCEDEXIT_EXIT); } // End of file diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/controller/traces/calenedituiTraces.h --- a/calendarui/controller/traces/calenedituiTraces.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/controller/traces/calenedituiTraces.h Fri Oct 15 12:10:36 2010 +0530 @@ -22,6 +22,10 @@ #define CCALENEDITUI_HANDLEDIALOGCLOSED_EXIT 0x8a00d7 #define CCALENEDITUI_HANDLENOTIFICATION_ENTRY 0x8a00d8 #define CCALENEDITUI_HANDLENOTIFICATION_EXIT 0x8a00d9 +#define CCALENEDITUI_SAVEANDCLOSEEDITOR_ENTRY 0x8a01fb +#define CCALENEDITUI_SAVEANDCLOSEEDITOR_EXIT 0x8a01fc +#define CCALENEDITUI_HANDLEFORCEDEXIT_ENTRY 0x8a01fd +#define CCALENEDITUI_HANDLEFORCEDEXIT_EXIT 0x8a01fe #endif diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/controller/traces/fixed_id.definitions --- a/calendarui/controller/traces/fixed_id.definitions Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/controller/traces/fixed_id.definitions Fri Oct 15 12:10:36 2010 +0530 @@ -288,10 +288,14 @@ [TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_HANDLEDIALOGCLOSED_EXIT=0xd7 [TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_HANDLEENTRYSAVED_ENTRY=0xd4 [TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_HANDLEENTRYSAVED_EXIT=0xd5 +[TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_HANDLEFORCEDEXIT_ENTRY=0x1fd +[TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_HANDLEFORCEDEXIT_EXIT=0x1fe [TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_HANDLENOTIFICATION_ENTRY=0xd8 [TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_HANDLENOTIFICATION_EXIT=0xd9 [TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_NEWL_ENTRY=0xca [TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_NEWL_EXIT=0xcb +[TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_SAVEANDCLOSEEDITOR_ENTRY=0x1fb +[TRACE]TRACE_FLOW[0x8A]_CCALENEDITUI_SAVEANDCLOSEEDITOR_EXIT=0x1fc [TRACE]TRACE_FLOW[0x8A]_CCALENEXITINGSTATE_CCALENEXITINGSTATE_ENTRY=0xde [TRACE]TRACE_FLOW[0x8A]_CCALENEXITINGSTATE_CCALENEXITINGSTATE_EXIT=0xdf [TRACE]TRACE_FLOW[0x8A]_CCALENEXITINGSTATE_CONSTRUCTL_ENTRY=0xdc diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/globaldata/inc/calencontext.h --- a/calendarui/globaldata/inc/calencontext.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/globaldata/inc/calencontext.h Fri Oct 15 12:10:36 2010 +0530 @@ -80,6 +80,13 @@ */ virtual void setFocusDateAndTimeAndInstance( const QDateTime& focusDateTime, const TCalenInstanceId& aInstanceId ) = 0; + + /** + * Sets start date and time that should be used for creating new instance. + * + * @param startDateTime Start date and time for new instance + */ + virtual void setStartDateAndTimeForNewInstance(const QDateTime &startDateTime) = 0; // Getters /** @@ -103,6 +110,14 @@ * this will be TCalenInstanceId::NullInstanceIdL() */ virtual TCalenInstanceId instanceId() const = 0; + + /** + * Returns start date and time that should be used for creating new instance. + * Check isValid() to verify if returnd value is valid. + * + * @return Start date and time for new instance + */ + virtual QDateTime startDateAndTimeForNewInstance() const = 0; public: // For Mutliple Context Support diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/globaldata/inc/calencontextimpl.h --- a/calendarui/globaldata/inc/calencontextimpl.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/globaldata/inc/calencontextimpl.h Fri Oct 15 12:10:36 2010 +0530 @@ -98,6 +98,13 @@ */ void setFocusDateAndTimeAndInstance( const QDateTime& focusDateTime, const TCalenInstanceId& aInstanceId); + + /** + * Sets start date and time that should be used for creating new instance. + * + * @param startDateTime Start date and time for new instance + */ + void setStartDateAndTimeForNewInstance(const QDateTime &startDateTime); // Getters /** @@ -120,7 +127,14 @@ * this will be TCalenInstanceId::NullInstanceIdL() */ TCalenInstanceId instanceId() const; - + + /** + * Returns start date and time that should be used for creating new instance. + * Check isValid() to verify if returnd value is valid. + * + * @return Start date and time for new instance + */ + QDateTime startDateAndTimeForNewInstance() const; public: // Multiple Context support @@ -167,6 +181,10 @@ // Multiple context ids QList mMutlipleContextIds; + /** + * Indicates if default time should be used for new instance creation. + */ + QDateTime mDateTimeForNewInstance; }; #endif // CALENCONTEXTIMPL_H diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/globaldata/src/calencontextimpl.cpp --- a/calendarui/globaldata/src/calencontextimpl.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/globaldata/src/calencontextimpl.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -195,6 +195,18 @@ } // ----------------------------------------------------------------------------- +// CalenContextImpl::setStartDateAndTimeForNewInstance +// Sets start date and time that should be used for creating new instance. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CalenContextImpl::setStartDateAndTimeForNewInstance( + const QDateTime &startDateTime) + { + mDateTimeForNewInstance = startDateTime; + } + +// ----------------------------------------------------------------------------- // CalenContextImpl::FocusDateAndTimeL // Returns the focus time // (other items were commented in a header). @@ -243,6 +255,17 @@ } // ----------------------------------------------------------------------------- +// CalenContextImpl::startDateAndTimeForNewInstance +// Returns start date and time that should be used for creating new instance. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +QDateTime CalenContextImpl::startDateAndTimeForNewInstance() const + { + return mDateTimeForNewInstance; + } + +// ----------------------------------------------------------------------------- // CalenContextImpl::SetMutlipleContextIds // Set multiple context ids // (other items were commented in a header). diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/rom/calendarresources.iby --- a/calendarui/rom/calendarresources.iby Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/rom/calendarresources.iby Fri Oct 15 12:10:36 2010 +0530 @@ -26,7 +26,7 @@ S60_APP_RESOURCE(calendar) data=DATAZ_/QT_TRANSLATIONS_DIR/calendar.qm QT_TRANSLATIONS_DIR/calendar.qm data=DATAZ_/QT_TRANSLATIONS_DIR/caleneditor.qm QT_TRANSLATIONS_DIR/caleneditor.qm -data=DATAZ_/QT_TRANSLATIONS_DIR/caleneventviewer.qm QT_TRANSLATIONS_DIR/caleneventviewer.qm +data=DATAZ_/QT_TRANSLATIONS_DIR/eventviewer.qm QT_TRANSLATIONS_DIR/eventviewer.qm data=DATAZ_/QT_TRANSLATIONS_DIR/calenregional.qm QT_TRANSLATIONS_DIR/calenregional.qm #endif // CALENDARRESOURCE_IBY diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/inc/calendaycontainer.h --- a/calendarui/views/dayview/inc/calendaycontainer.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/inc/calendaycontainer.h Fri Oct 15 12:10:36 2010 +0530 @@ -27,6 +27,8 @@ // Forward declarations class CalenDayInfo; class TouchEventAbsorber; +class CalenDayEventsPane; +class CalenDayItem; // Class declaration class CalenDayContainer : public HbAbstractItemContainer @@ -34,7 +36,7 @@ Q_OBJECT public: - CalenDayContainer(QGraphicsItem *parent = 0); + CalenDayContainer(QGraphicsObject *parent = 0); ~CalenDayContainer(); void itemAdded(int index, HbAbstractViewItem *item, bool animate); @@ -46,9 +48,12 @@ CalenDayInfo* dayInfo(); void setDate(const QDate &date); const QDate &date() const; + + QDateTime dateTimeAtPos(const QPointF &pos); public slots: void orientationChanged(Qt::Orientation orientation); + void updateFloatingItemsList(const CalenDayItem *item); protected: HbAbstractViewItem * createDefaultPrototype() const; @@ -102,6 +107,8 @@ LayoutValues mLayoutValues; //!< Keeps layout values, see LayoutValues class QList mAbsorbers; //!< Keeps needed touch absorbers QDate mDate; //!< Keeps date currently associated with this container + QList mFloatingItemsList; //! mEventsPaneElements; //!< List of event panes }; diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/inc/calendayitem.h --- a/calendarui/views/dayview/inc/calendayitem.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/inc/calendayitem.h Fri Oct 15 12:10:36 2010 +0530 @@ -35,7 +35,19 @@ Q_OBJECT Q_PROPERTY( bool eventDescription READ hasEventDescription ) Q_PROPERTY( bool backgroundFrame READ hasBackgroundFrame ) - + Q_PROPERTY( BackgroundType backgroundType READ backgroundType ) + Q_ENUMS( BackgroundType ) + +public: + //Due to HbFrameItem size limitation (2047px) in case when we have long lasting + //events, background item has the same height as screen and needs to be scrolled + //along with the view. By default background type is set as static but final decision + //is made when handling resize event i.e. when geomtry of event is already known. + enum BackgroundType{ + EStaticBackground, + EFloatingBackground + }; + public: CalenDayItem(const CalenDayContainer *container); virtual ~CalenDayItem(); @@ -43,8 +55,15 @@ void updateChildItems(); bool hasEventDescription() const { return mEventDesc->isVisible(); } bool hasBackgroundFrame() const { return mBg->isVisible(); } + BackgroundType backgroundType() const { return mBackgroundType; } const CalenDayContainer *container() const { return mContainer; } + +public slots: + void scrollBackground(const QPointF &pos); +signals: + void backgroundTypeChanged(const CalenDayItem *item); + protected: void resizeEvent(QGraphicsSceneResizeEvent *event); @@ -62,6 +81,8 @@ CalenDayStatusStrip *mColorStripe; const CalenDayContainer *mContainer; + + BackgroundType mBackgroundType; }; #endif // CALENDAYITEM_H diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/inc/calendayitemview.h --- a/calendarui/views/dayview/inc/calendayitemview.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/inc/calendayitemview.h Fri Oct 15 12:10:36 2010 +0530 @@ -66,6 +66,9 @@ void modelReset(); void scrollVertically(const QPointF &newPosition); + +public: + void gestureEvent(QGestureEvent *event); private slots: diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/inc/calendayutils.h --- a/calendarui/views/dayview/inc/calendayutils.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/inc/calendayutils.h Fri Oct 15 12:10:36 2010 +0530 @@ -30,6 +30,7 @@ ~CalenDayUtils(); qreal screenWidth() const; + qreal screenHeight() const; qreal hourElementWidth() const; qreal hourElementHeight() const; qreal minEventHeight() const; diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/resources/calendayeventspane.css --- a/calendarui/views/dayview/resources/calendayeventspane.css Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/resources/calendayeventspane.css Fri Oct 15 12:10:36 2010 +0530 @@ -1,4 +1,4 @@ CalenDayEventsPane { - pref-height: expr(2*var(hb-param-text-height-secondary) + 2*var(hb-param-margin-gene-middle-vertical) + 4.1un); + pref-height: expr(2*var(hb-param-text-height-secondary) + 2*var(hb-param-margin-gene-middle-vertical) + 5un); size-policy-vertical: fixed; } \ No newline at end of file diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/resources/calendayhourelement.css --- a/calendarui/views/dayview/resources/calendayhourelement.css Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/resources/calendayhourelement.css Fri Oct 15 12:10:36 2010 +0530 @@ -1,6 +1,6 @@ CalenDayHourElement { layout: customCalendarLayout; - pref-height: expr(2*var(hb-param-text-height-secondary) + 2*var(hb-param-margin-gene-middle-vertical) + 4.1un); + pref-height: expr(2*var(hb-param-text-height-secondary) + 2*var(hb-param-margin-gene-middle-vertical) + 5un); size-policy-vertical: fixed; } @@ -25,6 +25,6 @@ } CalenDayHourElement::bottomSpacer{ - pref-height: 4.1un; + pref-height: 5un; size-policy-vertical: expanding; } \ No newline at end of file diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/resources/calendayitem.css --- a/calendarui/views/dayview/resources/calendayitem.css Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/resources/calendayitem.css Fri Oct 15 12:10:36 2010 +0530 @@ -1,13 +1,21 @@ -CalenDayItem { - layout: noIconLayout; +CalenDayItem[backgroundFrame][eventDescription][backgroundType=EStaticBackground]{ + layout: default; /*all elements are placed on layout*/ +} + +CalenDayItem[backgroundFrame][!eventDescription][backgroundType=EStaticBackground]{ + layout: backgroundStripe; } -CalenDayItem[!eventDescription][!backgroundFrame] { - layout: noIconNoTextNoBkgLayout; +CalenDayItem[backgroundFrame][eventDescription][backgroundType=EFloatingBackground]{ + layout: stripeText; } -CalenDayItem[!eventDescription][backgroundFrame] { - layout: noIconNoTextLayout; +CalenDayItem[backgroundFrame][!eventDescription][backgroundType=EFloatingBackground]{ + layout: stripeWithMargins; +} + +CalenDayItem[!backgroundFrame][!eventDescription]{ + layout: stripeNoMargins; } CalenDayItem::eventDescription { diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/resources/calendayitem.widgetml --- a/calendarui/views/dayview/resources/calendayitem.widgetml Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/resources/calendayitem.widgetml Fri Oct 15 12:10:36 2010 +0530 @@ -1,11 +1,11 @@ - + - + @@ -16,19 +16,37 @@ - + - + - + - - + + + + + + + + + + + + + + + + + + + + diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/src/calendaycontainer.cpp --- a/calendarui/views/dayview/src/calendaycontainer.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/src/calendaycontainer.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -53,9 +53,10 @@ Sets container initial geometry, creates hours area widgets. \param parent Parent object */ -CalenDayContainer::CalenDayContainer(QGraphicsItem *parent) : +CalenDayContainer::CalenDayContainer(QGraphicsObject *parent) : HbAbstractItemContainer(parent), mGeometryUpdated(false), mInfo(0) { + mEventsPaneElements.clear(); getTimedEventLayoutValues(mLayoutValues); QGraphicsLinearLayout* timeLinesLayout = new QGraphicsLinearLayout( @@ -67,6 +68,7 @@ element->setDrawTopLine(true); } timeLinesLayout->addItem(element); + mEventsPaneElements.append(element); } timeLinesLayout->setContentsMargins(0.0, 0.0, 0.0, 0.0); timeLinesLayout->setSpacing(0.0); @@ -434,11 +436,6 @@ mDate = date; } -// ----------------------------------------------------------------------------- -// date() -// Returns date of the container. -// ----------------------------------------------------------------------------- -// /*! \brief Returns date of the container. @@ -450,6 +447,43 @@ } /*! + \brief Calculates date and time for scene position given by parameter. + If date and time for given position cannot be calculated, invalid dateTime is returned. + The accuracy of returned time is 30 minutes. + + \sa pos Position in scene. + */ +QDateTime CalenDayContainer::dateTimeAtPos(const QPointF &pos) +{ + QPointF pointPos = mapFromScene(pos); + QDateTime dateTime; + int hour = -1; + int minutes = 0; + for (int i = 0; i < mEventsPaneElements.count(); i++) { + QRectF paneGeometry = mEventsPaneElements.at(i)->geometry(); + if (paneGeometry.contains(pointPos)) { + hour = i; + QRectF firstHalf(paneGeometry.left(), paneGeometry.top(), + paneGeometry.width(), paneGeometry.height() / 2); + if (firstHalf.contains(pointPos)) { + minutes = 0; + } + else { + minutes = 30; + } + break; + } + } + + if (hour >= 0) { + dateTime.setDate(mDate); + dateTime.setTime(QTime(hour, minutes)); + } + + return dateTime; +} + +/*! \brief Slot handles layout switch. \a orientation current device orientation */ @@ -544,6 +578,41 @@ return absorber; } +/*! + \brief This slot is called when backround type of item changes. It maintains mFloatingItemsList. + Thanks that scroll events are propagated only to items that might be interested in getting such + information. + + \a item Pointer to the item that reported backround type change. + */ +void CalenDayContainer::updateFloatingItemsList(const CalenDayItem *item) +{ + if(!item){ + return; + } + + bool isItemOnList = mFloatingItemsList.contains(item); + + switch(item->backgroundType()){ + + case CalenDayItem::EFloatingBackground: + + if(!isItemOnList){ + connect(itemView(), SIGNAL(scrollPositionChanged(const QPointF&)), item, SLOT(scrollBackground(const QPointF&))); + mFloatingItemsList.append(item); + } + break; + + case CalenDayItem::EStaticBackground: + + if(isItemOnList){ + disconnect(itemView(), SIGNAL(scrollPositionChanged(const QPointF&)), item, SLOT(scrollBackground(const QPointF&))); + mFloatingItemsList.removeOne(item); + } + break; + } +} + /*! \brief Handles tap event on overlapping area diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/src/calendaycontentscrollarea.cpp --- a/calendarui/views/dayview/src/calendaycontentscrollarea.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/src/calendaycontentscrollarea.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -32,13 +32,14 @@ */ const int KCalenScrollDaysTimeout = 600; +#ifdef CALENDAYVIEW_PANNING_ENABLED /*! Value [%] defines how long (depending on content area width) should horizontal pan gesture be to change day to previous/next. If the gesture is shorter - current view is not changed. */ const int KCalenHScrollMoveParam = 30; //!< Percentage - +#endif /*! \class CalenDayContentScrollArea diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/src/calendayitem.cpp --- a/calendarui/views/dayview/src/calendayitem.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/src/calendayitem.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -22,6 +22,7 @@ #include #include #include +#include // User includes #include "calendaycommonheaders.h" @@ -36,8 +37,9 @@ \brief Constructor. */ CalenDayItem::CalenDayItem(const CalenDayContainer *container) : - mContainer(container), mUpdated(false), mBg(0), mEventDesc(0), - mColorStripe(0), mEventDescMinWidth(0.0), mFrameMinWidth(0.0) + mUpdated(false), mEventDescMinWidth(0.0), mFrameMinWidth(0.0), + mBg(0), mEventDesc(0), mColorStripe(0), + mContainer(container), mBackgroundType(EStaticBackground) { } @@ -45,12 +47,14 @@ \brief Constructor. */ CalenDayItem::CalenDayItem(const CalenDayItem & source) : - HbAbstractViewItem(source), mContainer(source.container()), - mUpdated(false), mBg(0), mEventDesc(0), mColorStripe(0), - mEventDescMinWidth(0.0), mFrameMinWidth(0.0) + HbAbstractViewItem(source), + mUpdated(false), mEventDescMinWidth(0.0), + mFrameMinWidth(0.0), mBg(0), mEventDesc(0), + mColorStripe(0), mContainer(source.container()), + mBackgroundType(EStaticBackground) { - mBg = new HbFrameItem("qtg_fr_cal_meeting_bg", HbFrameDrawer::NinePieces, - this); + mBg = new HbFrameItem("qtg_fr_cal_meeting_bg", HbFrameDrawer::NinePieces, this); + mEventDesc = new HbTextItem(this); // TODO: probably ElideLeft needed for mirrored layout mEventDesc->setElideMode(Qt::ElideRight); @@ -74,6 +78,8 @@ // Minimum width is assured by widgetml and css, additionally called here // to prevent minimum size hint caching inside effectiveSizeHint setMinimumWidth(stripeWidth); + + connect(this, SIGNAL(backgroundTypeChanged(const CalenDayItem*)), mContainer, SLOT(updateFloatingItemsList(const CalenDayItem*))); } /*! @@ -210,16 +216,24 @@ Q_UNUSED(event) qreal width = rect().width(); + qreal height = rect().height(); + + //Backround height can't be bigger the screen. If event is long enough + //backround will start to float together with view content. + mBg->setMaximumHeight(CalenDayUtils::instance()->screenHeight()); HbDeviceProfile deviceProfile; if (width < mEventDescMinWidth) { mColorStripe->setPreferredWidth(KCalenMinTimeStripWidth * deviceProfile.unitValue()); + mBg->setMaximumWidth(KCalenMinEventWidth + * deviceProfile.unitValue()); mEventDesc->hide(); } else { mColorStripe->setPreferredWidth(KCalenTimeStripWidth * deviceProfile.unitValue()); + mBg->setMaximumWidth(CalenDayUtils::instance()->screenWidth()); mEventDesc->show(); } @@ -229,9 +243,65 @@ else { mBg->show(); } + + //If following condition is fulfilled then background item needs to be + //switched to floating one. + if (height > CalenDayUtils::instance()->screenHeight()) { + + //If background item is floating then it needs to be removed from + //layout (see css & widgetml). In this case we need to take care of setting its + //geometry by ourselves. + QRectF newRect = rect(); + qreal baseY = pos().y(); + qreal mappedY = mapFromScene(pos()).y(); + qreal normalizedY = mappedY - baseY; //aligns background to the top of viewport + //Check whether background won't go out of the event's rectangle + if(normalizedY < newRect.top()){ + normalizedY = newRect.top(); + } + newRect.setY(normalizedY); + mBg->setGeometry(newRect); + + //Notify the container about background type change. + //From now on this object is going to receive information + //about scrolling. + if (mBackgroundType == EStaticBackground) { + mBackgroundType = EFloatingBackground; + emit backgroundTypeChanged(this); + } + }else if (mBackgroundType == EFloatingBackground) { + mBackgroundType = EStaticBackground; + emit backgroundTypeChanged(this); + } // Necessary to switch layout repolish(); } +/*! + \brief This slot is triggered when backround type is set as EFloatingBackground. + It allows to scroll backround along with view content. + + \param pos Positoin to which backround needs to be scrolled. + */ +void CalenDayItem::scrollBackground(const QPointF &pos) +{ + qreal newY = mapFromParent(pos).y(); + //margin to ensure that rounded corners will stay hidden + const qreal margin = 5.0; + + if (newY > rect().top() && newY + mBg->rect().height() < rect().bottom()) { + + mBg->setY(newY - margin); + } + else if (newY < rect().top()) { //condition for top boundary + + mBg->setY(rect().top()); + + }else if (newY + mBg->rect().height() > rect().bottom()) { //condition for bottom boundary + + mBg->setY(rect().bottom() - mBg->rect().height()); + } +} + // End of File diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/src/calendayitemview.cpp --- a/calendarui/views/dayview/src/calendayitemview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/src/calendayitemview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -21,6 +21,7 @@ #include #include #include +#include // User includes #include "calendayitemview.h" @@ -196,6 +197,33 @@ } /*! + \brief Handles gesture events in CalenDayItemView. + + Handles Tap gesture and launches the editor with given start position. + + \param event Gesture event + */ +void CalenDayItemView::gestureEvent(QGestureEvent *event) +{ + HbTapGesture *tapGesture = qobject_cast (event->gesture( + Qt::TapGesture)); + + if (tapGesture) { + if (tapGesture->state() == Qt::GestureFinished) { + QPointF pos = tapGesture->scenePosition(); + QDateTime dateTime = mContainer->dateTimeAtPos(pos); + if (dateTime.isValid()) { + mServices.Context().setStartDateAndTimeForNewInstance(dateTime); + TRAP_IGNORE( mServices.IssueCommandL(ECalenNewMeeting); ); + } + } + } + else { + HbAbstractItemView::gestureEvent(event); + } +} + +/*! \brief This function is called when a touch press event is received within Abstract view item that is representing index. Currently it does nothing. diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/src/calendayutils.cpp --- a/calendarui/views/dayview/src/calendayutils.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/src/calendayutils.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -77,6 +77,18 @@ } /*! + \brief screenHeight + + \return Height of main window's screen + */ +qreal CalenDayUtils::screenHeight() const +{ + ASSERT(mMainWindow); + + return mMainWindow->layoutRect().height(); +} + +/*! \brief hourElementWidth \return Width of hour element @@ -222,7 +234,7 @@ qreal textHeight = 0.0; qreal verticalSpacing = 0.0; - qreal bottomSpacer = 4.1 * unitInPixels; + qreal bottomSpacer = 5 * unitInPixels; style.parameter(QString("hb-param-text-height-secondary"), textHeight, deviceProfile); style.parameter(QString("hb-param-margin-gene-middle-vertical"), diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/src/calendayview.cpp --- a/calendarui/views/dayview/src/calendayview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/src/calendayview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -59,11 +59,10 @@ CalenDayView::CalenDayView(MCalenServices &services) : CalenNativeView(services), mContentScrollArea(NULL), mContentWidget(NULL), mHourScrollArea(NULL), mVLayout(NULL), mMainContainer(NULL), - mDocLoader(NULL), mIsLaunching(true), mSettingsManager(NULL), - mRegionalInfoKey(XQSettingsKey::TargetCentralRepository, - KCRUidCalendar, KCalendarShowRegionalInfo), mServices(services), - mRegionalInfoGroupBox(NULL), mGoToTodayMenuAction(NULL), mBg(NULL), - mGesturesAbsorber(NULL) + mDocLoader(NULL), mIsLaunching(true), mGesturesAbsorber(NULL), + mSettingsManager(NULL), mRegionalInfoKey(XQSettingsKey::TargetCentralRepository, + KCRUidCalendar, KCalendarShowRegionalInfo), mServices(services), + mRegionalInfoGroupBox(NULL), mGoToTodayMenuAction(NULL), mBg(NULL) { setupMenu(); @@ -544,6 +543,8 @@ CalenPluginLabel *regionalInfo = new CalenPluginLabel( mServices, this); regionalInfo->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + regionalInfo->setTextWrapping(Hb::TextNoWrap); + regionalInfo->setElideMode(Qt::ElideRight); mRegionalInfoGroupBox->setContentWidget(regionalInfo); mVLayout->insertItem(1, mRegionalInfoGroupBox); } diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendaycontainer/calendaycontainertest.h --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendaycontainer/calendaycontainertest.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendaycontainer/calendaycontainertest.h Fri Oct 15 12:10:36 2010 +0530 @@ -19,6 +19,10 @@ #define CALENDAYCONTAINERTEST_H #include +#include +#include + +#include "calendayitem.h" #include "calendaycontainer.h" class CalenDayContainerTest : public CalenDayContainer @@ -26,7 +30,7 @@ Q_OBJECT public: - CalenDayContainerTest(QGraphicsItem *parent = 0) + CalenDayContainerTest(QGraphicsObject *parent = 0) : CalenDayContainer(parent) { @@ -36,5 +40,43 @@ friend class TestCalenDayContainer; }; +class CalenDayItemTest : public CalenDayItem +{ + Q_OBJECT + +public: + CalenDayItemTest(const CalenDayContainer *container) + : CalenDayItem(container) + { + + } + + friend class TestCalenDayContainer; +}; + +class CalenDayItemViewTest : public HbAbstractItemView +{ +public: + CalenDayItemViewTest(HbAbstractItemContainer *container, + HbModelIterator *iterator, + QGraphicsItem *parent = 0) + : HbAbstractItemView(container, iterator, parent) + { + } + + int connectedSlots(const char * signal) + { + return receivers(signal); + } + + void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) + { + Q_UNUSED(index) + Q_UNUSED(hint) + } + + friend class TestCalenDayContainer; +}; + #endif diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendaycontainer/unittest_calendaycontainer.cpp --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendaycontainer/unittest_calendaycontainer.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendaycontainer/unittest_calendaycontainer.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -22,7 +22,7 @@ #include "calendayinfo.h" #include "calendaymodel.h" -#include "calendayitem.h" +#include "calendayeventspane.h" #define private public @@ -34,6 +34,7 @@ // Test variables QRectF gTestWindowRect = QRectF(0, 0, 10, 20); Qt::Orientation gTestOrientation = Qt::Vertical; +QSizeF gTestContainerSize = QSizeF(100, 500); class TestCalenDayContainer : public QObject { @@ -57,10 +58,12 @@ void testReset(); void testViewResized(); void testOrientationChanged(); + void testupdateFloatingItemsList(); void testCreateDefaultPrototype(); void testGetTimedEventLayoutValues(); void testCreateTouchEventAbsorbers(); void testCrateAbsorberBetweenSlots(); + void testDateTimeAtPos(); private: @@ -249,7 +252,7 @@ } /*! - It test change of orientation based on count of absorbers + It tests change of orientation based on count of absorbers */ void TestCalenDayContainer::testOrientationChanged() { @@ -262,6 +265,46 @@ } /*! + Test function that maintains floating items list + 1) Null pointer check + 2) Floating item notification received + 3) The same floating item notification received + 4) Static item notification received + */ +void TestCalenDayContainer::testupdateFloatingItemsList() +{ + + CalenDayItemViewTest *itemView = new CalenDayItemViewTest(mContainer, new HbModelIterator()); + //CalenDayContainer *container = itemView->mContainer; + const int floatingItemsCount = mContainer->mFloatingItemsList.count(); + const int connectedSlotsCount = itemView->connectedSlots(SIGNAL(scrollPositionChanged(const QPointF&))); + + // 1) Test null pointer + mContainer->updateFloatingItemsList(0); + //Nothing happend, list remains unchanged + QCOMPARE(mContainer->mFloatingItemsList.count(), floatingItemsCount); + QCOMPARE(itemView->connectedSlots(SIGNAL(scrollPositionChanged(const QPointF&))), connectedSlotsCount); + + // 2) Floating item notification received + CalenDayItemTest *item = new CalenDayItemTest(mContainer); + item->mBackgroundType = CalenDayItem::EFloatingBackground; + mContainer->updateFloatingItemsList(item); + QCOMPARE(mContainer->mFloatingItemsList.count(), floatingItemsCount + 1); + QCOMPARE(itemView->connectedSlots(SIGNAL(scrollPositionChanged(const QPointF&))), connectedSlotsCount + 1); + + // 3) The same floating item notification received + mContainer->updateFloatingItemsList(item); + QCOMPARE(mContainer->mFloatingItemsList.count(), floatingItemsCount + 1); + QCOMPARE(itemView->connectedSlots(SIGNAL(scrollPositionChanged(const QPointF&))), connectedSlotsCount + 1); + + // 4) Static item notification received + item->mBackgroundType = CalenDayItem::EStaticBackground; + mContainer->updateFloatingItemsList(item); + QCOMPARE(mContainer->mFloatingItemsList.count(), floatingItemsCount); + QCOMPARE(itemView->connectedSlots(SIGNAL(scrollPositionChanged(const QPointF&))), connectedSlotsCount); +} + +/*! Test creating item prototype */ void TestCalenDayContainer::testCreateDefaultPrototype() @@ -323,6 +366,38 @@ delete testValue; } +/*! + Test dateTimeAtPos + 1. Position outside control + 2. Position in control, first half of hour (0-30 min) + 3. Position in control, second half of hour (30-60 min) + */ +void TestCalenDayContainer::testDateTimeAtPos() +{ + mContainer->setDate(QDate(2010, 10, 1)); + mContainer->viewResized(gTestContainerSize); + + QRectF geometry = mContainer->mEventsPaneElements.at(0)->geometry(); + qreal halfHour = geometry.height() / 2; + + //1) + QPointF point(50, geometry.top() - 10); + QDateTime dateTime = mContainer->dateTimeAtPos(point); + QVERIFY(!dateTime.isValid()); + + //2) + point = QPointF(50, geometry.top() + halfHour - 1); + dateTime = mContainer->dateTimeAtPos(point); + QVERIFY(dateTime.isValid()); + QCOMPARE(dateTime.time(), QTime(0, 0)); + + //3) + point = QPointF(50, geometry.top() + halfHour + 1); + dateTime = mContainer->dateTimeAtPos(point); + QVERIFY(dateTime.isValid()); + QCOMPARE(dateTime.time(), QTime(0, 30)); +} + QTEST_MAIN(TestCalenDayContainer); #include "unittest_calendaycontainer.moc" diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendaycontentscrollarea/hbmainwindow.h --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendaycontentscrollarea/hbmainwindow.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendaycontentscrollarea/hbmainwindow.h Fri Oct 15 12:10:36 2010 +0530 @@ -29,6 +29,8 @@ */ class HbMainWindow : public QObject { + Q_OBJECT + public: HbMainWindow() { diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/calendayitemtest.h --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/calendayitemtest.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/calendayitemtest.h Fri Oct 15 12:10:36 2010 +0530 @@ -43,7 +43,17 @@ class CalenDayItemTest : public CalenDayItem { + public: + CalenDayItemTest::CalenDayItemTest(): + CalenDayItem(0) + {} + + CalenDayItemTest::CalenDayItemTest(const CalenDayItemTest&): + CalenDayItem(0) + { + } + CalenDayItemTest::CalenDayItemTest(const CalenDayContainer *container) : CalenDayItem(container) { @@ -74,7 +84,15 @@ // to prevent minimum size hint caching inside effectiveSizeHint setMinimumWidth(stripeWidth); #endif + connect(this, SIGNAL(backgroundTypeChanged(const CalenDayItem*)), container, SLOT(updateFloatingItemsList(const CalenDayItem*))); + } + + int connectedSlots(const char * signal) + { + return receivers(signal); } }; +Q_DECLARE_METATYPE(CalenDayItemTest*) + #endif diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/unittest_calendayitem.cpp --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/unittest_calendayitem.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/unittest_calendayitem.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -38,8 +38,9 @@ #include "calenagendautils.h" #include "calendaycontainer.h" + +#define private public #ifndef __WINSCW__ -#define private public #define protected public #endif @@ -70,6 +71,8 @@ void testHasBackgroundFrame(); void testSetDescription(); void testSetStatusStrip(); + void testFloatingBackground(); + void testScrollBackground(); void testConstructors(); private: @@ -141,6 +144,7 @@ Test function for constructors 1. Test if content widget is not initialized 2. Test if content widget is correcty created + 3. Test whether connection to container has been established properly */ void TestCalenDayItem::testConstructors() { @@ -151,6 +155,10 @@ //2) testItem = new CalenDayItemTest(mContainer); QVERIFY(testItem); + + //3) + QCOMPARE(testItem->connectedSlots(SIGNAL(backgroundTypeChanged(const CalenDayItem*))), 1); + delete testItem; } @@ -349,5 +357,105 @@ #endif } + +/*! + Test floating background functionality + 1. Event is higher then screen (background starts to float) + 2. Orientation changed + 3. Event is higher then screen but item is already set as floating + 4. Event's layout switches from floating to static + 5. Static event remains smaller then screen height + */ +void TestCalenDayItem::testFloatingBackground() +{ +#ifndef __WINSCW__ + qRegisterMetaType("const CalenDayItem*"); + + QSignalSpy spy(mItem, SIGNAL(backgroundTypeChanged(const CalenDayItem*))); + int emittedSignalsCount = 0; + + //1)Event is higher then screen (background starts to float) + gTestWindowRect = QRectF(0, 0, 320, 640); + mItem->mBackgroundType = CalenDayItem::EStaticBackground; + mItem->resize(30, 1000); + int bgHeight = mItem->mBg->rect().height(); + int screenHeight = CalenDayUtils::instance()->screenHeight(); + + QCOMPARE(bgHeight, screenHeight); + QCOMPARE(mItem->mBackgroundType, CalenDayItem::EFloatingBackground); + QCOMPARE(spy.count(), ++emittedSignalsCount); + + //2)Orientation changed + gTestWindowRect = QRectF(0, 0, 640, 320); + mItem->mBackgroundType = CalenDayItem::EStaticBackground; + mItem->resize(30, 1001); + bgHeight = mItem->mBg->rect().height(); + screenHeight = CalenDayUtils::instance()->screenHeight(); + + QCOMPARE(bgHeight, screenHeight); + QCOMPARE(mItem->mBackgroundType, CalenDayItem::EFloatingBackground); + QCOMPARE(spy.count(), ++emittedSignalsCount); + + //3)Event is higher then screen but item is already set as floating + mItem->resize(30, 1000); + bgHeight = mItem->mBg->rect().height(); + screenHeight = CalenDayUtils::instance()->screenHeight(); + + QCOMPARE(bgHeight, screenHeight); + QCOMPARE(mItem->mBackgroundType, CalenDayItem::EFloatingBackground); + QCOMPARE(spy.count(), emittedSignalsCount); + + //4)Event's layout switches from floating to static + mItem->setGeometry(0, 0, 30, 100); + QCOMPARE(mItem->mBackgroundType, CalenDayItem::EStaticBackground); + QCOMPARE(spy.count(), ++emittedSignalsCount); + + //5)Static event remains smaller then screen height + mItem->setGeometry(0, 0, 30, 200); + QCOMPARE(mItem->mBackgroundType, CalenDayItem::EStaticBackground); + QCOMPARE(spy.count(), emittedSignalsCount); +#endif +} + +/*! + Test scrolling background slot + 1. Position of background doesn't go out of events rectangle + 2. Position of background is out of the top edge + 3. Position of background is out of the bottom edge + */ +void TestCalenDayItem::testScrollBackground() +{ +#ifndef __WINSCW__ + gTestWindowRect = QRectF(0, 0, 240, 480); + mItem->setGeometry(0, 0, 30, 1000); + + //1)Position of background doesn't go out of events rectangle + QPointF pos(0, 50); + mItem->scrollBackground(pos); + int screenHeight = CalenDayUtils::instance()->screenHeight(); + int bgHeight = mItem->mBg->rect().height(); + + QCOMPARE(bgHeight, screenHeight); + QVERIFY(gTestWindowRect.contains(mItem->mBg->rect())); + + //2)Position of background is out of the top edge + pos = QPointF(0, -50); + mItem->scrollBackground(pos); + bgHeight = mItem->mBg->rect().height(); + + QCOMPARE(bgHeight, screenHeight); + QVERIFY(gTestWindowRect.contains(mItem->mBg->rect())); + + //3)Position of background is out of the bottom edge + pos = QPointF(0, 300); + mItem->scrollBackground(pos); + bgHeight = mItem->mBg->rect().height(); + + QCOMPARE(bgHeight, screenHeight); + QVERIFY(gTestWindowRect.contains(mItem->mBg->rect())); +#endif +} + QTEST_MAIN(TestCalenDayItem); + #include "unittest_calendayitem.moc" diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/calencontext.h --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/calencontext.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/calencontext.h Fri Oct 15 12:10:36 2010 +0530 @@ -23,16 +23,23 @@ class MCalenContext { - public: - MCalenContext() {} - - void setFocusDateAndTimeAndInstance( const QDateTime& focusDateTime, - const TCalenInstanceId& aInstanceId ) +public: + MCalenContext() + { + } + + void setFocusDateAndTimeAndInstance( + const QDateTime& focusDateTime, + const TCalenInstanceId& aInstanceId) { Q_UNUSED(focusDateTime); Q_UNUSED(aInstanceId); } - + + void setStartDateAndTimeForNewInstance(const QDateTime &startDateTime) + { + Q_UNUSED(startDateTime); + } }; #endif diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/unittest_calendayitemview.cpp --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/unittest_calendayitemview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/unittest_calendayitemview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -22,9 +22,11 @@ #include #include +#include #ifndef __WINSCW__ #define private public +#define protected public #endif #include "calendayitemview.h" @@ -58,6 +60,8 @@ void testSetContextMenu(); void testContextMenu(); void testModelReset(); + void testGestureEvent(); + private: MCalenServices mMCalenServices; CalenDayItemView *mCalenDayItemView; @@ -286,5 +290,36 @@ #endif } +/*! + Test gestureEvent + 1. Test with non-tap gesture + 2. Test with tap gesture + */ +void TestCalenItemView::testGestureEvent() +{ +#ifndef __WINSCW__ + QGestureEvent *gestureEvent = NULL; + + //1) + QList list; + QPanGesture *panGesture = new QPanGesture(); + list.append(panGesture); + gestureEvent = new QGestureEvent(list); + mCalenDayItemView->gestureEvent(gestureEvent); + + delete gestureEvent; + gestureEvent = NULL; + + //2) + QTapGesture *tapGesture = new QTapGesture(); + list.append(tapGesture); + gestureEvent = new QGestureEvent(list); + mCalenDayItemView->gestureEvent(gestureEvent); + + delete gestureEvent; + gestureEvent = NULL; +#endif +} + QTEST_MAIN(TestCalenItemView); #include "unittest_calendayitemview.moc" diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayutils/unittest_calendayutils.cpp --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayutils/unittest_calendayutils.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayutils/unittest_calendayutils.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -45,6 +45,7 @@ void testInstance(); void testScreenWidth(); + void testScreenHeight(); void testHourElementWidth(); void testHourElementHeight(); void testContentWidth(); @@ -120,6 +121,12 @@ QVERIFY(sw == gTestWindowRect.width()); } +void TestCalenDayUtils::testScreenHeight() +{ + qreal sw = mUtils->screenHeight(); + QVERIFY(sw == gTestWindowRect.height()); +} + void TestCalenDayUtils::testHourElementWidth() { qreal hEW = mUtils->hourElementWidth(); @@ -133,7 +140,7 @@ { qreal hEH = mUtils->hourElementHeight(); - qreal myHeight = mUnit * 4.1 + param_value * 2 + param_value * 2; + qreal myHeight = mUnit * 5 + param_value * 2 + param_value * 2; QCOMPARE(hEH, myHeight); } diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayview/calencontext.h --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayview/calencontext.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayview/calencontext.h Fri Oct 15 12:10:36 2010 +0530 @@ -59,9 +59,15 @@ Q_UNUSED(aInstanceId); mFocusedDate = focusDateTime; } + + void setStartDateAndTimeForNewInstance(const QDateTime &startDateTime) + { + mStartDateTime = startDateTime; + } private: QDateTime mFocusedDate; + QDateTime mStartDateTime; }; diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayview/rom/unittest_calendayview.iby --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayview/rom/unittest_calendayview.iby Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayview/rom/unittest_calendayview.iby Fri Oct 15 12:10:36 2010 +0530 @@ -15,14 +15,14 @@ * */ -#ifndef UNITTEST_CALENDAYITEM_IBY -#define UNITTEST_CALENDAYITEM_IBY +#ifndef UNITTEST_CALENDAYVIEW_IBY +#define UNITTEST_CALENDAYVIEW_IBY -S60_APP_EXE(unittest_calendayitem) -S60_APP_RESOURCE(unittest_calendayitem) +S60_APP_EXE(unittest_calendayview) +S60_APP_RESOURCE(unittest_calendayview) // Application registration file. data=DATAZ_\private\10003a3f\import\apps\unittest_calendayview_reg.rsc \private\10003a3f\import\apps\unittest_calendayview_reg.rsc -#endif // UNITTEST_CALENDAYITEM_IBY \ No newline at end of file +#endif // UNITTEST_CALENDAYVIEW_IBY \ No newline at end of file diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/dayview/tsrc/unittests/unittest_calendayview/unittest_calendayview.pro --- a/calendarui/views/dayview/tsrc/unittests/unittest_calendayview/unittest_calendayview.pro Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/dayview/tsrc/unittests/unittest_calendayview/unittest_calendayview.pro Fri Oct 15 12:10:36 2010 +0530 @@ -78,6 +78,9 @@ TARGET.CAPABILITY = CAP_APPLICATION MMP_RULES += "USERINCLUDE ." + BLD_INF_RULES.prj_testexports += \ + "./rom/unittest_calendayview.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unittest_calendayview.iby)" + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE LIBS += -lagendainterface \ diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/inc/calenagendaview.h --- a/calendarui/views/inc/calenagendaview.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/inc/calenagendaview.h Fri Oct 15 12:10:36 2010 +0530 @@ -179,7 +179,7 @@ QPointF mTapPoint; bool mActionTaken; bool mIsAboutToQuitEventConnected; // bool to check if agenda view is registered to get aboutToQuit signals - bool mDayViewActivated; + }; #endif /* CALENAGENDAVIEW_H */ diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/inc/calenmonthgrid.h --- a/calendarui/views/inc/calenmonthgrid.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/inc/calenmonthgrid.h Fri Oct 15 12:10:36 2010 +0530 @@ -104,6 +104,7 @@ QGraphicsWidget* mContentWidget; QList mLocalisedDates; QPointF mStartPos; + qreal mFutureMonthHeight; QColor mGridLineColor; bool mActiveDatesSet; bool mIsGridAdjusting; diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/inc/calennativeview.h --- a/calendarui/views/inc/calennativeview.h Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/inc/calennativeview.h Fri Oct 15 12:10:36 2010 +0530 @@ -102,6 +102,7 @@ private: QPointer mDatePicker; bool mIsCapturedScreenShotValid; // to check if the captured screenshot is valid + bool mForcedExit; }; #endif // CALENNATIVEVIEW_H diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/src/calenagendaview.cpp --- a/calendarui/views/src/calenagendaview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/src/calenagendaview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -51,8 +51,7 @@ mGoToTodayAction(NULL), mSwitchToDayViewAction(NULL), mActionTaken(false), -mIsAboutToQuitEventConnected(false), -mDayViewActivated(false) +mIsAboutToQuitEventConnected(false) { OstTraceFunctionEntry0( CALENAGENDAVIEW_CALENAGENDAVIEW_ENTRY ); @@ -129,7 +128,7 @@ void CalenAgendaView::doPopulation() { OstTraceFunctionEntry0( CALENAGENDAVIEW_DOPOPULATION_ENTRY ); - mDayViewActivated = false; + // The content widget has not been constructed. Don't do anything if (!mAgendaViewWidget) { OstTraceFunctionExit0( CALENAGENDAVIEW_DOPOPULATION_EXIT ); @@ -177,7 +176,7 @@ // Population is complete, issue a notification populationComplete(); - captureScreenshot(true); + OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_DOPOPULATION_EXIT ); } @@ -310,7 +309,7 @@ // void CalenAgendaView::createNewEvent() { - + captureScreenshot(true); mAgendaViewWidget->createNewEvent(); } @@ -372,7 +371,7 @@ void CalenAgendaView::launchDayView() { OstTraceFunctionEntry0( CALENAGENDAVIEW_LAUNCHDAYVIEW_ENTRY ); - mDayViewActivated = true; + // Issue the command to launch the day view mServices.IssueCommandL(ECalenDayView); @@ -386,12 +385,9 @@ void CalenAgendaView::clearListModel() { OstTraceFunctionEntry0( CALENAGENDAVIEW_CLEARLISTMODEL_ENTRY ); - // do not disconnect if day view is open - // save the agenda view as an activity - if(!mDayViewActivated){ + // day view is removed from the list disconnect for aboutToQuit events disconnectAboutToQuitEvent(); - } mAgendaViewWidget->clearListModel(); OstTraceFunctionExit0( CALENAGENDAVIEW_CLEARLISTMODEL_EXIT ); diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/src/calenagendaviewwidget.cpp --- a/calendarui/views/src/calenagendaviewwidget.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/src/calenagendaviewwidget.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -58,7 +58,6 @@ const QString space(" "); const QString singleHyphen("-"); const QString customLayout("custom"); -const char *stretchLayout("customstretch"); const QString toDoIcon("qtg_small_todo"); const QString reminderIcon("qtg_mono_alarm"); const QString locationIcon("qtg_mono_location"); @@ -629,11 +628,9 @@ // Disable item stretching by removing the dynamic property - HbListViewItem *listViewItem = static_cast - (mEventsList->itemByIndex(mListModel->index(index, 0))); - if (listViewItem) { - listViewItem->setProperty(stretchLayout, false); - } + QModelIndex currIndex = mListModel->index(index, 0); + mListModel->itemFromIndex(currIndex)->setData(false); + // Get the list model index and set the text and icon data QModelIndex listIndex = mListModel->index(index, 0); mListModel->setData(listIndex, textData, Qt::DisplayRole); @@ -791,21 +788,19 @@ } } // Enable item stretching by adding the dynamic property - HbListViewItem *listViewItem = static_cast - (mEventsList->itemByIndex(mListModel->index(index, 0))); + QModelIndex currentIndex = mListModel->index(index, 0); + Qt::Orientation orientation = mServices.MainWindow().orientation(); // Apply stretch only for landscape orientation - if (listViewItem) { - if (Qt::Horizontal == orientation) { - listViewItem->setProperty(stretchLayout, true); - } else { - listViewItem->setProperty(stretchLayout, false); - } + if (Qt::Horizontal == orientation) { + mListModel->itemFromIndex(currentIndex)->setData(true); + } else { + mListModel->itemFromIndex(currentIndex)->setData(false); } + // Get the list model index and set the text and icon data - QModelIndex listIndex = mListModel->index(index, 0); - mListModel->setData(listIndex, textData, Qt::DisplayRole); - mListModel->setData(listIndex, iconData, Qt::DecorationRole); + mListModel->setData(currentIndex, textData, Qt::DisplayRole); + mListModel->setData(currentIndex, iconData, Qt::DecorationRole); OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ADDNONTIMEDEVENTTOLIST_EXIT ); } @@ -843,32 +838,27 @@ case AgendaEntry::TypeAnniversary: { // Get the list view item corresponding to the index - HbListViewItem *listItem = static_cast - (mEventsList->itemByIndex(mListModel->index(index, 0))); - if (listItem) { - if (orientation == Qt::Horizontal) { - // Set a dynamic property to indicate that this list item - // must be stretched in landscape. - // NOTE: Property name MUST match the name specified in - // css file, else wierd things might happen - listItem->setProperty(stretchLayout, true); - } - if (orientation == Qt::Vertical) { - // Set a dynamic property to indicate that this list item - // NOTE: Property name MUST match the name specified in - // css file, else wierd things might happen - listItem->setProperty(stretchLayout, false); - } + QModelIndex currIndex = mListModel->index(index, 0); + + if (orientation == Qt::Horizontal) { + // Set a dynamic property to indicate that this list item + // must be stretched in landscape. + // NOTE: Property name MUST match the name specified in + // css file, else wierd things might happen + mListModel->itemFromIndex(currIndex)->setData(true); + } + if (orientation == Qt::Vertical) { + // Set a dynamic property to indicate that this list item + // NOTE: Property name MUST match the name specified in + // css file, else wierd things might happen + mListModel->itemFromIndex(currIndex)->setData(false); } } break; default: { - HbListViewItem *listItem = static_cast - (mEventsList->itemByIndex(mListModel->index(index, 0))); - if (listItem) { - listItem->setProperty(stretchLayout, false); - } + QModelIndex currIndex = mListModel->index(index, 0); + mListModel->itemFromIndex(currIndex)->setData(false); break; } } @@ -936,15 +926,16 @@ HbLabel *pluginInfoLabel = qobject_cast (mRegionalInfoGroupBox->contentWidget()); pluginInfoLabel->setPlainText(*pluginString); + pluginInfoLabel->setTextWrapping(Hb::TextNoWrap); + pluginInfoLabel->setElideMode(Qt::ElideRight); + }else { + if (mRegionalInfoGroupBox) { + mRegionalPluginLayout->removeItem(mRegionalInfoGroupBox); + delete mRegionalInfoGroupBox; + mRegionalInfoGroupBox = NULL; + } } - } else { - if (mRegionalInfoGroupBox) { - mRegionalPluginLayout->removeItem(mRegionalInfoGroupBox); - delete mRegionalInfoGroupBox; - mRegionalInfoGroupBox = NULL; - } - } - + } OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SHOWHIDEREGIONALINFORMATION_EXIT ); } diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/src/caleneventlistviewitem.cpp --- a/calendarui/views/src/caleneventlistviewitem.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/src/caleneventlistviewitem.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -25,6 +25,9 @@ #include "caleneventlistviewitemTraces.h" #endif +// Constants +const char *stretchLayout("customstretch"); + // ---------------------------------------------------------------------------- // CalenEventListViewItem::CalenEventListViewItem // constructor @@ -72,6 +75,13 @@ void CalenEventListViewItem::updateChildItems() { OstTraceFunctionEntry0( CALENEVENTLISTVIEWITEM_UPDATECHILDITEMS_ENTRY ); + + QVariant itemData = modelIndex().data(Qt::UserRole + 1); + bool stretch = itemData.toBool(); + // Set this stretchy to the view item + setProperty(stretchLayout, stretch); + + // Call parent handler HbListViewItem::updateChildItems(); OstTraceFunctionExit0( CALENEVENTLISTVIEWITEM_UPDATECHILDITEMS_EXIT ); diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/src/calenmonthgrid.cpp --- a/calendarui/views/src/calenmonthgrid.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/src/calenmonthgrid.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -377,7 +377,11 @@ // Start the scrolling QPointF targetPos(0.0, 0.0); - scrollContentsTo(targetPos,500); + if (floor(targetPos.y()) != floor(mContentWidget->pos().y())) { + scrollContentsTo(targetPos,500); + } else { + scrollingFinished(); + } OstTraceFunctionExit0( CALENMONTHGRID_DOWNGESTURE_EXIT ); } @@ -407,9 +411,13 @@ } // Start the scrolling - QPointF targetPos(0.0, mStartPos.y() - size().height()); - scrollContentsTo(-targetPos,500); - + QPointF targetPos(0.0, mStartPos.y() - mFutureMonthHeight); + if (floor(targetPos.y()) != floor(mContentWidget->pos().y())) {\ + scrollContentsTo(-targetPos,500); + } else { + scrollingFinished(); + } + // scrollContentsTo(-targetPos,500); OstTraceFunctionExit0( CALENMONTHGRID_UPGESTURE_EXIT ); } @@ -468,6 +476,7 @@ if (!mIsPanGesture) { mDirection = invalid; mStartPos = mContentWidget->pos(); + mFutureMonthHeight = abs(mContentWidget->geometry().bottomRight().y() - geometry().bottomRight().y()); // TODO: This work around till framework provides an api // to know the direciton of the pan, until then we need // calculate the direction explicitly @@ -590,6 +599,7 @@ mDirection = invalid; mActiveDatesSet = false; } else { + mIsGridAdjusting = false; mIsAtomicScroll = false; mDirection = invalid; } @@ -654,23 +664,11 @@ // first visible date belong to previous to previous month // hence, scroll down to bring the previous month downGesture(); - } else if (month == nextMonth.date().month()) { - // first visible item belongs to next month - // Check if the date is more than half of the next month - if (date.date().day() > (nextMonth.date().daysInMonth()) / 2) { - // up gesture to bring the next month - upGesture(); - } else { - // we should again show the current month by scrolling upwards - mDirection = up; - mIsAtomicScroll = true; - scrollContentsTo(-mStartPos,500); - } - } else if (month == nextMonth.addMonths(1).date().month()) { - // first visible date belongs to next to next month - // hence, scroll up to show the next month - upGesture(); - } else { + } else if (month == nextMonth.date().month() || + month == nextMonth.addMonths(1).date().month()) { + // up gesture to bring the next month + upGesture(); + } else { // User has panned so that exact month has been scrolled // no need for any adjustment here, just append/prepend the rows mIsAtomicScroll = false; @@ -973,9 +971,11 @@ if (activeMonth.date().month() == nonActiveFocusedDay.date().month()) { mDirection = up; + mFutureMonthHeight = abs(mContentWidget->geometry().bottomRight().y() - geometry().bottomRight().y()); // up gesture upGesture(); - } else { + } else if (nonActiveFocusedDay.date().month() == + activeMonth.addMonths(-2).date().month()){ mDirection = down; // down gesture downGesture(); diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/src/calenmonthview.cpp --- a/calendarui/views/src/calenmonthview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/src/calenmonthview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -578,10 +578,20 @@ QString *pluginString = pluginText(); mPrevRegionalInfo->setPlainText(*pluginString); mPrevRegionalInfo->setTextColor(mPreviewHeadingColor); + mPrevRegionalInfo->setTextWrapping(Hb::TextNoWrap); + mPrevRegionalInfo->setElideMode(Qt::ElideRight); + mCurrRegionalInfo->setPlainText(*pluginString); mCurrRegionalInfo->setTextColor(mPreviewHeadingColor); + mCurrRegionalInfo->setTextWrapping(Hb::TextNoWrap); + mCurrRegionalInfo->setElideMode(Qt::ElideRight); + + mNextRegionalInfo->setPlainText(*pluginString); mNextRegionalInfo->setTextColor(mPreviewHeadingColor); + mNextRegionalInfo->setTextWrapping(Hb::TextNoWrap); + mNextRegionalInfo->setElideMode(Qt::ElideRight); + } else { if (mPrevRegionalInfo) { mPrevPaneLayout->removeItem(mPrevRegionalInfo); @@ -1646,7 +1656,6 @@ { OstTraceFunctionEntry0( CALENMONTHVIEW_ONLOCALECHANGED_ENTRY ); Q_UNUSED(reason); - return; OstTraceFunctionExit0( CALENMONTHVIEW_ONLOCALECHANGED_EXIT ); } diff -r dcd0ca396fa1 -r 5aadd1120515 calendarui/views/src/calennativeview.cpp --- a/calendarui/views/src/calennativeview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/calendarui/views/src/calennativeview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -53,8 +53,9 @@ CalenNativeView::CalenNativeView(MCalenServices &services) : mServices(services), mEntriesInDataBase(false), - mIsCapturedScreenShotValid(false), - mDatePicker(0) + mDatePicker(0), + mIsCapturedScreenShotValid(false), + mForcedExit(false) { OstTraceFunctionEntry0( CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY ); @@ -69,7 +70,7 @@ notificationArray.Append(ECalenNotifySystemLocaleChanged); notificationArray.Append(ECalenNotifyContextChanged); notificationArray.Append(ECalenNotifyCloseDialogs); - + notificationArray.Append(ECalenNotifyForcedExit); mServices.RegisterForNotificationsL(this, notificationArray); CleanupStack::PopAndDestroy(¬ificationArray); @@ -96,7 +97,17 @@ // Population is complete, issue the notification mServices.IssueNotificationL(ECalenNotifyViewPopulationComplete); - + //if entry is created in editor, and app closed from either + // task switcher or red key + //latest entry should be shown in activity + //provide uinfo to user that entry get saved + if(mForcedExit){ + captureScreenshot(true); + saveActivity(); + } + else{ + captureScreenshot(false); + } OstTraceFunctionExit0( CALENNATIVEVIEW_POPULATIONCOMPLETE_EXIT ); } @@ -264,6 +275,10 @@ emit closeDialogs(); } break; + case ECalenNotifyForcedExit:{ + mForcedExit = true; + } + break; default: break; } diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockmw/clocktimezone/src/timezoneclient.cpp --- a/clock/clockmw/clocktimezone/src/timezoneclient.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockmw/clocktimezone/src/timezoneclient.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -999,7 +999,6 @@ int ruleMatchIndex( KNoDifference ); TTimeIntervalSeconds secondsDifference; - TTime ruleMatchTime; // Fetch lowest time offset for the year residing at aTime. // This is used to determine if DST is on. @@ -1048,9 +1047,6 @@ TTime tempTime( sevenDays ); TTime newTime( ruleTime.Int64() + tempTime.Int64() ); - TTimeIntervalDays temp; - temp = newTime.DaysFrom( ruleTime ); - if ( ( secondsDifference.Int() >= KNoDifference ) && ( newTime > alarmTime) && ( actualisedRule.iTimeOfChange < alarmTime ) && @@ -1058,7 +1054,6 @@ // If there is a match, save the index and break. // We've got the rule and there's no need to continue with other rules. ruleMatchIndex = ruleIndex; - ruleMatchTime = actualisedRule.iTimeOfChange; break; } } diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockalarmeditor/inc/clockalarmeditor.h --- a/clock/clockui/clockalarmeditor/inc/clockalarmeditor.h Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockalarmeditor/inc/clockalarmeditor.h Fri Oct 15 12:10:36 2010 +0530 @@ -72,6 +72,7 @@ void handleDescriptionChanged(const QString &text); void handleKeypadOpen(); void handleKeypadClosed(); + void forcedExit(); signals: void alarmSet(); @@ -99,6 +100,7 @@ int mStartOfWeek; bool mAlarmDayItemInserted; bool mIsQuickAlarm; + bool mForcedExit; QString mTimeFormat; QTime mOldAlarmTime; diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockalarmeditor/src/clockalarmeditor.cpp --- a/clock/clockui/clockalarmeditor/src/clockalarmeditor.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockalarmeditor/src/clockalarmeditor.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -39,6 +39,7 @@ #include #include #include +#include // User includes #include "clockprivatecrkeys.h" @@ -84,6 +85,7 @@ mStartOfWeek(0), mAlarmDayItemInserted(false), mIsQuickAlarm(true), + mForcedExit(false), mAlarmEditorForm(0), mAlarmEditorModel(0), mAlarmTimeItem(0), @@ -208,6 +210,10 @@ HbMainWindow *window = hbInstance->allMainWindows().first(); window->addView(mAlarmEditorView); window->setCurrentView(mAlarmEditorView); + //if editor is open in background, and user close the app from task switcher + //entry should get saved + connect(qobject_cast(qApp), SIGNAL(aboutToQuit()), + this, SLOT(forcedExit())); OstTraceFunctionExit0( CLOCKALARMEDITOR_SHOWALARMEDITOR_EXIT ); } @@ -239,8 +245,9 @@ mAlarmDayItemInserted = false; emit alarmSet(); - - closeAlarmEditor(); + if(!mForcedExit){ + closeAlarmEditor(); + } OstTraceFunctionExit0( CLOCKALARMEDITOR_HANDLEDONEACTION_EXIT ); } @@ -758,15 +765,17 @@ // Check if DST rule gets applied in 24hrs. displayDSTRolloverNote = mTimezoneClient->checkForDstChange(alarmInfo); - if (displayDSTRolloverNote) { - // display DST rollover note - displayDSTRollOverNote(alarmInfo); + //don't display any note if forced exit + if(!mForcedExit){ + if (displayDSTRolloverNote) { + // display DST rollover note + displayDSTRollOverNote(alarmInfo); + } + else { + // display remaining time note + displayRemainingTimeNote(alarmInfo); + } } - else { - // display remaining time note - displayRemainingTimeNote(alarmInfo); - } - // Save previous alarm time. setPreviosAlarmTime(alarmTime); OstTraceFunctionExit0( CLOCKALARMEDITOR_SETALARM_EXIT ); @@ -1073,4 +1082,17 @@ } OstTraceFunctionExit0( CLOCKALARMEDITOR_SORTALARMDAYSLIST_EXIT ); } + + +/*! + * slot calls if app closed from task switcher or red key. + * saved the created entry + */ +void ClockAlarmEditor::forcedExit() +{ + OstTraceFunctionEntry0( CLOCKALARMEDITOR_FORCEDEXIT_ENTRY ); + mForcedExit = true; + handleDoneAction(); + OstTraceFunctionExit0( CLOCKALARMEDITOR_FORCEDEXIT_EXIT ); +} // End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockalarmeditor/traces/clockalarmeditorTraces.h --- a/clock/clockui/clockalarmeditor/traces/clockalarmeditorTraces.h Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockalarmeditor/traces/clockalarmeditorTraces.h Fri Oct 15 12:10:36 2010 +0530 @@ -16,8 +16,6 @@ #define CLOCKALARMEDITOR_HANDLEDONEACTION_EXIT 0x8a0014 #define CLOCKALARMEDITOR_HANDLEDELETEACTION_ENTRY 0x8a0015 #define CLOCKALARMEDITOR_HANDLEDELETEACTION_EXIT 0x8a0016 -#define CLOCKALARMEDITOR_HANDLEDISCARDACTION_ENTRY 0x8a0017 -#define CLOCKALARMEDITOR_HANDLEDISCARDACTION_EXIT 0x8a0018 #define CLOCKALARMEDITOR_HANDLETIMECHANGE_ENTRY 0x8a0019 #define CLOCKALARMEDITOR_HANDLETIMECHANGE_EXIT 0x8a001a #define DUP1_CLOCKALARMEDITOR_HANDLETIMECHANGE_EXIT 0x8a001b @@ -60,6 +58,8 @@ #define CLOCKALARMEDITOR_LAUNCHDIALOG_EXIT 0x8a0040 #define CLOCKALARMEDITOR_SORTALARMDAYSLIST_ENTRY 0x8a0041 #define CLOCKALARMEDITOR_SORTALARMDAYSLIST_EXIT 0x8a0042 +#define CLOCKALARMEDITOR_FORCEDEXIT_ENTRY 0x8a0043 +#define CLOCKALARMEDITOR_FORCEDEXIT_EXIT 0x8a0044 #endif diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockalarmeditor/traces/fixed_id.definitions --- a/clock/clockui/clockalarmeditor/traces/fixed_id.definitions Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockalarmeditor/traces/fixed_id.definitions Fri Oct 15 12:10:36 2010 +0530 @@ -17,6 +17,8 @@ [TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_DISPLAYDSTROLLOVERNOTE_EXIT=0x38 [TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_DISPLAYREMAININGTIMENOTE_ENTRY=0x39 [TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_DISPLAYREMAININGTIMENOTE_EXIT=0x3a +[TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_FORCEDEXIT_ENTRY=0x43 +[TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_FORCEDEXIT_EXIT=0x44 [TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_GETDAYTEXT_ENTRY=0x3b [TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_GETDAYTEXT_EXIT=0x3c [TRACE]TRACE_FLOW[0x8A]_CLOCKALARMEDITOR_GETPREVIOUSALARMTIME_ENTRY=0x30 diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockcityselectionlist/data/xml/clockaddcitydialog.docml --- a/clock/clockui/clockcityselectionlist/data/xml/clockaddcitydialog.docml Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockcityselectionlist/data/xml/clockaddcitydialog.docml Fri Oct 15 12:10:36 2010 +0530 @@ -7,52 +7,30 @@ - - - - - - - - - - - - - - + + - + + + - + - - - - - - - - - - - - - - - - - - + + + + + + @@ -60,46 +38,29 @@
- + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - -
- - - - @@ -113,41 +74,15 @@ - - - - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - -
diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockcityselectionlist/src/clockcityselectionlist_p.cpp --- a/clock/clockui/clockcityselectionlist/src/clockcityselectionlist_p.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockcityselectionlist/src/clockcityselectionlist_p.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -129,7 +129,7 @@ mListModel->removeRows(0,infoList.count()-1); mListModel->insertRows(0, infoList.count()); mListModel->setColumnCount(1); - + for (int iter = 0; iter < infoList.count(); iter++) { QModelIndex index = mListModel->index(iter, 0); @@ -304,7 +304,7 @@ addTimeZoneField(); } - mCountryComboBox = static_cast (mAddCityDocloader->findWidget("counrtyCombobox")); + mCountryComboBox = static_cast (mAddCityDocloader->findWidget("countryCombobox")); addCountryListField(); mOkAction = static_cast (mAddCityDocloader->findObject("okAction")); diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockplugins/datetimesettingsplugin/datetimesettingsplugin.pro --- a/clock/clockui/clockplugins/datetimesettingsplugin/datetimesettingsplugin.pro Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockplugins/datetimesettingsplugin/datetimesettingsplugin.pro Fri Oct 15 12:10:36 2010 +0530 @@ -56,7 +56,7 @@ } plugin.sources = datetimesettingsplugin.dll -plugin.path = \resource\qt\plugins\controlpanel +plugin.path = /resource/qt/plugins/controlpanel DEPLOYMENT += plugin # End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/clockui/clockviews/src/clockmainview.cpp --- a/clock/clockui/clockviews/src/clockmainview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/clockui/clockviews/src/clockmainview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -524,9 +524,10 @@ \param key The key which got changed in cenrep. \param value The new value of that key. */ -void ClockMainView::eventMonitor( - const XQSettingsKey& key, const QVariant& value) +void ClockMainView::eventMonitor(const XQSettingsKey& key, const QVariant& value) { + Q_UNUSED(value) + OstTraceFunctionEntry0( CLOCKMAINVIEW_EVENTMONITOR_ENTRY ); if (key.uid() == KCRUidClockApp && key.key() == KClockType) { // Update view diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/tsrc.pro --- a/clock/tsrc/tsrc.pro Tue Oct 05 14:14:48 2010 +0530 +++ b/clock/tsrc/tsrc.pro Fri Oct 15 12:10:36 2010 +0530 @@ -15,6 +15,17 @@ # This is the project specification file clock test code # -# include test components here +TEMPLATE = subdirs + +SUBDIRS += \ + unittest_clockengines \ + unittest_settingsutility \ + unittest_alarmclient \ + unittest_timezoneclient + + +CONFIG += qtestlib +CONFIG += symbian_test +CONFIG += ordered # End of file --Don't remove this diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_alarmclient/rom/unittest_alarmclient.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_alarmclient/rom/unittest_alarmclient.iby Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* The iby file for notes application unit tests. +* +*/ + + +#ifndef __UT_ALARMCLIENT_IBY__ +#define __UT_ALARMCLIENT_IBY__ + +S60_APP_EXE(utalarmclient) +S60_APP_RESOURCE(utalarmclient) + +// Application registration file. +data=DATAZ_\private\10003a3f\import\apps\utalarmclient_reg.rsc \private\10003a3f\import\apps\utalarmclient_reg.rsc + +#endif // __UT_ALARMCLIENT_IBY__ + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_alarmclient/unittest_alarmclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_alarmclient/unittest_alarmclient.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AlarmClient unit test class. +* +*/ + +// System includes +#include + +// User includes +#include "alarmclient.h" +#include "qdatetime.h" +#include "qstring.h" +#include "clockdatatypes.h" + +/*! + \class TestAlarmClient + + This object has functions to test the public apis in the class + AlarmClient. + */ +class TestAlarmClient: public QObject +{ + Q_OBJECT + +private slots: + // Test case setup. + void init(); + void cleanup(); + + // Test cases. + void testToggleAlarmStatus(); + void testDeleteAlarm(); + void testGetAlarmList(); + void testSetAlarmDaily(); + void testSetAlarmWeekly(); + void testSetAlarmWorkdays(); + void testSetAlarmOnceOnly(); + + +private: + AlarmClient *mAlarmClient; +}; + +/*! + This function will be called before each testfunction is executed. + */ +void TestAlarmClient::init() +{ + mAlarmClient = new AlarmClient(this); +} + +/*! + This function will be called after every testfunction. + */ +void TestAlarmClient::cleanup() +{ + QList alarmlist; + mAlarmClient->getAlarmList(alarmlist); + + // Delete all the alarms. + int numOfAlarms = alarmlist.count(); + for (int i = 0; i < numOfAlarms; i++) { + mAlarmClient->deleteAlarm(alarmlist.at(i).alarmId); + } + + if (mAlarmClient) { + delete mAlarmClient; + } +} + +/*! + * Test the API AlarmClient::toggleAlarmStatus. + */ +void TestAlarmClient::testToggleAlarmStatus() +{ + // Set an alarm. + QTime alarmTime; + QString descInfo("This is a daily alarm"); + + AlarmInfo alarmInfoDaily; + // First the description. + alarmInfoDaily.alarmDesc = descInfo; + // The time. + alarmTime = QTime::fromString("12:30 pm", "hh:mm ap"); + // Construct the alarm info. + alarmInfoDaily.origAlarmTime = alarmTime; + // Fill the repeat type. + alarmInfoDaily.repeatType = Daily; + + // Request the listener to set the alarm. + mAlarmClient->setAlarm(alarmInfoDaily); + // Get the Id of the alarm set. + int tempId = alarmInfoDaily.alarmId; + mAlarmClient->toggleAlarmStatus(tempId, Disabled); + + // Get the above alarminfo and see if its disabled. + AlarmInfo retrievedAlarmInfoDaily; + int error = mAlarmClient->getAlarmInfo(tempId, retrievedAlarmInfoDaily); + + if (0 == error) { + QVERIFY(Disabled == + retrievedAlarmInfoDaily.alarmStatus); + } + + // Now toggle from disabled to enabled and check. + mAlarmClient->toggleAlarmStatus(tempId, Enabled); + error = mAlarmClient->getAlarmInfo(tempId, retrievedAlarmInfoDaily); + + if (0 == error) { + QVERIFY(Enabled == + retrievedAlarmInfoDaily.alarmStatus); + } + +} + +/*! + Test the API AlarmClient::deleteAlarm. + */ +void TestAlarmClient::testDeleteAlarm() +{ + // Set an alarm. + QTime alarmTime; + QString descInfo("This is a daily alarm"); + + AlarmInfo alarmInfoDaily; + // First the description. + alarmInfoDaily.alarmDesc = descInfo; + // The time. + alarmTime = QTime::fromString("12:30 pm", "hh:mm ap"); + // Construct the alarm info. + alarmInfoDaily.origAlarmTime = alarmTime; + // Fill the repeat type. + alarmInfoDaily.repeatType = Daily; + // Request the listener to set the alarm. + mAlarmClient->setAlarm(alarmInfoDaily); + + QList alarmList; + mAlarmClient->getAlarmList(alarmList); + + // Delete all the alarms. + int numOfAlarms = alarmList.count(); + for (int i = 0; i < numOfAlarms; i++) { + mAlarmClient->deleteAlarm(alarmList.at(i).alarmId); + } + // TODO:Have to check the number of alarms returned.Ll do later + // Check if there are no alarms. + // mAlarmClient->getAlarmList(alarmList); + // numOfAlarms = alarmList.size(); + // QVERIFY(0 == numOfAlarms); +} + +/* + Test the API AlarmClient::getAlarmList. + */ +void TestAlarmClient::testGetAlarmList() +{ + QList alarmlist; + + // Set an alarm. + QTime alarmTime; + QString descInfo("This is a daily alarm"); + + AlarmInfo alarmInfoDaily; + // First the description. + alarmInfoDaily.alarmDesc = descInfo; + // The time. + alarmTime = QTime::fromString("12:30 pm", "hh:mm ap"); + // Construct the alarm info. + alarmInfoDaily.origAlarmTime = alarmTime; + // Fill the repeat type. + alarmInfoDaily.repeatType = Daily; + + // Request the listener to set the alarm. + mAlarmClient->setAlarm(alarmInfoDaily); + + // Check if the list has only one element. + mAlarmClient->getAlarmList(alarmlist); + int numOfAlarms = alarmlist.count(); + QVERIFY(1 == numOfAlarms); +} + +/*! + Tests the api AlarmClient::setAlarm with a daily alarm. + */ +void TestAlarmClient::testSetAlarmDaily() +{ + QTime alarmTime; + QString descInfo("This is a daily alarm"); + + AlarmInfo alarmInfoDaily; + // First the description. + alarmInfoDaily.alarmDesc = descInfo; + // The time. + alarmTime = QTime::fromString("12:30 pm", "hh:mm ap"); + // Construct the alarm info. + alarmInfoDaily.origAlarmTime = alarmTime; + // Fill the repeat type. + alarmInfoDaily.repeatType = Daily; + + // Request the listener to set the alarm. + mAlarmClient->setAlarm(alarmInfoDaily); + // Get the Id of the alarm set. + int tempId = alarmInfoDaily.alarmId; + + // Retrieve the alarm information and compare. + AlarmInfo retrievedAlarmInfoDaily; + int error = mAlarmClient->getAlarmInfo(tempId, retrievedAlarmInfoDaily); + + if (0 == error) { + QVERIFY(alarmInfoDaily.origAlarmTime == + retrievedAlarmInfoDaily.origAlarmTime); + QVERIFY(alarmInfoDaily.alarmDesc == + retrievedAlarmInfoDaily.alarmDesc); + QVERIFY(alarmInfoDaily.repeatType == + retrievedAlarmInfoDaily.repeatType); + QVERIFY(alarmInfoDaily.alarmId == + retrievedAlarmInfoDaily.alarmId); + } + else { + QVERIFY(false); + } +} + +/*! + Tests the api AlarmClient::setAlarm with a weekly alarm. + */ +void TestAlarmClient::testSetAlarmWeekly() +{ + QTime alarmTime; + QString descInfo("This is a weekly alarm"); + + AlarmInfo alarmInfoWeekly; + // First the description. + alarmInfoWeekly.alarmDesc = descInfo; + // The time. + alarmTime = QTime::fromString("12:30 pm", "hh:mm ap"); + // Construct the alarm info. + alarmInfoWeekly.origAlarmTime = alarmTime; + // Fill the repeat type. + alarmInfoWeekly.repeatType = Weekly; + // Fill the day. + alarmInfoWeekly.alarmDay = 2; + + // Request the listener to set the alarm. + mAlarmClient->setAlarm(alarmInfoWeekly); + // Get the Id of the alarm set. + int tempId = alarmInfoWeekly.alarmId; + + // Retrieve the alarm information and compare. + AlarmInfo retrievedalarmInfoWeekly; + int error = mAlarmClient->getAlarmInfo(tempId, retrievedalarmInfoWeekly); + + if (0 == error) { + QVERIFY(alarmInfoWeekly.alarmDesc == + retrievedalarmInfoWeekly.alarmDesc); + QVERIFY(alarmInfoWeekly.repeatType == + retrievedalarmInfoWeekly.repeatType); + // TODO: have to check the alarm day. ll do later. + // QVERIFY(alarmInfoWeekly.alarmDay == + // retrievedalarmInfoWeekly.alarmDay); + QVERIFY(alarmInfoWeekly.alarmId == + retrievedalarmInfoWeekly.alarmId); + QVERIFY(alarmInfoWeekly.origAlarmTime == + retrievedalarmInfoWeekly.origAlarmTime); + } + else { + QVERIFY(false); + } +} + +/*! + Tests the api AlarmClient::setAlarmWorkdays with a workdays alarm. + */ +void TestAlarmClient::testSetAlarmWorkdays() +{ + QTime alarmTime; + QString descInfo("This is a workdays alarm"); + + AlarmInfo alarmInfoWorkdays; + // First the description. + alarmInfoWorkdays.alarmDesc = descInfo; + // The time. + alarmTime = QTime::fromString("12:30 pm", "hh:mm ap"); + // Construct the alarm info. + alarmInfoWorkdays.origAlarmTime = alarmTime; + // Fill the repeat type. + alarmInfoWorkdays.repeatType = Workday; + + // Request the listener to set the alarm. + mAlarmClient->setAlarm(alarmInfoWorkdays); + // Get the Id of the alarm set. + int tempId = alarmInfoWorkdays.alarmId; + + // Retrieve the alarm information and compare. + AlarmInfo retrievedalarmInfoWorkdays; + int error = mAlarmClient->getAlarmInfo(tempId, retrievedalarmInfoWorkdays); + + if (0 == error) { + QVERIFY(alarmInfoWorkdays.origAlarmTime == + retrievedalarmInfoWorkdays.origAlarmTime); + QVERIFY(alarmInfoWorkdays.alarmDesc == + retrievedalarmInfoWorkdays.alarmDesc); + QVERIFY(alarmInfoWorkdays.repeatType == + retrievedalarmInfoWorkdays.repeatType); + QVERIFY(alarmInfoWorkdays.alarmId == + retrievedalarmInfoWorkdays.alarmId); + } + else { + QVERIFY(false); + } +} + +/*! + Tests the api AlarmClient::setAlarmOncleOnly for a once only alarm. + */ +void TestAlarmClient::testSetAlarmOnceOnly() +{ + QTime alarmTime; + QString descInfo("This is a onceonly alarm"); + + AlarmInfo alarmInfoOnceonly; + // First the description. + alarmInfoOnceonly.alarmDesc = descInfo; + // The time. + alarmTime = QTime::fromString("12:30 pm", "hh:mm ap"); + // Construct the alarm info. + alarmInfoOnceonly.origAlarmTime = alarmTime; + // Fill the repeat type. + alarmInfoOnceonly.repeatType = Once; + // Fill the day. + alarmInfoOnceonly.alarmDay = 6; + + // Request the listener to set the alarm. + mAlarmClient->setAlarm(alarmInfoOnceonly); + // Get the Id of the alarm set. + int tempId = alarmInfoOnceonly.alarmId; + + // Retrieve the alarm information and compare. + AlarmInfo retrievedalarmInfoOnceonly; + int error = mAlarmClient->getAlarmInfo(tempId, retrievedalarmInfoOnceonly); + + if (0 == error) { + QVERIFY(alarmInfoOnceonly.alarmDesc == + retrievedalarmInfoOnceonly.alarmDesc); + QVERIFY(alarmInfoOnceonly.repeatType == + retrievedalarmInfoOnceonly.repeatType); + // TODO: have to check the alarm day. ll do later. + // QVERIFY(alarmInfoOnceonly.alarmDay == + // retrievedalarmInfoOnceonly.alarmDay); + QVERIFY(alarmInfoOnceonly.alarmId == + retrievedalarmInfoOnceonly.alarmId); + QVERIFY(alarmInfoOnceonly.origAlarmTime == + retrievedalarmInfoOnceonly.origAlarmTime); + } + else { + QVERIFY(false); + } +} + +QTEST_MAIN(TestAlarmClient) +#include "unittest_alarmclient.moc" + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_alarmclient/unittest_alarmclient.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_alarmclient/unittest_alarmclient.pro Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,43 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: pro file for settingsutility unit test. +# + + +TEMPLATE = app +TARGET = utalarmclient +CONFIG += qtestlib +CONFIG += symbian_test +DEPENDPATH += . +INCLUDEPATH += . \ + ../../inc \ + ../../clockmw/clockalarms/inc + +# Input +SOURCES += unittest_alarmclient.cpp + +symbian: { + BLD_INF_RULES.prj_testexports += \ + "./rom/unittest_alarmclient.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unittest_alarmclient.iby)" + + LIBS += -leuser \ + -lclockalarmclient + + INCLUDEPATH += /epoc32/include/osextensions/stdapis/stlport + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + TARGET.EPOCHEAPSIZE = 0x200000 0x4000000 + TARGET.CAPABILITY = CAP_GENERAL_DLL +} + +# End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_clockengines/inc/unittest_clockengines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_clockengines/inc/unittest_clockengines.h Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef UNITTEST_CLOCKENGINES_H +#define UNITTEST_CLOCKENGINES_H + +// System includes +#include +#include + +// User Includes +#include "clockpluginobserver.h" + +// Forward declarations. +class RClkSrvInterface; +class CClockTimeSourceInterface; +class CClockTimeZoneResolver; + +/*! + \class TestClockEngines + + This object has functions to test the public apis in the component + Clockengines. + */ +class TestClockEngines: public QObject, MClockPluginObserver +{ + Q_OBJECT + +private slots: + // Test case setup. + void init(); + void cleanup(); + + // Test cases. + void testConnectToServer(); + void testActiveProtocol(); + void testActivateAllProtocols(); + void testIsProtocolActive(); + void testGetProtocolInfo(); + void testGetCurrentMcc(); + void testGetCurrentTimeZoneId(); + + void testDeActivateProtocol(); + void testDeActivateAllProtocols(); + + void tesTimeZoneResolverSingleZone1(); + void tesTimeZoneResolverSingleZone2(); + void tesTimeZoneResolverSingleZone3(); + void tesTimeZoneResolverSingleZone4(); + void tesTimeZoneResolverSingleZone5(); + void tesTimeZoneResolverSingleZone6(); + void tesTimeZoneResolverSingleZone7(); + + void tesTimeZoneResolverMultiZone1(); + void tesTimeZoneResolverMultiZone2(); + void tesTimeZoneResolverMultiZone3(); + void tesTimeZoneResolverMultiZone4(); + void tesTimeZoneResolverMultiZone5(); + + void testTimeZoneResolverSingleZoneWrongMCC(); + void NotifyTimeChangeL( CClockTimeSourceInterface& plugin ); + void testVersion(); + void testCreatePluginInstance(); + void testGetNitzData(); + void testInvalidPlugin(); + void testTimeUpdateOn(); + void testTimeUpdateOff(); + +private: + RClkSrvInterface *mClockServerCltHandle; + CClockTimeSourceInterface *mClkTimeUpdaterInterface; + CClockTimeZoneResolver *mTzResolver; + STimeAttributes mTimeInfo; + int mTzId; + STimeAttributes mNitzInfo; + RMobilePhone::TMobilePhoneNetworkCountryCode mMCC; + int mError; +}; + +#endif // UNITTEST_CLOCKENGINES_H + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_clockengines/rom/unittest_clockengines.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_clockengines/rom/unittest_clockengines.iby Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* The iby file for clock engines unit tests. +* +*/ + + +#ifndef __UT_CLOCKENGINES_IBY__ +#define __UT_CLOCKENGINES_IBY__ + +S60_APP_EXE(utclockengines) +S60_APP_RESOURCE(utclockengines) + +// Application registration file. +data=DATAZ_\private\10003a3f\import\apps\utclockengines_reg.rsc \private\10003a3f\import\apps\utclockengines_reg.rsc + +#endif // __UT_CLOCKENGINES_IBY__ + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_clockengines/src/unittest_clockengines.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_clockengines/src/unittest_clockengines.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,614 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Symbian Foundation License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: TimeZoneClient unit test class. + * + */ + +// System includes +#include +#include + +// User includes +#include "clockserverclt.h" +#include "clockserver.h" +#include "clocktimesourceinterface.h" +#include "clocktimesourceinterface.hrh" +#include "clocktimezoneresolver.h" +#include "clockdatatypes.h" +#include "unittest_clockengines.h" + +// constants +const int KNitzPluginId(0x200159A5); +static const TUid KInvalidID = {0xA001234C}; +const int KClockServerMajorVN(1); +const int KClockServerMinorVN(0); +const int KClockServerBuildVN(1); + +/*! + This function will be called before each testfunction is executed. + */ +void TestClockEngines::init() +{ + // Create a clockserver session. + TRAPD(mError, mClockServerCltHandle = new RClkSrvInterface()); + mClockServerCltHandle->Connect(); + Q_UNUSED(mError) + + Q_ASSERT(!mError); + Q_ASSERT(mClockServerCltHandle); +} + +/*! + This function will be called after every testfunction. + */ +void TestClockEngines::cleanup() +{ + if (mClockServerCltHandle) { + delete mClockServerCltHandle; + mClockServerCltHandle = NULL; + } +} + +/*! + Tests the api TestTimezoneClient::testConnectToServer. + */ +void TestClockEngines::testConnectToServer() +{ + int result = mClockServerCltHandle->Connect(); + QVERIFY(KErrNone == result); + + mClockServerCltHandle->Close(); +} + +/*! + Tests the api TestTimezoneClient::testActiveProtocol. + */ +void TestClockEngines::testActiveProtocol() +{ + int errorCode(KErrNotFound); + + errorCode = mClockServerCltHandle->Connect(); + if (errorCode == KErrNone) { + // To activate nitz protocol + errorCode = mClockServerCltHandle->ActivateProtocol(KNitzPluginId); + mClockServerCltHandle->Close(); + QVERIFY(KErrNone == errorCode); + } + else { + QVERIFY(false); + } +} + +/*! + Tests the api TestTimezoneClient::testActiveProtocol. + */ +void TestClockEngines::testActivateAllProtocols() +{ + TInt errorCode(KErrNotFound); + + errorCode = mClockServerCltHandle->Connect(); + if (errorCode == KErrNone) { + // To activate nitz protocol + errorCode = mClockServerCltHandle->ActivateAllProtocols();; + mClockServerCltHandle->Close(); + QVERIFY(KErrNone == errorCode); + } + else { + QVERIFY(false); + } +} + +/*! + Tests the api TestTimezoneClient::testIsProtocolActive. + */ +void TestClockEngines::testIsProtocolActive() +{ + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + if (KErrNone == errorCode) { + int protocolActive(false); + + errorCode = mClockServerCltHandle->IsProtocolActive(KNitzPluginId, protocolActive); + mClockServerCltHandle->Close(); + QVERIFY(true == protocolActive); + } + else{ + QVERIFY(false); + } +} + +/*! + Tests the api TestTimezoneClient::testGetProtocolInfo. + */ +void TestClockEngines::testGetProtocolInfo() +{ + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + + if (KErrNone == errorCode) { + errorCode = mClockServerCltHandle->ActivateProtocol(KNitzPluginId); + if (KErrNone == errorCode) { + STimeAttributes timeAttributes; + errorCode = mClockServerCltHandle->GetProtocolInfo(0x200159A5, timeAttributes); + } + QVERIFY(KErrNone == errorCode); + mClockServerCltHandle->Close(); + } +} + +/*! + Tests the api TestTimezoneClient::testGetCurrentMcc. + */ +void TestClockEngines::testGetCurrentMcc() +{ + + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + + if (KErrNone == errorCode) { + int currentMcc; + errorCode = mClockServerCltHandle->GetCurrentMcc(currentMcc); + mClockServerCltHandle->Close(); + QVERIFY(KErrNone == errorCode); + } +} + +/*! + Tests the api TestTimezoneClient::testGetCurrentTimeZoneId. + */ +void TestClockEngines::testGetCurrentTimeZoneId() +{ + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + + if (KErrNone == errorCode) { + errorCode = mClockServerCltHandle->ActivateProtocol(KNitzPluginId); + if (KErrNone == errorCode) { + int currentTimeZoneId; + errorCode = mClockServerCltHandle->GetCurrentTimeZondId(currentTimeZoneId); + QVERIFY(KErrNone == errorCode); + } + mClockServerCltHandle->Close(); + } +} + +/*! + Tests the api TestTimezoneClient::testDeActivateProtocol. + */ +void TestClockEngines::testDeActivateProtocol() +{ + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + + if (KErrNone == errorCode) { + errorCode = mClockServerCltHandle->DeActivateProtocol(KNitzPluginId); + mClockServerCltHandle->Close(); + QVERIFY(KErrNone == errorCode); + } +} + +/*! + Tests the api TestTimezoneClient::testDeActivateProtocol. + */ +void TestClockEngines::testDeActivateAllProtocols() +{ + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + if (KErrNone == errorCode) { + errorCode = mClockServerCltHandle->ActivateAllProtocols(); + + if (KErrNone == errorCode) { + errorCode = mClockServerCltHandle->DeActivateAllProtocols(); + mClockServerCltHandle->Close(); + QVERIFY(KErrNone == errorCode); + } + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone1. + */ +void TestClockEngines::tesTimeZoneResolverSingleZone1() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + int actualTzId = 1944; + + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth( EJanuary ), 27, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 330; + mTimeInfo.iDstOffset = 0; + mMCC = _L("404"); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNone == errorCode); + QVERIFY(actualTzId == mTzId); + delete mTzResolver; + } +} +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone2. + */ +void TestClockEngines::tesTimeZoneResolverSingleZone2() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth(EJanuary), 27, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 300; + mTimeInfo.iDstOffset = 0; + + mMCC = _L( "404" ); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNotFound == errorCode); + QVERIFY(KErrNotFound == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone3. + */ +void TestClockEngines::tesTimeZoneResolverSingleZone3() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth( EJanuary ), 27, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 330; + mTimeInfo.iDstOffset = 0; + mMCC = _L("310"); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNotFound == errorCode); + QVERIFY(KErrNotFound == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone4. + */ +void TestClockEngines::tesTimeZoneResolverSingleZone4() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + int actualTzId = 3048; + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth(EJanuary), 27, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 300; + mTimeInfo.iDstOffset = 0; + mMCC = _L( "-1" ); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNone == errorCode); + QVERIFY(actualTzId == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone5. + */ +void TestClockEngines::tesTimeZoneResolverSingleZone5() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + int actualTzId = 1944; + + if(NULL != mTzResolver){ + mTimeInfo.iUtcDateTime = TTime(KErrNotFound).DateTime();//TDateTime( 2008, TMonth( EJanuary ), 27, 10, 0, 0, 0 ); + mTimeInfo.iTimeZoneOffset = KErrNotFound; + mTimeInfo.iDstOffset = KErrNotFound; + mMCC = _L( "404" ); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNone == errorCode); + QVERIFY(actualTzId == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone6. + */ +void TestClockEngines::tesTimeZoneResolverSingleZone6() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TTime(KErrNotFound).DateTime();//TDateTime( 2008, TMonth( EJanuary ), 27, 10, 0, 0, 0 ); + mTimeInfo.iTimeZoneOffset = KErrNotFound; + mTimeInfo.iDstOffset = KErrNotFound; + + mMCC = _L("-1"); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNotFound == errorCode); + QVERIFY(KErrNotFound == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone7. + */ +void TestClockEngines::tesTimeZoneResolverSingleZone7() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + int actualTzId = 2744; + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth(EApril), 2, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 0; + mTimeInfo.iDstOffset = 60; + mMCC = _L( "235" ); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNone == errorCode); + QVERIFY(actualTzId == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverMultiZone1. +*/ +void TestClockEngines::tesTimeZoneResolverMultiZone1() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + int actualTzId = 2416; + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth(EApril), 2, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 480; + mTimeInfo.iDstOffset = 0; + mMCC = _L( "505" ); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNone == errorCode); + QVERIFY(actualTzId == mTzId); + delete mTzResolver; + } + +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone2. +*/ +void TestClockEngines::tesTimeZoneResolverMultiZone2() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + + if(NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth( EApril ), 2, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 480; + mTimeInfo.iDstOffset = 0; + mMCC = _L("9999"); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNotFound == errorCode); + QVERIFY(KErrNotFound == mTzId); + delete mTzResolver; + } + +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone3. +*/ +void TestClockEngines::tesTimeZoneResolverMultiZone3() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TTime(KErrNotFound).DateTime(); + mTimeInfo.iTimeZoneOffset = KErrNotFound; + mTimeInfo.iDstOffset = KErrNotFound; + mMCC = _L("505"); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNotFound == errorCode); + QVERIFY(KErrNotFound == mTzId); + delete mTzResolver; + } + +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone4. +*/ +void TestClockEngines::tesTimeZoneResolverMultiZone4() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TTime(KErrNotFound).DateTime(); + mTimeInfo.iTimeZoneOffset = KErrNotFound; + mTimeInfo.iDstOffset = KErrNotFound; + mMCC = _L("9999"); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNotFound == errorCode); + QVERIFY(KErrNotFound == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone5. +*/ +void TestClockEngines::tesTimeZoneResolverMultiZone5() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2010, TMonth(EApril), 2, 10, 0, 0, 0); + mTimeInfo.iTimeZoneOffset = 600; + mTimeInfo.iDstOffset = 1; + mMCC = _L( "505" ); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNotFound == errorCode); + QVERIFY(KErrNotFound == mTzId); + delete mTzResolver; + } +} + +/*! + Tests the api TestTimezoneClient::tesTimeZoneResolverSingleZone5. +*/ +void TestClockEngines::testTimeZoneResolverSingleZoneWrongMCC() +{ + int errorCode(KErrNotFound); + mTzResolver = CClockTimeZoneResolver::NewL(); + int actualTzId = 1944; + if (NULL != mTzResolver) { + mTimeInfo.iUtcDateTime = TDateTime(2008, TMonth(EJanuary), 27, 10, 0, 0, 0);; + mTimeInfo.iTimeZoneOffset = 330; + mTimeInfo.iDstOffset = 0; + mMCC = _L("9999"); + + errorCode = mTzResolver->GetTimeZoneL(mTimeInfo, mMCC, mTzId); + QVERIFY(KErrNone == errorCode); + QVERIFY(actualTzId == mTzId); + delete mTzResolver; + } +} + +//********************** TIMESOURCE INTERFACE****************************// + +/*! + Tests the api TestTimezoneClient::NotifyTimeChangeL. +*/ +void TestClockEngines::NotifyTimeChangeL( CClockTimeSourceInterface& plugin ) +{ + Q_UNUSED(plugin) +} + +/*! + Tests the api TestTimezoneClient::testVersion. +*/ +void TestClockEngines::testVersion() +{ + int errorCode = mClockServerCltHandle->Connect(); + if (KErrNone == errorCode) { + TVersion testVersion = mClockServerCltHandle->Version(); + mClockServerCltHandle->Close(); + + QVERIFY(KClockServerBuildVN == testVersion.iBuild); + QVERIFY(KClockServerMajorVN == testVersion.iMajor); + QVERIFY(KClockServerMinorVN == testVersion.iMinor); + } +} + +/*! + Tests the api TestTimezoneClient::testCreatePluginInstance. +*/ +void TestClockEngines::testCreatePluginInstance() +{ + mClkTimeUpdaterInterface = CClockTimeSourceInterface::NewL(TUid::Uid(KNitzPluginId), this); + Q_ASSERT(mClkTimeUpdaterInterface); + delete mClkTimeUpdaterInterface; +} + +/*! + Tests the api TestTimezoneClient::testGetNitzData. +*/ +void TestClockEngines::testGetNitzData() +{ + mNitzInfo.iUtcDateTime = TTime(KErrNotFound).DateTime(); + mNitzInfo.iTimeZoneOffset = KErrNotFound; + mNitzInfo.iDstOffset = KErrNotFound; + + mClkTimeUpdaterInterface = CClockTimeSourceInterface::NewL(TUid::Uid(KNitzPluginId), this); + + Q_ASSERT(mClkTimeUpdaterInterface); + if (NULL != mClkTimeUpdaterInterface) { + mClkTimeUpdaterInterface->GetTimeInformationL(EUTCTime, &mNitzInfo); + mClkTimeUpdaterInterface->GetTimeInformationL(ETZOffset, &mNitzInfo); + mClkTimeUpdaterInterface->GetTimeInformationL(EDSTOffset, &mNitzInfo); + + qDebug() << "UtcDate: " << QDate(mNitzInfo.iUtcDateTime.Year(),mNitzInfo.iUtcDateTime.Month(),mNitzInfo.iUtcDateTime.Day()); + qDebug() << "UtcTime: " << QTime(mNitzInfo.iUtcDateTime.Hour(),mNitzInfo.iUtcDateTime.Minute(),mNitzInfo.iUtcDateTime.Second()); + qDebug() << "Timzone Offset: " << mNitzInfo.iTimeZoneOffset.Int(); + qDebug() << "DST Offset: " << mNitzInfo.iDstOffset.Int(); + + delete mClkTimeUpdaterInterface; + } +} + +/*! + Tests the api TestTimezoneClient::testInvalidPlugin. +*/ +void TestClockEngines::testInvalidPlugin() +{ + mClkTimeUpdaterInterface = CClockTimeSourceInterface::NewL(KInvalidID, this); + QVERIFY(NULL == mClkTimeUpdaterInterface); +} + +/*! + Tests the api TestTimezoneClient::testTimeUpdateOn. +*/ +void TestClockEngines::testTimeUpdateOn() +{ + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + + if (KErrNone == errorCode) { + int timeUpdateOn( EFalse ); + + // Activate Nitz plugin. + errorCode = mClockServerCltHandle->ActivateProtocol(KNitzPluginId); + if (KErrNone == errorCode) { + // Check if auto time update is on. + errorCode = mClockServerCltHandle->IsAutoTimeUpdateOn(timeUpdateOn); + QVERIFY(true == timeUpdateOn); + } + mClockServerCltHandle->Close(); + } +} + +/*! + Tests the api TestTimezoneClient::testInvalidPlugin. +*/ +void TestClockEngines::testTimeUpdateOff() +{ + // First connect and test for it. + int errorCode = mClockServerCltHandle->Connect(); + + if (KErrNone == errorCode) { + int timeUpdateOn( ETrue ); + + // Activate Nitz plugin. + errorCode = mClockServerCltHandle->DeActivateProtocol(KNitzPluginId); + if (KErrNone == errorCode) { + // Check if auto time update is on. + errorCode = mClockServerCltHandle->IsAutoTimeUpdateOn(timeUpdateOn); + QVERIFY(false == timeUpdateOn); + } + mClockServerCltHandle->Close(); + } +} + +QTEST_MAIN(TestClockEngines) + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_clockengines/unittest_clockengines.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_clockengines/unittest_clockengines.pro Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,60 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Project specification file for settingsutility unit test. +# + + +TEMPLATE = app +TARGET = utclockengines +CONFIG += qtestlib +CONFIG += symbian_test + +DEPENDPATH += \ + . \ + ./src + +INCLUDEPATH += . \ + ../../clockengines \ + ../../clockengines/inc \ + ../../clockengines/clockserver/client/inc \ + ../../clockengines/clockserver/server/inc \ + ../../clockengines/clocktimezoneresolver/inc \ + ../../clockengines/clocktimesourceinterface/inc \ + ../../clockui/inc \ + ../../inc + +symbian: { + + LIBS += -leuser \ + -lclockserverclient \ + -lclocktimesourceinterface \ + -lclocktimezoneresolver + + BLD_INF_RULES.prj_testexports += \ + "./rom/unittest_clockengines.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unittest_clockengines.iby)" + + TARGET.EPOCHEAPSIZE = 0x200000 0x4000000 + TARGET.CAPABILITY = CAP_GENERAL_DLL + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +} + +SOURCES += \ + unittest_clockengines.cpp \ + + +HEADERS += \ + ./inc/unittest_clockengines.h + +# End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_settingsutility/rom/unittest_settingsutility.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_settingsutility/rom/unittest_settingsutility.iby Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* The iby file for clockmw settingsutility unit tests. +* +*/ + + +#ifndef __UT_SETTINGSUTILITY_IBY__ +#define __UT_SETTINGSUTILITY_IBY__ + +S60_APP_EXE(utsettingsutility) +S60_APP_RESOURCE(utsettingsutility) + +// Application registration file. +data=DATAZ_\private\10003a3f\import\apps\utsettingsutility_reg.rsc \private\10003a3f\import\apps\utsettingsutility_reg.rsc + +#endif // __UT_SETTINGSUTILITY_IBY__ + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_settingsutility/unittest_settingsutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_settingsutility/unittest_settingsutility.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,313 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: SettingsUtility unit test class. +* +*/ + + +#include +#include "settingsutility.h" + +class TestSettingsUtility: public QObject +{ + Q_OBJECT + +private slots: + // Test case setup. + void init(); + void cleanup(); + + // Test cases. + void testTime(); + + void testSetTimeFormat(); + void testTimeFormat(); + + void testSetClockType(); + void testClockType(); + + void testSetTimeSeparator(); + void testTimeSeparator(); + + void testDate(); + + void testSetDateFormat(); + void testDateFormat(); + + void testSetDateSeparator(); + void testDateSeparator(); + +private: + SettingsUtility *mSettingsUtility; +}; + +/*! + This function will be called before each testfunction is executed. + */ +void TestSettingsUtility::init() +{ + mSettingsUtility = new SettingsUtility(); +} + +/*! + This function will be called after every testfunction. + */ +void TestSettingsUtility::cleanup() +{ + if (mSettingsUtility) { + delete mSettingsUtility; + } +} + +/*! + Tests the api SettingsUtility::time + */ +void TestSettingsUtility::testTime() +{ + QString expectedTime = + QTime::currentTime().toString(mSettingsUtility->timeFormatString()); + QString testTime = mSettingsUtility->time(); + QVERIFY(expectedTime == testTime); +} + +/*! + Tests the api SettingsUtility::setTimeFormat + */ +void TestSettingsUtility::testSetTimeFormat() +{ + QStringList dummyList; + mSettingsUtility->setTimeFormat(qtTrId("txt_clk_setlabel_val_24_hour")); + QCOMPARE(mSettingsUtility->timeFormat(dummyList), 0); + + mSettingsUtility->setTimeFormat(qtTrId("txt_clk_setlabel_val_12_hour")); + QCOMPARE(mSettingsUtility->timeFormat(dummyList), 1); + + mSettingsUtility->setTimeFormat("hour"); + QCOMPARE(mSettingsUtility->timeFormat(dummyList), 1); +} + +/*! + Tests the api SettingsUtility::timeFormat + */ +void TestSettingsUtility::testTimeFormat() +{ + QStringList expectedResult; + expectedResult << qtTrId("txt_clk_setlabel_val_24_hour") << qtTrId("txt_clk_setlabel_val_12_hour"); + QStringList result; + + mSettingsUtility->timeFormat(result); + QCOMPARE(result, expectedResult); + + mSettingsUtility->setTimeFormat(qtTrId("txt_clk_setlabel_val_24_hour")); + QVERIFY(mSettingsUtility->timeFormat(expectedResult) == 0); + + mSettingsUtility->setTimeFormat(qtTrId("txt_clk_setlabel_val_12_hour")); + QVERIFY(mSettingsUtility->timeFormat(expectedResult) == 1); + + mSettingsUtility->setTimeFormat("hour"); + QVERIFY(mSettingsUtility->timeFormat(expectedResult) == 1); +} + +/*! + Tests the api SettingsUtility::setClockType + */ +void TestSettingsUtility::testSetClockType() +{ + QStringList dummyList; + + mSettingsUtility->setClockType(qtTrId("txt_clock_button_analog")); + QCOMPARE(mSettingsUtility->clockType(dummyList), 0); + + mSettingsUtility->setClockType(qtTrId("txt_clock_button_digital")); + QCOMPARE(mSettingsUtility->clockType(dummyList), 1); + + mSettingsUtility->setClockType("clock"); + QCOMPARE(mSettingsUtility->clockType(dummyList), 1); + + mSettingsUtility->setClockType("&%#$"); + QCOMPARE(mSettingsUtility->clockType(dummyList), 1); +} + +/*! + Tests the api SettingsUtility::clockType + */ +void TestSettingsUtility::testClockType() +{ + QStringList expectedResult; + expectedResult << qtTrId("txt_clock_button_analog") << qtTrId("txt_clock_button_digital"); + QStringList result; + + mSettingsUtility->clockType(result); + QCOMPARE(result, expectedResult); + + mSettingsUtility->setClockType(qtTrId("txt_clock_button_analog")); + QVERIFY(mSettingsUtility->clockType(expectedResult) == 0); + + mSettingsUtility->setClockType(qtTrId("txt_clock_button_digital")); + QVERIFY(mSettingsUtility->clockType(expectedResult) == 1); + + // Negative test case + mSettingsUtility->setClockType("clock"); + QVERIFY(mSettingsUtility->clockType(expectedResult) == 1); + +} + +/*! + Tests the api SettingsUtility::setTimeSeparator + */ +void TestSettingsUtility::testSetTimeSeparator() +{ + QStringList expectedResult; + expectedResult << tr(".") << tr(":"); + QStringList result; + + mSettingsUtility->timeSeparator(result); + QVERIFY(result == expectedResult); + + mSettingsUtility->setTimeSeparator("."); + QCOMPARE(mSettingsUtility->timeSeparator(result), 0); + + mSettingsUtility->setTimeSeparator(":"); + QCOMPARE(mSettingsUtility->timeSeparator(result), 1); + + // Negative case + mSettingsUtility->setTimeSeparator("/"); + QCOMPARE(mSettingsUtility->timeSeparator(result), 1); + +} + +/*! + Tests the api SettingsUtility::timeSeparator + */ +void TestSettingsUtility::testTimeSeparator() +{ + QStringList expectedResult; + expectedResult << tr(".") << tr(":"); + QStringList result; + + mSettingsUtility->timeSeparator(result); + QCOMPARE(result, expectedResult); + + mSettingsUtility->setTimeSeparator(":"); + int index = mSettingsUtility->timeSeparator(result); + QVERIFY(index == 1); + + // Negative case + mSettingsUtility->setTimeSeparator("$"); + index = mSettingsUtility->timeSeparator(result); + QVERIFY(index == 1); +} + +/*! + Tests the api SettingsUtility::date + */ +void TestSettingsUtility::testDate() +{ + QStringList dummyList; + int index = mSettingsUtility->dateFormat(dummyList); + QString dateFormat = mSettingsUtility->dateFormatString(); + QString actualDate = QDate::currentDate().toString(dateFormat); + QString currentDate = mSettingsUtility->date(); + QVERIFY(actualDate == currentDate); +} + +/*! + Tests the api SettingsUtility::setDateFormat + */ +void TestSettingsUtility::testSetDateFormat() +{ + QStringList dummyList; + + mSettingsUtility->setDateFormat(qtTrId("txt_clk_setlabel_val_dd_mm_yyyy")); + QCOMPARE(mSettingsUtility->dateFormat(dummyList), 0); + + mSettingsUtility->setDateFormat(qtTrId("txt_clk_setlabel_val_mm_dd_yyyy")); + QCOMPARE(mSettingsUtility->dateFormat(dummyList), 1); + + mSettingsUtility->setDateFormat(qtTrId("txt_clk_setlabel_val_yyyy_mm_dd")); + QCOMPARE(mSettingsUtility->dateFormat(dummyList), 2); + + // Negative test case + mSettingsUtility->setDateFormat("dd yyyy mm"); + QCOMPARE(mSettingsUtility->dateFormat(dummyList), 2); +} + +/*! + Tests the api SettingsUtility::dateFormat + */ +void TestSettingsUtility::testDateFormat() +{ + QStringList expectedResult; + expectedResult << qtTrId("txt_clk_setlabel_val_dd_mm_yyyy") << qtTrId("txt_clk_setlabel_val_mm_dd_yyyy") << qtTrId("txt_clk_setlabel_val_yyyy_mm_dd"); + QStringList result; + + mSettingsUtility->dateFormat(result); + QCOMPARE(result, expectedResult); + + mSettingsUtility->setDateFormat(qtTrId("txt_clk_setlabel_val_dd_mm_yyyy")); + int index = mSettingsUtility->dateFormat(result); + QVERIFY(index == 0); + + //Negative test case + mSettingsUtility->setDateFormat("hello"); + index = mSettingsUtility->dateFormat(result); + QVERIFY(index == 0); + +} + +/*! + Tests the api SettingsUtility::setDateSeparator + */ +void TestSettingsUtility::testSetDateSeparator() +{ + QStringList dummyList; + + mSettingsUtility->setDateSeparator("."); + QCOMPARE(mSettingsUtility->dateSeparator(dummyList), 0); + + mSettingsUtility->setDateSeparator(":"); + QCOMPARE(mSettingsUtility->dateSeparator(dummyList), 1); + + mSettingsUtility->setDateSeparator("/"); + QCOMPARE(mSettingsUtility->dateSeparator(dummyList), 2); + + mSettingsUtility->setDateSeparator("-"); + QCOMPARE(mSettingsUtility->dateSeparator(dummyList), 3); + + // Negative test case + mSettingsUtility->setDateSeparator("?"); + QCOMPARE(mSettingsUtility->dateSeparator(dummyList), 3); +} + +/*! + Tests the api SettingsUtility::dateSeparator + */ +void TestSettingsUtility::testDateSeparator() +{ + QStringList expectedResult; + expectedResult << tr(".") << tr(":") << tr("/") << tr("-"); + QStringList result; + + mSettingsUtility->dateSeparator(result); + QCOMPARE(result, expectedResult); + + mSettingsUtility->setDateSeparator("-"); + int index = mSettingsUtility->dateSeparator(result); + QVERIFY(index == 3); +} + +QTEST_MAIN(TestSettingsUtility) +#include "unittest_settingsutility.moc" + +// End of file. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_settingsutility/unittest_settingsutility.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_settingsutility/unittest_settingsutility.pro Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,42 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Project specification file for settingsutility unit test. +# + +TEMPLATE = app +TARGET = utsettingsutility +CONFIG += qtestlib +CONFIG += symbian_test + +DEPENDPATH += . +INCLUDEPATH += . \ + ../../clockmw/clocksettingsutility/inc \ + ../../inc + +symbian: { + BLD_INF_RULES.prj_testexports += \ + "./rom/unittest_settingsutility.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unittest_settingsutility.iby)" + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + + LIBS += -leuser \ + -lclocksettingsutility + + TARGET.EPOCHEAPSIZE = 0x200000 0x4000000 + TARGET.CAPABILITY = CAP_GENERAL_DLL +} + +SOURCES += unittest_settingsutility.cpp + +# End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_timezoneclient/rom/unittest_timezoneclient.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_timezoneclient/rom/unittest_timezoneclient.iby Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* The iby file for clockmw Timezoneclient unit tests. +* +*/ + + +#ifndef __UT_TIMEZONECLIENT_IBY__ +#define __UT_TIMEZONECLIENT_IBY__ + +S60_APP_EXE(uttimezoneclient) +S60_APP_RESOURCE(uttimezoneclient) + +// Application registration file. +data=DATAZ_\private\10003a3f\import\apps\uttimezoneclient_reg.rsc \private\10003a3f\import\apps\uttimezoneclient_reg.rsc + +#endif // __UT_TIMEZONECLIENT_IBY__ + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_timezoneclient/unittest_timezoneclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_timezoneclient/unittest_timezoneclient.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,465 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Symbian Foundation License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: TimeZoneClient unit test class. + * + */ + +// System includes +#include + +// User includes +#include "timezoneclient.h" +#include "clockdatatypes.h" +/*! + \class TestTimeZoneClient + + This object has functions to test the public apis in the class + TimeZoneClient. + */ +class TestTimezoneClient: public QObject +{ + Q_OBJECT + +private slots: + // Test case setup. + void init(); + void cleanup(); + + // Test cases. + void testGetLocations(); + void testGetCurrentZoneInfoL(); + void testSetAsCurrentLocation(); + void testSetAsCurrentLocationWithDst(); + void testIsDSTOnL(); + void testGetStandardOffset(); + void testTimeUpdateOn(); + void testSetTimeUpdateOn(); + void testSetDateTime(); + void testGetAllTimeZoneOffsets(); + void testGetCountriesForUTCOffset(); + void testAddCity(); + void testCheckForDstChange(); + void testGetSavedLocations(); + void testSaveLocations(); + //void testGetLocationInfo(); + //void testGetCityGroupIdByName(); + //void testGetCityOffsetByNameAndId(); +private: + void doCleanup(); +private: + TimezoneClient *mTimezoneClient; + int mError; +}; + +/*! + This function will be called before each testfunction is executed. + */ +void TestTimezoneClient::init() +{ + TRAPD(mError, mTimezoneClient = TimezoneClient::getInstance()); + Q_UNUSED(mError) + + Q_ASSERT(!mError); + Q_ASSERT(mTimezoneClient); +} + +/*! + This function will be called after every testfunction. + */ +void TestTimezoneClient::cleanup() +{ + if (!mTimezoneClient->isNull()) { + mTimezoneClient->deleteInstance(); + } +} + +/*! + Tests the api TimeZoneClient::getLocations + */ +void TestTimezoneClient::testGetLocations() +{ + QList locationList = mTimezoneClient->getLocations(); + QVERIFY(0 < locationList.count()); +} + +/*! + Tests the api TestTimezoneClient::getCurrentZoneInfoL + */ +void TestTimezoneClient::testGetCurrentZoneInfoL() +{ + //LocationInfo testLocationInfo = {"Canada", "Toronto", "", -300, 1528, true}; + + LocationInfo testLocationInfo = {"India", "Chennai", "", 330, 1944, 45, false}; + mTimezoneClient->setAsCurrentLocationL(testLocationInfo); + LocationInfo retrievedLocationInfo; + retrievedLocationInfo = mTimezoneClient->getCurrentZoneInfoL(); + + // Check the location info set with retrieved info. + QString temp = retrievedLocationInfo.countryName; + temp = retrievedLocationInfo.cityName; + QVERIFY(testLocationInfo.countryName == retrievedLocationInfo.countryName); + QVERIFY(testLocationInfo.cityName == retrievedLocationInfo.cityName); + QVERIFY(testLocationInfo.timezoneId == retrievedLocationInfo.timezoneId); +} + +/*! + Tests the api TestTimezoneClient::setAsCurrentLocation. + */ +void TestTimezoneClient::testSetAsCurrentLocation() +{ + LocationInfo testLocationInfo = {"India", "Kolkata", "", 330, 1944, false}; + mTimezoneClient->setAsCurrentLocationL(testLocationInfo); + LocationInfo retrievedLocationInfo; + retrievedLocationInfo = mTimezoneClient->getCurrentZoneInfoL(); + + // Check the location info set with retrieved info. + QVERIFY(testLocationInfo.countryName == retrievedLocationInfo.countryName); + QVERIFY(testLocationInfo.cityName == retrievedLocationInfo.cityName); + QVERIFY(testLocationInfo.listImageName + == retrievedLocationInfo.listImageName); + QVERIFY(testLocationInfo.zoneOffset == retrievedLocationInfo.zoneOffset); + QVERIFY(testLocationInfo.timezoneId == retrievedLocationInfo.timezoneId); + QVERIFY(testLocationInfo.dstOn == retrievedLocationInfo.dstOn); +} + +/*! + Tests the api TimeZoneClient::dstOn. + */ +void TestTimezoneClient::testSetAsCurrentLocationWithDst() +{ + //QDateTime currentDateTime(QDate(2009, 05, 15), QTime(12, 30)); + //QDateTime currentDateTime(QDate(2010, 03, 28), QTime(4, 0)); + QDateTime currentDateTime(QDate(2010, 03, 31), QTime(8, 30)); + mTimezoneClient->setDateTime(currentDateTime); + LocationInfo testLocationInfo = {"Finland", "Helsinki", "", 180, 2760, 33, + true}; + mTimezoneClient->setAsCurrentLocationL(testLocationInfo); + LocationInfo retrievedLocationInfo; + retrievedLocationInfo = mTimezoneClient->getCurrentZoneInfoL(); + + // Check the location info set with retrieved info. + QVERIFY(testLocationInfo.countryName == retrievedLocationInfo.countryName); + QVERIFY(testLocationInfo.cityName == retrievedLocationInfo.cityName); + QVERIFY(testLocationInfo.listImageName + == retrievedLocationInfo.listImageName); + QVERIFY(testLocationInfo.zoneOffset == retrievedLocationInfo.zoneOffset); + QVERIFY(testLocationInfo.timezoneId == retrievedLocationInfo.timezoneId); + QVERIFY(testLocationInfo.dstOn == retrievedLocationInfo.dstOn); +} + +/*! + Tests the api TestTimezoneClient::isDSTOnL + */ +void TestTimezoneClient::testIsDSTOnL() +{ + LocationInfo testLocationInfo = + {"Finland", "Helsinki", "", 180, 2760, 33, true}; + mTimezoneClient->setAsCurrentLocationL(testLocationInfo); + QDateTime dstOnDate(QDate(2010, 03, 31), QTime(8, 30)); + mTimezoneClient->setDateTime(dstOnDate); + QVERIFY(true == mTimezoneClient->isDSTOnL(2760)); + + QDateTime dstOffDate(QDate(2010, 03, 27), QTime(8, 30)); + mTimezoneClient->setDateTime(dstOffDate); + QVERIFY(false == mTimezoneClient->isDSTOnL(2760)); + + LocationInfo testLocationInfo1 = {"India", "Kolkata", "", 330, 1944, false}; + mTimezoneClient->setAsCurrentLocationL(testLocationInfo1); + QVERIFY(false == mTimezoneClient->isDSTOnL(1944)); +} + +/*! + Tests the api TimeZoneClient::getStandardOffset + */ +void TestTimezoneClient::testGetStandardOffset() +{ + // For India + int expectedOffset = 330; + int offset = mTimezoneClient->getStandardOffset(1944); + QVERIFY(expectedOffset == offset); + + // For London + expectedOffset = 345; + offset = mTimezoneClient->getStandardOffset(1936); + QVERIFY(expectedOffset == offset); +} + +/*! + Tests the api TimeZoneClient::timeUpdateOn + */ +void TestTimezoneClient::testTimeUpdateOn() +{ + mTimezoneClient->setTimeUpdateOn(true); + QVERIFY(true == mTimezoneClient->timeUpdateOn()); + mTimezoneClient->setTimeUpdateOn(false); + QVERIFY(false == mTimezoneClient->timeUpdateOn()); +} + +/*! + Tests the api TimeZoneClient::timeUpdateOn + */ +void TestTimezoneClient::testSetTimeUpdateOn() +{ + bool timeUpdate = mTimezoneClient->timeUpdateOn(); + mTimezoneClient->setTimeUpdateOn(!timeUpdate); + + QVERIFY(timeUpdate != mTimezoneClient->timeUpdateOn()); +} + +/*! + Tests the api TimeZoneClient::setDateTime + */ +void TestTimezoneClient::testSetDateTime() +{ + QDateTime currentDateTime = QDateTime::currentDateTime(); + + QDateTime expectedDateTime1 = currentDateTime.addDays(10).addSecs(3600); + mTimezoneClient->setDateTime(expectedDateTime1); + QVERIFY(currentDateTime.date() != QDate::currentDate()); + QVERIFY(currentDateTime.time().toString("hh:mm ap") != QTime::currentTime().toString("hh:mm ap")); + QVERIFY(expectedDateTime1.date() == QDate::currentDate()); + QVERIFY(expectedDateTime1.time().toString("hh:mm ap") == QTime::currentTime().toString("hh:mm ap")); + + QDateTime expectedDateTime2 = currentDateTime.addDays(100).addSecs(7200); + + mTimezoneClient->setDateTime(expectedDateTime2); + QVERIFY(expectedDateTime2.date() == QDate::currentDate()); + QVERIFY(expectedDateTime2.time().toString("hh:mm ap") == QTime::currentTime().toString("hh:mm ap")); +} + +/*! + Tests the api TimeZoneClient::getAllTimeZoneOffsets + */ +void TestTimezoneClient::testGetAllTimeZoneOffsets() +{ + int indiaOffset = 330; + QList offsetList = mTimezoneClient->getAllTimeZoneOffsets(); + QVERIFY(offsetList.count()); + QVERIFY(offsetList.contains(indiaOffset)); +} + +/*! + Tests the api TimeZoneClient::getCountriesForUTCOffset + */ +void TestTimezoneClient::testGetCountriesForUTCOffset() +{ + int offset = 330; + QList expectedList; + expectedList.append("India"); + expectedList.append("Sri Lanka"); + QList countryList = + mTimezoneClient->getCountriesForUTCOffset(offset); + int count = countryList.count(); + QVERIFY(expectedList.count() == count); + + QList nameList; + for(int i = 0; i < count; i++) { + nameList.append(countryList[i].countryName); + } + for(int i = 0; i < count; i++) { + QVERIFY(nameList.contains(expectedList[i])); + } + + // TODO: // Add negative + offset = -12; + countryList.clear(); + countryList = mTimezoneClient->getCountriesForUTCOffset(offset); + QVERIFY(!countryList.count()); +} + +/*! + Tests the api TimeZoneClient::addCity + */ +void TestTimezoneClient::testAddCity() +{ + QString cityName("Cochin"); + LocationInfo newLocInfo; + TRAPD(err, newLocInfo = mTimezoneClient->addCity(1944, cityName, 45)); + if(err == KErrAlreadyExists) { + // City is already existing. + } + QList &list = mTimezoneClient->getLocations(); + QList nameList; + for(int i = 0; i < list.count(); i++) { + nameList.append(list[i].cityName); + } + QVERIFY(nameList.contains(cityName)); +} + +/*! + Tests the api TimeZoneClient::checkForDstChange + */ +void TestTimezoneClient::testCheckForDstChange() +{ + LocationInfo testLocationInfo = + {"Finland", "Helsinki", "", 180, 2760, 33, true}; + mTimezoneClient->setAsCurrentLocationL(testLocationInfo); + // Finland, Helsinki + // DST started on Sunday, 28 March 2010, 03:00 local standard time + // DST ends on Sunday, 31 October 2010, 04:00 local daylight time + QDateTime dstOnDate(QDate(2010, 10, 31), QTime(3, 45)); + mTimezoneClient->setDateTime(dstOnDate); + mTimezoneClient->setAsCurrentLocationL(testLocationInfo); + + AlarmInfo alarmDetails; + alarmDetails.origAlarmTime = QTime::currentTime().addSecs(3600); + alarmDetails.alarmDateTime = QDate::currentDate(); + alarmDetails.repeatType = AlarmRepeatType(0); + alarmDetails.alarmDay = 1; + bool dstChange = mTimezoneClient->checkForDstChange(alarmDetails); + QVERIFY(dstChange == true); + + QDateTime dstOffDate(QDate(2010, 10, 31), QTime(04, 01)); + mTimezoneClient->setDateTime(dstOffDate); + AlarmInfo alarmDetails1; + alarmDetails1.origAlarmTime = QTime::currentTime().addSecs(3600); + alarmDetails1.alarmDateTime = QDate::currentDate(); + alarmDetails1.repeatType = AlarmRepeatType(0); + alarmDetails1.alarmDay = 1; + dstChange = mTimezoneClient->checkForDstChange(alarmDetails1); + QVERIFY(dstChange == false); + + LocationInfo testLocationInfo1 = + {"India", "Chennai", "", 330, 1944, 45, false}; + mTimezoneClient->setAsCurrentLocationL(testLocationInfo1); + mTimezoneClient->setDateTime(dstOnDate); + mTimezoneClient->setAsCurrentLocationL(testLocationInfo1); + dstChange = mTimezoneClient->checkForDstChange(alarmDetails1); + QVERIFY(dstChange == false); +} + +/*! + Tests the api TimeZoneClient::getSavedLocations + */ +void TestTimezoneClient::testGetSavedLocations() +{ + doCleanup(); + mTimezoneClient->setDateTime(QDateTime(QDate(2010, 8, 15), QTime(9,30))); + + QList locationList = mTimezoneClient->getSavedLocations(); + int firstcount = locationList.count(); + LocationInfo testLocationInfo1 = {"Japan", "Tokyo", "", 540, 2192, 53, + false}; + QList testList; + testList << testLocationInfo1; + mTimezoneClient->saveLocations(testList); + + locationList.clear(); + locationList = mTimezoneClient->getSavedLocations(); + int cnt = locationList.count(); + QVERIFY((firstcount + 1) == locationList.count()); + + QList nameList; + int index = 0; + for(int i = 0; i < locationList.count(); i++) { + if(testLocationInfo1.countryName == locationList[i].countryName) { + index = i; + } + } + QVERIFY(testLocationInfo1.countryName == locationList[index].countryName); + QVERIFY(testLocationInfo1.cityName == locationList[index].cityName); + QVERIFY(testLocationInfo1.listImageName + == locationList[index].listImageName); + QVERIFY(testLocationInfo1.zoneOffset == locationList[index].zoneOffset); + QVERIFY(testLocationInfo1.timezoneId == locationList[index].timezoneId); + QVERIFY(testLocationInfo1.dstOn == locationList[index].dstOn); + + LocationInfo testLocationInfo2 = {"Singapore", "Singapore", "", 480, 2144, 87, false}; + LocationInfo testLocationInfo3 = {"Finland", "Helsinki", "", 180, 2760, 33, true}; + testList << testLocationInfo2 + << testLocationInfo3; + mTimezoneClient->saveLocations(testList); + locationList.clear(); + locationList = mTimezoneClient->getSavedLocations(); + QVERIFY((firstcount + 3) == locationList.count()); + doCleanup(); + +} + +/*! + Tests the api TimeZoneClient::saveLocations. + */ +void TestTimezoneClient::testSaveLocations() +{ + doCleanup(); + LocationInfo testLocationInfo = {"India", "Kolkata", "", 330, 1944, 45, false}; + QList testList; + testList << testLocationInfo; + mTimezoneClient->saveLocations(testList); + QList resultantList = mTimezoneClient->getSavedLocations(); + + // Check the location info saved with retrieved info. + QVERIFY(resultantList.at(0).countryName == testList.at(0).countryName); + QVERIFY(resultantList.at(0).cityName == testList.at(0).cityName); + QVERIFY(resultantList.at(0).listImageName == testList.at(0).listImageName); + QVERIFY(resultantList.at(0).zoneOffset == testList.at(0).zoneOffset); + QVERIFY(resultantList.at(0).timezoneId == testList.at(0).timezoneId); + QVERIFY(resultantList.at(0).dstOn == testList.at(0).dstOn); + doCleanup(); +} +void TestTimezoneClient::doCleanup() +{ + // Cleanup + QString fileName("c:\\data\\clock\\cityInfo.dat"); + QFile cityInfoFile(fileName); + cityInfoFile.remove(); +} +/* +! + Tests the api TimeZoneClient::getLocationInfo. + +void TestTimezoneClient::testGetLocationInfo() +{ + LocationInfo gotInfo; + LocationInfo testInfo = {"India", "Mumbai", "", 330, 1624, false}; + mTimezoneClient->getLocationInfo(45, 2, gotInfo); + + // Check the location info got by specifying groupId and cityIndex + // with testInfo. + QVERIFY(testInfo.countryName == gotInfo.countryName); + QVERIFY(testInfo.cityName == gotInfo.cityName); + QVERIFY(testInfo.listImageName == gotInfo.listImageName); + QVERIFY(testInfo.zoneOffset == gotInfo.zoneOffset); + QVERIFY(testInfo.timezoneId == gotInfo.timezoneId); + QVERIFY(testInfo.dstOn == gotInfo.dstOn); +} + +! + Test the api TimeZoneClient::testGetCityGroupIdByName. + +void TestTimezoneClient::testGetCityGroupIdByName() +{ + int retrievedGroupId = mTimezoneClient->getCityGroupIdByName("India"); + mTimezoneClient->get + // Check the retrieved city group id with actual id. + QVERIFY(45 == retrievedGroupId); +} + +! + Test the api TestTimezoneClient::getCityOffsetByNameAndId. + +void TestTimezoneClient::testGetCityOffsetByNameAndId() +{ + int retrievedCityOffset = + mTimezoneClient->getCityOffsetByNameAndId("Mumbai",1624); + + // Check the retrieved city offset with actual offset. + QVERIFY(1 == retrievedCityOffset); +} +*/ + +QTEST_MAIN(TestTimezoneClient) +#include "unittest_timezoneclient.moc" + +// End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 clock/tsrc/unittest_timezoneclient/unittest_timezoneclient.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/tsrc/unittest_timezoneclient/unittest_timezoneclient.pro Fri Oct 15 12:10:36 2010 +0530 @@ -0,0 +1,42 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Project specification file for timezoneclient unit test. +# + +TEMPLATE = app +TARGET = uttimezoneclient +CONFIG += qtestlib +CONFIG += symbian_test + +DEPENDPATH += . + +INCLUDEPATH += . \ + ../../inc \ + ../../clockmw/clocktimezone/inc + +symbian: { + BLD_INF_RULES.prj_testexports += \ + "./rom/unittest_timezoneclient.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unittest_timezoneclient.iby)" + LIBS += -leuser \ + -ltimezoneclient + + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + TARGET.EPOCHEAPSIZE = 0x200000 0x4000000 + TARGET.CAPABILITY = CAP_GENERAL_DLL +} + +SOURCES += unittest_timezoneclient.cpp + +# End of file --Don't remove. diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/data/xml/todoeditor.docml --- a/notes/notesui/noteseditor/data/xml/todoeditor.docml Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/data/xml/todoeditor.docml Fri Oct 15 12:10:36 2010 +0530 @@ -3,7 +3,7 @@ - + diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/inc/notesnoteeditor.h --- a/notes/notesui/noteseditor/inc/notesnoteeditor.h Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/inc/notesnoteeditor.h Fri Oct 15 12:10:36 2010 +0530 @@ -63,6 +63,8 @@ void handleCalendarEditorClosed(); void handleNewNoteAction(); void selectedAction(HbAction *action); + void forcedExit(); + private: HbView *mEditor; @@ -89,6 +91,7 @@ bool mEntrySavedInCalendar; bool mDiscardChangesActionActive; bool mIgnoreFirstContentChange; + bool mForcedExit; private: friend class NotesEditorPrivate; }; diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/inc/notestodoeditor.h --- a/notes/notesui/noteseditor/inc/notestodoeditor.h Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/inc/notestodoeditor.h Fri Oct 15 12:10:36 2010 +0530 @@ -39,6 +39,7 @@ class HbDialog; class HbGroupBox; class HbDataFormModelItem; +class HbTranslator; class AgendaEntry; class NotesEditorPrivate; class NotesEditorDocLoader; @@ -71,6 +72,7 @@ void addMenu(); bool validAlarmSet(); void addDiscardChangesAction(); + void saveActivity(); private slots: void saveTodo(); @@ -80,7 +82,7 @@ void handleDeleteAction(); void handleDiscardChangesAction(); void selectedAction(HbAction *action); - + void forcedExit(); private: NotesEditorPrivate* mOwner; @@ -102,11 +104,15 @@ HbAction *mDeleteTodoAction; HbAction *mCancelDeleteAction; HbGroupBox *mSubHeading; - + + HbTranslator *mTranslator; + NotesEditorDocLoader *mDocLoader; + int mDescriptionItemIndex; bool mDiscardChangesActive; + bool mForcedExit; private: friend class NotesEditorPrivate; }; diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/noteseditor.pro --- a/notes/notesui/noteseditor/noteseditor.pro Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/noteseditor.pro Fri Oct 15 12:10:36 2010 +0530 @@ -69,6 +69,7 @@ RESOURCES += \ noteseditor.qrc -TRANSLATIONS += noteseditor.ts +TRANSLATIONS += noteseditor.ts \ + todoeditor.ts # End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/src/noteseditor_p.cpp --- a/notes/notesui/noteseditor/src/noteseditor_p.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/src/noteseditor_p.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -502,11 +502,11 @@ if (mNewEntry) { if (AgendaEntry::TypeNote == mModifiedNote.type()) { mModifiedNote.setDescription(description); - mModifiedNote.setLastModifiedDateTime( - QDateTime(QDate::currentDate(), QTime::currentTime())); // Set the creation time as DTStamp time - mModifiedNote.setDTStamp( - QDateTime(QDate::currentDate(), QTime::currentTime())); + QDateTime currDateTime = QDateTime::currentDateTime(); + mModifiedNote.setDTStamp(currDateTime); + // Set the same for last modified date as well + mModifiedNote.setLastModifiedDateTime(currDateTime); } else if (AgendaEntry::TypeTodo == mModifiedNote.type()) { mModifiedNote.setSummary(description); mModifiedNote.setDescription(description); @@ -516,9 +516,11 @@ } // Now save the entry. mNoteId = mAgendaUtil->store(mModifiedNote); - if (mNoteId) { + //if application exit from task switcher or red key + //don't show any notfication + if (mNoteId && !mNoteEditor->mForcedExit) { showNotification( - hbTrId("txt_notes_dpopinfo_new_note_saved")); + hbTrId("txt_notes_dpopinfo_note_saved")); } } else { if (mOriginalNote.type() != mModifiedNote.type()) { @@ -537,12 +539,13 @@ } } else { mModifiedNote.setDescription(description); - mModifiedNote.setLastModifiedDateTime( - QDateTime(QDate::currentDate(), QTime::currentTime())); + mModifiedNote.setLastModifiedDateTime(QDateTime::currentDateTime()); if (isNoteEdited()) { ulong updateStatus = mAgendaUtil->store(mModifiedNote); - if (updateStatus) { + //if application exit from task switcher or red key + //don't show any notfication + if (updateStatus && !mNoteEditor->mForcedExit ) { showNotification( hbTrId("txt_notes_dpopinfo_note_saved")); } @@ -577,10 +580,12 @@ if (isTodoEdited()) { // Add the new to-do. mNoteId = mAgendaUtil->store(mModifiedNote); - if (mNoteId) { + //if application exit from task switcher or red key + //don't show any notfication + if (mNoteId && !mTodoEditor->mForcedExit) { status = true; showNotification( - hbTrId("txt_notes_dpopinfo_new_todo_note_saved")); + hbTrId("txt_notes_dpopinfo_note_saved")); } } } else { @@ -610,9 +615,11 @@ } } } - if (status) { + //if application exit from task switcher or red key + //don't show any notfication + if (status && !mTodoEditor->mForcedExit) { showNotification( - hbTrId("txt_notes_dpopinfo_todo_note_saved")); + hbTrId("txt_notes_dpopinfo_note_saved")); } } diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/src/notesnoteeditor.cpp --- a/notes/notesui/noteseditor/src/notesnoteeditor.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/src/notesnoteeditor.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -30,6 +30,7 @@ #include #include #include +#include // User includes #include "notesnoteeditor.h" @@ -67,7 +68,8 @@ mOwner(owner), mEntrySavedInCalendar(false), mDiscardChangesActionActive(false), - mIgnoreFirstContentChange(false) + mIgnoreFirstContentChange(false), + mForcedExit(false) { OstTraceFunctionEntry0( NOTESNOTEEDITOR_NOTESNOTEEDITOR_ENTRY ); mDocLoader = new NotesEditorDocLoader; @@ -194,7 +196,12 @@ Q_UNUSED(entry) HbExtendedLocale locale = HbExtendedLocale::system(); - + + //if editor is open in background, and user close the app from task switcher + //entry should get saved + connect(qobject_cast(qApp), SIGNAL(aboutToQuit()), + this, SLOT(forcedExit())); + if (!mOwner->mNewEntry) { mTextEditor->setPlainText(mOwner->mModifiedNote.description()); @@ -267,7 +274,11 @@ void NotesNoteEditor::markNoteAsTodo() { OstTraceFunctionEntry0( NOTESNOTEEDITOR_MARKNOTEASTODO_ENTRY ); - mOwner->markNoteAsTodo(); + //if editor is open in background, and user close the app from task switcher + //entry should get saved + disconnect(qobject_cast(qApp), SIGNAL(aboutToQuit()), + this, SLOT(forcedExit())); + mOwner->markNoteAsTodo(); OstTraceFunctionExit0( NOTESNOTEEDITOR_MARKNOTEASTODO_EXIT ); } @@ -280,7 +291,11 @@ { OstTraceFunctionEntry0( NOTESNOTEEDITOR_SAVENOTE_ENTRY ); bool status = false; - + //if editor is open in background, and user close the app from task switcher + //entry should get saved + disconnect(qobject_cast(qApp), SIGNAL(aboutToQuit()), + this, SLOT(forcedExit())); + if (!mOwner->mSaveEntry) { // We don't save the note, since the note was modified by an external // entity. We just Display a message box alerting the user about this @@ -595,4 +610,14 @@ OstTraceFunctionExit0( NOTESNOTEEDITOR_SELECTEDACTION_EXIT ); } +/*! + Slot to handle entry when app exit from red key or task switcher. + */ +void NotesNoteEditor::forcedExit() +{ + OstTraceFunctionEntry0( NOTESNOTEEDITOR_FORCEDEXIT_ENTRY ); + mForcedExit = true; + saveNote(); + OstTraceFunctionExit0( NOTESNOTEEDITOR_FORCEDEXIT_EXIT ); +} // End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/src/notestodoeditor.cpp --- a/notes/notesui/noteseditor/src/notestodoeditor.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/src/notestodoeditor.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -18,6 +18,8 @@ // System includes #include +#include + #include #include #include @@ -38,6 +40,8 @@ #include #include #include +#include +#include // User includes #include "notestodoeditor.h" @@ -75,10 +79,15 @@ mOwner(owner), mReminderEnabler(0), mReminderItem(0), + mTranslator(0), mDescriptionItemIndex(5), - mDiscardChangesActive(false) + mDiscardChangesActive(false), + mForcedExit(false) { OstTraceFunctionEntry0( NOTESTODOEDITOR_NOTESTODOEDITOR_ENTRY ); + + mTranslator = new HbTranslator("todoeditor"); + mDocLoader = new NotesEditorDocLoader; Q_ASSERT(mDocLoader); @@ -111,6 +120,13 @@ QList prototypes = mDataForm->itemPrototypes(); prototypes.append(customItem); mDataForm->setItemPrototypes(prototypes); + + //if editor is open in background, and user close the app from task switcher + //entry should get saved + connect(qobject_cast(qApp), SIGNAL(aboutToQuit()), + this, SLOT(forcedExit())); + + OstTraceFunctionExit0( NOTESTODOEDITOR_NOTESTODOEDITOR_EXIT ); } @@ -126,6 +142,15 @@ mDocLoader->reset(); delete mDocLoader; + + if (mTranslator) { + delete mTranslator; + mTranslator = 0; + } + + if(mEditor){ + delete mEditor; + } OstTraceFunctionExit0( DUP1_NOTESTODOEDITOR_NOTESTODOEDITOR_EXIT ); } @@ -265,7 +290,7 @@ { OstTraceFunctionEntry0( NOTESTODOEDITOR_ADDDISCARDCHANGESACTION_ENTRY ); if(!mDiscardChangesActive) { - mDiscardAction = new HbAction(hbTrId("txt_notes_opt_discard_changes")); + mDiscardAction = new HbAction(hbTrId("txt_calendar_opt_discard_changes")); mEditor->menu()->addAction(mDiscardAction); @@ -298,14 +323,14 @@ // Insert description item insertDescriptionItem(); - mDescriptionAction->setText(hbTrId("txt_notes_opt_remove_description")); + mDescriptionAction->setText(hbTrId("txt_calendar_opt_remove_description")); viewMenu->addAction(mDescriptionAction); connect( mDescriptionAction, SIGNAL(triggered()), this, SLOT(handleRemoveDescriptionAction())); } else { - mDescriptionAction->setText(hbTrId("txt_notes_opt_add_description")); + mDescriptionAction->setText(hbTrId("txt_calendar_opt_add_description")); viewMenu->addAction(mDescriptionAction); connect( @@ -315,9 +340,9 @@ // Update the sub heading based on the new /existing entry if (mOwner->mNewEntry) { - mSubHeading->setHeading(hbTrId("txt_notes_subhead_new_todo")); + mSubHeading->setHeading(hbTrId("txt_calendar_subhead_new_todo")); } else { - mSubHeading->setHeading(hbTrId("txt_notes_subhead_todo")); + mSubHeading->setHeading(hbTrId("txt_calendar_subhead_todo")); } // Store the current view and set our view as the current view. @@ -406,7 +431,7 @@ (HbDataFormModelItem::CustomItemBase + DueDateItemOffset); mDueDateItem = mFormModel->appendDataFormItem( - itemType, hbTrId("txt_notes_formlabel_due_date"), + itemType, hbTrId("txt_calendar_formlabel_due_date"), mFormModel->invisibleRootItem()); QString dueDateText; @@ -436,7 +461,7 @@ tr(""), mFormModel->invisibleRootItem()); mReminderEnabler->setContentWidgetData( - QString("text"), QString(hbTrId("txt_notes_formlabel_alarm"))); + QString("text"), QString(hbTrId("txt_calendar_formlabel_alarm"))); if (!mOwner->mModifiedNote.alarm().isNull()) { mReminderEnabler->setContentWidgetData("checkState",Qt::Checked); @@ -462,7 +487,7 @@ (HbDataFormModelItem::CustomItemBase + AlarmDateItemOffset); mReminderItem = mFormModel->insertDataFormItem( - 3,itemType,hbTrId("txt_notes_formlabel_alarm_date_and_time")); + 3,itemType,hbTrId("txt_calendar_formlabel_alarm_date_and_time")); // Set alarm time to the buttton. QString alarmTimeText; @@ -536,13 +561,13 @@ OstTraceFunctionEntry0( NOTESTODOEDITOR_INSERTPRIORITYITEM_ENTRY ); mPriorityItem = mFormModel->appendDataFormItem( HbDataFormModelItem::ComboBoxItem, - hbTrId("txt_notes_setlabel_priority"), + hbTrId("txt_calendar_setlabel_priority"), mFormModel->invisibleRootItem()); QStringList priorityList; - priorityList << hbTrId("txt_notes_setlabel_priority_val_high") - << hbTrId("txt_notes_setlabel_priority_val_normal") - << hbTrId("txt_notes_setlabel_priority_val_low"); + priorityList << hbTrId("txt_calendar_setlabel_repeat_val_high") + << hbTrId("txt_calendar_setlabel_repeat_val_normal") + << hbTrId("txt_calendar_setlabel_repeat_val_low"); mPriorityItem->setContentWidgetData(QString("items"), priorityList); int priority = mOwner->mModifiedNote.priority(); @@ -567,11 +592,13 @@ OstTraceFunctionEntry0( NOTESTODOEDITOR_INSERTDESCRIPTIONITEM_ENTRY ); mDescriptionItem = mFormModel->appendDataFormItem( HbDataFormModelItem::TextItem, - hbTrId("txt_notes_formlabel_val_description"), + hbTrId("txt_calendar_formlabel_description"), mFormModel->invisibleRootItem()); mDescriptionItemIndex = mFormModel->indexFromItem(mDescriptionItem).row(); + + QModelIndex modelIndex = mFormModel->indexFromItem(mDescriptionItem); mDescriptionItem->setContentWidgetData("maxRows", MaxRowsInTextItem); mDescriptionItem->setContentWidgetData( @@ -580,6 +607,27 @@ mDataForm->addConnection( mDescriptionItem, SIGNAL(textChanged(const QString)), this, SLOT(updateDescription(const QString))); + + HbDataFormViewItem* view_Item = static_cast( + static_cast(mDataForm)->itemByIndex(modelIndex)); + mDataForm->scrollTo(modelIndex,HbAbstractItemView::PositionAtCenter); + + if(view_Item) { + HbLineEdit* lineEdit = static_cast(view_Item->dataItemContentWidget()); + if ( lineEdit ) { + + lineEdit->setFocus(Qt::OtherFocusReason); + + QInputContext *ic = qApp->inputContext(); + if (ic) { + QEvent *openEvent = new QEvent(QEvent::RequestSoftwareInputPanel); + ic->filterEvent(openEvent); + delete openEvent; + } + } + + } + OstTraceFunctionExit0( NOTESTODOEDITOR_INSERTDESCRIPTIONITEM_EXIT ); } @@ -618,7 +666,11 @@ disconnect( action, SIGNAL(triggered()), this, SLOT(saveTodo())); - + //if editor is open in background, and user close the app from task switcher + //entry should get saved + disconnect(qobject_cast(qApp), SIGNAL(aboutToQuit()), + this, SLOT(forcedExit())); + mOwner->editingCompleted(status); } OstTraceFunctionExit0( NOTESTODOEDITOR_SAVETODO_EXIT ); @@ -649,7 +701,7 @@ insertDescriptionItem(); // Update the text in the menu action. - mDescriptionAction->setText(hbTrId("txt_notes_opt_remove_description")); + mDescriptionAction->setText(hbTrId("txt_calendar_opt_remove_description")); disconnect( mDescriptionAction, SIGNAL(triggered()), @@ -675,7 +727,7 @@ mFormModel->removeItem(mFormModel->item(mDescriptionItemIndex)); // Update the text in the menu action. - mDescriptionAction->setText(hbTrId("txt_notes_opt_add_description")); + mDescriptionAction->setText(hbTrId("txt_calendar_opt_add_description")); disconnect( mDescriptionAction, SIGNAL(triggered()), @@ -751,4 +803,17 @@ OstTraceFunctionExit0( NOTESTODOEDITOR_SELECTEDACTION_EXIT ); } +/*! + Slot to handle entry when app exit from red key or task switcher. + */ +void NotesTodoEditor::forcedExit() +{ + OstTraceFunctionEntry0( NOTESTODOEDITOR_FORCEDEXIT_ENTRY ); + mForcedExit = true; + saveTodo(); + OstTraceFunctionExit0( NOTESTODOEDITOR_FORCEDEXIT_EXIT ); +} + + + // End of file --Don't remove this. diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/src/notestodoeditorcustomitem.cpp --- a/notes/notesui/noteseditor/src/notestodoeditorcustomitem.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/src/notestodoeditorcustomitem.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -209,7 +209,7 @@ mTimePickerDialog->setAttribute(Qt::WA_DeleteOnClose, true); // Set the heading for the dialog. - HbLabel * timeLabel = new HbLabel("Time", mTimePickerDialog); + HbLabel * timeLabel = new HbLabel(hbTrId("txt_calendar_title_alarm_time"), mTimePickerDialog); mTimePickerDialog->setHeadingWidget(timeLabel); // Create the tumbler. HbDateTimePicker *timePicker = new HbDateTimePicker(mTimePickerDialog); @@ -252,7 +252,7 @@ mDatePickerDialog->setAttribute(Qt::WA_DeleteOnClose, true); // Set the heading for the dialog. - HbLabel * timeLabel = new HbLabel("Date", mDatePickerDialog); + HbLabel * timeLabel = new HbLabel(hbTrId("txt_calendar_title_alarm_date"), mDatePickerDialog); mDatePickerDialog->setHeadingWidget(timeLabel); // Create the tumbler. @@ -322,7 +322,7 @@ mNotesTodoeditorPvt->dateFormatString())); // Set the heading text - HbLabel *label = new HbLabel(hbTrId("txt_notes_formlabel_due_date")); + HbLabel *label = new HbLabel(hbTrId("txt_calendar_title_due_date")); mDatePickerDialog->setHeadingWidget(label); // Set the tumbler as the content widget. diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/traces/fixed_id.definitions --- a/notes/notesui/noteseditor/traces/fixed_id.definitions Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/traces/fixed_id.definitions Fri Oct 15 12:10:36 2010 +0530 @@ -91,6 +91,8 @@ [TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_DELETENOTE_EXIT=0x53 [TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_EXECUTE_ENTRY=0x4b [TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_EXECUTE_EXIT=0x4c +[TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_FORCEDEXIT_ENTRY=0xb5 +[TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_FORCEDEXIT_EXIT=0xb6 [TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_GETDESCRIPTION_ENTRY=0x4d [TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_HANDLEADDTOCALENDARACTION_ENTRY=0x5e [TRACE]TRACE_FLOW[0x8A]_NOTESNOTEEDITOR_HANDLEADDTOCALENDARACTION_EXIT=0x5f @@ -143,6 +145,8 @@ [TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_CREATE_EXIT=0x7c [TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_EXECUTE_ENTRY=0x79 [TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_EXECUTE_EXIT=0x7a +[TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_FORCEDEXIT_ENTRY=0xb7 +[TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_FORCEDEXIT_EXIT=0xb8 [TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_HANDLEADDDESCRIPTIONACTION_ENTRY=0x91 [TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_HANDLEADDDESCRIPTIONACTION_EXIT=0x92 [TRACE]TRACE_FLOW[0x8A]_NOTESTODOEDITOR_HANDLEDELETEACTION_ENTRY=0x95 diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/traces/notesnoteeditorTraces.h --- a/notes/notesui/noteseditor/traces/notesnoteeditorTraces.h Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/traces/notesnoteeditorTraces.h Fri Oct 15 12:10:36 2010 +0530 @@ -39,6 +39,8 @@ #define NOTESNOTEEDITOR_HANDLENEWNOTEACTION_EXIT 0x8a0065 #define NOTESNOTEEDITOR_SELECTEDACTION_ENTRY 0x8a0066 #define NOTESNOTEEDITOR_SELECTEDACTION_EXIT 0x8a0067 +#define NOTESNOTEEDITOR_FORCEDEXIT_ENTRY 0x8a00b5 +#define NOTESNOTEEDITOR_FORCEDEXIT_EXIT 0x8a00b6 #endif diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/noteseditor/traces/notestodoeditorTraces.h --- a/notes/notesui/noteseditor/traces/notestodoeditorTraces.h Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/noteseditor/traces/notestodoeditorTraces.h Fri Oct 15 12:10:36 2010 +0530 @@ -57,6 +57,8 @@ #define NOTESTODOEDITOR_HANDLEDISCARDCHANGESACTION_EXIT 0x8a0098 #define NOTESTODOEDITOR_SELECTEDACTION_ENTRY 0x8a0099 #define NOTESTODOEDITOR_SELECTEDACTION_EXIT 0x8a009a +#define NOTESTODOEDITOR_FORCEDEXIT_ENTRY 0x8a00b7 +#define NOTESTODOEDITOR_FORCEDEXIT_EXIT 0x8a00b8 #endif diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/notesmodel/src/notesmodel.cpp --- a/notes/notesui/notesmodel/src/notesmodel.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/notesmodel/src/notesmodel.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -515,9 +515,12 @@ QString modifiedText; // Show the creation time if entry is not modified. - if (entry.dtStamp().isValid()) { - QDateTime creationDateTime = entry.dtStamp(); - + // Modified time will be equal to creation time if the entry is newly created + QDateTime creationDateTime = entry.dtStamp(); + QDateTime modifiedDateTime = entry.lastModifiedDateTime(); + + if (creationDateTime.isValid() && modifiedDateTime.isValid() && + modifiedDateTime == creationDateTime) { // If created on today,show only creation time otherwise show the // creation date. if ((QDate::currentDate()) == creationDateTime.date()) { @@ -532,8 +535,6 @@ creationDateTime.date().toString(dateFormatString()); } } else { - QDateTime modifiedDateTime = entry.lastModifiedDateTime(); - // If modified on today,show only modified time otherwise show the // modified date. if ((QDate::currentDate()) == modifiedDateTime.date() ) { @@ -777,9 +778,15 @@ QString modifiedText; // Show the creation time if entry is not modified. - if (entry.dtStamp().isValid()) { - QDateTime creationDateTime = entry.dtStamp(); - + // Modified time will be equal to creation time if the entry is newly created + QDateTime creationDateTime = entry.dtStamp(); + QDateTime modifiedDateTime = entry.lastModifiedDateTime(); + + if (creationDateTime.isValid() && modifiedDateTime.isValid() && + modifiedDateTime == creationDateTime + /* creationDateTime.time().hour() == modifiedDateTime.time().hour() && + creationDateTime.time().minute() == modifiedDateTime.time().minute() && + creationDateTime.time().second() == modifiedDateTime.time().second()*/) { // If created on today,show only creation time otherwise show the // creation date. if ((QDate::currentDate()) == creationDateTime.date()) { @@ -794,8 +801,6 @@ creationDateTime.date().toString(dateFormatString()); } } else { - QDateTime modifiedDateTime = entry.lastModifiedDateTime(); - // If modified on today,show only modified time otherwise show the // modified date. if ((QDate::currentDate()) == modifiedDateTime.date() ) { diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/notesviews/inc/notesmainview.h --- a/notes/notesui/notesviews/inc/notesmainview.h Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/notesviews/inc/notesmainview.h Fri Oct 15 12:10:36 2010 +0530 @@ -118,7 +118,7 @@ bool mIsLongTop; bool mIsScreenShotCapruted; // check if the screenshot captured is valid QVariantHash mScreenShot; // screenshot - AfActivityStorage *mActivityStorage;; + AfActivityStorage *mActivityStorage; }; #endif // NOTESMAINVIEW_H diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/notesviews/src/notesfavoriteview.cpp --- a/notes/notesui/notesviews/src/notesfavoriteview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/notesviews/src/notesfavoriteview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -341,6 +341,15 @@ entry.setFavourite(0); } mAgendaUtil->store(entry); + + // Show the soft notification. + HbNotificationDialog *notificationDialog = new HbNotificationDialog(); + notificationDialog->setTimeout( + HbNotificationDialog::ConfirmationNoteTimeout); + notificationDialog->setTitle( + hbTrId("txt_notes_dpopinfo_removed_from_favorites")); + notificationDialog->show(); + OstTraceFunctionExit0( NOTESFAVORITEVIEW_MARKNOTEASNOTFAVOURITE_EXIT ); } diff -r dcd0ca396fa1 -r 5aadd1120515 notes/notesui/notesviews/src/notesmainview.cpp --- a/notes/notesui/notesviews/src/notesmainview.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/notesui/notesviews/src/notesmainview.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -470,9 +470,10 @@ // Cleanup. mNotesEditor->deleteLater(); - // set captured screenshot as invalid as the control is returned back - // to the main view - captureScreenShot(false); + //save the activity + //if app closed from task switcher ot red key + captureScreenShot(true); + saveActivity(); OstTraceFunctionExit0( NOTESMAINVIEW_HANDLEEDITINGCOMPLETED_EXIT ); } diff -r dcd0ca396fa1 -r 5aadd1120515 notes/rom/notesresources.iby --- a/notes/rom/notesresources.iby Tue Oct 05 14:14:48 2010 +0530 +++ b/notes/rom/notesresources.iby Fri Oct 15 12:10:36 2010 +0530 @@ -24,6 +24,7 @@ S60_APP_RESOURCE(notes) data=DATAZ_/QT_TRANSLATIONS_DIR/notes.qm QT_TRANSLATIONS_DIR/notes.qm data=DATAZ_/QT_TRANSLATIONS_DIR/noteseditor.qm QT_TRANSLATIONS_DIR/noteseditor.qm +data=DATAZ_/QT_TRANSLATIONS_DIR/todoeditor.qm QT_TRANSLATIONS_DIR/todoeditor.qm #endif // __NOTESRESOURCES_IBY__ diff -r dcd0ca396fa1 -r 5aadd1120515 organizer_plat/calendar_editor_api/inc/caleneditor.h --- a/organizer_plat/calendar_editor_api/inc/caleneditor.h Tue Oct 05 14:14:48 2010 +0530 +++ b/organizer_plat/calendar_editor_api/inc/caleneditor.h Fri Oct 15 12:10:36 2010 +0530 @@ -70,6 +70,7 @@ void entrySaved(); void dialogClosed(); void calendarLaunchFailed(int error); + void forcedExit(); private: CalenEditorPrivate *d_ptr; diff -r dcd0ca396fa1 -r 5aadd1120515 pimappservices/calendar/server/src/agsextractor.cpp --- a/pimappservices/calendar/server/src/agsextractor.cpp Tue Oct 05 14:14:48 2010 +0530 +++ b/pimappservices/calendar/server/src/agsextractor.cpp Fri Oct 15 12:10:36 2010 +0530 @@ -103,8 +103,6 @@ TTime searchRangeStartLocal(aSearchParams.iRangeStart.LocalL()); TTime searchRangeEndLocal(aSearchParams.iRangeEnd.LocalL()); - TTime startTime(searchRangeStartLocal); - #ifdef SYMBIAN_SKIPPED_CALENDAR_ALARMS TBool alarmInstanceSearch(EFalse); alarmInstanceSearch = aSearchParams.iFilter.IsAlarmedInstanceSearch(); @@ -172,7 +170,9 @@ } } -#else +#else + TTime startTime(searchRangeStartLocal); + for (iIterator->GotoL(startTime); !iIterator->AtEnd() && ( (iIterator->CurrentElement().ValidFromTimeLocalL() == Time::NullTTime()) || iIterator->CurrentElement().ValidFromTimeLocalL() <= searchRangeEndLocal) ; iIterator->NextL()) { const CAgnSimpleEntry& KSimpleEntry(iIterator->CurrentElement());