public static int Main(String[] args) { KAboutData aboutdata = new KAboutData( "p9", "Tutorial - p9", KDE.Ki18n(""), "1.0", KDE.Ki18n("Step 9 of a simple tutorial"), KAboutData.LicenseKey.License_GPL, KDE.Ki18n("(C) 2000, 2001 Antonio Larrosa Jimenez"), KDE.Ki18n(""), "http://devel-home.kde.org/~larrosa/tutorial.html" ); aboutdata.AddAuthor( KDE.Ki18n("Antonio Larrosa Jimenez"), KDE.Ki18n("Original Developer/Maintainer"), "*****@*****.**", "http://devel-home.kde.org/~larrosa/index.html" ); aboutdata.AddAuthor( KDE.Ki18n("Richard Dale"), KDE.Ki18n("C# port"), "*****@*****.**", "" ); KCmdLineArgs.Init(args, aboutdata); KUniqueApplication a = new KUniqueApplication(); if (!QDBusConnection.SessionBus().IsConnected()) { Console.Error.WriteLine("Cannot connect to the D-BUS session bus.\n" + "To start it, run:\n" + "\teval `dbus-launch --auto-syntax`\n"); return 1; } if (!QDBusConnection.SessionBus().RegisterService("org.kde.Browser")) { Console.Error.WriteLine("{0}", QDBusConnection.SessionBus().LastError().Message()); return 1; } Browser window = new Browser("Tutorial - p9"); window.Resize(300, 200); window.Show(); QDBusConnection.SessionBus().RegisterObject("/", window, (uint) QDBusConnection.RegisterOption.ExportAllSlots); return KApplication.Exec(); }
public static int Main(String[] argv) { KAboutData aboutData = new KAboutData( "kwrite-sharp", "Simple Text Editor", KDE.Ki18n("KWrite"), "4.1", // KDE.VersionString(), KDE.Ki18n("KWrite - Text Editor"), KAboutData.LicenseKey.License_LGPL_V2, KDE.Ki18n("(c) 2000-2005 The Kate Authors"), new KLocalizedString(), "http://www.kate-editor.org" ); aboutData.AddAuthor(KDE.Ki18n("Christoph Cullmann"), KDE.Ki18n("Maintainer"), "*****@*****.**", "http://www.babylon2k.de"); aboutData.AddAuthor(KDE.Ki18n("Anders Lund"), KDE.Ki18n("Core Developer"), "*****@*****.**", "http://www.alweb.dk"); aboutData.AddAuthor(KDE.Ki18n("Joseph Wenninger"), KDE.Ki18n("Core Developer"), "*****@*****.**","http://stud3.tuwien.ac.at/~e9925371"); aboutData.AddAuthor(KDE.Ki18n("Hamish Rodda"),KDE.Ki18n("Core Developer"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Dominik Haumann"), KDE.Ki18n("Developer & Highlight wizard"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Waldo Bastian"), KDE.Ki18n( "The cool buffersystem" ), "*****@*****.**" ); aboutData.AddAuthor(KDE.Ki18n("Charles Samuels"), KDE.Ki18n("The Editing Commands"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Matt Newell"), KDE.Ki18n("Testing, ..."), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Michael Bartl"), KDE.Ki18n("Former Core Developer"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Michael McCallum"), KDE.Ki18n("Core Developer"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Jochen Wilhemly"), KDE.Ki18n( "KWrite Author" ), "*****@*****.**" ); aboutData.AddAuthor(KDE.Ki18n("Michael Koch"),KDE.Ki18n("KWrite port to KParts"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Christian Gebauer"), new KLocalizedString(), "*****@*****.**" ); aboutData.AddAuthor(KDE.Ki18n("Simon Hausmann"), new KLocalizedString(), "*****@*****.**" ); aboutData.AddAuthor(KDE.Ki18n("Glen Parker"),KDE.Ki18n("KWrite Undo History, Kspell integration"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("Scott Manson"),KDE.Ki18n("KWrite XML Syntax highlighting support"), "*****@*****.**"); aboutData.AddAuthor(KDE.Ki18n("John Firebaugh"),KDE.Ki18n("Patches and more"), "*****@*****.**"); aboutData.AddCredit(KDE.Ki18n("Matteo Merli"),KDE.Ki18n("Highlighting for RPM Spec-Files, Perl, Diff and more"), "*****@*****.**"); aboutData.AddCredit(KDE.Ki18n("Rocky Scaletta"),KDE.Ki18n("Highlighting for VHDL"), "*****@*****.**"); aboutData.AddCredit(KDE.Ki18n("Yury Lebedev"),KDE.Ki18n("Highlighting for SQL")); aboutData.AddCredit(KDE.Ki18n("Chris Ross"),KDE.Ki18n("Highlighting for Ferite")); aboutData.AddCredit(KDE.Ki18n("Nick Roux"),KDE.Ki18n("Highlighting for ILERPG")); aboutData.AddCredit(KDE.Ki18n("Carsten Niehaus"), KDE.Ki18n("Highlighting for LaTeX")); aboutData.AddCredit(KDE.Ki18n("Per Wigren"), KDE.Ki18n("Highlighting for Makefiles, Python")); aboutData.AddCredit(KDE.Ki18n("Jan Fritz"), KDE.Ki18n("Highlighting for Python")); aboutData.AddCredit(KDE.Ki18n("Daniel Naber")); aboutData.AddCredit(KDE.Ki18n("Roland Pabel"),KDE.Ki18n("Highlighting for Scheme")); aboutData.AddCredit(KDE.Ki18n("Cristi Dumitrescu"),KDE.Ki18n("PHP Keyword/Datatype list")); aboutData.AddCredit(KDE.Ki18n("Carsten Pfeiffer"), KDE.Ki18n("Very nice help")); aboutData.AddCredit(KDE.Ki18n("Richard Dale"), KDE.Ki18n("C# port")); aboutData.AddCredit(KDE.Ki18n("All people who have contributed and I have forgotten to mention")); aboutData.SetProgramIconName("accessories-text-editor"); KCmdLineArgs.Init(argv, aboutData); KCmdLineOptions options = new KCmdLineOptions(); options.Add("stdin", KDE.Ki18n("Read the contents of stdin")); options.Add("encoding <argument>", KDE.Ki18n("Set encoding for the file to open")); options.Add("line <argument>", KDE.Ki18n("Navigate to this line")); options.Add("column <argument>", KDE.Ki18n("Navigate to this column")); options.Add("+[URL]", KDE.Ki18n("Document to open")); KCmdLineArgs.AddCmdLineOptions(options); KApplication kapp = new KApplication(); KGlobal.Locale().InsertCatalog("katepart4"); KCmdLineArgs args = KCmdLineArgs.ParsedArgs(); if (kapp.IsSessionRestored()) { KWrite.Restore(); } else { bool nav = false; int line = 0, column = 0; 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")) { column = System.Convert.ToInt32(args.GetOption("column")) - 1; nav = true; } if (args.Count() == 0) { KWrite t = new KWrite((KTextEditor.Document) null); if (args.IsSet("stdin")) { QTextStream input = new QTextStream(Console.OpenStandardInput()); // set chosen codec if (codec != null) input.SetCodec(codec); string inputLine; string text = ""; do { inputLine = input.ReadLine(); text += (inputLine + "\n"); } while (inputLine != null); KTextEditor.Document doc = t.View().Document(); if (doc != null) doc.SetText(text); } if (nav && t.View() != null) t.View().SetCursorPosition(new KTextEditor.Cursor(line, column)); } else { int docs_opened = 0; for ( int z = 0; z < args.Count(); z++ ) { // this file is no local dir, open it, else warn bool noDir = !args.Url(z).IsLocalFile() || !(new QDir(args.Url(z).Path())).Exists(); if (noDir) { ++docs_opened; KWrite t = new KWrite(); //if (codec != null) // t.View().Document().SetEncoding(codec.Name()); t.LoadURL(args.Url(z)); if (nav) t.View().SetCursorPosition(new KTextEditor.Cursor(line, column)); } else { KMessageBox.Sorry(null, KDE.I18n("The file " + args.Url(z).Url() + " could not be opened: it is not a normal file, it is a folder.")); } } if (docs_opened == 0) return 1; // see http://bugs.kde.org/show_bug.cgi?id=124708 } } // no window there, uh, ohh, for example borked session config !!! // create at least one !! if (KWrite.NoWindows()) new KWrite(); return KApplication.Exec(); }