Author: tgoettlicher
Date: Mon Jul 9 17:41:38 2007
New Revision: 5936
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5936&view=rev
Log:
Added first step for progresspopup when installing updates
Added:
trunk/updater-kde/updater/progresspopup.cpp
trunk/updater-kde/updater/progresspopup.h
Modified:
trunk/updater-kde/updater/CMakeLists.txt
trunk/updater-kde/updater/MainWindow.cpp
trunk/updater-kde/updater/MainWindow.h
trunk/updater-kde/updater/TrayIcon.cpp
trunk/updater-kde/updater/zypp/ZYppUpdater.cpp
trunk/updater-kde/updater/zypp/ZYppUpdater.h
Modified: trunk/updater-kde/updater/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/CMakeLists.txt?rev=5936&r1=5935&r2=5936&view=diff
==============================================================================
--- trunk/updater-kde/updater/CMakeLists.txt (original)
+++ trunk/updater-kde/updater/CMakeLists.txt Mon Jul 9 17:41:38 2007
@@ -21,7 +21,7 @@
########### next target ###############
-SET(opensuseupdater_SRCS main.cpp UpdaterApplication.cpp MainWindow.cpp ConfigWidget.h ConfigWidgetUI.h ConfigWidgetUI.ui )
+SET(opensuseupdater_SRCS progresspopup.cpp progresspopup.h main.cpp UpdaterApplication.cpp MainWindow.cpp ConfigWidget.h ConfigWidgetUI.h ConfigWidgetUI.ui )
KDE3_AUTOMOC(${opensuseupdater_SRCS})
KDE3_ADD_EXECUTABLE(opensuseupdater-kde ${opensuseupdater_SRCS})
TARGET_LINK_LIBRARIES(opensuseupdater-kde opensuseupdater ${QT_AND_KDECORE_LIBS} kdeui kio connectionmanager )
Modified: trunk/updater-kde/updater/MainWindow.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/MainWindow.cpp?rev=5936&r1=5935&r2=5936&view=diff
==============================================================================
--- trunk/updater-kde/updater/MainWindow.cpp (original)
+++ trunk/updater-kde/updater/MainWindow.cpp Mon Jul 9 17:41:38 2007
@@ -51,6 +51,7 @@
#include "UpdateListItem.h"
#include "TrayIcon.h"
#include "ConfigWidget.h"
+#include "progresspopup.h"
@@ -92,6 +93,7 @@
packagesSelected = 0;
popup = new OSUpdaterPopup(applet,this);
+ progressPopup = new ProgressPopup(applet);
hide();
}
@@ -126,12 +128,14 @@
patchLabel->setText(i18n("The following are software patches to fix bugs."));
patchList = new QListView(patchWidget);
patchList->addColumn(i18n("Name"));
- patchList->addColumn(i18n("Summary"));
patchList->setColumnWidthMode(COLUMN_NAME, QListView::Maximum);
+ patchList->addColumn(i18n("Summary"));
patchList->addColumn(i18n("Type"));
patchList->addColumn(i18n("New Version"));
patchList->addColumn(i18n("Catalog"));
- patchList->addColumn("ID", 0); // This is a hidden column to hold the ID of the patch
+ patchList->addColumn(i18n("Size"));
+ patchList->addColumn(i18n("Restart"));
+// patchList->addColumn("ID", 0); // This is a hidden column to hold the ID of the patch
QVBoxLayout *patchBox = new QVBoxLayout(patchWidget);
patchDescription = new KTextEdit(patchWidget);
patchDescription->setReadOnly(true);
@@ -163,9 +167,12 @@
packageList = new QListView(packageWidget);
packageList->addColumn(i18n("Name"));
packageList->setColumnWidthMode(COLUMN_NAME, QListView::Maximum);
+ packageList->addColumn(i18n("Summary"));
packageList->addColumn(i18n("Type"));
packageList->addColumn(i18n("New Version"));
packageList->addColumn(i18n("Catalog"));
+ packageList->addColumn(i18n("Size"));
+ packageList->addColumn(i18n("Restart"));
QVBoxLayout *packageBox = new QVBoxLayout(packageWidget);
packageDescription = new KTextEdit(packageWidget);
packageDescription->setReadOnly(true);
Modified: trunk/updater-kde/updater/MainWindow.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/MainWindow.h?rev=5936&r1=5935&r2=5936&view=diff
==============================================================================
--- trunk/updater-kde/updater/MainWindow.h (original)
+++ trunk/updater-kde/updater/MainWindow.h Mon Jul 9 17:41:38 2007
@@ -23,6 +23,7 @@
#include
#include
#include "UpdaterCapabilities.h"
+#include "progresspopup.h"
#include
@@ -57,13 +58,13 @@
*/
enum {
COLUMN_NAME, /** The Package Name **/
+ COLUMN_SUMMARY, /** Package description **/
COLUMN_TYPE, /** Patch or Package **/
COLUMN_NEW_VERSION, /** The Version We Are Upgrading To **/
COLUMN_CATALOG, /** The Catalog **/
- COLUMN_ID, /** The ID of the Package/Patch **/
COLUMN_DOWNLOADSIZE, /** Download size **/
COLUMN_RESTART, /** Restart needed **/
- COLUMN_SUMMARY, /** Package description **/
+ COLUMN_ID, /** The ID of the Package/Patch **/
};
/**
@@ -272,6 +273,7 @@
//popup
OSUpdaterPopup *popup;
+ ProgressPopup *progressPopup;
UpdaterCapabilities _caps;
Modified: trunk/updater-kde/updater/TrayIcon.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/TrayIcon.cpp?rev=5936&r1=5935&r2=5936&view=diff
==============================================================================
--- trunk/updater-kde/updater/TrayIcon.cpp (original)
+++ trunk/updater-kde/updater/TrayIcon.cpp Mon Jul 9 17:41:38 2007
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
@@ -94,7 +95,8 @@
if (patchCount > 1 && packageCount > 1)
QToolTip::add(this, i18n("%1 Patches and %2 Packages available").arg(patchCount).arg(packageCount));
- break;
+ break;
+
}
}
Added: trunk/updater-kde/updater/progresspopup.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/progresspopup.cpp?rev=5936&view=auto
==============================================================================
--- trunk/updater-kde/updater/progresspopup.cpp (added)
+++ trunk/updater-kde/updater/progresspopup.cpp Mon Jul 9 17:41:38 2007
@@ -0,0 +1,13 @@
+#include "progresspopup.h"
+#include
+
+ProgressPopup::ProgressPopup(QWidget * parent) : KPassivePopup(parent)
+{
+ setTimeout(0);
+ setView("Caption", "Text");
+ show();
+ kdDebug() << "ProgressPopup called" << endl;
+}
+
+
+#include "progresspopup.moc"
Added: trunk/updater-kde/updater/progresspopup.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/progresspopup.h?rev=5936&view=auto
==============================================================================
--- trunk/updater-kde/updater/progresspopup.h (added)
+++ trunk/updater-kde/updater/progresspopup.h Mon Jul 9 17:41:38 2007
@@ -0,0 +1,13 @@
+#include
+
+#ifndef PROGRESSPOPUP_H
+#define PROGRESSPOPUP_H
+
+class ProgressPopup : public KPassivePopup
+{
+ Q_OBJECT
+ public:
+ ProgressPopup(QWidget *parent);
+};
+
+#endif
Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpdater.cpp?rev=5936&r1=5935&r2=5936&view=diff
==============================================================================
--- trunk/updater-kde/updater/zypp/ZYppUpdater.cpp (original)
+++ trunk/updater-kde/updater/zypp/ZYppUpdater.cpp Mon Jul 9 17:41:38 2007
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include
@@ -49,7 +50,7 @@
ZYppUpdater::ZYppUpdater( QObject *parent, const char* name, const QStringList& ) : Updater( parent, name )
, _process(0L)
- , _you_process(0L)
+ , _install_process(0L)
, _state(Unknown)
, _update_counter(0)
, _patchList(0)
@@ -71,10 +72,11 @@
return caps;
}
-void ZYppUpdater::slotYOUProcessExited( KProcess *p )
+void ZYppUpdater::slotInstallProcessExited( KProcess *p )
{
+ kdDebug() << "install process exited." << endl;
delete p;
- _you_process = 0L;
+ _install_process = 0L;
doCheckForUpdates();
}
@@ -134,7 +136,6 @@
kdDebug() << "populating... " << _resolvables.count() << " resolvables" << endl;
for ( QPtrList<ZYppResolvable>::const_iterator it = _resolvables.begin(); it != _resolvables.end(); ++it )
{
-// QListViewItem *newItem;
QCheckListItem *newItem;
if ( (*it)->resolvableType == RESOLVABLE_PATCH)
@@ -147,12 +148,9 @@
newItem->setText(COLUMN_TYPE, (*it)->category );
newItem->setText(COLUMN_NEW_VERSION,(*it)->edition);
newItem->setText(COLUMN_CATALOG, (*it)->source );
-
newItem->setText(COLUMN_DOWNLOADSIZE, QString("%1 MB").arg((*it)->downloadSize));
newItem->setText(COLUMN_RESTART, ((*it)->restart == true ) ? "Yes" : "No" ) ;
- newItem->setText(COLUMN_ID, (*it)->name ) ;
-
}
if ( _patchList->childCount() > 0 )
@@ -177,6 +175,16 @@
_buffer += QString::fromUtf8( buffer, buflen );
}
+void ZYppUpdater::slotInstallReceivedStdout(KProcess *proc, char *buffer, int buflen)
+{
+ kdDebug() << "got text from install helper..." << endl;
+ kdDebug() << buffer << endl;
+}
+
+
+
+
+
void ZYppUpdater::slotReceivedStderr(KProcess *proc, char *buffer, int buflen)
@@ -261,16 +269,17 @@
void ZYppUpdater::startInstall()
{
- QString installList = "";
-
+ QStringList installList;
QCheckListItem *item = (QCheckListItem*)_patchList->firstChild();
+
+ int totalUpdateCount=0;
while (item != NULL)
{
if (item->isOn())
{
- installList += " ";
installList += item->text();
+ totalUpdateCount++;
}
item = (QCheckListItem*)item->nextSibling();
}
@@ -281,17 +290,56 @@
{
if (item->isOn())
{
- installList += " ";
installList += item->text();
+ totalUpdateCount++;
}
item = (QCheckListItem*)item->nextSibling();
}
- kdDebug() << "Install: " << installList << endl;
+/*
+ progressDialog = new QProgressDialog("LabelText", "cancel", totalUpdateCount, 0 , 0 , false, 0 );
+ progressDialog->setMinimumDuration(0);
+ progressDialog->setProgress(1);
+*/
+
+ if ( _install_process ) {
+ // TODO update still running
+ kdDebug() << "Update process still running. Will not run this time." << endl;
+ return;
+ }
+
+ _install_process = new KProcess;
+
+ // *_install_process << "/tmp/zypp-install " + installList;
+ *_install_process << "/tmp/zypp-install" << installList;
+
+ 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 ) ) );
+
+
+ bool result = _install_process->start( KProcess::NotifyOnExit, KProcess::AllOutput );
+ if ( ! result )
+ {
+ kdDebug() << "error launching install process..." << endl;
+ emit(updateAppletError(i18n("Can't launch install helper program. Make sure zypper package is installed and working.")));
+ delete _install_process;
+ _install_process = 0L;
+ emit(populateDone());
+ return;
+ }
+
+ kdDebug() << "install process started.." << endl;
+ emit(updateApplet(APPLET_CHECKING, 0, 0)); // TODO
}
+
+
void ZYppUpdater::configureUpdater()
{
kdDebug() << "configure updater" << endl;
Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpdater.h?rev=5936&r1=5935&r2=5936&view=diff
==============================================================================
--- trunk/updater-kde/updater/zypp/ZYppUpdater.h (original)
+++ trunk/updater-kde/updater/zypp/ZYppUpdater.h Mon Jul 9 17:41:38 2007
@@ -22,6 +22,7 @@
#include "Updater.h"
#include
+#include
/**
@file
@@ -131,13 +132,18 @@
protected slots:
- void slotYOUProcessExited( KProcess * );
void slotInstSourceProcessExited( KProcess * );
void showLog();
void slotProcessExited( KProcess *proc );
void slotReceivedStdout(KProcess *proc, char *buffer, int buflen);
void slotReceivedStderr(KProcess *proc, char *buffer, int buflen);
+
+ void slotInstallProcessExited( KProcess * );
+ void slotInstallReceivedStdout(KProcess *, char *, int ) ;
+// void slotInstallReceivedStderr(KProcess *, char *, int ) ;
+
+
private:
@@ -151,7 +157,7 @@
QString _stderr_buffer;
QString _error_message_buffer;
- KProcess *_you_process;
+ KProcess *_install_process;
// parsed data, cleared between calls
// to checkpatches
@@ -177,6 +183,9 @@
bool _found_update_status_tag;
bool _end_document_reached;
bool _error;
+
+ QProgressDialog *progressDialog;
+
};
#endif
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org