Add accept/reject change to the context menu of the toc.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29480 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-05-01 17:55:26 +00:00
parent 26069b2465
commit 69d2e076dc
2 changed files with 43 additions and 7 deletions

View File

@ -531,4 +531,14 @@ Menuset
OptItem "Settings...|S" "inset-settings" OptItem "Settings...|S" "inset-settings"
End End
#
# Toc Changes context menu
#
Menu "context-toc-change"
Item "Accept Change|C" "change-accept"
Item "Reject Change|R" "change-reject"
End
End End

View File

@ -111,7 +111,8 @@ Inset * TocWidget::itemInset() const
inset = dit.nextInset(); inset = dit.nextInset();
else if (current_type_ == "branch" else if (current_type_ == "branch"
|| current_type_ == "index") || current_type_ == "index"
|| current_type_ == "change")
inset = &dit.inset(); inset = &dit.inset();
else if (current_type_ == "table" else if (current_type_ == "table"
@ -129,10 +130,20 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & status) const FuncStatus & status) const
{ {
Inset * inset = itemInset(); Inset * inset = itemInset();
FuncRequest tmpcmd(cmd); FuncRequest tmpcmd(cmd);
switch (cmd.action)
{
case LFUN_CHANGE_ACCEPT:
case LFUN_CHANGE_REJECT:
status.setEnabled(true);
return true;
default:
if (inset) if (inset)
return inset->getStatus(cur, tmpcmd, status); return inset->getStatus(cur, tmpcmd, status);
}
return false; return false;
} }
@ -140,11 +151,25 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd) void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
{ {
Inset * inset = itemInset(); Inset * inset = itemInset();
FuncRequest tmpcmd(cmd); FuncRequest tmpcmd(cmd);
QModelIndex const & index = tocTV->currentIndex();
TocItem const & item =
gui_view_.tocModels().currentItem(current_type_, index);
switch (cmd.action)
{
case LFUN_CHANGE_ACCEPT:
case LFUN_CHANGE_REJECT:
dispatch(item.action());
cur.dispatch(tmpcmd);
break;
default:
if (inset) if (inset)
inset->dispatch(cur, tmpcmd); inset->dispatch(cur, tmpcmd);
} }
}
void TocWidget::on_tocTV_activated(QModelIndex const & index) void TocWidget::on_tocTV_activated(QModelIndex const & index)
@ -369,6 +394,7 @@ void TocWidget::updateView()
sortCB->setChecked(gui_view_.tocModels().isSorted(current_type_)); sortCB->setChecked(gui_view_.tocModels().isSorted(current_type_));
sortCB->blockSignals(false); sortCB->blockSignals(false);
bool const can_navigate_ = canNavigate(current_type_); bool const can_navigate_ = canNavigate(current_type_);
persistentCB->setEnabled(can_navigate_); persistentCB->setEnabled(can_navigate_);