Fix error on setting favorite render profile

parent 8e95cf31
......@@ -539,9 +539,13 @@ void RenderWidget::slotSaveProfile()
void RenderWidget::saveProfile(const QDomElement &newprofile)
{
QDir dir(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/export/");
if (!dir.exists()) {
dir.mkpath(".");
}
QString exportFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/export/customprofiles.xml";
QDomDocument doc;
QFile file(exportFile);
QFile file(dir.absoluteFilePath("customprofiles.xml"));
doc.setContent(&file, false);
file.close();
QDomElement documentElement;
......@@ -586,13 +590,13 @@ void RenderWidget::saveProfile(const QDomElement &newprofile)
//QCString save = doc.toString().utf8();
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
KMessageBox::sorry(this, i18n("Unable to write to file %1", exportFile));
KMessageBox::sorry(this, i18n("Unable to write to file %1", dir.absoluteFilePath("customprofiles.xml")));
return;
}
QTextStream out(&file);
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
KMessageBox::error(this, i18n("Cannot write to file %1", dir.absoluteFilePath("customprofiles.xml")));
file.close();
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment