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

fix start agent

parent 54ef4a1e
......@@ -43,7 +43,8 @@
//#define DEBUG_SENDLATERAGENT 1
SendLaterAgent::SendLaterAgent(const QString &id)
: Akonadi::AgentBase( id )
: Akonadi::AgentBase( id ),
mAgentInitialized(false)
{
mManager = new SendLaterManager(this);
connect(mManager, SIGNAL(needUpdateConfigDialogBox()), SIGNAL(needUpdateConfigDialogBox()));
......@@ -61,9 +62,9 @@ SendLaterAgent::SendLaterAgent(const QString &id)
if (SendLaterAgentSettings::enabled()) {
#ifdef DEBUG_SENDLATERAGENT
QTimer::singleShot(1000, mManager, SLOT(load()));
QTimer::singleShot(1000, this, SLOT(slotStartAgent()));
#else
QTimer::singleShot(1000*60*4, mManager, SLOT(load()));
QTimer::singleShot(1000*60*4, this, SLOT(slotStartAgent()));
#endif
}
}
......@@ -72,12 +73,21 @@ SendLaterAgent::~SendLaterAgent()
{
}
void SendLaterAgent::slotStartAgent()
{
mAgentInitialized = true;
if (isOnline())
mManager->load();
}
void SendLaterAgent::doSetOnline( bool online )
{
if (online) {
reload();
} else {
mManager->stopAll();
if (mAgentInitialized) {
if (online) {
reload();
} else {
mManager->stopAll();
}
}
}
......
......@@ -47,12 +47,14 @@ public Q_SLOTS:
private Q_SLOTS:
void slotSendNow(Akonadi::Item::Id id);
void slotStartAgent();
protected:
void itemsRemoved( const Akonadi::Item::List &item );
void itemsMoved(const Akonadi::Item::List &items, const Akonadi::Collection &sourceCollection, const Akonadi::Collection &destinationCollection);
void doSetOnline( bool online );
private:
bool mAgentInitialized;
SendLaterManager *mManager;
};
......
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