Ignore:
Timestamp:
06/04/13 08:24:52 (16 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
aa62fb7, e9e40b5
Parents:
66f9603
Message:

Update the Update GUI to use a new Details section, which gives descriptions of
updates pulled down from freebsd-update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-updategui/mainWin.cpp

    r67e6e29 r408fff7  
    2626{ 
    2727  // Set any warden directories 
     28  groupDetails->setVisible(false); 
    2829  doingUpdate=false; 
    2930  lastError=""; 
     
    7677  else 
    7778    pushInstallUpdates->setEnabled(true); 
     79 
     80 
     81  // See if we have description text to update 
     82  groupDetails->setVisible(false); 
     83  textDesc->setText(QString()); 
     84  if ( ! listViewUpdates->currentItem() ) 
     85     return; 
     86 
     87  int myRow = listViewUpdates->currentRow(); 
     88 
     89  if ( listUpdates.at(myRow).at(1) == "FBSDUPDATE" ) { 
     90    groupDetails->setVisible(true); 
     91 
     92    QString desc; 
     93    for (int p=2; p < listUpdates.at(myRow).count(); p++) 
     94      desc += listUpdates.at(myRow).at(p) + "<br>"; 
     95    textDesc->setText(desc); 
     96  } 
    7897} 
    7998 
     
    381400        fileNameList += listUpdates.at(z).at(p) + "<br>"; 
    382401 
    383       QListWidgetItem *item = new QListWidgetItem(tr("FreeBSD Security Update")); 
     402      QListWidgetItem *item = new QListWidgetItem(tr("Base System Updates")); 
    384403      item->setCheckState(Qt::Unchecked); 
    385       item->setToolTip(tr("The following files need updating:") + "<hr>" + fileNameList); 
     404      item->setToolTip(fileNameList); 
    386405       
    387406      listViewUpdates->addItem(item); 
     
    505524 
    506525void mainWin::checkFBSDUpdates() { 
    507   QString line; 
    508   QStringList up, listPkgs; 
     526  QString line, toPatchVer, tmp; 
     527  QStringList up, listDesc, listPkgs; 
    509528 
    510529  // Now check if there are freebsd-updates to install 
     
    525544    line = f.readLine().simplified(); 
    526545    qDebug() << line; 
    527     if ( line.indexOf("The following files will be updated ") == 0) { 
     546    if ( line.indexOf("The following files will be ") == 0) { 
     547       toPatchVer= line.remove(0, line.lastIndexOf(" ")); 
     548       toPatchVer=toPatchVer.section("-", 2,2); 
     549       toPatchVer=toPatchVer.section(":", 0,0); 
     550       toPatchVer=toPatchVer.section("p", 1,1); 
    528551       fUp = true; 
     552       listPkgs << " " << tr("The following files will be updated:"); 
    529553       continue; 
    530554    } 
     
    539563  // Are there freebsd updates to install? 
    540564  if ( fUp ) { 
     565    QString mySysVer; 
     566    QString myPatchVer; 
     567 
     568    // Lets try and fetch the desc file 
     569    QProcess::execute("fetch -o /tmp/.fbsdupdesc http://fbsd-update.pcbsd.org/updates.desc"); 
     570 
     571    // Get the current system ver 
     572    QProcess p; 
     573    p.start(QString("uname"), QStringList() << "-r"); 
     574    while(p.state() == QProcess::Starting || p.state() == QProcess::Running) 
     575       QCoreApplication::processEvents(); 
     576    tmp = p.readLine().simplified(); 
     577    mySysVer = tmp; 
     578    myPatchVer = tmp; 
     579    mySysVer = mySysVer.section("-", 0, 1); 
     580    mySysVer = mySysVer.section("-", 0, 1); 
     581    myPatchVer = myPatchVer.section("-", 2, 2); 
     582    myPatchVer = myPatchVer.section(":", 0, 0); 
     583    myPatchVer = myPatchVer.section("p", 1, 1); 
     584 
     585    QFile file("/tmp/.fbsdupdesc"); 
     586    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { 
     587        listDesc << tr("Update Details:"); 
     588      while (!file.atEnd()) { 
     589         line = file.readLine(); 
     590         tmp = line; 
     591         if ( tmp.section(":::", 0, 0) != mySysVer )  
     592            continue; 
     593         if ( tmp.section(":::", 1, 1) <= myPatchVer ) 
     594            continue; 
     595         if ( tmp.section(":::", 1, 1) > toPatchVer ) 
     596            continue; 
     597         listDesc << tmp.section(":::", 2, 2); 
     598      } 
     599    } 
     600 
    541601    up.clear(); 
    542602    up << "FreeBSD Security Updates" << "FBSDUPDATE"; 
    543     up.append(listPkgs); 
     603    up.append(listDesc + listPkgs); 
    544604    listUpdates.append(up); 
    545605  } 
Note: See TracChangeset for help on using the changeset viewer.