Author: tgoettlicher Date: Fri Jul 20 16:14:11 2007 New Revision: 6129 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6129&view=rev Log: Add sudo to zypper for call of zypper Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.cpp trunk/updater-kde/updater/zypp/ZYppUpdater.h Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpdater.cpp?rev=6129&r1=6128&r2=6129&view=diff ============================================================================== --- trunk/updater-kde/updater/zypp/ZYppUpdater.cpp (original) +++ trunk/updater-kde/updater/zypp/ZYppUpdater.cpp Fri Jul 20 16:14:11 2007 @@ -78,10 +78,22 @@ void ZYppUpdater::slotInstallProcessExited( KProcess *p ) { kdDebug() << "install process exited." << endl; - delete p; - _install_process = 0L; emit(showProgress(false)); - doCheckForUpdates(); + + if (p->exitStatus() == 0) + { + _install_stderr_buffer.truncate(0); + _install_stdout_buffer.truncate(0); + delete p; + _install_process = 0L; + doCheckForUpdates(); + } + else + { + updateAppletError( i18n("helper program returned:\n%1").arg(_install_stderr_buffer) ); + delete p; + _install_process = 0L; + } } void ZYppUpdater::slotInstSourceProcessExited( KProcess *p ) @@ -181,9 +193,25 @@ void ZYppUpdater::slotInstallReceivedStdout(KProcess *proc, char *buffer, int buflen) { + // We show the progress popup casue we have got the first answer from install process. + if (_install_stdout_buffer.isEmpty()) + emit(showProgress(true)); + + emit(setProgressNextStep(buffer)); + kdDebug() << "got text from install helper..." << endl; kdDebug() << buffer << endl; - emit(setProgressNextStep(buffer)); + + _install_stdout_buffer += QString::fromUtf8( buffer, buflen ); + +} + +void ZYppUpdater::slotInstallReceivedStderr(KProcess *proc, char *buffer, int buflen) +{ + kdDebug() << "got stderror from install helper..." << endl; + kdDebug() << buffer << endl; + + _install_stderr_buffer += QString::fromUtf8( buffer, buflen ); } @@ -364,14 +392,17 @@ _install_process = new KProcess; - *_install_process << "/tmp/zypper_dummy" << installList; +// *_install_process << "kdesu" << "-t" << "-c" << "/tmp/zypper_dummy " + installList.join(" "); +// *_install_process << "gnomesu" << "-c" << "/tmp/zypper_dummy " + installList.join(" "); + *_install_process << "gnomesu" << "-c" << "/tmp/zypper_dummy " + installList.join(" "); + QObject::connect( _install_process, SIGNAL( processExited( KProcess * ) ), SLOT( slotInstallProcessExited( KProcess * ) ) ); QObject::connect( _install_process, SIGNAL( receivedStdout(KProcess *, char *, int ) ), SLOT( slotInstallReceivedStdout(KProcess *, char *, int ) ) ); -// QObject::connect( _install_process, SIGNAL( receivedStderr(KProcess *, char *, int ) ), -// SLOT( slotInstallReceivedStderr(KProcess *, char *, int ) ) ); + QObject::connect( _install_process, SIGNAL( receivedStderr(KProcess *, char *, int ) ), + SLOT( slotInstallReceivedStderr(KProcess *, char *, int ) ) ); bool result = _install_process->start( KProcess::NotifyOnExit, KProcess::AllOutput ); @@ -388,7 +419,6 @@ kdDebug() << "install process started.." << endl; emit(updateApplet(APPLET_INSTALLING, 0, 0)); emit(setProgress(0, totalUpdateCount, "")); - emit(showProgress(true)); } Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpdater.h?rev=6129&r1=6128&r2=6129&view=diff ============================================================================== --- trunk/updater-kde/updater/zypp/ZYppUpdater.h (original) +++ trunk/updater-kde/updater/zypp/ZYppUpdater.h Fri Jul 20 16:14:11 2007 @@ -143,7 +143,7 @@ void slotInstallProcessExited( KProcess * ); void slotInstallReceivedStdout(KProcess *, char *, int ) ; -// void slotInstallReceivedStderr(KProcess *, char *, int ) ; + void slotInstallReceivedStderr(KProcess *, char *, int ) ; @@ -160,6 +160,8 @@ QString _error_message_buffer; KProcess *_install_process; + QString _install_stderr_buffer; + QString _install_stdout_buffer; // parsed data, cleared between calls // to checkpatches @@ -179,6 +181,7 @@ ZYppResolvable *_current_resolvable; int _update_counter; + int totalUpdateCount; QListView *_patchList; QListView *_packageList; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org