diff libgui/src/m-editor/file-editor.h @ 15860:feba9ff6e6a8

editor: add list of recently used files to the file menu * file_editor_tab.cc (set_file_name): emit signal mru_add_file () for a new file * file_editor_tab.h: new signal mru_add_file () * file_editor.cc (request_mru_open_file): new handler for opening a file from the mru-list, (handle_mru_add_file): slot for signal emitted from file_editor_tab; adds the new file to the mru list, (mru_menu_update): private function for updating the mru-list, (mru_menu_update): private function for updating the mru-list, (construct): implement mru-list menu and the related actions, (add_file_editor_tab): connect signal mru_add_file () * file-editor.h: definition of new slots, methods, string list for mru-list, and array for the related actions
author Torsten <ttl@justmail.de>
date Fri, 28 Dec 2012 15:01:08 +0100
parents 424edeca3c66
children 6c0fce0632a4
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.h	Thu Dec 27 23:04:46 2012 -0800
+++ b/libgui/src/m-editor/file-editor.h	Fri Dec 28 15:01:08 2012 +0100
@@ -89,6 +89,7 @@
 public slots:
   void request_new_file ();
   void request_open_file ();
+  void request_mru_open_file ();
 
   void request_undo ();
   void request_redo ();
@@ -118,6 +119,7 @@
   void handle_add_filename_to_list (const QString& fileName);
   void active_tab_changed (int index);
   void handle_editor_state_changed (bool enableCopy, const QString& fileName);
+  void handle_mru_add_file (const QString& file_name);
   void check_conflict_save (const QString& fileName, bool remove_on_success);
 
   /** Slot when floating property changes */
@@ -133,6 +135,7 @@
   void construct ();
   void add_file_editor_tab(file_editor_tab *f, const QString &fn);
   void save_file_as (QWidget *fetabID = 0);
+  void mru_menu_update ();
 
   QStringList fetFileNames;
   QString ced;
@@ -145,6 +148,11 @@
   QAction *         _run_action;
   QTabWidget *      _tab_widget;
   int               _marker_breakpoint;
+
+  enum { MaxMRUFiles = 10 };
+  QAction *_mru_file_actions[MaxMRUFiles];
+  QStringList _mru_files;
+
 };
 
 #endif // FILEEDITORMDISUBWINDOW_H