From 022ea0feb6dfdc73cee5670b23a25dab4f8a7638 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 24 Apr 2008 18:30:31 +0000 Subject: [PATCH] Fix part of bug 4775. We need to search here only when the user requests it, and not try to do "search as you go". This is too slow, even on fast machines, if you have more than a handful of entries. I've also added some tooltips to direct people to the keyboard shortcuts. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24495 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiCitation.cpp | 24 +++++++++++----- src/frontends/qt4/GuiCitation.h | 1 + src/frontends/qt4/ui/CitationUi.ui | 45 ++++++++++++++++++++++++------ 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index e6af4f8237..c1e7fd74c6 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -92,8 +92,12 @@ GuiCitation::GuiCitation(GuiView & lv) this, SLOT(changed())); connect(textAfterED, SIGNAL(textChanged(QString)), this, SLOT(changed())); - connect(clearPB, SIGNAL(clicked()), - findLE, SLOT(clear())); + connect(findLE, SIGNAL(returnPressed()), + this, SLOT(on_searchPB_clicked())); + connect(textBeforeED, SIGNAL(returnPressed()), + this, SLOT(on_okPB_clicked())); + connect(textAfterED, SIGNAL(returnPressed()), + this, SLOT(on_okPB_clicked())); connect(this, SIGNAL(rejected()), this, SLOT(cleanUp())); selectionManager = new GuiSelectionManager(availableLV, selectedLV, @@ -420,10 +424,16 @@ void GuiCitation::on_citationStyleCO_currentIndexChanged(int index) void GuiCitation::on_findLE_textChanged(const QString & text) { - clearPB->setDisabled(text.isEmpty()); - if (text.isEmpty()) - findLE->setFocus(); - findText(text); + searchPB->setDisabled(text.isEmpty()); + if (!text.isEmpty()) + return; + findText(findLE->text()); + findLE->setFocus(); +} + +void GuiCitation::on_searchPB_clicked() +{ + findText(findLE->text()); } @@ -527,7 +537,7 @@ void GuiCitation::findKey(QString const & str, bool only_keys, last_case_sensitive = case_sensitive; last_reg_exp = reg_exp; - Qt::CaseSensitivity qtcase = case_sensitive? + Qt::CaseSensitivity qtcase = case_sensitive ? Qt::CaseSensitive: Qt::CaseInsensitive; QStringList keys; // If new string (str) contains the last searched one... diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index 5e07a24fa3..8863bc3a04 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -64,6 +64,7 @@ private Q_SLOTS: void on_cancelPB_clicked(); void on_restorePB_clicked(); void on_applyPB_clicked(); + void on_searchPB_clicked(); void on_findLE_textChanged(const QString & text); void on_fieldsCO_currentIndexChanged(int index); void on_entriesCO_currentIndexChanged(int index); diff --git a/src/frontends/qt4/ui/CitationUi.ui b/src/frontends/qt4/ui/CitationUi.ui index 6e385752d2..1a4cd5145b 100644 --- a/src/frontends/qt4/ui/CitationUi.ui +++ b/src/frontends/qt4/ui/CitationUi.ui @@ -33,7 +33,7 @@ - Move the selected citation up + Move the selected citation up (try Ctrl-Up) &Up @@ -41,6 +41,9 @@ + + false + @@ -52,7 +55,7 @@ - Move the selected citation down + Move the selected citation down (try Ctrl-Down) &Down @@ -60,6 +63,9 @@ + + false + @@ -77,9 +83,15 @@ + + The delete key works, too + D&elete + + false + @@ -92,13 +104,13 @@ - + The Enter key works, too &Add - true + false @@ -162,18 +174,27 @@ + + Hit Enter to search, or click Go! + - + false + + You can also hit Enter in the search box + - <- C&lear + &Go! + + + false @@ -384,6 +405,9 @@ &Restore + + false + @@ -405,10 +429,10 @@ &OK - true + false - true + false @@ -417,6 +441,9 @@ A&pply + + false + @@ -441,7 +468,7 @@ upPB downPB findLE - clearPB + searchPB caseCB regexCB citationStyleCO -- 2.39.2