void PerforcePart::setupActions() { actionEdit = new KAction( i18n("Edit"), 0, this, SLOT(slotActionEdit()), actionCollection(), "perforce_edit" ); actionEdit->setToolTip(i18n("Edit")); actionEdit->setWhatsThis(i18n("<b>Edit</b><p>Opens file(s) in a client workspace for edit.")); actionRevert = new KAction( i18n("Revert"), 0, this, SLOT(slotActionRevert()), actionCollection(), "perforce_revert" ); actionRevert->setToolTip(i18n("Revert")); actionRevert->setWhatsThis(i18n("<b>Revert</b><p>Discards changes made to open files.")); actionSubmit = new KAction( i18n("Submit"), 0, this, SLOT(slotActionCommit()), actionCollection(), "perforce_submit" ); actionSubmit->setToolTip(i18n("Submit")); actionSubmit->setWhatsThis(i18n("<b>Submit</b><p>Sends changes made to open files to the depot.")); actionSync = new KAction( i18n("Sync"), 0, this, SLOT(slotActionUpdate()), actionCollection(), "perforce_sync" ); actionSync->setToolTip(i18n("Sync")); actionSync->setWhatsThis(i18n("<b>Sync</b><p>Copies files from the depot into the workspace.")); actionDiff = new KAction( i18n("Diff Against Repository"), 0, this, SLOT(slotActionDiff()), actionCollection(), "perforce_diff" ); actionDiff->setToolTip(i18n("Diff against repository")); actionDiff->setWhatsThis(i18n("<b>Diff against repository</b><p>Compares a client workspace file to a revision in the depot.")); actionAdd = new KAction( i18n("Add to Repository"), 0, this, SLOT(slotActionAdd()), actionCollection(), "perforce_add" ); actionAdd->setToolTip(i18n("Add to repository")); actionAdd->setWhatsThis(i18n("<b>Add to repository</b><p>Open file(s) in a client workspace for addition to the depot.")); actionRemove = new KAction( i18n("Remove From Repository"), 0, this, SLOT(slotActionRemove()), actionCollection(), "perforce_remove" ); actionRemove->setToolTip(i18n("Remove from repository")); actionRemove->setWhatsThis(i18n("<b>Remove from repository</b><p>Open file(s) in a client workspace for deletion from the depot.")); }
void MainUI::slotInstalledAppRightClicked(const QPoint &pt){ //Get the item under the mouse click QTreeWidgetItem *it = ui->tree_install_apps->itemAt(pt); if(it==0){ return; } // no item selected QString pbiID = it->whatsThis(0); qDebug() << "Get context menu for:" << pbiID; //Now Update the context menu appropriately NGApp info = PBI->singleAppInfo(pbiID); //QStringList info = PBI->PBIInfo(pbiID, QStringList() << "hasdesktopicons" << "hasmenuicons" << "hasmimetypes"); if( info.origin.isEmpty() ){ return; } //invalid application bool pending = PBI->isWorking(pbiID); contextActionMenu->clear(); if( (info.version != info.installedversion) && !pending){ //Upgrade is only available if actions not pending contextActionMenu->addAction( QIcon(":icons/view-refresh.png"), tr("Update"), this, SLOT(slotActionUpdate()) ); contextActionMenu->addSeparator(); } if(info.hasDE){ QMenu *dmenu = contextActionMenu->addMenu( QIcon(":icons/xdg_desktop.png"), tr("Desktop Icons")); dmenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddDesktop()) ); dmenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemoveDesktop()) ); } if(!pending){ //Remove option is only available if not currently pending actions contextActionMenu->addSeparator(); contextActionMenu->addAction( QIcon(":icons/remove.png"), tr("Uninstall"), this, SLOT(slotActionRemove()) ); }else{ //Cancel option is only available if actions are currently pending contextActionMenu->addSeparator(); contextActionMenu->addAction( QIcon(":icons/dialog-cancel.png"), tr("Cancel Actions"), this, SLOT(slotActionCancel()) ); } //Now show the menu cDetails = pbiID; //save this so we know which app is currently being modified contextActionMenu->popup(ui->tree_install_apps->mapToGlobal(pt)); }