![](https://seccdn.libravatar.org/avatar/f850d49374387219fe79b9ca562f7803.jpg?s=120&d=mm&r=g)
Author: tgoettlicher Date: Tue Feb 26 17:20:36 2008 New Revision: 8920 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8920&view=rev Log: - removed call of zypp-checkpatches-wrapper - added button to call yast if operation was to complex Modified: trunk/updater-kde/package/opensuse-updater-kde.changes trunk/updater-kde/updater/MainWindow.cpp trunk/updater-kde/updater/MainWindow.h trunk/updater-kde/updater/TrayIcon.cpp trunk/updater-kde/updater/Updater.h trunk/updater-kde/updater/UpdaterApplication.cpp trunk/updater-kde/updater/simpleview.cpp trunk/updater-kde/updater/simpleview.h trunk/updater-kde/updater/zypp/ZYppUpdater.cpp trunk/updater-kde/updater/zypp/ZYppUpdater.h trunk/updater-kde/updater/zypp/zypper_install Modified: trunk/updater-kde/package/opensuse-updater-kde.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/package/opensuse-upda... ============================================================================== --- trunk/updater-kde/package/opensuse-updater-kde.changes (original) +++ trunk/updater-kde/package/opensuse-updater-kde.changes Tue Feb 26 17:20:36 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue Feb 26 17:07:15 CET 2008 - tgoettlicher@suse.de + +- removed call of zypp-checkpatches-wrapper +- added button to call yast if operation was to complex + +------------------------------------------------------------------- Thu Jan 24 12:54:07 CET 2008 - tgoettlicher@suse.de - Added check for battery state before checking for updates (fate #302960) Modified: trunk/updater-kde/updater/MainWindow.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/MainWindow.cp... ============================================================================== --- trunk/updater-kde/updater/MainWindow.cpp (original) +++ trunk/updater-kde/updater/MainWindow.cpp Tue Feb 26 17:20:36 2008 @@ -344,6 +344,22 @@ *********************************************************************/ +void MainWindow::slotAppletStartYast(const QString &desc) +{ + kdDebug() << "Operation was too complex, description: " << desc << endl; + kdDebug() << "Operation was too complex, description length: " << desc.length() << endl; + applet->setUpdates(0); + applet->setState(APPLET_START_YAST, desc); + + _simple->setRecommendedCount(0); + _simple->setPatchCount(0); + _simple->setPackageCount(0); + _simple->setSecurityCount(0); + _simple->setState(APPLET_START_YAST, desc); + + _check_updates_action->setEnabled(true); +} + void MainWindow::slotAppletError(const QString &desc) { kdDebug() << "Applet error, description: " << desc << endl; @@ -359,7 +375,6 @@ _check_updates_action->setEnabled(true); } - void MainWindow::slotPluginError(const QString &desc) { kdDebug() << "Applet error, description: " << desc << endl; Modified: trunk/updater-kde/updater/MainWindow.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/MainWindow.h?... ============================================================================== --- trunk/updater-kde/updater/MainWindow.h (original) +++ trunk/updater-kde/updater/MainWindow.h Tue Feb 26 17:20:36 2008 @@ -182,6 +182,7 @@ */ void slotAppletError(const QString &desc); void slotPluginError(const QString &desc); + void slotAppletStartYast(const QString &desc); /** Tells the backend to repopulate our list. Modified: trunk/updater-kde/updater/TrayIcon.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/TrayIcon.cpp?... ============================================================================== --- trunk/updater-kde/updater/TrayIcon.cpp (original) +++ trunk/updater-kde/updater/TrayIcon.cpp Tue Feb 26 17:20:36 2008 @@ -83,7 +83,7 @@ QToolTip::add(this, i18n("Checking for updates...")); break; - case APPLET_PROBLEM: + case APPLET_PROBLEM: setPixmap(loadIcon(TRAY_ICON_PROBLEM)); QToolTip::add(this, "<qt>" + i18n("Error:\n") + description + "</qt>" ); break; @@ -129,6 +129,12 @@ setPixmap(loadIcon(TRAY_ICON_UNKNOWN)); break; + case APPLET_START_YAST: + setPixmap(loadIcon(TRAY_ICON_PROBLEM)); + QToolTip::add(this, "<qt>" + i18n("Operation was too complex.") + "</qt>" ); + break; + + } } Modified: trunk/updater-kde/updater/Updater.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/Updater.h?rev... ============================================================================== --- trunk/updater-kde/updater/Updater.h (original) +++ trunk/updater-kde/updater/Updater.h Tue Feb 26 17:20:36 2008 @@ -58,7 +58,8 @@ APPLET_ONLY_OPTIONAL_UPDATES, /** Only optional updates are available (for trayicon) **/ APPLET_NO_NETWORK, /** No Network connection available **/ APPLET_SYSTEM_BUSY, /** System (CPU) is busy**/ - APPLET_SYSTEM_IS_ON_BATTERY /** No power supply is connected **/ + APPLET_SYSTEM_IS_ON_BATTERY, /** No power supply is connected **/ + APPLET_START_YAST /** Operation is too complex, ask for starting yast **/ }; /** @@ -99,6 +100,8 @@ will be refreshed to reflect **/ void updateAppletError( const QString &desc ); + void updateStartYast( const QString &desc ); + // TODO void setProgress(int step, int totalSteps, QString labelText); Modified: trunk/updater-kde/updater/UpdaterApplication.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/UpdaterApplic... ============================================================================== --- trunk/updater-kde/updater/UpdaterApplication.cpp (original) +++ trunk/updater-kde/updater/UpdaterApplication.cpp Tue Feb 26 17:20:36 2008 @@ -53,6 +53,7 @@ connect(_simple, SIGNAL(showDetailView()), _main, SLOT(showMainWindow())); connect(_simple, SIGNAL(startInstall()), _main, SLOT(installButtonClicked())); + connect(_simple, SIGNAL(startCheck()), _main, SLOT(checkUpdatesWithoutProgress())); connect(_simple, SIGNAL(patchSelectRecommended()), _main, SLOT(patchSelectRecommended())); connect(_simple, SIGNAL(patchStandardSelection()), _main, SLOT(patchStandardSelection())); connect(_simple, SIGNAL(patchUnselectRestart()), _main, SLOT(patchUnselectRestart())); @@ -252,6 +253,7 @@ connect(updater, SIGNAL(updateAppletError(const QString &)), _main, SLOT(slotAppletError(const QString &))); + connect(updater, SIGNAL(updateStartYast(const QString &)), _main, SLOT(slotAppletStartYast(const QString &))); //Signal which allows updater "plugins" to force an update refresh connect(updater, SIGNAL(refreshList()), _main, SLOT(checkUpdatesWithoutProgress())); Modified: trunk/updater-kde/updater/simpleview.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/simpleview.cp... ============================================================================== --- trunk/updater-kde/updater/simpleview.cpp (original) +++ trunk/updater-kde/updater/simpleview.cpp Tue Feb 26 17:20:36 2008 @@ -15,6 +15,7 @@ #include <kpushbutton.h> #include <qtimer.h> #include <qtextbrowser.h> +#include <kprocess.h> #include "Updater.h" #include "UpdaterCapabilities.h" @@ -75,15 +76,21 @@ // -------------------- Buttons ------------------------ details = new KPushButton(i18n("Details"),centralWidget); + install = new KPushButton(KStdGuiItem::ok(), centralWidget); - ok = new KPushButton(KStdGuiItem::close(), centralWidget); install->setText(i18n("Install")); + ok = new KPushButton(KStdGuiItem::close(), centralWidget); + + startYast = new KPushButton(centralWidget); + startYast->setText(i18n("Start YaST")); + // -------------------------- layout ----------------------- layout->addWidget(details,6,0); layout->addWidget(install,6,2); + layout->addWidget(startYast,6,2); layout->addWidget(ok,6,3); // -------------------------- connect ----------------------- @@ -91,6 +98,7 @@ connect(details, SIGNAL(clicked()), this, SLOT(slotDetailsButtonClicked())); connect(install, SIGNAL(clicked()), this, SLOT(slotStartInstall())); connect(ok, SIGNAL(clicked()), this, SLOT(hide())); + connect(startYast, SIGNAL(clicked()), this, SLOT(startYastProcess())); connect(recommended, SIGNAL(clicked()), this, SLOT(updateSelection())); connect(norestart, SIGNAL(clicked()), this, SLOT(updateSelection())); @@ -181,6 +189,7 @@ ok->show(); details->hide(); bar->hide(); + startYast->hide(); break; case APPLET_PROBLEM: @@ -197,6 +206,7 @@ ok->show(); details->hide(); bar->hide(); + startYast->hide(); break; case APPLET_NO_UPDATES: @@ -211,6 +221,7 @@ ok->show(); details->hide(); bar->hide(); + startYast->hide(); break; case APPLET_PKGMGR_UPDATES: @@ -229,7 +240,8 @@ details->hide(); ok->show(); bar->hide(); - break; + startYast->hide(); + break; case APPLET_ONLY_OPTIONAL_UPDATES: case APPLET_UPDATES: @@ -270,6 +282,7 @@ details->show(); ok->show(); bar->hide(); + startYast->hide(); if (restartCount > 0) norestart->show(); @@ -307,6 +320,7 @@ details->hide(); bar->show(); textBrowser->hide(); + startYast->hide(); break; case APPLET_UNKNOWN: @@ -320,6 +334,7 @@ details->hide(); bar->hide(); textBrowser->hide(); + startYast->hide(); break; case APPLET_NO_NETWORK: @@ -333,6 +348,7 @@ details->hide(); bar->hide(); textBrowser->hide(); + startYast->hide(); break; case APPLET_SYSTEM_BUSY: @@ -346,6 +362,7 @@ details->hide(); bar->hide(); textBrowser->hide(); + startYast->hide(); break; case APPLET_SYSTEM_IS_ON_BATTERY: @@ -359,7 +376,25 @@ details->hide(); bar->hide(); textBrowser->hide(); + startYast->hide(); + break; + case APPLET_START_YAST: + headline->setText(i18n("<b>Start YaST?</b>")); + recommended->hide(); + title->show(); + textBrowser->hide(); + title->setText("<qt>"+i18n("The operation was too complex.<br>Do you want to start YaST that is able to handle complex updates?")+"</qt>"); + textBrowser->setTextFormat(Qt::RichText); + textBrowser->setMinimumWidth(500); + additionalText->hide(); + norestart->hide(); + install->hide(); + ok->show(); + details->hide(); + bar->hide(); + startYast->show(); + show(); break; @@ -432,4 +467,25 @@ } +void SimpleView::startYastProcess() +{ + + kdDebug() << "starting YaST..." << endl; + KProcess *yast = new KProcess; + *yast << "kdesu" << "-c" << "/sbin/yast2 online_update"; + + connect( yast, SIGNAL( processExited( KProcess * ) ), + SLOT( slotYastExited( KProcess * ) ) ); + yast->start( KProcess::NotifyOnExit ); + + hide(); +} + +void SimpleView::slotYastExited(KProcess* p) +{ + delete p; + emit(startCheck()); +} + + #include "simpleview.moc" Modified: trunk/updater-kde/updater/simpleview.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/simpleview.h?... ============================================================================== --- trunk/updater-kde/updater/simpleview.h (original) +++ trunk/updater-kde/updater/simpleview.h Tue Feb 26 17:20:36 2008 @@ -8,6 +8,7 @@ class MainWindow; class QTextBrowser; +class KProcess; #ifndef SIMPLEVIEW_H #define SIMPLEVIEW_H @@ -30,6 +31,7 @@ KPushButton *install; KPushButton *details; KPushButton *ok; + KPushButton *startYast; QProgressBar *bar; QTextBrowser *textBrowser; @@ -67,10 +69,13 @@ void slotDetailsButtonClicked(); void slotStartInstall(); void updateSelection(); + void slotYastExited(KProcess * p); + void startYastProcess(); signals: void showDetailView(); void startInstall(); + void startCheck(); void patchSelectRecommended(); void patchStandardSelection(); void patchUnselectRestart(); Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpda... ============================================================================== --- trunk/updater-kde/updater/zypp/ZYppUpdater.cpp (original) +++ trunk/updater-kde/updater/zypp/ZYppUpdater.cpp Tue Feb 26 17:20:36 2008 @@ -100,8 +100,8 @@ _process = 0L; - _silent=true; - doCheckForUpdates(); + _silent=true; +// doCheckForUpdates(); emit(showProgress(false)); } @@ -130,9 +130,10 @@ for (unsigned int i=0; i < _warningList.size(); ++i) message += _warningList[i] + "<br>"; - if (!_infoList.isEmpty()) - for (unsigned int i=0; i < _infoList.size(); ++i) - message += _infoList[i] + "<br>"; +// don't show info messages because zypper creates a lot of them +// if (!_infoList.isEmpty()) +// for (unsigned int i=0; i < _infoList.size(); ++i) +// message += _infoList[i] + "<br>"; if (!_errorList.isEmpty()) { @@ -148,9 +149,10 @@ for (unsigned int i=0; i < _warningList.size(); ++i) QMessageBox::warning( NULL, PROGRAM_DISPLAY_NAME, "<qt>" + _warningList[i].utf8() + "</qt>" ); - if (!_infoList.isEmpty()) - for (unsigned int i=0; i < _infoList.size(); ++i) - QMessageBox::information( NULL, PROGRAM_DISPLAY_NAME, "<qt>" + _infoList[i].utf8() + "</qt>"); +// don't show info messages because zypper creates a lot of them +// if (!_infoList.isEmpty()) +// for (unsigned int i=0; i < _infoList.size(); ++i) +// QMessageBox::information( NULL, PROGRAM_DISPLAY_NAME, "<qt>" + _infoList[i].utf8() + "</qt>"); if (!_errorList.isEmpty()) { @@ -163,6 +165,14 @@ } } + if (_startYast) + { + updateStartYast(_errorList.join("\n")); + kdDebug() << "state: startyast" << endl; + err = true; + } + + _warningList.clear(); _infoList.clear(); _errorList.clear(); @@ -257,9 +267,9 @@ } } - if (_noUpdateRepositories) + if (_noUpdateRepositories) emit(updateApplet(APPLET_UNKNOWN, _patchList->childCount(), _packageList->childCount())); - else if (pkgmgr_available) + else if (pkgmgr_available) emit(updateApplet(APPLET_PKGMGR_UPDATES, _patchList->childCount(), _packageList->childCount())); else if (critical_available) emit(updateApplet(APPLET_CRITICAL_UPDATES, _patchList->childCount(), _packageList->childCount())); @@ -323,7 +333,8 @@ _noUpdateRepositories=false; _process = new KProcess; - *_process << "/usr/sbin/zypp-checkpatches-wrapper"; + + *_process << "/usr/bin/zypper" << "--non-interactive" << "--xmlout" << "-q" << "xu"; QObject::connect( _process, SIGNAL( processExited( KProcess * ) ), SLOT( slotProcessExited( KProcess * ) ) ); @@ -333,7 +344,8 @@ SLOT( slotReceivedStderr(KProcess *, char *, int ) ) ); - bool result = _process->start( KProcess::NotifyOnExit, KProcess::AllOutput ); +// bool result = _process->start( KProcess::NotifyOnExit, KProcess::AllOutput ); + bool result = _process->start( KProcess::NotifyOnExit, KProcess::All ); if ( ! result ) { kdDebug() << "error launching zypp-checkpatches-wrapper..." << endl; @@ -382,7 +394,6 @@ if ( _process ) { - // TODO update still running kdDebug() << "Process still running. Will not run this time." << endl; return; } @@ -482,7 +493,8 @@ QObject::connect( _process, SIGNAL( receivedStderr(KProcess *, char *, int ) ), SLOT( slotReceivedStderr(KProcess *, char *, int ) ) ); - bool result = _process->start( KProcess::NotifyOnExit, KProcess::AllOutput ); +// bool result = _process->start( KProcess::NotifyOnExit, KProcess::AllOutput ); + bool result = _process->start( KProcess::NotifyOnExit, KProcess::All ); if ( ! result ) { kdDebug() << "error launching install process..." << endl; @@ -525,6 +537,7 @@ kdDebug() << "start document..." << endl; _found_update_status_tag = false; _error = false; + _startYast = false; _message = false; _resolvables.setAutoDelete(true); _resolvables.clear(); @@ -561,6 +574,63 @@ return true; } + +void ZYppUpdater::handlePrompt(int id) +{ + + char answer = 'n'; + + switch (id) + { + case PROMPT_YN_INST_REMOVE_CONTINUE: + case PROMPT_YN_MEDIA_CHANGE: + case PROMPT_YN_LICENSE_AGREE: + case PROMPT_YN_GPG_UNSIGNED_FILE_ACCEPT: + case PROMPT_YN_GPG_KEY_IMPORT_TRUSTED: + case PROMPT_YN_GPG_UNKNOWN_KEY_ACCEPT: + case PROMPT_YN_GPG_KEY_TRUST: + case PROMPT_YN_GPG_CHECK_FAILED_IGNORE: + case PROMPT_GPG_NO_DIGEST_ACCEPT: + case PROMPT_GPG_UNKNOWN_DIGEST_ACCEPT: + case PROMPT_GPG_WRONG_DIGEST_ACCEPT: + answer='n'; + break; + + case PROMPT_DEP_RESOLVE: + answer='c'; + break; + + case PROMPT_AUTH_USERNAME: + case PROMPT_AUTH_PASSWORD: + answer='n'; //TODO + break; + + case PROMPT_ARI_RPM_DOWNLOAD_PROBLEM: + case PROMPT_ARI_REPO_PROBLEM: + case PROMPT_ARI_RPM_REMOVE_PROBLEM: + case PROMPT_ARI_RPM_INSTALL_PROBLEM: + case PROMPT_ARI_MEDIA_PROBLEM: + answer='a'; + break; + default: + answer='n'; + break; + } + + _writeBuffer= answer ; + _writeBuffer+= '\n'; + + if (_process) + { + kdDebug() << "write: " << _writeBuffer.data() << "." << endl; + _process->writeStdin( _writeBuffer.data(), strlen(_writeBuffer.data() )); + } + + _startYast = true; + +} + + bool ZYppUpdater::startElement( const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts ) { if ( qName == "message") @@ -571,17 +641,18 @@ _state=Warning; else if (atts.value("type") == "info") _state=Info; - } + } + if (qName == "prompt") + { + handlePrompt(atts.value("id").toInt()); + _state=Prompt; + kdDebug() << "found Prompt" << endl; + }; + if (qName == "progress") { _state = Progress; -// if ( atts.value("type") == "done" ) -// emit showProgress(false); -// else -// { -// emit showProgress(true); - emit setProgress( atts.value("value").toInt(), 100, atts.value("name")); -// } + emit setProgress( atts.value("value").toInt(), 100, atts.value("name")); } if( qName == "appletinfo" ) { @@ -650,6 +721,10 @@ { _state = Unknown; } + if ( (qName == "prompt") ) + { + _state = Unknown; + } if ( ( qName == "progress" )) { _state = Unknown; Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpda... ============================================================================== --- trunk/updater-kde/updater/zypp/ZYppUpdater.h (original) +++ trunk/updater-kde/updater/zypp/ZYppUpdater.h Tue Feb 26 17:20:36 2008 @@ -22,6 +22,7 @@ #include "Updater.h" #include <qxml.h> +#include "prompt.h" /** @file @@ -69,6 +70,7 @@ Warning, Info, Progress, + Prompt, } XmlState; class ZYppUpdater : public Updater, public QXmlDefaultHandler @@ -154,7 +156,8 @@ int getNetworkStatus() const; void doCheckForUpdates(); - bool handleMessages(); + bool handleMessages(); + void handlePrompt(int id); KProcess *_process; QString _buffer; @@ -195,8 +198,9 @@ bool _last_xml_parse_code; bool _error; bool _message; - bool _noUpdateRepositories; - bool _silent; + bool _noUpdateRepositories; + bool _silent; + bool _startYast; // QProgressDialog *progressDialog; @@ -206,6 +210,8 @@ // Continous xml parsing QXmlInputSource _xml_source; QXmlSimpleReader _xml_reader; + + QString _writeBuffer; }; #endif Modified: trunk/updater-kde/updater/zypp/zypper_install URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/zypper_i... ============================================================================== --- trunk/updater-kde/updater/zypp/zypper_install (original) +++ trunk/updater-kde/updater/zypp/zypper_install Tue Feb 26 17:20:36 2008 @@ -32,8 +32,8 @@ done -patchcommand="zypper -q --terse --non-interactive in -l -t patch --force --name $patchlist" -packagecommand="zypper -q --terse --non-interactive in -l -t package --force --name $packagelist" +patchcommand="zypper -q --xmlout --non-interactive in -l -t patch --name $patchlist" +packagecommand="zypper -q --xmlout --non-interactive in -l -t package --name $packagelist" tempdir=`mktemp -d /tmp/opensuseupdater.XXXXXXXXXX` if [ $? != 0 ]; @@ -48,6 +48,7 @@ mkfifo $out || { echo "can't mkfifo $out" >&2 ; exit 1 ; } mkfifo $err || { echo "can't mkfifo $err" >&2 ; exit 1 ; } + retval=0 @@ -65,7 +66,8 @@ command="$command ; $packagecommand " fi -kdesu --noignorebutton -d -c "( $command ) > $out 2> $err " + +kdesu --noignorebutton -d -c "( $command ) > $out 2> $err " retval=$? rm -rf ${tempdir} -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org