restore double clicking in the QRefs dialog (bug 2194), plus some small ui fixes.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10714 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-01-08 10:57:31 +00:00
parent 49de27a95f
commit 10a5c58dbd
5 changed files with 40 additions and 7 deletions

View File

@ -1,3 +1,16 @@
2006-01-08 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ui/QRefDialogBase.ui: re-connect the refsLB->Selected signal
in order to restore double clicking (bug 2194)
* QRef.[Ch]: add isValid member and use it (disable OK button
when text widget is empty).
* QRef.C:
* QRefDialog.C: assure that the browser items are correctly
highlighted/not highlighted if a dialog is opened for the first
time (was distorted by the refsLB->Selected signal).
2005-12-14 Hartmut Haase <hha4491@atomstromfrei.de>
* ui/QPrefLatexModule.ui: make the papersize choices in

View File

@ -100,7 +100,7 @@ void QRef::update_contents()
dialog_->bufferCO->setCurrentItem(controller().getBufferNum());
updateRefs();
bc().valid(false);
bc().valid(isValid());
}
@ -192,13 +192,15 @@ void QRef::redoRefs()
dialog_->referenceED->setText(tmp);
// restore the last selection for new insets
// but do not highlight it
if (tmp.isEmpty() && lastref != -1
&& lastref < int(dialog_->refsLB->count()))
&& lastref < int(dialog_->refsLB->count())) {
dialog_->refsLB->setCurrentItem(lastref);
else
dialog_->refsLB->clearSelection();
} else
for (unsigned int i = 0; i < dialog_->refsLB->count(); ++i) {
if (tmp == dialog_->refsLB->text(i))
dialog_->refsLB->setCurrentItem(i);
dialog_->refsLB->setSelected(i, true);
}
dialog_->refsLB->setAutoUpdate(true);
@ -223,5 +225,11 @@ void QRef::updateRefs()
redoRefs();
}
bool QRef::isValid()
{
return !dialog_->referenceED->text().isEmpty();
}
} // namespace frontend
} // namespace lyx

View File

@ -30,6 +30,8 @@ public:
friend class QRefDialog;
QRef(Dialog &);
protected:
virtual bool isValid();
private:
/// apply changes
virtual void apply();

View File

@ -44,8 +44,7 @@ void QRefDialog::show()
void QRefDialog::changed_adaptor()
{
if (!referenceED->text().isEmpty())
form_->changed();
form_->changed();
}
@ -82,7 +81,12 @@ void QRefDialog::refSelected(const QString & sel)
if (form_->readOnly())
return;
referenceED->setText(sel);
int const cur_item = refsLB->currentItem();
bool const cur_item_selected = cur_item >= 0 ?
refsLB->isSelected(cur_item) : false;
if (cur_item_selected)
referenceED->setText(sel);
// <enter> or double click, inserts ref and closes dialog
form_->slotOK();
}

View File

@ -409,6 +409,12 @@
<receiver>QRefDialogBase</receiver>
<slot>refHighlighted(const QString&amp;)</slot>
</connection>
<connection>
<sender>refsLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QRefDialogBase</receiver>
<slot>refSelected(const QString&amp;)</slot>
</connection>
<connection>
<sender>sortCB</sender>
<signal>toggled(bool)</signal>