summaryrefslogtreecommitdiffstats
path: root/kdecore/kdcoppropertyproxy.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdecore/kdcoppropertyproxy.h
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/kdcoppropertyproxy.h')
-rw-r--r--kdecore/kdcoppropertyproxy.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/kdecore/kdcoppropertyproxy.h b/kdecore/kdcoppropertyproxy.h
new file mode 100644
index 000000000..97b5f6f73
--- /dev/null
+++ b/kdecore/kdcoppropertyproxy.h
@@ -0,0 +1,106 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef __kdcoppropertyproxy_h__
+#define __kdcoppropertyproxy_h__
+
+#include <qobject.h>
+#include <qcstring.h>
+#include <qvaluelist.h>
+#include "kdelibs_export.h"
+
+class KDCOPPropertyProxyPrivate;
+/**
+ * The KDCOPPropertyProxy class provides an easy way to publish Qt properties of a
+ * QObject through DCOP.
+ *
+ * The class provides DCOP equivalents for the Qt property methods setProperty() ,
+ * property() and propertyNames() and also provides automatic set/get methods for
+ * the properties of a QObject. That means for example if your object provides a
+ * QString property called foo , then KDCOPPropertyProxy translates DCOP calls
+ * "setFoo( QString )" and "QString foo()" automatically into the corresponding
+ * setProperty/property calls.
+ */
+class KDECORE_EXPORT KDCOPPropertyProxy
+{
+public:
+ /**
+ * Convenience constructor. Use it if you want to use this class as object, in contrary
+ * to using the static methods of this class and providing a QObject argument for each
+ * call.
+ */
+ KDCOPPropertyProxy( QObject *object );
+ /**
+ * Destructor.
+ */
+ ~KDCOPPropertyProxy();
+
+ /**
+ * Convenience method, when using this class as object. See documentation of the constructor and
+ * static isPropertyRequest method.
+ */
+ bool isPropertyRequest( const QCString &fun );
+
+ /**
+ * Convenience method, when using this class as object. See documentation of the constructor and
+ * static processPropertyRequest method.
+ */
+ bool processPropertyRequest( const QCString &fun, const QByteArray &data, QCString &replyType,
+ QByteArray &replyData );
+
+ /**
+ * Convenience method, when using this class as object. See documentation of the constructor and
+ * static functions method.
+ */
+ QValueList<QCString> functions();
+
+ /**
+ * Returns a semicolon-separated list of functions understood by the PropertyProxy for the given
+ * QObject argument.
+ *
+ * Returns "property(QCString);setProperty(QCString,QVariant);propertyNames();" plus set/get
+ * methods for the properties of the given object argument.
+ *
+ * @see DCOPObject::functions()
+ */
+ static QValueList<QCString> functions( QObject *object );
+
+ /**
+ * Returns true if the method request in the fun argument matches the signature of the three standard
+ * property methods or set/get methods for the properties of the object argument.
+ *
+ * Use this method in your own DCOPObject dispatcher to check if the DCOP request is a property
+ * request which can be handled by this class.
+ */
+ static bool isPropertyRequest( const QCString &fun, QObject *object );
+
+ /**
+ * Processes the given DCOP method request by translating the request into a setProperty/property call
+ * on the given QObject argument.
+ */
+ static bool processPropertyRequest( const QCString &fun, const QByteArray &data, QCString &replyType,
+ QByteArray &replyData, QObject *object );
+
+private:
+ static bool decodePropertyRequestInternal( const QCString &fun, QObject *object, bool &set,
+ QCString &propName, QCString &arg );
+
+ KDCOPPropertyProxyPrivate *d;
+};
+
+#endif