disallow the insertion of incomplete citation references, prevent crash (bug 1617)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8818 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2004-06-21 08:56:43 +00:00
parent fe87ad6b88
commit c842720218
5 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2004-06-21 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* QCitation.[Ch]: add validation (fix bug 1617).
2004-06-18 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyx_gui.C (roman_font_name): go through QString when converting

View File

@ -19,6 +19,7 @@
#include "bufferparams.h"
#include "controllers/ButtonController.h"
#include "controllers/ControlCitation.h"
#include "support/lstrings.h"
@ -212,6 +213,8 @@ void QCitation::update_contents()
// the bool prevents that this is also done after "apply"
if (open_find_)
dialog_->openFind();
bc().valid(isValid());
}
@ -229,5 +232,12 @@ void QCitation::updateBrowser(QListBox * browser,
}
}
bool QCitation::isValid()
{
return dialog_->selectedLB->count() > 0;
}
} // namespace frontend
} // namespace lyx

View File

@ -31,6 +31,8 @@ public:
friend class QCitationDialog;
///
QCitation(Dialog &);
protected:
virtual bool isValid();
private:
/// Set the Params variable for the Controller.

View File

@ -1,3 +1,7 @@
2004-06-21 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormCitation.C: Don't allow incomplete input (fix bug 1617).
2004-06-04 Angus Leeming <leeming@lyx.org>
* combox.c (combox_handle): prevent crash when trying to draw

View File

@ -434,6 +434,10 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
fl_set_choice(dialog_->choice_style, choice);
}
// Invalid if no citation has been chosen
if (fl_get_browser_maxline(dialog_->browser_cite) < 1)
activate = ButtonPolicy::SMI_INVALID;
return activate;
}