Changeset 8b8cfe3d


Ignore:
Timestamp:
12/06/13 07:04:40 (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:
13c44de
Parents:
72acc29 (diff), 15ea961 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/pcbsd/pcbsd

Location:
src-qt4
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/EasyPBI/PBIModule.cpp

    r618dff3 rffa2c7a  
    55    // 10.x PBI format: 12/5/13 
    66  version = "10.x" 
     7  //pbi.conf values 
    78  CTextValues << "PBI_PROGNAME" << "PBI_PROGWEB" << "PBI_PROGAUTHOR" << "PBI_PROGICON" \ 
    89                << "PBI_LICENCE" << "PBI_TAGS" << "PBI_PROGTYPE" << "PBI_ICONURL" << "PBI_CATEGORY" \ 
     
    1011  CBoolValues << "PBI_REQUIRESROOT" << "PBI_AB_NOTMPFS" << "PBI_AB_NOPKGBUILD"; 
    1112  CIntValues << "PBI_BUILDKEY" << "PBI_PROGREVISION" << "PBI_AB_PRIORITY"; 
     13  //Valid Scripts 
     14  scriptValues << "pre-pbicreate.sh" << "pre-install.sh" << "post-install.sh" << "pre-remove.sh"; 
     15         
    1216  HASH.clear(); //Make sure the hash is currently empty 
    1317} 
     
    182186//     SCRIPTS 
    183187// ========== 
    184          
     188QStringList PBIModule::readScript(QString var){ 
     189  QStringList out; 
     190  if( scriptValues.contains(var) || QFile:exists(basePath+"/scripts/"+var) ){ 
     191    out = readFile(basePath+"/scripts/"+var); 
     192  }        
     193  return out; 
     194} 
     195 
     196bool PBIModule::writeScript(QString var,QStringList val){ 
     197  bool ok = false; 
     198  if( scriptValues.contains(var) || QFile:exists(basePath+"/scripts/"+var) ){ 
     199    ok = createFile(basePath+"/scripts/"+var, val); 
     200  } 
     201  return ok; 
     202} 
     203 
     204QStringList PBIModule::validScripts(){ 
     205  return scriptValues; 
     206} 
     207 
     208QStringList PBIModule::existingScripts(){ 
     209  QStringList out; 
     210  QDir dir(basePath+"/scripts"); 
     211  if(dir.exists()){ 
     212    out = dir.entryList(QStringList() << "*.sh", QDir::Files | QDir::NoDotAndDotDot, QDir::Name); 
     213  } 
     214  return out; 
     215} 
     216 
    185217// ============= 
    186218//      RESOURCES 
     
    201233//fileName = full path to file (I.E. /home/pcbsd/junk/junk.txt) 
    202234//contents = list of lines to be written (one line per entry in the list - no newline needed at the end of an entry) 
     235         
     236  //Check if this is actually a file removal 
     237  if(contents.isEmpty() && QFile::exists(fileName)){ 
     238    bool good = QFile::remove(fileName); 
     239    if(!good){ 
     240      qDebug() << fileName+": Could not be deleted"; 
     241    } 
     242    return good; 
     243  } 
     244   
    203245  //Check that the parent directory exists, and create it if necessary 
    204246  QDir dir(fileName); 
     
    240282  //Return success 
    241283  QString extra = QDir::homePath(); //remove this from the filename display 
    242   qDebug() << "Created:" << fileName.replace(extra,"~"); 
     284  qDebug() << "Saved:" << fileName.replace(extra,"~"); 
    243285  return true;; 
    244286} 
     
    248290  //Check that the file exists first 
    249291  if(!QFile::exists(filePath)){  
    250     qDebug() << "Error: file to read does not exist:" << filePath; 
     292    qDebug() << "Warning: file to read does not exist:" << filePath; 
    251293    return contents;  
    252294  } 
  • src-qt4/EasyPBI/PBIModule.h

    r618dff3 rffa2c7a  
    5454private: 
    5555        QHash<QString, QVariant> HASH; 
    56         QStringList CTextValues, CBoolValues, CIntValues; 
     56        QStringList CTextValues, CBoolValues, CIntValues, scriptValues; 
    5757        QString basePath, version; 
    5858 
  • src-qt4/pc-updatecenter/mainwindow.cpp

    r136fa80 r72acc29  
    221221void MainWindow::globalStateChanged(CAbstractUpdateController::EUpdateControllerState new_state) 
    222222{ 
    223     refreshMenu(); 
    224  
    225     ui->RebootW->setVisible(mSysController.rebootRequired()); 
     223    refreshMenu();     
    226224 
    227225    bool isUpdatesAvail= (mSysController.currentState() == CAbstractUpdateController::eUPDATES_AVAIL) 
  • src-qt4/pc-updatecenter/pkgcontroller.cpp

    rf74a1b6 r72acc29  
    3030#include <QDebug> 
    3131#include <QFile> 
     32#include <QRegExp> 
    3233 
    3334__string_constant FULLY_UPDATED_MESSAGE = "All packages are up to date!"; 
     
    5556__string_constant PKG_NETWORK_ERROR = ": No address record"; 
    5657 
     58typedef struct 
     59{ 
     60    QString mDEName; 
     61    QStringList mPkgSet; 
     62}SDesktopCriticalPkgs; 
     63 
     64//============== This is list of packages that should cause logaut from desktop environment 
     65//TODO: Add MATE, XFCE. Check KDE and LXDE 
     66 
     67const SDesktopCriticalPkgs DESKTOP_CRITICAL_PKG[]={ 
     68{QString("kde"), QStringList()<<"kde-runtime*"<<"kde-workspace*"<<"kdebindings*"<<"kdelibs*"<<"plasma-scriptengine*"}, 
     69{QString("lxde"), QStringList()<<"lxpanel*"<<"lxde-meta*"<<"lxsession*"<<"lxde-common*"}, 
     70}; 
     71 
     72const int DESKTOP_CRITICAL_PKG_COUNT = sizeof(DESKTOP_CRITICAL_PKG) / sizeof(SDesktopCriticalPkgs); 
    5773 
    5874typedef enum{ 
     
    91107    env.insert("PCFETCHGUI","YES"); //For readable download notifications 
    92108    process().setProcessEnvironment(env); 
     109    mCurrentDEIndex=-1; 
     110 
     111    // Get current DE 
     112    pcbsd::DesktopEnvironmentInfo currDE = pcbsd::Utils::currentDesktop(); 
     113    if (currDE.Name.length()) 
     114    { 
     115        for(int i=0; i<DESKTOP_CRITICAL_PKG_COUNT; i++) 
     116        { 
     117            if (DESKTOP_CRITICAL_PKG[i].mDEName.toLower().trimmed() == currDE.Name.trimmed().toLower()) 
     118            { 
     119                mCurrentDEIndex = i; 
     120                qDebug()<<currDE.Name; 
     121                break; 
     122            } 
     123        }//for all DESKTOP_CRITICAL_PKG 
     124    }// if detected DE 
     125 
     126    misLogoffRequired= false; 
     127 
    93128} 
    94129 
     
    97132{ 
    98133    return mUpdData; 
     134} 
     135 
     136/////////////////////////////////////////////////////////////////////////////// 
     137bool CPkgController::logoffRequired() 
     138{ 
     139    return (currentState() != eUPDATING) && misLogoffRequired; 
    99140} 
    100141 
     
    349390        progress.mMessage = msg; 
    350391 
     392        // Check for lofoff required packages 
     393        if (mCurrentDEIndex>=0) 
     394        { 
     395            QRegExp rx; 
     396            rx.setPatternSyntax(QRegExp::WildcardUnix); 
     397            for (int i=0; i<DESKTOP_CRITICAL_PKG[mCurrentDEIndex].mPkgSet.size(); i++) 
     398            { 
     399                rx.setPattern(DESKTOP_CRITICAL_PKG[mCurrentDEIndex].mPkgSet[i]); 
     400                if (rx.exactMatch(pkg_name)) 
     401                { 
     402                    misLogoffRequired= true; 
     403                    qDebug()<<"Logoff required!"; 
     404                    break; 
     405                }//if match 
     406            }//for all wildcard 
     407        } 
     408 
    351409        misWasInstalation= true; 
    352410        last_message= msg; 
  • src-qt4/pc-updatecenter/pkgcontroller.h

    r08b1b75 r72acc29  
    2727 
    2828#include "updatecontroller.h" 
    29  
    3029#include <QProcess> 
    3130#include <QVector> 
     
    7877 
    7978    SUpdate updateData(); 
     79    bool    logoffRequired(); 
    8080 
    8181protected: 
     
    104104    QString mConflictList; 
    105105    QString mConflictsReply; 
     106    int     mCurrentDEIndex; 
     107    bool    misLogoffRequired; 
    106108}; 
    107109 
  • src-qt4/pc-updatecenter/rebootwidget.cpp

    r6266834 r72acc29  
    33 
    44#include <QProcess> 
     5#include <QDebug> 
     6#include "utils.h" 
     7 
     8__string_constant REBOOT_IMAGE = ":/images/system-reboot.png"; 
     9__string_constant LOGOFF_IMAGE = ":/images/system-log-out.png"; 
    510 
    611RebootWidget::RebootWidget(QWidget *parent) : 
     
    1217    mPkgController= NULL; 
    1318    mPBIController = NULL; 
     19    misReboot= false; 
     20    misLogoff = false; 
    1421} 
    1522 
     
    4855    bool is_reboot_btn = false; 
    4956    if ((!mSysController) || (!mPkgController) || (!mPBIController)) 
    50         return; 
     57        return;         
    5158 
    5259    is_reboot_btn = (mSysController->currentState() != CAbstractUpdateController::eUPDATING) 
     
    5764    ui->restartButton->setVisible(is_reboot_btn); 
    5865 
    59     bool this_visible = mSysController->rebootRequired() && (mSysController->currentState() != CAbstractUpdateController::eUPDATING); 
    60     setVisible(this_visible); 
     66    bool misReboot = mSysController->rebootRequired() && (mSysController->currentState() != CAbstractUpdateController::eUPDATING); 
     67    bool misLogoff = mPkgController->logoffRequired() && (mPkgController->currentState() != CAbstractUpdateController::eUPDATING); 
     68 
     69    setVisible((misReboot) || (misLogoff)); 
     70 
     71    if (misLogoff && (!misReboot)) 
     72    { 
     73        ui->IconLabel->setPixmap(QPixmap(LOGOFF_IMAGE)); 
     74        ui->messageLabel->setText(tr("Please re-enter to desktop environment to prevent unexpected behaviour")); 
     75    } 
     76    if (misReboot) 
     77    { 
     78        ui->IconLabel->setPixmap(QPixmap(REBOOT_IMAGE)); 
     79        ui->messageLabel->setText(tr("Your system should be restarted to finalize update")); 
     80    } 
    6181} 
  • src-qt4/pc-updatecenter/rebootwidget.h

    r6266834 r72acc29  
    3333    CPkgController* mPkgController; 
    3434    CPBIController* mPBIController; 
     35 
     36    bool            misReboot; 
     37    bool            misLogoff; 
    3538}; 
    3639 
  • src-qt4/pc-updatecenter/rebootwidget.ui

    r6266834 r72acc29  
    77    <x>0</x> 
    88    <y>0</y> 
    9     <width>546</width> 
    10     <height>44</height> 
     9    <width>544</width> 
     10    <height>42</height> 
    1111   </rect> 
    1212  </property> 
     
    4747   </item> 
    4848   <item> 
    49     <widget class="QLabel" name="label"> 
     49    <widget class="QLabel" name="messageLabel"> 
    5050     <property name="text"> 
    5151      <string>Your system should be restarted to finalize update</string> 
Note: See TracChangeset for help on using the changeset viewer.