Exemple #1
0
Fichier : p3.cs Projet : KDE/kimono
    public static int Main(String[] args)
    {
        KAboutData about = new KAboutData("p3", "Tutorial - p3", KDE.Ki18n(""), "0.1");
        KCmdLineArgs.Init(args, about);
        KApplication a = new KApplication();
        MainWindow window = new MainWindow("Tutorial - p3");
        window.Resize(400, 300);
        window.Show();

        return KApplication.Exec();
    }
Exemple #2
0
Fichier : p2.cs Projet : KDE/kimono
    public static int Main(String[] args)
    {
        KAboutData about = new KAboutData("p2", "Hello World", KDE.Ki18n(""), "0.1");
        KCmdLineArgs.Init(args, about);
        KApplication a = new KApplication();
        QPushButton hello = new QPushButton(KDE.I18n("Hello World !"), null);

        a.SetTopWidget(hello);
        hello.Show();

        return KApplication.Exec();
    }
Exemple #3
0
    public static int Main(String[] args)
    {
        KAboutData about = new KAboutData("editor", "Text Editor Example", KDE.Ki18n(""), "0.1");
        KCmdLineArgs.Init(args, about);
        KApplication a = new KApplication();

        KParts.MainWindow w = new KParts.MainWindow(null, 0);

        KTextEditor.Editor editor = KTextEditor.Global.Editor("katepart");

        //      other possibility
        //      KTextEditor.Editor editor = KTextEditor.EditorChooser.Editor();
        editor.SetSimpleMode(true);
        KTextEditor.Document doc = editor.CreateDocument(w);
        KTextEditor.View view = doc.CreateView(w);
        w.SetCentralWidget(view);
        doc.SetText("Here is some text..");
        w.Show();

        return KApplication.Exec();
    }
Exemple #4
0
Fichier : p5.cs Projet : KDE/kimono
    public static int Main(String[] args)
    {
        KAboutData about = new KAboutData("p5", "Tutorial - p5", KDE.Ki18n(""), "0.1");
        KCmdLineArgs.Init(args, about);
        KApplication a = new KApplication();

        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;
        }

        MainWindow window = new MainWindow("Tutorial - p5");
        window.Resize(300, 200);
        window.Show();

        return KApplication.Exec();
    }
Exemple #5
0
    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();
    }