mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
* frontends/{qt2,qt4}/QPrefsDialog.C (remove_format):
Prevent deletion of file formats if they are used by a converter and warn the user accordingly. Fixes crash (bug 2431). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13514 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
eedb4c6821
commit
7b81bf1108
@ -19,6 +19,8 @@
|
||||
#include "qcoloritem.h"
|
||||
#include "qfontexample.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
|
||||
#include "ui/QPrefAsciiModule.h"
|
||||
#include "ui/QPrefDateModule.h"
|
||||
#include "ui/QPrefKeyboardModule.h"
|
||||
@ -845,7 +847,14 @@ void QPrefsDialog::remove_format()
|
||||
int const nr(fileformatsModule->formatsLB->currentItem());
|
||||
if (nr < 0)
|
||||
return;
|
||||
form_->formats().erase(form_->formats().get(nr).name());
|
||||
string const current_text = form_->formats().get(nr).name();
|
||||
if (form_->converters().formatIsUsed(current_text)) {
|
||||
Alert::error(_("Format in use"),
|
||||
_("Cannot remove a Format used by a Converter. "
|
||||
"Remove the converter first."));
|
||||
return;
|
||||
}
|
||||
form_->formats().erase(current_text);
|
||||
updateFormats();
|
||||
form_->converters().update(form_->formats());
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "controllers/frnt_lang.h"
|
||||
#include "controllers/helper_funcs.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
#include "frontends/lyx_gui.h"
|
||||
|
||||
#include "QPrefsDialog.h"
|
||||
@ -969,7 +970,14 @@ void QPrefsDialog::remove_format()
|
||||
int const nr(fileformatsModule->formatsLB->currentItem());
|
||||
if (nr < 0)
|
||||
return;
|
||||
form_->formats().erase(form_->formats().get(nr).name());
|
||||
string const current_text = form_->formats().get(nr).name();
|
||||
if (form_->converters().formatIsUsed(current_text)) {
|
||||
Alert::error(_("Format in use"),
|
||||
_("Cannot remove a Format used by a Converter. "
|
||||
"Remove the converter first."));
|
||||
return;
|
||||
}
|
||||
form_->formats().erase(current_text);
|
||||
updateFormats();
|
||||
form_->converters().update(form_->formats());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user