summaryrefslogtreecommitdiffstats
path: root/kommander/widget/invokeclass.cpp
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
commite9ae80694875f869892f13f4fcaf1170a00dea41 (patch)
treeaa2f8d8a217e2d376224c8d46b7397b68d35de2d /kommander/widget/invokeclass.cpp
downloadtdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz
tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.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/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/widget/invokeclass.cpp')
-rw-r--r--kommander/widget/invokeclass.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/kommander/widget/invokeclass.cpp b/kommander/widget/invokeclass.cpp
new file mode 100644
index 00000000..b5de4678
--- /dev/null
+++ b/kommander/widget/invokeclass.cpp
@@ -0,0 +1,61 @@
+//
+// C++ Interface: invokeclass
+//
+// Description:
+//
+//
+// Author: Andras Mantia <[email protected]>, (C) 2008
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include "invokeclass.h"
+
+#include <qcolor.h>
+#include <qregexp.h>
+
+InvokeClass::InvokeClass(QObject *parent):QObject(parent)
+{
+ m_acceptedSlots = acceptedSlots();
+}
+
+void InvokeClass::invokeSlot(QObject *object, const QString& slot, QStringList args)
+{
+ QString invokeName = slot;
+ invokeName = invokeName.mid(invokeName.find('('));
+ invokeName.prepend(QString::number(QSIGNAL_CODE) + "invoke");
+ QString slotName = QString::number(QSLOT_CODE) + slot;
+ connect(this, invokeName.ascii(), object, slotName.ascii());
+
+ if (args.count() == 0)
+ emit invoke();
+ else
+ {
+ QString slotArgStr = slot.section(QRegExp("\\(|\\)"), 1);
+ uint argNum = slotArgStr.contains(',') + 1;
+ for (uint i = args.count(); i < argNum; i++)
+ args << "";
+ //poor man's invokeMetaObject
+ if (slotArgStr == m_acceptedSlots[0])
+ emit invoke(args[0]);
+ else if (slotArgStr == m_acceptedSlots[1])
+ emit invoke(args[0], args[1]);
+ else if (slotArgStr == m_acceptedSlots[2])
+ emit invoke(args[0].upper()=="TRUE" || args[0] =="1"? true : false);
+ else if (slotArgStr == m_acceptedSlots[3])
+ emit invoke(args[0].toInt());
+ else if (slotArgStr == m_acceptedSlots[4])
+ emit invoke(args[0].toInt(), args[1].toInt());
+ else if (slotArgStr == m_acceptedSlots[5])
+ emit invoke(args[0].toInt(), args[1].toInt(), args[2].toInt());
+ else if (slotArgStr == m_acceptedSlots[6])
+ emit invoke(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt());
+ else if (slotArgStr == m_acceptedSlots[7])
+ emit invoke(QColor(args[0]));
+ }
+
+ disconnect(this, invokeName.ascii(), object, slotName.ascii());
+}
+
+#include "invokeclass.moc"