@@ -1107,14 +1107,33 @@ void MainWindow::onEditorFileChangedExternally()
11071107 if (!editor) editor = currentEditor;
11081108 if (!editor) return ;
11091109
1110- auto ret = QMessageBox::question (this ,
1111- " File has been modified externally!" ,
1112- " The file that you have currently opened has been modified outside the CEGUI Unified Editor."
1113- " \n\n Reload the file?\n\n If you select Yes, ALL UNDO HISTORY WILL BE DESTROYED!" ,
1114- QMessageBox::No | QMessageBox::Yes,
1115- QMessageBox::No); // defaulting to No is safer IMO
1116-
1117- editor->resolveSyncConflict (ret == QMessageBox::Yes);
1110+ if (QFileInfo::exists (editor->getFilePath ()))
1111+ {
1112+ // File changed
1113+ auto ret = QMessageBox::question (this ,
1114+ " File has been modified externally!" ,
1115+ " The file that you have currently opened has been modified outside the CEGUI Unified Editor."
1116+ " \n\n Reload the file?\n\n If you select Yes, ALL UNDO HISTORY WILL BE DESTROYED!" ,
1117+ QMessageBox::No | QMessageBox::Yes,
1118+ QMessageBox::No); // defaulting to No is safer IMO
1119+
1120+ editor->resolveSyncConflict (ret == QMessageBox::Yes);
1121+ }
1122+ else
1123+ {
1124+ // File moved or deleted
1125+ auto ret = QMessageBox::question (this ,
1126+ " File has been moved or deleted externally!" ,
1127+ " The file that you have currently opened has been moved or deleted form the disk."
1128+ " \n\n Keep the file opened?" ,
1129+ QMessageBox::No | QMessageBox::Yes,
1130+ QMessageBox::Yes);
1131+
1132+ if (ret == QMessageBox::Yes)
1133+ editor->resolveSyncConflict (false );
1134+ else
1135+ closeEditorTab (editor);
1136+ }
11181137
11191138 displayingReloadAlert = false ;
11201139}
0 commit comments