A bit of house cleaning.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24638 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-05-06 13:50:37 +00:00
parent 2e7c94ee0f
commit 39276a1254
2 changed files with 24 additions and 27 deletions

View File

@ -15,8 +15,11 @@
#include "GuiCitation.h" #include "GuiCitation.h"
#include "GuiSelectionManager.h"
#include "qt_helpers.h" #include "qt_helpers.h"
#include "Buffer.h" #include "Buffer.h"
#include "BiblioInfo.h"
#include "BufferParams.h" #include "BufferParams.h"
#include "FuncRequest.h" #include "FuncRequest.h"
@ -77,7 +80,7 @@ static vector<lyx::docstring> to_docstring_vector(QStringList const & qlist)
GuiCitation::GuiCitation(GuiView & lv) GuiCitation::GuiCitation(GuiView & lv)
: GuiDialog(lv, "citation", qt_("Citation")), : DialogView(lv, "citation", qt_("Citation")),
params_(insetCode("citation")) params_(insetCode("citation"))
{ {
setupUi(this); setupUi(this);
@ -106,11 +109,10 @@ GuiCitation::GuiCitation(GuiView & lv)
connect(selectionManager, SIGNAL(selectionChanged()), connect(selectionManager, SIGNAL(selectionChanged()),
this, SLOT(setCitedKeys())); this, SLOT(setCitedKeys()));
connect(selectionManager, SIGNAL(updateHook()), connect(selectionManager, SIGNAL(updateHook()),
this, SLOT(updateDialog())); this, SLOT(updateControls()));
connect(selectionManager, SIGNAL(okHook()), connect(selectionManager, SIGNAL(okHook()),
this, SLOT(on_okPB_clicked())); this, SLOT(on_okPB_clicked()));
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
// FIXME: the sizeHint() for this is _way_ too high // FIXME: the sizeHint() for this is _way_ too high
infoML->setFixedHeight(60); infoML->setFixedHeight(60);
} }
@ -154,10 +156,9 @@ void GuiCitation::applyView()
void GuiCitation::showEvent(QShowEvent * e) void GuiCitation::showEvent(QShowEvent * e)
{ {
init();
findLE->clear(); findLE->clear();
availableLV->setFocus(); availableLV->setFocus();
GuiDialog::showEvent(e); DialogView::showEvent(e);
} }
@ -185,16 +186,6 @@ void GuiCitation::on_applyPB_clicked()
void GuiCitation::on_restorePB_clicked() void GuiCitation::on_restorePB_clicked()
{ {
init(); init();
updateView();
}
void GuiCitation::updateView()
{
init();
fillFields();
fillEntries();
updateDialog();
} }
@ -204,7 +195,7 @@ void GuiCitation::updateView()
// will not have changed. At the moment, however, the division between // will not have changed. At the moment, however, the division between
// fillStyles() and updateStyle() doesn't lend itself to dividing the // fillStyles() and updateStyle() doesn't lend itself to dividing the
// two methods, though they should be divisible. // two methods, though they should be divisible.
void GuiCitation::updateDialog() void GuiCitation::updateControls()
{ {
if (selectionManager->selectedFocused()) { if (selectionManager->selectedFocused()) {
if (selectedLV->selectionModel()->selectedIndexes().isEmpty()) if (selectedLV->selectionModel()->selectedIndexes().isEmpty())
@ -406,7 +397,7 @@ void GuiCitation::findText(QString const & text, bool reset)
//availableLV. Currently, we get an automatic reset, since the //availableLV. Currently, we get an automatic reset, since the
//model is reset. //model is reset.
updateDialog(); updateControls();
} }
@ -537,6 +528,10 @@ void GuiCitation::init()
else else
cited_keys_ = str.split(","); cited_keys_ = str.split(",");
selected_model_.setStringList(cited_keys_); selected_model_.setStringList(cited_keys_);
fillFields();
fillEntries();
updateControls();
} }
@ -628,6 +623,7 @@ bool GuiCitation::initialiseParams(string const & data)
InsetCommand::string2params("citation", data, params_); InsetCommand::string2params("citation", data, params_);
CiteEngine const engine = buffer().params().citeEngine(); CiteEngine const engine = buffer().params().citeEngine();
citeStyles_ = citeStyles(engine); citeStyles_ = citeStyles(engine);
init();
return true; return true;
} }

View File

@ -15,22 +15,25 @@
#ifndef GUICITATION_H #ifndef GUICITATION_H
#define GUICITATION_H #define GUICITATION_H
#include "GuiDialog.h" #include "DialogView.h"
#include "GuiSelectionManager.h"
#include "ui_CitationUi.h" #include "ui_CitationUi.h"
#include "BiblioInfo.h"
#include "Citation.h"
#include "insets/InsetCommandParams.h" #include "insets/InsetCommandParams.h"
#include "Citation.h"
#include <QStringList> #include <QStringList>
#include <QStringListModel> #include <QStringListModel>
namespace lyx { namespace lyx {
class BiblioInfo;
namespace frontend { namespace frontend {
class GuiCitation : public GuiDialog, public Ui::CitationUi class GuiSelectionManager;
class GuiCitation : public DialogView, public Ui::CitationUi
{ {
Q_OBJECT Q_OBJECT
@ -42,9 +45,7 @@ public:
/// ///
void applyView(); void applyView();
public Q_SLOTS: void updateView() {}
/// Update the display of the dialog whilst it is still visible.
void updateView();
private: private:
/// ///
@ -77,7 +78,7 @@ private Q_SLOTS:
/// ///
void setCitedKeys(); void setCitedKeys();
/// performs a limited update, suitable for internal call /// performs a limited update, suitable for internal call
void updateDialog(); void updateControls();
private: private:
/// enable/disable buttons /// enable/disable buttons