[Kde-bindings] KDE/kdebindings

Arno Rehn kde at arnorehn.de
Sun Aug 3 18:03:12 UTC 2008


SVN commit 841631 by arnorehn:

* Implemented KUrl.List.

CCMAIL: kde-bindings at kde.org



 M  +4 -0      csharp/kimono/ChangeLog  
 M  +1 -93     csharp/kimono/kde/KUrl.cs  
 A             csharp/kimono/kde/KUrlExtras.cs  
 M  +64 -0     csharp/kimono/src/kimono.cpp  
 M  +7 -6      kalyptus/kalyptusCxxToKimono.pm  


--- trunk/KDE/kdebindings/csharp/kimono/ChangeLog #841630:841631
@@ -1,3 +1,7 @@
+2008-08-03  Arno Rehn  <arno at arnorehn.de>
+
+	* Implemented KUrl.List.
+
 2008-07-31  Arno Rehn  <arno at arnorehn.de>
 
 	* Assign a new KApplication instance to the qApp global variable.
--- trunk/KDE/kdebindings/csharp/kimono/kde/KUrl.cs #841630:841631
@@ -3,7 +3,6 @@
     using System;
     using Qyoto;
     using System.Runtime.InteropServices;
-    using System.Text;
     using System.Collections.Generic;
     /// <remarks>
     ///  \class KUrl kurl.h <KUrl>
@@ -65,99 +64,8 @@
     ///  context.
     ///  </remarks>        <short>    \class KUrl kurl.</short>
     [SmokeClass("KUrl")]
-    public class KUrl : QUrl, IDisposable {
+    public partial class KUrl : QUrl, IDisposable {
         protected KUrl(Type dummy) : base((Type) null) {}
-        /// <remarks>
-        ///  \class List kurl.h <KUrl>
-        ///  KUrl.List is a QList that contains KUrls with a few
-        ///  convenience methods.
-        /// </remarks>        <short>    \class List kurl.</short>
-        ///         <see> KUrl</see>
-        ///         <see> QList</see>
-        [SmokeClass("KUrl::List")]
-        public class List : Object {
-            protected SmokeInvocation interceptor = null;
-            private IntPtr smokeObject;
-            protected List(Type dummy) {}
-            protected void CreateProxy() {
-                interceptor = new SmokeInvocation(typeof(List), this);
-            }
-            private static SmokeInvocation staticInterceptor = null;
-            static List() {
-                staticInterceptor = new SmokeInvocation(typeof(List), null);
-            }
-            //  List(); >>>> NOT CONVERTED
-            //  List(const KUrl& arg1); >>>> NOT CONVERTED
-            //  List(const QStringList& arg1); >>>> NOT CONVERTED
-            //  List(); >>>> NOT CONVERTED
-            //  operator QVariant(); >>>> NOT CONVERTED
-            // void populateMimeData(,,); >>>> NOT CONVERTED
-            // KUrl::List fromMimeData(,); >>>> NOT CONVERTED
-            /// <remarks>
-            ///  Creates an empty List.
-            ///      </remarks>        <short>    Creates an empty List.</short>
-            /// <remarks>
-            ///  Creates a list that contains the given URL as only
-            ///  item.
-            /// <param> name="url" the url to add.
-            ///        </param></remarks>        <short>    Creates a list that contains the given URL as only  item.</short>
-            /// <remarks>
-            ///  Creates a list that contains the URLs from the given
-            ///  list of strings.
-            /// <param> name="list" the list containing the URLs as strings
-            ///        </param></remarks>        <short>    Creates a list that contains the URLs from the given  list of strings.</short>
-            /// <remarks>
-            ///  Creates a list that contains the URLs from the given QList<KUrl>.
-            /// <param> name="list" the list containing the URLs
-            ///        </param></remarks>        <short>    Creates a list that contains the URLs from the given QList<KUrl>.</short>
-            /// <remarks>
-            ///  Converts the URLs of this list to a list of strings.
-            /// </remarks>        <return> the list of strings
-            ///        </return>
-            ///         <short>    Converts the URLs of this list to a list of strings.</short>
-            public List<string> ToStringList() {
-                return (List<string>) interceptor.Invoke("toStringList", "toStringList() const", typeof(List<string>));
-            }
-            /// <remarks>
-            ///  Converts this KUrl.List to a QVariant, this allows to use KUrl.List
-            ///  in QVariant() constructor
-            ///        </remarks>        <short>    Converts this KUrl.List to a QVariant, this allows to use KUrl.List  in QVariant() constructor        </short>
-            /// <remarks>
-            ///  Adds URLs data into the given QMimeData.
-            ///  By default, populateMimeData also exports the URLs as plain text, for e.g. dropping
-            ///  onto a text editor.
-            ///  But in some cases this might not be wanted, e.g. if adding other mime data
-            ///  which provides better plain text data.
-            ///  WARNING: do not call this method multiple times on the same mimedata object,
-            ///  you can add urls only once. But you can add other things, e.g. images, XML...
-            /// <param> name="mimeData" the QMimeData instance used to drag or copy this URL
-            /// </param><param> name="metaData" KIO metadata shipped in the mime data, which is used for instance to
-            ///  set a correct HTTP referrer (some websites require it for downloading e.g. an image)
-            /// </param><param> name="flags" set NoTextExport to prevent setting plain/text data into <code>mimeData</code>
-            ///  In such a case, setExportAsText( false ) should be called.
-            ///        </param></remarks>        <short>    Adds URLs data into the given QMimeData.</short>
-            /// <remarks>
-            ///  Return true if <code>mimeData</code> contains URI data
-            ///        </remarks>        <short>    Return true if <code>mimeData</code> contains URI data        </short>
-            public static bool CanDecode(QMimeData mimeData) {
-                return (bool) staticInterceptor.Invoke("canDecode#", "canDecode(const QMimeData*)", typeof(bool), typeof(QMimeData), mimeData);
-            }
-            /// <remarks>
-            ///  Return the list of mimeTypes that can be decoded by fromMimeData
-            ///         </remarks>        <short>    Return the list of mimeTypes that can be decoded by fromMimeData         </short>
-            public static List<string> MimeDataTypes() {
-                return (List<string>) staticInterceptor.Invoke("mimeDataTypes", "mimeDataTypes()", typeof(List<string>));
-            }
-            /// <remarks>
-            ///  Extract a list of KUrls from the contents of <code>mimeData.</code>
-            ///  Decoding will fail if <code>mimeData</code> does not contain any URLs, or if at
-            ///  least one extracted URL is not valid.
-            /// <param> name="mimeData" the mime data to extract from; cannot be 0
-            /// </param><param> name="metaData" optional pointer to a map holding the metadata
-            /// </param></remarks>        <return> the list of urls
-            ///        </return>
-            ///         <short>    Extract a list of KUrls from the contents of <code>mimeData.</code></short>
-        }
         protected new void CreateProxy() {
             interceptor = new SmokeInvocation(typeof(KUrl), this);
         }
--- trunk/KDE/kdebindings/csharp/kimono/src/kimono.cpp #841630:841631
@@ -28,6 +28,11 @@
 #include <smoke/qt_smoke.h>
 #include <smoke/kde_smoke.h>
 
+#include <QMimeData>
+#include <QStringList>
+
+#include <KUrl>
+
 QHash<int, char*> classNames;
 
 const char *
@@ -47,6 +52,65 @@
 
 extern "C" {
 
+typedef bool (*GetNextDictionaryEntryFn)(void** key, void** value);
+
+Q_DECL_EXPORT void
+KUrlListPopulateMimeData(NoArgs getNextItem, void* mimeData,
+	GetNextDictionaryEntryFn getNextDictionaryEntry, uint flags)
+{
+	QMimeData* md = (QMimeData*) ((smokeqyoto_object*) (*GetSmokeObject)(mimeData))->ptr;
+	(*FreeGCHandle)(mimeData);
+	KUrl::List list;
+	for (void* handle = (*getNextItem)(); handle; handle = (*getNextItem)()) {
+		list.append(*(KUrl*) ((smokeqyoto_object*) (*GetSmokeObject)(mimeData))->ptr);
+		(*FreeGCHandle)(handle);
+	}
+	QMap<QString, QString> map;
+	for (void *key = 0, *value = 0; getNextDictionaryEntry(&key, &value); ) {
+		QString k = QString::fromUtf8((char*) (*IntPtrToCharStar)(key));
+		QString v = QString::fromUtf8((char*) (*IntPtrToCharStar)(value));
+		map.insert(k, v);
+		(*FreeGCHandle)(key);
+		(*FreeGCHandle)(value);
+	}
+	list.populateMimeData(md, map, (KUrl::MimeDataFlags) flags);
+}
+
+Q_DECL_EXPORT void
+KUrlListMimeDataTypes(FromIntPtr addfn)
+{
+	foreach(QString str, KUrl::List::mimeDataTypes())
+		(*addfn)((*IntPtrFromQString)(&str));
+}
+
+Q_DECL_EXPORT bool
+KUrlListCanDecode(void* mimeData)
+{
+	QMimeData* md = (QMimeData*) ((smokeqyoto_object*) (*GetSmokeObject)(mimeData))->ptr;
+	(*FreeGCHandle)(mimeData);
+	return KUrl::List::canDecode(md);
+}
+
+Q_DECL_EXPORT void
+KUrlListFromMimeData(FromIntPtr addfn, void* mimeData, GetNextDictionaryEntryFn getNextDictionaryEntry)
+{
+	QMimeData* md = (QMimeData*) ((smokeqyoto_object*) (*GetSmokeObject)(mimeData))->ptr;
+	(*FreeGCHandle)(mimeData);
+	QMap<QString, QString> map;
+	for (void *key = 0, *value = 0; getNextDictionaryEntry(&key, &value); ) {
+		QString k = QString::fromUtf8((char*) (*IntPtrToCharStar)(key));
+		QString v = QString::fromUtf8((char*) (*IntPtrToCharStar)(value));
+		map.insert(k, v);
+		(*FreeGCHandle)(key);
+		(*FreeGCHandle)(value);
+	}
+	Smoke::Index id = kde_Smoke->idClass("KUrl").index;
+	foreach(KUrl url, KUrl::List::fromMimeData(md, (map.size() > 0)? &map : 0)) {
+		smokeqyoto_object *o = alloc_smokeqyoto_object(true, kde_Smoke, id, new KUrl(url));
+		(*addfn)((*CreateInstance)("Kimono.KUrl", o));
+	}
+}
+
 extern Q_DECL_EXPORT void Init_kimono();
 
 static Qyoto::Binding binding;
--- trunk/KDE/kdebindings/kalyptus/kalyptusCxxToKimono.pm #841630:841631
@@ -180,6 +180,7 @@
    'KTextEditor::CodeCompletionModel' => '1',
    'KTextEditor::Document' => '1',
    'KTextEditor::Factory' => '1',
+   'KUrl' => '1',
    'QAbstractItemModel' => '1',
    'QApplication' => '1',
    'QBrush' => '1',
@@ -1567,12 +1568,12 @@
 
 	# only generate nested classes
 	if ($node->{NodeType} ne 'namespace') {
-		Iter::MembersByType ( $node, undef,
-			sub {	my ($node, $subclassNode ) = @_;
-				if ( $subclassNode->{NodeType} =~ /class|struct/ && !defined $subclassNode->{Compound} ) {
-					$classCode .= generateClass($subclassNode, $packagename, $namespace, $indent . "    ", $addImport);
-				}
-			}, undef );
+# 		Iter::MembersByType ( $node, undef,
+# 			sub {	my ($node, $subclassNode ) = @_;
+# 				if ( $subclassNode->{NodeType} =~ /class|struct/ && !defined $subclassNode->{Compound} ) {
+# 					$classCode .= generateClass($subclassNode, $packagename, $namespace, $indent . "    ", $addImport);
+# 				}
+# 			}, undef );
 	
 		Iter::MembersByType ( $node, undef,
 			sub {	my ($node, $subclassNode ) = @_;



More information about the Kde-bindings mailing list