MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / loadUnsavedFileDetails

Method loadUnsavedFileDetails

src/SessionManager.cpp:295–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295ScintillaNext *SessionManager::loadUnsavedFileDetails(QSettings &settings)
296{
297 qInfo(Q_FUNC_INFO);
298
299 const QString filePath = settings.value("FilePath").toString();
300 const QString sessionFileName = settings.value("SessionFileName").toString();
301 const QString sessionFilePath = sessionDirectory().filePath(sessionFileName);
302
303 qDebug("Session file: \"%s\"", qUtf8Printable(filePath));
304 qDebug(" temp loc: \"%s\"", qUtf8Printable(sessionFilePath));
305
306 ScintillaNext *editor = app->getEditorManager()->getEditorByFilePath(filePath);
307 if (editor != Q_NULLPTR) {
308 qDebug(" file is already open, ignoring");
309 return Q_NULLPTR;
310 }
311
312 if (QFileInfo::exists(filePath) && QFileInfo::exists(sessionFilePath)) {
313 ScintillaNext *editor = ScintillaNext::fromFile(sessionFilePath);
314
315 // Since this editor has different file path info, treat this as a temporary buffer
316 editor->setFileInfo(filePath);
317 editor->setTemporary(true);
318
319 app->getEditorManager()->manageEditor(editor);
320
321 loadEditorViewDetails(editor, settings);
322
323 return editor;
324 }
325 else {
326 // What if just filePath exists?
327 qDebug(" no longer exists on disk, ignoring this file for session loading");
328 return Q_NULLPTR;
329 }
330}
331
332void SessionManager::storeTempFile(ScintillaNext *editor, QSettings &settings)
333{

Callers

nothing calls this directly

Calls 6

toStringMethod · 0.80
getEditorByFilePathMethod · 0.80
getEditorManagerMethod · 0.80
setFileInfoMethod · 0.80
setTemporaryMethod · 0.80
manageEditorMethod · 0.80

Tested by

no test coverage detected