mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Save read-only state in project file
When opening a database in read-only mode and creating a project file, save the read-only flag in the project file. When loading a project file with a read only flag set, open the database in read-only mode. See issue #1598.
This commit is contained in:
@@ -2615,6 +2615,10 @@ bool MainWindow::loadProject(QString filename, bool readOnly)
|
||||
{
|
||||
if(xml.name() == "db")
|
||||
{
|
||||
// Read only?
|
||||
if(xml.attributes().hasAttribute("readonly"))
|
||||
readOnly = xml.attributes().value("readonly").toInt();
|
||||
|
||||
// DB file
|
||||
QString dbfilename = xml.attributes().value("path").toString();
|
||||
if(!QFile::exists(dbfilename))
|
||||
@@ -2887,6 +2891,7 @@ void MainWindow::saveProject()
|
||||
// Database file name
|
||||
xml.writeStartElement("db");
|
||||
xml.writeAttribute("path", db.currentFile());
|
||||
xml.writeAttribute("readonly", QString::number(db.readOnly()));
|
||||
xml.writeAttribute("foreign_keys", db.getPragma("foreign_keys"));
|
||||
xml.writeAttribute("case_sensitive_like", db.getPragma("case_sensitive_like"));
|
||||
xml.writeAttribute("temp_store", db.getPragma("temp_store"));
|
||||
|
||||
Reference in New Issue
Block a user