src/gui.cpp

changeset 467
59549731151a
parent 461
fbcc91ae1dd2
child 473
2a84149fe642
--- a/src/gui.cpp	Tue Aug 20 21:23:56 2013 +0300
+++ b/src/gui.cpp	Wed Aug 21 01:13:52 2013 +0300
@@ -54,7 +54,7 @@
 cfg (Bool, lv_colorize, true);
 cfg (String, gui_colortoolbar, "16:24:|:1:2:4:14:0:15:|:33:34:36:46");
 cfg (Bool, gui_implicitfiles, false);
-extern_cfg (String, io_recentfiles);
+extern_cfg (List, io_recentfiles);
 extern_cfg (Bool, gl_axes);
 extern_cfg (String, gl_maincolor);
 extern_cfg (Float, gl_maincolor_alpha);
@@ -150,22 +150,21 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void ForgeWindow::updateRecentFilesMenu() {
-	QStringList files = io_recentfiles.value.split ("@", QString::SkipEmptyParts);
-	QStringListIterator it (files);
-	
 	// First, clear any items in the recent files menu
 	for (QAction* recent : m_recentFiles)
 		delete recent;
 	m_recentFiles.clear();
 	
-	it.toBack();
-	while (it.hasPrevious()) {
-		str file = it.previous();
+	QAction* first = null;
+	
+	for (const QVariant& it : io_recentfiles) {
+		str file = it.toString();
 		QAction* recent = new QAction (getIcon ("open-recent"), file, this);
 		
 		connect (recent, SIGNAL (triggered()), this, SLOT (slot_recentFile()));
-		ui->menuOpenRecent->addAction (recent);
+		ui->menuOpenRecent->insertAction (first, recent);
 		m_recentFiles << recent;
+		first = recent;
 	}
 }
 

mercurial