| 261 | } |
| 262 | |
| 263 | void ProjectControl::command_OpenRecentProject(const MyGUI::UString& _commandName, bool& _result) |
| 264 | { |
| 265 | if (!checkCommand()) |
| 266 | return; |
| 267 | |
| 268 | MyGUI::UString data = CommandManager::getInstance().getCommandData(); |
| 269 | if (data.empty()) |
| 270 | return; |
| 271 | |
| 272 | clear(); |
| 273 | |
| 274 | MyGUI::UString filePath; |
| 275 | MyGUI::UString fileName = data; |
| 276 | |
| 277 | size_t index = data.find_last_of("\\/"); |
| 278 | if (index != MyGUI::UString::npos) |
| 279 | { |
| 280 | filePath = data.substr(0, index); |
| 281 | fileName = data.substr(index + 1); |
| 282 | } |
| 283 | |
| 284 | RecentFilesManager::getInstance().setRecentFolder(filePath); |
| 285 | setFileName(filePath, fileName); |
| 286 | |
| 287 | if (!load()) |
| 288 | { |
| 289 | /*MyGUI::Message* message = */ MessageBoxManager::getInstance().create( |
| 290 | replaceTags("Error"), |
| 291 | replaceTags("MessageFailedLoadProject"), |
| 292 | MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok); |
| 293 | |
| 294 | clear(); |
| 295 | } |
| 296 | |
| 297 | updateCaption(); |
| 298 | |
| 299 | _result = true; |
| 300 | } |
| 301 | |
| 302 | bool ProjectControl::checkCommand() |
| 303 | { |
nothing calls this directly
no test coverage detected