[Kde-bindings] KDE/kdebindings/csharp/kimono
Arno Rehn
kde at arnorehn.de
Fri Dec 26 01:31:11 UTC 2008
SVN commit 901573 by arnorehn:
* kimonopluginfactory.cpp: If the interface string doesn't appear to contain
a namespace, prepend 'Qyoto' or 'Kimono' depending on the letter the string
is starting with.
* kdehandlers.cpp: Add a marshaller for KService::List (which is a
QList<KSharedPtr<KService> >)
CCMAIL: kde-bindings at kde.org
M +8 -0 ChangeLog
M +45 -2 src/kdehandlers.cpp
M +13 -2 src/kimonopluginfactory.cpp
--- trunk/KDE/kdebindings/csharp/kimono/ChangeLog #901572:901573
@@ -1,3 +1,11 @@
+2008-12-26 Arno Rehn <arno at arnorehn.de>
+
+ * kimonopluginfactory.cpp: If the interface string doesn't appear to contain
+ a namespace, prepend 'Qyoto' or 'Kimono' depending on the letter the string
+ is starting with.
+ * kdehandlers.cpp: Add a marshaller for KService::List (which is a
+ QList<KSharedPtr<KService> >)
+
2008-12-23 Arno Rehn <arno at arnorehn.de>
* kimonopluginfactory.cpp: check for an existing root domain and reuse it.
--- trunk/KDE/kdebindings/csharp/kimono/src/kdehandlers.cpp #901572:901573
@@ -51,6 +51,49 @@
#include "marshall_macros_kde.h"
+void marshall_KServiceList(Marshall *m) {
+ switch(m->action()) {
+ case Marshall::FromObject:
+ {
+ }
+ break;
+ case Marshall::ToObject:
+ {
+ KService::List *offerList = (KService::List*)m->item().s_voidp;
+ if (!offerList) {
+ m->var().s_voidp = 0;
+ break;
+ }
+
+ void *av = (*ConstructList)("Kimono.KService");
+
+ for ( KService::List::Iterator it = offerList->begin();
+ it != offerList->end();
+ ++it )
+ {
+ KSharedPtr<KService> *ptr = new KSharedPtr<KService>(*it);
+ KService * currentOffer = ptr->data();
+
+ void *obj = (*GetInstance)(currentOffer, true);
+ if (obj == 0) {
+ smokeqyoto_object * o = alloc_smokeqyoto_object(false, m->smoke(), m->smoke()->idClass("KService").index, currentOffer);
+ obj = (*CreateInstance)("Kimono.KService", o);
+ }
+ (*AddIntPtrToList)(av, obj);
+ }
+
+ m->var().s_voidp = av;
+
+ if (m->cleanup())
+ delete offerList;
+ }
+ break;
+ default:
+ m->unsupported();
+ break;
+ }
+}
+
DEF_KSHAREDPTR_MARSHALLER(KSharedConfig, KSharedConfig)
DEF_KSHAREDPTR_MARSHALLER(KMimeType, KMimeType)
@@ -83,7 +126,6 @@
DEF_VALUELIST_MARSHALLER( KPluginInfoList, QList<KPluginInfo>, KPluginInfo )
DEF_VALUELIST_MARSHALLER( KServiceActionList, QList<KServiceAction>, KServiceAction )
DEF_VALUELIST_MARSHALLER( KServiceGroupPtrList, QList<KServiceGroup::Ptr>, KServiceGroup::Ptr )
-DEF_VALUELIST_MARSHALLER( KServicePtrList, QList<KService::Ptr>, KService::Ptr )
DEF_VALUELIST_MARSHALLER( KTimeZoneLeapSecondsList, QList<KTimeZone::LeapSeconds>, KTimeZone::LeapSeconds )
DEF_VALUELIST_MARSHALLER( KTimeZonePhaseList, QList<KTimeZone::Phase>, KTimeZone::Phase )
DEF_VALUELIST_MARSHALLER( KTimeZoneTransitionList, QList<KTimeZone::Transition>, KTimeZone::Transition )
@@ -143,7 +185,8 @@
{ "QList<KPluginInfo>&", marshall_KPluginInfoList },
{ "QList<KServiceAction>", marshall_KServiceActionList },
{ "QList<KServiceGroup::Ptr>", marshall_KServiceGroupPtrList },
- { "QList<KService::Ptr>", marshall_KServicePtrList },
+ { "QList<KService::Ptr>", marshall_KServiceList },
+ { "QList<KSharedPtr<KService> >", marshall_KServiceList },
{ "QList<KTimeZone::LeapSeconds>", marshall_KTimeZoneLeapSecondsList },
{ "QList<KTimeZone::LeapSeconds>&", marshall_KTimeZoneLeapSecondsList },
{ "QList<KTimeZone::Phase>", marshall_KTimeZonePhaseList },
--- trunk/KDE/kdebindings/csharp/kimono/src/kimonopluginfactory.cpp #901572:901573
@@ -232,9 +232,10 @@
QObject *parent, const QVariantList &args,
const QString &keyword)
{
- Q_UNUSED(iface);
Q_UNUSED(parentWidget);
+ kWarning() << "KimonoPluginFactory::create() iface:" << iface << "keyword:" << keyword;
+
// find the assembly
QString path = KStandardDirs::locate("data", keyword);
@@ -257,6 +258,8 @@
QByteArray className = KimonoPluginFactory::camelize(file.baseName().toLatin1());
MonoClass* klass = mono_class_from_name(image, nameSpace, className);
+ if (klass) kWarning() << "Found class" << nameSpace + "." + className;
+
MonoMethod* ctor = 0;
if (klass) {
// we want the Foo.Bar:.ctor(QObject, List<QVariant>)
@@ -265,7 +268,15 @@
ctor = mono_method_desc_search_in_class(desc, klass);
} else {
QString ifacestr(iface);
- ifacestr.replace("::", ".");
+ if (!ifacestr.contains("::")) {
+ if (ifacestr.startsWith('Q'))
+ ifacestr.prepend("Qyoto.");
+ else if (ifacestr.startsWith('K'))
+ ifacestr.prepend("Kimono.");
+ } else {
+ ifacestr.replace("::", ".");
+ }
+ kWarning() << "searching for iface" << ifacestr;
foreach(QByteArray name, assemblyGetClasses((const char*) path.toLatin1())) {
nameSpace = name.left(name.lastIndexOf("."));
className = name.right(name.size() - name.lastIndexOf(".") - 1);
More information about the Kde-bindings
mailing list