Commit 43c16934 authored by David Jarvie's avatar David Jarvie
Browse files

Merge commit 'eb1f4f49b8c91365d112709d206f93bdb58c9b64'

and commit 4ced21c70abebb4406abe6ae6e8feab6c997c0fe.
parents 75aabf16 446af517
KAlarm Change Log
=== Version 2.10.10 --- 10 May 2014 ===
=== Version 2.10.11 --- 12 August 2014 ===
- [Akonadi] Fix alarms not being redisplayed after Akonadi server restarts
(requires kdepimlibs 4.14.0) [KDE Bug 336942]
=== Version 2.10.10 (KDE 4.13.2) --- 10 May 2014 ===
- [Akonadi] Fix no Defer button in alarm windows restored after login [KDE Bug 334334]
- Fix display of duplicate alarm windows after login.
......
......@@ -131,9 +131,7 @@ AkonadiModel::AkonadiModel(ChangeRecorder* monitor, QObject* parent)
#endif
connect(monitor, SIGNAL(collectionChanged(Akonadi::Collection,QSet<QByteArray>)), SLOT(slotCollectionChanged(Akonadi::Collection,QSet<QByteArray>)));
connect(monitor, SIGNAL(collectionRemoved(Akonadi::Collection)), SLOT(slotCollectionRemoved(Akonadi::Collection)));
connect(CalendarMigrator::instance(), SIGNAL(creating(QString,Akonadi::Collection::Id,bool)),
SLOT(slotCollectionBeingCreated(QString,Akonadi::Collection::Id,bool)));
connect(CalendarMigrator::instance(), SIGNAL(destroyed(QObject*)), SLOT(slotMigrationCompleted()));
initCalendarMigrator();
MinuteTimer::connect(this, SLOT(slotUpdateTimeTo()));
Preferences::connect(SIGNAL(archivedColourChanged(QColor)), this, SLOT(slotUpdateArchivedColour(QColor)));
Preferences::connect(SIGNAL(disabledColourChanged(QColor)), this, SLOT(slotUpdateDisabledColour(QColor)));
......@@ -156,22 +154,54 @@ AkonadiModel::~AkonadiModel()
}
/******************************************************************************
* Called when the server manager is running, i.e. the agent manager knows about
* Called when the server manager changes state.
* If it is now running, i.e. the agent manager knows about
* all existing resources.
* Once it is running, if necessary migrate any KResources alarm calendars from
* Once it is running, i.e. the agent manager knows about
* all existing resources, if necessary migrate any KResources alarm calendars from
* pre-Akonadi versions of KAlarm, or create default Akonadi calendar resources
* if any are missing.
*/
void AkonadiModel::checkResources(ServerManager::State state)
{
if (!mResourcesChecked && state == ServerManager::Running)
switch (state)
{
mResourcesChecked = true;
mMigrating = true;
CalendarMigrator::execute();
case ServerManager::Running:
if (!mResourcesChecked)
{
kDebug() << "Server running";
mResourcesChecked = true;
mMigrating = true;
CalendarMigrator::execute();
}
break;
case ServerManager::NotRunning:
kDebug() << "Server stopped";
mResourcesChecked = false;
mMigrating = false;
mCollectionAlarmTypes.clear();
mCollectionRights.clear();
mCollectionEnabled.clear();
initCalendarMigrator();
emit serverStopped();
break;
default:
break;
}
}
/******************************************************************************
* Initialise the calendar migrator so that it can be run (either for the first
* time, or again).
*/
void AkonadiModel::initCalendarMigrator()
{
CalendarMigrator::reset();
connect(CalendarMigrator::instance(), SIGNAL(creating(QString,Akonadi::Collection::Id,bool)),
SLOT(slotCollectionBeingCreated(QString,Akonadi::Collection::Id,bool)));
connect(CalendarMigrator::instance(), SIGNAL(destroyed(QObject*)), SLOT(slotMigrationCompleted()));
}
/******************************************************************************
* Return whether calendar migration has completed.
*/
......@@ -1657,13 +1687,13 @@ void AkonadiModel::setCollectionChanged(const Collection& collection, const QSet
// Check for the collection being enabled/disabled
if (attributeNames.contains(CollectionAttribute::name()))
{
static bool first = true;
static bool firstEnabled = true;
const CalEvent::Types oldEnabled = mCollectionEnabled.value(collection.id(), CalEvent::EMPTY);
const CalEvent::Types newEnabled = collection.hasAttribute<CollectionAttribute>() ? collection.attribute<CollectionAttribute>()->enabled() : CalEvent::EMPTY;
if (first || newEnabled != oldEnabled)
if (firstEnabled || newEnabled != oldEnabled)
{
qDebug() << "Collection" << collection.id() << ": enabled ->" << newEnabled;
first = false;
firstEnabled = false;
mCollectionEnabled[collection.id()] = newEnabled;
emit collectionStatusChanged(collection, Enabled, static_cast<int>(newEnabled), rowInserted);
}
......
......@@ -244,6 +244,9 @@ class AkonadiModel : public Akonadi::EntityTreeModel
/** Signal emitted when calendar migration/creation has completed. */
void migrationCompleted();
/** Signal emitted when the Akonadi server has stopped. */
void serverStopped();
protected:
virtual QVariant entityHeaderData(int section, Qt::Orientation, int role, HeaderGroup) const;
virtual int entityColumnCount(HeaderGroup) const;
......@@ -291,6 +294,7 @@ class AkonadiModel : public Akonadi::EntityTreeModel
};
AkonadiModel(Akonadi::ChangeRecorder*, QObject* parent);
void initCalendarMigrator();
KAEvent event(const Akonadi::Item&, const QModelIndex&, Akonadi::Collection*) const;
void signalDataChanged(bool (*checkFunc)(const Akonadi::Item&), int startColumn, int endColumn, const QModelIndex& parent);
void setCollectionChanged(const Akonadi::Collection&, const QSet<QByteArray>&, bool rowInserted);
......
......@@ -148,6 +148,14 @@ CalendarMigrator::~CalendarMigrator()
mInstance = 0;
}
/******************************************************************************
* Reset to allow migration to be run again.
*/
void CalendarMigrator::reset()
{
mCompleted = false;
}
/******************************************************************************
* Create and return the unique CalendarMigrator instance.
*/
......
......@@ -45,6 +45,7 @@ class CalendarMigrator : public QObject
public:
~CalendarMigrator();
static CalendarMigrator* instance();
static void reset();
static void execute();
static void updateToCurrentFormat(const Akonadi::Collection&, bool ignoreKeepFormat, QWidget* parent);
static bool completed() { return mCompleted; }
......
/*
* collectionmodel.cpp - Akonadi collection models
* Program: kalarm
* Copyright © 2007-2012 by David Jarvie <djarvie@kde.org>
* Copyright © 2007-2014 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
......@@ -678,6 +678,7 @@ CollectionControlModel::CollectionControlModel(QObject* parent)
SLOT(collectionPopulated()));
connect(AkonadiModel::instance(), SIGNAL(collectionPopulated(Akonadi::Collection::Id)),
SLOT(collectionPopulated()));
connect(AkonadiModel::instance(), SIGNAL(serverStopped()), SLOT(reset()));
}
/******************************************************************************
......@@ -1298,6 +1299,20 @@ bool CollectionControlModel::waitUntilPopulated(Collection::Id colId, int timeou
return result;
}
/******************************************************************************
* Called when the Akonadi server has stopped. Reset the model.
*/
void CollectionControlModel::reset()
{
delete mPopulatedCheckLoop;
mPopulatedCheckLoop = 0;
// Clear the collections list. This is required because addCollection() or
// setCollections() don't work if the collections which they specify are
// already in the list.
setCollections(Collection::List());
}
/******************************************************************************
* Exit from the populated event loop when a collection has been populated.
*/
......
/*
* collectionmodel.h - Akonadi collection models
* Program: kalarm
* Copyright © 2010-2012 by David Jarvie <djarvie@kde.org>
* Copyright © 2010-2014 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
......@@ -284,6 +284,7 @@ class CollectionControlModel : public Akonadi::FavoriteCollectionsModel
static QString typeListForDisplay(CalEvent::Types);
private slots:
void reset();
void statusChanged(const Akonadi::Collection&, AkonadiModel::Change, const QVariant& value, bool inserted);
void collectionPopulated();
......
......@@ -24,7 +24,7 @@
#undef QT3_SUPPORT
#define VERSION_SUFFIX "-ak"
#define KALARM_VERSION "2.10.10" VERSION_SUFFIX
#define KALARM_VERSION "2.10.11" VERSION_SUFFIX
#define KALARM_NAME "KAlarm"
#define KALARM_DBUS_SERVICE "org.kde.kalarm" // D-Bus service name of KAlarm application
......
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