fix packaging
[profile/ivi/mlite.git] / mremoteaction.h
1 /***************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (directui@nokia.com)
6 **
7 ** .
8 **
9 ** If you have questions regarding the use of this file, please contact
10 ** Nokia at directui@nokia.com.
11 **
12 ** This library is free software; you can redistribute it and/or
13 ** modify it under the terms of the GNU Lesser General Public
14 ** License version 2.1 as published by the Free Software Foundation
15 ** and appearing in the file LICENSE.LGPL included in the packaging
16 ** of this file.
17 **
18 ****************************************************************************/
19
20 #ifndef MREMOTEACTION_H_
21 #define MREMOTEACTION_H_
22
23 #include <MAction>
24 #include "mlite-global.h"
25
26 class MRemoteActionPrivate;
27
28 /*!
29  * \class MRemoteAction
30  *
31  * \brief MRemoteAction implements a MAction that executes a D-Bus call when triggered.
32  *        The D-Bus related parameters can be serialized and unserialized into a string.
33  */
34 class MLITESHARED_EXPORT MRemoteAction : public MAction
35 {
36     Q_OBJECT
37
38 public:
39     /*!
40      * \brief Constructs a MRemoteAction from a D-Bus service path, object path, interface and arguments.
41      *
42      * \param serviceName the service path of the D-Bus object to be called
43      * \param objectPath the object path of the D-Bus object to be called
44      * \param interface the interface of the D-Bus object to be called
45      * \param methodName the name of the D-Bus method to call
46      * \param arguments the arguments of the D-Bus call. Defaults to no arguments.
47      * \param parent Parent object
48      */
49     explicit MRemoteAction(const QString &serviceName, const QString &objectPath, const QString &interface, const QString &methodName, const QList<QVariant> &arguments = QList<QVariant>(), QObject *parent = NULL);
50
51     /*!
52      * \brief Constructs a MRemoteAction from a string representation of a D-Bus remote action acquired with toString().
53      *
54      * \param string the QString to construct the MRemoteAction from
55      * \param parent Parent object
56      */
57     explicit MRemoteAction(const QString &string = QString(), QObject *parent = NULL);
58
59     /*!
60      * \brief Constructs a copy of another MRemoteAction.
61      *
62      * \param action the MRemoteAction to copy
63      */
64     MRemoteAction(const MRemoteAction &action);
65
66     /*!
67      * \brief Destroys the MRemoteAction.
68      */
69     virtual ~MRemoteAction();
70
71     /*!
72      * Returns a string representation of this remote action.
73      *
74      * \return a string representation of this remote action
75      */
76     QString toString() const;
77
78 protected Q_SLOTS:
79     /*!
80      * \brief A slot for calling the D-Bus function when the action is triggered
81      */
82     void call();
83
84 protected:
85     /*!
86      * \brief Initializes the MRemoteAction from a string representation
87      *
88      * \param string a string representation of a remote action
89      */
90     void fromString(const QString &string);
91
92     //! \internal
93     MRemoteAction(MRemoteActionPrivate &dd, QObject *parent = NULL);
94     //! \internal_end
95
96 private:
97     Q_DECLARE_PRIVATE(MRemoteAction)
98 };
99
100 #endif /* MREMOTEACTION_H_ */