| 6061 | } |
| 6062 | |
| 6063 | StrList GetFilteredSetForIDataObject(vector<BumpObject *>& selection, IShellFolder2 ** psfOut) |
| 6064 | { |
| 6065 | QDir userDesktop(winOS->GetSystemPath(DesktopDirectory)); |
| 6066 | QDir allUsersDesktop(winOS->GetSystemPath(AllUsersDesktopDir)); |
| 6067 | |
| 6068 | bool hasPrevSourceDir = false; |
| 6069 | QDir prevSourceDir; |
| 6070 | StrList filePaths; |
| 6071 | for (int i = 0; i < selection.size();) |
| 6072 | { |
| 6073 | ObjectType objType = selection[i]->getObjectType(); |
| 6074 | if (objType == ObjectType(BumpPile, HardPile)) |
| 6075 | { |
| 6076 | selection.erase(selection.begin() + i); |
| 6077 | // don't increment i, since we've erased the item at i |
| 6078 | } |
| 6079 | else if (objType == ObjectType(BumpPile, SoftPile)) |
| 6080 | { |
| 6081 | Pile * p = dynamic_cast<Pile *>(selection[i]); |
| 6082 | selection.erase(selection.begin() + i); |
| 6083 | // don't increment i, since we've erased the item at i |
| 6084 | |
| 6085 | vector<BumpObject *> pileItems = p->getPileItems(); |
| 6086 | for (vector<BumpObject *>::iterator pIter = pileItems.begin(); |
| 6087 | pIter != pileItems.end(); pIter++) |
| 6088 | { |
| 6089 | // NOTE: this is not a typo, we are pushing back to the end of the |
| 6090 | // selection, so that it is handled recursively if necessary |
| 6091 | selection.push_back(*pIter); |
| 6092 | } |
| 6093 | } |
| 6094 | else if ((objType == ObjectType(BumpActor, FileSystem)) && |
| 6095 | !(objType == ObjectType(BumpActor, FileSystem, Virtual))) |
| 6096 | { |
| 6097 | QString filePath(dynamic_cast<FileSystemActor *>(selection[i])->getFullPath()); |
| 6098 | QDir filePathBranch = parent(filePath); |
| 6099 | filePaths.push_back(filePath); |
| 6100 | if (hasPrevSourceDir && (filePathBranch != prevSourceDir)) |
| 6101 | { |
| 6102 | // ERROR, we've found a mixed selection (items from the desktop and a subfolder) |
| 6103 | // notify the user and return |
| 6104 | |
| 6105 | // NOTE: it will still fail for instances where the desktops are not the same |
| 6106 | // if (!( (filePathBranch == userDesktop || filePathBranch == allUsersDesktop) && |
| 6107 | // (prevSourceDir == userDesktop || prevSourceDir == allUsersDesktop) )) |
| 6108 | { |
| 6109 | MessageClearPolicy clearPolicy; |
| 6110 | clearPolicy.setTimeout(4); |
| 6111 | Message * message = new Message("GetFilteredSetForIDataObject", |
| 6112 | BtUtilStr->getString("ErrorMultipleSources"), Message::Warning, clearPolicy); |
| 6113 | scnManager->messages()->addMessage(message); |
| 6114 | selection.clear(); |
| 6115 | return StrList(); |
| 6116 | } |
| 6117 | } |
| 6118 | prevSourceDir = filePathBranch; |
| 6119 | hasPrevSourceDir = true; |
| 6120 | ++i; |
no test coverage detected