Commit 73100779 authored by David Jarvie's avatar David Jarvie
Browse files

Fix "exportalarms" showing as selection in file dialogues

Using kfiledialog:///exportalarms as the start URL in KFileCustomDialog
for Export Alarms, makes "exportalarms" appear as the selected file in
other dialogues. Save the location manually instead.
parent a054e8b4
......@@ -649,8 +649,9 @@ bool ResourcesCalendar::addEvent(KAEvent& evnt, QWidget* promptParent, bool useE
}
if (res.isValid())
{
// Don't add event to mEventMap yet - its Akonadi item id is not yet known.
// It will be added once it is inserted into AkonadiDataModel.
// Don't add event to mEventMap yet - its ID is not yet known.
// It will be added after it is inserted into the data model, when
// the resource signals eventsAdded().
ok = res.addEvent(*event);
remove = ok; // if success, delete the local event instance on exit
if (ok && type == CalEvent::ACTIVE && !event->enabled())
......@@ -810,7 +811,8 @@ bool ResourcesCalendar::modifyEvent(const EventId& oldEventId, KAEvent& newEvent
Resource resource = Resources::resource(oldEventId.resourceId());
if (!resource.isValid())
return false;
// Don't add new event to mEventMap yet - its Akonadi item id is not yet known
// Don't add new event to mEventMap yet - it will be added when the resource
// signals eventsAdded().
if (!resource.addEvent(newEvent))
return false;
// Note: deleteEventInternal() will delete storedEvent before using the
......
......@@ -85,6 +85,7 @@ namespace
{
bool refreshAlarmsQueued = false;
QUrl lastImportUrl; // last URL for Import Alarms file dialogue
QUrl lastExportUrl; // last URL for Export Alarms file dialogue
struct UpdateStatusData
{
......@@ -835,8 +836,7 @@ bool importAlarms(Resource& resource, QWidget* parent)
bool exportAlarms(const KAEvent::List& events, QWidget* parent)
{
bool append;
//TODO: exportalarms shows up afterwards in other file dialogues
QString file = FileDialog::getSaveFileName(QUrl(QStringLiteral("kfiledialog:///exportalarms")),
QString file = FileDialog::getSaveFileName(lastExportUrl,
QStringLiteral("*.ics|%1").arg(i18nc("@info", "Calendar Files")),
parent, i18nc("@title:window", "Choose Export Calendar"),
&append);
......@@ -848,6 +848,7 @@ bool exportAlarms(const KAEvent::List& events, QWidget* parent)
qCDebug(KALARM_LOG) << "KAlarm::exportAlarms: Invalid URL" << url;
return false;
}
lastExportUrl = url.adjusted(QUrl::RemoveFilename);
qCDebug(KALARM_LOG) << "KAlarm::exportAlarms:" << url.toDisplayString();
MemoryCalendar::Ptr calendar(new MemoryCalendar(Preferences::timeSpecAsZone()));
......
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