/*! \brief Remove the selected entity node */ void EntitiesTreeWidget::onRemove() { QTreeWidgetItem *item = currentItem(); if(!item){ return; } if(QMessageBox::question(this,"Removing","Are you sure to remove this item?") == QMessageBox::Yes){ if(item->parent() == applicationNode){ if(item->data(0,Qt::UserRole) == yarp::manager::APPLICATION){ yarp::manager::Application *app = (yarp::manager::Application*)item->data(0,Qt::UserRole + 1).toLongLong(); if(app){ QString appName = item->text(0); removeApplication(appName); } } }else if(item->parent() == resourcesNode){ if(item->data(0,Qt::UserRole) == yarp::manager::RESOURCE){ yarp::manager::Computer *res = (yarp::manager::Computer*)item->data(0,Qt::UserRole + 1).toLongLong(); if(res){ QString resName = item->text(0); removeResource(resName); } } }else if(item->parent() == modulesNode){ if(item->data(0,Qt::UserRole) == yarp::manager::MODULE){ yarp::manager::Module *mod = (yarp::manager::Module*)item->data(0,Qt::UserRole + 1).toLongLong(); if(mod){ QString modName = item->text(0); removeModule(modName); } } } while(item->childCount()>0){ delete item->takeChild(0); } if(item->parent()){ int index = item->parent()->indexOfChild(item); delete item->parent()->takeChild(index); } } }
void Index::addApplication(DesktopEntry *entry) { removeApplication(entry->identifier()); knownApplications_[entry->identifier()] = entry; for (std::vector<std::string>::size_type i = 0; i < entry->types().size(); ++i) { addToType(entry->types().at(i), entry); } }
void Index::processDesktopFile(const std::string &baseDirectory, const std::string &relative) { DesktopEntry *entry = new DesktopEntry(baseDirectory, relative, language_); if (entry->hidden()) { removeApplication(entry->identifier()); } else if (!entry->noDisplay()) { addApplication(entry); } }