forked from qt-creator/qt-creator
DocumentManager: Refactor saveModified methods
Introduce methods to save a document/list of documents/all documents, both silently and with a dialog to the DocumentManager. All of these return a bool that signifies whether the save was successful or not. Detailed information on which files failed to load or whether the save was canceled by the user are still available as optional in/out parameters. Change-Id: Id17798302f2a8ba6b85a07c1f0b91f03b20da03f Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -1945,8 +1945,9 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
|
||||
} else if (cmd.matches(_("wa"), _("wall"))) {
|
||||
// :w[all]
|
||||
QList<IDocument *> toSave = DocumentManager::modifiedDocuments();
|
||||
QList<IDocument *> failed = DocumentManager::saveModifiedDocumentsSilently(toSave);
|
||||
if (failed.isEmpty())
|
||||
QList<IDocument *> failed;
|
||||
bool success = DocumentManager::saveModifiedDocuments(toSave, QString(), 0, QString(), 0, &failed);
|
||||
if (!success)
|
||||
handler->showMessage(MessageInfo, tr("Saving succeeded"));
|
||||
else
|
||||
handler->showMessage(MessageError, tr("%n files not saved", 0, failed.size()));
|
||||
|
||||
Reference in New Issue
Block a user