calendarui/views/src/calenagendaviewwidget.cpp
changeset 55 2c54b51f39c4
parent 51 0b38fc5b94c6
child 57 bb2d3e476f29
equal deleted inserted replaced
51:0b38fc5b94c6 55:2c54b51f39c4
    61 const QString toDoIcon("qtg_small_todo");
    61 const QString toDoIcon("qtg_small_todo");
    62 const QString reminderIcon("qtg_mono_alarm");
    62 const QString reminderIcon("qtg_mono_alarm");
    63 const QString locationIcon("qtg_mono_location");
    63 const QString locationIcon("qtg_mono_location");
    64 const QString repeatIcon("qtg_mono_repeat");
    64 const QString repeatIcon("qtg_mono_repeat");
    65 // TODO: Replace with actual image name once its available
    65 // TODO: Replace with actual image name once its available
    66 //const QString allDayIcon("qtg_small_allday");
    66 const QString allDayIcon("qtg_small_day");
    67 const QString allDayIcon(":/qgn_indi_cdr_meeting_layer0.svg"); 
       
    68 const QString exceptionIcon("qtg_mono_repeat_exception");
    67 const QString exceptionIcon("qtg_mono_repeat_exception");
    69 const int singleColumn(1);
    68 const int singleColumn(1);
    70 
    69 
    71 // ----------------------------------------------------------------------------
    70 // ----------------------------------------------------------------------------
    72 // CalenAgendaViewWidget::CalenAgendaViewWidget
    71 // CalenAgendaViewWidget::CalenAgendaViewWidget
    77                                        CalenDocLoader *docLoader) :
    76                                        CalenDocLoader *docLoader) :
    78 mServices(services),
    77 mServices(services),
    79 mDocLoader(docLoader),
    78 mDocLoader(docLoader),
    80 mRegionalInfoGroupBox(NULL),
    79 mRegionalInfoGroupBox(NULL),
    81 mLongTapEventFlag(false),
    80 mLongTapEventFlag(false),
    82 mNotesPluginLoaded(false)
    81 mNotesPluginLoaded(false),
       
    82 mIndex(0),
       
    83 mIconCheck(false)
    83 {
    84 {
    84     OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_CALENAGENDAVIEWWIDGET_ENTRY );
    85     OstTraceFunctionEntry0( CALENAGENDAVIEWWIDGET_CALENAGENDAVIEWWIDGET_ENTRY );
    85     
    86     
    86     // Construct the list view prototype
    87     // Construct the list view prototype
    87     mListViewPrototype = new CalenEventListViewItem(this);
    88     mListViewPrototype = new CalenEventListViewItem(this);
   370     } else if (mInstanceArray.count() < mListModel->rowCount()) {
   371     } else if (mInstanceArray.count() < mListModel->rowCount()) {
   371         // There are less number of events than the number
   372         // There are less number of events than the number
   372         // of items in the list. Remove the extra rows
   373         // of items in the list. Remove the extra rows
   373         mListModel->removeRows(0, mListModel->rowCount() - mInstanceArray.count());
   374         mListModel->removeRows(0, mListModel->rowCount() - mInstanceArray.count());
   374     }
   375     }
       
   376     mIndex = 0; 
       
   377     mIconCheck = false;
   375     mListModel->setColumnCount(singleColumn);
   378     mListModel->setColumnCount(singleColumn);
   376     
   379     mIconCheck = true;
   377     // Add all the events to the list
   380     // Add all the events to the list
   378     for (int index = 0; index < mInstanceArray.count(); index++) {
   381     for (int index = 0; index < mInstanceArray.count(); index++) {
   379         // Get each of the entry details
   382         // Get each of the entry details
   380         AgendaEntry entry = mInstanceArray[index];
   383         AgendaEntry entry = mInstanceArray[index];
   381         // Create a list item for each entry
   384         // Create a list item for each entry
   624     }else {
   627     }else {
   625     	textData<<QString(space);
   628     	textData<<QString(space);
   626     }
   629     }
   627     // Get the list model index and set the text and icon data
   630     // Get the list model index and set the text and icon data
   628     QModelIndex listIndex = mListModel->index(index, 0);
   631     QModelIndex listIndex = mListModel->index(index, 0);
       
   632     mNextEntry = false;
   629     mListModel->setData(listIndex, textData, Qt::DisplayRole);
   633     mListModel->setData(listIndex, textData, Qt::DisplayRole);
       
   634     mNextEntry = true;
   630     mListModel->setData(listIndex, iconData, Qt::DecorationRole);
   635     mListModel->setData(listIndex, iconData, Qt::DecorationRole);
   631     
   636     
   632     // Disable item stretching by removing the dynamic property
   637     // Disable item stretching by removing the dynamic property
   633     HbListViewItem *listViewItem = static_cast<HbListViewItem*>
   638     HbListViewItem *listViewItem = static_cast<HbListViewItem*>
   634                                         (mEventsList->itemByIndex(mListModel->index(index, 0)));
   639                                         (mEventsList->itemByIndex(mListModel->index(index, 0)));
   705         }
   710         }
   706 
   711 
   707         // Check if the entry is recurring
   712         // Check if the entry is recurring
   708         if (entry.isRepeating()) {
   713         if (entry.isRepeating()) {
   709             iconData << HbIcon(repeatIcon);
   714             iconData << HbIcon(repeatIcon);
       
   715         } else if (!entry.recurrenceId().isNull()) {
       
   716             // This is an exceptional entry
       
   717             iconData << HbIcon(exceptionIcon);
   710         } else {
   718         } else {
   711         	// put the blank icon only when both reminder and repeating icons 
   719         	// put the blank icon only when both reminder and repeating icons 
   712         	// are not there
   720         	// are not there
   713         	if (entry.alarm().isNull()) {
   721         	if (entry.alarm().isNull()) {
   714         	iconData << HbIcon();
   722         	iconData << HbIcon();
   785         }
   793         }
   786     }
   794     }
   787     
   795     
   788     // Get the list model index and set the text and icon data
   796     // Get the list model index and set the text and icon data
   789     QModelIndex listIndex = mListModel->index(index, 0);
   797     QModelIndex listIndex = mListModel->index(index, 0);
       
   798     mNextEntry = false;
   790     mListModel->setData(listIndex, textData, Qt::DisplayRole);
   799     mListModel->setData(listIndex, textData, Qt::DisplayRole);
       
   800     mNextEntry = true;
   791     mListModel->setData(listIndex, iconData, Qt::DecorationRole);
   801     mListModel->setData(listIndex, iconData, Qt::DecorationRole);
   792     
   802     
   793     // Enable item stretching by adding the dynamic property
   803     // Enable item stretching by adding the dynamic property
   794     HbListViewItem *listViewItem = static_cast<HbListViewItem*>
   804     HbListViewItem *listViewItem = static_cast<HbListViewItem*>
   795                                         (mEventsList->itemByIndex(mListModel->index(index, 0)));
   805                                         (mEventsList->itemByIndex(mListModel->index(index, 0)));
  1011     // Get the entry details first
  1021     // Get the entry details first
  1012     AgendaEntry entry = mInstanceArray[mSelectedIndex];
  1022     AgendaEntry entry = mInstanceArray[mSelectedIndex];
  1013     
  1023     
  1014     // Set the context
  1024     // Set the context
  1015     setContextFromHighlight(entry);
  1025     setContextFromHighlight(entry);
  1016         
  1026      
       
  1027     mIconCheck = false;
  1017     // Launch the event viewer.
  1028     // Launch the event viewer.
  1018     mServices.IssueCommandL(ECalenEventView);
  1029     mServices.IssueCommandL(ECalenEventView);
  1019     
  1030     
  1020     OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_VIEWENTRY_EXIT );
  1031     OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_VIEWENTRY_EXIT );
  1021 }
  1032 }
  1255     mListModel->clear();
  1266     mListModel->clear();
  1256     
  1267     
  1257     OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CLEARLISTMODEL_EXIT );
  1268     OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_CLEARLISTMODEL_EXIT );
  1258     }
  1269     }
  1259 
  1270 
       
  1271 bool CalenAgendaViewWidget::hasAllDayIcon()
       
  1272     {
       
  1273     return mIconCheck;
       
  1274     }
       
  1275 
       
  1276 
       
  1277 
       
  1278 void CalenAgendaViewWidget::checkEntryIcons()
       
  1279     {
       
  1280     //  return allDayLeftIcon;
       
  1281     int index = 0;
       
  1282     //check the number of entries
       
  1283     index  = mInstanceArray.count(); 
       
  1284     // Get each of the entry details
       
  1285     AgendaEntry entry;
       
  1286      if(mIndex < index )   
       
  1287      entry = mInstanceArray[mIndex];
       
  1288      
       
  1289      mRightAlarmIcon = false;
       
  1290      mRightRepeatIcon = false;
       
  1291      mRightExceptionIcon = false;
       
  1292      mLeftAllDayIcon = false;
       
  1293      
       
  1294      if(!entry.alarm().isNull()){
       
  1295          mRightAlarmIcon = true;
       
  1296          }
       
  1297      if (entry.isRepeating()){
       
  1298          mRightRepeatIcon = true; 
       
  1299          }
       
  1300      if (!entry.recurrenceId().isNull()){
       
  1301          mRightExceptionIcon = true;
       
  1302          }
       
  1303 
       
  1304      if(!entry.isTimedEntry()){
       
  1305          //all day icon is not there if its a timed entry
       
  1306          mLeftAllDayIcon = true;
       
  1307          } 
       
  1308      //check if shift to next entry
       
  1309     if(mNextEntry)
       
  1310         mIndex++;     
       
  1311 
       
  1312     }
       
  1313 
       
  1314 bool CalenAgendaViewWidget::isAllDayIcon()
       
  1315     {
       
  1316     return mLeftAllDayIcon;
       
  1317     }
       
  1318 
       
  1319 bool CalenAgendaViewWidget::isExceptionIcon()
       
  1320     {
       
  1321     return mRightExceptionIcon;
       
  1322     }
       
  1323 
       
  1324 bool CalenAgendaViewWidget::isAlarmIcon()
       
  1325     {
       
  1326     return mRightAlarmIcon;
       
  1327     }
       
  1328 
       
  1329 bool CalenAgendaViewWidget::isRepeatingIcon()
       
  1330     {
       
  1331     return mRightRepeatIcon;
       
  1332     }
       
  1333 
  1260 // End of file	--Don't remove this.
  1334 // End of file	--Don't remove this.