Commit 45755085 authored by Christoph Cullmann's avatar Christoph Cullmann

fix minimum size of the config dialog

kate part config pages are clever, just create them always, that allows to have reasonable dialog sizes
this is the 'proper' fix I guess
without the review request and hints there, this would not have been fixed!
thanks to Mikael Hermansson
REVIEW: 107925
parent c056f2aa
...@@ -132,7 +132,7 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, KTextEditor::View * ...@@ -132,7 +132,7 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, KTextEditor::View *
vbox->addWidget(metaInfos); vbox->addWidget(metaInfos);
buttonGroup->setLayout(vbox); buttonGroup->setLayout(vbox);
layout->addStretch(1); // :-] works correct without autoadd layout->addStretch(1); // :-] works correct without autoadd
//END General page //END General page
...@@ -157,7 +157,7 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, KTextEditor::View * ...@@ -157,7 +157,7 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, KTextEditor::View *
m_restoreVC->setChecked( cgGeneral.readEntry("Restore Window Configuration", true) ); m_restoreVC->setChecked( cgGeneral.readEntry("Restore Window Configuration", true) );
m_restoreVC->setWhatsThis( i18n("Check this if you want all your views and frames restored each time you open Kate")); m_restoreVC->setWhatsThis( i18n("Check this if you want all your views and frames restored each time you open Kate"));
connect( m_restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged()) ); connect( m_restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged()) );
vbox->addWidget(m_restoreVC); vbox->addWidget(m_restoreVC);
buttonGroup->setLayout(vbox); buttonGroup->setLayout(vbox);
...@@ -180,7 +180,7 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, KTextEditor::View * ...@@ -180,7 +180,7 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, KTextEditor::View *
connect(m_startNewSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(m_startNewSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
connect(m_loadLastUserSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(m_loadLastUserSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
connect(m_manuallyChooseSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(m_manuallyChooseSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
vbox->addWidget(m_startNewSessionRadioButton); vbox->addWidget(m_startNewSessionRadioButton);
vbox->addWidget(m_loadLastUserSessionRadioButton); vbox->addWidget(m_loadLastUserSessionRadioButton);
vbox->addWidget(m_manuallyChooseSessionRadioButton); vbox->addWidget(m_manuallyChooseSessionRadioButton);
...@@ -230,31 +230,15 @@ KateConfigDialog::~KateConfigDialog() ...@@ -230,31 +230,15 @@ KateConfigDialog::~KateConfigDialog()
void KateConfigDialog::addEditorPages() { void KateConfigDialog::addEditorPages() {
for (int i = 0; i < KateDocManager::self()->editor()->configPages (); ++i) for (int i = 0; i < KateDocManager::self()->editor()->configPages (); ++i)
{ {
KVBox *page = new KVBox(); QWidget *page = KateDocManager::self()->editor()->configPage(i, this);
page->setSpacing( -1 ); connect( page, SIGNAL(changed()), this, SLOT(slotChanged()) );
KPageWidgetItem *item=addSubPage( m_editorPage, page, KateDocManager::self()->editor()->configPageName(i) ); KPageWidgetItem *item=addSubPage( m_editorPage, page, KateDocManager::self()->editor()->configPageName(i) );
item->setHeader( KateDocManager::self()->editor()->configPageFullName(i) ); item->setHeader( KateDocManager::self()->editor()->configPageFullName(i) );
item->setIcon( KateDocManager::self()->editor()->configPageIcon(i) ); item->setIcon( KateDocManager::self()->editor()->configPageIcon(i) );
PluginPageListItem *info = new PluginPageListItem;
info->type=PluginPageListItem::Editor;
info->plugin = 0;
info->configPageInterface=0;
info->pageParent=page;
info->pluginPage = 0;
info->editorPage = 0; //info->configPageInterface->configPage (i, page);
info->idInPlugin=i;
info->pageWidgetItem = item;
//connect( info->page, SIGNAL(changed()), this, SLOT(slotChanged()) );
m_pluginPages.insert(item,info);
} }
} }
void KateConfigDialog::addPluginPage (Kate::Plugin *plugin) void KateConfigDialog::addPluginPage (Kate::Plugin *plugin)
...@@ -272,7 +256,6 @@ void KateConfigDialog::addPluginPage (Kate::Plugin *plugin) ...@@ -272,7 +256,6 @@ void KateConfigDialog::addPluginPage (Kate::Plugin *plugin)
item->setIcon( Kate::pluginConfigPageInterface(plugin)->configPageIcon(i)); item->setIcon( Kate::pluginConfigPageInterface(plugin)->configPageIcon(i));
PluginPageListItem *info = new PluginPageListItem; PluginPageListItem *info = new PluginPageListItem;
info->type=PluginPageListItem::Plugin;
info->plugin = plugin; info->plugin = plugin;
info->configPageInterface=Kate::pluginConfigPageInterface(plugin); info->configPageInterface=Kate::pluginConfigPageInterface(plugin);
info->pageParent=page; info->pageParent=page;
...@@ -291,17 +274,9 @@ void KateConfigDialog::slotCurrentPageChanged( KPageWidgetItem *current, KPageWi ...@@ -291,17 +274,9 @@ void KateConfigDialog::slotCurrentPageChanged( KPageWidgetItem *current, KPageWi
if (!info) return; if (!info) return;
if (info->pluginPage || info->editorPage) return; if (info->pluginPage || info->editorPage) return;
kDebug()<<"creating config page"; kDebug()<<"creating config page";
if (info->type==PluginPageListItem::Plugin) { info->pluginPage=info->configPageInterface->configPage(info->idInPlugin,info->pageParent);
info->pluginPage=info->configPageInterface->configPage(info->idInPlugin,info->pageParent); info->pluginPage->show();
info->pluginPage->show(); connect( info->pluginPage, SIGNAL(changed()), this, SLOT(slotChanged()) );
connect( info->pluginPage, SIGNAL(changed()), this, SLOT(slotChanged()) );
} else if (info->type==PluginPageListItem::Editor) {
info->editorPage = KateDocManager::self()->editor()->configPage(info->idInPlugin, info->pageParent);
info->editorPage->show();
connect( info->editorPage, SIGNAL(changed()), this, SLOT(slotChanged()) );
}
} }
void KateConfigDialog::removePluginPage (Kate::Plugin *plugin) void KateConfigDialog::removePluginPage (Kate::Plugin *plugin)
...@@ -316,7 +291,7 @@ void KateConfigDialog::removePluginPage (Kate::Plugin *plugin) ...@@ -316,7 +291,7 @@ void KateConfigDialog::removePluginPage (Kate::Plugin *plugin)
if (pli->plugin==plugin) if (pli->plugin==plugin)
remove.append(it.key()); remove.append(it.key());
} }
kDebug()<<remove.count(); kDebug()<<remove.count();
while (!remove.isEmpty()) { while (!remove.isEmpty()) {
KPageWidgetItem *wItem=remove.takeLast(); KPageWidgetItem *wItem=remove.takeLast();
...@@ -360,7 +335,7 @@ void KateConfigDialog::slotApply() ...@@ -360,7 +335,7 @@ void KateConfigDialog::slotApply()
cg.writeEntry("Modified Notification", m_modNotifications->isChecked()); cg.writeEntry("Modified Notification", m_modNotifications->isChecked());
m_mainWindow->modNotification = m_modNotifications->isChecked(); m_mainWindow->modNotification = m_modNotifications->isChecked();
// patch document modified warn state // patch document modified warn state
const QList<KTextEditor::Document*> &docs = KateDocManager::self()->documentList (); const QList<KTextEditor::Document*> &docs = KateDocManager::self()->documentList ();
foreach (KTextEditor::Document *doc, docs) foreach (KTextEditor::Document *doc, docs)
...@@ -383,7 +358,7 @@ void KateConfigDialog::slotApply() ...@@ -383,7 +358,7 @@ void KateConfigDialog::slotApply()
else if (plugin->editorPage) else if (plugin->editorPage)
plugin->editorPage->apply(); plugin->editorPage->apply();
} }
// write back the editor config // write back the editor config
KateDocManager::self()->editor()->writeConfig(config.data()); KateDocManager::self()->editor()->writeConfig(config.data());
......
...@@ -38,10 +38,6 @@ class KateMainWindow; ...@@ -38,10 +38,6 @@ class KateMainWindow;
struct PluginPageListItem struct PluginPageListItem
{ {
enum e_type{Editor=1,Plugin=2};
enum e_type type;
Kate::Plugin *plugin; Kate::Plugin *plugin;
Kate::PluginConfigPageInterface *configPageInterface; Kate::PluginConfigPageInterface *configPageInterface;
uint idInPlugin; uint idInPlugin;
...@@ -69,7 +65,7 @@ class KateConfigDialog : public KPageDialog ...@@ -69,7 +65,7 @@ class KateConfigDialog : public KPageDialog
void slotChanged(); void slotChanged();
void slotCurrentPageChanged( KPageWidgetItem *current, KPageWidgetItem *before ); void slotCurrentPageChanged( KPageWidgetItem *current, KPageWidgetItem *before );
private: private:
KateMainWindow *m_mainWindow; KateMainWindow *m_mainWindow;
...@@ -85,11 +81,11 @@ class KateConfigDialog : public KPageDialog ...@@ -85,11 +81,11 @@ class KateConfigDialog : public KPageDialog
QRadioButton *m_startNewSessionRadioButton; QRadioButton *m_startNewSessionRadioButton;
QRadioButton *m_loadLastUserSessionRadioButton; QRadioButton *m_loadLastUserSessionRadioButton;
QRadioButton *m_manuallyChooseSessionRadioButton; QRadioButton *m_manuallyChooseSessionRadioButton;
QHash<KPageWidgetItem*, PluginPageListItem*> m_pluginPages; QHash<KPageWidgetItem*, PluginPageListItem*> m_pluginPages;
KPageWidgetItem *m_applicationPage; KPageWidgetItem *m_applicationPage;
KPageWidgetItem *m_editorPage; KPageWidgetItem *m_editorPage;
void addEditorPages(); void addEditorPages();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment