From d5f119e4308938947666c1e921862b83a5476020 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 7 Jan 2012 23:19:54 -0600 Subject: Restore Kate MRU list number-of-items configuration option This closes Bug 244 --- kate/app/kateconfigdialog.cpp | 25 +++++++++++++++++++++++++ kate/app/kateconfigdialog.h | 2 ++ kate/app/katemainwindow.cpp | 1 + 3 files changed, 28 insertions(+) (limited to 'kate') diff --git a/kate/app/kateconfigdialog.cpp b/kate/app/kateconfigdialog.cpp index 5e9ec2fb8..1433d95be 100644 --- a/kate/app/kateconfigdialog.cpp +++ b/kate/app/kateconfigdialog.cpp @@ -112,11 +112,32 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, Kate::View *view ) TQWhatsThis::add(cb_fullPath,i18n("If this option is checked, the full document path will be shown in the window caption.")); connect( cb_fullPath, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) ); + // sort filelist if desired + cb_sortFiles = new TQCheckBox(bgStartup); + cb_sortFiles->setText(i18n("Sort &files alphabetically in the file list")); + cb_sortFiles->setChecked(parent->filelist->sortType() == KateFileList::sortByName); + TQWhatsThis::add( cb_sortFiles, i18n( + "If this is checked, the files in the file list will be sorted alphabetically.") ); + connect( cb_sortFiles, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) ); // GROUP with the one below: "Behavior" bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("&Behavior"), frGeneral ); lo->addWidget( bgStartup ); + // number of recent files + TQHBox *hbNrf = new TQHBox( bgStartup ); + TQLabel *lNrf = new TQLabel( i18n("&Number of recent files:"), hbNrf ); + sb_numRecentFiles = new TQSpinBox( 0, 1000, 1, hbNrf ); + sb_numRecentFiles->setValue( mainWindow->fileOpenRecent->maxItems() ); + lNrf->setBuddy( sb_numRecentFiles ); + TQString numRecentFileHelpString ( i18n( + "Sets the number of recent files remembered by Kate.

NOTE: " + "If you set this lower than the current value, the list will be truncated and " + "some items forgotten.") ); + TQWhatsThis::add( lNrf, numRecentFileHelpString ); + TQWhatsThis::add( sb_numRecentFiles, numRecentFileHelpString ); + connect( sb_numRecentFiles, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( slotChanged() ) ); + // sync the konsole ? cb_syncKonsole = new TQCheckBox(bgStartup); cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document")); @@ -388,6 +409,10 @@ void KateConfigDialog::slotApply() mainWindow->modNotification = cb_modNotifications->isChecked(); mainWindow->syncKonsole = cb_syncKonsole->isChecked(); + mainWindow->filelist->setSortType(cb_sortFiles->isChecked() ? KateFileList::sortByName : KateFileList::sortByID); + + config->writeEntry( "Number of recent files", sb_numRecentFiles->value() ); + mainWindow->fileOpenRecent->setMaxItems( sb_numRecentFiles->value() ); fileSelConfigPage->apply(); diff --git a/kate/app/kateconfigdialog.h b/kate/app/kateconfigdialog.h index 52b9121b7..b80be2354 100644 --- a/kate/app/kateconfigdialog.h +++ b/kate/app/kateconfigdialog.h @@ -66,6 +66,8 @@ class KateConfigDialog : public KDialogBase TQCheckBox *cb_fullPath; TQCheckBox *cb_syncKonsole; + TQCheckBox *cb_sortFiles; + TQSpinBox *sb_numRecentFiles; TQCheckBox *cb_modNotifications; TQCheckBox *cb_saveMetaInfos; TQSpinBox *sb_daysMetaInfos; diff --git a/kate/app/katemainwindow.cpp b/kate/app/katemainwindow.cpp index a0cce60d6..4b1b47a5a 100644 --- a/kate/app/katemainwindow.cpp +++ b/kate/app/katemainwindow.cpp @@ -412,6 +412,7 @@ void KateMainWindow::readOptions () m_viewManager->setShowFullPath(config->readBoolEntry("Show Full Path in Title", false)); + fileOpenRecent->setMaxItems( config->readNumEntry("Number of recent files", fileOpenRecent->maxItems() ) ); fileOpenRecent->loadEntries(config, "Recent Files"); fileselector->readConfig(config, "fileselector"); -- cgit v1.2.1