24 #ifndef AKONADI_AGENTBASE_H
25 #define AKONADI_AGENTBASE_H
27 #include "akonadi_export.h"
28 #include <akonadi/item.h>
30 #include <KDE/KApplication>
32 #include <QtDBus/QDBusConnection>
33 #include <QtDBus/QDBusContext>
35 class Akonadi__ControlAdaptor;
36 class Akonadi__StatusAdaptor;
40 class AgentBasePrivate;
80 class AKONADI_EXPORT
AgentBase :
public QObject,
protected QDBusContext
203 virtual void itemAdded(
const Akonadi::Item &item,
const Akonadi::Collection &collection );
210 virtual void itemChanged(
const Akonadi::Item &item,
const QSet<QByteArray> &partIdentifiers );
216 virtual void itemRemoved(
const Akonadi::Item &item );
247 using Observer::collectionChanged;
259 virtual void itemMoved(
const Akonadi::Item &item,
const Akonadi::Collection &collectionSource,
268 virtual void itemLinked(
const Akonadi::Item &item,
const Akonadi::Collection &collection );
276 virtual void itemUnlinked(
const Akonadi::Item &item,
const Akonadi::Collection &collection );
296 virtual void collectionChanged(
const Akonadi::Collection &collection,
const QSet<QByteArray> &changedAttributes );
323 virtual void itemsFlagsChanged(
const Akonadi::Item::List &items,
const QSet<QByteArray> &addedFlags,
const QSet<QByteArray> &removedFlags );
330 virtual void itemsRemoved(
const Akonadi::Item::List &items );
339 virtual void itemsMoved(
const Akonadi::Item::List &items,
const Akonadi::Collection &sourceCollection,
348 virtual void itemsLinked(
const Akonadi::Item::List &items,
const Akonadi::Collection &collection );
356 virtual void itemsUnlinked(
const Akonadi::Item::List &items,
const Akonadi::Collection &collection );
394 template <
typename T>
395 static int init(
int argc,
char **argv )
397 const QString
id = parseArguments( argc, argv );
404 if ( observer != 0 ) {
405 r->registerObserver( observer );
420 virtual int status()
const;
425 virtual QString statusMessage()
const;
430 virtual int progress()
const;
435 virtual QString progressMessage()
const;
448 virtual void configure( WId windowId );
454 WId winIdForDialogs()
const;
461 void configure( qlonglong windowId );
467 QString identifier()
const;
476 virtual void cleanup();
485 void registerObserver( Observer *observer );
494 void setAgentName(
const QString &name );
501 QString agentName()
const;
511 static KComponentData componentData();
521 void agentNameChanged(
const QString &name );
528 void status(
int status,
const QString &message = QString() );
536 void percent(
int progress );
543 void warning(
const QString& message );
550 void error(
const QString& message );
558 void advancedStatus(
const QVariantMap &status );
568 void abortRequested();
576 void reloadConfiguration();
583 void onlineChanged(
bool online );
593 void configurationDialogAccepted();
603 void configurationDialogRejected();
625 virtual void aboutToQuit();
636 KSharedConfigPtr config();
645 void changeProcessed();
650 bool isOnline()
const;
660 void setNeedsNetwork(
bool needsNetwork );
665 void setOnline(
bool state );
671 friend class ObserverV2;
679 virtual void doSetOnline(
bool online );
683 static QString parseArguments(
int,
char** );
685 void setOnlineInternal(
bool state );
693 friend class ::Akonadi__StatusAdaptor;
694 friend class ::Akonadi__ControlAdaptor;
697 Q_PRIVATE_SLOT( d_func(),
void delayedInit() )
698 Q_PRIVATE_SLOT( d_func(),
void slotStatus(
int, const QString& ) )
699 Q_PRIVATE_SLOT( d_func(),
void slotPercent(
int ) )
700 Q_PRIVATE_SLOT( d_func(),
void slotWarning( const QString& ) )
701 Q_PRIVATE_SLOT( d_func(),
void slotError( const QString& ) )
702 Q_PRIVATE_SLOT( d_func(),
void slotNetworkStatusChange( Solid::Networking::Status ) )
703 Q_PRIVATE_SLOT( d_func(),
void slotResumedFromSuspend() )
710 #ifndef AKONADI_AGENT_MAIN
714 #define AKONADI_AGENT_MAIN( agentClass ) \
715 int main( int argc, char **argv ) \
717 return Akonadi::AgentBase::init<agentClass>( argc, argv ); \
Status
This enum describes the different states the agent can be in.
Represents a collection of PIM items.
The interface for reacting on monitored or replayed changes.
The base class for all Akonadi agents and resources.
BC extension of Observer with support for monitoring item and collection moves.
BC extension of ObserverV2 with support for batch operations.
The agent encountered an error state.
static int init(int argc, char **argv)
Use this method in the main function of your agent application to initialize your agent subclass...
The agent is working on something.
Records and replays change notification.