]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlChanges.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlChanges.C
index fcc42687dc42c45266e0093408a8ed70a53014e5..ea6b8909cf621543a8136023dded6da3a4136c78 100644 (file)
@@ -5,53 +5,57 @@
  *
  * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#include "ViewBase.h"
-#include "ButtonControllerBase.h"
 #include "ControlChanges.h"
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
+
+#include "author.h"
 #include "buffer.h"
-#include "lyxfind.h"
-#include "lyxfunc.h"
-#include "debug.h"
+#include "bufferparams.h"
 #include "BufferView.h"
-#include "support/lstrings.h"
+#include "changes.h"
 #include "funcrequest.h"
-#include "author.h"
+#include "lyxfind.h"
+#include "support/lyxtime.h"
 
-ControlChanges::ControlChanges(LyXView & lv, Dialogs & d)
-       : ControlDialogBD(lv, d)
-{
-}
+using std::string;
 
+namespace lyx {
 
-void ControlChanges::find()
+namespace frontend {
+
+
+ControlChanges::ControlChanges(Dialog & parent)
+       : Dialog::Controller(parent)
+{}
+
+
+bool ControlChanges::find()
 {
-       lyxfind::findNextChange(bufferview());
+       return find::findNextChange(kernel().bufferview());
 }
 
 
 string const ControlChanges::getChangeDate()
 {
-       Change c(bufferview()->getCurrentChange());
+       Change c(kernel().bufferview()->getCurrentChange());
        if (c.type == Change::UNCHANGED || !c.changetime)
                return string();
-       return ctime(&c.changetime);
+
+       return formatted_time(c.changetime);
 }
 
 
 string const ControlChanges::getChangeAuthor()
 {
-       Change c(bufferview()->getCurrentChange());
+       Change c(kernel().bufferview()->getCurrentChange());
        if (c.type == Change::UNCHANGED)
                return string();
 
-       Author const & a(bufferview()->buffer()->authors().get(c.author));
+       Author const & a(kernel().buffer().params().authors().get(c.author));
 
        string author(a.name());
 
@@ -64,15 +68,19 @@ string const ControlChanges::getChangeAuthor()
 }
 
 
-void ControlChanges::accept()
+bool ControlChanges::accept()
 {
-       lv_.dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
-       lyxfind::findNextChange(bufferview());
+       kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
+       return find::findNextChange(kernel().bufferview());
 }
 
 
-void ControlChanges::reject()
+bool ControlChanges::reject()
 {
-       lv_.dispatch(FuncRequest(LFUN_REJECT_CHANGE));
-       lyxfind::findNextChange(bufferview());
+       kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
+       return find::findNextChange(kernel().bufferview());
 }
+
+
+} // namespace frontend
+} // namespace lyx