This funciton moves selected files from thier current location into a Folder
| 1622 | |
| 1623 | // This funciton moves selected files from thier current location into a Folder |
| 1624 | NxActorWrapper * SoftPileToFolderIcon( Pile *pile, QString folderName ) |
| 1625 | { |
| 1626 | Pile *selectedPile = NULL; |
| 1627 | bool hasVirtualFolder = false; |
| 1628 | QString errorMessage(QT_TRANSLATE_NOOP("BtUtilStrings", "These items cannot be moved from the desktop into a folder:\n[")); |
| 1629 | QStringList virtualFolders; |
| 1630 | |
| 1631 | for (int i = 0; i < pile->getNumItems(); i++) |
| 1632 | { |
| 1633 | Actor * a = (Actor *) (*pile)[i]; |
| 1634 | |
| 1635 | if (!(a->isActorType(FileSystem))) |
| 1636 | { |
| 1637 | GLOBAL(gPause) = false; |
| 1638 | sel->setPickedActor(NULL); |
| 1639 | return NULL; |
| 1640 | } |
| 1641 | } |
| 1642 | |
| 1643 | // Search the pile for VIRTUAL folders |
| 1644 | for (int i = 0; i < pile->getNumItems(); i++) |
| 1645 | { |
| 1646 | if (!(*pile)[i]->isPilable(HardPile)) |
| 1647 | { |
| 1648 | virtualFolders.append(((FileSystemActor *) (*pile)[i])->getFullPath()); |
| 1649 | hasVirtualFolder = true; |
| 1650 | } |
| 1651 | } |
| 1652 | |
| 1653 | // If this pile has items that are VRTUAL, ask the user to remove them |
| 1654 | if (hasVirtualFolder) |
| 1655 | { |
| 1656 | errorMessage.append(virtualFolders.join(", ")); |
| 1657 | errorMessage.append("]\n"); |
| 1658 | errorMessage.append(QT_TRANSLATE_NOOP("BtUtilStrings", "\n\nCollapse anyway and leave these items unchanged?")); |
| 1659 | |
| 1660 | dlgManager->clearState(); |
| 1661 | dlgManager->setPrompt(errorMessage); |
| 1662 | if (dlgManager->promptDialog(DialogYesNo)) |
| 1663 | { |
| 1664 | for (int i = 0; i < pile->getNumItems(); i++) |
| 1665 | { |
| 1666 | FileSystemActor *fsData = (FileSystemActor *) (*pile)[i]; |
| 1667 | |
| 1668 | // Check to see if this item is really a VRTUAL folder |
| 1669 | if (fsData->isFileSystemType(Virtual)) |
| 1670 | { |
| 1671 | // Remove this item from the pile |
| 1672 | FreezeActor((*pile)[i], false); |
| 1673 | (*pile)[i]->wakeUp(); |
| 1674 | pile->removeFromPile((*pile)[i]); |
| 1675 | i--; |
| 1676 | } |
| 1677 | } |
| 1678 | }else{ |
| 1679 | // User aborted |
| 1680 | return NULL; |
| 1681 | } |