+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
string const after = fromqstr(dialog_->textAfterED->text());
controller().params().setOptions(after);
+
+ style_ = choice;
+ open_find_ = false;
}
{
citekeys.clear();
bibkeys.clear();
+ open_find_ = true;
QDialogView::hide();
}
// add when enabled !
//bcview().addReadOnly(dialog_->textBeforeED);
bcview().addReadOnly(dialog_->textAfterED);
+
+ open_find_ = true;
}
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);
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();
}
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
* 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.
*/
#include "qt_helpers.h"
#include "controllers/ControlCitation.h"
+#include "ButtonController.h"
#include <qcheckbox.h>
#include <qlineedit.h>
}
+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();
~QCitationDialog();
void setButtons();
+ /// open the find dialog if nothing selected
+ void openFind();
QCitationFindDialogBase * add_;
dialog_->sortCB->setChecked(sort_);
+ int const orig = dialog_->bufferCO->currentItem();
// insert buffer list
dialog_->bufferCO->clear();
vector<string> const buffers = controller().getBufferList();
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();
}
refs_ = controller().getLabelList(name);
dialog_->sortCB->setEnabled(!refs_.empty());
dialog_->refsLB->setEnabled(!refs_.empty());
+ dialog_->gotoPB->setEnabled(!refs_.empty());
redoRefs();
}