[Kde-bindings] KDE/kdebindings/csharp/ktexteditor
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Sat Jul 26 17:11:36 UTC 2008
SVN commit 838086 by rdale:
* Fix some issues with the KWrite example
* SetXmlFile() was being given the wrong filename, which meant that the
menus and menu option were in the wrong order
* The Connect() to the close app slot was wrong
* Fixed the loop to open files via their urls from the open file dialog
* A KIO.NetAccess.Exists() call crashes and needed to be commented out
* KCmdLineArgs parsing is borked, and the code to do that is skipped at
at the moment
* In Qyoto the CreateInstance() method doesn't work with nested classes
as they are wrongly named. For instance,
Kimono.KEncodingFileDialog.Result should be passed as
Kimono.KEncodingFileDialog+Result because nested classes have '+'s
rather than '.'s. So the start up code for a Qyoto module needs to use
C# reflection to get each C# class and obtain the corresponding Smoke
class and put them in the lookup map.
CCMAIL: kde-bindings at kde.org
M +25 -7 ChangeLog
A examples/kwrite/kwrite-sharp.desktop
A examples/kwrite/kwrite-sharpui.rc
M +20 -13 examples/kwrite/kwritemain.cs
--- trunk/KDE/kdebindings/csharp/ktexteditor/ChangeLog #838085:838086
@@ -1,3 +1,21 @@
+2008-07-26 Richard Dale <richard.j.dale at gmail.com>
+
+* Fix some issues with the KWrite example
+ * SetXmlFile() was being given the wrong filename, which meant that the
+ menus and menu option were in the wrong order
+ * The Connect() to the close app slot was wrong
+ * Fixed the loop to open files via their urls from the open file dialog
+ * A KIO.NetAccess.Exists() call crashes and needed to be commented out
+ * KCmdLineArgs parsing is borked, and the code to do that is skipped at
+ at the moment
+ * In Qyoto the CreateInstance() method doesn't work with nested classes
+ as they are wrongly named. For instance,
+ Kimono.KEncodingFileDialog.Result should be passed as
+ Kimono.KEncodingFileDialog+Result because nested classes have '+'s
+ rather than '.'s. So the start up code for a Qyoto module needs to use
+ C# reflection to get each C# class and obtain the corresponding Smoke
+ class and put them in the lookup map.
+
2008-07-25 Richard Dale <richard.j.dale at gmail.com>
* Add a port of the KWrite shell to C#
@@ -2,8 +20,8 @@
* There are some problems to be solved:
- * Accessing some functionality requires qobject_cast<>'s
- * How should mono KDE apps be installed? Should they be installed into
- the bin dir, or they should they be started from a C++ shell like Ruby
- KDE apps?
- * Couldn't see how to convert this call:
- QTextStream input(stdin, QIODevice::ReadOnly);
- * The KUrl.List class needs more work to be usuable with drag and drop
\ No newline at end of file
+ * Accessing some functionality requires qobject_cast<>'s
+ * How should mono KDE apps be installed? Should they be installed into
+ the bin dir, or they should they be started from a C++ shell like Ruby
+ KDE apps?
+ * Couldn't see how to convert this call:
+ QTextStream input(stdin, QIODevice::ReadOnly);
+ * The KUrl.List class needs more work to be usuable with drag and drop
--- trunk/KDE/kdebindings/csharp/ktexteditor/examples/kwrite/kwritemain.cs #838085:838086
@@ -47,7 +47,7 @@
private QPixmap m_modmodPm;
private QPixmap m_noPm;
- KWrite() : this(null) {}
+ KWrite() : this((KTextEditor.Document) null) {}
KWrite(KTextEditor.Document doc) : base(null, 0) {
if (doc == null) {
@@ -92,7 +92,7 @@
AcceptDrops = true;
Connect(m_view, SIGNAL("dropEventPass(QDropEvent *)"), this, SLOT("SlotDropEvent(QDropEvent *)"));
- SetXMLFile("kwriteui.rc");
+ SetXMLFile("kwrite-sharpui.rc");
CreateShellGUI(true);
GuiFactory().AddClient(m_view);
@@ -145,7 +145,7 @@
Connect(a, SIGNAL("triggered()"), this, SLOT("NewView()"));
a.WhatsThis = KDE.I18n("Create another view containing the current document");
- ActionCollection().AddAction(KStandardAction.StandardAction.Quit, this, SLOT("Close()"))
+ ActionCollection().AddAction(KStandardAction.StandardAction.Quit, this, SLOT("close()"))
.WhatsThis = KDE.I18n("Close the current document view");
// setup Settings menu
@@ -246,20 +246,21 @@
this,
KDE.I18n("Open File") );
-// for (KUrl.List.Iterator i=r.URLs.begin(); i != r.URLs.end(); ++i) {
-// encoding = r.encoding;
-// slotOpen(i);
-// }
+ foreach (KUrl url in r.URLs) {
+ encoding = r.Encoding;
+ SlotOpen(url);
+ }
+
}
[Q_SLOT("SlotOpen(KUrl)")]
public void SlotOpen(KUrl url) {
if (url.IsEmpty()) return;
- if (!KIO.NetAccess.Exists(url, KIO.NetAccess.StatSide.SourceSide, this)) {
- KMessageBox.Error(this, KDE.I18n("The file given could not be read; check whether it exists or is readable for the current user."));
- return;
- }
+// if (!KIO.NetAccess.Exists(url, KIO.NetAccess.StatSide.SourceSide, this)) {
+// KMessageBox.Error(this, KDE.I18n("The file given could not be read; check whether it exists or is readable for the current user."));
+// return;
+// }
if (m_view.Document().IsModified() || !m_view.Document().Url.IsEmpty()) {
KWrite t = new KWrite();
@@ -630,6 +631,7 @@
KCmdLineArgs.AddCmdLineOptions(options);
KApplication a = new KApplication();
+
KGlobal.Locale().InsertCatalog("katepart4");
KCmdLineArgs args = KCmdLineArgs.ParsedArgs();
@@ -639,20 +641,25 @@
bool nav = false;
int line = 0, column = 0;
+ // The code below that uses KCmdLineArgs doesn't work, so avoid it for now
+ KWrite t2 = new KWrite();
+ return KApplication.Exec();
+
QTextCodec codec = args.IsSet("encoding") ? QTextCodec.CodecForName(args.GetOption("encoding")) : null;
+
if (args.IsSet("line")) {
line = System.Convert.ToInt32(args.GetOption("line")) - 1;
nav = true;
}
- if (args.IsSet ("column")) {
+ if (args.IsSet("column")) {
column = System.Convert.ToInt32(args.GetOption("column")) - 1;
nav = true;
}
if (args.Count() == 0) {
- KWrite t = new KWrite();
+ KWrite t = new KWrite((KTextEditor.Document) null);
if (args.IsSet("stdin")) {
// FIXME: the first argument should be stdin here
More information about the Kde-bindings
mailing list