| 461 | } |
| 462 | |
| 463 | bool ProjectControl::renameItemInProject(size_t _index, const MyGUI::UString& _name) |
| 464 | { |
| 465 | bool renamed = false; |
| 466 | |
| 467 | MyGUI::UString fileName = common::concatenatePath(mProjectPath, mProjectName); |
| 468 | |
| 469 | MyGUI::xml::Document doc; |
| 470 | if (!doc.open(fileName)) |
| 471 | { |
| 472 | MYGUI_LOGGING(LogSection, Error, doc.getLastError()); |
| 473 | return false; |
| 474 | } |
| 475 | |
| 476 | MyGUI::xml::ElementPtr root = doc.getRoot(); |
| 477 | if ((nullptr == root) || (root->getName() != "MyGUI")) |
| 478 | { |
| 479 | MYGUI_LOGGING(LogSection, Error, "'" << fileName << "', tag 'MyGUI' not found"); |
| 480 | return false; |
| 481 | } |
| 482 | |
| 483 | if (root->findAttribute("type") == "Resource") |
| 484 | { |
| 485 | // берем детей и крутимся |
| 486 | MyGUI::xml::ElementEnumerator element = root->getElementEnumerator(); |
| 487 | while (element.next("Resource")) |
| 488 | { |
| 489 | if (element->findAttribute("type") == "ResourceLayout") |
| 490 | { |
| 491 | if (_index == 0) |
| 492 | { |
| 493 | element->setAttribute("name", _name); |
| 494 | renamed = true; |
| 495 | break; |
| 496 | } |
| 497 | |
| 498 | _index--; |
| 499 | } |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | doc.save(fileName); |
| 504 | |
| 505 | return renamed; |
| 506 | } |
| 507 | |
| 508 | void ProjectControl::notifyMessageBoxResultDelete(MyGUI::Message* _sender, MyGUI::MessageBoxStyle _result) |
| 509 | { |
nothing calls this directly
no test coverage detected