diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-09-08 12:52:35 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-09-12 10:04:20 +0000 |
commit | 21ab4c427c160eafd5550ff46944ee5be23bd7a5 (patch) | |
tree | dedcd6f5273f1c05d1fa2199906ef1bcf3ac736f /src/plugins/vcsbase | |
parent | 1e3b5418eac08df5292913e7ff8841972b72695e (diff) | |
download | qt-creator-21ab4c427c160eafd5550ff46944ee5be23bd7a5.tar.gz |
VCS: Offer to save-all before commit
Task-number: QTCREATORBUG-3857
Change-Id: I3ff3d90803eec4134b9da4af5567753ad7bffafb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/vcsbase')
-rw-r--r-- | src/plugins/vcsbase/vcsbaseplugin.cpp | 10 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbaseplugin.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index edc68b2a0c..dcf648a4e7 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -641,6 +641,16 @@ bool VcsBasePlugin::enableMenuAction(ActionState as, QAction *menuAction) const return true; } +QString VcsBasePlugin::commitDisplayName() const +{ + return tr("commit", "name of \"commit\" action of the VCS."); +} + +bool VcsBasePlugin::promptBeforeCommit() +{ + return DocumentManager::saveAllModifiedDocuments(tr("Save before %1?").arg(commitDisplayName()); +} + void VcsBasePlugin::promptToDeleteCurrentFile() { const VcsBasePluginState state = currentState(); diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index 0312d63724..72b2c5a46e 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -178,6 +178,11 @@ public: const QProcessEnvironment &env = QProcessEnvironment()); protected: + // Display name of the commit action: + virtual QString commitDisplayName() const; + // Prompt to save all files before commit: + bool promptBeforeCommit(); + // Convenience slot for "Delete current file" action. Prompts to // delete the file via VcsManager. void promptToDeleteCurrentFile(); |