changeset 185:52bb35e43bfc

Made the recently opened list be updated if the maximum list size is changed in the settings. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@389 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Wed, 06 Jun 2007 12:07:34 +0000
parents 3d8dac181633
children 3d414d19ed15
files src/mainwindow.cpp
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Wed Jun 06 12:00:47 2007 +0000
+++ b/src/mainwindow.cpp	Wed Jun 06 12:07:34 2007 +0000
@@ -146,6 +146,7 @@
     // Init the menue for selecting one of the recently opened files.
     updateRecentlyOpenedList();
     connect( menuRecently_Opened_Files, SIGNAL(triggered(QAction*)), this, SLOT(openFileFromRecentlyOpenedList(QAction*)) );
+    connect( settings, SIGNAL(recentlyOpenedListSize(int)), this, SLOT(updateRecentlyOpenedList()) );
 
     // Init of some variables.
     dataDirctoryStr = "./data/";
@@ -1224,7 +1225,6 @@
  */
 void MainWindow::updateRecentlyOpenedList() {
 
-    QAction *recentlyOpenedAction;
 	QString fileName;
     QString filePath;
     QStringList recentlyOpenedList = settings->getValueByName("LastOpenedFiles").toString().split("|");
@@ -1245,11 +1245,11 @@
     }
 
 	// Get the maximum recently opened list size.
-	int recentlyOpenedListSize = settings->getValueByName("RecentlyOpenedListSize").toInt();
+	int recentlyOpenedListMaxSize = settings->getValueByName("RecentlyOpenedListSize").toInt();
 
 	// Loop for each filepath in the recently opened list, remove non existing files and
 	// loop only as long as maximum allowed list entries are set.
-    for ( int i = 0; i < recentlyOpenedList.size() && i < recentlyOpenedListSize; ) {
+    for ( int i = 0; i < recentlyOpenedList.size() && i < recentlyOpenedListMaxSize; ) {
 		filePath = recentlyOpenedList.at(i);
         QFileInfo fileInfo(filePath);
 
@@ -1269,7 +1269,7 @@
 	}
 
 	// Trim the list to its in the settings allowed maximum size.
-	while ( recentlyOpenedList.size() > recentlyOpenedListSize ) {
+	while ( recentlyOpenedList.size() > recentlyOpenedListMaxSize ) {
 		recentlyOpenedList.takeLast();
         QAction* action = recentlyOpenedActionList.takeLast();
         delete action;