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
This commit is contained in:
Richard Heck 2008-04-24 18:30:31 +00:00
parent 696f745f63
commit 022ea0feb6
3 changed files with 54 additions and 16 deletions

View File

@ -92,8 +92,12 @@ GuiCitation::GuiCitation(GuiView & lv)
this, SLOT(changed())); this, SLOT(changed()));
connect(textAfterED, SIGNAL(textChanged(QString)), connect(textAfterED, SIGNAL(textChanged(QString)),
this, SLOT(changed())); this, SLOT(changed()));
connect(clearPB, SIGNAL(clicked()), connect(findLE, SIGNAL(returnPressed()),
findLE, SLOT(clear())); 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())); connect(this, SIGNAL(rejected()), this, SLOT(cleanUp()));
selectionManager = new GuiSelectionManager(availableLV, selectedLV, selectionManager = new GuiSelectionManager(availableLV, selectedLV,
@ -420,10 +424,16 @@ void GuiCitation::on_citationStyleCO_currentIndexChanged(int index)
void GuiCitation::on_findLE_textChanged(const QString & text) void GuiCitation::on_findLE_textChanged(const QString & text)
{ {
clearPB->setDisabled(text.isEmpty()); searchPB->setDisabled(text.isEmpty());
if (text.isEmpty()) if (!text.isEmpty())
findLE->setFocus(); return;
findText(text); 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_case_sensitive = case_sensitive;
last_reg_exp = reg_exp; last_reg_exp = reg_exp;
Qt::CaseSensitivity qtcase = case_sensitive? Qt::CaseSensitivity qtcase = case_sensitive ?
Qt::CaseSensitive: Qt::CaseInsensitive; Qt::CaseSensitive: Qt::CaseInsensitive;
QStringList keys; QStringList keys;
// If new string (str) contains the last searched one... // If new string (str) contains the last searched one...

View File

@ -64,6 +64,7 @@ private Q_SLOTS:
void on_cancelPB_clicked(); void on_cancelPB_clicked();
void on_restorePB_clicked(); void on_restorePB_clicked();
void on_applyPB_clicked(); void on_applyPB_clicked();
void on_searchPB_clicked();
void on_findLE_textChanged(const QString & text); void on_findLE_textChanged(const QString & text);
void on_fieldsCO_currentIndexChanged(int index); void on_fieldsCO_currentIndexChanged(int index);
void on_entriesCO_currentIndexChanged(int index); void on_entriesCO_currentIndexChanged(int index);

View File

@ -33,7 +33,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip" > <property name="toolTip" >
<string>Move the selected citation up</string> <string>Move the selected citation up (try Ctrl-Up)</string>
</property> </property>
<property name="text" > <property name="text" >
<string>&amp;Up</string> <string>&amp;Up</string>
@ -41,6 +41,9 @@
<property name="icon" > <property name="icon" >
<iconset/> <iconset/>
</property> </property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item row="5" column="1" > <item row="5" column="1" >
@ -52,7 +55,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip" > <property name="toolTip" >
<string>Move the selected citation down</string> <string>Move the selected citation down (try Ctrl-Down)</string>
</property> </property>
<property name="text" > <property name="text" >
<string>&amp;Down</string> <string>&amp;Down</string>
@ -60,6 +63,9 @@
<property name="icon" > <property name="icon" >
<iconset/> <iconset/>
</property> </property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item row="3" column="1" > <item row="3" column="1" >
@ -77,9 +83,15 @@
</item> </item>
<item row="2" column="1" > <item row="2" column="1" >
<widget class="QPushButton" name="deletePB" > <widget class="QPushButton" name="deletePB" >
<property name="toolTip" >
<string>The delete key works, too</string>
</property>
<property name="text" > <property name="text" >
<string>D&amp;elete</string> <string>D&amp;elete</string>
</property> </property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item rowspan="5" row="1" column="0" > <item rowspan="5" row="1" column="0" >
@ -92,13 +104,13 @@
<item row="1" column="1" > <item row="1" column="1" >
<widget class="QPushButton" name="addPB" > <widget class="QPushButton" name="addPB" >
<property name="toolTip" > <property name="toolTip" >
<string/> <string>The Enter key works, too</string>
</property> </property>
<property name="text" > <property name="text" >
<string>&amp;Add</string> <string>&amp;Add</string>
</property> </property>
<property name="autoDefault" > <property name="autoDefault" >
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -162,18 +174,27 @@
</item> </item>
<item row="0" column="1" colspan="3" > <item row="0" column="1" colspan="3" >
<widget class="QLineEdit" name="findLE" > <widget class="QLineEdit" name="findLE" >
<property name="toolTip" >
<string>Hit Enter to search, or click Go!</string>
</property>
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4" > <item row="0" column="4" >
<widget class="QPushButton" name="clearPB" > <widget class="QPushButton" name="searchPB" >
<property name="enabled" > <property name="enabled" >
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="toolTip" >
<string>You can also hit Enter in the search box</string>
</property>
<property name="text" > <property name="text" >
<string>&lt;- C&amp;lear</string> <string>&amp;Go!</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -384,6 +405,9 @@
<property name="text" > <property name="text" >
<string>&amp;Restore</string> <string>&amp;Restore</string>
</property> </property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -405,10 +429,10 @@
<string>&amp;OK</string> <string>&amp;OK</string>
</property> </property>
<property name="autoDefault" > <property name="autoDefault" >
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="default" > <property name="default" >
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -417,6 +441,9 @@
<property name="text" > <property name="text" >
<string>A&amp;pply</string> <string>A&amp;pply</string>
</property> </property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -441,7 +468,7 @@
<tabstop>upPB</tabstop> <tabstop>upPB</tabstop>
<tabstop>downPB</tabstop> <tabstop>downPB</tabstop>
<tabstop>findLE</tabstop> <tabstop>findLE</tabstop>
<tabstop>clearPB</tabstop> <tabstop>searchPB</tabstop>
<tabstop>caseCB</tabstop> <tabstop>caseCB</tabstop>
<tabstop>regexCB</tabstop> <tabstop>regexCB</tabstop>
<tabstop>citationStyleCO</tabstop> <tabstop>citationStyleCO</tabstop>