forked from qt-creator/qt-creator
Handle internally triggered deletes more gracefull
If the user has enabled "Reload unmodified" then on remove the unmodified editors are closed. Otherwise the user is asked as before. Also modify the message to indicate if the change was triggred externally.
This commit is contained in:
@@ -81,12 +81,16 @@ QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer
|
||||
}
|
||||
|
||||
QTCREATOR_UTILS_EXPORT Utils::FileDeletedPromptAnswer
|
||||
Utils::fileDeletedPrompt(const QString &fileName, QWidget *parent)
|
||||
Utils::fileDeletedPrompt(const QString &fileName, bool triggerExternally, QWidget *parent)
|
||||
{
|
||||
const QString title = QCoreApplication::translate("Utils::fileDeletedPrompt", "File has been removed");
|
||||
QString msg;
|
||||
msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
||||
"The file %1 has been removed outside Qt Creator. Do you want to save it under a different name, or close the editor?").arg(QDir::toNativeSeparators(fileName));
|
||||
if (triggerExternally)
|
||||
msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
||||
"The file %1 has been removed outside Qt Creator. Do you want to save it under a different name, or close the editor?").arg(QDir::toNativeSeparators(fileName));
|
||||
else
|
||||
msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
||||
"The file %1 was removed. Do you want to save it under a different name, or close the editor?").arg(QDir::toNativeSeparators(fileName));
|
||||
QMessageBox box(QMessageBox::Question, title, msg, QMessageBox::NoButton, parent);
|
||||
QPushButton *close = box.addButton(QCoreApplication::translate("Utils::fileDeletedPrompt", "Close"), QMessageBox::RejectRole);
|
||||
QPushButton *saveas = box.addButton(QCoreApplication::translate("Utils::fileDeletedPrompt", "Save as..."), QMessageBox::ActionRole);
|
||||
|
||||
Reference in New Issue
Block a user