calendarui/views/src/calenagendaviewwidget.cpp
changeset 50 579cc610882e
child 51 0b38fc5b94c6
child 58 ef813d54df51
equal deleted inserted replaced
49:5de72ea7a065 50:579cc610882e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: CalenAgendaViewWidget implementation
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <QStandardItemModel>
       
    20 #include <QGraphicsSceneEvent>
       
    21 #include <QDir>
       
    22 #include <QPluginLoader>
       
    23 #include <hbi18ndef.h>
       
    24 #include <hbextendedlocale.h>
       
    25 #include <hbgroupbox.h>
       
    26 #include <hbmenu.h>
       
    27 #include <hbaction.h>
       
    28 #include <hbmainwindow.h>
       
    29 #include <hbstyleloader.h>
       
    30 #include <hbdatetimepicker.h>
       
    31 #include <hbdialog.h>
       
    32 #include <xqsettingsmanager.h>
       
    33 #include <agendautil.h>
       
    34 #include <NotesEditorInterface>
       
    35 
       
    36 // User includes
       
    37 #include "calenagendaviewwidget.h"
       
    38 #include "calencommon.h"
       
    39 #include "calenagendaview.h"
       
    40 #include "calendocloader.h"
       
    41 #include "calenservices.h"
       
    42 #include "calencontext.h"
       
    43 #include "calendateutils.h"
       
    44 #include "CalenUid.h"
       
    45 #include "caleneventlistviewitem.h"
       
    46 #include "calenpluginlabel.h"
       
    47 #include "calendarprivatecrkeys.h"
       
    48 
       
    49 // Constants
       
    50 const QString singleSpace(" ");
       
    51 const QString doubleSpace("  ");
       
    52 const QString space("              ");
       
    53 const QString singleHyphen("-");
       
    54 const QString customLayout("custom");
       
    55 const char *stretchLayout("stretchItem");
       
    56 const QString toDoIcon("qtg_small_todo");
       
    57 const QString reminderIcon("qtg_mono_alarm");
       
    58 const QString locationIcon("qtg_mono_location");
       
    59 const QString repeatIcon("qtg_mono_repeat");
       
    60 // TODO: Replace with actual image name once its available
       
    61 //const QString allDayIcon("qtg_small_allday");
       
    62 const QString allDayIcon(":/qgn_indi_cdr_meeting_layer0.svg"); 
       
    63 const QString exceptionIcon("qtg_mono_repeat_exception");
       
    64 const int singleColumn(1);
       
    65 
       
    66 // ----------------------------------------------------------------------------
       
    67 // CalenAgendaViewWidget::CalenAgendaViewWidget
       
    68 // Rest of the details are commented in the header
       
    69 // ----------------------------------------------------------------------------
       
    70 //
       
    71 EXPORT_C CalenAgendaViewWidget::CalenAgendaViewWidget(MCalenServices &services,
       
    72                                        CalenDocLoader *docLoader) :
       
    73 mServices(services),
       
    74 mDocLoader(docLoader),
       
    75 mRegionalInfoGroupBox(NULL),
       
    76 mLongTapEventFlag(false),
       
    77 mNotesPluginLoaded(false)
       
    78 {
       
    79     // Construct the list view prototype
       
    80     mListViewPrototype = new CalenEventListViewItem(this);
       
    81     
       
    82     // Create the list model
       
    83     mListModel = new QStandardItemModel(this);
       
    84     
       
    85     // Register the custom docml and css to provide our own style to the list items
       
    86     HbStyleLoader::registerFilePath(":/");
       
    87     
       
    88     //Create the setting manager
       
    89     mSettingsManager = new XQSettingsManager(this);
       
    90 }
       
    91 
       
    92 // ----------------------------------------------------------------------------
       
    93 // CalenAgendaViewWidget::~CalenAgendaViewWidget
       
    94 // Rest of the details are commented in the header
       
    95 // ----------------------------------------------------------------------------
       
    96 //    
       
    97 EXPORT_C CalenAgendaViewWidget::~CalenAgendaViewWidget()
       
    98 {
       
    99 	// Unload notes editor if loaded.
       
   100 	if (mNotesEditorPluginLoader) {
       
   101 		mNotesEditorPluginLoader->unload();
       
   102 		delete mNotesEditorPluginLoader;
       
   103 		mNotesEditorPluginLoader = 0;
       
   104 	}
       
   105 
       
   106     if (mListViewPrototype) {
       
   107         delete mListViewPrototype;
       
   108         mListViewPrototype = NULL;
       
   109     }
       
   110     if (mListModel) {
       
   111         // Do not delete the model since its owned by the view
       
   112         mListModel->clear();
       
   113     }
       
   114     if (mSettingsManager) {
       
   115     	delete mSettingsManager;
       
   116     	mSettingsManager = NULL;
       
   117     }
       
   118 }
       
   119 
       
   120 // ----------------------------------------------------------------------------
       
   121 // CalenAgendaViewWidget::setupWidget
       
   122 // Rest of the details are commented in the header
       
   123 // ----------------------------------------------------------------------------
       
   124 //    
       
   125 void CalenAgendaViewWidget::setupWidget(CalenAgendaView *view)
       
   126 {
       
   127     // Store the view for future reference
       
   128 	mView = view;
       
   129 	
       
   130 	if (!mDocLoader) {
       
   131 	    // Nothing much can be done. Simply return
       
   132 	    return;
       
   133 	}
       
   134 
       
   135 	// Initialize the child widgets
       
   136 	initChildWidgets();
       
   137 }
       
   138 
       
   139 // ----------------------------------------------------------------------------
       
   140 // CalenAgendaViewWidget::showWidget
       
   141 // Rest of the details are commented in the header
       
   142 // ----------------------------------------------------------------------------
       
   143 //
       
   144 void CalenAgendaViewWidget::showWidget()
       
   145 {
       
   146     // Get the date for which this view has been launched
       
   147     mDate = mServices.Context().focusDateAndTime();
       
   148         
       
   149     // Set the heading text
       
   150     setHeadingText();
       
   151 
       
   152     // Get the instance list
       
   153     getInstanceList();
       
   154     
       
   155     // Check if regional information needs to be shown
       
   156     // and add it or remove it
       
   157     showHideRegionalInformation();
       
   158 
       
   159     // Load the appropriate section based on the number of events for the day
       
   160     if (0 == mInstanceArray.count()) {
       
   161         // There are no entries for the day
       
   162         // Load and show the empty list section
       
   163         bool loadSuccess = false;
       
   164 
       
   165         // Hide the list which shows the events
       
   166         mEventsList->hide();
       
   167 
       
   168         // Show the empty list text
       
   169         mEmptyListLabel->show();
       
   170 
       
   171         // Get the current device orientation
       
   172         int orientation = mServices.MainWindow().orientation();
       
   173         if (Qt::Vertical == orientation) {
       
   174             mDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, "emptyList", &loadSuccess);
       
   175         } else {
       
   176             mDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, "emptyLandscape", &loadSuccess);
       
   177         }
       
   178         if (!loadSuccess) {
       
   179             qFatal("calenagendaviewwidget.cpp : Unable to load empty list section");
       
   180         }
       
   181     } else {
       
   182         // Hide the empty view label
       
   183         mEmptyListLabel->hide();
       
   184 
       
   185         // Show the events list
       
   186         mEventsList->show();
       
   187 
       
   188         // There are one or more events. Load the non-empty section
       
   189         bool loadSuccess = false;
       
   190         mDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, "nonEmptyList", &loadSuccess);
       
   191         if (!loadSuccess) {
       
   192             qFatal("calenagendaviewwidget.cpp : Unable to load non-empty list section");
       
   193         }
       
   194         // Now populate the list with the events
       
   195         populateListWidget();
       
   196     }
       
   197 }
       
   198 
       
   199 // ----------------------------------------------------------------------------
       
   200 // CalenAgendaViewWidget::orientationChanged
       
   201 // Rest of the details are commented in the header
       
   202 // ----------------------------------------------------------------------------
       
   203 //
       
   204 void CalenAgendaViewWidget::orientationChanged(Qt::Orientation orientation)
       
   205 {
       
   206     // Load the appropriate section based on the number of events for the day
       
   207     if (0 == mInstanceArray.count()) {
       
   208         // There are no entries for the day
       
   209         // Load and show the empty list section
       
   210         bool loadSuccess = false;
       
   211 
       
   212         // Hide the list which shows the events
       
   213         mEventsList->hide();
       
   214 
       
   215         // Show the empty list text
       
   216         mEmptyListLabel->show();
       
   217 
       
   218         if (Qt::Vertical == orientation) {
       
   219             mDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, "emptyList", &loadSuccess);
       
   220         } else {
       
   221             mDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, "emptyLandscape", &loadSuccess);
       
   222         }
       
   223         if (!loadSuccess) {
       
   224             qFatal("calenagendaviewwidget.cpp : Unable to load empty list section");
       
   225         }
       
   226     } else {
       
   227         // Hide the empty view label
       
   228         mEmptyListLabel->hide();
       
   229 
       
   230         // Show the events list
       
   231         mEventsList->show();
       
   232 
       
   233         // There are one or more events. Load the non-empty section
       
   234         bool loadSuccess = false;
       
   235         mDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, "nonEmptyList", &loadSuccess);
       
   236         if (!loadSuccess) {
       
   237             qFatal("calenagendaviewwidget.cpp : Unable to load non-empty list section");
       
   238         }
       
   239         handleListItemStretching(orientation);
       
   240     }
       
   241 }
       
   242 
       
   243 // ----------------------------------------------------------------------------
       
   244 // CalenAgendaViewWidget::handleLocaleChange
       
   245 // Rest of the details are commented in the header
       
   246 // ----------------------------------------------------------------------------
       
   247 //
       
   248 void CalenAgendaViewWidget::handleLocaleChange()
       
   249 {
       
   250 
       
   251 }
       
   252 
       
   253 // ----------------------------------------------------------------------------
       
   254 // CalenAgendaViewWidget::setContextFromHighlight
       
   255 // Rest of the details are commented in the header
       
   256 // ----------------------------------------------------------------------------
       
   257 //    
       
   258 void CalenAgendaViewWidget::setContextFromHighlight(AgendaEntry entry)
       
   259 {
       
   260     if (entry.isTimedEntry()) {
       
   261         // Timed entry.
       
   262         QDateTime start = entry.startTime();
       
   263         // start.setDate(mDate.date());
       
   264         mServices.Context().setFocusDateAndTimeAndInstance(start,
       
   265                                                             TCalenInstanceId::create(entry));
       
   266     } else {
       
   267         // Untimed entry.
       
   268         if (CalenDateUtils::onSameDay(TCalenInstanceId::create(entry).mInstanceTime,
       
   269                                       mDate)) {
       
   270             mServices.Context().setInstanceId(TCalenInstanceId::create(entry));
       
   271         } else {
       
   272             // Multi-day untimed note (either multi-day day note or weird todo).
       
   273             // Focus on the instance and set the focus time to the highlighted day.
       
   274             mServices.Context().setFocusDateAndTimeAndInstance(mDate,
       
   275                                                                 TCalenInstanceId::create(entry));
       
   276         }
       
   277     }
       
   278 }
       
   279 
       
   280 // ----------------------------------------------------------------------------
       
   281 // CalenAgendaViewWidget::initChildWidgets
       
   282 // Rest of the details are commented in the header
       
   283 // ----------------------------------------------------------------------------
       
   284 //
       
   285 void CalenAgendaViewWidget::initChildWidgets()
       
   286 {
       
   287     // Get the pointer to the events list
       
   288     mEventsList = static_cast<HbListView*> (mDocLoader->findWidget(CALEN_AGENDAVIEW_LISTWIDGET));
       
   289     if (!mEventsList) {
       
   290         qFatal("calenagendaviewwidget.cpp : Unable to find the events list");
       
   291     }
       
   292     // NOTE: Layout name MUST be same as the name mentioned in the css
       
   293     mEventsList->setLayoutName(customLayout);
       
   294     
       
   295     // TODO : remove this line after gestures are available
       
   296     mEventsList->installEventFilter(mView);
       
   297 
       
   298     // Connect to the long press and activation signals
       
   299     connect(mEventsList, SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
       
   300             this, SLOT(itemLongPressed(HbAbstractViewItem*, const QPointF&)));
       
   301     connect(mEventsList, SIGNAL(activated(const QModelIndex&)), this,
       
   302             SLOT(itemActivated(const QModelIndex&)));
       
   303     
       
   304     // Get the pointer to label from the loader.
       
   305     mHeadingLabel = qobject_cast<HbGroupBox*> (mDocLoader->findWidget(CALEN_AGENDAVIEW_HEADING));
       
   306     if (!mHeadingLabel) {
       
   307         qFatal("calenagendaviewwidget.cpp : Unable to find heading widget");
       
   308     }
       
   309     
       
   310     // Get the pointer to the empty view label
       
   311     mEmptyListLabel = qobject_cast<HbLabel*> (mDocLoader->findWidget("noEventsLabel"));
       
   312     if (!mEmptyListLabel) {
       
   313         qFatal("calenagendaviewwidget.cpp : Unable to find empty list label");
       
   314     }
       
   315     HbWidget *headingPluginWidget = 
       
   316     		qobject_cast<HbWidget*> (mDocLoader->findWidget(CALEN_AGENDAVIEW_HEADING_REGIONALPLUGIN_WIDGET));
       
   317     
       
   318     mRegionalPluginLayout = static_cast<QGraphicsLinearLayout*>(headingPluginWidget->layout());
       
   319     
       
   320 }
       
   321 
       
   322 // ----------------------------------------------------------------------------
       
   323 // CalenAgendaViewWidget::populateListWidget
       
   324 // Rest of the details are commented in the header
       
   325 // ----------------------------------------------------------------------------
       
   326 //    
       
   327 void CalenAgendaViewWidget::populateListWidget()
       
   328 {
       
   329     // Recycle the list items so that only needed rows
       
   330     // are added or removed
       
   331     if (mInstanceArray.count() == 0) {
       
   332         // Reset the list
       
   333         mEventsList->reset();
       
   334         // Clear the model to ensure it does not have any old items
       
   335         mListModel->clear();
       
   336         return;
       
   337     } else if (mInstanceArray.count() > mListModel->rowCount()) {
       
   338         // There are more events than the number of items
       
   339         // in the list. Add more rows
       
   340         mListModel->insertRows(0, mInstanceArray.count() - mListModel->rowCount());
       
   341     } else if (mInstanceArray.count() < mListModel->rowCount()) {
       
   342         // There are less number of events than the number
       
   343         // of items in the list. Remove the extra rows
       
   344         mListModel->removeRows(0, mListModel->rowCount() - mInstanceArray.count());
       
   345     }
       
   346     mListModel->setColumnCount(singleColumn);
       
   347     
       
   348     // Add all the events to the list
       
   349     for (int index = 0; index < mInstanceArray.count(); index++) {
       
   350         // Get each of the entry details
       
   351         AgendaEntry entry = mInstanceArray[index];
       
   352         // Create a list item for each entry
       
   353         createListItem(index, entry);
       
   354     }
       
   355     // Add the item on to the list widget
       
   356     mEventsList->setModel(mListModel, mListViewPrototype);
       
   357     
       
   358     // Now get the item to scroll to
       
   359     int scrollToIndex = getIndexToScrollTo();
       
   360     if (mListModel->rowCount() > 0) {
       
   361         // Scroll to the index only if index is valid
       
   362         mEventsList->scrollTo(mListModel->index(scrollToIndex, 0));
       
   363     }
       
   364 }
       
   365 
       
   366 // ----------------------------------------------------------------------------
       
   367 // CalenAgendaViewWidget::getInstanceList
       
   368 // Rest of the details are commented in the header
       
   369 // ----------------------------------------------------------------------------
       
   370 //    
       
   371 void CalenAgendaViewWidget::getInstanceList()
       
   372 {
       
   373     // Clear the previous instance list
       
   374     mInstanceArray.clear();
       
   375     
       
   376     // Check if the date is valid
       
   377     if (!CalenDateUtils::isValidDay(mDate)) {
       
   378         mDate = CalenDateUtils::today();
       
   379     }
       
   380     
       
   381     // Set the filter flags to fetch all relevant entries
       
   382     AgendaUtil::FilterFlags filter = AgendaUtil::FilterFlags(AgendaUtil::IncludeAnniversaries |
       
   383                                                              AgendaUtil::IncludeAppointments | 
       
   384                                                              AgendaUtil::IncludeEvents |
       
   385                                                              AgendaUtil::IncludeReminders |
       
   386                                                              AgendaUtil::IncludeIncompletedTodos);
       
   387     
       
   388     // Fetch the instance list from the agenda interface
       
   389     mInstanceArray = mServices.agendaInterface()->createEntryIdListForDay(mDate, filter);
       
   390     
       
   391 }
       
   392 
       
   393 // ----------------------------------------------------------------------------
       
   394 // CalenAgendaViewWidget::setDateToLabel
       
   395 // Rest of the details are commented in the header
       
   396 // ----------------------------------------------------------------------------
       
   397 //
       
   398 void CalenAgendaViewWidget::setHeadingText()
       
   399     {
       
   400     // Format the date as per the device locale settings
       
   401 	HbExtendedLocale systemLocale = HbExtendedLocale::system();
       
   402 	
       
   403 	// Get localised name of the day from locale
       
   404 	QString dayString = systemLocale.dayName(mDate.date().dayOfWeek());
       
   405 	// Append a single space
       
   406 	dayString.append(singleSpace);
       
   407 	// Set the heading
       
   408 	// Append the date which is formatted as per the locale
       
   409 	mHeadingLabel->setHeading(hbTrId(
       
   410 				"txt_calendar_subhead_1_2").arg(dayString).arg(
       
   411 				systemLocale.format(mDate.date(), r_qtn_date_usual_with_zero)));
       
   412 }
       
   413 
       
   414 // ----------------------------------------------------------------------------
       
   415 // CalenAgendaViewWidget::createListItem
       
   416 // Rest of the details are commented in the header
       
   417 // ----------------------------------------------------------------------------
       
   418 //
       
   419 void CalenAgendaViewWidget::createListItem(int index, AgendaEntry entry)
       
   420 {
       
   421     if (index < 0 || entry.isNull()) {
       
   422         // Not a valid index or entry. Dont do anything
       
   423         return;
       
   424     }
       
   425     // Check if the entry is a timed entry
       
   426     // TODO: Right now, only appointment/meeting type is being handled
       
   427     // Handle other timed entry types like reminder etc
       
   428     if (entry.isTimedEntry()) {
       
   429         // Get the text and icon data for the entry
       
   430         addTimedEventToList(index, entry);
       
   431     } else {
       
   432         addNonTimedEventToList(index, entry);
       
   433     }
       
   434 }
       
   435 
       
   436 // ----------------------------------------------------------------------------
       
   437 // CalenAgendaViewWidget::addTimedEventToList
       
   438 // Rest of the details are commented in the header
       
   439 // ----------------------------------------------------------------------------
       
   440 //
       
   441 void CalenAgendaViewWidget::addTimedEventToList(int index, AgendaEntry entry)
       
   442 {
       
   443     // Create text and icon list to set to the model
       
   444     QVariantList textData;
       
   445     QVariantList iconData;
       
   446     bool twoLines = false;
       
   447     
       
   448     /**
       
   449      * IMPORTANT NOTE: All the text and icon items must be
       
   450      * inserted into the variant list in a specific order.
       
   451      * If not, chaos will set it!!!
       
   452      * On a more serious note, the mesh layout depends on the
       
   453      * fact that the icons and text data will be added in a
       
   454      * particular order. If one of the items go missing, the
       
   455      * layout might get messed up. Also in case a particular item
       
   456      * is not required to be added in the middle of the list, an
       
   457      * empty QVariant must be added to indicate to the list view
       
   458      * that the item must be removed from the layout.
       
   459      * Do not mess with the order in case you are not sure what
       
   460      * you are exactly doing.
       
   461      */
       
   462     
       
   463     // The first icon to show to-do or all day should not be shown
       
   464     // Append empty data to the icons list
       
   465     iconData << QVariant();
       
   466 
       
   467     // Check if alarm is enabled for the entry       
       
   468     if (entry.alarm().isNull()) {
       
   469         // Insert a blank icon. Else the next icon
       
   470         // will get replaced in this icon's position
       
   471         iconData << QVariant();
       
   472     } else {
       
   473         iconData << HbIcon(reminderIcon);
       
   474     }
       
   475 
       
   476     // Check if the entry is recurring
       
   477     if (entry.isRepeating()) {
       
   478         iconData << HbIcon(repeatIcon);
       
   479     } else if (!entry.recurrenceId().isNull()) {
       
   480         // This is an exceptional entry
       
   481         iconData << HbIcon(exceptionIcon);
       
   482     } else {
       
   483         // Insert a blank icon. Else the next icon
       
   484         // will get replaced in this icon's position
       
   485         iconData << QVariant();
       
   486     }
       
   487 
       
   488     HbExtendedLocale locale = HbExtendedLocale::system();
       
   489 	// Get the start time and format as per the locale
       
   490 	QDateTime startTime = entry.startTime();
       
   491 	QTime eventStartTime;
       
   492 
       
   493 	if (CalenDateUtils::beginningOfDay(startTime)
       
   494 	        < CalenDateUtils::beginningOfDay(mDate)) {
       
   495 		// event is started previous day, show StarTime as 12:00 am in Agendaview, 
       
   496 		eventStartTime.setHMS(00, 00, 00);
       
   497 	} else {
       
   498 		eventStartTime = entry.startTime().time();
       
   499 	}
       
   500     QString eventTime = locale.format(eventStartTime, r_qtn_time_usual_with_zero);
       
   501 
       
   502 	// Get the event end time
       
   503 	QDateTime endTime = entry.endTime();
       
   504 	QTime eventEndTime;
       
   505 
       
   506 	if (CalenDateUtils::beginningOfDay(endTime)
       
   507 	        > CalenDateUtils::beginningOfDay(mDate)) {
       
   508 		// event has MidNight crossover, show EndTime as 11:59pm in Agendaview, 
       
   509 		eventEndTime.setHMS(23, 59, 59);
       
   510 	} else {
       
   511 		eventEndTime = entry.endTime().time();
       
   512 	}
       
   513 
       
   514     if (eventStartTime < eventEndTime) {
       
   515         // Raise the flag to indicate that the list item
       
   516         // would wrap to two lines
       
   517         twoLines = true;
       
   518         // Append '-' to indicate an end time is present
       
   519         eventTime.append(singleHyphen);
       
   520     } else {
       
   521     	// To align the subject properly if the start and endtime are same
       
   522     	eventTime.append(doubleSpace);
       
   523     }
       
   524     
       
   525     // Add the event time to the text list
       
   526     // This MUST be the first item to be added to the list 
       
   527     textData << eventTime;
       
   528 
       
   529     // Get the entry subject
       
   530     QString subject = entry.summary();
       
   531     if (subject.isEmpty() || subject.isNull()) {
       
   532         // No subject. Add "(No subject)" text
       
   533         subject.append(hbTrId("txt_calendar_dblist_unnamed"));
       
   534     }
       
   535     // Add the subject to the text list
       
   536     // This MUST be the second item in the list
       
   537     textData << subject;
       
   538 
       
   539     // Check if the entry has location
       
   540     // TODO: This must change to check for geo-location
       
   541     // This MUST be the third item in the list
       
   542     if (entry.location().isEmpty()) {
       
   543         // Insert a blank icon. Else the next icon
       
   544         // will get replaced in this icon's position
       
   545         iconData << QVariant();
       
   546         if (twoLines) {
       
   547             /**
       
   548              * NOTE: If the primary text is wrapping to two
       
   549              * lines, then the location must be set as blank
       
   550              * since the bottom of the list item is anchored to
       
   551              * the bottom of the secondary text. Else the bottom
       
   552              * of the list will overlap on the primary text
       
   553              */
       
   554             textData << singleSpace;
       
   555         } else {
       
   556             /**
       
   557              * Else, set the secondary text to empty to indicate
       
   558              * to the list view to remove the item itself and 
       
   559              * shrink its size to a single line size
       
   560              */
       
   561             textData << QVariant();
       
   562         }
       
   563     } else {
       
   564         // TODO: Location icon must be shown
       
   565         // only if valid geo-coordinates are present
       
   566         if (!entry.geoValue().isNull()){    
       
   567             iconData << HbIcon(locationIcon);
       
   568         }
       
   569         else {
       
   570             iconData << HbIcon();
       
   571         }
       
   572         textData << entry.location();
       
   573     }
       
   574     // Add the end time to the list item	
       
   575     if (eventStartTime < eventEndTime) {
       
   576     	QString endtime = locale.format(eventEndTime, r_qtn_time_usual_with_zero);
       
   577     	endtime.append(singleSpace);
       
   578     	textData << endtime;
       
   579     }else {
       
   580     	textData<<QString(space);
       
   581     }
       
   582     // Get the list model index and set the text and icon data
       
   583     QModelIndex listIndex = mListModel->index(index, 0);
       
   584     mListModel->setData(listIndex, textData, Qt::DisplayRole);
       
   585     mListModel->setData(listIndex, iconData, Qt::DecorationRole);
       
   586     
       
   587     // Disable item stretching by removing the dynamic property
       
   588     HbListViewItem *listViewItem = static_cast<HbListViewItem*>
       
   589                                         (mEventsList->itemByIndex(mListModel->index(index, 0)));
       
   590     if (listViewItem) {
       
   591         listViewItem->setProperty(stretchLayout, false);
       
   592     }
       
   593 }
       
   594 
       
   595 // ----------------------------------------------------------------------------
       
   596 // CalenAgendaViewWidget::addNonTimedEventToList
       
   597 // Rest of the details are commented in the header
       
   598 // ----------------------------------------------------------------------------
       
   599 //
       
   600 void CalenAgendaViewWidget::addNonTimedEventToList(int index, AgendaEntry entry)
       
   601 {
       
   602     QVariantList textData;
       
   603     QVariantList iconData;
       
   604     
       
   605     /**
       
   606      * IMPORTANT NOTE: All the text and icon items must be
       
   607      * inserted into the variant list in a specific order.
       
   608      * If not, chaos will set it!!!
       
   609      * On a more serious note, the mesh layout depends on the
       
   610      * fact that the icons and text data will be added in a
       
   611      * particular order. If one of the items go missing, the
       
   612      * layout might get messed up. Also in case a particular item
       
   613      * is not required to be added in the middle of the list, an
       
   614      * empty QVariant must be added to indicate to the list view
       
   615      * that the item must be removed from the layout.
       
   616      * Do not mess with the order in case you are not sure what
       
   617      * you are exactly doing.
       
   618      */
       
   619     
       
   620     // The first column text has to be empty
       
   621     textData << QVariant();
       
   622     
       
   623     // Get the entry subject
       
   624     QString subject = entry.summary();
       
   625     if (subject.isEmpty() || subject.isNull()) {
       
   626         // No subject. Add "(No subject)" text
       
   627         subject.append(hbTrId("txt_calendar_dblist_unnamed"));
       
   628     }
       
   629     // Add the subject to the text list
       
   630     // This MUST be the second item in the list
       
   631     textData << subject;
       
   632     
       
   633     // Get the entry type
       
   634     AgendaEntry::Type entryType = entry.type();
       
   635         
       
   636     if (entryType == AgendaEntry::TypeAnniversary) {
       
   637         // Nothing to do as of now as anniversary events
       
   638         // cannot be created
       
   639         // TODO: To be handled in case of sync
       
   640     } else if (entryType == AgendaEntry::TypeEvent) {
       
   641         // This is an all day event
       
   642         // Append the all-day icon
       
   643         iconData << HbIcon(allDayIcon);
       
   644         
       
   645         // Check if alarm is enabled for the entry
       
   646         if (entry.alarm().isNull()) {
       
   647             // Insert a blank icon. Else next text item will get shifted to left
       
   648             iconData << HbIcon();
       
   649         } else {
       
   650         	// if entry is not repeating in place of reminder icon put a blank 
       
   651         	// icon and move reminder icon to the place of repeating icon 
       
   652         	 if (!entry.isRepeating()) {
       
   653         		 iconData << HbIcon();
       
   654         	 }
       
   655             iconData << HbIcon(reminderIcon);
       
   656         }
       
   657 
       
   658         // Check if the entry is recurring
       
   659         if (entry.isRepeating()) {
       
   660             iconData << HbIcon(repeatIcon);
       
   661         } else {
       
   662         	// put the blank icon only when both reminder and repeating icons 
       
   663         	// are not there
       
   664         	if (entry.alarm().isNull()) {
       
   665         	iconData << HbIcon();
       
   666         	}
       
   667         }
       
   668         
       
   669         // Append the location
       
   670         if (!entry.location().isEmpty()) {
       
   671             textData << entry.location();
       
   672             // TODO: Location icon must be shown
       
   673             // only if valid geo-coordinates are present
       
   674             if (!entry.geoValue().isNull()){ 
       
   675                 iconData << HbIcon(locationIcon);
       
   676             }else {
       
   677                 iconData << HbIcon();
       
   678             }
       
   679         } else {
       
   680             textData << QVariant();
       
   681         }
       
   682         // The fourth text item has to be empty
       
   683         textData << QVariant();
       
   684         
       
   685     } else if (entryType == AgendaEntry::TypeTodo) {
       
   686         // Append the to-do icon
       
   687         iconData << HbIcon(toDoIcon);
       
   688         
       
   689         // Get the due date
       
   690         QDateTime dueDate = entry.endTime();
       
   691         
       
   692         // Append the date first
       
   693         QString dueDateString(hbTrId("txt_calendar_dblist_val_due_on_1"));
       
   694         QString dueText;
       
   695         dueText.setNum(dueDate.date().day());
       
   696         dueText.append(singleSpace);
       
   697         
       
   698         // Append the month name next
       
   699         HbExtendedLocale locale = HbExtendedLocale::system();
       
   700         QString month = locale.monthName(dueDate.date().month());
       
   701         dueText.append(month);
       
   702         dueText.append(singleSpace);
       
   703         
       
   704         // Append the year
       
   705         QString year;
       
   706         year.setNum(dueDate.date().year());
       
   707         dueText.append(year);
       
   708         
       
   709         textData << dueDateString.arg(dueText);
       
   710         
       
   711         // The fourth text item has to be empty
       
   712         textData << QVariant();
       
   713        
       
   714         // Check if alarm is enabled for the entry
       
   715         if (entry.alarm().isNull()) {
       
   716         	// Insert a blank icon. Else next text item will get shifted to left
       
   717         	iconData << HbIcon();
       
   718         } else {
       
   719         	// if entry is not repeating in place of reminder icon put a blank 
       
   720         	// icon and move reminder icon to the place of repeating icon 
       
   721         	if (!entry.isRepeating()) {
       
   722         		iconData << HbIcon();
       
   723         	}
       
   724         	iconData << HbIcon(reminderIcon);
       
   725         }
       
   726 
       
   727         // Check if the entry is recurring
       
   728         if (entry.isRepeating()) {
       
   729         	iconData << HbIcon(repeatIcon);
       
   730         } else {
       
   731         	// Insert the blank icon only when both reminder and repeating icons 
       
   732         	// are not there
       
   733         	if (entry.alarm().isNull()) {
       
   734         		iconData << HbIcon();
       
   735         	}
       
   736         }
       
   737     }
       
   738     
       
   739     // Get the list model index and set the text and icon data
       
   740     QModelIndex listIndex = mListModel->index(index, 0);
       
   741     mListModel->setData(listIndex, textData, Qt::DisplayRole);
       
   742     mListModel->setData(listIndex, iconData, Qt::DecorationRole);
       
   743     
       
   744     // Enable item stretching by adding the dynamic property
       
   745     HbListViewItem *listViewItem = static_cast<HbListViewItem*>
       
   746                                         (mEventsList->itemByIndex(mListModel->index(index, 0)));
       
   747     Qt::Orientation orientation = mServices.MainWindow().orientation();
       
   748     // Apply stretch only for landscape orientation
       
   749     if (listViewItem) {
       
   750         if (Qt::Horizontal == orientation) {
       
   751             listViewItem->setProperty(stretchLayout, true);
       
   752         } else {
       
   753             listViewItem->setProperty(stretchLayout, false);
       
   754         }
       
   755     }
       
   756 }
       
   757 
       
   758 // ----------------------------------------------------------------------------
       
   759 // CalenAgendaViewWidget::handleListItemStretching
       
   760 // Rest of the details are commented in the header
       
   761 // ----------------------------------------------------------------------------
       
   762 // 
       
   763 void CalenAgendaViewWidget::handleListItemStretching(Qt::Orientation orientation)
       
   764 {
       
   765     if (mInstanceArray.count() == 0) {
       
   766         // Nothing much to do. Simply return
       
   767         return;
       
   768     }
       
   769     for(int index = 0; index < mInstanceArray.count() ; index ++) {
       
   770         AgendaEntry entry = mInstanceArray[index];
       
   771         if (!entry.isNull()) {
       
   772             AgendaEntry::Type eventType = entry.type();
       
   773             switch(eventType) {
       
   774                 // Apply the stretching to only to-do's,
       
   775                 // anniversary and all-day event types
       
   776                 case AgendaEntry::TypeTodo:
       
   777                 case AgendaEntry::TypeEvent:
       
   778                 case AgendaEntry::TypeAnniversary:
       
   779                 {
       
   780                     // Get the list view item corresponding to the index
       
   781                     HbListViewItem *listItem = static_cast<HbListViewItem*>
       
   782                                                 (mEventsList->itemByIndex(mListModel->index(index, 0)));
       
   783                     if (listItem) {
       
   784                         if (orientation == Qt::Horizontal) {
       
   785                             // Set a dynamic property to indicate that this list item
       
   786                             // must be stretched in landscape.
       
   787                             // NOTE: Property name MUST match the name specified in
       
   788                             // css file, else wierd things might happen
       
   789                             listItem->setProperty(stretchLayout, true);
       
   790                         }
       
   791                     }
       
   792                 }
       
   793                     break;
       
   794                 default:
       
   795                 {
       
   796                     HbListViewItem *listItem = static_cast<HbListViewItem*>
       
   797                                                 (mEventsList->itemByIndex(mListModel->index(index, 0)));
       
   798                     if (listItem) {
       
   799                         listItem->setProperty(stretchLayout, false);
       
   800                     }
       
   801                     break;
       
   802                 }
       
   803             }
       
   804         }
       
   805     }
       
   806 }
       
   807 
       
   808 // ----------------------------------------------------------------------------
       
   809 // CalenAgendaViewWidget::getIndexToScrollTo
       
   810 // Rest of the details are commented in the header
       
   811 // ----------------------------------------------------------------------------
       
   812 //  
       
   813 int CalenAgendaViewWidget::getIndexToScrollTo()
       
   814 {
       
   815     int scrollIndex = 0;
       
   816     TCalenInstanceId instanceId = mServices.Context().instanceId();
       
   817     if (instanceId == TCalenInstanceId::nullInstanceId()) {
       
   818         // If the instance is not set, then scroll to zero index
       
   819         return scrollIndex;
       
   820     }
       
   821     
       
   822     for (int index = 0 ; index < mInstanceArray.count() ; index++) {
       
   823         AgendaEntry entry = mInstanceArray[index];
       
   824         if (entry.id() == instanceId.mEntryLocalUid) {
       
   825             // Match found.
       
   826             scrollIndex = index;
       
   827             break;
       
   828         }
       
   829     }
       
   830     return scrollIndex;
       
   831 }
       
   832 
       
   833 // ----------------------------------------------------------------------------
       
   834 // CalenAgendaViewWidget::showHideRegionalInformation
       
   835 // To Show and hide regional plugin label depends upon settings
       
   836 // ----------------------------------------------------------------------------
       
   837 //
       
   838 void CalenAgendaViewWidget::showHideRegionalInformation()
       
   839 {
       
   840 	if (mView->pluginEnabled()) {
       
   841 		XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository,
       
   842 		                           KCRUidCalendar, KCalendarShowRegionalInfo);
       
   843 
       
   844 		int showRegionalInfo = 
       
   845 						mSettingsManager->readItemValue(regionalInfo).toUInt();
       
   846 		if (showRegionalInfo) {
       
   847 
       
   848 			if (!mRegionalInfoGroupBox) {
       
   849 				mRegionalInfoGroupBox = new HbGroupBox();
       
   850 				CalenPluginLabel *regionalInfo = new CalenPluginLabel(
       
   851 						mServices, this);
       
   852 				regionalInfo->setFontSpec(HbFontSpec(HbFontSpec::Primary));
       
   853 				mRegionalInfoGroupBox->setContentWidget(regionalInfo);
       
   854 				mRegionalPluginLayout->insertItem(1, mRegionalInfoGroupBox);
       
   855 			}
       
   856 			QString *pluginString = mView->pluginText();
       
   857 			HbLabel *pluginInfoLabel = qobject_cast <HbLabel *> 
       
   858 									(mRegionalInfoGroupBox->contentWidget());
       
   859 			pluginInfoLabel->setPlainText(*pluginString);
       
   860 		}
       
   861     } else {
       
   862         if (mRegionalInfoGroupBox) {
       
   863         	mRegionalPluginLayout->removeItem(mRegionalInfoGroupBox);
       
   864             delete mRegionalInfoGroupBox;
       
   865             mRegionalInfoGroupBox = NULL;
       
   866         }
       
   867     }
       
   868 }
       
   869 
       
   870 // ----------------------------------------------------------------------------
       
   871 // CalenAgendaViewWidget::createNewEvent
       
   872 // Rest of the details are commented in the header
       
   873 // ----------------------------------------------------------------------------
       
   874 //    
       
   875 void CalenAgendaViewWidget::createNewEvent()
       
   876 {
       
   877     // Issue a command to launch editor to create
       
   878     // a new event
       
   879 	mServices.IssueCommandL(ECalenNewMeeting);
       
   880 }
       
   881 
       
   882 // ----------------------------------------------------------------------------
       
   883 // CalenAgendaViewWidget::editEntry
       
   884 // Rest of the details are commented in the header
       
   885 // ----------------------------------------------------------------------------
       
   886 //    
       
   887 void CalenAgendaViewWidget::editEntry()
       
   888 {
       
   889     // Check if the selected index is valid
       
   890     if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) {
       
   891         return;
       
   892     }
       
   893 
       
   894 	// Get the entry details first
       
   895 	AgendaEntry entry = mInstanceArray[mSelectedIndex];
       
   896 	if (AgendaEntry::TypeTodo == entry.type()) {
       
   897 		// Load the notes editor plugin if not loaded.
       
   898 		if (!mNotesPluginLoaded) {
       
   899 			// Launch the to-do editor using notes editor plugin api
       
   900 			QDir dir(NOTES_EDITOR_PLUGIN_PATH);
       
   901 			QString pluginName = dir.absoluteFilePath(NOTES_EDITOR_PLUGIN_NAME);
       
   902 
       
   903 			// Create NotesEditor plugin loader object.
       
   904 			mNotesEditorPluginLoader = new QPluginLoader(pluginName);
       
   905 
       
   906 			// Load the plugin
       
   907 			mNotesPluginLoaded = mNotesEditorPluginLoader->load();
       
   908 		}
       
   909 
       
   910 		QObject *plugin = qobject_cast<QObject*> (
       
   911 				mNotesEditorPluginLoader->instance());
       
   912 
       
   913 		NotesEditorInterface* interface =
       
   914 				qobject_cast<NotesEditorInterface*>(plugin);
       
   915 
       
   916 		interface->edit(entry, mServices.agendaInterface());
       
   917 
       
   918 		connect(
       
   919 				interface, SIGNAL(editingCompleted(bool)),
       
   920 				this, SLOT(noteEditingCompleted(bool)));
       
   921 	} else {
       
   922 		// Set the context
       
   923 		setContextFromHighlight(entry);
       
   924 		// Issue a command to launch the editor to edit this entry
       
   925 		mServices.IssueCommandL(ECalenEditCurrentEntry);
       
   926 	}
       
   927 }
       
   928 
       
   929 // ----------------------------------------------------------------------------
       
   930 // CalenAgendaViewWidget::viewEntry
       
   931 // Rest of the details are commented in the header
       
   932 // ----------------------------------------------------------------------------
       
   933 //    
       
   934 void CalenAgendaViewWidget::viewEntry()
       
   935 {
       
   936     // Get the entry details first
       
   937     AgendaEntry entry = mInstanceArray[mSelectedIndex];
       
   938     
       
   939     // Set the context
       
   940     setContextFromHighlight(entry);
       
   941         
       
   942     // Launch the event viewer.
       
   943     mServices.IssueCommandL(ECalenEventView);
       
   944 }
       
   945 
       
   946 
       
   947 // ----------------------------------------------------------------------------
       
   948 // CalenAgendaViewWidget::deleteEntry
       
   949 // Rest of the details are commented in the header
       
   950 // ----------------------------------------------------------------------------
       
   951 //    
       
   952 void CalenAgendaViewWidget::deleteEntry()
       
   953 {
       
   954     // Check if the selected index is valid
       
   955 	if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) {
       
   956 		return;
       
   957 	}
       
   958 	
       
   959 	// Get the entry details
       
   960 	AgendaEntry entry = mInstanceArray[mSelectedIndex];
       
   961 	// Set the context
       
   962 	setContextFromHighlight(entry);
       
   963 	// Issue the command to delete the entry
       
   964 	mServices.IssueCommandL(ECalenDeleteCurrentEntry);
       
   965 }
       
   966 
       
   967 // ----------------------------------------------------------------------------
       
   968 // CalenAgendaViewWidget::markAsDone
       
   969 // Rest of the details are commented in the header
       
   970 // ----------------------------------------------------------------------------
       
   971 //  
       
   972 void CalenAgendaViewWidget::markAsDone()
       
   973 {
       
   974     // Check if the selected index is valid
       
   975     if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) {
       
   976         return;
       
   977     }
       
   978     
       
   979     // Get the entry details
       
   980     AgendaEntry entry = mInstanceArray[mSelectedIndex];
       
   981     
       
   982     // Check again if the event is of type to-to
       
   983     if (AgendaEntry::TypeTodo == entry.type()) {
       
   984         // Set the status of the to-do as completed
       
   985         entry.setStatus(AgendaEntry::TodoCompleted);
       
   986         // Update the completed date and time
       
   987         entry.setCompletedDateTime(mDate);
       
   988         
       
   989         // Update the entry in the database
       
   990         mServices.agendaInterface()->setCompleted(entry, true, mDate);
       
   991 		mServices.IssueCommandL(ECalenStartActiveStep);
       
   992     }
       
   993 }
       
   994 
       
   995 // ----------------------------------------------------------------------------
       
   996 // CalenAgendaViewWidget::itemLongPressed
       
   997 // Rest of the details are commented in the header
       
   998 // ----------------------------------------------------------------------------
       
   999 //    
       
  1000 void CalenAgendaViewWidget::itemLongPressed(HbAbstractViewItem* listViewItem,
       
  1001                                          const QPointF& coords)
       
  1002 {
       
  1003 	mLongTapEventFlag = true;
       
  1004     // Update the selection index first
       
  1005     mSelectedIndex = listViewItem->modelIndex().row();
       
  1006     
       
  1007     if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) {
       
  1008         // Invalid index
       
  1009         return;
       
  1010     }
       
  1011 
       
  1012     AgendaEntry entry = mInstanceArray[mSelectedIndex];
       
  1013     
       
  1014     // Create new menu.
       
  1015     HbMenu *contextMenu = new HbMenu();
       
  1016     
       
  1017     // Add the open option
       
  1018     HbAction *openAction = contextMenu->addAction(
       
  1019 									hbTrId("txt_common_menu_open"));
       
  1020     
       
  1021     // Check the type of event
       
  1022     if (AgendaEntry::TypeTodo == entry.type()) {
       
  1023         // Add an option to mark the note as complete
       
  1024         HbAction *completeAction = contextMenu->addAction(
       
  1025 									hbTrId("txt_calendar_menu_mark_as_done"));
       
  1026     }
       
  1027     
       
  1028     // Add the edit option
       
  1029     HbAction *editAction = contextMenu->addAction(
       
  1030 									hbTrId("txt_common_menu_edit"));
       
  1031     
       
  1032     // Add the delete option
       
  1033     HbAction *deleteAction = contextMenu->addAction(
       
  1034 									hbTrId("txt_common_menu_delete"));
       
  1035     
       
  1036     contextMenu->setDismissPolicy(HbMenu::TapAnywhere);
       
  1037 
       
  1038     // Show context sensitive menu. 
       
  1039     // Param const QPointF& coordinate - is a longpress position.
       
  1040     contextMenu->setPreferredPos(coords);
       
  1041     connect(contextMenu, SIGNAL(aboutToClose()),
       
  1042 								this, 
       
  1043 								SLOT(contextMenuClosed()));
       
  1044     
       
  1045     contextMenu->open(this, SLOT(contextManuTriggered(HbAction *)));
       
  1046 }
       
  1047 
       
  1048 // ----------------------------------------------------------------------------
       
  1049 // CalenAgendaViewWidget::itemActivated
       
  1050 // Rest of the details are commented in the header
       
  1051 // ----------------------------------------------------------------------------
       
  1052 //    
       
  1053 void CalenAgendaViewWidget::itemActivated(const QModelIndex &index)
       
  1054 {
       
  1055     // Update the selection index first
       
  1056     mSelectedIndex = index.row();
       
  1057 
       
  1058     // Check if the selected index is valid
       
  1059     if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) {
       
  1060         return;
       
  1061     }
       
  1062     if( !mLongTapEventFlag ) {
       
  1063     // Open the event for viewing
       
  1064     viewEntry();
       
  1065     }
       
  1066 }
       
  1067 
       
  1068 // ----------------------------------------------------------------------------
       
  1069 // CalenAgendaViewWidget::itemActivated
       
  1070 // Rest of the details are commented in the header
       
  1071 // ----------------------------------------------------------------------------
       
  1072 // 
       
  1073 void CalenAgendaViewWidget::noteEditingCompleted(bool status)
       
  1074 {
       
  1075 	// We need to refresh the list since user
       
  1076 	// might have marked the to-do as complete or
       
  1077 	// edited it or deleted it. So get the instance
       
  1078 	// list again
       
  1079 	if (status) {
       
  1080 		mServices.IssueCommandL(ECalenStartActiveStep);
       
  1081 	}
       
  1082 }
       
  1083 
       
  1084 // ----------------------------------------------------------------------------
       
  1085 // CalenAgendaViewWidget::goToToday
       
  1086 // Rest of the details are commented in the header
       
  1087 // ----------------------------------------------------------------------------
       
  1088 // 
       
  1089 void CalenAgendaViewWidget::goToToday()
       
  1090 {
       
  1091     // First check if we are not already
       
  1092     // showing today's agenda
       
  1093     if (mDate == CalenDateUtils::today()) {
       
  1094         return;
       
  1095     }
       
  1096     
       
  1097     // Set the context for the current day
       
  1098     mServices.Context().setFocusDate(CalenDateUtils::today());
       
  1099     
       
  1100     mView->refreshViewOnGoToDate();
       
  1101 }
       
  1102 
       
  1103 // ----------------------------------------------------------------------------
       
  1104 // CalenAgendaViewWidget::contextMenuClosed
       
  1105 // Rest of the details are commented in the header
       
  1106 // ----------------------------------------------------------------------------
       
  1107 //
       
  1108 void CalenAgendaViewWidget::contextMenuClosed()
       
  1109 {
       
  1110 	mLongTapEventFlag = false;
       
  1111 }
       
  1112 
       
  1113 // ----------------------------------------------------------------------------
       
  1114 // CalenAgendaViewWidget::contextManuTriggered
       
  1115 // Rest of the details are commented in the header
       
  1116 // ----------------------------------------------------------------------------
       
  1117 //
       
  1118 void CalenAgendaViewWidget::contextManuTriggered(HbAction *action)
       
  1119 {
       
  1120 	if (action->text() == hbTrId("txt_common_menu_open")) {
       
  1121 		viewEntry();
       
  1122 	} else if (action->text() == hbTrId("txt_calendar_menu_mark_as_done")) {
       
  1123 		markAsDone();
       
  1124 	} else if (action->text() == hbTrId("txt_common_menu_edit")) {
       
  1125 		editEntry();
       
  1126 	} else {
       
  1127 		if (action->text() == hbTrId("txt_common_menu_delete")) {
       
  1128 			deleteEntry();
       
  1129 		}
       
  1130 	}
       
  1131 }
       
  1132 // ----------------------------------------------------------------------------
       
  1133 // CalenAgendaViewWidget::clearListModel
       
  1134 // clears the list model 
       
  1135 // ----------------------------------------------------------------------------
       
  1136 // 
       
  1137 void CalenAgendaViewWidget::clearListModel()
       
  1138     {
       
  1139     mListModel->clear();
       
  1140     }
       
  1141 
       
  1142 // End of file	--Don't remove this.