// Iterate over the list of events foreach (const CalendarEvent &event, events2) { // Copy the data into a model entry QVariantMap entry; entry["myType"] = QVariant(trUtf8("tomorrow")); entry["eventId"] = event.id(); entry["accountId"] = event.accountId(); entry["subject"] = event.subject().replace('&', "&").replace('<', "<").replace('>', ">").replace('"', """); entry["order"] = order++; entry["startTime"] = event.startTime(); entry["endTime"] = event.endTime(); entry["timeString"] = ""; entry["account"] = event.accountId(); std::stringstream keyStream; keyStream << event.accountId() << event.folderId(); std::string key = keyStream.str(); entry["color24"] = QString::number(accountColor[key], 16); qDebug() << "FMI ######### key:" << QString::fromStdString(key) << "=" << accountColor[key]; qDebug() << "FMI ######### id:" << event.id() << " subject" << event.subject() << " startTime:" << event.startTime().toString(Qt::DefaultLocaleShortDate); entries.append(entry); }
//! [2] void EventEditor::loadEvent(const EventKey &eventKey) { m_eventKey = eventKey; // Load the event from the persistent storage const CalendarEvent event = m_calendarService->event(m_eventKey.accountId(), m_eventKey.eventId()); // Update the properties with the data from the event m_subject = event.subject(); m_location = event.location(); m_startTime = event.startTime(); m_endTime = event.endTime(); m_folderId = event.folderId(); m_accountId = event.accountId(); // Emit the change notifications emit subjectChanged(); emit locationChanged(); emit startTimeChanged(); emit endTimeChanged(); emit folderIdChanged(); emit accountIdChanged(); }