[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kalarm] /: Bug 362962: Fix default calendar files not being created on first run
From: David Jarvie <djarvie () kde ! org>
Date: 2016-10-21 17:28:11
Message-ID: E1bxdc3-0001jd-JW () code ! kde ! org
[Download RAW message or body]
Git commit 9d9ee1311e58d4a4cf879daa104d101d52b1ede2 by David Jarvie.
Committed on 21/10/2016 at 17:24.
Pushed by djarvie into branch 'master'.
Bug 362962: Fix default calendar files not being created on first run
The file path in the resource config file was being set to a local
path, whereas it must be set to a URL.
Forward port of 72b42951fc44bccf5dcbfa0a986f39e6e3b3e86e (16.08 branch)
M +3 -0 Changelog
M +14 -10 src/calendarmigrator.cpp
M +2 -2 src/kalarm.h
http://commits.kde.org/kalarm/9d9ee1311e58d4a4cf879daa104d101d52b1ede2
diff --git a/Changelog b/Changelog
index b17c29e..c9b60fd 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,8 @@
KAlarm Change Log
+=== Version 2.11.10 (KDE Applications 16.08.3) --- 21 October 2016 ===
++ Fix default calendar files not being created on first run [KDE Bug 362962]
+
=== Version 2.11.9 (KDE Applications 16.08.1) --- 18 August 2016 ===
* Prevent KAlarm autostarting on non-KDE desktops if it has never been run [KDE Bug \
366562]
diff --git a/src/calendarmigrator.cpp b/src/calendarmigrator.cpp
index a544176..5431675 100644
--- a/src/calendarmigrator.cpp
+++ b/src/calendarmigrator.cpp
@@ -1,7 +1,7 @@
/*
* calendarmigrator.cpp - migrates or creates KAlarm Akonadi resources
* Program: kalarm
- * Copyright © 2011-2015 by David Jarvie <djarvie@kde.org>
+ * Copyright © 2011-2016 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ class CalendarCreator : public QObject
bool newCalendar() const { return mNew; }
QString resourceName() const { return mName; }
Collection::Id collectionId() const { return mCollectionId; }
- QString path() const { return mPath; }
+ QString path() const { return mUrlString; }
QString errorMessage() const { return mErrorMessage; }
void createAgent(const QString& agentType, QObject* parent);
@@ -98,7 +98,7 @@ class CalendarCreator : public QObject
AgentInstance mAgent;
CalEvent::Type mAlarmType;
ResourceType mResourceType;
- QString mPath;
+ QString mUrlString;
QString mName;
QColor mColour;
QString mErrorMessage;
@@ -565,7 +565,8 @@ CalendarCreator::CalendarCreator(const QString& resourceType, \
const KConfigGroup
qCCritical(KALARM_LOG) << "Invalid resource type:" << resourceType;
return;
}
- mPath = config.readPathEntry(pathKey, QStringLiteral(""));
+ const QString path = config.readPathEntry(pathKey, QString());
+ mUrlString = QUrl::fromUserInput(path).toString();
switch (config.readEntry("AlarmType", (int)0))
{
case 1: mAlarmType = CalEvent::ACTIVE; break;
@@ -580,7 +581,7 @@ CalendarCreator::CalendarCreator(const QString& resourceType, \
const KConfigGroup mReadOnly = config.readEntry("ResourceIsReadOnly", true);
mEnabled = config.readEntry("ResourceIsActive", false);
mStandard = config.readEntry("Standard", false);
- qCDebug(KALARM_LOG) << "Migrating:" << mName << ", type=" << mAlarmType << ", \
path=" << mPath; + qCDebug(KALARM_LOG) << "Migrating:" << mName << ", type=" << \
mAlarmType << ", path=" << mUrlString; }
/******************************************************************************
@@ -598,8 +599,9 @@ CalendarCreator::CalendarCreator(CalEvent::Type alarmType, const \
QString& file, mNew(true),
mFinished(false)
{
- mPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + \
QLatin1Char('/') + file;
- qCDebug(KALARM_LOG) << "New:" << mName << ", type=" << mAlarmType << ", path=" \
<< mPath; + const QString path = \
QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + \
file; + mUrlString = QUrl::fromLocalFile(path).toString();
+ qCDebug(KALARM_LOG) << "New:" << mName << ", type=" << mAlarmType << ", path=" \
<< mUrlString; }
/******************************************************************************
@@ -607,7 +609,7 @@ CalendarCreator::CalendarCreator(CalEvent::Type alarmType, const \
QString& file,
*/
void CalendarCreator::createAgent(const QString& agentType, QObject* parent)
{
- Q_EMIT creating(mPath);
+ Q_EMIT creating(mUrlString);
AgentInstanceCreateJob* job = new AgentInstanceCreateJob(agentType, parent);
connect(job, &KJob::result, this, &CalendarCreator::agentCreated);
job->start();
@@ -655,7 +657,7 @@ void CalendarCreator::agentCreated(KJob* j)
}
mAgent.reconfigure(); // notify the agent that its configuration has been \
changed
- // Wait for the resource to create its collection.
+ // Wait for the resource to create its collection and synchronize the backend \
storage.
ResourceSynchronizationJob* sjob = new ResourceSynchronizationJob(mAgent);
connect(sjob, &KJob::result, this, &CalendarCreator::resourceSynchronised);
sjob->start(); // this is required (not an Akonadi::Job)
@@ -672,6 +674,8 @@ void CalendarCreator::resourceSynchronised(KJob* j)
{
// Don't give up on error - we can still try to fetch the collection
qCCritical(KALARM_LOG) << "ResourceSynchronizationJob error: " << \
j->errorString(); + // Try again to synchronize the backend storage.
+ mAgent.synchronize();
}
mCollectionFetchRetryCount = 0;
fetchCollection();
@@ -728,7 +732,7 @@ template <class Interface> Interface* \
CalendarCreator::writeBasicConfig() {
iface->setReadOnly(mReadOnly);
iface->setDisplayName(mName);
- iface->setPath(mPath);
+ iface->setPath(mUrlString); // this must be a full URL, not a local path
iface->setAlarmTypes(CalEvent::mimeTypes(mAlarmType));
iface->setUpdateStorageFormat(false);
}
diff --git a/src/kalarm.h b/src/kalarm.h
index d6c5b93..de85165 100644
--- a/src/kalarm.h
+++ b/src/kalarm.h
@@ -23,8 +23,8 @@
#undef QT3_SUPPORT
-#define VERSION_SUFFIX "-5ak"
-#define KALARM_VERSION "2.11.9" VERSION_SUFFIX
+#define VERSION_SUFFIX "-5"
+#define KALARM_VERSION "2.11.10" VERSION_SUFFIX
#define KALARM_NAME "KAlarm"
#define KALARM_DBUS_SERVICE "org.kde.kalarm" // D-Bus service name of KAlarm \
application
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic