Changeset 453e63a


Ignore:
Timestamp:
11/14/13 06:19:53 (13 months ago)
Author:
yurkis <yurkis@…>
Branches:
master, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
b913d3a
Parents:
3224cf9
Message:

Prepare for packages conflict handling

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

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-updatecenter/mainwindow.ui

    r3224cf9 r453e63a  
    259259         <widget class="QStackedWidget" name="pkgDetailsStack"> 
    260260          <property name="currentIndex"> 
    261            <number>1</number> 
     261           <number>0</number> 
    262262          </property> 
    263263          <widget class="QWidget" name="page_3"> 
  • src-qt4/pc-updatecenter/pkgcontroller.cpp

    r3224cf9 r453e63a  
    44 
    55#include <QDebug> 
     6#include <QFile> 
    67 
    78static const char* const UPDATES_AVAIL_STRING = "Upgrades have been requested for the following"; 
     
    2021static const char* const DOWNLOADED_DL_MARKER = "DOWNLOADED:"; 
    2122static const char* const DL_FETCH_START = "FETCH:"; 
     23static const char* const DL_RESUME_DOWNLOAD= "Resuming download of:"; 
     24static const char* const PKG_CONFLICTS_LIST= "PKGCONFLICTS: "; 
     25static const char* const PKG_CONFLICTS_REPLY= "PKGREPLY: "; 
    2226 
    2327typedef enum{ 
     
    213217        mCurrentPkgName= mCurrentPkgName.left(mCurrentPkgName.lastIndexOf("-")); // get packagename without version 
    214218        progress.misCanCancel= true; 
    215         return; 
     219        progress.mMessage= tr("[%1/%2] Downloading %3").arg(QString::number(progress.mItemNo+1), 
     220                                                            QString::number(progress.mItemsCount), 
     221                                                            mCurrentPkgName); 
     222        if (!mLastLine.contains(DL_RESUME_DOWNLOAD)) 
     223            progress.mLogMessages= QStringList()<<(QString("Downloading: ")+line.replace(FETCH, "")); 
     224 
    216225    } 
    217226    if(line == FETCH_DONE) 
     
    247256                                                                                  speed); 
    248257    } 
    249  
     258    else 
     259    if (line.indexOf(PKG_CONFLICTS_LIST) == 0) 
     260    { 
     261        //----------- package conflict 
     262        mConflictList= line.replace(PKG_CONFLICTS_LIST, ""); 
     263        progress.misCanCancel= true; 
     264        progress.mLogMessages= QStringList()<<QString("ERROR: Package upgrade conflict for packages: ")<<mConflictList; 
     265        reportProgress(progress); 
     266 
     267        reportError(tr("Package conflict: ") + mConflictList); 
     268        return; 
     269    } 
     270    else 
     271    if (line.indexOf(PKG_CONFLICTS_REPLY)) 
     272    { 
     273        mConflictsReply= line.replace(PKG_CONFLICTS_REPLY, ""); 
     274        emit packageConflict(mConflictList); 
     275        return; 
     276    } 
     277 
     278    mLastLine = line; 
    250279 
    251280    reportProgress(progress); 
    252281} 
     282 
     283void CPkgController::autoResolveConflict(bool isAutoResolve) 
     284{ 
     285    QString answer = (isAutoResolve)?"yes":"no"; 
     286 
     287    QFile pkgReply( mConflictsReply ); 
     288    if ( pkgReply.open( QIODevice::WriteOnly ) ) 
     289    { 
     290       QTextStream streamReply( &pkgReply ); 
     291       streamReply << answer; 
     292       pkgReply.close(); 
     293    } 
     294    if (!isAutoResolve) 
     295    { 
     296        //process().terminate(); 
     297    } 
     298} 
  • src-qt4/pc-updatecenter/pkgcontroller.h

    r3224cf9 r453e63a  
    6161    virtual void onReadUpdateLine(QString line); 
    6262 
     63signals: 
     64    void packageConflict(QString conflictList); 
     65 
     66public slots: 
     67    void autoResolveConflict(bool isAutoResolve); 
     68 
    6369private: 
    6470    SUpdate mUpdData; 
     
    6773    int     misInFetch; 
    6874    QString mCurrentPkgName; 
     75    QString mLastLine; 
     76    QString mConflictList; 
     77    QString mConflictsReply; 
    6978}; 
    7079 
Note: See TracChangeset for help on using the changeset viewer.