| 293 | } |
| 294 | |
| 295 | ScintillaNext *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 | |
| 332 | void SessionManager::storeTempFile(ScintillaNext *editor, QSettings &settings) |
| 333 | { |
nothing calls this directly
no test coverage detected