Commit 7d4d768b authored by flypig's avatar flypig

Merge branch 'jb52660' into 'master'

Allow import to notebook from ics string

See merge request !77
parents cc591031 dd67c875
......@@ -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) {
storage->save();
}
storage->close();
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