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

Method checkFileForModification

src/dialogs/MainWindow.cpp:1873–1902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1871}
1872
1873bool MainWindow::checkFileForModification(ScintillaNext *editor)
1874{
1875 qInfo(Q_FUNC_INFO);
1876
1877 auto state = editor->checkFileForStateChange();
1878
1879 if (state == ScintillaNext::NoChange) {
1880 return false;
1881 }
1882 else if (state == ScintillaNext::Modified) {
1883 qInfo("ScintillaNext::Modified");
1884 const QString filePath = editor->getFilePath();
1885 auto reply = QMessageBox::question(this, tr("Reload File"), tr("<b>%1</b> has been modified by another program. Do you want to reload it?").arg(filePath));
1886
1887 if (reply == QMessageBox::Yes) {
1888 editor->reload();
1889 }
1890 else {
1891 editor->omitModifications();
1892 }
1893 }
1894 else if (state == ScintillaNext::Deleted) {
1895 qInfo("ScintillaNext::Deleted");
1896 }
1897 else if (state == ScintillaNext::Restored) {
1898 qInfo("ScintillaNext::Restored");
1899 }
1900
1901 return true;
1902}
1903
1904void MainWindow::showSaveErrorMessage(ScintillaNext *editor, QFileDevice::FileError error)
1905{

Callers

nothing calls this directly

Calls 4

getFilePathMethod · 0.80
reloadMethod · 0.80
omitModificationsMethod · 0.80

Tested by

no test coverage detected