+bool BufferList::qwriteOne(Buffer * buf, string const & fname,
+ string & unsaved_list)
+{
+ bool reask = true;
+ while (reask) {
+ switch (Alert::askConfirmation(_("Changes in document:"),
+ fname,
+ _("Save document?"))) {
+ case 1: // Yes
+ // FIXME: WriteAs can be asynch !
+ if (buf->isUnnamed())
+ reask = !WriteAs(current_view, buf);
+ else {
+ reask = !MenuWrite(current_view, buf);
+ }
+ break;
+ case 2: // No
+ // if we crash after this we could
+ // have no autosave file but I guess
+ // this is really inprobable (Jug)
+ if (buf->isUnnamed()) {
+ removeAutosaveFile(buf->fileName());
+ }
+
+ unsaved_list += MakeDisplayPath(fname, 50) + "\n";
+ return true;
+ case 3: // Cancel
+ return false;
+ }
+ }
+ return true;
+}
+
+