Ignore:
Timestamp:
Jul 9, 2013 2:57:42 PM (9 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
a3c7851
Parents:
e7d8648
Message:

Add a quick "cancel" button to the AppCafe?, and make the quick buttons dynamically visible as necessary. Also fix up and add a couple icons for the small update button.

File:
1 edited

Legend:

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

    re7d8648 rf3baeb9  
    314314  vals << "name" << "icon" << "author" << "website" << "version" << "license"; 
    315315  QStringList bools; 
    316   bools << "autoupdate" << "hasdesktopicons" << "hasmenuicons"; 
     316  bools << "autoupdate" << "hasdesktopicons" << "hasmenuicons" << "requiresroot"; 
    317317  vals = PBI->PBIInfo(appID,vals); 
    318318  bools = PBI->PBIInfo(appID,bools); 
     
    327327  bool desktopSC = (bools[1] == "true"); // XDG desktop entries available 
    328328  bool menuSC= (bools[2] == "true");     // XDG menu entries available 
    329   bool autoupdate = (bools[0] == "true");   
     329  bool autoupdate = (bools[0] == "true"); //auto-update enabled 
     330  bool rootonly = (bools[3] == "true"); //requires root 
    330331  //Create the shortcuts string 
    331332  QString shortcuts; 
     
    348349  ui->label_install_shortcuts->setText(shortcuts); 
    349350  ui->check_install_autoupdate->setChecked(autoupdate); 
    350   //Make the upgrade button invisible if no upgrade available 
    351   if(PBI->upgradeAvailable(appID).isEmpty()){ ui->tool_install_update->setVisible(FALSE); } 
    352   else{ ui->tool_install_update->setVisible(TRUE); } 
     351   
     352  //Adjust the quick action buttons as necessary 
     353  if(!PBI->currentAppStatus(appID).isEmpty()){ 
     354    //Actions pending/working only show cancel button 
     355    ui->tool_install_cancel->setVisible(TRUE); 
     356    ui->tool_install_remove->setVisible(FALSE); 
     357    ui->tool_install_update->setVisible(FALSE); 
     358  }else{ 
     359    //Nothing pending 
     360    ui->tool_install_cancel->setVisible(FALSE); 
     361    if( !PBI->isInstalled(appID).isEmpty() ){  
     362      //Remove Button 
     363      ui->tool_install_remove->setVisible(TRUE); 
     364      if(rootonly){ ui->tool_install_remove->setIcon(QIcon(":icons/remove-root.png")); } 
     365      else{ ui->tool_install_remove->setIcon(QIcon(":icons/remove.png")); } 
     366      //Upgrade button 
     367      if(PBI->upgradeAvailable(appID).isEmpty()){ ui->tool_install_update->setVisible(FALSE); } 
     368      else{ 
     369        ui->tool_install_update->setVisible(TRUE);  
     370        if(rootonly){ ui->tool_install_update->setIcon(QIcon(":icons/app_upgrade_small-root.png")); } 
     371        else{ ui->tool_install_update->setIcon(QIcon(":icons/app_upgrade_small.png")); } 
     372      } 
     373    }else{  
     374      ui->tool_install_remove->setVisible(FALSE);  
     375      ui->tool_install_update->setVisible(FALSE);  
     376    }    
     377  } 
    353378   
    354379} 
     
    388413    PBI->removePBI(QStringList() << appID); 
    389414  } 
     415} 
     416 
     417void MainUI::on_tool_install_cancel_clicked(){ 
     418  //Get the current item 
     419  QString appID; 
     420  if(ui->tree_install_apps->topLevelItemCount() > 0){ 
     421    appID = ui->tree_install_apps->currentItem()->whatsThis(0); 
     422  } 
     423  if(appID.isEmpty()){return;} 
     424  PBI->cancelActions(QStringList() << appID); 
     425   
    390426} 
    391427 
Note: See TracChangeset for help on using the changeset viewer.