Add new QCheckBox in QET settings for Keep projects in read-only, their

files will cannot be over written


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4872 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2017-01-25 16:53:09 +00:00
parent f40950d714
commit 15c3bf1a39
3 changed files with 11 additions and 0 deletions

View File

@@ -83,6 +83,7 @@ QETProject::QETProject(const QString &path, QObject *parent) :
m_auto_conductor (true ),
m_elements_collection (nullptr)
{
QSettings settings;
//Open the file
QFile project_file(path);
if (!project_file.open(QIODevice::ReadOnly | QIODevice::Text))
@@ -798,6 +799,10 @@ QETResult QETProject::write()
// if the project was opened read-only and the file is still non-writable, do not save the project
if (isReadOnly() && !QFileInfo(file_path_).isWritable())
return(QString("the file %1 was opened read-only and thus will not be written").arg(file_path_));
if (settings.value("qetproject/readonly", true).toBool()){
return(QString("the file %1 was opened read-only and thus will not be written").arg(file_path_));
}
//Get the project in xml
QDomDocument xml_project;