56 const QString singleSpace(" "); |
56 const QString singleSpace(" "); |
57 const QString doubleSpace(" "); |
57 const QString doubleSpace(" "); |
58 const QString space(" "); |
58 const QString space(" "); |
59 const QString singleHyphen("-"); |
59 const QString singleHyphen("-"); |
60 const QString customLayout("custom"); |
60 const QString customLayout("custom"); |
61 const char *stretchLayout("customstretch"); |
|
62 const QString toDoIcon("qtg_small_todo"); |
61 const QString toDoIcon("qtg_small_todo"); |
63 const QString reminderIcon("qtg_mono_alarm"); |
62 const QString reminderIcon("qtg_mono_alarm"); |
64 const QString locationIcon("qtg_mono_location"); |
63 const QString locationIcon("qtg_mono_location"); |
65 const QString repeatIcon("qtg_mono_repeat"); |
64 const QString repeatIcon("qtg_mono_repeat"); |
66 // TODO: Replace with actual image name once its available |
65 // TODO: Replace with actual image name once its available |
627 textData<<QString(space); |
626 textData<<QString(space); |
628 } |
627 } |
629 |
628 |
630 |
629 |
631 // Disable item stretching by removing the dynamic property |
630 // Disable item stretching by removing the dynamic property |
632 HbListViewItem *listViewItem = static_cast<HbListViewItem*> |
631 QModelIndex currIndex = mListModel->index(index, 0); |
633 (mEventsList->itemByIndex(mListModel->index(index, 0))); |
632 mListModel->itemFromIndex(currIndex)->setData(false); |
634 if (listViewItem) { |
633 |
635 listViewItem->setProperty(stretchLayout, false); |
|
636 } |
|
637 // Get the list model index and set the text and icon data |
634 // Get the list model index and set the text and icon data |
638 QModelIndex listIndex = mListModel->index(index, 0); |
635 QModelIndex listIndex = mListModel->index(index, 0); |
639 mListModel->setData(listIndex, textData, Qt::DisplayRole); |
636 mListModel->setData(listIndex, textData, Qt::DisplayRole); |
640 mListModel->setData(listIndex, iconData, Qt::DecorationRole); |
637 mListModel->setData(listIndex, iconData, Qt::DecorationRole); |
641 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ADDTIMEDEVENTTOLIST_EXIT ); |
638 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ADDTIMEDEVENTTOLIST_EXIT ); |
789 iconData << QVariant(); |
786 iconData << QVariant(); |
790 } |
787 } |
791 } |
788 } |
792 } |
789 } |
793 // Enable item stretching by adding the dynamic property |
790 // Enable item stretching by adding the dynamic property |
794 HbListViewItem *listViewItem = static_cast<HbListViewItem*> |
791 QModelIndex currentIndex = mListModel->index(index, 0); |
795 (mEventsList->itemByIndex(mListModel->index(index, 0))); |
792 |
796 Qt::Orientation orientation = mServices.MainWindow().orientation(); |
793 Qt::Orientation orientation = mServices.MainWindow().orientation(); |
797 // Apply stretch only for landscape orientation |
794 // Apply stretch only for landscape orientation |
798 if (listViewItem) { |
795 if (Qt::Horizontal == orientation) { |
799 if (Qt::Horizontal == orientation) { |
796 mListModel->itemFromIndex(currentIndex)->setData(true); |
800 listViewItem->setProperty(stretchLayout, true); |
797 } else { |
801 } else { |
798 mListModel->itemFromIndex(currentIndex)->setData(false); |
802 listViewItem->setProperty(stretchLayout, false); |
799 } |
803 } |
800 |
804 } |
|
805 // Get the list model index and set the text and icon data |
801 // Get the list model index and set the text and icon data |
806 QModelIndex listIndex = mListModel->index(index, 0); |
802 mListModel->setData(currentIndex, textData, Qt::DisplayRole); |
807 mListModel->setData(listIndex, textData, Qt::DisplayRole); |
803 mListModel->setData(currentIndex, iconData, Qt::DecorationRole); |
808 mListModel->setData(listIndex, iconData, Qt::DecorationRole); |
|
809 |
804 |
810 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ADDNONTIMEDEVENTTOLIST_EXIT ); |
805 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_ADDNONTIMEDEVENTTOLIST_EXIT ); |
811 } |
806 } |
812 |
807 |
813 // ---------------------------------------------------------------------------- |
808 // ---------------------------------------------------------------------------- |
841 case AgendaEntry::TypeTodo: |
836 case AgendaEntry::TypeTodo: |
842 case AgendaEntry::TypeEvent: |
837 case AgendaEntry::TypeEvent: |
843 case AgendaEntry::TypeAnniversary: |
838 case AgendaEntry::TypeAnniversary: |
844 { |
839 { |
845 // Get the list view item corresponding to the index |
840 // Get the list view item corresponding to the index |
846 HbListViewItem *listItem = static_cast<HbListViewItem*> |
841 QModelIndex currIndex = mListModel->index(index, 0); |
847 (mEventsList->itemByIndex(mListModel->index(index, 0))); |
842 |
848 if (listItem) { |
843 if (orientation == Qt::Horizontal) { |
849 if (orientation == Qt::Horizontal) { |
844 // Set a dynamic property to indicate that this list item |
850 // Set a dynamic property to indicate that this list item |
845 // must be stretched in landscape. |
851 // must be stretched in landscape. |
846 // NOTE: Property name MUST match the name specified in |
852 // NOTE: Property name MUST match the name specified in |
847 // css file, else wierd things might happen |
853 // css file, else wierd things might happen |
848 mListModel->itemFromIndex(currIndex)->setData(true); |
854 listItem->setProperty(stretchLayout, true); |
849 } |
855 } |
850 if (orientation == Qt::Vertical) { |
856 if (orientation == Qt::Vertical) { |
851 // Set a dynamic property to indicate that this list item |
857 // Set a dynamic property to indicate that this list item |
852 // NOTE: Property name MUST match the name specified in |
858 // NOTE: Property name MUST match the name specified in |
853 // css file, else wierd things might happen |
859 // css file, else wierd things might happen |
854 mListModel->itemFromIndex(currIndex)->setData(false); |
860 listItem->setProperty(stretchLayout, false); |
|
861 } |
|
862 } |
855 } |
863 } |
856 } |
864 break; |
857 break; |
865 default: |
858 default: |
866 { |
859 { |
867 HbListViewItem *listItem = static_cast<HbListViewItem*> |
860 QModelIndex currIndex = mListModel->index(index, 0); |
868 (mEventsList->itemByIndex(mListModel->index(index, 0))); |
861 mListModel->itemFromIndex(currIndex)->setData(false); |
869 if (listItem) { |
|
870 listItem->setProperty(stretchLayout, false); |
|
871 } |
|
872 break; |
862 break; |
873 } |
863 } |
874 } |
864 } |
875 } |
865 } |
876 } |
866 } |
934 } |
924 } |
935 QString *pluginString = mView->pluginText(); |
925 QString *pluginString = mView->pluginText(); |
936 HbLabel *pluginInfoLabel = qobject_cast <HbLabel *> |
926 HbLabel *pluginInfoLabel = qobject_cast <HbLabel *> |
937 (mRegionalInfoGroupBox->contentWidget()); |
927 (mRegionalInfoGroupBox->contentWidget()); |
938 pluginInfoLabel->setPlainText(*pluginString); |
928 pluginInfoLabel->setPlainText(*pluginString); |
|
929 pluginInfoLabel->setTextWrapping(Hb::TextNoWrap); |
|
930 pluginInfoLabel->setElideMode(Qt::ElideRight); |
|
931 }else { |
|
932 if (mRegionalInfoGroupBox) { |
|
933 mRegionalPluginLayout->removeItem(mRegionalInfoGroupBox); |
|
934 delete mRegionalInfoGroupBox; |
|
935 mRegionalInfoGroupBox = NULL; |
|
936 } |
939 } |
937 } |
940 } else { |
938 } |
941 if (mRegionalInfoGroupBox) { |
|
942 mRegionalPluginLayout->removeItem(mRegionalInfoGroupBox); |
|
943 delete mRegionalInfoGroupBox; |
|
944 mRegionalInfoGroupBox = NULL; |
|
945 } |
|
946 } |
|
947 |
|
948 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SHOWHIDEREGIONALINFORMATION_EXIT ); |
939 OstTraceFunctionExit0( CALENAGENDAVIEWWIDGET_SHOWHIDEREGIONALINFORMATION_EXIT ); |
949 } |
940 } |
950 |
941 |
951 // ---------------------------------------------------------------------------- |
942 // ---------------------------------------------------------------------------- |
952 // CalenAgendaViewWidget::createNewEvent |
943 // CalenAgendaViewWidget::createNewEvent |