]> git.lyx.org Git - features.git/commitdiff
various qt fixes (bug 1146, bug 1037, bug 1511)
authorJürgen Spitzmüller <spitz@lyx.org>
Wed, 18 Feb 2004 14:02:49 +0000 (14:02 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Wed, 18 Feb 2004 14:02:49 +0000 (14:02 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8440 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QCitation.C
src/frontends/qt2/QCitation.h
src/frontends/qt2/QCitationDialog.C
src/frontends/qt2/QCitationDialog.h
src/frontends/qt2/QRef.C

index bffc44e6c6160305d42954667f2e4566d044f38c..77f6d849a4c2e07a77b79d94ae627e78d25408bf 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-18  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * QCitation.[Ch]:
+       * QCitationDialog.[Ch]: open the find dialog if an inset is 
+       new (new method openFind()). Fixes bug 1146.
+       
+       * QCitation.C: restore the chosen natbib style.
+       
+       * QRef.C: Disable goto button if there is no ref (bug 1037)
+       Restore setting of the buffer combo (bug 1511)
+
 2004-02-01  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * floatplacement.C (set): "c" -> 'c' in calls to contains
index 010bbedfaa7e552b93147cbaf5da89d40172b5b2..83e86325111df8de4e389b251a9c9b94db5cee29 100644 (file)
@@ -62,6 +62,9 @@ void QCitation::apply()
 
        string const after = fromqstr(dialog_->textAfterED->text());
        controller().params().setOptions(after);
+       
+       style_ = choice;
+       open_find_ = false;
 }
 
 
@@ -69,6 +72,7 @@ void QCitation::hide()
 {
        citekeys.clear();
        bibkeys.clear();
+       open_find_ = true;
 
        QDialogView::hide();
 }
@@ -94,6 +98,8 @@ void QCitation::build_dialog()
        // add when enabled !
        //bcview().addReadOnly(dialog_->textBeforeED);
        bcview().addReadOnly(dialog_->textAfterED);
+       
+       open_find_ = true;
 }
 
 
@@ -147,8 +153,12 @@ void QCitation::updateStyle()
 
        vector<biblio::CiteStyle>::const_iterator cit =
                find(styles.begin(), styles.end(), cs.style);
-
-       dialog_->citationStyleCO->setCurrentItem(0);
+       
+       // restore the latest natbib style 
+       if (style_ >= 0 && style_ < dialog_->citationStyleCO->count())
+               dialog_->citationStyleCO->setCurrentItem(style_);
+       else
+               dialog_->citationStyleCO->setCurrentItem(0);
        dialog_->fulllistCB->setChecked(false);
        dialog_->forceuppercaseCB->setChecked(false);
 
@@ -179,6 +189,11 @@ void QCitation::update_contents()
 
        fillStyles();
        updateStyle();
+       
+       // open the find dialog if nothing has been selected (yet)
+       // the bool prevents that this is also done after "apply"
+       if (open_find_)
+               dialog_->openFind();
 }
 
 
index 742f008c0e0d61edca18c62d143fe79ea82f4327..446e7b2e65b5a5a6a98c76208aa24c14a4e06182 100644 (file)
@@ -47,11 +47,15 @@ private:
        void updateStyle();
 
        void updateBrowser(QListBox *, std::vector<std::string> const &) const;
+       /// check if apply has been pressed
+       bool open_find_;
 
        /// selected keys
        std::vector<std::string> citekeys;
        /// available bib keys
        std::vector<std::string> bibkeys;
+       /// selected natbib style
+       int style_;
 };
 
 #endif // QCITATION_H
index d5be3d1b1cef497e32dd797f4f7d809dd976ed6c..09715ca59fc35160e0c4a748e3b0942c8f721419 100644 (file)
@@ -4,6 +4,8 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Kalle Dalheimer
+ * \author John Levon
+ * \author Jürgen Spitzmüller
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -12,6 +14,7 @@
 
 #include "qt_helpers.h"
 #include "controllers/ControlCitation.h"
+#include "ButtonController.h"
 
 #include <qcheckbox.h>
 #include <qlineedit.h>
@@ -71,6 +74,21 @@ void QCitationDialog::setButtons()
 }
 
 
+void QCitationDialog::openFind()
+{
+       if (form_->readOnly())
+               return;
+       
+       if (selectedLB->count() == 0 && add_->availableLB->count() != 0){
+               // open the find dialog
+               add();
+               // and let the user press ok after a selection
+               if (selectedLB->count() != 0)
+                       form_->bc().valid();
+       }
+}
+
+
 void QCitationDialog::selectedChanged()
 {
        form_->fillStyles();
index a0131c64aa1b59ecdd045f063ccdc4788609f1ce..7f987b0af49db4b7f9344a0e4ff2e9e5a53c02a8 100644 (file)
@@ -28,6 +28,8 @@ public:
        ~QCitationDialog();
 
        void setButtons();
+       /// open the find dialog if nothing selected
+       void openFind();
 
        QCitationFindDialogBase * add_;
 
index 8ae515995ac241e7798d911079ceea6929b8e54e..695c439e75db80b89dc3735a55dc8889aa9c5a1e 100644 (file)
@@ -73,6 +73,7 @@ void QRef::update_contents()
 
        dialog_->sortCB->setChecked(sort_);
 
+       int const orig = dialog_->bufferCO->currentItem();
        // insert buffer list
        dialog_->bufferCO->clear();
        vector<string> const buffers = controller().getBufferList();
@@ -80,7 +81,10 @@ void QRef::update_contents()
                it != buffers.end(); ++it) {
                dialog_->bufferCO->insertItem(toqstr(*it));
        }
-       dialog_->bufferCO->setCurrentItem(controller().getBufferNum());
+       if (orig != -1 && orig < dialog_->bufferCO->count())
+               dialog_->bufferCO->setCurrentItem(orig);
+       else
+               dialog_->bufferCO->setCurrentItem(controller().getBufferNum());
 
        updateRefs();
 }
@@ -183,5 +187,6 @@ void QRef::updateRefs()
        refs_ = controller().getLabelList(name);
        dialog_->sortCB->setEnabled(!refs_.empty());
        dialog_->refsLB->setEnabled(!refs_.empty());
+       dialog_->gotoPB->setEnabled(!refs_.empty());
        redoRefs();
 }