Changeset c24d6287


Ignore:
Timestamp:
02/25/14 10:06:43 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
9cd0fa0, 9cbf5aa
Parents:
4588960
Message:

Make sure that when an upgrade fails in the AppCafe?, it defaults to trying to download the latest PBI manually before throwing an error. This catches the situations where the user is actually "upgrading" to an older version of an application because of an un-approval of the latest PBI for some reason.

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

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-softwaremanager/containers.h

    r4be3e27 rc24d6287  
    3737  public: 
    3838    enum PBISTATUS{ NONE, DOWNLOADING, INSTALLING, REMOVING, UPDATING, PENDINGDOWNLOAD, PENDINGINSTALL, PENDINGREMOVAL, PENDINGUPDATE, UPDATEAVAILABLE, WORKING }; 
    39     QString name, version, author, website, arch, path, icon, license, mdate, metaID, downloadfile, description, maintainer, fbsdversion; 
     39    QString name, version, author, website, arch, path, icon, license, mdate, metaID, downloadfile, description, maintainer, fbsdversion, rawmdate; 
    4040    PBISTATUS status; 
    4141    bool rootInstall, autoUpdate, desktopIcons, menuIcons, mimetypes; 
  • src-qt4/pc-softwaremanager/pbiBackend.cpp

    r4be3e27 rc24d6287  
    227227    if( PBIHASH.contains(pbiID[i]) ){ 
    228228      if( PBIHASH[pbiID[i]].status == InstalledPBI::UPDATEAVAILABLE ){ 
    229         QString cmd = generateUpdateCMD(pbiID[i]); 
     229        QString cmd = generateUpdateCMD(pbiID[i]); 
    230230        PENDINGUPDATE << pbiID[i] + ":::" + cmd; 
    231231        PBIHASH[pbiID[i]].setStatus(InstalledPBI::PENDINGUPDATE); 
     
    550550          if(lDownload.startsWith("DLSTAT::")){ 
    551551            QString percent = lDownload.section("::",1,1); 
    552             output = QString(tr("Downloading: %1%")).arg( percent ); 
    553           }else if(lDownload == "DLDONE"){ 
    554             output = tr("Download Finished"); 
     552            QString spd = lDownload.section("::",3,3); 
     553            if(spd=="??"){ 
     554              output = QString(tr("Downloading: %1%")).arg( percent ); 
     555            }else{ 
     556              output = QString(tr("Downloading: %1% @ %2")).arg( percent, spd ); 
     557            } 
    555558          }else{ 
    556             output = tr("Download Starting");  
     559            output = lDownload; 
    557560          } 
    558561          break; 
     
    11561159   if(ID == ProcessManager::UPDATE){ 
    11571160     if(!sUpdate){ //not stopped manually 
    1158        if(PBIHASH.contains(cUpdate)){name = PBIHASH[cUpdate].name; } 
    1159        title = QString(tr("%1 Update Error:")).arg(name);  
    1160        message = tr("The update process experienced an error and could not be completed"); 
     1161       //Try to do the update through full download instead 
     1162       if(PBIHASH.contains(cUpdate)){ 
     1163         QString metaID = PBIHASH[cUpdate].metaID; 
     1164         if(APPHASH.contains(metaID)){ 
     1165          QString version = APPHASH[metaID].latestVersion; 
     1166          queueInstall(metaID, version); 
     1167         }else{ 
     1168          QString name = PBIHASH[cUpdate].name; 
     1169          title = QString(tr("%1 Update Error:")).arg(name);  
     1170          message = tr("The update process experienced an error and could not be completed"); 
     1171         } 
     1172       } 
    11611173     } 
    11621174   } 
  • src-qt4/pc-softwaremanager/processManager.cpp

    r5cb32e6 rc24d6287  
    135135// ===== PRIVATE SLOTS ===== 
    136136// ========================= 
    137 //QString ProcessManager::parseDlLine(QString line){ 
    138137  /*DOWNLOAD NOTIFICATION CODES: 
    139138  Download complete: "DLDONE" 
     
    142141  Download starting: "DLSTART" 
    143142  */ 
    144 /* 
    145   QString out; 
    146   if( line.startsWith("FETCH:") ){ return "DLSTART"; } 
    147   else if( line == "FETCHDONE"){ return "DLDONE"; } 
    148   else if(!line.startsWith("SIZE:")){ return out; } 
    149   //qDebug() << "parse Download Line:" << line; 
    150   //Line format: SIZE:  <KB> DOWNLOADED:  <KB> SPEED:  <KB/s> KB/s 
    151   line = line.simplified(); 
    152   line.replace("SIZE: ",""); 
    153   line.replace("DOWNLOADED: ", ""); 
    154   line.replace("SPEED: ",""); 
    155   line.replace("KB/s",""); 
    156   bool totok, curok, spdok; 
    157   double tot, cur, spd; 
    158   tot = line.section(" ",0,0).toDouble(&totok); 
    159   cur = line.section(" ",1,1).toDouble(&curok); 
    160   spd = line.section(" ",2,2).toDouble(&spdok); 
    161   //qDebug() << " - DownloadStats:" << tot << cur << spd; 
    162   if(totok && tot==0){totok=FALSE;} 
    163   if(curok && cur==0){curok=FALSE;} 
    164   if(spdok && spd==0){spdok=FALSE;} 
    165   //Now format the output string 
    166   QString stats; 
    167   out = "DLSTAT::"; 
    168   //Get percent and totals 
    169   if(totok && curok){ 
    170     bool totErr = (tot==cur); //catch for a display error where the cur is always identical to the tot 
    171     if(!totErr){           
    172       //Calculate the percentage 
    173       double percent = (cur/tot)*100; 
    174       percent = int(percent*10)/10.0; 
    175       out.append(QString::number(percent)+"::"); 
    176       //Now list the total 
    177       out.append( Extras::sizeKToDisplay(QString::number(tot)) +"::" ); 
    178     }else{ 
    179       //Only Total/Current is known (unknown percentage since not complete yet) 
    180       out.append("??::"+Extras::sizeKToDisplay(QString::number(tot))+"::"); 
    181     }        
    182   }else if(curok){ 
    183     //Only Total/Current is known (unknown percentage since not complete yet) 
    184     out.append("??::"+Extras::sizeKToDisplay(QString::number(cur))+"::"); 
    185   }else if(totok){ 
    186     //Only Total/Current is known (unknown percentage since not complete yet) 
    187     out.append("??::"+Extras::sizeKToDisplay(QString::number(tot))+"::"); 
    188   }else{ 
    189     //Unknown Total and Current 
    190     out.append("??::??::"); 
    191   } 
    192   //Now get the speed 
    193   if(spdok){ 
    194     out.append( Extras::sizeKToDisplay(QString::number(spd))+"/s" ); 
    195   }else{ 
    196     out.append("??"); 
    197   } 
    198   return out; 
    199 } 
    200 */ 
     143 
    201144// == UPDATE PROCESS == 
    202145void ProcessManager::slotUpProcMessage(QString msg){ 
    203   //Check for DL start/finish messages 
    204   if(msg.startsWith("FETCH:")){ msg = "DLSTART"; } 
    205   else if(msg.startsWith("FETCHDONE")){ msg = "DLDONE"; } 
    206   else{ 
    207     //Add the message to the log 
    208     upLog << msg; 
    209   } 
     146  //Add the message to the log 
     147  upLog << msg; 
     148   
    210149  //Now send it out 
    211150  emit ProcessMessage(UPDATE, msg); 
     
    250189void ProcessManager::slotDlProcMessage(QString msg){ 
    251190  //Check for DL start/finish messages 
    252   if(msg.startsWith("FETCH:")){ msg = "DLSTART"; } 
    253   else if(msg.startsWith("FETCHDONE")){ msg = "DLDONE"; } 
    254   else{ 
    255     //Add the message to the log 
    256     dlLog << msg; 
    257   } 
     191  //Add the message to the log 
     192  dlLog << msg; 
    258193  //Now send it out 
    259194  emit ProcessMessage(DOWNLOAD, msg); 
Note: See TracChangeset for help on using the changeset viewer.