Changeset 5215583


Ignore:
Timestamp:
May 10, 2014 6:04:57 AM (2 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0.2
Children:
c30962e
Parents:
be45c1d
Message:

Fix the AppCafe? pbi migration, the conflict detection was missing
still.

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

Legend:

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

    racb0f00 r5215583  
    11#include "migrateUI.h" 
    22#include "ui_migrateUI.h" 
     3#include <QMessageBox> 
    34 
    45MigrateUI::MigrateUI() : QMainWindow(), ui(new Ui::MigrateUI){ 
     
    3839void MigrateUI::updateProgress(QString msg){ 
    3940  ui->text_progress->append(msg); 
     41 
     42  QString line = msg; 
     43 
     44  if ( line.indexOf("PKGCONFLICTS: ") == 0 ) { 
     45     QString tmp = line; 
     46     tmp.replace("PKGCONFLICTS: ", ""); 
     47     ConflictList = tmp; 
     48  } 
     49  else if ( line.indexOf("PKGREPLY: ") == 0 ) { 
     50     QString ans; 
     51     QString tmp = line; 
     52     tmp.replace("PKGREPLY: ", ""); 
     53     QMessageBox msgBox; 
     54     msgBox.setText(tr("The following packages are causing conflicts with the selected changes and can be automatically removed. Continue?") + "\n" + ConflictList); 
     55     msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No); 
     56     msgBox.setDetailedText(getConflictDetailText()); 
     57     msgBox.setDefaultButton(QMessageBox::No); 
     58     if ( msgBox.exec() == QMessageBox::Yes) { 
     59        // We will try to fix conflicts 
     60        ans="yes"; 
     61     } else { 
     62       // We will fail :( 
     63       QMessageBox::warning(this, tr("Package Conflicts"), 
     64       tr("You may need to manually fix the conflicts before trying again."), 
     65       QMessageBox::Ok, 
     66       QMessageBox::Ok); 
     67       ans="no"; 
     68     } 
     69 
     70     QFile pkgTrig( tmp ); 
     71     if ( pkgTrig.open( QIODevice::WriteOnly ) ) { 
     72        QTextStream streamTrig( &pkgTrig ); 
     73        streamTrig << ans; 
     74        pkgTrig.close(); 
     75        ConflictList.clear(); //already sent an answer - clear the internal list 
     76     } 
     77  } 
    4078} 
    4179 
     
    4886  this->close(); 
    4987} 
    50          
     88 
     89 
     90QString MigrateUI::getConflictDetailText() { 
     91 
     92  QStringList ConList = ConflictList.split(" "); 
     93  QStringList tmpDeps; 
     94  QString retText; 
     95 
     96  for (int i = 0; i < ConList.size(); ++i) { 
     97    QProcess p; 
     98    tmpDeps.clear(); 
     99 
     100    p.start("pkg", QStringList() << "rquery" << "%rn-%rv" << ConList.at(i)); 
     101 
     102    if(p.waitForFinished()) { 
     103      while (p.canReadLine()) { 
     104        tmpDeps << p.readLine().simplified(); 
     105      } 
     106    } 
     107    retText+= ConList.at(i) + " " + tr("required by:") + "\n" + tmpDeps.join(" "); 
     108  } 
     109 
     110  return retText; 
     111} 
  • src-qt4/pc-softwaremanager/migrateUI.h

    racb0f00 r5215583  
    2424        Ui::MigrateUI *ui; 
    2525        DLProcess *proc; 
     26        QString ConflictList; 
    2627 
    2728private slots: 
     
    3334        void updatePercent(QString,QString,QString); 
    3435        void restartSystem(); 
     36        QString getConflictDetailText(); 
    3537 
    3638protected: 
Note: See TracChangeset for help on using the changeset viewer.