Exemple #1
0
void MainWindow::showConfigurationDialog()
{
    QPointer<KConfigDialog> dialog = new KConfigDialog(this, "settings", Settings::self());
    KTextEditor::Editor *editor = KTextEditor::Editor::instance();
    for (int index = 0; index < editor->configPages(); ++index) {
        KTextEditor::ConfigPage *page = editor->configPage(index, dialog);
        dialog->addPage(page,
            page->name(),
            page->icon().name(),
            page->fullName());
    }
    dialog->exec();
}
	void Config::setupEditor(KPageWidgetItem* parent)
	{
		m_editorSettingsChanged = false;
		m_editorPages.clear();

		KTextEditor::Editor* editor = m_ki->docManager()->getEditor();
		if(!editor) {
			return;
		}
		for(int i = 0; i < editor->configPages(); ++i) {
			KTextEditor::ConfigPage *configPage = editor->configPage(i, parent->widget());
			KPageWidgetItem *pageWidgetItem = addConfigPage(parent, configPage, configPage->name(),
			                                                                          configPage->icon(),
			                                                                          configPage->fullName());
			connect(configPage, &KTextEditor::ConfigPage::changed, this, [=] {
				m_editorSettingsChanged = true;
			});
			m_editorPages.insert(pageWidgetItem, configPage);
		}
	}