Commits

Andreas Tscharner committed 0721862

gui: ListHandler for this class and use of it if files selected

* New method setListHandler to provide a ListHandler for this class
* Use ListHandler class to add selected files to TreeView

Comments (0)

Files changed (2)

src/gui/AddRemoveHandlers.cxx

 
 	dlgRet = m_addFilesDlg->run();
 	if (dlgRet == Gtk::RESPONSE_OK) {
-		m_lastSelected.clear();
-		m_lastSelected = m_addFilesDlg->get_filenames();
+		if (m_listHandler) {
+			m_listHandler->newFilesAdded(m_addFilesDlg->get_filenames());
+		};
 	};
 	m_addFilesDlg->hide();
 }
 	anyFile->add_pattern("*");
 	m_addFilesDlg->add_filter(anyFile);
 
-	m_lastSelected.clear();
+	m_listHandler = nullptr;
 }
 
 AddRemoveHandlers::~AddRemoveHandlers(void)
 	delete m_addButton;
 }
 
-std::vector<std::string> AddRemoveHandlers::getSelectedFilenames(void)
+int AddRemoveHandlers::setListHandler(ListHandler *p_listHandler)
 {
-	return m_lastSelected;
+	m_listHandler = p_listHandler;
 }

src/gui/AddRemoveHandlers.hxx

  * main window
  *
  * \author Andreas Tscharner
- * \date 2012-06-17
+ * \date 2012-07-29
  */
 
 
 #include <gtkmm/button.h>
 #include <gtkmm/builder.h>
 #include <gtkmm/filechooserdialog.h>
+#include "ListHandler.hxx"
 
 
 /*! \class AddRemoveHandlers
 		Gtk::Button *m_addButton;      //!< Reference to "Add" button
 		Gtk::Button *m_removeButton;   //!< Reference to "Remove" button
 		Gtk::FileChooserDialog *m_addFilesDlg;   //!< Reference to "Add Files" dialog
-		std::vector<std::string> m_lastSelected; //!< List of filenames that were last selected
+		ListHandler *m_listHandler;    //!< Reference to (global) list handler class
 
 	protected:
 		/*! \brief Signal handler for "Add" button
 		 */
 		~AddRemoveHandlers(void);
 
-		/*! \brief Returns last selected filenames
+		/*! \brief Set instance of list handler
 		 *
-		 * This method returns the list of the filenames that were last
-		 * selected. The list will not be cleared.
+		 * This method is used to provide a ListHandler instance for this
+		 * class. It should be used by the MainWindow constructor
 		 *
-		 * \return List of last selected filenames
+		 * \retval NO_ERROR Instance successfully set
 		 */
-		std::vector<std::string> getSelectedFilenames(void);
+		int setListHandler(ListHandler *);
 };
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.