Changeset 2f6ea6c


Ignore:
Timestamp:
08/01/13 19:07:16 (16 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
70f7882, 1fd6b8b
Parents:
87b26bd
Message:

Clean up a couple new status update bugs, and add a lot better reporting about canceled actions, updates can now be canceled during the download phase, but cannot currently be canceled during the actual update application (displays a message about that in the status of the canceled app).

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

Legend:

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

    r74c359f r2f6ea6c  
    362362   
    363363  //Adjust the quick action buttons as necessary 
    364   if(!PBI->currentAppStatus(appID).isEmpty()){ 
     364  if( PBI->isWorking(appID) ){ 
    365365    //Actions pending/working only show cancel button 
    366366    ui->tool_install_cancel->setVisible(TRUE); 
  • src-qt4/pc-softwaremanager/pbiBackend.cpp

    r74c359f r2f6ea6c  
    204204      //Now cancel any current operations for this pbiID 
    205205      if(cDownload==pbiID[i]){ sDownload=TRUE; PMAN->stopProcess(ProcessManager::DOWNLOAD); } 
    206       if(cUpdate==pbiID[i]){ sUpdate=TRUE; PMAN->stopProcess(ProcessManager::UPDATE); } 
     206      if(cUpdate==pbiID[i]){  
     207              if( lUpdate.startsWith("DLSTAT::") || lUpdate.startsWith("DLSTART") ){ 
     208                //In download phase of the update - just kill it 
     209                PMAN->stopProcess(ProcessManager::UPDATE);  
     210              }else{ 
     211                //In the install phase of the update 
     212                sUpdate=TRUE; //need to clean up after it finishes 
     213              } 
     214      } 
    207215      if(cRemove==pbiID[i]){ sRemove=TRUE; } 
    208216      if(cInstall==pbiID[i]){ sInstall=TRUE; } 
     
    263271    //Find out if app is installed already 
    264272    QString pbiID = isInstalled(appID[i]); 
     273    if(pbiID.isEmpty()){ 
     274      //Not installed at the moment, queue up the installation 
     275      qDebug() << "Fresh install of appID:" << appID[i]; 
     276      queueInstall(appID[i]); 
     277    }else{ 
     278      //It is already registered as installed 
     279      if( APPHASH[appID[i]].latestVersion == PBIHASH[pbiID].version ){ 
     280        //latest version already installed, revert to backup version 
     281        qDebug() << "Revert install of appID:" << appID[i]; 
     282        queueInstall(appID[i], APPHASH[appID[i]].backupVersion); 
     283      }else{ 
     284        //older version installed - try to update the app 
     285        qDebug() << "Update install of appID:" << appID[i]; 
     286        upgradePBI(QStringList() << pbiID); 
     287      } 
     288    } 
     289     
     290     
     291    /* 
    265292    //Generate the download command  
    266293    QString cmd, version, arch, dlfile; 
     
    321348      } 
    322349    } 
     350    */ 
    323351  } // end of loop over items 
    324352  //Now check/start the remove process 
     
    553581    switch (status){ 
    554582        case InstalledPBI::DOWNLOADING: 
     583          if(sDownload){ output = tr("Download Canceled"); } 
    555584          if(lDownload.startsWith("DLSTAT::")){ 
    556585            QString percent = lDownload.section("::",1,1); 
     
    563592          break; 
    564593        case InstalledPBI::INSTALLING: 
    565           output = tr("Installing"); break; 
     594          if(sInstall){ output = tr("Install Canceled (will remove)"); } 
     595          else{ output = tr("Installing"); } 
     596          break; 
    566597        case InstalledPBI::REMOVING: 
    567           output = tr("Removing"); break; 
     598          if(sRemove){ output = tr("Removal Canceled (will reinstall)"); } 
     599          else{ output = tr("Removing"); } 
     600          break; 
    568601        case InstalledPBI::UPDATING: 
    569           if(lUpdate.startsWith("DLSTAT::")){ 
     602          if(sUpdate){ output = tr("Update's cannot be canceled"); } 
     603          else if(lUpdate.startsWith("DLSTAT::")){ 
    570604            QString percent = lUpdate.section("::",1,1); 
    571605            output = QString(tr("Update Downloading: %1%")).arg( percent ); 
     
    596630} 
    597631 
     632bool PBIBackend::isWorking(QString pbiID){ 
     633  if( !PBIHASH.contains(pbiID) ){ return FALSE; } 
     634 
     635  bool notworking = (PBIHASH[pbiID].status == InstalledPBI::UPDATEAVAILABLE || PBIHASH[pbiID].status == InstalledPBI::NONE ); 
     636  return !notworking; 
     637} 
     638 
    598639// === Configuration Management === 
    599640void PBIBackend::openConfigurationDialog(){ 
     
    850891 } 
    851892  
     893void PBIBackend::queueInstall(QString appID, QString version){ 
     894  //This function assumes that the new app/version combination is not already installed on the system 
     895  //  and that upgrading is not an option (fresh download/install)       
     896  if( !APPHASH.contains(appID) ){ return; } 
     897  //verify that the version is available 
     898  if( version.isEmpty() ){ version = APPHASH[appID].latestVersion; } 
     899  bool useLatest = false; 
     900  if( version == APPHASH[appID].latestVersion){ useLatest=true; } 
     901  else if( version != APPHASH[appID].backupVersion ){ return; } //invalid version 
     902  //Check to see if the file is already downloaded 
     903  QString dlFile, arch; 
     904  if(useLatest){ dlFile = APPHASH[appID].latestFilename; arch = APPHASH[appID].latestArch; } 
     905  else{ dlFile = APPHASH[appID].backupFilename; arch = APPHASH[appID].backupArch; } 
     906  //Generate PBI ID 
     907  QString newID = appID+"-"+version+"-"+arch; 
     908  QString oldID = isInstalled(appID); //look for existing installation of this app 
     909 
     910  //Create Commands and add them to the proper queue 
     911  if( QFile::exists(dlDir+dlFile) ){ 
     912    if(!oldID.isEmpty()){ 
     913      //Remove the old application first 
     914      PENDINGINSTALL << oldID+":::"+generateRemoveCMD(oldID); 
     915    } 
     916    PENDINGINSTALL << newID+":::"+generateInstallCMD(appID,dlFile); 
     917  }else{ 
     918    //Generate download command 
     919    PENDINGDL << newID+":::"+generateDownloadCMD(appID, version); 
     920  } 
     921  //Setup the HASH entry for the new PBI 
     922  PBIHASH.insert(newID, InstalledPBI()); 
     923  PBIHASH[newID].metaID = appID; 
     924  PBIHASH[newID].version = version; 
     925  PBIHASH[newID].arch = arch; 
     926  PBIHASH[newID].downloadfile = dlFile; 
     927  syncPBI(newID,FALSE); 
     928   
     929} 
     930  
    852931 // =============================== 
    853932 // ======   PRIVATE SLOTS   ====== 
     
    9561035     if(sUpdate){ 
    9571036       //Update stopped during installation of new version: re-install old version 
    958         qDebug() << "Still need to add update cancellation during install phase"; 
     1037        //get metaID of app 
     1038        /*QString metaID = PBIHASH[cUpdate].metaID; 
     1039        slotSyncToDatabase(TRUE); 
     1040        sleep(2); 
     1041        installApp(QStringList() << metaID); //will install backup version if available*/ 
    9591042     } 
    9601043     //Update the PBIHASH for installed versions 
    961      slotSyncToDatabase(TRUE); 
     1044     resync=TRUE; 
    9621045     cUpdate.clear(); //remove that it is finished 
     1046     lUpdate.clear(); 
    9631047     sUpdate=FALSE; 
    9641048     resync=TRUE; 
     
    9661050     if(sRemove){ 
    9671051       //Removal Cancelled: Re-install the PBI 
    968        QString metaid = PBIHASH[cRemove].metaID; //get the metaID 
     1052       QString metaID = PBIHASH[cRemove].metaID; //get the metaID 
    9691053       slotSyncToDatabase(TRUE); 
    970        sleep(1); 
    971        installApp(QStringList() << PBIHASH[cRemove].metaID); 
     1054       sleep(2); 
     1055       installApp(QStringList() << metaID); 
    9721056     } 
    9731057     sRemove=FALSE; 
    974      cRemove.clear(); //remove that it is finished          
     1058     cRemove.clear(); //remove that it is finished       
     1059     lRemove.clear(); 
    9751060   }else if(ID == ProcessManager::INSTALL){ 
    9761061     //Add XDG commands to the queue 
     
    9891074     sInstall = FALSE; 
    9901075     cInstall.clear(); //remove that it is finished 
     1076     lInstall.clear(); 
    9911077     resync=TRUE; //make sure to reload local files 
    9921078   }else if(ID == ProcessManager::DOWNLOAD){ 
     
    10221108     sDownload = FALSE; 
    10231109     cDownload.clear(); //remove that it is finished     
     1110     lDownload.clear(); 
    10241111   }else if(ID == ProcessManager::OTHER){ 
    10251112     cOther.clear();        
  • src-qt4/pc-softwaremanager/pbiBackend.h

    r74c359f r2f6ea6c  
    6767        QStringList AppInfo( QString appID, QStringList infoList); 
    6868        QString currentAppStatus( QString appID , bool rawstatus = false); 
     69        bool isWorking(QString pbiID); 
    6970         
    7071        //Configuration Management 
     
    120121        QStringList removePbiCMD(QString pbiID, QStringList list); 
    121122         
     123        //Internal functions for queuing up actions 
     124        void queueInstall(QString appID, QString version=""); 
     125         
    122126private slots: 
    123127        void updateDlDirPath(QString); 
Note: See TracChangeset for help on using the changeset viewer.