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
00069 { return m_operationsQueue.count(); }
00070 void clearOperationsQueue()
00071 { m_operationsQueue.clear(); }
00072
00073 void removeOperation(const char *name, bool removeAll = true);
00074
00075 bool queueContainsOperation(const char *name);
00076 void stopOperationsProcessing()
00077 { m_operationsStopped = true; }
00078
00079 static QByteArray normalizedOperationSignature(const char *operationName)
00080 { return QMetaObject::normalizedSignature(operationName); }
00081
00082 private:
00083 QObject *m_clientObject;
00084 const int m_maxNumberOfOperationParameters;
00085 QQueue<Operation *> m_operationsQueue;
00086 bool m_operationsStopped;
00087 };
00088
00089 }
00090
00091
00092
00093
00094
00095 #endif // DBUSOPERATIONQUEUEHANDLER_H