]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlChanges.C
convert author names and status messages to docstring
[lyx.git] / src / frontends / controllers / ControlChanges.C
index 1d5053ff1df45966603143b7da72b44848c72313..9c67cc57c50cfec7a713526fe254f5e9d6421c96 100644 (file)
@@ -5,20 +5,28 @@
  *
  * \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 "ControlChanges.h"
+
+#include "author.h"
 #include "buffer.h"
+#include "bufferparams.h"
 #include "BufferView.h"
+#include "changes.h"
 #include "funcrequest.h"
 #include "lyxfind.h"
-#include "author.h"
-#include "support/lstrings.h"
+#include "support/lyxtime.h"
+
+using std::string;
+
+namespace lyx {
+
+namespace frontend {
 
-using namespace lyx::support;
 
 ControlChanges::ControlChanges(Dialog & parent)
        : Dialog::Controller(parent)
@@ -27,50 +35,61 @@ ControlChanges::ControlChanges(Dialog & parent)
 
 bool ControlChanges::find()
 {
-       return lyxfind::findNextChange(kernel().bufferview());
+       return findNextChange(kernel().bufferview());
 }
 
 
-string const ControlChanges::getChangeDate()
+bool ControlChanges::changed()
+{
+       Change c(kernel().bufferview()->getCurrentChange());
+       return c.type != Change::UNCHANGED;
+}
+
+
+docstring const ControlChanges::getChangeDate()
 {
        Change c(kernel().bufferview()->getCurrentChange());
        if (c.type == Change::UNCHANGED || !c.changetime)
-               return string();
+               return docstring();
 
-       // ctime adds newline; trim it off!
-       string const date = rtrim(ctime(&c.changetime), "\n");
-       return date;
+       // FIXME UNICODE
+       return from_utf8(formatted_time(c.changetime));
 }
 
 
-string const ControlChanges::getChangeAuthor()
+docstring const ControlChanges::getChangeAuthor()
 {
        Change c(kernel().bufferview()->getCurrentChange());
        if (c.type == Change::UNCHANGED)
-               return string();
+               return docstring();
 
-       Author const & a(kernel().buffer()->authors().get(c.author));
+       Author const & a(kernel().buffer().params().authors().get(c.author));
 
-       string author(a.name());
+       docstring author(a.name());
 
        if (!a.email().empty()) {
                author += " (";
-               author += a.email() + ")";
+               author += a.email();
+               author += ")";
        }
 
        return author;
 }
 
 
-void ControlChanges::accept()
+bool ControlChanges::accept()
 {
-       kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
-       lyxfind::findNextChange(kernel().bufferview());
+       kernel().dispatch(FuncRequest(LFUN_CHANGE_ACCEPT));
+       return findNextChange(kernel().bufferview());
 }
 
 
-void ControlChanges::reject()
+bool ControlChanges::reject()
 {
-       kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
-       lyxfind::findNextChange(kernel().bufferview());
+       kernel().dispatch(FuncRequest(LFUN_CHANGE_REJECT));
+       return findNextChange(kernel().bufferview());
 }
+
+
+} // namespace frontend
+} // namespace lyx