/** * Installs native messaging JSON script for the selected browser * * @param browser Selected browser * @param enabled Is browser integration enabled * @param proxy Is keepassxc-proxy enabled * @param location Custom proxy location */ void HostInstaller::installBrowser(SupportedBrowsers browser, const bool& enabled, const bool& proxy, const QString& location) { if (enabled) { #ifdef Q_OS_WIN // Create a registry key QSettings settings(getTargetPath(browser), QSettings::NativeFormat); if (!registryEntryFound(settings)) { settings.setValue("Default", getPath(browser)); } #endif // Always create the script file QJsonObject script = constructFile(browser, proxy, location); if (!saveFile(browser, script)) { QMessageBox::critical(nullptr, tr("KeePassXC: Cannot save file!"), tr("Cannot save the native messaging script file."), QMessageBox::Ok); } } else { // Remove the script file QString fileName = getPath(browser); QFile::remove(fileName); #ifdef Q_OS_WIN // Remove the registry entry QSettings settings(getTargetPath(browser), QSettings::NativeFormat); if (registryEntryFound(settings)) { settings.remove("Default"); } #endif } }
void FileSystemActor::refreshThumbnail() { if (winOS->IsFileInUse(getFullPath())) return; if (isThumbnailized()) { Widget * w = widgetManager->getActiveWidgetForFile(getFullPath()); if (w) loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, filePath, HiResImage, NormalPriority)); else loadThumbnailTexture(GLTextureObject(Load|Compress, _alternateThumbnailId, getTargetPath(), getMinThumbnailDetail(), NormalPriority)); } else loadThumbnailTexture(GLTextureObject(Load|Reload, textureID, getTargetPath(), FileIcon, NormalPriority)); }
QString FileSystemActor::resolveDropOperationString(vector<BumpObject *>& objList) { // if this is a recycle bin, then show "delete files" if (isFileSystemType(Virtual) && winOS->GetIconTypeFromFileName(getFullPath()) == RecycleBin) { return QT_TR_NOOP("Delete"); } else if (isFileSystemType(Executable)) { return QT_TR_NOOP("Launch %1").arg(getFileName(true)); } else if (isFileSystemType(Link)) { // check if we are pointing to a folder or not if (!QFileInfo(getTargetPath()).isDir()) { return QT_TR_NOOP("Launch %1").arg(getFileName(true)); } } else { // check if the root of the items in the object list is different // than that of this item if (isCopyIntoActor(objList)) // Shift forces move, Ctrl forces copy, common root defaults to move { return QT_TR_NOOP("Copy"); } } return Actor::resolveDropOperationString(objList); }
/** * Gets the installation directory for JSON script file (application install path) * * @param browser Selected browser * @return QString Install path */ QString HostInstaller::getInstallDir(SupportedBrowsers browser) const { QString path = getTargetPath(browser); #ifdef Q_OS_WIN return QCoreApplication::applicationDirPath(); #else return QString("%1%2").arg(QDir::homePath(), path); #endif }
solution::solution() { target_path=getTargetPath(); mutex_for_query = new std::mutex; problem = compare_way = lang = time_limit = mem_limit = score = error_code = 0; public_code = 0; timestamp = 0; type = TYPE_normal; }
/** * Checks if the selected browser has native messaging host properly installed * * @param browser Selected browser * @return bool Script is installed correctly */ bool HostInstaller::checkIfInstalled(SupportedBrowsers browser) { QString fileName = getPath(browser); #ifdef Q_OS_WIN QSettings settings(getTargetPath(browser), QSettings::NativeFormat); return registryEntryFound(settings); #else return QFile::exists(fileName); #endif }
// Sets whether this actor should be thumbnailed at all, and if loadThumbnail // is true, queues the thumbnail operation on the texture loader. // If no thumbnail exists, it will use the default filesystem icon. void FileSystemActor::enableThumbnail(bool enableThumbnail/*=true*/, bool loadThumbnail/*=true*/) { useThumbnail = enableThumbnail; // Load this Thumbnail because it wasn't loaded before if (useThumbnail) { GLTextureDetail detail = SampledImage; // NOTE: workaround for keeping training images in hires // also use hi-res if user wants to skip thumbs db usage bool isTrainingImage = getFullPath().startsWith(native(winOS->GetTrainingDirectory()), Qt::CaseInsensitive); if (!GLOBAL(settings).useThumbsDb || isTrainingImage) detail = HiResImage; if (loadThumbnail) loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, getTargetPath(), detail, NormalPriority, true, isFileSystemType(Image))); } }
/** * Returns the path of native messaging JSON script for the selected browser * * @param browser Selected browser * @return QString JSON script path for the selected browser */ QString HostInstaller::getPath(SupportedBrowsers browser) const { #ifdef Q_OS_WIN // If portable settings file exists save the JSON scripts to application folder QString userPath; QString portablePath = QCoreApplication::applicationDirPath() + "/keepassxc.ini"; if (QFile::exists(portablePath)) { userPath = QCoreApplication::applicationDirPath(); } else { userPath = QDir::fromNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); } QString winPath = QString("%1/%2_%3.json").arg(userPath, HOST_NAME, getBrowserName(browser)); winPath.replace("/", "\\"); return winPath; #else QString path = getTargetPath(browser); return QString("%1%2/%3.json").arg(QDir::homePath(), path, HOST_NAME); #endif }
int DPTDriveBusy::drvBusy(int hba, int bus, int target, int lun) { char * Targets[2]; char ** Dirs[sizeof(Targets)/sizeof(Targets[0])]; char ** Suffixes[sizeof(Targets)/sizeof(Targets[0])]; int SuffixIndex; DPTDeviceList * Mounts = (DPTDeviceList *)NULL; int RetVal = -1; /* Initialize the local structures */ Targets[0] = getTargetString(hba, bus, target, lun); Dirs[0] = TargetStringDirs; Suffixes[0] = TargetStringSuffixes; Targets[1] = getTargetPath(hba, bus, target, lun); Dirs[1] = TargetPathDirs; Suffixes[1] = TargetPathSuffixes; for (SuffixIndex = 0;;) { while (Targets[0] == (char *)NULL) { int Index, NoneZero = 0; for (Index = sizeof(Targets)/sizeof(Targets[0]); Index; --Index) { if ((Targets[Index-2] = Targets[Index-1]) != (char *)NULL) { ++NoneZero; } Targets[Index-1] = (char *)NULL; Dirs[Index-2] = Dirs[Index-1]; Suffixes[Index-2] = Suffixes[Index-1]; } if (NoneZero == 0) { break; } } if (Targets[0] == (char *)NULL) { break; } /* Check if the Dirs/Targets entry exists */ { char * name = new char[strlen(Dirs[0][0]) + strlen(Targets[0]) + strlen(Suffixes[0][SuffixIndex]) + 1]; if (name == (char *)NULL) { RetVal = -2; break; } (void)strcat(strcat(strcpy(name, Dirs[0][0]), Targets[0]), Suffixes[0][SuffixIndex]); switch(PathExists(name)) { case PathExists_Exists: case PathExists_Read: case PathExists_Open: /* Check if the Dirs/Target entry is mounted */ if (Mounts == (DPTDeviceList *)NULL) { FILE * fp = SafePopenRead("mount | sed -n '" "s/^\\([^ ][^ ]*\\)[ ][ ]*on[ ][ ]*\\([^ ][^ ]*\\).*/\\1 \\2/p'"); char * Buffer = new char[512]; while (fgets (Buffer, 512, fp)) { if (newDeviceList (&Mounts, Buffer)) { RetVal = -2; } } SafePclose(fp); if (RetVal == -1) { RetVal = 0; } # if (defined(DEBUG) && (DEBUG > 0)) if (Mounts != (DPTDeviceList *)NULL) { DPTDeviceList * List = Mounts; DPTDeviceList * Link; printf ("Mount list:\n"); do { printf ("%s", List->Name); if ((List->Major == -2) && (List->Minor == -2)) { printf ("/"); } else if ((List->Major != -1) || (List->Minor != -1)) { printf ("(%d,%d)", List->Major, List->Minor); } if ((Link = List->Link) == (DPTDeviceList *)NULL) { printf ("\n"); Link = List->Next; } else { printf (", "); } } while ((List = Link) != (DPTDeviceList *)NULL); } # endif } /* We have an initialized mount database, search! */ { DPTDeviceList * Link; DPTDeviceList * Names = (DPTDeviceList *)NULL; newDeviceList (&Names, name); for (Link = Mounts; Link != (DPTDeviceList *)NULL; ) { DPTDeviceList * Next; DPTDeviceList *Name; for (Name = Names; (Name = Name->Link) != (DPTDeviceList *)NULL; ) { /* Same name, or same device */ if ((strcmp (Name->Name, Link->Name) == 0) || ((Name->Major == Link->Major) && (Name->Minor == Link->Minor))) { break; } } if (Name != (DPTDeviceList *)NULL) { RetVal = 1; break; } if ((Next = Link->Link) == (DPTDeviceList *)NULL) { Next = Link->Next; } Link = Next; } deleteDeviceList (Names); } break; case PathExists_Busy: RetVal = 1; /* It's busy even before we hit the ground */ case PathExists_None: break; } delete [] name; } if ((RetVal != -1) && (RetVal != 0)) { break; } /* Try next */ if (Suffixes[0][++SuffixIndex] == (char *)NULL) { SuffixIndex = 0; if ((++(Dirs[0]))[0] == (char *)NULL) { delete [] Targets[0]; Targets[0] = (char *)NULL; } } } /* Free up resources */ { int Index; for (Index = 0; Index < (sizeof(Targets)/sizeof(Targets[0])); ++Index) { if (Targets[Index] != (char *)NULL) { delete [] Targets[Index]; } } } deleteDeviceList (Mounts); return (RetVal); }
//Execute the watermark void QWatermark::doWatermark(void) { QImage resultImage; QPainter painter; Profile profile = Profile::getProfile(profileComboBox->currentText()); if (!profile.isValid()) { qDebug() << "TODO/FIXME: invalid profile msg?"; return; } QStringList filesToProcess; QDir::Filters filters = QDir::NoDotAndDotDot | QDir::Readable | QDir::Files | QDir::AllDirs; QDirIterator::IteratorFlags flags = treeCheckBox->isChecked() ? QDirIterator::Subdirectories | QDirIterator::FollowSymlinks : QDirIterator::NoIteratorFlags; QDirIterator it(sourceLineEdit->text(), filters, flags); while (it.hasNext()) { it.next(); if (!QImageReader::imageFormat(it.filePath()).isNull()) filesToProcess << it.filePath(); else qDebug() << "Ignored" << it.filePath(); } QProgressDialog progress("Applying watermarks...", "Abort", 0, filesToProcess.size(), this); progress.setWindowModality(Qt::WindowModal); progress.show(); int errCnt = 0; //Iterate over images for(int i = 0; i < filesToProcess.size(); ++i){ qDebug() << "FILE" << filesToProcess.at(i); if (progress.wasCanceled()) { qDebug() << "TODO/FIXME: cleanup already created files"; break; } progress.setValue(i+1); progress.setLabelText(filesToProcess.at(i)); //Load image if (!resultImage.load(filesToProcess.at(i))) { qDebug() << "Cannot load" << filesToProcess.at(i) << "skipping"; continue; } if (!painter.begin(&resultImage)) { qDebug() << "TODO/FIXME: painter.begin check" << filesToProcess.at(i); continue; } //painter.setCompositionMode(QPainter::CompositionMode_SourceOver); paintOne(resultImage.width(), resultImage.height(), &painter, &profile); painter.end(); //save the image QString tgtPath = getTargetPath(filesToProcess.at(i)); qDebug() << "SAVE" << tgtPath; QDir dir = QFileInfo(tgtPath).absoluteDir(); if (!dir.exists(dir.path())) dir.mkpath(dir.path()); if(!resultImage.save(tgtPath, 0, 100)) { errCnt++; if (QMessageBox::question(this, tr("Error"), tr("An error occurred while saving the image '%1'. Continue?").arg(tgtPath), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) { qDebug() << "User canceled processing after an error"; break; } } } if (errCnt == 0) QMessageBox::information(this, tr("Success"), tr("Processing Completed.")); qDebug() << "TODO/FIXME: Clear input/target lineedits?"; }
vector<BumpObject *> FileSystemActor::onDrop(vector<BumpObject *> &objList) { QString fPath; FileSystemActor *fsData; Pile *pile; FileSystemPile *fsPile; Vec3 topPt; bool moveItem = true; bool operationSucceeded = false; vector<FileSystemActor *> failedObj, fsObjList; vector<BumpObject *> failedBumpObjs; vector<FileSystemActor *> hardPileOwners; if (!isSourceValid()) { return objList; } else { // Convert Piles to Free Items for (int i = 0; i < objList.size(); i++) { // Do Pile to free Item conversions if (objList[i]->getObjectType() == ObjectType(BumpPile, HardPile, Stack)) { // If its a Hard Pile, get its owner and use it instead of pile members fsPile = (FileSystemPile *) objList[i]; objList.erase(objList.begin() + i); objList.push_back(fsPile->getOwner()); hardPileOwners.push_back(fsPile->getOwner()); fsPile->folderize(false); i--; }else if (objList[i]->getObjectType() == ObjectType(BumpPile, SoftPile, Stack)) { pile = (Pile *) objList[i]; objList.erase(objList.begin() + i); i--; // If its a Soft Pile, use its members instead of the pile for (uint j = 0; j < pile->getNumItems(); j++) { objList.push_back((*pile)[j]); } } } if (isFileSystemType(Executable)) { for (uint i = 0; i < objList.size(); i++) { // Create a parameter list separated by spaces fsData = (FileSystemActor *) objList[i]; if (!fsData || !scnManager->containsObject(fsData)) continue; fPath.append(fsData->getFullPath()); fPath.append(" "); } // We just tossed into an executable // QString lnkTarget, dummyLnkArgs, lnkWorkingDir; QString lnkArgs = fPath; /* if (isFileSystemType(Link)) { fsManager->getShortcutTarget(getFullPath(), &lnkTarget, &dummyLnkArgs, &lnkWorkingDir); fsManager->launchFileAsync(lnkTarget, lnkArgs, lnkWorkingDir); } else */ fsManager->launchFileAsync(filePath, lnkArgs); }else if (isFileSystemType(Folder)) { bool itemNeedsPrompt = false; bool onlyPhotoFrame = true; int iconType = winOS->GetIconTypeFromFileName(getFullPath()); bool isRecycleBin = iconType == RecycleBin; bool isMyDocuments = iconType == MyDocuments; // Convert BumpObject to FileSystemActors, delete WebActors since they are not FileSystemActors for (uint i = 0; i < objList.size(); i++) { if (objList[i]->isObjectType(ObjectType(BumpActor, Webpage))) { if (isRecycleBin) { sel->remove(objList[i]); objList[i]->markDragCancelled(true); objList[i]->onDragEnd(); FadeAndDeleteActor((Actor *)objList[i]); objList.erase(objList.begin() + i); } else _ASSERT(0); } else { fsObjList.push_back((FileSystemActor *) objList[i]); if (fsObjList[i]->getObjectType() == ObjectType(BumpActor, FileSystem, PhotoFrame)) itemNeedsPrompt = true; else onlyPhotoFrame = false; } } if (isFileSystemType(Virtual)) { // Handle tossing into the recycle bin if (isRecycleBin || isMyDocuments) { if (itemNeedsPrompt) { dlgManager->clearState(); dlgManager->setPrompt(QT_TR_NOOP("A Photo Frame was detected in the selection, would you like to delete it?")); dlgManager->setCaption(QT_NT("BumpTop")); if (dlgManager->promptDialog(DialogYesNo)) { vector<FileSystemActor *>::iterator iter = fsObjList.begin(); while (iter != fsObjList.end()) { FileSystemActor * fsActor = *iter; if (fsActor->getObjectType() == ObjectType(BumpActor, FileSystem, PhotoFrame)) { // Remove the photo frame by deferring deletion until after the anim is over fsActor->fadeOut(); animManager->removeAnimation(fsActor); animManager->addAnimation(AnimationEntry(fsActor, (FinishedCallBack) DeleteActorAfterAnim, NULL, true)); iter = fsObjList.erase(iter); } else iter++; } } else { vector<FileSystemActor *>::iterator iter = fsObjList.begin(); while (iter != fsObjList.end()) { FileSystemActor * fsActor = *iter; if (fsActor->getObjectType() == ObjectType(BumpActor, FileSystem, PhotoFrame)) { failedObj.push_back(fsActor); iter = fsObjList.erase(iter); } else iter++; } } } if (!fsObjList.empty()) { if (isRecycleBin) operationSucceeded = fsManager->deleteFiles(fsObjList, failedObj, !onlyPhotoFrame); else operationSucceeded = fsManager->moveFiles(fsObjList, winOS->GetSystemPath(iconType), failedObj, true); } } }else{ if (!isCopyIntoActor(objList)) // Shift forces move, Ctrl forces copy, common root defaults to move { // Handle tossing into a regular folder operationSucceeded = fsManager->moveFiles(fsObjList, getTargetPath(), failedObj, true); if (operationSucceeded) { printUnique("FileSystemActor::onDrop", QT_TR_NOOP("%1 file(s) moved to %2").arg(fsObjList.size()).arg(getText())); } } else { // Handle tossing into a regular folder on another resource (will copy instead of move) operationSucceeded = fsManager->copyFiles(fsObjList, getTargetPath(), failedObj, true); if (operationSucceeded) { printUnique("FileSystemActor::onDrop", QT_TR_NOOP("%1 file(s) copied to %2").arg(fsObjList.size()).arg(getText())); } // Animate back to the original starting pose animateObjectsBackToPreDropPose(objList); } } } if (!operationSucceeded) { // re-pileize hard piles if move failed vector<FileSystemActor *>::iterator iter = hardPileOwners.begin(); while (iter != hardPileOwners.end()) { (*iter)->pileize(); iter++; } } // record this drop statsManager->getStats().bt.interaction.dragAndDrop.toActor++; } // Convert from a list of FileSYstemActors to BumpObjects for (uint i = 0; i < failedObj.size(); i++) { failedBumpObjs.push_back(failedObj[i]); } return failedBumpObjs; }
void FileSystemActor::setFilePath(QString fullPath, bool skipTextureResolution /*=false*/) { if (_isAnimatedTexture) _animatedTextureSource.setPath(fullPath); // Save the Path (or Virtual Folder Name) filePath = fullPath; winOS->GetShortPathName(fullPath, shortPath); if (skipTextureResolution) return; // resolve the texture to load for this file if there is one QString ext = fsManager->getFileExtension(fullPath); QString texId; GLTextureDetail detail = FileIcon; GLTextureLoadPriority priority = NormalPriority; bool isVista = winOS->IsWindowsVersionGreaterThanOrEqualTo(WindowsVista); bool overrideSystemTextures = GLOBAL(settings).useThemeIconOverrides; int virtualIconId = winOS->GetIconTypeFromFileName(fullPath); if (virtualIconId > -1) { // mark this is a virtual icon pushFileSystemType(Virtual); pushFileSystemType(Folder); // check if we are overloading any virtual icons (only My Computer for now) if (overrideSystemTextures && (virtualIconId == MyComputer) && texMgr->hasTexture("override.virtual.mycomputer")) { texId = QT_NT("override.virtual.mycomputer"); detail = HiResImage; } else { // otherwise, we will just load the icon later texId = fullPath; // NOTE: we force load these icons here because we do not do so if the // texture id is set below loadThumbnailTexture(GLTextureObject(Load, texId, texId, FileIcon, priority, false)); } } else { // not a virtual icon, just a random icon then unsigned int fileAttributes = fsManager->getFileAttributes(fullPath); // delete this object if it doesn't exist (and it's not a photo frame or volume) if (!fileAttributes && !(isFileSystemType(PhotoFrame) || isFileSystemType(LogicalVolume))) { animManager->addAnimation(AnimationEntry(this, (FinishedCallBack) DeleteActorAfterAnim)); setAlpha(0.0f); return; } // make sure there's no lingering animations animManager->removeAnimation(this); setAlpha(1.0f); // XXX: check if we are using animated textures // _isAnimatedTexture = (fileExtension == ".gif"); // check if this is a shortcut // NOTE: if it is a valid shortcut, the file attributes and extension // now refer to the target and not the shortcut itself if (fileAttributes && ext == ".lnk") { // resolve the shortcut target fsManager->getShortcutTarget(fullPath, &lnkFullPath); if (fsManager->isValidFileName(lnkFullPath)) { pushFileSystemType(Link); popFileSystemType(DeadLink); fileAttributes = fsManager->getFileAttributes(lnkFullPath); ext = fsManager->getFileExtension(lnkFullPath); } else { pushFileSystemType(DeadLink); } } // check if it is a folder if (fileAttributes & Directory) { pushFileSystemType(Folder); // XXX: only override shortcuts, and not folders? /* if (!overrideSystemTextures || !enableFileTypeIconsForShortcuts) { texId = winOS->GetSystemIconInfo(getFullPath()); } else */ if (overrideSystemTextures) { texId = QT_NT("override.ext.folder"); detail = HiResImage; } } else { // normal file pushFileSystemType(File); hasExtension(true); //only files have extension, so the nameable extension hide only applies here // resolve some information about the file if (ext.size() > 0) { if (ext == ".exe") pushFileSystemType(Executable); else { // XXX: check if it's a document // pushFileSystemType(Document); if (overrideSystemTextures) { QString potentialOverrideTex = QString(QT_NT("override.ext")) + ext; if (texMgr->hasTexture(potentialOverrideTex)) { texId = potentialOverrideTex; detail = HiResImage; } } } // load the thumbnail if this is an image // NOTE: we append the period because if the extension is empty // the search is always true if (GLOBAL(supportedExtensions).contains(ext + ".")) { if (!isThumbnailized()) enableThumbnail(true, !winOS->IsFileInUse(fullPath)); pushFileSystemType(Image); pushFileSystemType(Thumbnail); hideText(true); } } } } // at this point, resolve the file icon texture id if there was no override if (texId.isEmpty()) { texId = winOS->GetSystemIconInfo(fullPath); // mark the texture for loading loadThumbnailTexture(GLTextureObject(Load, texId, texId, detail, priority,false)); } setTextureID(texId); // we also want to try and load thumbnails for normal files if they exist // (as long as it's not a widget file) Widget * w = widgetManager->getActiveWidgetForFile(fullPath); if (!isThumbnailized() && (detail == FileIcon) && !w) { FileSystemActorType typesToIgnore = FileSystemActorType(Executable | Virtual); // on vista, just queue the thumbnail for loading if (isVista && !isFileSystemType(typesToIgnore)) { QString ext = fsManager->getFileExtension(getTargetPath()); loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, getTargetPath(), SampledImage, IdlePriority)); } // on windows xp, check if the thumbs db has a record first else if (winOS->IsWindowsVersion(WindowsXP)) { if (texMgr->hasWinThumbnail(getTargetPath())) { loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, getTargetPath(), SampledImage, IdlePriority)); } } } // XXX: (disabled) set the initial dimensions and weight of this file based on it's size // setDimsFromFileSize(this); // set the text if(!isFileSystemType(PhotoFrame)) { if (w && w->isWidgetOverrideActor(this)) { setText(w->getWidgetOverrideLabel(this)); Vec3 actorDims = getDims(); float aspect = (actorDims.x / actorDims.y); Vec3 dims(GLOBAL(settings).xDist, GLOBAL(settings).zDist / aspect, GLOBAL(settings).yDist); float scale = w->getWidgetOverrideScale(this); if (scale > 0.0f) { dims *= scale; setSizeAnim(getDims(), dims, 25); } } else setText(getFileName(isFileSystemType(Link) || isFileSystemType(DeadLink))); } setRespectIconExtensionVisibility(!isFileSystemType(Folder)); // New name was set, invalidate text textManager->invalidate(); rndrManager->invalidateRenderer(); }
FileSystemPile *FileSystemActor::pileize() { StrList dirListing; QString dirPath; vector<Actor *> objListing; FileSystemActor *obj = NULL; FileSystemPile *p = NULL; // Don't allow Piles to be created recursively if (isParentType(BumpPile)) { MessageClearPolicy clearPolicy; clearPolicy.setTimeout(4); scnManager->messages()->addMessage(new Message("pileize_recPiles", QT_TR_NOOP("Sorry, Items within Piles cannot be viewed as Piles at this time.\nThis feature will be implemented in a later version of BumpTop"), Message::Ok, clearPolicy)); return NULL; } // If this item has been pileized, then just return its pile if (pileizedPile) { return pileizedPile; } if (isFileSystemType(Folder)) { // Get a Directory listing of this folder dirPath = getTargetPath(); dirListing = fsManager->getDirectoryContents(dirPath); // Check if this Folder has anything in it if (dirListing.empty()) { MessageClearPolicy clearPolicy; clearPolicy.setTimeout(4); scnManager->messages()->addMessage(new Message("pileize_emptyFolder", QT_TR_NOOP("This folder is empty, so it can't be expanded to a pile"), Message::Ok, clearPolicy)); return NULL; } // Create a new Pile p = new FileSystemPile(); if (p) { for (uint i = 0; i < dirListing.size(); i++) { obj = FileSystemActorFactory::createFileSystemActor(dirListing[i]); // Create new Actors that represent each item in that directory // NOTE: we need to set the initial size of the object, since we try and sync the post it // in the setFilePath call, which means that it will try and fill to the dims of the // object, which, in it's default size, is not visible text-wise. if (_prevPileizedActorDims.contains(dirListing[i].toLower())) obj->setDims(Vec3(_prevPileizedActorDims.value(dirListing[i].toLower()))); else obj->setDims(getDims()); obj->setGlobalPose(getGlobalPose()); obj->setFilePath(dirListing[i]); objListing.push_back(obj); } // Add items to this Pile for (uint i = 0; i < objListing.size(); i++) { p->addToPile(objListing[i]); } // Save and setup initial states p->setOwner(this); p->setText(getFullText()); p->stack(getGlobalPosition()); // set the icon to be this actor's if (isFileSystemType(Folder)) p->setTextIcon(getTextureID()); // Create custom Animations for (uint i = 0; i < objListing.size(); i++) { objListing[i]->setAlphaAnim(0.0f, 1.0f, 15); } // Make this actor Non-existent this->hideAndDisable(); // Finish up by setting the pile as the current selection pileizedPile = p; sel->remove((BumpObject *) this); sel->add((Pile *) p); textManager->invalidate(); // record this pilization statsManager->getStats().bt.interaction.piles.pilized++; return p; } } return NULL; }