Changeset f7905b5


Ignore:
Timestamp:
02/24/14 10:11:50 (6 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
a2ef28e
Parents:
430a6b5
Message:

Make sure that the AppCafe? browser "app" page gets the download button updated if there is a status change for the associated installed version of that app.

Location:
src-qt4/pc-softwaremanager
Files:
4 edited

Legend:

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

    re543bca rf7905b5  
    292292  slotDisplayStats(); 
    293293  slotCheckSelectedItems(); 
     294  //If the browser app page is currently visible for this app 
     295  if( (ui->stacked_browser->currentWidget() == ui->page_app) && ui->page_app->isVisible() ){ 
     296    slotUpdateAppDownloadButton(); 
     297  } 
    294298} 
    295299 
     
    327331      } 
    328332    } 
     333  } 
     334  //If the browser app page is current for this app 
     335  QString metaID = PBI->pbiToAppID(pbiID); 
     336  if( (ui->stacked_browser->currentWidget() == ui->page_app) && (cApp == metaID) && ui->page_app->isVisible() ){ 
     337    slotUpdateAppDownloadButton(); 
    329338  } 
    330339} 
     
    832841    return; 
    833842  } 
     843  cApp = appID; //save this for later 
    834844  //Start the search for similar apps 
    835845  PBI->searchSimilar = appID; 
     
    868878  } 
    869879  //Now update the download button appropriately 
    870   QString ico; 
     880  slotUpdateAppDownloadButton(); 
     881  /*QString ico; 
    871882  QString working = PBI->currentAppStatus(appID); 
    872883  if(!working.isEmpty()){ //app currently pending or actually doing something 
     
    899910  } 
    900911  ui->tool_bapp_download->setWhatsThis(appID); //set for slot 
     912  */ 
    901913  //Now enable/disable the shortcut buttons 
    902914  ui->tool_browse_app->setVisible(TRUE); 
     
    913925  ui->stacked_browser->setCurrentWidget(ui->page_app); 
    914926         
     927} 
     928 
     929void MainUI::slotUpdateAppDownloadButton(){ 
     930  QString ico; 
     931  QString working = PBI->currentAppStatus(cApp); 
     932  QStringList info = PBI->AppInfo(cApp, QStringList() << "latestversion" << "backupversion" << "requiresroot"); 
     933  QString pbiID = PBI->isInstalled(cApp); 
     934  if(!working.isEmpty()){ //app currently pending or actually doing something 
     935    ui->tool_bapp_download->setText(working); 
     936    ui->tool_bapp_download->setIcon(QIcon(":icons/working.png")); 
     937    ui->tool_bapp_download->setEnabled(FALSE); 
     938  }else if( pbiID.isEmpty() ){ //new installation 
     939    ui->tool_bapp_download->setText(tr("Install Now!")); 
     940    ico = ":icons/app_download.png"; 
     941    ui->tool_bapp_download->setEnabled(TRUE); 
     942  }else if( !PBI->upgradeAvailable(pbiID).isEmpty() ){ //Update available 
     943    ui->tool_bapp_download->setText(tr("Update")); 
     944    ico = ":icons/app_upgrade.png"; 
     945    ui->tool_bapp_download->setEnabled(TRUE); 
     946  }else if(!info[1].isEmpty()){  //Downgrade available 
     947    ui->tool_bapp_download->setText(tr("Downgrade")); 
     948    ico = ":icons/app_downgrade.png"; 
     949    ui->tool_bapp_download->setEnabled(TRUE); 
     950  }else{ //already installed (no downgrade available) 
     951    ui->tool_bapp_download->setText(tr("Installed")); 
     952    ui->tool_bapp_download->setIcon(QIcon(":icons/dialog-ok.png")); 
     953    ui->tool_bapp_download->setEnabled(FALSE); 
     954  } 
     955  //Now set the icon appropriately if it requires root permissions 
     956  if(!ico.isEmpty()){ 
     957    if(info[2]=="true"){ //requires root permissions to install 
     958      ico.replace(".png","-root.png"); 
     959    } 
     960    ui->tool_bapp_download->setIcon(QIcon(ico)); 
     961  } 
     962  ui->tool_bapp_download->setWhatsThis(cApp); //set for slot 
    915963} 
    916964 
     
    10591107  ui->tool_bapp_download->setEnabled(FALSE); //make sure it cannot be clicked more than once before page refresh 
    10601108  //Now show the Installed tab 
    1061   ui->tabWidget->setCurrentWidget(ui->tab_installed); 
     1109  //ui->tabWidget->setCurrentWidget(ui->tab_installed); 
    10621110} 
    10631111 
  • src-qt4/pc-softwaremanager/mainUI.h

    re543bca rf7905b5  
    9595  void slotGoToCategory(QString); 
    9696  void slotGoToApp(QString); 
     97  void slotUpdateAppDownloadButton(); 
    9798  void slotGoToSearch(); 
    9899  void slotShowSimilarApps(QStringList); 
     
    120121  //BROWSER TAB 
    121122  QTimer *searchTimer; 
    122   QString cCat; 
     123  QString cCat, cApp; 
    123124  void initializeBrowserTab(); 
    124125  //OTHER 
  • src-qt4/pc-softwaremanager/pbiBackend.cpp

    re543bca rf7905b5  
    629629  } 
    630630  return output; 
     631} 
     632 
     633QString PBIBackend::pbiToAppID(QString pbiID){ 
     634  QString appID; 
     635  if( PBIHASH.contains(pbiID) ){ appID = PBIHASH[pbiID].metaID; }        
     636  return appID; 
    631637} 
    632638 
  • src-qt4/pc-softwaremanager/pbiBackend.h

    re543bca rf7905b5  
    7070        bool isWorking(QString pbiID); 
    7171        QStringList pbiBinList(QString pbiID); 
     72        QString pbiToAppID(QString pbiID); 
    7273         
    7374        //Configuration Management 
     
    7778        bool exportPbiListToFile(QString filepath); 
    7879        bool importPbiListFromFile(QString filepath); 
    79  
     80         
    8081public slots: 
    8182        void startAppSearch(); //get list of apps containing the search string (SIGNAL OUTPUT ONLY) 
Note: See TracChangeset for help on using the changeset viewer.