[Kde-bindings] KDE/kdebindings/csharp

Arno Rehn kde at arnorehn.de
Sat Jul 26 19:56:44 UTC 2008


SVN commit 838125 by arnorehn:

* Use qobject_cast in the KWrite example.
* If CreateInstance() doesn't find a type, it now replaces the last '.'
  with a '+' and tries again to find nested classes.

CCMAIL: kde-bindings at kde.org



 M  +4 -0      ktexteditor/ChangeLog  
 M  +16 -12    ktexteditor/examples/kwrite/kwritemain.cs  
 M  +5 -0      qyoto/ChangeLog  
 M  +5 -0      qyoto/src/SmokeMarshallers.cs  


--- trunk/KDE/kdebindings/csharp/ktexteditor/ChangeLog #838124:838125
@@ -1,3 +1,7 @@
+2008-07-26  Arno Rehn  <arno at arnorehn.de>
+
+* Use qobject_cast in the KWrite example.
+
 2008-07-26  Richard Dale  <richard.j.dale at gmail.com>
 
 * Fix some issues with the KWrite example
--- trunk/KDE/kdebindings/csharp/ktexteditor/examples/kwrite/kwritemain.cs #838124:838125
@@ -65,8 +65,8 @@
             doc = editor.CreateDocument(null);
 
             // enable the modified on disk warning dialogs if any
-            //if (qobject_cast<KTextEditor::ModificationInterface *>(doc))
-            //    qobject_cast<KTextEditor::ModificationInterface *>(doc).setModifiedOnDiskWarning (true);
+            if (qobject_cast<KTextEditor.ModificationInterface>(doc) != null)
+                qobject_cast<KTextEditor.ModificationInterface>(doc).SetModifiedOnDiskWarning(true);
 
             docList.Add(doc);
         }
@@ -407,8 +407,9 @@
     private void ReadProperties(KSharedConfig config) {
         ReadConfig(config);
 
-        //if (KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(m_view))
-        //    iface.readSessionConfig(KConfigGroup(config, "General Options"));
+        KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(m_view);
+        if (iface != null)
+            iface.ReadSessionConfig(new KConfigGroup(config, "General Options"));
     }
 
     private void SaveProperties(KSharedConfig config) {
@@ -417,10 +418,11 @@
         KConfigGroup group = new KConfigGroup(config, "");
         group.WriteEntry("DocumentNumber", docList.IndexOf(m_view.Document()) + 1);
 
-        //if (KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(m_view)) {
-        //    KConfigGroup cg( config, "General Options" );
-        //    iface.writeSessionConfig(cg);
-        //}
+        KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(m_view);
+        if (iface != null) {
+            KConfigGroup cg = new KConfigGroup( config, "General Options" );
+            iface.WriteSessionConfig(cg);
+        }
     }
 
     private void SaveGlobalProperties(KConfig config) {
@@ -432,8 +434,9 @@
             KConfigGroup cg = new KConfigGroup(config, buf);
             KTextEditor.Document doc = docList[z - 1];
 
-            //if (KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(doc))
-            //    iface.writeSessionConfig(cg);
+            KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(doc);
+            if (iface != null)
+                iface.WriteSessionConfig(cg);
             z++;
         }
 
@@ -479,8 +482,9 @@
             KConfigGroup cg = new KConfigGroup(config, buf);
             doc = editor.CreateDocument(null);
 
-            //if (KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(doc))
-            //    iface.readSessionConfig(cg);
+            KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface >(doc);
+            if (iface != null)
+                iface.ReadSessionConfig(cg);
             docList.Add(doc);
         }
 
--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #838124:838125
@@ -1,3 +1,8 @@
+2008-07-26  Arno Rehn  <arno at arnorehn.de>
+
+	* If CreateInstance() doesn't find a type, it now replaces the last '.'
+	  with a '+' and tries again to find nested classes.
+
 2008-07-26  Richard Dale  <richard.j.dale at gmail.com>
 
 	* Look in all loaded Assemblies for types in lists that might not be in
--- trunk/KDE/kdebindings/csharp/qyoto/src/SmokeMarshallers.cs #838124:838125
@@ -533,6 +533,11 @@
 			}
 
 			if (data == null) {
+				if (className.Contains(".")) {
+					StringBuilder sb = new StringBuilder(className);
+					sb[className.LastIndexOf(".")] = '+';
+					return CreateInstance(sb.ToString(), smokeObjectPtr);
+				}
 				Console.Error.WriteLine("CreateInstance() ** Missing class ** {0}", className);
 			}
 



More information about the Kde-bindings mailing list