Commit a635753b authored by Gregor Mi's avatar Gregor Mi

apply RecentFilesMaxCount to m_fileOpenRecent

parent 231f78a0
......@@ -150,7 +150,7 @@ KateConfigDialog::KateConfigDialog(KateMainWindow *parent, KTextEditor::View *vi
sessionConfigUi->restoreVC->setChecked( cgGeneral.readEntry("Restore Window Configuration", true) );
connect(sessionConfigUi->restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged()) );
sessionConfigUi->spinBoxRecentFilesCount->setValue(cgGeneral.readEntry("Recent File List Entry Count", 10));
sessionConfigUi->spinBoxRecentFilesCount->setValue(readRecentFilesMaxCount(config));
connect(sessionConfigUi->spinBoxRecentFilesCount, SIGNAL(valueChanged(int)), this, SLOT(slotChanged()));
QString sesStart (cgGeneral.readEntry ("Startup Session", "manual"));
......@@ -383,3 +383,10 @@ void KateConfigDialog::slotHelp()
{
QDesktopServices::openUrl(QUrl(QStringLiteral("help:/")));
}
int KateConfigDialog::readRecentFilesMaxCount(KSharedConfig::Ptr config)
{
int maxItems = KConfigGroup(config, "General").readEntry("Recent File List Entry Count", 10);
return maxItems;
}
......@@ -31,6 +31,7 @@
#include <KPageDialog>
#include <QList>
#include <KSharedConfig>
class QCheckBox;
class QSpinBox;
......@@ -55,6 +56,13 @@ class KateConfigDialog : public KPageDialog
public:
KateConfigDialog(KateMainWindow *parent, KTextEditor::View *view);
~KateConfigDialog();
public: // static
/**
* Reads the value from the given open config. If not present in config yet then
* the default value 10 is used.
*/
static int readRecentFilesMaxCount(KSharedConfig::Ptr config);
public:
void addPluginPage(KTextEditor::Plugin *plugin);
......
......@@ -277,6 +277,7 @@ void KateMainWindow::setupActions()
->setWhatsThis(i18n("Open an existing document for editing"));
m_fileOpenRecent = KStandardAction::openRecent(m_viewManager, SLOT(openUrl(QUrl)), this);
m_fileOpenRecent->setMaxItems(KateConfigDialog::readRecentFilesMaxCount(KSharedConfig::openConfig()));
actionCollection()->addAction(m_fileOpenRecent->objectName(), m_fileOpenRecent);
m_fileOpenRecent->setWhatsThis(i18n("This lists files which you have opened recently, and allows you to easily open them again."));
......@@ -723,7 +724,10 @@ void KateMainWindow::showPluginConfigPage(KTextEditor::ConfigPageInterface *conf
if (configpageinterface) {
dlg->showAppPluginPage(configpageinterface, id);
}
dlg->exec();
if (dlg->exec() == QDialog::Accepted) {
m_fileOpenRecent->setMaxItems(KateConfigDialog::readRecentFilesMaxCount(KSharedConfig::openConfig()));
}
delete dlg;
......
......@@ -32,7 +32,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Number of entries in recent file list:</string>
<string>Maximum number of entries in recent file list:</string>
</property>
<property name="buddy">
<cstring>spinBoxRecentFilesCount</cstring>
......
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