| 812 | } |
| 813 | |
| 814 | bool Map::askForSave(const std::string& title) |
| 815 | { |
| 816 | if (!isModified()) |
| 817 | { |
| 818 | // Map is not modified, return positive |
| 819 | return true; |
| 820 | } |
| 821 | |
| 822 | // Ask the user |
| 823 | auto answer = radiant::FileSaveConfirmation::SendAndReceiveAnswer(getSaveConfirmationText(), title); |
| 824 | |
| 825 | if (answer == radiant::FileSaveConfirmation::Action::Cancel) |
| 826 | { |
| 827 | return false; |
| 828 | } |
| 829 | |
| 830 | if (answer == radiant::FileSaveConfirmation::Action::SaveChanges) |
| 831 | { |
| 832 | // The user wants to save the map |
| 833 | if (isUnnamed()) |
| 834 | { |
| 835 | // Map still unnamed, try to save the map with a new name |
| 836 | // and take the return value from the other routine. |
| 837 | return saveAs(); |
| 838 | } |
| 839 | else |
| 840 | { |
| 841 | // Map is named, save it |
| 842 | save(); |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | // Default behaviour: allow the action |
| 847 | return true; |
| 848 | } |
| 849 | |
| 850 | bool Map::saveAs() |
| 851 | { |
no outgoing calls
no test coverage detected