Commit 23ba1ea2 authored by con's avatar con
Browse files

Don't show the full file name in the reload prompt by default.

Because paths can get long, and text wrapping in QMessageBox will do the
wrong thing. Put the full file name into the details of the message box.

Task-number: QTCREATORBUG-1708
parent 6941781c
......@@ -46,19 +46,25 @@ QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer
if (modified)
msg = QCoreApplication::translate("Utils::reloadPrompt",
"The unsaved file %1 has been changed outside Qt Creator. Do you want to reload it and discard your changes?").arg(QDir::toNativeSeparators(fileName));
"The unsaved file <i>%1</i> has been changed outside Qt Creator. Do you want to reload it and discard your changes?");
else
msg = QCoreApplication::translate("Utils::reloadPrompt",
"The file %1 has changed outside Qt Creator. Do you want to reload it?").arg(QDir::toNativeSeparators(fileName));
return reloadPrompt(title, msg, parent);
"The file <i>%1</i> has changed outside Qt Creator. Do you want to reload it?");
msg = msg.arg(QFileInfo(fileName).fileName());
return reloadPrompt(title, msg, QDir::toNativeSeparators(fileName), parent);
}
QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer
Utils::reloadPrompt(const QString &title, const QString &prompt, QWidget *parent)
Utils::reloadPrompt(const QString &title, const QString &prompt, const QString &details, QWidget *parent)
{
switch (QMessageBox::question(parent, title, prompt,
QMessageBox::Yes|QMessageBox::YesToAll|QMessageBox::No|QMessageBox::NoToAll,
QMessageBox::YesToAll)) {
QMessageBox msg(parent);
msg.setStandardButtons(QMessageBox::Yes|QMessageBox::YesToAll|QMessageBox::No|QMessageBox::NoToAll);
msg.setDefaultButton(QMessageBox::YesToAll);
msg.setWindowTitle(title);
msg.setText(prompt);
msg.setDetailedText(details);
switch (msg.exec()) {
case QMessageBox::Yes:
return ReloadCurrent;
case QMessageBox::YesToAll:
......
......@@ -42,7 +42,7 @@ namespace Utils {
enum ReloadPromptAnswer { ReloadCurrent, ReloadAll, ReloadSkipCurrent, ReloadNone };
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &fileName, bool modified, QWidget *parent);
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title, const QString &prompt, QWidget *parent);
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title, const QString &prompt, const QString &details, QWidget *parent);
enum FileDeletedPromptAnswer { FileDeletedClose, FileDeletedSaveAs, FileDeletedSave };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment