Ignore:
Timestamp:
02/24/14 12:29:17 (6 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
127b5d8
Parents:
3adfc87
Message:

Get the shortcuts button working on the application details page (just for that one application)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-softwaremanager/mainUI.cpp

    rae5a5d8 r2b9aed7  
    168168    actionMenu->addSeparator(); 
    169169    actionMenu->addAction( QIcon(":icons/dialog-cancel.png"), tr("Cancel Actions"), this, SLOT(slotActionCancel()) ); 
     170  //Setup the shortcuts menu for installed applications 
     171  shortcutMenu = new QMenu(this); 
     172    sDeskMenu = shortcutMenu->addMenu( QIcon(":icons/xdg_desktop.png"), tr("Desktop Icons")); 
     173      sDeskMenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddDesktop()) ); 
     174      sDeskMenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemoveDesktop()) ); 
     175    sMenuMenu = shortcutMenu->addMenu( QIcon(":icons/xdg_menu.png"), tr("Menu Icons")); 
     176      sMenuMenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddMenu()) ); 
     177      sMenuMenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemoveMenu()) );   
     178      sMenuMenu->addAction( QIcon(":icons/add-root.png"),tr("Add (All Users)"),this,SLOT(slotActionAddMenuAll()) ); 
     179    QMenu *spmenu = shortcutMenu->addMenu( QIcon(":icons/xdg_paths.png"), tr("Path Links")); 
     180      spmenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddPath()) ); 
     181      spmenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemovePath()) );   
     182      spmenu->addAction( QIcon(":icons/add-root.png"),tr("Add (All Users)"),this,SLOT(slotActionAddPathAll()) ); 
     183    QMenu *sfmenu = shortcutMenu->addMenu( QIcon(":icons/xdg_mime.png"), tr("File Associations")); 
     184      sfmenu->addAction( QIcon(":icons/add.png"),tr("Add"),this,SLOT(slotActionAddMime()) ); 
     185      sfmenu->addAction( QIcon(":icons/remove.png"),tr("Remove"),this,SLOT(slotActionRemoveMime()) );   
     186      sfmenu->addAction( QIcon(":icons/add-root.png"),tr("Add (All Users)"),this,SLOT(slotActionAddMimeAll()) ); 
     187  ui->tool_install_shortcuts->setMenu(shortcutMenu); 
    170188  //Setup the binary menu for installed applications 
    171189  appBinMenu = new QMenu(); 
     
    179197  connect(ui->tree_install_apps, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotCheckSelectedItems()) ); 
    180198  slotRefreshInstallTab(); 
    181   qDebug() << "Detailed shortcuts button not implemented yet"; 
    182   ui->tool_install_shortcuts->setEnabled(false); 
    183199} 
    184200 
     
    205221 
    206222QStringList MainUI::getCheckedItems(){ 
    207   //Return the pbiID's of all the checked items 
     223  //Return the pbiID's of all the active items 
    208224  QStringList output; 
    209   for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){ 
    210     if(ui->tree_install_apps->topLevelItem(i)->checkState(0) == Qt::Checked){ 
    211       output << ui->tree_install_apps->topLevelItem(i)->whatsThis(0); 
    212     } 
    213   } 
    214   //If no items checked, use the item that is selected instead 
    215   if(output.isEmpty()){ 
    216     //Make sure that an item is selected 
    217     if(ui->tree_install_apps->topLevelItemCount() >0){ 
    218       output << ui->tree_install_apps->currentItem()->whatsThis(0);   
    219     } 
    220   } 
     225  //See if we are on the single-app details page - then get the current app only 
     226  if(ui->stackedWidget->currentWidget() == ui->page_install_details){ 
     227      output << cDetails;   
     228           
     229  //If on the main Installed page, look for checked items only 
     230  }else{ 
     231    for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){ 
     232      if(ui->tree_install_apps->topLevelItem(i)->checkState(0) == Qt::Checked){ 
     233        output << ui->tree_install_apps->topLevelItem(i)->whatsThis(0); 
     234      } 
     235    } 
     236  } 
     237  qDebug() << "Checked Items:" << output; 
    221238  return output;         
    222239} 
     
    579596  //Get the information to update the details page 
    580597  //Get the PBI info for that item 
     598    cDetails = appID; //save for later 
    581599    QStringList vals;  
    582600    vals << "name" << "icon" << "author" << "website" << "version" << "license" << "description" << "maintainer" << "date" << "arch"; 
     
    603621      else if(menuSC){ shortcuts = tr("Menu"); } 
    604622      else{ shortcuts = tr("None"); } 
     623    sDeskMenu->setEnabled(desktopSC); 
     624    sMenuMenu->setEnabled(menuSC); 
    605625    //Now display that info on the UI 
    606626    ui->label_install_app->setText(vals[0]); 
     
    619639    ui->label_install_date->setText(vals[8]); 
    620640    ui->label_install_arch->setText(vals[9]); 
    621     ui->label_install_shortcuts->setText(shortcuts); 
     641    //ui->label_install_shortcuts->setText(shortcuts); 
    622642    ui->check_install_autoupdate->setChecked(autoupdate); 
    623643   
Note: See TracChangeset for help on using the changeset viewer.