#include "changes.h"
#include "funcrequest.h"
#include "lyxfind.h"
-#include "support/lstrings.h"
-
-using lyx::support::rtrim;
+#include "support/lyxtime.h"
using std::string;
+namespace lyx {
+
+namespace frontend {
+
ControlChanges::ControlChanges(Dialog & parent)
: Dialog::Controller(parent)
bool ControlChanges::find()
{
- return lyx::find::findNextChange(kernel().bufferview());
+ return findNextChange(kernel().bufferview());
+}
+
+
+bool ControlChanges::changed()
+{
+ Change c(kernel().bufferview()->getCurrentChange());
+ return c.type != Change::UNCHANGED;
}
-string const ControlChanges::getChangeDate()
+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().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));
- lyx::find::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));
- lyx::find::findNextChange(kernel().bufferview());
+ kernel().dispatch(FuncRequest(LFUN_CHANGE_REJECT));
+ return findNextChange(kernel().bufferview());
}
+
+
+} // namespace frontend
+} // namespace lyx