Ignore:
Timestamp:
02/25/14 10:06:43 (15 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.