MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / allowFileRestore

Method allowFileRestore

MiniZincIDE/preferencesdialog.cpp:182–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182QByteArray PreferencesDialog::allowFileRestore(const QString& path)
183{
184 QFileInfo fi(path);
185 auto filePath = fi.canonicalFilePath();
186 if (_restore.contains(filePath)) {
187 // Already processed
188 return _restore[filePath];
189 }
190 if (_remove.contains(filePath)) {
191 // Already processed
192 return QByteArray();
193 }
194 QFile f(path);
195 if (f.exists()) {
196 // Restore to old contents on cancel
197 if (f.open(QIODevice::ReadOnly)) {
198 auto contents = f.readAll();
199 _restore[filePath] = contents;
200 f.close();
201 return contents;
202 }
203 } else {
204 // Remove on cancel
205 _remove << filePath;
206 }
207 return QByteArray();
208}
209
210void PreferencesDialog::loadDriver(bool showError)
211{

Callers

nothing calls this directly

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected