* frontends/qt4/QChanges.C:

* frontends/controllers/ControlChanges.C:
	* frontends/controllers/ControlChanges.h: fix merge-changes dialog;
	remove old cruft; strip interface down to what is really needed


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17019 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2007-02-01 20:48:43 +00:00
parent 2cf58651ed
commit bbc332f234
3 changed files with 26 additions and 51 deletions

View File

@ -4,6 +4,7 @@
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Michael Gerz
*
* Full author contact details are available in file CREDITS.
*/
@ -20,14 +21,8 @@
#include "funcrequest.h"
#include "lyxfind.h"
// FIXME: those two headers are needed because of the
// WorkArea::redraw() call below.
#include "frontends/LyXView.h"
#include "frontends/WorkArea.h"
#include "support/lyxtime.h"
using std::string;
namespace lyx {
@ -39,29 +34,16 @@ ControlChanges::ControlChanges(Dialog & parent)
{}
bool ControlChanges::find()
void ControlChanges::next()
{
// FIXME: it would be better to use an LFUN.
if (!findNextChange(kernel().bufferview()))
return false;
kernel().bufferview()->update();
kernel().lyxview().currentWorkArea()->redraw();
return true;
}
bool ControlChanges::changed()
{
Change c(kernel().bufferview()->getCurrentChange());
return c.type != Change::UNCHANGED;
kernel().dispatch(FuncRequest(LFUN_CHANGE_NEXT));
}
docstring const ControlChanges::getChangeDate()
{
Change c(kernel().bufferview()->getCurrentChange());
if (c.type == Change::UNCHANGED || !c.changetime)
Change const & c = kernel().bufferview()->getCurrentChange();
if (c.type == Change::UNCHANGED)
return docstring();
// FIXME UNICODE
@ -71,35 +53,33 @@ docstring const ControlChanges::getChangeDate()
docstring const ControlChanges::getChangeAuthor()
{
Change c(kernel().bufferview()->getCurrentChange());
Change const & c = kernel().bufferview()->getCurrentChange();
if (c.type == Change::UNCHANGED)
return docstring();
Author const & a(kernel().buffer().params().authors().get(c.author));
Author const & a = kernel().buffer().params().authors().get(c.author);
docstring author(a.name());
if (!a.email().empty()) {
author += " (";
author += a.email();
author += ")";
author += " (" + a.email() + ")";
}
return author;
}
bool ControlChanges::accept()
void ControlChanges::accept()
{
kernel().dispatch(FuncRequest(LFUN_CHANGE_ACCEPT));
return find();
next();
}
bool ControlChanges::reject()
void ControlChanges::reject()
{
kernel().dispatch(FuncRequest(LFUN_CHANGE_REJECT));
return find();
next();
}

View File

@ -5,6 +5,7 @@
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Michael Gerz
*
* Full author contact details are available in file CREDITS.
*/
@ -37,11 +38,8 @@ public:
/// always true since dispatchParams() is empty
virtual bool canApply() const { return true; }
/// find the next merge chunk and highlight it
bool find();
/// Are there changes to be merged at current location?
bool changed();
/// find the next change and highlight it
void next();
/// return date of change
lyx::docstring const getChangeDate();
@ -49,11 +47,11 @@ public:
/// return author of change
lyx::docstring const getChangeAuthor();
/// accept the current merge
bool accept();
/// accept the current change
void accept();
/// reject the current merge
bool reject();
/// reject the current change
void reject();
};
} // namespace frontend

View File

@ -4,6 +4,7 @@
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Michael Gerz
*
* Full author contact details are available in file CREDITS.
*/
@ -24,8 +25,6 @@
using lyx::support::bformat;
using std::string;
namespace lyx {
namespace frontend {
@ -50,14 +49,6 @@ void QChanges::build_dialog()
void QChanges::update_contents()
{
next();
}
void QChanges::next()
{
controller().find();
docstring text;
docstring author = controller().getChangeAuthor();
docstring date = controller().getChangeDate();
@ -71,6 +62,12 @@ void QChanges::next()
}
void QChanges::next()
{
controller().next();
}
void QChanges::accept()
{
controller().accept();