Improve code style, Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-08-16 14:26:40 +02:00
parent c4bf492616
commit 41cef49453
16 changed files with 128 additions and 101 deletions

View File

@@ -870,17 +870,19 @@ bool QETProject::close() {
*/
QETResult QETProject::write()
{
// this operation requires a filepath
// this operation requires a filepath
if (m_file_path.isEmpty())
return(QString("unable to save project to file: no filepath was specified"));
// if the project was opened read-only and the file is still non-writable, do not save the project
// if the project was opened read-only
// and the file is still non-writable, do not save the project
if (isReadOnly() && !QFileInfo(m_file_path).isWritable())
return(QString("the file %1 was opened read-only and thus will not be written").arg(m_file_path));
QDomDocument xml_project(toXml());
QDomDocument xml_project(toXml());
QString error_message;
if (!QET::writeXmlFile(xml_project, m_file_path, &error_message)) return(error_message);
if (!QET::writeXmlFile(xml_project, m_file_path, &error_message))
return(error_message);
//title block variables should be updated after file save dialog is confirmed, before file is saved.
m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate));