| 320 | } |
| 321 | |
| 322 | void InstanceList::undoTrashInstance() { |
| 323 | if (m_trashHistory.empty()) { |
| 324 | qWarning() << "Nothing to recover from trash."; |
| 325 | return; |
| 326 | } |
| 327 | |
| 328 | auto top = m_trashHistory.pop(); |
| 329 | |
| 330 | while (QDir(top.polyPath).exists()) { |
| 331 | top.id += "1"; |
| 332 | top.polyPath += "1"; |
| 333 | } |
| 334 | |
| 335 | qDebug() << "Moving" << top.trashPath << "back to" << top.polyPath; |
| 336 | QFile(top.trashPath).rename(top.polyPath); |
| 337 | |
| 338 | m_instanceGroupIndex[top.id] = top.groupName; |
| 339 | m_groupNameCache.insert(top.groupName); |
| 340 | |
| 341 | saveGroupList(); |
| 342 | emit instancesChanged(); |
| 343 | } |
| 344 | |
| 345 | void InstanceList::deleteInstance(const InstanceId& id) |
| 346 | { |