]> git.lyx.org Git - features.git/commitdiff
disallow the insertion of incomplete citation references, prevent crash (bug 1617)
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 21 Jun 2004 08:56:43 +0000 (08:56 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 21 Jun 2004 08:56:43 +0000 (08:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8818 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QCitation.C
src/frontends/qt2/QCitation.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormCitation.C

index 0e6b72baeeaa8631a5daa8be96cc1c9575069e26..7585f32fa1115bc2d60b9cc84b78cd16b3fdbf53 100644 (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
index aefedb6c3195914406832ced33c6d20316c45110..7f7c9a45ba5d7bfa963a01db8f81b361054e3cd0 100644 (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
index 23d22f2213e8f2fca4007b29c78530dfe1b1dbcc..b185b763286356ff4c012aed6b4766ab1188fa3d 100644 (file)
@@ -31,6 +31,8 @@ public:
        friend class QCitationDialog;
        ///
        QCitation(Dialog &);
+protected:
+       virtual bool isValid();
 private:
 
        /// Set the Params variable for the Controller.
index cee43700b305f63f70a115e8ec0a895c8ca54769..d9be053ea8afd927f5ec6d484b30d2b4217f7060 100644 (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
index f6891d43f8cb257ac444b1b8b94428f9aee515e7..1898387635125eaf90dd6db8dd633dccd69916c2 100644 (file)
@@ -433,6 +433,10 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
                           controller().getCiteStrings(currentCitekey));
                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;
 }