00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DBUSOPERATIONQUEUEHANDLER_H
00025 #define DBUSOPERATIONQUEUEHANDLER_H
00026
00027 #include <QQueue>
00028 #include <QDBusInterface>
00029
00030
00031 #define SIGNOND_NORMALIZE_METHOD_SIGNATURE(method) \
00032 DBusOperationQueueHandler::normalizedOperationSignature(method).data()
00033
00034
00035
00036
00037 namespace SignOn {
00038
00039 class DBusOperationQueueHandler
00040 {
00041 public:
00042 struct Operation
00043 {
00044 Operation(const char *name,
00045 QList<QGenericArgument *> args = QList<QGenericArgument *>());
00046 ~Operation();
00047
00048 inline bool operator==(const Operation &op) const
00049 { return QLatin1String(op.m_name) == m_name; }
00050
00051 char *m_name;
00052 QList<QGenericArgument *> m_args;
00053
00054 private:
00055 void copy(const char *name,
00056 const QList<QGenericArgument *> &args);
00057 };
00058
00059 public:
00060 DBusOperationQueueHandler(QObject *clientObject);
00061 ~DBusOperationQueueHandler();
00062
00063 void enqueueOperation(Operation *operation);
00064 void enqueueOperation(const char *name,
00065 QList<QGenericArgument *> args = QList<QGenericArgument *>());
00066
00067 void execQueuedOperations();
00068 int queuedOperationsCount() const { return m_operationsQueue.count(); }
00069 void clearOperationsQueue() { m_operationsQueue.clear(); }
00070
00071 void removeOperation(const char *name, bool removeAll = true);
00072
00073 bool queueContainsOperation(const char *name);
00074 void stopOperationsProcessing() { m_operationsStopped = true; }
00075
00076 static QByteArray normalizedOperationSignature(const char *operationName)
00077 { return QMetaObject::normalizedSignature(operationName); }
00078
00079 private:
00080 QObject *m_clientObject;
00081 const int m_maxNumberOfOperationParameters;
00082 QQueue<Operation *> m_operationsQueue;
00083 bool m_operationsStopped;
00084 };
00085
00086 }
00087
00088
00089
00090
00091
00092 #endif // DBUSOPERATIONQUEUEHANDLER_H