aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-23 20:18:21 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-23 20:18:21 (GMT)
commita635753b302f754a27ea2ea911353b55e15e502e (patch)
tree8a8e534f5ebcfbd637812e4358f6ed499a65207f
parent231f78a0cb7049da9ceea92e8a1c923ed7cbd133 (diff)
apply RecentFilesMaxCount to m_fileOpenRecent
-rw-r--r--kate/src/kateconfigdialog.cpp9
-rw-r--r--kate/src/kateconfigdialog.h8
-rw-r--r--kate/src/katemainwindow.cpp6
-rw-r--r--kate/src/ui/sessionconfigwidget.ui2
4 files changed, 22 insertions, 3 deletions
diff --git a/kate/src/kateconfigdialog.cpp b/kate/src/kateconfigdialog.cpp
index 338c1c8..436d131 100644
--- a/kate/src/kateconfigdialog.cpp
+++ b/kate/src/kateconfigdialog.cpp
@@ -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;
+}
+
diff --git a/kate/src/kateconfigdialog.h b/kate/src/kateconfigdialog.h
index b34e310..469ca0b 100644
--- a/kate/src/kateconfigdialog.h
+++ b/kate/src/kateconfigdialog.h
@@ -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);
diff --git a/kate/src/katemainwindow.cpp b/kate/src/katemainwindow.cpp
index 3df5361..9ff515c 100644
--- a/kate/src/katemainwindow.cpp
+++ b/kate/src/katemainwindow.cpp
@@ -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;
diff --git a/kate/src/ui/sessionconfigwidget.ui b/kate/src/ui/sessionconfigwidget.ui
index 021d99a..6890ea4 100644
--- a/kate/src/ui/sessionconfigwidget.ui
+++ b/kate/src/ui/sessionconfigwidget.ui
@@ -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>