Esempio n. 1
0
// =========================
// ===== INSTALLED TAB =====
// =========================
void MainUI::initializeInstalledTab(){
  //Setup the action menu for installed applications
  actionMenu = new QMenu();
    QMenu *dmenu = actionMenu->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()) );
    QMenu *lmenu = actionMenu->addMenu( QIcon(":icons/lock.png"), tr("Version Lock") );
	lmenu->addAction( QIcon(":icons/lock.png"), tr("Lock Current Version"), this, SLOT(slotActionLock()) );
	lmenu->addAction( QIcon(":icons/unlock.png"), tr("Unlock Application"), this, SLOT(slotActionUnlock()) );
    actionMenu->addSeparator();
    actionMenu->addAction( QIcon(":icons/remove.png"), tr("Uninstall"), this, SLOT(slotActionRemove()) );
    actionMenu->addSeparator();
    actionMenu->addAction( QIcon(":icons/dialog-cancel.png"), tr("Cancel Actions"), this, SLOT(slotActionCancel()) );
  //Setup the shortcuts menu for installed applications
    sDeskMenu = new QMenu(this);
      sDeskMenu->addAction( QIcon(":icons/add.png"),tr("Add Desktop Shortcuts"),this,SLOT(slotActionAddDesktop()) );
      sDeskMenu->addAction( QIcon(":icons/remove.png"),tr("Remove Desktop Shortcuts"),this,SLOT(slotActionRemoveDesktop()) );
  ui->tool_install_shortcuts->setMenu(sDeskMenu);
  //Setup the binary menu for installed applications
  appBinMenu = new QMenu();
  ui->tool_install_startApp->setMenu(appBinMenu);
    connect(appBinMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotStartApp(QAction*)) );
  //Initialize the context menu
  contextActionMenu = new QMenu(this);
    connect(contextActionMenu, SIGNAL(aboutToHide()), this, SLOT(contextMenuFinished()) );
  //Now setup the action button
  ui->tool_install_performaction->setMenu(actionMenu);
  ui->tool_install_performaction->setPopupMode(QToolButton::InstantPopup);
  //Now setup any defaults for the installed tab
  ui->tree_install_apps->setIconSize(QSize(22,22));
  ui->tree_install_apps->setContextMenuPolicy(Qt::CustomContextMenu);
  connect(ui->tree_install_apps, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotCheckSelectedItems()) );
  connect(ui->tree_install_apps, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT( slotInstalledAppRightClicked(const QPoint &)) );
  slotRefreshInstallTab();
}
Esempio n. 2
0
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."));
}
Esempio n. 3
0
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.hasDE && VISJAIL.isEmpty() ){
    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(info.isLocked){
    contextActionMenu->addAction( QIcon(":icons/unlock.png"), tr("Unlock Application"), this, SLOT(slotActionUnlock()) );
  }else{
    contextActionMenu->addAction( QIcon(":icons/lock.png"), tr("Lock Current Version"), this, SLOT(slotActionLock()) );
  }
  if(!pending && PBI->safeToRemove(pbiID)){
    //Remove option is only available if not currently pending actions
    contextActionMenu->addSeparator();
    contextActionMenu->addAction( QIcon(":icons/remove.png"), tr("Uninstall"), this, SLOT(slotActionRemove()) );
  }else if(pending){
    //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));
}