From ca067e952a6955a27976f0ee8bb4f8b946681da1 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Wed, 5 Mar 2003 10:47:11 +0000 Subject: [PATCH] Minimal fix needed to give Qt a label dialog again. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6350 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 7 +++++++ src/frontends/qt2/Dialogs3.C | 14 ++++++++++++-- src/frontends/qt2/QIndex.C | 9 ++++++--- src/frontends/qt2/QIndex.h | 9 ++++++--- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index a0c5045f9b..d8dedda87f 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2003-03-05 Angus Leeming + + * QIndex.[Ch]: minimal changes needed to use this dialog + for both the Index and the Label dialogs. + + * Dialogs3.C: add label dialog. + 2003-03-03 Dekel Tsur * qfont_loader.C (available): Rewrite as the old version did not diff --git a/src/frontends/qt2/Dialogs3.C b/src/frontends/qt2/Dialogs3.C index 9bf18247c8..83b7e97d38 100644 --- a/src/frontends/qt2/Dialogs3.C +++ b/src/frontends/qt2/Dialogs3.C @@ -19,6 +19,7 @@ #include "ControlError.h" #include "ControlERT.h" #include "ControlIndex.h" +#include "ControlLabel.h" #include "ControlRef.h" #include "ControlToc.h" #include "ControlUrl.h" @@ -48,6 +49,7 @@ #include "Qt2BC.h" #include "ButtonController.h" +#include "qt_helpers.h" typedef ButtonController @@ -63,7 +65,7 @@ typedef ButtonController namespace { char const * const dialognames[] = { "bibitem", "bibtex", "citation", - "error", "ert", "index", "ref", + "error", "ert", "index", "label", "ref", "toc", "url" }; char const * const * const end_dialognames = @@ -118,7 +120,15 @@ Dialog * Dialogs::build(string const & name) dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); } else if (name == "index") { dialog->setController(new ControlIndex(*dialog)); - dialog->setView(new QIndex(*dialog)); + dialog->setView(new QIndex(*dialog, + qt_("LyX: Insert Index Entry"), + qt_("&Keyword"))); + dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + } else if (name == "label") { + dialog->setController(new ControlLabel(*dialog)); + dialog->setView(new QIndex(*dialog, + qt_("LyX: Insert Label"), + qt_("&Label"))); dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); } else if (name == "ref") { dialog->setController(new ControlRef(*dialog)); diff --git a/src/frontends/qt2/QIndex.C b/src/frontends/qt2/QIndex.C index 1f025efb4c..97cce54613 100644 --- a/src/frontends/qt2/QIndex.C +++ b/src/frontends/qt2/QIndex.C @@ -17,14 +17,15 @@ #include "QIndexDialog.h" #include "QIndex.h" #include "Qt2BC.h" +#include #include #include -typedef QController > base_class; +typedef QController > base_class; -QIndex::QIndex(Dialog & parent) - : base_class(parent, qt_("LyX: Insert Index Entry")) +QIndex::QIndex(Dialog & parent, QString const & title, QString const & label) + : base_class(parent, title), label_(label) { } @@ -33,6 +34,8 @@ void QIndex::build_dialog() { dialog_.reset(new QIndexDialog(this)); + dialog_->keywordLA->setText(label_); + bc().setOK(dialog_->okPB); bc().setCancel(dialog_->closePB); bc().addReadOnly(dialog_->keywordED); diff --git a/src/frontends/qt2/QIndex.h b/src/frontends/qt2/QIndex.h index 18fafd4ba8..88e2c1b835 100644 --- a/src/frontends/qt2/QIndex.h +++ b/src/frontends/qt2/QIndex.h @@ -16,17 +16,17 @@ #include "QDialogView.h" -class ControlIndex; +class ControlCommand; class QIndexDialog; class QIndex : - public QController > + public QController > { public: friend class QIndexDialog; - QIndex(Dialog &); + QIndex(Dialog &, QString const & title, QString const & label); protected: virtual bool isValid(); private: @@ -36,6 +36,9 @@ private: virtual void update_contents(); /// build the dialog virtual void build_dialog(); + + /// + QString const label_; }; #endif // QINDEX_H