+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
dialog_->bufferCO->setCurrentItem(controller().getBufferNum());
updateRefs();
- bc().valid(false);
+ bc().valid(isValid());
}
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);
redoRefs();
}
+
+bool QRef::isValid()
+{
+ return !dialog_->referenceED->text().isEmpty();
+}
+
} // namespace frontend
} // namespace lyx
friend class QRefDialog;
QRef(Dialog &);
+protected:
+ virtual bool isValid();
private:
/// apply changes
virtual void apply();
void QRefDialog::changed_adaptor()
{
- if (!referenceED->text().isEmpty())
- form_->changed();
+ form_->changed();
}
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();
}
<receiver>QRefDialogBase</receiver>
<slot>refHighlighted(const QString&)</slot>
</connection>
+ <connection>
+ <sender>refsLB</sender>
+ <signal>selected(const QString&)</signal>
+ <receiver>QRefDialogBase</receiver>
+ <slot>refSelected(const QString&)</slot>
+ </connection>
<connection>
<sender>sortCB</sender>
<signal>toggled(bool)</signal>