]> git.lyx.org Git - features.git/commitdiff
Add accept/reject change to the context menu of the toc.
authorVincent van Ravesteijn <vfr@lyx.org>
Fri, 1 May 2009 17:55:26 +0000 (17:55 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Fri, 1 May 2009 17:55:26 +0000 (17:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29480 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ui/stdcontext.inc
src/frontends/qt4/TocWidget.cpp

index 1b5fbc71bcd1bbeeb8fcbb74e57819810a56680a..a3b5e7ed43a8d9d5c668b34f5ed93032ab52ad2b 100644 (file)
@@ -531,4 +531,14 @@ Menuset
                OptItem "Settings...|S" "inset-settings"
        End
 
+
+#
+# Toc Changes context menu
+#
+
+       Menu "context-toc-change"
+               Item "Accept Change|C" "change-accept"
+               Item "Reject Change|R" "change-reject"
+       End     
+
 End
index 159054cd9b8b554a76b846e9de9b0c321c0635ce..fa044ad6455b8a5299c4faf55470cd4a87695c2f 100644 (file)
@@ -111,7 +111,8 @@ Inset * TocWidget::itemInset() const
                inset = dit.nextInset();
 
        else if (current_type_ == "branch"
-                    || current_type_ == "index")
+                    || current_type_ == "index"
+                        || current_type_ == "change")
                inset = &dit.inset();
 
        else if (current_type_ == "table" 
@@ -129,10 +130,20 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
        FuncStatus & status) const
 {
        Inset * inset = itemInset();
-
        FuncRequest tmpcmd(cmd);
-       if (inset)
-               return inset->getStatus(cur, tmpcmd, status);
+
+       switch (cmd.action)
+       {
+       case LFUN_CHANGE_ACCEPT:
+       case LFUN_CHANGE_REJECT:
+               status.setEnabled(true);
+               return true;
+
+       default:
+               if (inset)
+                       return inset->getStatus(cur, tmpcmd, status);
+       }
+
        return false;
 }
 
@@ -140,10 +151,24 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
 void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
 {
        Inset * inset = itemInset();
-
        FuncRequest tmpcmd(cmd);
-       if (inset)
-               inset->dispatch(cur, tmpcmd);
+
+       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)
+                       inset->dispatch(cur, tmpcmd);
+       }
 }
 
 
@@ -369,6 +394,7 @@ void TocWidget::updateView()
        sortCB->setChecked(gui_view_.tocModels().isSorted(current_type_));
        sortCB->blockSignals(false);
 
+       
        bool const can_navigate_ = canNavigate(current_type_);
        persistentCB->setEnabled(can_navigate_);