]> git.lyx.org Git - features.git/commitdiff
restore double clicking in the QRefs dialog (bug 2194), plus some small ui fixes.
authorJürgen Spitzmüller <spitz@lyx.org>
Sun, 8 Jan 2006 10:57:31 +0000 (10:57 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sun, 8 Jan 2006 10:57:31 +0000 (10:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10714 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QRef.C
src/frontends/qt2/QRef.h
src/frontends/qt2/QRefDialog.C
src/frontends/qt2/ui/QRefDialogBase.ui

index 202a2bd227e09c3a2df644839e8970890b8e1d4c..bbaf84e32fe97d2d3cbb8c83f750262f9959ce9f 100644 (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
index fc8791cb59b305f24fbf84c89516acca0b7e636a..7a535876692a1cc739d3bb207f986358d1668861 100644 (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
index f23d0aa3c1d72488e55cdc5c4a71f4e9f0a45c36..f3a79fb21ca7a3a91ddfc78a6b43049dee91d678 100644 (file)
@@ -30,6 +30,8 @@ public:
        friend class QRefDialog;
 
        QRef(Dialog &);
+protected:
+       virtual bool isValid();
 private:
        /// apply changes
        virtual void apply();
index 619f5c581690a90952f31c095aad0080a6be0579..332dbb820162ff1f84b47d607f161ea8fd0590f1 100644 (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();
 }
index cf6724c0e96c4f5cd5b43dbaba926ef83a86afce..3c4db57a91bb0b9494eb4bd8e432555172fbd754 100644 (file)
         <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>