]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlShowFile.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlShowFile.C
index f46100860b205090292e92d6f7bb43bb9003f617..6ffe52a18e805e2fce0a864e756a1829b106601f 100644 (file)
@@ -1,45 +1,56 @@
 /**
  * \file ControlShowFile.C
- * Copyright 2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Herbert Voss <voss@perce.de>
+ * \author Herbert Voß
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
-#include <fstream>
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
-#include "ViewBase.h"
-#include "ButtonControllerBase.h"
 #include "ControlShowFile.h"
-#include "Dialogs.h"
-#include "LyXView.h"
-#include "BufferView.h"
-#include "gettext.h"
-#include "support/filetools.h" // FileSearch
-
-ControlShowFile::ControlShowFile(LyXView & lv, Dialogs & d)
-       : ControlDialogBI(lv, d)
+#include "support/filetools.h"
+
+using std::string;
+
+namespace lyx {
+
+using support::GetFileContents;
+using support::OnlyFilename;
+
+namespace frontend {
+
+
+ControlShowFile::ControlShowFile(Dialog & parent)
+       : Dialog::Controller(parent)
+{}
+
+
+bool ControlShowFile::initialiseParams(string const & data)
 {
-       d_.showFile.connect(SigC::slot(this, &ControlShowFile::showFile));
+       filename_ = data;
+       return true;
 }
 
-void ControlShowFile::showFile(string const & file)
+
+void ControlShowFile::clearParams()
 {
-       filename_ = file;
-       show();
+       filename_.erase();
 }
 
+
 string ControlShowFile::getFileContents()
 {
        return GetFileContents(filename_);
 }
 
+
 string ControlShowFile::getFileName()
 {
        return OnlyFilename(filename_);
 }
+
+} // namespace frontend
+} // namespace lyx