From 3ec9ac5ff5555d7010e0dc0057fecf46b1aa03fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 24 Jul 2009 13:58:02 +0000 Subject: [PATCH] * TocWidget.cpp: disable sort option for TOC (bug 5983). * TocModel.cpp: whitespace git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30760 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/TocModel.cpp | 2 +- src/frontends/qt4/TocWidget.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp index cfaa3809de..4eaafb4bed 100644 --- a/src/frontends/qt4/TocModel.cpp +++ b/src/frontends/qt4/TocModel.cpp @@ -237,7 +237,7 @@ TocModels::TocModels() } -void TocModels::clear() +void TocModels::clear() { names_->blockSignals(true); names_->clear(); diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp index badc345323..9add9ed43e 100644 --- a/src/frontends/qt4/TocWidget.cpp +++ b/src/frontends/qt4/TocWidget.cpp @@ -244,6 +244,7 @@ void TocWidget::on_sortCB_stateChanged(int state) updateView(); } + void TocWidget::on_persistentCB_stateChanged(int state) { persistent_ = state == Qt::Checked; @@ -394,6 +395,13 @@ static bool canNavigate(QString const & type) } +/// Test whether sorting is possible +static bool isSortable(QString const & type) +{ + return type != "tableofcontents"; +} + + void TocWidget::updateView() { if (!gui_view_.view()) { @@ -408,7 +416,7 @@ void TocWidget::updateView() depthSL->setEnabled(false); return; } - sortCB->setEnabled(true); + sortCB->setEnabled(isSortable(current_type_)); depthSL->setEnabled(true); typeCO->setEnabled(true); tocTV->setEnabled(false); @@ -423,7 +431,8 @@ void TocWidget::updateView() } sortCB->blockSignals(true); - sortCB->setChecked(gui_view_.tocModels().isSorted(current_type_)); + sortCB->setChecked(isSortable(current_type_) + && gui_view_.tocModels().isSorted(current_type_)); sortCB->blockSignals(false);