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

Method checkFileForStateChange

src/ScintillaNext.cpp:481–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481ScintillaNext::FileStateChange ScintillaNext::checkFileForStateChange()
482{
483 if (bufferType == BufferType::New) {
484 return FileStateChange::NoChange;
485 }
486 else if (bufferType == BufferType::File) {
487 // refresh else exists() fails to notice missing file
488 fileInfo.refresh();
489
490 if (!fileInfo.exists()) {
491 bufferType = BufferType::FileMissing;
492
493 emit savePointChanged(false);
494
495 return FileStateChange::Deleted;
496 }
497
498 // See if the timestamp changed
499 if (modifiedTime != fileTimestamp()) {
500 return FileStateChange::Modified;
501 }
502 else {
503 return FileStateChange::NoChange;
504 }
505 }
506 else if (bufferType == BufferType::FileMissing) {
507 // See if it reappeared
508 fileInfo.refresh();
509
510 if (fileInfo.exists()) {
511 bufferType = BufferType::File;
512
513 return FileStateChange::Restored;
514 }
515 else {
516 return FileStateChange::NoChange;
517 }
518 }
519
520 qInfo("type() = %d", bufferType);
521 Q_ASSERT(false);
522
523 return FileStateChange::NoChange;
524}
525
526bool ScintillaNext::moveToTrash()
527{

Callers 1

Calls 1

refreshMethod · 0.80

Tested by

no test coverage detected