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

Bug 293208: fix errors creating default resources on initialisation

Wait for Akonadi server to be fully running before creating default
KAlarm resources. This also requires kdepimlibs commit
d612b6055f725c01664e3ed07294d2f29052d204 by Volker Krause which fixes
the server manager reporting prematurely that it is running.

parent dad16d00
......@@ -91,7 +91,8 @@ AkonadiModel* AkonadiModel::instance()
AkonadiModel::AkonadiModel(ChangeRecorder* monitor, QObject* parent)
: EntityTreeModel(monitor, parent),
// Set lazy population to enable the contents of unselected collections to be ignored
......@@ -136,10 +137,25 @@ AkonadiModel::AkonadiModel(ChangeRecorder* monitor, QObject* parent)
connect(this, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), SLOT(slotRowsAboutToBeRemoved(QModelIndex,int,int)));
connect(monitor, SIGNAL(itemChanged(Akonadi::Item,QSet<QByteArray>)), SLOT(slotMonitoredItemChanged(Akonadi::Item,QSet<QByteArray>)));
// If necessary, migrate any KResources alarm calendars from pre-Akonadi
// versions of KAlarm, or create default Akonadi calendar resources if any
// are missing.
connect(ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)),
* Called when the server manager is running, i.e. the agent manager knows about
* all existing resources.
* Once it is running, 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)
mResourcesChecked = true;
......@@ -25,6 +25,7 @@
#include <kalarmcal/kaevent.h>
#include <akonadi/entitytreemodel.h>
#include <akonadi/servermanager.h>
#include <QSize>
#include <QColor>
......@@ -233,6 +234,7 @@ class AkonadiModel : public Akonadi::EntityTreeModel
virtual int entityColumnCount(HeaderGroup) const;
private slots:
void checkResources(Akonadi::ServerManager::State);
void slotCollectionChanged(const Akonadi::Collection& c, const QSet<QByteArray>& attrNames)
{ setCollectionChanged(c, attrNames, false); }
void slotCollectionRemoved(const Akonadi::Collection&);
......@@ -312,6 +314,7 @@ class AkonadiModel : public Akonadi::EntityTreeModel
QList<Akonadi::Collection::Id> mCollectionsDeleting; // collections currently being removed
QList<Akonadi::Collection::Id> mCollectionsDeleted; // collections recently removed
QQueue<Event> mPendingEventChanges; // changed events with changedEvent() signal pending
bool mResourcesChecked; // whether resource existence has been checked yet
Supports Markdown
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