Make the "prompt to submit" setting a per-plugin one.

Provide a checkable message box to be able to turn
prompting off when asked.
This commit is contained in:
Friedemann Kleint
2009-06-19 16:34:38 +02:00
parent e05505613a
commit 2508fa03a0
25 changed files with 554 additions and 69 deletions

View File

@@ -930,20 +930,26 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
if (!perforceEditor)
return true;
QFileInfo editorFile(fileIFace->fileName());
QFileInfo changeFile(m_changeTmpFile->fileName());
QFileInfo changeFile(m_changeTmpFile->fileName());
if (editorFile.absoluteFilePath() == changeFile.absoluteFilePath()) {
// Prompt the user. Force a prompt unless submit was actually invoked (that
// is, the editor was closed or shutdown).
bool wantsPrompt = m_settings.promptToSubmit();
const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult answer =
perforceEditor->promptSubmit(tr("Closing p4 Editor"),
tr("Do you want to submit this change list?"),
tr("The commit message check failed. Do you want to submit this change list"),
!m_submitActionTriggered);
&wantsPrompt, !m_submitActionTriggered);
m_submitActionTriggered = false;
if (answer == VCSBase::VCSBaseSubmitEditor::SubmitCanceled)
return false;
// Set without triggering the checking mechanism
if (wantsPrompt != m_settings.promptToSubmit()) {
m_settings.setPromptToSubmit(wantsPrompt);
m_settings.toSettings(Core::ICore::instance()->settings());
}
core->fileManager()->blockFileChange(fileIFace);
fileIFace->save();
core->fileManager()->unblockFileChange(fileIFace);