Changeset 6a903a7


Ignore:
Timestamp:
07/18/13 07:44:19 (13 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
1aa6ed7
Parents:
a61a5ce
Message:

Add fixes for cancelling a running Install/Removal/Download?.

File:
1 edited

Legend:

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

    ra61a5ce r6a903a7  
    206206      if(cUpdate==pbiID[i]){ sUpdate=TRUE; PMAN->stopProcess(ProcessManager::UPDATE); } 
    207207      if(cRemove==pbiID[i]){ sRemove=TRUE; PMAN->stopProcess(ProcessManager::REMOVE); } 
    208       if(cInstall==pbiID[i]){ sInstall=TRUE; PMAN->stopProcess(ProcessManager::INSTALL); } 
     208      if(cInstall==pbiID[i]){ sInstall=TRUE; }// PMAN->stopProcess(ProcessManager::INSTALL); } 
    209209      //Ignore OTHER process - those commands are pretty much instant 
    210210    } 
     
    922922     resync=TRUE; 
    923923   }else if(ID == ProcessManager::REMOVE){ 
     924     if(sRemove){ 
     925       //Removal Cancelled: Re-install the PBI 
     926       QString metaid = PBIHASH[cRemove].metaID; //get the metaID 
     927       slotSyncToDatabase(TRUE); 
     928       sleep(1); 
     929       installApp(QStringList() << PBIHASH[cRemove].metaID); 
     930     } 
    924931     sRemove=FALSE; 
    925932     cRemove.clear(); //remove that it is finished          
    926933   }else if(ID == ProcessManager::INSTALL){ 
    927934     //Add XDG commands to the queue 
    928      if(!sInstall){  // do not continue on if it was cancelled 
     935     if(sInstall){ 
     936       //Installation Cancelled: remove the PBI now that the install is complete 
     937       QString cmd = generateRemoveCMD(cInstall); 
     938       PENDINGREMOVAL << cInstall+":::"+cmd; 
     939     }else{   
     940       // Installation NOT canceled 
    929941       qDebug() << "Installation Finished:" << cInstall; 
    930942       if(!keepDownloads){ QFile::remove(dlDir+PBIHASH[cInstall].downloadfile); } 
     
    939951     //Make sure the download was successful 
    940952     //qDebug() << "dlDir:" << dlDir << "file:" << PBIHASH[cDownload].downloadfile; 
    941      if(!sDownload){  // do not continue on if it was cancelled 
     953     if(sDownload){ 
     954       //Download Cancelled: remove the (partially) downloaded file 
     955       QString fPath = dlDir+PBIHASH[cDownload].downloadfile; 
     956       if(QFile::exists(fPath)){ 
     957         QFile::remove(fPath); 
     958       } 
     959     }else{ 
     960       //Download not cancelled 
    942961       if(!QFile::exists(dlDir+PBIHASH[cDownload].downloadfile)){ 
    943962         qDebug() << "Download Error:" << cDownload << PBIHASH[cDownload].downloadfile; 
Note: See TracChangeset for help on using the changeset viewer.