Commit dd67c875 authored by flypig's avatar flypig Committed by flypig

[nemo-qml-plugin-calendar] Allow import to notebook from ics string. Contributes to JB#52660

The CalendarImportModel::importToNotebook() method allowed files to be
imported to a notebook, but didn't allow ics data to be imported
directly as a string, even though ImportModel supports it more

This change allows import to a notebook by string of ics data directly.
parent cc591031
......@@ -143,6 +143,8 @@ bool CalendarImportModel::importToNotebook(const QString &notebookUid)
mKCal::ExtendedCalendar::Ptr calendar(new mKCal::ExtendedCalendar(QTimeZone::systemTimeZone()));
mKCal::ExtendedStorage::Ptr storage = calendar->defaultStorage(calendar);
bool success = false;
if (!storage->open()) {
qWarning() << "Unable to open calendar DB";
return false;
......@@ -161,12 +163,19 @@ bool CalendarImportModel::importToNotebook(const QString &notebookUid)
if (CalendarUtils::importFromFile(mFileName, calendar))
if (!mFileName.isEmpty()) {
success = CalendarUtils::importFromFile(mFileName, calendar);
} else {
success = CalendarUtils::importFromIcsRawData(mIcsRawData, calendar);
if (success) {
return true;
return success;
QHash<int, QByteArray> CalendarImportModel::roleNames() const
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment