7 #ifndef AKONADICONTROL_AGENTINSTANCE_H 8 #define AKONADICONTROL_AGENTINSTANCE_H 10 #include "controlinterface.h" 11 #include "statusinterface.h" 12 #include "resourceinterface.h" 13 #include "preprocessorinterface.h" 14 #include "searchinterface.h" 16 #include <private/dbus_p.h> 19 #include <QSharedPointer> 55 Q_REQUIRED_RESULT
QString agentType()
const 60 Q_REQUIRED_RESULT
int status()
const 65 Q_REQUIRED_RESULT
QString statusMessage()
const 67 return mStatusMessage;
70 Q_REQUIRED_RESULT
int progress()
const 75 Q_REQUIRED_RESULT
bool isOnline()
const 80 Q_REQUIRED_RESULT
QString resourceName()
const 85 virtual bool start(
const AgentType &agentInfo) = 0;
87 virtual void cleanup();
88 virtual void restartWhenIdle() = 0;
89 virtual void configure(qlonglong windowId) = 0;
91 Q_REQUIRED_RESULT
bool hasResourceInterface()
const 93 return mResourceInterface !=
nullptr;
96 Q_REQUIRED_RESULT
bool hasAgentInterface()
const 98 return mAgentControlInterface !=
nullptr && mAgentStatusInterface !=
nullptr;
101 Q_REQUIRED_RESULT
bool hasPreprocessorInterface()
const 103 return mPreprocessorInterface !=
nullptr;
106 org::freedesktop::Akonadi::Agent::Control *controlInterface()
const 108 return mAgentControlInterface.get();
111 org::freedesktop::Akonadi::Agent::Status *statusInterface()
const 113 return mAgentStatusInterface.get();
116 org::freedesktop::Akonadi::Agent::Search *searchInterface()
const 118 return mSearchInterface.get();
121 org::freedesktop::Akonadi::Resource *resourceInterface()
const 123 return mResourceInterface.get();
126 org::freedesktop::Akonadi::Preprocessor *preProcessorInterface()
const 128 return mPreprocessorInterface.get();
131 bool obtainAgentInterface();
132 bool obtainResourceInterface();
133 bool obtainPreprocessorInterface();
136 void statusChanged(
int status,
const QString &statusMsg);
137 void advancedStatusChanged(
const QVariantMap &status);
138 void statusStateChanged(
int status);
139 void statusMessageChanged(
const QString &msg);
140 void percentChanged(
int percent);
141 void warning(
const QString &msg);
142 void error(
const QString &msg);
143 void onlineChanged(
bool state);
144 void resourceNameChanged(
const QString &name);
146 void refreshAgentStatus();
147 void refreshResourceStatus();
152 template <
typename T>
153 std::unique_ptr<T> findInterface(Akonadi::DBus::AgentType agentType,
const char *path =
nullptr);
156 void setAgentType(
const QString &agentType)
165 std::unique_ptr<org::freedesktop::Akonadi::Agent::Control> mAgentControlInterface;
166 std::unique_ptr<org::freedesktop::Akonadi::Agent::Status> mAgentStatusInterface;
167 std::unique_ptr<org::freedesktop::Akonadi::Agent::Search> mSearchInterface;
168 std::unique_ptr<org::freedesktop::Akonadi::Resource> mResourceInterface;
169 std::unique_ptr<org::freedesktop::Akonadi::Preprocessor> mPreprocessorInterface;
175 bool mOnline =
false;
176 bool mPendingQuit =
false;
Represents one agent instance and takes care of communication with it.
QString identifier() const
Set/get the unique identifier of this AgentInstance.
The agent manager has knowledge about all available agents (it scans for .desktop files in the agent ...