Use UTF8 for storing comments in files.

This commit is contained in:
leo 2013-12-08 22:44:01 +00:00
parent eb9a75fc25
commit 717a36d3b5
2 changed files with 10 additions and 6 deletions

View file

@ -6,6 +6,7 @@ Leonardo Zide <leozide@gmail.com>
Contributions (in alphabetical order): Contributions (in alphabetical order):
Christian Höltje <docwhat@gerf.org> Christian Höltje <docwhat@gerf.org>
David Paleino <dapal@debian.org> David Paleino <dapal@debian.org>
Hubert Figuiere <hub@figuiere.net>
Joerg Scheurich <rusmufti@helpdesk.bera.rus.uni-stuttgart.de> Joerg Scheurich <rusmufti@helpdesk.bera.rus.uni-stuttgart.de>
Nicolas Guilbert <nicolas@ange.dk> Nicolas Guilbert <nicolas@ange.dk>
Nicolas Schodet <nico-leocad@ni.fr.eu.org> Nicolas Schodet <nico-leocad@ni.fr.eu.org>

View file

@ -25,9 +25,9 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
setWindowTitle(QString(tr("%1 Properties")).arg(options->Title)); setWindowTitle(QString(tr("%1 Properties")).arg(options->Title));
ui->descriptionEdit->setText(options->Description); ui->descriptionEdit->setText(QString::fromUtf8(options->Description));
ui->authorEdit->setText(options->Author); ui->authorEdit->setText(QString::fromUtf8(options->Author));
ui->commentsEdit->setText(options->Comments); ui->commentsEdit->setText(QString::fromUtf8(options->Comments));
if (options->BackgroundType == 2) if (options->BackgroundType == 2)
ui->imageRadio->setChecked(true); ui->imageRadio->setChecked(true);
@ -123,9 +123,12 @@ lcQPropertiesDialog::~lcQPropertiesDialog()
void lcQPropertiesDialog::accept() void lcQPropertiesDialog::accept()
{ {
strcpy(options->Description, ui->descriptionEdit->text().toLocal8Bit().data()); strncpy(options->Description, ui->descriptionEdit->text().toUtf8().data(), sizeof(options->Description));
strcpy(options->Author, ui->authorEdit->text().toLocal8Bit().data()); options->Description[sizeof(options->Description) - 1] = 0;
strcpy(options->Comments, ui->commentsEdit->toPlainText().toLocal8Bit().data()); strncpy(options->Author, ui->authorEdit->text().toUtf8().data(), sizeof(options->Author));
options->Author[sizeof(options->Author) - 1] = 0;
strncpy(options->Comments, ui->commentsEdit->toPlainText().toUtf8().data(), sizeof(options->Comments));
options->Comments[sizeof(options->Comments) - 1] = 0;
if (ui->imageRadio->isChecked()) if (ui->imageRadio->isChecked())
options->BackgroundType = 2; options->BackgroundType = 2;