| 364 | } |
| 365 | |
| 366 | void InstanceList::undoTrashInstance() |
| 367 | { |
| 368 | if (m_trashHistory.empty()) { |
| 369 | qWarning() << "Nothing to recover from trash."; |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | auto top = m_trashHistory.pop(); |
| 374 | |
| 375 | while (QDir(top.path).exists()) { |
| 376 | top.id += "1"; |
| 377 | top.path += "1"; |
| 378 | } |
| 379 | |
| 380 | qDebug() << "Moving" << top.trashPath << "back to" << top.path; |
| 381 | QFile(top.trashPath).rename(top.path); |
| 382 | |
| 383 | m_instanceGroupIndex[top.id] = top.groupName; |
| 384 | increaseGroupCount(top.groupName); |
| 385 | |
| 386 | saveGroupList(); |
| 387 | emit instancesChanged(); |
| 388 | } |
| 389 | |
| 390 | void InstanceList::deleteInstance(const InstanceId& id) |
| 391 | { |