Commit f1230f18 authored by Laurent Montel's avatar Laurent Montel 😁

Don't load directly data

parent 53a56481
......@@ -39,7 +39,8 @@
#include <QPointer>
NotesAgent::NotesAgent(const QString &id)
: Akonadi::AgentBase( id )
: Akonadi::AgentBase( id ),
mAgentInitialized(false)
{
mNotesManager = new NotesManager(this);
KGlobal::locale()->insertCatalog( QLatin1String("akonadi_notes_agent") );
......@@ -50,7 +51,7 @@ NotesAgent::NotesAgent(const QString &id)
setNeedsNetwork(true);
if (NotesAgentSettings::enabled()) {
QTimer::singleShot(60 * 1000, mNotesManager, SLOT(load()));
QTimer::singleShot(60 * 1000, this, SLOT(slotStartAgent()));
}
}
......@@ -60,13 +61,22 @@ NotesAgent::~NotesAgent()
void NotesAgent::doSetOnline( bool online )
{
if (online) {
reload();
} else {
mNotesManager->stopAll();
if (mAgentInitialized) {
if (online) {
reload();
} else {
mNotesManager->stopAll();
}
}
}
void NotesAgent::slotStartAgent()
{
mAgentInitialized = true;
if (isOnline())
mNotesManager->load();
}
void NotesAgent::reload()
{
if (NotesAgentSettings::enabled())
......
......@@ -54,7 +54,11 @@ public Q_SLOTS:
protected:
void doSetOnline( bool online );
private slots:
void slotStartAgent();
private:
bool mAgentInitialized;
NotesManager *mNotesManager;
};
......
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