diff -r 360d55486d7f -r 5de72ea7a065 calendarui/views/src/calendayviewwidget.cpp --- a/calendarui/views/src/calendayviewwidget.cpp Fri Jun 11 13:37:54 2010 +0300 +++ b/calendarui/views/src/calendayviewwidget.cpp Wed Jun 23 18:11:28 2010 +0300 @@ -18,6 +18,8 @@ // System includes #include #include +#include +#include #include #include #include @@ -29,7 +31,7 @@ #include #include #include -#include +#include // User includes #include "calendayviewwidget.h" @@ -68,7 +70,8 @@ mServices(services), mDocLoader(docLoader), mRegionalInfoGroupBox(NULL), -mLongTapEventFlag(false) +mLongTapEventFlag(false), +mNotesPluginLoaded(false) { // Construct the list view prototype mListViewPrototype = new CalenEventListViewItem(this); @@ -90,6 +93,13 @@ // EXPORT_C CalenDayViewWidget::~CalenDayViewWidget() { + // Unload notes editor if loaded. + if (mNotesEditorPluginLoader) { + mNotesEditorPluginLoader->unload(); + delete mNotesEditorPluginLoader; + mNotesEditorPluginLoader = 0; + } + if (mListViewPrototype) { delete mListViewPrototype; mListViewPrototype = NULL; @@ -509,8 +519,6 @@ // Raise the flag to indicate that the list item // would wrap to two lines twoLines = true; - // Append space - eventTime.append(" "); // Append '-' to indicate an end time is present eventTime.append("-"); } else { @@ -565,13 +573,10 @@ // Add the end time to the list item if (eventStartTime < eventEndTime) { QString endtime = locale.format(eventEndTime, r_qtn_time_usual_with_zero); + endtime.append(" "); textData << endtime; }else { - if (entry.location().isEmpty()) { - textData << QVariant(); - }else { - textData << singleSpace; - } + textData<index(index, 0); @@ -827,22 +832,22 @@ // void CalenDayViewWidget::showHideRegionalInformation() { - XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository, - KCRUidCalendar, KCalendarShowRegionalInfo); - - int showRegionalInfo = mSettingsManager->readItemValue(regionalInfo).toUInt(); - if (showRegionalInfo) { - - if (!mRegionalInfoGroupBox) { - mRegionalInfoGroupBox = new HbGroupBox(); - CalenPluginLabel *regionalInfo = new CalenPluginLabel( - mServices, this); - regionalInfo->setFontSpec(HbFontSpec(HbFontSpec::Primary)); - mRegionalInfoGroupBox->setContentWidget(regionalInfo); - mRegionalPluginLayout->insertItem(1, mRegionalInfoGroupBox); - } - - if (mView->pluginEnabled()) { + if (mView->pluginEnabled()) { + XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository, + KCRUidCalendar, KCalendarShowRegionalInfo); + + int showRegionalInfo = + mSettingsManager->readItemValue(regionalInfo).toUInt(); + if (showRegionalInfo) { + + if (!mRegionalInfoGroupBox) { + mRegionalInfoGroupBox = new HbGroupBox(); + CalenPluginLabel *regionalInfo = new CalenPluginLabel( + mServices, this); + regionalInfo->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + mRegionalInfoGroupBox->setContentWidget(regionalInfo); + mRegionalPluginLayout->insertItem(1, mRegionalInfoGroupBox); + } QString *pluginString = mView->pluginText(); HbLabel *pluginInfoLabel = qobject_cast (mRegionalInfoGroupBox->contentWidget()); @@ -880,20 +885,40 @@ if (mSelectedIndex < 0 || mSelectedIndex > mInstanceArray.count()) { return; } - - // Get the entry details first - AgendaEntry entry = mInstanceArray[mSelectedIndex]; - if (AgendaEntry::TypeTodo == entry.type()) { - // Launch the to-do editor - mNotesEditor = new NotesEditor(mView); - mNotesEditor->edit(entry); - connect(mNotesEditor, SIGNAL(editingCompleted(bool)), this, SLOT(noteEditingCompleted(bool))); - } else { - // Set the context - setContextFromHighlight(entry); - // Issue a command to launch the editor to edit this entry - mServices.IssueCommandL(ECalenEditCurrentEntry); - } + + // Get the entry details first + AgendaEntry entry = mInstanceArray[mSelectedIndex]; + if (AgendaEntry::TypeTodo == entry.type()) { + // Load the notes editor plugin if not loaded. + if (!mNotesPluginLoaded) { + // Launch the to-do editor using notes editor plugin api + QDir dir(NOTES_EDITOR_PLUGIN_PATH); + QString pluginName = dir.absoluteFilePath(NOTES_EDITOR_PLUGIN_NAME); + + // Create NotesEditor plugin loader object. + mNotesEditorPluginLoader = new QPluginLoader(pluginName); + + // Load the plugin + mNotesPluginLoaded = mNotesEditorPluginLoader->load(); + } + + QObject *plugin = qobject_cast ( + mNotesEditorPluginLoader->instance()); + + NotesEditorInterface* interface = + qobject_cast(plugin); + + interface->edit(entry, mServices.agendaInterface()); + + connect( + interface, SIGNAL(editingCompleted(bool)), + this, SLOT(noteEditingCompleted(bool))); + } else { + // Set the context + setContextFromHighlight(entry); + // Issue a command to launch the editor to edit this entry + mServices.IssueCommandL(ECalenEditCurrentEntry); + } } // ---------------------------------------------------------------------------- @@ -1042,17 +1067,13 @@ // void CalenDayViewWidget::noteEditingCompleted(bool status) { - Q_UNUSED(status); - // Delete the notes editor instance - mNotesEditor->deleteLater(); - - // We need to refresh the list since user - // might have marked the to-do as complete or - // edited it or deleted it. So get the instance - // list again - if (status) { - mServices.IssueCommandL(ECalenStartActiveStep); - } + // We need to refresh the list since user + // might have marked the to-do as complete or + // edited it or deleted it. So get the instance + // list again + if (status) { + mServices.IssueCommandL(ECalenStartActiveStep); + } } // ----------------------------------------------------------------------------