Exemple #1
0
    //common config
    public void ReadConfig(KSharedConfig config)
    {
        KConfigGroup cfg = new KConfigGroup(config, "General Options");

        m_showStatusBar.Checked = cfg.ReadEntry("ShowStatusBar", true);
        m_showPath.Checked = cfg.ReadEntry("ShowPath", false);

        m_recentFiles.LoadEntries(config.Group("Recent Files"));

        m_view.Document().Editor().ReadConfig(config);

        if (m_showStatusBar.Checked) {
            StatusBar().Show();
        } else {
            StatusBar().Hide();
        }
    }
Exemple #2
0
Fichier : p9.cs Projet : KDE/kimono
    public Browser(string name)
        : base((QWidget) null)
    {
        ObjectName = name;
        SetCaption("KDE Tutorial - p9");

        QMenu filemenu = new QMenu(KDE.I18n("&File"), this);

        KAction setDefaultPageAction = new KAction(this);
        setDefaultPageAction.Text = KDE.I18n("&Set default page");
        ActionCollection().AddAction("set_default_page", setDefaultPageAction);
        Connect(	setDefaultPageAction, SIGNAL("triggered(bool)"),
                    this, SLOT("FileSetDefaultPage()") );

        addBookmarkAction = KStandardAction.AddBookmark(this, SLOT("BookLocation()"), ActionCollection());
        backAction = KStandardAction.Back(this, SLOT("GotoPreviousPage()"), ActionCollection());
        backAction.Enabled = false;
        quitAction = KStandardAction.Quit(KApplication.kApplication(), SLOT("quit()"), ActionCollection());

        string about = KDE.I18n("p9 1.0\n\n" +
                 "(C) 1999-2002 Antonio Larrosa Jimenez\n" +
                 "[email protected]\t\[email protected]\n" +
                 "Malaga (Spain)\n\n" +
                 "Simple KDE Tutorial\n" +
                 "This tutorial comes with ABSOLUTELY NO WARRANTY\n" +
                 "This is free software, and you are welcome to redistribute it\n" +
                 "under certain conditions\n");
        QMenu helpmenu = HelpMenu(about);

        KMenuBar menu = MenuBar();
        menu.AddMenu(filemenu);
        menu.AddSeparator();
        menu.AddMenu(helpmenu);

        ToolBar().AddAction(quitAction);
        ToolBar().AddAction(addBookmarkAction);
        ToolBar().AddAction(backAction);
        StandardToolBarMenuEnabled = true;

        location = new QLineEdit();
        config = new KConfigGroup(KGlobal.Config(), "Settings");
        location.Text = config.ReadEntry("defaultPage", "http://localhost");

        Connect(location, SIGNAL("returnPressed()"), this, SLOT("ChangeLocation()"));

        QSplitter split = new QSplitter();
        split.OpaqueResize = true;

        QWidget widget = new QWidget(this);

        QVBoxLayout vbox = new QVBoxLayout(widget);
        vbox.AddWidget(location);
        vbox.AddWidget(split);

        browser = new KHTMLPart(split);
        browser.OpenUrl(new KUrl(location.Text));

        Connect( browser.BrowserExtension(),
                 SIGNAL("openUrlRequest(KUrl, KParts::OpenUrlArguments)"),
                 this, SLOT("OpenUrlRequest(KUrl, KParts::OpenUrlArguments)") );

        SetCentralWidget(widget);
        SetupGUI();
    }
Exemple #3
0
    //restore session
    public static void Restore()
    {
        KConfig config = KApplication.kApplication().SessionConfig();

        if (config == null) {
            return;
        }

        KTextEditor.Editor editor = KTextEditor.EditorChooser.Editor();

        if (editor == null) {
            KMessageBox.Error(null, KDE.I18n("A KDE text-editor component could not be found;\n" +
                                  "please check your KDE installation."));
            QCoreApplication.Exit(1);
        }

        // simple mode
        editor.SetSimpleMode(true);

        int docs, windows;
        string buf;
        KTextEditor.Document doc;
        KWrite t;

        KConfigGroup numberConfig = new KConfigGroup(config, "Number");
        docs = numberConfig.ReadEntry("NumberOfDocuments", 0);
        windows = numberConfig.ReadEntry("NumberOfWindows", 0);

        for (int z = 1; z <= docs; z++) {
            buf = "Document " + z.ToString();
            KConfigGroup cg = new KConfigGroup(config, buf);
            doc = editor.CreateDocument(null);

            KTextEditor.SessionConfigInterface iface = qobject_cast<KTextEditor.SessionConfigInterface>(doc);
            if (iface != null)
                iface.ReadSessionConfig(cg);
            docList.Add(doc);
        }

        for (int z = 1; z <= windows; z++) {
            buf = "Window " + z;
            KConfigGroup cg = new KConfigGroup(config, buf);
            t = new KWrite(docList[cg.ReadEntry("DocumentNumber", 0) - 1]);
            t.Restore(config, z);
        }
    }