Author: tgoettlicher Date: Thu Jul 5 17:39:22 2007 New Revision: 5894 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5894&view=rev Log: Enabled Zypp-Plugin to handle Packages Modified: trunk/updater-kde/updater/CMakeLists.txt trunk/updater-kde/updater/zypp/ZYppListItem.cpp trunk/updater-kde/updater/zypp/ZYppListItem.h 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.tx... ============================================================================== --- trunk/updater-kde/updater/CMakeLists.txt (original) +++ trunk/updater-kde/updater/CMakeLists.txt Thu Jul 5 17:39:22 2007 @@ -1,5 +1,5 @@ #ADD_SUBDIRECTORY( zmd ) -#ADD_SUBDIRECTORY( zypp ) +ADD_SUBDIRECTORY( zypp ) ADD_SUBDIRECTORY( dummy ) ADD_SUBDIRECTORY( dummy_with_packages ) Modified: trunk/updater-kde/updater/zypp/ZYppListItem.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppList... ============================================================================== --- trunk/updater-kde/updater/zypp/ZYppListItem.cpp (original) +++ trunk/updater-kde/updater/zypp/ZYppListItem.cpp Thu Jul 5 17:39:22 2007 @@ -19,13 +19,13 @@ #include "ZYppListItem.h" -ZYppListItem::ZYppListItem( ZYppPatch *patch, QListView *parent, const QString &text ) +ZYppListItem::ZYppListItem( ZYppResolvable *patch, QListView *parent, const QString &text ) : QListViewItem(parent, text ) , _patch(patch) { } -ZYppPatch * ZYppListItem::patch() const +ZYppResolvable * ZYppListItem::patch() const { return _patch; } Modified: trunk/updater-kde/updater/zypp/ZYppListItem.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppList... ============================================================================== --- trunk/updater-kde/updater/zypp/ZYppListItem.h (original) +++ trunk/updater-kde/updater/zypp/ZYppListItem.h Thu Jul 5 17:39:22 2007 @@ -40,11 +40,11 @@ public: - ZYppListItem( ZYppPatch *, QListView *, const QString& ); - ZYppPatch * patch() const; + ZYppListItem( ZYppResolvable *, QListView *, const QString& ); + ZYppResolvable * patch() const; private: - ZYppPatch *_patch; + ZYppResolvable *_patch; }; #endif 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 Thu Jul 5 17:39:22 2007 @@ -70,7 +70,8 @@ , _you_process(0L) , _state(Unknown) , _update_counter(0) - , _list_view(0) + , _patchList(0) + , _packageList(0) , _found_update_status_tag(false) , _end_document_reached(false) , _error(false) @@ -82,13 +83,13 @@ kdDebug() << "ZyppUpdater plugin loaded" << endl; kdDebug() << "Initializing zypp backend" << endl; -// doCheckForUpdates(); } UpdaterCapabilities ZYppUpdater::capabilities() { UpdaterCapabilities caps; caps.canSelectIndividualUpdates = false; + caps.canProvidePackages = true; return caps; } @@ -142,21 +143,24 @@ _stderr_buffer.truncate(0); _buffer.truncate(0); - if ( ! _list_view ) + if ( ! _patchList || !_packageList ) { - kdDebug() << " ! _list_view " << endl; + kdDebug() << " ! _patchList || ! _packageList " << endl; return; } - _list_view->clear(); + _patchList->clear(); + _packageList->clear(); + +// TODO kdDebug() << "populating... " << _patches.count() << " patches" << endl; - for ( QPtrList<ZYppPatch>::const_iterator it = _patches.begin(); it != _patches.end(); ++it ) + for ( QPtrList<ZYppResolvable>::const_iterator it = _patches.begin(); it != _patches.end(); ++it ) { if ( (*it)->category != "optional" ) { QListViewItem *newItem; - newItem = new ZYppListItem( (*it), _list_view, (*it)->summary ); + newItem = new ZYppListItem( (*it), _patchList, (*it)->summary ); newItem->setText(COLUMN_TYPE, ((*it)->category == "security") ? i18n("Security") : i18n("Patch") ); newItem->setText(COLUMN_NEW_VERSION,(*it)->edition); @@ -164,17 +168,12 @@ newItem->setText(COLUMN_CATALOG, (*it)->source ); } } - + + // TODO if ( _patches.count() > 0 ) - { - emit(updateApplet(APPLET_UPDATES, _patches.count())); - emit(installAllowed(true)); - } + emit(updateApplet(APPLET_UPDATES, _patches.count(), _patches.count())); else - { - emit(updateApplet(APPLET_NO_UPDATES, 0)); - emit(installAllowed(false)); - } + emit(updateApplet(APPLET_NO_UPDATES, 0, 0)); if ( _error ) { @@ -182,14 +181,13 @@ _error_message_buffer.truncate(0); } -// _list_view = 0L; emit(populateDone()); } void ZYppUpdater::slotReceivedStdout(KProcess *proc, char *buffer, int buflen) { kdDebug() << "got..." << endl; - // add stdout to a buffer# + // add stdout to a buffer // we can parse it when process finishes _buffer += QString::fromUtf8( buffer, buflen ); } @@ -212,13 +210,13 @@ if ( _process ) { kdDebug() << "Check process still running. Will not run this time." << endl; - emit(updateApplet(APPLET_CHECKING, 0)); + emit(updateApplet(APPLET_CHECKING, 0, 0)); return; } _process = new KProcess; - *_process << "/usr/sbin/zypp-checkpatches-wrapper"; + *_process << "/tmp/zypp-checkpatches-wrapper"; QObject::connect( _process, SIGNAL( processExited( KProcess * ) ), SLOT( slotProcessExited( KProcess * ) ) ); @@ -241,59 +239,41 @@ } kdDebug() << "check process started.." << endl; - emit(updateApplet(APPLET_CHECKING, 0)); + emit(updateApplet(APPLET_CHECKING, 0, 0)); //mStatusLabel->setText( i18n("Checking...") ); } -void ZYppUpdater::populateUpdateList(QListView *updateList) +void ZYppUpdater::populateLists(QListView *patchList, QListView *packageList ) { kdDebug() << "got populate UI request..." << endl; - _list_view = updateList; - emit(updateApplet(APPLET_NO_UPDATES, 0)); + _patchList = patchList; + _packageList = packageList; + emit(updateApplet(APPLET_NO_UPDATES, 0, 0)); doCheckForUpdates(); } -void ZYppUpdater::updateSelected(QListViewItem *item) + + +void ZYppUpdater::resolvableSelected(QListViewItem *item, int resolvableType) { + // retrieve description kdDebug() << "updating item" << endl; - ZYppListItem *zi = dynamic_cast<ZYppListItem *>(item); - if ( zi ) - { - ZYppPatch *patch = zi->patch(); - emit(returnDescription(patch->description)); - } - -} - -void ZYppUpdater::updateMenu(QListViewItem *item, const QPoint& point) -{ -// if (item != NULL && tempList != NULL) -// { -// QPopupMenu *menu = new QPopupMenu(tempList); -// if (item->text(COLUMN_LOCK) == "") { -// menu->insertItem(i18n("Hold Back Package"), this, SLOT(holdPackage())); -// } else { -// menu->insertItem(i18n("Don't Hold Back Package"), this, SLOT(removeHold())); -// } -// menu->popup(point); -// } + if (resolvableType == RESOLVABLE_PATCH) + { + //TODO + ZYppListItem *zi = dynamic_cast<ZYppListItem *>(item); + if ( zi ) + { + ZYppResolvable *patch = zi->patch(); + emit(returnDescription(patch->description, RESOLVABLE_PATCH)); + } + } + else + //TODO + emit(returnDescription("This package does nothing.", RESOLVABLE_PACKAGE)); } -/***************************************************************************** - These are all noops because we do not support - package holds yet -*****************************************************************************/ -// void ZYppUpdater::holdPackage() -// { -// } -// -// void ZYppUpdater::removeHold() -// { -// } -/****************************************************************************** -******************************************************************************/ - void ZYppUpdater::startInstall() { if ( _you_process != 0L ) @@ -310,10 +290,6 @@ _you_process->start( KProcess::NotifyOnExit ); } -// void ZYppUpdater::startRefresh() -// { -// //emit(refreshList()); -// } void ZYppUpdater::configureUpdater() { @@ -344,11 +320,11 @@ { if ( _state == UpdateDescription ) { - _current_patch->description += ch; + _current_resolvable->description += ch; } if ( _state == UpdateSummary ) { - _current_patch->summary += ch; + _current_resolvable->summary += ch; } if ( _state == Error ) { @@ -380,11 +356,19 @@ } if ( qName == "update" ) { + //TODO kdDebug() << "found patch..." << qName << endl; - _current_patch = new ZYppPatch(); - _current_patch->name = atts.value("name"); - _current_patch->category = atts.value("category"); - _current_patch->edition = atts.value("edition"); + _current_resolvable = new ZYppResolvable(); + _current_resolvable->name = atts.value("name"); + _current_resolvable->category = atts.value("category"); + _current_resolvable->edition = atts.value("edition"); + _current_resolvable->downloadSize= atoi (atts.value("downloadsize")); + _current_resolvable->resolvableType= + ( atts.value("resolvabletype") == "patch" ? RESOLVABLE_PATCH : RESOLVABLE_PACKAGE ); + _current_resolvable->restart=atts.value("restart"); + _current_resolvable->pkgmanager=atts.value("pkgmanager"); + _current_resolvable->interactive=atts.value("interactive"); + _state = Update; // ignore sources for now @@ -405,7 +389,7 @@ { if ( _state == Update ) { - _current_patch->source = atts.value("alias"); + _current_resolvable->source = atts.value("alias"); } else { @@ -463,12 +447,12 @@ if ( qName == "update" ) { _state = Unknown; - kdDebug() << _current_patch->name << " appended" << endl; - _patches.append(_current_patch); + kdDebug() << _current_resolvable->name << " appended" << endl; + _patches.append(_current_resolvable); // ignore sources for now - kdDebug() << _current_patch->name << endl; - kdDebug() << _current_patch->summary << endl; + kdDebug() << _current_resolvable->name << endl; + kdDebug() << _current_resolvable->summary << endl; return true; } 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 Thu Jul 5 17:39:22 2007 @@ -30,11 +30,12 @@ @author Martin Vidner <mvidner@novell.com> @author Duncan Mac-Vicar <dmacvicar@novell.com> + @author Thomas Goettlicher <tgoettlicher@novell.com> */ class KProcess; -struct ZYppPatch +struct ZYppResolvable { QString category; QString name; @@ -42,6 +43,11 @@ QString source; QString summary; QString description; + int downloadSize; // MegaByte + bool restart; // needs system restart + bool pkgmanager; // affects package manager + bool interactive; // needs user interaction + int resolvableType; // RESOLVABLE_PATCH or RESOLVABLE_PACKAGE }; struct ZYppSource @@ -97,7 +103,7 @@ @param updateList the list on the main window */ - void populateUpdateList(QListView* updateList); + void populateLists(QListView* patchList, QListView* packageList); /** Slot which gets called when the user selects an update. @@ -106,7 +112,7 @@ @param item the update itself */ - void updateSelected(QListViewItem* item); + void resolvableSelected(QListViewItem* item, int); /** Slot which gets called when the user right clicks an update. @@ -149,7 +155,7 @@ // parsed data, cleared between calls // to checkpatches - QPtrList<ZYppPatch> _patches; + QPtrList<ZYppResolvable> _patches; QValueList<ZYppSource> _sources; ZYppSource _current_source; @@ -162,11 +168,12 @@ QListViewItem *currentUpdate; //Holds the descript for the currently selected update - ZYppPatch *_current_patch; + ZYppResolvable *_current_resolvable; int _update_counter; - QListView *_list_view; + QListView *_patchList; + QListView *_packageList; bool _found_update_status_tag; bool _end_document_reached; bool _error; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org