Author: dmacvicar
Date: Mon May 23 21:27:16 2011
New Revision: 64090
URL: http://svn.opensuse.org/viewcvs/yast?rev=64090&view=rev
Log:
Port to Code11 libzypp.
TODO: PkgTable class, updateInfo method commented.
Search progress popup commented.
Added:
branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgStrings.h
Modified:
branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.cc
branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.h
branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupDeps.cc
branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupPkgTable.cc
branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupSelection.cc
branches/tmp/dmacvicar/zc10/ncurses/src/ObjectStatStrategy.cc
branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.cc
branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.h
branches/tmp/dmacvicar/zc10/ncurses/src/YNCursesUI.cc
branches/tmp/dmacvicar/zc10/ncurses/src/YQZypp.h
Added: branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgStrings.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgStrings.h?rev=64090&view=auto
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgStrings.h (added)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgStrings.h Mon May 23 21:27:16 2011
@@ -0,0 +1,317 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCPkgStrings.h
+
+ Author: Gabriele Strattner
+
+/-*/
+#ifndef NCPkgStrings_h
+#define NCPkgStrings_h
+
+#include "NCstring.h"
+#include <string>
+
+
+
+// Class to make available globally used names in package selection dialog,
+// such as widget ids, text which has to be translated and so on
+
+class NCPkgStrings
+{
+public:
+
+ // Main menu entry Dependencies
+ static const string Deps();
+
+ // Main menu entry View
+ static const string View();
+
+ // Main menu entry 'Extras'
+ static const string Extras();
+
+ //Package Filters combo box label
+ static const string Filter();
+
+ static const string InstPkg();
+
+ //Label below the table - pkg name follows
+ static const string PackageName();
+
+ //Actions menu (what to do with the pkg)
+ static const string Actions();
+
+ static const string Help();
+
+ // The headline of the help popup
+ static const string PackageHelp();
+
+ //strings in 'General Help'
+ static const string HelpPkgGen1();
+ static const string HelpPkgGen2();
+ static const string HelpPkgGen3();
+ static const string HelpPkgGen4();
+ static const string HelpPkgGen5();
+ static const string HelpPkgGen6();
+
+ // The headline of the help popup
+ static const string PackageStatusHelp();
+
+ //strings in 'Package Status and symbols'
+ static const string HelpOnStatus1();
+ static const string HelpOnStatus2();
+ static const string HelpOnStatus3();
+ static const string HelpOnStatus4();
+ static const string HelpOnStatus5();
+
+ // The headline of the help popup
+ static const string PackageFiltersHelp();
+
+ //string in 'How to use filters'
+ static const string HelpOnFilters1();
+ static const string HelpOnFilters2();
+ static const string HelpOnFilters3();
+ static const string HelpOnFilters4();
+ static const string HelpOnFilters5();
+
+ // The headline of the help popup
+ static const string PackageMenuHelp();
+
+ // strings in 'Useful functions in menu'
+ static const string HelpPkgMenu1();
+ static const string HelpPkgMenu2();
+ static const string HelpPkgMenu2_2();
+ static const string HelpPkgMenu3();
+ static const string HelpPkgMenu4();
+ static const string HelpPkgMenu5();
+
+ //Search settings
+ static const string SearchIn();
+ static const string SearchPhrase();
+
+ // table column headlines
+ static const string PkgStatus();
+ static const string PatternsLabel();
+ static const string LangCode();
+ static const string LangName();
+ static const string RepoURL();
+ static const string PkgName();
+ static const string PkgSummary();
+ static const string PkgVersion();
+ static const string PkgInstSource();
+ static const string PkgVersionNew();
+ static const string PkgVersionInst();
+ static const string PkgSize();
+ static const string PkgArch();
+ static const string PkgSource();
+ static const string PatchKind();
+
+ //Useful busy popups
+ static const string Solving();
+ static const string Saving();
+ static const string Loading();
+
+ /**
+ * The headline of the disk space popup
+ */
+ static const string DiskspaceLabel();
+
+ //column headers, diskspace table
+ static const string Partition();
+ static const string UsedSpace();
+ static const string FreeSpace();
+ static const string TotalSpace();
+ /**
+ * The headline of the disk space popup
+ */
+ static const string DiskSpaceError();
+ static const string DiskSpaceWarning();
+ static const string MoreText();
+ static const string MoreSpaceText();
+
+ /**
+ * bold text Version: (richtext)
+ */
+ static const string Version();
+
+ /**
+ * bold text Installed version: (richtext)
+ */
+ static const string InstVersion();
+
+ /**
+ * bold text License: (richtext)
+ */
+ static const string License();
+
+ /**
+ * bold text Media No.: (richtext)
+ */
+ static const string MediaNo();
+
+ /**
+ * bold text Size: (richtext)
+ */
+ static const string Size();
+
+ /**
+ * bold text Package Group: (richtext)
+ */
+ static const string RpmGroup();
+
+ /**
+ * bold text Authors: (richtext)
+ */
+ static const string Authors();
+
+ /**
+ * bold text Provides: (richtext)
+ */
+ static const string Provides();
+
+ /**
+ * bold text Requires: (richtext)
+ */
+ static const string Requires();
+
+ /**
+ * bold text Required by: (richtext)
+ */
+ static const string PreRequires();
+
+ /**
+ * bold text Conflicts with: (richtext)
+ */
+ static const string Conflicts();
+
+ static const string ListOfFiles();
+ static const string LanguageDescription();
+ /**
+ * text used for automatic changes popup
+ */
+ static const string AutoChangeLabel();
+ static const string AutoChangeText1();
+ static const string AutoChangeText2();
+
+ /**
+ * The headline of the help YOU popup
+ */
+ static const string YouHelp();
+
+ /**
+ * help text package status
+ */
+ static const string YouHelp1();
+ static const string YouHelp2();
+ static const string YouHelp3();
+
+ static const string WarningLabel();
+ static const string ErrorLabel();
+ static const string NotifyLabel();
+
+ /**
+ * The label of the OK button
+ */
+ static const string OKLabel();
+
+ /**
+ * The label of the Cancel button
+ */
+ static const string CancelLabel();
+
+ /**
+ * The label of the Yes button
+ */
+ static const string YesLabel();
+
+ /**
+ * The label of the Accept button
+ */
+ static const string AcceptLabel();
+
+ /**
+ * The label of the No button
+ */
+ static const string NoLabel();
+
+ /**
+ * The label of the Solve button
+ */
+ static const string SolveLabel();
+
+
+ static const string CancelText();
+ /**
+ * The label of the language selections popup
+ */
+ static const string LanguageLabel();
+
+ /**
+ * The label of the repositories selections popup
+ */
+ static const string RepoLabel();
+
+ /**
+ * The label Filter: YOU Patches
+ */
+ static const string YOUPatches();
+ static const string InstPatches();
+ static const string Patches();
+
+ /**
+ * The label for Filter: Search results
+ */
+ static const string SearchResults();
+
+ /**
+ * The label for Filter: Update problem
+ */
+ static const string UpdateProblem();
+
+ /**
+ * The headline of the dependency popup
+ */
+ static const string PackageDeps();
+
+ static const string HelpOnUpdate();
+
+ /**
+ * bold text Patch: (richtext)
+ */
+ static const string Patch();
+
+ /**
+ * Info line in empty patch list
+ */
+ static const string NoPatches();
+
+ static const string MenuList();
+ static const string Script();
+
+
+
+private:
+
+ // Need no object of this class: hide default constructor
+ NCPkgStrings();
+
+ static int do_something(){ return 0; }
+
+};
+
+
+///////////////////////////////////////////////////////////////////
+
+#endif // NCPkgStrings_h
+
+
+
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.cc?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.cc (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.cc Mon May 23 21:27:16 2011
@@ -91,10 +91,10 @@
case S_AutoDel: // Will be automatically deleted
return " a- ";
case S_AutoUpdate: // Will be automatically updated
- return " a> ";
- case S_Taboo: // Never install this
+ return " a> ";
+ case S_Taboo: // Never install this
return " ---";
- case S_Protected: // always keep installed version
+ case S_Protected: // always keep installed version
return " -i-";
default:
return "####";
@@ -119,7 +119,7 @@
, haveInstalledVersion ( false )
{
fillHeader();
-
+
WIDDBG << endl;
}
@@ -154,7 +154,7 @@
ZyppSel slbPtr )
{
vector Items( elements.size()+1, 0 );
-
+
// fill first column (containing the status information and the package pointers)
Items[0] = new NCPkgTableTag( objPtr, slbPtr, stat );
@@ -163,9 +163,9 @@
Items[i] = new NCTableCol( YCPString( elements[i-1] ) );
}
myPad()->Append( Items );
-
+
// don't call DrawPad(); for every line - is called once after the loop
-
+
}
///////////////////////////////////////////////////////////////////
@@ -178,7 +178,7 @@
//
void NCPkgTable::itemsCleared()
{
- return NCTable::itemsCleared();
+ return NCTable::itemsCleared();
}
@@ -213,8 +213,8 @@
if ( !packager || !slbPtr )
return false;
- zypp::Text notify;
- zypp::License license;
+ std::string notify;
+ std::string license;
bool license_confirmed = true;
ZyppPkg pkgPtr = NULL;
YCPString header( "" );
@@ -235,7 +235,7 @@
case S_Install:
case S_Update:
if ( objPtr )
- {
+ {
notify = objPtr->insnotify();
NCDBG << "NOTIFY message: " << notify << endl;
header = YCPString(PkgNames::NotifyLabel());
@@ -277,7 +277,7 @@
case S_AutoInstall:
newstatus = S_Taboo;
break;
-
+
case S_Update:
case S_AutoUpdate:
newstatus = S_Protected;
@@ -286,7 +286,7 @@
default:
break;
}
-
+
ok = false;
} else {
NCMIL << "User confirmed license agreement for " << pkgName << endl;
@@ -301,10 +301,10 @@
YCPString( "<i>" + pkgName + "</i><br><br>" + packager->createDescrText( notify ) ) );
info.showInfoPopup( );
}
-
+
// inform the package manager
ok = statusStrategy->setObjectStatus( newstatus, slbPtr, objPtr );
-
+
if ( ok && singleChange )
{
switch ( tableType )
@@ -322,22 +322,22 @@
// don't show diskspace (type T_Availables is also used in YOU mode)
break;
case T_Selections:
- // check/show dependencies of selections
+ // check/show dependencies of selections
packager->showSelectionDependencies();
packager->showDiskSpace();
break;
-
+
case T_Patches:
// show the download size for all selected patches
packager->showDownloadSize();
break;
-
+
default:
break;
}
// update this list to show the status changes
updateTable();
-
+
if ( tableType == T_Availables )
{
// additionally update the package list
@@ -364,7 +364,7 @@
while ( index < size )
{
- // get the table line
+ // get the table line
NCTableLine * cl = myPad()->ModifyLine( index );
if ( !cl )
{
@@ -383,7 +383,7 @@
ret = false;
break;
}
-
+
ZyppStatus newstatus = S_NoInst;
if ( slbPtr && objPtr)
{
@@ -399,7 +399,7 @@
{
// get the new status and replace old status
newstatus = statusStrategy->getPackageStatus( slbPtr, objPtr );
-
+
// set new status (if status has changed)
if ( getStatus(index) != newstatus )
{
@@ -429,7 +429,7 @@
case T_Patches: {
packager->fillPatchList( "installable" ); // default: installable patches
- // set the visible info to long description
+ // set the visible info to long description
packager->setVisibleInfo ( PkgNames::PatchDescr() );
// show the package description of the current item
showInformation ();
@@ -439,7 +439,7 @@
if ( ! zypp::getZYpp()->resolver()->problematicUpdateItems().empty() )
{
packager->fillUpdateList();
- // set the visible info to package description
+ // set the visible info to package description
packager->setVisibleInfo ( PkgNames::PkgInfo() );
// show the package description of the current item
showInformation ();
@@ -453,8 +453,8 @@
{
packager->fillPackageList ( YCPString( defaultGroup->value().translation()),
defaultGroup );
-
- // set the visible info to package description
+
+ // set the visible info to package description
packager->setVisibleInfo ( PkgNames::PkgInfo() );
// show the package description of the current item
showInformation ();
@@ -487,7 +487,7 @@
//
// fillHeader
//
-// Fillup the column headers of the package table
+// Fillup the column headers of the package table
//
void NCPkgTable::fillHeader( )
{
@@ -584,14 +584,14 @@
NCERR << "No valid package available" << endl;
return false;
}
-
+
// add the package name
- pkgLine.push_back( slbPtr->name() );
+ pkgLine.push_back( slbPtr->name() );
string instVersion = "";
string version = "";
ZyppStatus status;
-
+
switch( tableType )
{
case T_PatchPkgs: {
@@ -599,7 +599,7 @@
{
instVersion = slbPtr->installedObj()->edition().asString();
}
-
+
// in case of YOU patches: show the version of the package which
// is contained in the patch
version = pkgPtr->edition().asString();
@@ -611,10 +611,10 @@
pkgLine.push_back( instVersion );
pkgLine.push_back( pkgPtr->summary() ); // short description
-
+
status = slbPtr->status(); // the package status
NCMIL << "Status of " << slbPtr->name() << ": " << status << endl;
- zypp::ByteCount size = pkgPtr->size(); // installed size
+ zypp::ByteCount size = pkgPtr->installSize(); // installed size
pkgLine.push_back( size.asString( 8 ) ); // format size
break;
@@ -624,11 +624,11 @@
if ( pkgPtr == slbPtr->candidateObj() )
isCandidate = " x ";
pkgLine.push_back( isCandidate );
-
+
version = pkgPtr->edition().asString();
pkgLine.push_back( version );
// is alias the right string? id?
- pkgLine.push_back( pkgPtr->source().alias() ); // show the installation source
+ pkgLine.push_back( pkgPtr->repoInfo().alias() ); // show the installation source
// set package status either to S_NoInst or S_KeepInstalled
status = S_NoInst;
@@ -640,17 +640,17 @@
status = S_KeepInstalled;
}
}
-
- zypp::ByteCount size = pkgPtr->size(); // installed size
+
+ zypp::ByteCount size = pkgPtr->installSize(); // installed size
pkgLine.push_back( size.asString( 8 ) ); // format size
pkgLine.push_back( pkgPtr->arch().asString()); // architecture
-
+
break;
}
default: {
// version() was edition.version. but what about edition.release?
- // if the package is installed, get the installed version
+ // if the package is installed, get the installed version
if ( slbPtr->hasInstalledObj() )
{
instVersion = slbPtr->installedObj()->edition().version();
@@ -672,26 +672,26 @@
pkgLine.push_back( instVersion ); // installed version
}
pkgLine.push_back( pkgPtr->summary() ); // short description
-
+
status = slbPtr->status(); // the package status
- zypp::ByteCount size = pkgPtr->size(); // installed size
+ zypp::ByteCount size = pkgPtr->installSize(); // installed size
pkgLine.push_back( size.asString( 8 ) ); // format size
// Selectable does not have source_install
#ifdef FIXME
if ( slbPtr->source_install() )
{
- pkgLine.push_back( " x " );
+ pkgLine.push_back( " x " );
}
else
#endif
{
- pkgLine.push_back( " " );
+ pkgLine.push_back( " " );
}
}
}
-
+
addLine( status, // the package status
pkgLine, // the package data
pkgPtr, // the corresponding package pointer
@@ -716,7 +716,7 @@
pkgLine,
ZyppObj(),
ZyppSel()); // null pointer
-
+
return true;
}
@@ -729,7 +729,7 @@
{
vector<string> pkgLine;
pkgLine.reserve(5);
-
+
if ( !patchPtr || !selectable )
{
NCERR << "No valid patch available" << endl;
@@ -737,19 +737,19 @@
}
pkgLine.push_back( selectable->name() ); // show the patch name
-
+
if ( !patchPtr->summary().empty() )
pkgLine.push_back( patchPtr->summary() ); // short description
else
- pkgLine.push_back( selectable->name() ); // name
+ pkgLine.push_back( selectable->name() ); // name
pkgLine.push_back( patchPtr->category() ); // patch kind
pkgLine.push_back( patchPtr->edition().asString() ); // patch version
-
+
// zypp::ByteCount size = patchPtr->size();
// pkgLine.push_back( size.asString( 8 ) );
-
+
addLine( selectable->status(), // get the status
pkgLine,
patchPtr,
@@ -770,25 +770,76 @@
if ( !packager )
return false;
-
+
switch ( tableType )
{
case T_Packages:
case T_Update:
// show the required package info
- packager->showPackageInformation( objPtr, slbPtr );
+ if (objPtr && slbPtr)
+ {
+ packager->showPackageInformation( objPtr, slbPtr );
+ //updateInfo( objPtr, slbPtr, VisibleInfo() );
+ //packager->PackageLabel()->setLabel( slbPtr->name() );
+ }
break;
case T_Patches:
// show the patch info
+ //if (objPtr && slbPtr )
+ // updateInfo( objPtr, slbPtr, VisibleInfo() );
packager->showPatchInformation( objPtr, slbPtr );
break;
default:
break;
}
-
+
return true;
}
+void NCPkgTable::updateInfo( ZyppObj pkgPtr, ZyppSel slbPtr, NCPkgTableInfoType mode )
+{
+/*
+ switch (mode)
+ {
+ case I_Descr:
+ if ( packager->InfoText() )
+ packager->InfoText()->longDescription( pkgPtr );
+ break;
+ case I_Technical:
+ if ( packager->InfoText() )
+ packager->InfoText()->technicalData( pkgPtr, slbPtr );
+ break;
+ case I_Files:
+ if ( packager->InfoText() )
+ packager->InfoText()->fileList( slbPtr );
+ break;
+ case I_Deps:
+ if ( packager->InfoText() )
+ packager->InfoText()->dependencyList( pkgPtr, slbPtr );
+ break;
+ case I_Versions:
+ if ( packager->VersionsList() )
+ packager->VersionsList()->fillAvailableList( slbPtr );
+ break;
+ case I_PatchDescr:
+ if ( packager->InfoText() )
+ packager->InfoText()->patchDescription( pkgPtr, slbPtr );
+ break;
+ case I_PatchPkgs:
+ if ( packager->PatchPkgs() )
+ packager->fillPatchPackages( packager->PatchPkgs(), pkgPtr );
+ break;
+ case I_PatchPkgsVersions:
+ if ( packager->PatchPkgsVersions() )
+ packager->fillPatchPackages( packager->PatchPkgsVersions(), pkgPtr, true );
+ break;
+ // Intentionally omitting 'default' branch so the compiler can
+ // catch unhandled enum states
+ }
+*/
+}
+
+
///////////////////////////////////////////////////////////////////
//
//
@@ -800,10 +851,10 @@
NCursesEvent NCPkgTable::wHandleInput( wint_t key )
{
NCursesEvent ret = NCursesEvent::none;
-
+
// call handleInput of NCPad
handleInput( key );
-
+
switch ( key )
{
case KEY_UP:
@@ -823,7 +874,7 @@
toggleObjStatus( );
ret = NCursesEvent::handled;
- break;
+ break;
}
default: {
// set the new status
@@ -845,7 +896,7 @@
//
ZyppStatus NCPkgTable::getStatus( int index )
{
- // get the tag
+ // get the tag
NCPkgTableTag * cc = getTag( index);
if ( !cc )
return S_NoInst;
@@ -855,7 +906,7 @@
ZyppObj NCPkgTable::getDataPointer( int index )
{
- // get the tag
+ // get the tag
NCPkgTableTag *cc = getTag( index );
if ( !cc )
return ZyppObj( );
@@ -865,7 +916,7 @@
ZyppSel NCPkgTable::getSelPointer( int index )
{
- // get the tag
+ // get the tag
NCPkgTableTag *cc = getTag( index );
if ( !cc )
return ZyppSel( );
@@ -875,7 +926,7 @@
NCPkgTableTag * NCPkgTable::getTag( const int & index )
{
- // get the table line
+ // get the table line
NCTableLine * cl = myPad()->ModifyLine( index );
if ( !cl )
return 0;
@@ -897,7 +948,7 @@
int index = getCurrentItem();
ZyppObj objPtr = getDataPointer( index );
bool ok;
-
+
if ( !objPtr )
{
NCERR << "Invalid Pointer" << endl;
@@ -905,14 +956,14 @@
}
ZyppSel selPtr = objPtr->getSelectable();
NCTableLine * currentLine = myPad()->ModifyLine( index );
-
+
if ( !selPtr || !currentLine )
{
NCERR << "Invalid Selectable" << endl;
return false;
}
- NCTableCol * currentCol = currentLine->GetCol( currentLine->Cols()-1 );
+ NCTableCol * currentCol = currentLine->GetCol( currentLine->Cols()-1 );
if ( install && selPtr->providesSources() )
{
@@ -928,7 +979,7 @@
if ( currentCol )
currentCol->SetLabel( NClabel( " " ) );
}
-
+
return true;
}
#endif
@@ -945,16 +996,16 @@
if ( !slbPtr )
return false;
-
+
ZyppStatus newStatus;
-
+
bool ok = statusStrategy->toggleStatus( slbPtr, objPtr, newStatus );
if ( ok )
{
changeStatus( newStatus, slbPtr, objPtr, true );
}
-
+
return true;
}
@@ -970,12 +1021,12 @@
if ( !slbPtr )
{
- return false;
+ return false;
}
ZyppStatus newStatus;
bool ok = statusStrategy->keyToStatus( key, slbPtr, objPtr, newStatus );
-
+
if ( ok )
{
changeStatus( newStatus, slbPtr, objPtr, true );
@@ -1000,12 +1051,12 @@
ZyppSel slbPtr = getSelPointer( index );
ZyppObj objPtr = getDataPointer( index );
bool ok = false;
-
+
if ( slbPtr )
{
switch ( type ) {
case A_Install: {
- if ( slbPtr->status() == S_NoInst )
+ if ( slbPtr->status() == S_NoInst )
ok = statusStrategy->keyToStatus( '+', slbPtr, objPtr, newStatus );
break;
}
@@ -1028,7 +1079,7 @@
}
case A_UpdateNewer: {
if ( slbPtr->status() == S_KeepInstalled && slbPtr->hasCandidateObj() ) {
- if ( slbPtr->installedObj()->edition() < slbPtr->candidateObj()->edition() )
+ if ( slbPtr->installedObj()->edition() < slbPtr->candidateObj()->edition() )
ok = statusStrategy->keyToStatus( '>', slbPtr, objPtr, newStatus );
}
break;
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.h?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.h (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/NCPkgTable.h Mon May 23 21:27:16 2011
@@ -26,7 +26,7 @@
#include "NCTable.h"
#include "PkgNames.h"
-#include <map>
+#include <map>
#include <string>
#include <utility> // for STL pair
@@ -56,7 +56,7 @@
// returns the corresponding string value to given package status
string statusToStr( ZyppStatus stat ) const;
-
+
public:
NCPkgTableTag( ZyppObj pkgPtr,
@@ -68,7 +68,7 @@
virtual void DrawAt( NCursesWindow & w, const wrect at,
NCTableStyle & tableStyle,
NCTableLine::STATE linestate,
- unsigned colidx ) const;
+ unsigned colidx ) const;
void setStatus( ZyppStatus stat ) { status = stat; }
ZyppStatus getStatus() const { return status; }
@@ -112,19 +112,30 @@
L_Installed,
L_Unknown
};
-
+
+ enum NCPkgTableInfoType {
+ I_Descr,
+ I_Technical,
+ I_Versions,
+ I_Files,
+ I_Deps,
+ I_PatchDescr,
+ I_PatchPkgs,
+ I_PatchPkgsVersions
+ };
+
private:
NCPkgTable & operator=( const NCPkgTable & );
NCPkgTable ( const NCPkgTable & );
-
+
PackageSelector * packager; // connection to the PackageSelector,
ObjectStatStrategy * statusStrategy; // particular methods to get the status
NCPkgTableType tableType; // the type (e.g. table of packages, patches)
bool haveInstalledVersion; // for T_Packages and T_Update
-
+
// returns the first column of line with 'index' (the tag)
NCPkgTableTag * getTag ( const int & index );
@@ -156,9 +167,9 @@
/**
* Draws the package list (has to be called after the loop with addLine() calls)
- */
+ */
void drawList( ) { return DrawPad(); }
-
+
/**
* Clears the package list
*/
@@ -201,7 +212,7 @@
* the currently selected package and updates the states
* of all packages in the list
* @param newstat The new status
- * @param slbPtr The pointer to the object to change
+ * @param slbPtr The pointer to the object to change
* @param objPtr is candidatePtr or what the user selected instead of it.
* @return bool
*/
@@ -209,7 +220,7 @@
const ZyppSel & slbPtr,
ZyppObj objPtr,
bool singleChange );
-
+
bool changeObjStatus( int key );
bool changeListObjStatus( NCPkgTableListAction key );
@@ -217,27 +228,27 @@
bool toggleObjStatus( );
/**
- * Set the status information if status has changed
+ * Set the status information if status has changed
* @return bool
- */
+ */
bool updateTable();
/**
* Gets the currently displayed package status.
* @param index The index in package table (the line)
* @return ZyppStatus
- */
+ */
ZyppStatus getStatus( int index );
#ifdef FIXME
/**
* Toggles the installation of the source package.
- * @param install
+ * @param install
* @return bool
- */
+ */
bool SourceInstall( bool install );
#endif
-
+
/**
* Sets the type of the table and the status strategy (which means call particular methods
* to set/get the status for different zypp::ResObjects (zypp::Patch, zypp::Package or available zypp::Package)
@@ -249,7 +260,7 @@
bool setTableType( NCPkgTableType type, ObjectStatStrategy * strategy ) {
if ( !strategy )
return false;
-
+
delete statusStrategy;
statusStrategy = strategy;
tableType = type;
@@ -261,32 +272,32 @@
* Gets the data pointer of a certain package.
* @param index The index in package table (the line)
* @return ZyppObj
- */
+ */
ZyppObj getDataPointer( int index );
/**
* Gets the selectable pointer of a certain package.
* @param index The index in package table (the line)
* @return ZyppSel
- */
+ */
ZyppSel getSelPointer( int index );
/**
* Returns the number of lines in the table (the table size)
* @return unsigned int
- */
+ */
unsigned int getNumLines( ) { return myPad()->Lines(); }
/**
* Shows default list (packages of default RPM group or patch list)
* @return bool
- */
+ */
bool fillDefaultList( );
/**
* Fills the header of the table
* @return void
- */
+ */
void fillHeader( );
/**
@@ -294,29 +305,30 @@
* @param pkgPtr The package pointer
* @param slbPtr The selectable pointer
* @return bool
- */
+ */
bool createListEntry ( ZyppPkg pkgPtr, ZyppSel slbPtr );
/**
* Creates a line in the YOU patch table.
- * @param pkgPtr The YOU patch pointer
+ * @param pkgPtr The YOU patch pointer
* @return bool
- */
+ */
bool createPatchEntry ( ZyppPatch pkgPtr, ZyppSel slbPtr );
/**
* Creates a line in the table shwing an info text.
* @param text The information
* @return bool
- */
+ */
bool createInfoEntry ( string text );
/**
* Show the corresponding information (e.g. the package description).
* @return bool
- */
+ */
bool showInformation ( );
+ void updateInfo( ZyppObj pkgPtr, ZyppSel slbPtr, NCPkgTableInfoType mode );
};
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupDeps.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupDeps.cc?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupDeps.cc (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupDeps.cc Mon May 23 21:27:16 2011
@@ -244,7 +244,7 @@
success = resolver->resolvePool();
break;
case S_Verify:
- success = resolver->verifySystem( true ); // check hardware
+ success = resolver->verifySystem(); // check hardware
break;
default:
NCERR << "Unknown action for resolve" << endl;
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupPkgTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupPkgTable.cc?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupPkgTable.cc (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupPkgTable.cc Mon May 23 21:27:16 2011
@@ -96,7 +96,7 @@
split->addChild( lb1 );
NCLabel * lb2 = new NCLabel( split, opt, YCPString(PkgNames::AutoChangeText2()) );
split->addChild( lb2 );
-
+
// add the package table (use default type T_Packages)
pkgTable = new NCPkgTable( split, opt );
pkgTable->setPackager( packager );
@@ -147,19 +147,19 @@
pkgTable->itemsCleared(); // clear the table
- set<string> ignoredNames;
+ set<string> ignoredNames;
set<string> userWantedNames = zypp::ui::userWantedPackageNames();
//these are the packages already selected for autoinstallation in previous 'verify system' run
set<string> verifiedNames = packager->getVerifiedPkgs();
//initialize storage for the new set
insert_iterator< set<string> > result (ignoredNames, ignoredNames.begin());
-
+
if(!verifiedNames.empty())
- {
+ {
//if we have some leftovers from previous run, do the union of the sets
set_union(userWantedNames.begin(), userWantedNames.end(),
- verifiedNames.begin(), verifiedNames.end(), result );
+ verifiedNames.begin(), verifiedNames.end(), result );
}
else
//else just take userWanted stuff
@@ -167,7 +167,7 @@
for ( set<string>::iterator it = ignoredNames.begin(); it != ignoredNames.end(); ++it )
NCMIL << "Ignoring: " << *it << endl;
-
+
ZyppPoolIterator
b = zyppPkgBegin(),
e = zyppPkgEnd(),
@@ -180,7 +180,7 @@
// show all packages which are automatically selected for installation
if ( slb->toModify() && slb->modifiedBy () != zypp::ResStatus::USER )
{
- if ( ! contains( ignoredNames, slb->name() ) )
+ if ( ignoredNames.find(slb->name()) ==ignoredNames.end() )
{
ZyppPkg pkgPtr = tryCastToZyppPkg (slb->theObj());
if ( pkgPtr )
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupSelection.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupSelection.cc?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupSelection.cc (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/NCPopupSelection.cc Mon May 23 21:27:16 2011
@@ -25,7 +25,7 @@
#include "PkgNames.h"
#include "NCPkgTable.h"
#include "ObjectStatStrategy.h"
-#include
+#include
#include "YQZypp.h"
@@ -154,15 +154,18 @@
// show the package list
std::setstd::string packages;
- ZyppSelection selPtr = tryCastToZyppSelection (objPtr);
- ZyppPattern patPtr = tryCastToZyppPattern (objPtr);
- if (selPtr)
- packages = selPtr->install_packages ();
- else if (patPtr)
- {
- zypp::ui::PatternContents patternContents( patPtr );
- packages = patternContents.install_packages();
- }
+ ZyppPattern patPtr = tryCastToZyppPattern (objPtr);
+ zypp::Pattern::Contents related ( patPtr->contents() );
+ for ( zypp::Pattern::Contents::Selectable_iterator it = related.selectableBegin();
+ it != related.selectableEnd();
+ ++it )
+ {
+ ZyppPkg zyppPkg = tryCastToZyppPkg( (*it)->theObj() );
+ if ( zyppPkg )
+ {
+ packages.insert(zyppPkg->name());
+ }
+ }
packager->showSelPackages( getCurrentLine(), packages );
// showDiskSpace() moved to NCPkgTable.cc (show/check diskspace
@@ -209,7 +212,7 @@
vdim = 20;
else
vdim = NCurses::lines()-4;
-
+
return ( dim == YD_HORIZ ? NCurses::cols()*2/3 : vdim );
}
@@ -262,21 +265,7 @@
///////////////////////////////////////////////////////////////////
//
-// OrderFunc
-//
-bool order( ZyppSel slb1, ZyppSel slb2 )
-{
- ZyppSelection ptr1 = tryCastToZyppSelection (slb1->theObj());
- ZyppSelection ptr2 = tryCastToZyppSelection (slb2->theObj());
- if ( !ptr1 || !ptr2 )
- return false;
- else
- return ptr1->order() < ptr2->order();
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// OrderFuncPattern
+// OrderFuncPattern
//
bool orderPattern( ZyppSel slb1, ZyppSel slb2 )
{
@@ -303,35 +292,14 @@
ZyppPoolIterator i, b, e;
list<ZyppSel> slbList;
-
+
switch ( type )
{
- case S_Selection:
- {
- for ( i = zyppSelectionsBegin () ; i != zyppSelectionsEnd (); ++i )
- {
- ZyppObj resPtr = (*i)->theObj();
- bool show;
-
- ZyppSelection selPtr = tryCastToZyppSelection (resPtr);
- show = selPtr && selPtr->visible() && !selPtr->isBase();
- if (show)
- {
- NCMIL << resPtr->kind () <<": " << resPtr->name()
- << ", initial status: " << (*i)->status() << endl;
-
- slbList.push_back (*i);
- }
- }
- slbList.sort( order );
-
- break;
- }
case S_Pattern:
{
for ( i = zyppPatternsBegin () ; i != zyppPatternsEnd (); ++i )
{
- ZyppObj resPtr = (*i)->theObj();
+ ZyppObj resPtr = (*i)->theObj();
bool show;
ZyppPattern patPtr = tryCastToZyppPattern (resPtr);
@@ -351,7 +319,7 @@
default:
NCERR << "Selecion type not handled: " << type << endl;
}
-
+
list<ZyppSel>::iterator listIt;
vector<string> pkgLine;
for ( listIt = slbList.begin(); listIt != slbList.end(); ++listIt )
@@ -365,6 +333,6 @@
resPtr, // ZyppSelection or ZyppPattern
(*listIt) ); // ZyppSel
}
-
+
return true;
}
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/ObjectStatStrategy.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/ObjectStatStrategy.cc?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/ObjectStatStrategy.cc (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/ObjectStatStrategy.cc Mon May 23 21:27:16 2011
@@ -67,25 +67,25 @@
/////////////////////////////////////////////////////////////////
//
-// ObjectStatStrategy::setObjectStatus()
+// ObjectStatStrategy::setObjectStatus()
//
// Informs the package manager about the status change
//
bool ObjectStatStrategy::setObjectStatus( ZyppStatus newstatus, ZyppSel slbPtr, ZyppObj objPtr )
{
bool ok = false;
-
+
if ( !slbPtr )
{
NCERR << "Invalid package object" << endl;
return false;
}
- ok = slbPtr->set_status( newstatus );
+ ok = slbPtr->setStatus( newstatus );
NCMIL << "Set status of: " << slbPtr->name() << " to: "
<< newstatus << " returns: " << (ok?"true":"false") << endl;
-
+
return ok;
}
@@ -102,12 +102,12 @@
{
if ( !slbPtr )
return false;
-
+
bool valid = true;
ZyppStatus retStat = S_NoInst;
ZyppStatus oldStatus = getPackageStatus( slbPtr, objPtr );
bool installed = slbPtr->hasInstalledObj();
-
+
// get the new status
switch ( key )
{
@@ -158,7 +158,7 @@
valid = false;
}
break;
- //this is the case for 'going back' i.e. S_Install -> S_NoInst, S_Update -> S_KeepInstalled
+ //this is the case for 'going back' i.e. S_Install -> S_NoInst, S_Update -> S_KeepInstalled
//not for S_Del, since '+' key does this
case '<':
if ( oldStatus == S_Install
@@ -166,7 +166,7 @@
{
retStat = S_NoInst;
}
- else if ( oldStatus == S_Update
+ else if ( oldStatus == S_Update
|| oldStatus == S_AutoUpdate )
{
retStat = S_KeepInstalled;
@@ -182,7 +182,7 @@
retStat = S_Protected;
}
break;
- case '%': // reset S_Taboo or S_Protected status
+ case '%': // reset S_Taboo or S_Protected status
if ( oldStatus == S_Taboo )
{
retStat = S_NoInst;
@@ -203,7 +203,7 @@
if ( valid )
newStat = retStat;
-
+
return valid;
}
@@ -220,10 +220,10 @@
{
if ( !slbPtr )
return false;
-
+
bool ok = true;
-
- ZyppStatus oldStatus = getPackageStatus( slbPtr, objPtr );
+
+ ZyppStatus oldStatus = getPackageStatus( slbPtr, objPtr );
ZyppStatus newStatus = oldStatus;
switch ( oldStatus )
@@ -281,15 +281,7 @@
void ObjectStatStrategy::solveResolvableCollections()
{
zypp::Resolver_Ptr resolver = zypp::getZYpp()->resolver();
-
- resolver->transactReset( zypp::ResStatus::APPL_LOW );
-
- resolver->transactResKind( zypp::ResTraitszypp::Product::kind );
- resolver->transactResKind( zypp::ResTraitszypp::Selection::kind );
- resolver->transactResKind( zypp::ResTraits::kind );
- resolver->transactResKind( zypp::ResTraits::kind );
- resolver->transactResKind( zypp::ResTraits::kind );
- resolver->transactResKind( zypp::ResTraits::kind );
+ resolver->resolvePool();
}
@@ -335,12 +327,12 @@
{
if ( !slbPtr )
return false;
-
+
bool valid = true;
ZyppStatus retStat = S_NoInst;
ZyppStatus oldStatus = getPackageStatus( slbPtr, objPtr );
bool installed = slbPtr->hasInstalledObj();
-
+
// get the new status
switch ( key )
{
@@ -364,12 +356,12 @@
|| oldStatus == S_AutoDel)
{
retStat = S_KeepInstalled;
- }
+ }
else
{
valid = false;
}
-
+
break;
case '>':
if ( oldStatus == S_KeepInstalled
@@ -393,7 +385,7 @@
if ( valid )
newStat = retStat;
-
+
return valid;
}
@@ -411,10 +403,10 @@
{
if ( !slbPtr )
return false;
-
+
bool ok = true;
-
- ZyppStatus oldStatus = getPackageStatus( slbPtr, objPtr );
+
+ ZyppStatus oldStatus = getPackageStatus( slbPtr, objPtr );
ZyppStatus newStatus = oldStatus;
switch ( oldStatus )
@@ -448,14 +440,14 @@
}
newStat = newStatus;
-
+
return ok;
}
#endif
/////////////////////////////////////////////////////////////////
//
-// PatchStatStrategy::setObjectStatus()
+// PatchStatStrategy::setObjectStatus()
//
// Inform the package manager about the status change
// of the patch
@@ -470,12 +462,12 @@
return false;
}
- ok = slbPtr->set_status( newstatus );
+ ok = slbPtr->setStatus( newstatus );
NCMIL << "Set status of: " << slbPtr->name() << " to: "
<< newstatus << " returns: " << (ok?"true":"false") << endl;
// do a solver run
- solveResolvableCollections();
+ solveResolvableCollections();
return ok;
}
@@ -494,7 +486,7 @@
/////////////////////////////////////////////////////////////////
//
-// SelectionStatStrategy::setObjectStatus()
+// SelectionStatStrategy::setObjectStatus()
//
// Inform the package manager about the status change
// of the selection
@@ -509,12 +501,12 @@
return false;
}
- ok = slbPtr->set_status( newstatus );
+ ok = slbPtr->setStatus( newstatus );
NCMIL << "Set status of: " << slbPtr->name() << " to: "
<< newstatus << " returns: " << (ok?"true":"false") << endl;
// do a solver run
- solveResolvableCollections();
+ solveResolvableCollections();
return ok;
}
@@ -600,10 +592,10 @@
}
// Set status
- ok = slbPtr->set_status( status );
+ ok = slbPtr->setStatus( status );
NCMIL << "Set status of: " << slbPtr->name() << " to: "
<< status << " returns: " << (ok?"true":"false") << endl;
-
+
// Set candidate
ok = slbPtr->setCandidate( newCandidate );
NCMIL << "Set user candidate returns: " << (ok?"true":"false") << endl;
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.cc?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.cc (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.cc Mon May 23 21:27:16 2011
@@ -34,6 +34,7 @@
#include "NCPopupPkgTable.h"
#include "NCPopupPkgDescr.h"
#include "NCPopupFile.h"
+#include "NCPkgStrings.h"
#include "PackageSelector.h"
#include "YSelectionBox.h"
#include "YNCursesUI.h"
@@ -48,13 +49,14 @@
#include "YQZypp.h" // tryCastToZyppPkg(), tryCastToZyppPatch()
#include
-#include
+#include
#include
-typedef zypp::ui::PatchContents ZyppPatchContents;
-typedef zypp::ui::PatchContents::const_iterator ZyppPatchContentsIterator;
+typedef zypp::Patch::Contents ZyppPatchContents;
+typedef zypp::Patch::Contents::Selectable_iterator ZyppPatchContentsIterator;
+
typedef zypp::syscontent::Reader::Entry ZyppReaderEntry;
-typedef std::pair importMapPair;
+typedef std::pair importMapPair;
#include
#include
@@ -74,20 +76,7 @@
///////////////////////////////////////////////////////////////////
//
-// CompFunc
-//
-bool sortByName( ZyppSel ptr1, ZyppSel ptr2 )
-{
- if ( ptr1->name() < ptr2->name() )
- {
- return true;
- }
- return false;
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// ignore case compare
+// ignore case compare
//
bool ic_compare ( char c1, char c2 )
{
@@ -124,7 +113,7 @@
// Filter menu
eventHandlerMap[ PkgNames::RpmGroups()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::Selections()->toString() ] = &PackageSelector::FilterHandler;
- eventHandlerMap[ PkgNames::Patterns()->toString() ] = &PackageSelector::FilterHandler;
+ eventHandlerMap[ PkgNames::Patterns()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::UpdateList()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::Installed()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::Whatif()->toString() ] = &PackageSelector::FilterHandler;
@@ -134,10 +123,10 @@
eventHandlerMap[ PkgNames::Security()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::Optional()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::InstalledPatches()->toString() ] = &PackageSelector::FilterHandler;
- eventHandlerMap[ PkgNames::AllPatches()->toString() ] = &PackageSelector::FilterHandler;
+ eventHandlerMap[ PkgNames::AllPatches()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::NewPatches()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::InstalledPatches()->toString() ] = &PackageSelector::FilterHandler;
- eventHandlerMap[ PkgNames::InstallablePatches()->toString() ] = &PackageSelector::FilterHandler;
+ eventHandlerMap[ PkgNames::InstallablePatches()->toString() ] = &PackageSelector::FilterHandler;
eventHandlerMap[ PkgNames::YaST2Patches()->toString() ] = &PackageSelector::FilterHandler;
// Information menu
@@ -147,7 +136,7 @@
eventHandlerMap[ PkgNames::Versions()->toString() ] = &PackageSelector::InformationHandler;
eventHandlerMap[ PkgNames::Relations()->toString() ] = &PackageSelector::InformationHandler;
- // YOU information
+ // YOU information
eventHandlerMap[ PkgNames::PatchDescr()->toString() ] = &PackageSelector::InformationHandler;
eventHandlerMap[ PkgNames::PatchPackages()->toString() ] = &PackageSelector::InformationHandler;
eventHandlerMap[ PkgNames::PatchPackagesVersions()->toString() ] = &PackageSelector::InformationHandler;
@@ -168,7 +157,7 @@
eventHandlerMap[ PkgNames::UpdateNewer()->toString() ] = &PackageSelector::StatusHandler;
eventHandlerMap[ PkgNames::UpdateAll()->toString() ] = &PackageSelector::StatusHandler;
eventHandlerMap[ PkgNames::DontUpdate()->toString() ] = &PackageSelector::StatusHandler;
-
+
// Etc. menu
eventHandlerMap[ PkgNames::ShowDeps()->toString() ] = &PackageSelector::DependencyHandler;
eventHandlerMap[ PkgNames::AutoDeps()->toString() ] = &PackageSelector::DependencyHandler;
@@ -178,7 +167,7 @@
eventHandlerMap[ PkgNames::SaveSel()->toString() ] = &PackageSelector::SelectionHandler;
eventHandlerMap[ PkgNames::LoadSel()->toString() ] = &PackageSelector::SelectionHandler;
eventHandlerMap[ PkgNames::Testcase()->toString() ] = &PackageSelector::TestcaseHandler;
-
+
// Help menu
eventHandlerMap[ PkgNames::GeneralHelp()->toString() ] = &PackageSelector::HelpHandler;
eventHandlerMap[ PkgNames::StatusHelp()->toString() ] = &PackageSelector::HelpHandler;
@@ -205,13 +194,13 @@
selectionPopup = new NCPopupSelection( wpos( 1, 1 ), this, NCPopupSelection::S_Selection );
// create the patterns popup
patternPopup = new NCPopupSelection( wpos( 1, 1 ), this, NCPopupSelection::S_Pattern );
-
+
_rpmGroupsTree = new YRpmGroupsTree ();
// get the rpm groups
ZyppPoolIterator b = zyppPkgBegin ();
ZyppPoolIterator e = zyppPkgEnd ();
ZyppPoolIterator i;
- for ( i = b; i != e; ++i )
+ for ( i = b; i != e; ++i )
{
ZyppPkg zyppPkg = tryCastToZyppPkg( (*i)->theObj() );
if ( zyppPkg )
@@ -220,7 +209,7 @@
}
}
// create the filter popup
- filterPopup = new NCPopupTree( wpos( 1, 1 ), this );
+ filterPopup = new NCPopupTree( wpos( 1, 1 ), this );
// the file popup
filePopup = new NCPopupFile( wpos( 1, 1), floppyDevice, this );
@@ -228,7 +217,7 @@
// create the search popup
searchPopup = new NCPopupSearch( wpos( 1, 1 ), this );
-
+
// the dependency popup
depsPopup = new NCPopupDeps( wpos( 1, 1 ), this );
@@ -257,7 +246,7 @@
}
if ( depsPopup )
{
- delete depsPopup;
+ delete depsPopup;
}
if ( diskspacePopup )
{
@@ -279,108 +268,23 @@
void PackageSelector::createFilterMenu()
{
- bool selections;
- bool patterns;
-
- // create the pattern popup
- if ( ! zyppPool().emptyzypp::Pattern() )
- {
-
- patterns = true;
- }
- else
- {
- patterns = false;
- }
- // create the selections popup
- if ( ! zyppPool().emptyzypp::Selection() )
- {
-
- selections = true;
- }
- else
- {
- selections = false;
- }
-
- if ( selections && !patterns )
- {
- // ReplaceWidget and show menu entry Selections instead of Patterns
- char menu[4000];
- snprintf ( menu, sizeof(menu) - 1,
- "`MenuButton( `opt(`key_F4), \"%s\", "
- "[`item( `id(\"groups\"), \"%s\" ), `item( `id(\"selections\"), \"%s\" ), "
- " `item( `id(\"search\"), \"%s\" ), `item( `id(\"installed\"), \"%s\" ), "
- " `item( `id(\"whatif\"), \"%s\" ), `item( `id(\"updatelist\"), \"%s\" ) ] ) ",
- PkgNames::MenuFilter().c_str(),
- PkgNames::MenuEntryRPMGroups().c_str(),
- PkgNames::MenuEntrySelections().c_str(),
- PkgNames::MenuEntrySearch().c_str(),
- PkgNames::MenuEntryInstPkg().c_str() ,
- PkgNames::MenuEntryInstSummary().c_str(),
- PkgNames::MenuEntryUpdateList().c_str()
- );
-
- Parser parser( menu );
- YCodePtr parsed_code = parser.parse ();
- YCPValue layout = YCPNull ();
- if (parsed_code != NULL)
- layout = parsed_code->evaluate();
- if ( !layout.isNull() )
- y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
-
- }
- else if ( patterns && selections )
- {
- // ReplaceWidget and show menu entries Patterns AND Selections
- char menu[4000];
- snprintf ( menu, sizeof(menu) - 1,
- "`MenuButton(`opt(`key_F4), \"%s\", "
- "[`item( `id(\"groups\"), \"%s\" ), `item( `id(\"patterns\"), \"%s\" ), "
- " `item( `id(\"selections\"), \"%s\" ), "
- " `item( `id(\"search\"), \"%s\" ), `item( `id(\"installed\"), \"%s\" ), "
- " `item( `id(\"whatif\"), \"%s\" ), `item( `id(\"updatelist\"), \"%s\" ) ] ) ",
- PkgNames::MenuFilter().c_str(),
- PkgNames::MenuEntryRPMGroups().c_str(),
- PkgNames::MenuEntryPatterns().c_str(),
- PkgNames::MenuEntrySelections().c_str(),
- PkgNames::MenuEntrySearch().c_str(),
- PkgNames::MenuEntryInstPkg().c_str() ,
- PkgNames::MenuEntryInstSummary().c_str(),
- PkgNames::MenuEntryUpdateList().c_str()
- );
-
- Parser parser( menu );
- YCodePtr parsed_code = parser.parse ();
- YCPValue layout = YCPNull ();
- if (parsed_code != NULL)
- layout = parsed_code->evaluate();
- if ( !layout.isNull() )
- y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
-
- }
+ // NO OP if no Selections support
}
///////////////////////////////////////////////////////////////////
//
// detection whether the user has made any changes
//
-
+
void PackageSelector::saveState ()
{
ZyppPool p = zyppPool ();
p.saveStatezypp::Package ();
p.saveStatezypp::SrcPackage ();
-
- p.saveStatezypp::Patch ();
- // some future proofing
- p.saveStatezypp::Message ();
- p.saveStatezypp::Script ();
- p.saveStatezypp::Selection ();
+ p.saveStatezypp::Patch ();
p.saveStatezypp::Pattern ();
- p.saveStatezypp::Language ();
}
void PackageSelector::restoreState ()
@@ -389,15 +293,9 @@
p.restoreStatezypp::Package ();
p.restoreStatezypp::SrcPackage ();
-
+
p.restoreStatezypp::Patch ();
- // some future proofing
- p.restoreStatezypp::Message ();
- p.restoreStatezypp::Script ();
-
- p.restoreStatezypp::Selection ();
p.restoreStatezypp::Pattern ();
- p.restoreStatezypp::Language ();
}
bool PackageSelector::diffState ()
@@ -412,21 +310,11 @@
log << diff << endl;
diff = diff || p.diffStatezypp::SrcPackage ();
log << diff << endl;
-
+
diff = diff || p.diffStatezypp::Patch ();
log << diff << endl;
- // some future proofing
- diff = diff || p.diffStatezypp::Message ();
- log << diff << endl;
- diff = diff || p.diffStatezypp::Script ();
- log << diff << endl;
-
- diff = diff || p.diffStatezypp::Selection ();
- log << diff << endl;
diff = diff || p.diffStatezypp::Pattern ();
log << diff << endl;
- diff = diff || p.diffStatezypp::Language ();
- log << diff << endl;
return diff;
}
@@ -443,7 +331,7 @@
if ( event == NCursesEvent::handled )
return false;
-
+
// Get the id of the widget which is affected
if ( event == NCursesEvent::button )
{
@@ -453,31 +341,31 @@
{
currentId = event.selection;
}
-
+
// Find the handler-function for the given widget-nameId
if ( ! currentId.isNull() )
{
UIMIL << "Selected widget id: " << currentId->toString() << endl;
- // hyperlink
+ // hyperlink
if ( currentId->isString()
&& currentId->asString()->value().substr(0, 4) == "pkg:" )
{
LinkHandler( currentId->asString()->value() );
return true;
}
-
+
tHandlerMap::iterator it = eventHandlerMap.find ( currentId->toString() );
-
+
if (it != eventHandlerMap.end()) // if currentId found in map
- {
+ {
tHandlerFctPtr pFct = (*it).second;
retVal = (this->*pFct) ( event ); // call handler
}
else
{
UIERR << "Unhandled event for widget-Id: " << currentId->toString() << endl;
-
- // return true means: don't leave the event loop in runPkgSelection
+
+ // return true means: don't leave the event loop in runPkgSelection
retVal = true;
}
}
@@ -505,9 +393,9 @@
//
// fillAvailableList
//
-// Fills the package table (on bottom ) with the list of available packages
+// Fills the package table (on bottom ) with the list of available packages
//
-bool PackageSelector::fillAvailableList( NCPkgTable * pkgTable, ZyppSel selectable )
+bool PackageSelector::fillAvailableList( NCPkgTable * pkgTable, ZyppSel slb )
{
if ( !pkgTable )
{
@@ -515,35 +403,47 @@
return false;
}
- if ( !selectable )
+ bool addInstalled = true;
+ if ( !slb )
{
NCERR << "Package pointer not valid" << endl;
return false;
}
-
+
// clear the package table
pkgTable->itemsCleared ();
- NCDBG << "Number of available packages: " << selectable->availableObjs() << endl;
+ NCDBG << "Number of available packages: " << slb->availableSize() << endl;
// show all availables
zypp::ui::Selectable::available_iterator
- b = selectable->availableBegin (),
- e = selectable->availableEnd (),
+ b = slb->availableBegin (),
+ e = slb->availableEnd (),
it;
for (it = b; it != e; ++it)
{
- pkgTable->createListEntry( tryCastToZyppPkg (*it), selectable );
+
+ if ( slb->installedObj() &&
+ slb->installedObj()->edition() == (*it)->edition() &&
+ slb->installedObj()->arch() == (*it)->arch() )
+ // FIXME: In future releases, also the vendor will make a difference
+ {
+ addInstalled = false;
+ }
+ pkgTable->createListEntry( tryCastToZyppPkg (*it), slb );
+ }
+ if ( (! slb->installedEmpty()) && addInstalled )
+ {
+ pkgTable->createListEntry( tryCastToZyppPkg (slb->installedObj()), slb );
}
// show the package list
pkgTable->drawList();
-
+
if ( pkgTable->getNumLines() > 0 )
{
pkgTable->setCurrentItem( 0 );
}
-
return true;
}
@@ -556,7 +456,7 @@
bool PackageSelector::showSelPackages( const YCPString & label, const set<string> & wanted )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "Widget is not a valid NCPkgTable widget" << endl;
@@ -565,7 +465,7 @@
// clear the package table
packageList->itemsCleared ();
-
+
set<string>::iterator not_found = wanted.end ();
std::vector<ZyppSel> sorted;
@@ -607,7 +507,7 @@
// show the package table
packageList->drawList();
-
+
if ( !label.isNull() )
{
NCDBG << "Filter: " << label->toString() << endl;
@@ -619,7 +519,7 @@
static_cast(filterLabel)->setLabel( label );
}
}
-
+
return true;
}
@@ -639,9 +539,8 @@
bool checkRequires )
{
NCPkgTable * packageList = getPackageList();
-
- if ( !packageList
- || expr.isNull() )
+
+ if ( !packageList )
{
return false;
}
@@ -649,70 +548,74 @@
// clear the package table
packageList->itemsCleared ();
-// FIXME filter it inside zypp
- ZyppPoolIterator b = zyppPkgBegin ();
- ZyppPoolIterator e = zyppPkgEnd ();
- ZyppPoolIterator i;
-
- // get the package list and sort it
- list<ZyppSel> pkgList( b, e );
- pkgList.sort( sortByName );
-
- // fill the package table
- list<ZyppSel>::iterator listIt = pkgList.begin();
- ZyppPkg pkg;
- string description = "";
- string provides = "";
- string requires = "";
-
- while ( listIt != pkgList.end() )
- {
- if ( (*listIt)->installedObj() )
- pkg = tryCastToZyppPkg ((*listIt)->installedObj());
- else
- pkg = tryCastToZyppPkg ((*listIt)->theObj());
+ zypp::PoolQuery q;
+ q.setMatchSubstring();
- if ( pkg )
- {
- if ( checkDescr )
- {
- zypp::Text value = pkg->description();
- description = createDescrText( value );
- }
- if ( checkProvides )
- {
- zypp::CapSet value = pkg->dep (zypp::Dep::PROVIDES);
- provides = createRelLine( value );
- }
- if ( checkRequires )
- {
- zypp::CapSet value = pkg->dep (zypp::Dep::REQUIRES);
- requires = createRelLine( value );
- }
- if ( ( checkName && match( pkg->name(), expr->value(), ignoreCase )) ||
- ( checkSummary && match( pkg->summary(), expr->value(), ignoreCase) ) ||
- ( checkDescr && match( description, expr->value(), ignoreCase) ) ||
- ( checkProvides && match( provides, expr->value(), ignoreCase) ) ||
- ( checkRequires && match( requires, expr->value(), ignoreCase) )
- )
- {
- // search sucessful
- packageList->createListEntry( pkg, *listIt );
- }
- }
+ q.addString( expr->value() );
+ q.addKind( zypp::ResKind::package );
- ++listIt;
- }
+ if ( !ignoreCase )
+ q.setCaseSensitive();
+ if ( checkName )
+ q.addAttribute( zypp::sat::SolvAttr::name );
+ if ( checkSummary )
+ q.addAttribute( zypp::sat::SolvAttr::summary );
+ if ( checkDescr )
+ q.addAttribute( zypp::sat::SolvAttr::description );
+ if ( checkProvides )
+ q.addAttribute( zypp::sat::SolvAttr("solvable:provides") );
+ if ( checkRequires )
+ q.addAttribute( zypp::sat::SolvAttr("solvable:requires") );
+
+ //NCPopupInfo * info = new NCPopupInfo( wpos( (NCurses::lines()-4)/2, (NCurses::cols()-18)/2 ),
+// "",
+// _("Searching...")
+// );
+//info->popup();
+
+ try
+ {
+ for( zypp::PoolQuery::Selectable_iterator it = q.selectableBegin();
+ it != q.selectableEnd(); it++)
+ {
+ ZyppPkg pkg = tryCastToZyppPkg( (*it)->theObj() );
+ packageList->createListEntry ( pkg, *it);
+ }
+ }
+ catch (const std::exception & e)
+ {
+ //NCPopupInfo * info = new NCPopupInfo ( wpos( NCurses::lines()/10,
+ // NCurses::cols()/10),
+ // NCPkgStrings::ErrorLabel(),
+ // // Popup informs the user that the query string
+ // // entered for package search isn't correct
+ // _("Query Error:") + ("<br>") + e.what(),
+ // NCPkgStrings::OKLabel() );
+ //info->setPreferredSize( 50, 10 );
+ //info->showInfoPopup();
+ //YDialog::deleteTopmostDialog();
+ NCERR << "Caught a std::exception: " << e.what () << endl;
+ }
+
+ //info->popdown();
+//YDialog::deleteTopmostDialog();
+
+ int found_pkgs = packageList->getNumLines();
+ ostringstream s;
+//s << boost::format( _( "%d packages found")) % found_pkgs;
+//packager->PatternLabel()->setText( s.str() );
// show the package list
packageList->drawList();
-
- // set filter label to 'Search'
- YWidget * filterLabel = y2ui->widgetWithId( PkgNames::Filter(), true );
- if ( filterLabel )
+
+ if ( found_pkgs > 0 )
{
- static_cast(filterLabel)->setLabel( YCPString(PkgNames::SearchResults()) );
+ packageList->setCurrentItem( 0 );
+ packageList->showInformation();
+ packageList->setKeyboardFocus();
}
+// else
+ //packager->clearInfoArea();
return true;
}
@@ -726,7 +629,7 @@
bool PackageSelector::fillPatchSearchList( const YCPString & expr )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList
|| expr.isNull() )
{
@@ -738,7 +641,7 @@
// get the patch list and sort it
list<ZyppSel> patchList( zyppPatchesBegin (), zyppPatchesEnd () );
patchList.sort( sortByName );
- list<ZyppSel>::iterator listIt = patchList.begin();
+ list<ZyppSel>::iterator listIt = patchList.begin();
while ( listIt != patchList.end() )
{
@@ -756,7 +659,7 @@
}
// show the patch list with search result
packageList->drawList();
-
+
// set filter label to 'Search'
YWidget * filterLabel = y2ui->widgetWithId( PkgNames::Filter(), true );
if ( filterLabel )
@@ -777,20 +680,20 @@
bool PackageSelector::fillPatchList( string filter )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "No valid NCPkgTable widget" << endl;
return false;
}
-
+
// clear list of patches
packageList->itemsCleared ();
// get the patch list and sort it
list<ZyppSel> patchList( zyppPatchesBegin (), zyppPatchesEnd () );
patchList.sort( sortByName );
- list<ZyppSel>::iterator listIt = patchList.begin();
+ list<ZyppSel>::iterator listIt = patchList.begin();
while ( listIt != patchList.end() )
{
@@ -800,18 +703,18 @@
{
checkPatch( patchPtr, *listIt, filter );
}
- ++listIt;
+ ++listIt;
}
if ( filter == "installable"
&& packageList->getNumLines() == 0 )
{
- packageList->createInfoEntry( PkgNames::NoPatches() );
+ packageList->createInfoEntry( PkgNames::NoPatches() );
}
// show the patches
packageList->drawList();
-
+
// show the selected filter label
YWidget * filterLabel = y2ui->widgetWithId( PkgNames::Filter(), true );
if ( filterLabel )
@@ -823,14 +726,14 @@
}
else if ( filter == "installed" )
{
- static_cast(filterLabel)->setLabel( YCPString(PkgNames::InstPatches()) );
+ static_cast(filterLabel)->setLabel( YCPString(PkgNames::InstPatches()) );
}
else
{
- static_cast(filterLabel)->setLabel( YCPString(PkgNames::Patches()) );
+ static_cast(filterLabel)->setLabel( YCPString(PkgNames::Patches()) );
}
}
-
+
return true;
}
@@ -843,19 +746,19 @@
bool PackageSelector::fillUpdateList( )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
- UIERR << "Widget is not a valid NCPkgTable widget" << endl;
+ NCERR << "Widget is not a valid NCPkgTable widget" << endl;
return false;
}
// clear the package table
packageList->itemsCleared ();
- listzypp::PoolItem_Ref problemList = zypp::getZYpp()->resolver()->problematicUpdateItems();
-
- for ( listzypp::PoolItem_Ref::const_iterator it = problemList.begin();
+ listzypp::PoolItem problemList = zypp::getZYpp()->resolver()->problematicUpdateItems();
+
+ for ( listzypp::PoolItem::const_iterator it = problemList.begin();
it != problemList.end();
++it )
{
@@ -872,19 +775,19 @@
packageList->createListEntry( pkg, slb );
}
}
-
+
}
-
+
// show the list
packageList->drawList();
-
+
// show the selected filter label
- YWidget * filterLabel = y2ui->widgetWithId( PkgNames::Filter(), true );
- if ( filterLabel )
+ YWidget * packageLabel = y2ui->widgetWithId( PkgNames::Packages(), true );
+ if ( packageLabel )
{
- static_cast(filterLabel)->setLabel( YCPString(PkgNames::UpdateProblem()) );
+ static_cast(packageLabel)->setLabel( YCPString(PkgNames::UpdateProblem()) );
}
-
+
return true;
}
@@ -895,95 +798,83 @@
//
bool PackageSelector::fillPatchPackages ( NCPkgTable * pkgTable, ZyppObj objPtr, bool versions )
{
- if ( !pkgTable )
+ if ( !pkgTable || !objPtr )
return false;
+
pkgTable->itemsCleared ();
std::set<ZyppSel> patchSelectables;
-
- ZyppPatch patchPtr = tryCastToZyppPatch( objPtr );
-
+ ZyppPatch patchPtr = tryCastToZyppPatch( objPtr );
+
if ( !patchPtr )
return false;
- ZyppPatchContents patchContents( patchPtr );
+ ZyppPatchContents patchContents( patchPtr->contents() );
- zypp::Patch::AtomList atomList = patchPtr->atoms();
- NCMIL << "Filtering for patch: " << patchPtr->name().c_str() << " number of atoms: " << atomList.size() << endl ;
+ NCMIL << "Filtering for patch: " << patchPtr->name().c_str() << " number of atoms: "
+ << patchContents.size() << endl ;
- for ( ZyppPatchContentsIterator it = patchContents.begin();
- it != patchContents.end();
+ for ( ZyppPatchContentsIterator it = patchContents.selectableBegin();
+ it != patchContents.selectableEnd();
++it )
{
-
- ZyppPkg pkg = tryCastToZyppPkg( *it );
+ ZyppPkg pkg = tryCastToZyppPkg( (*it)->theObj() );
if ( pkg )
{
NCMIL << "Patch package found: " << (*it)->name().c_str() << endl;
-
ZyppSel sel = selMapper.findZyppSel( pkg );
if ( sel )
- if ( contains( patchSelectables, sel ) )
+ {
+ if ( inContainer( patchSelectables, sel ) )
{
NCMIL << "Suppressing duplicate selectable: " << (*it)->name().c_str() << "-" <<
- (*it)->edition().asString().c_str() << " " <<
- (*it)->arch().asString().c_str() << endl;
+ pkg->edition().asString().c_str() << " " <<
+ pkg->arch().asString().c_str() << endl;
}
else
{
patchSelectables.insert( sel );
+ NCDBG << (*it)->name().c_str() << ": Version: " << pkg->edition().asString() << endl;
+
+ pkgTable->createListEntry( pkg, sel );
- if ( versions )
+ if ( versions ) // additionally show all availables
{
- // show all availables
zypp::ui::Selectable::available_iterator
b = sel->availableBegin (),
e = sel->availableEnd (),
it;
for (it = b; it != e; ++it)
{
- pkgTable->createListEntry( tryCastToZyppPkg (*it), sel );
+ ZyppPkg pkgAvail = tryCastToZyppPkg (*it);
+ if ( pkgAvail )
+ {
+ if ( pkg->edition() != pkgAvail->edition() ||
+ pkg->arch() != pkgAvail->arch() )
+ {
+ pkgTable->createListEntry( pkgAvail, sel );
+ }
+ }
}
- }
- else
- {
- pkgTable->createListEntry( pkg, sel );
- }
- }
+ } // if ( versions )
+ }
+ }
}
- else // No ZyppPkg - some other kind of object (script, message)
+ else // No ZyppPkg - some other kind of object
{
- if ( zypp::isKindzypp::Script ( *it ) )
- {
- vector<string> pkgLine;
- pkgLine.reserve(4);
+ NCDBG << "Found unknown atom of kind %s: %s" <<
+ (*it)->kind().asString().c_str() <<
+ (*it)->name().c_str() << endl;
- pkgLine.push_back( (*it)->name() );
- pkgLine.push_back( " " ); // versions empty
- pkgLine.push_back( " " );
- pkgLine.push_back( PkgNames::Script() );
-
- pkgTable->addLine( S_NoInst,
- pkgLine,
- ZyppObj(),
- ZyppSel()
- );
- }
- else
- {
- y2debug( "Found unknown atom of kind %s: %s",
- (*it)->kind().asString().c_str(),
- (*it)->name().c_str() );
- }
}
}
// show the list
pkgTable->drawList();
-
+
return true;
}
@@ -996,13 +887,13 @@
bool PackageSelector::fillSummaryList( NCPkgTable::NCPkgTableListType type )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "No valid NCPkgTable widget" << endl;
return false;
}
-
+
// clear the package table
packageList->itemsCleared ();
@@ -1014,32 +905,32 @@
list<ZyppSel>::iterator listIt;
ZyppPkg pkgPtr;
- // If the dependency check is off, the dependencies will not be solved for
+ // If the dependency check is off, the dependencies will not be solved for
// the installation summary.
// This is not necessary because the dependencies will be solved and the
- // "Automatic Changes" list will be shown if the OK button is pressed.
+ // "Automatic Changes" list will be shown if the OK button is pressed.
if ( !autoCheck )
{
// showPackageDependencies( true );
}
-
+
for ( listIt = pkgList.begin(); listIt != pkgList.end(); ++listIt )
{
ZyppSel selectable = *listIt;
ZyppPkg pkg = tryCastToZyppPkg (selectable->theObj ());
- // show all matching packages
+ // show all matching packages
switch ( type )
{
case NCPkgTable::L_Changes: {
if ( selectable->status() != S_NoInst
- && selectable->status() != S_KeepInstalled )
+ && selectable->status() != S_KeepInstalled )
{
packageList->createListEntry( pkg, selectable );
}
break;
}
case NCPkgTable::L_Installed: {
- if ( selectable->status() == S_KeepInstalled )
+ if ( selectable->status() == S_KeepInstalled )
{
packageList->createListEntry( pkg, selectable );
}
@@ -1052,7 +943,7 @@
// show the package list
packageList->drawList();
-
+
// show the selected filter label
YWidget * filterLabel = y2ui->widgetWithId( PkgNames::Filter(), true );
if ( filterLabel )
@@ -1073,13 +964,13 @@
bool PackageSelector::fillPackageList( const YCPString & label, YStringTreeItem * rpmGroup )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "No valid NCPkgTable widget" << endl;
return false;
}
-
+
// clear the package table
packageList->itemsCleared ();
@@ -1095,7 +986,7 @@
for ( listIt = pkgList.begin(); listIt != pkgList.end(); ++listIt )
{
ZyppSel selectable = *listIt;
-
+
// Multiple instances of this package may or may not be in the same
// RPM group, so let's check both the installed version (if there
// is any) and the candidate version.
@@ -1103,14 +994,14 @@
// Make sure we emit only one filterMatch() signal if both exist
// and both are in the same RPM group. We don't want multiple list
// entries for the same package!
-
+
bool match =
checkPackage( selectable->candidateObj(), selectable, rpmGroup ) ||
- checkPackage( selectable->installedObj(), selectable, rpmGroup );
+ checkPackage( selectable->installedObj(), selectable, rpmGroup );
// If there is neither an installed nor a candidate package, check
- // any other instance.
-
+ // any other instance.
+
if ( ! match &&
! selectable->installedObj() &&
! selectable->candidateObj() )
@@ -1120,7 +1011,7 @@
// show the package list
packageList->drawList();
-
+
if ( !label.isNull() )
{
// show the selected filter label
@@ -1142,7 +1033,7 @@
bool PackageSelector::match ( string s1, string s2, bool ignoreCase )
{
string::iterator pos;
-
+
if ( ignoreCase )
{
pos = search( s1.begin(), s1.end(),
@@ -1172,19 +1063,19 @@
return false;
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "Widget is not a valid NCPkgTable widget" << endl;
return false;
}
-
+
string group_str = _rpmGroupsTree->rpmGroup (rpmGroup);
// is the requested rpm group a prefix of this package's group?
if ( pkg->group ().find (group_str) == 0 )
{
packageList->createListEntry( pkg, slb );
-
+
return true;
}
else
@@ -1204,11 +1095,11 @@
bool PackageSelector::checkPatch( ZyppPatch patchPtr,
ZyppSel selectable,
string filter )
-
+
{
NCPkgTable * packageList = getPackageList();
bool displayPatch = false;
-
+
if ( !packageList || !patchPtr
|| !selectable )
{
@@ -1230,7 +1121,7 @@
if ( selectable->hasInstalledObj() ) // patch installed?
{
// display only if broken
- if ( selectable->installedPoolItem().status().isIncomplete() )
+ if ( selectable->installedObj().isBroken() )
{
displayPatch = true;
NCWAR << "Installed patch is broken: " << patchPtr->name().c_str() << " - "
@@ -1239,13 +1130,13 @@
}
else // patch not installed
- {
- if (selectable->hasCandidateObj() &&
- selectable->candidatePoolItem().status().isSatisfied() )
+ {
+ if (selectable->hasCandidateObj() &&
+ selectable->candidateObj().status().isSatisfied() )
{
//patch not installed, but it is satisfied (updated to the version patch requires)
//all that is missing are patch metadata, so let's display the patch
-
+
displayPatch = true;
NCMIL << "Patch satisfied, but not installed yet: " << patchPtr->name().c_str() << " - "
@@ -1259,9 +1150,14 @@
// isSatisfied(): all packages are installed, therefore the isNeeded() flag
// isn't set. BUT the patch meta data aren't installed and therefore it makes
// sense to install the patch
- if ( selectable->candidatePoolItem().status().isNeeded())
- {
- displayPatch = true;
+ if ( selectable->hasCandidateObj() &&
+ selectable->candidateObj().isRelevant() )
+ {
+ // and only those that are needed
+ if ( ! selectable->candidateObj().isSatisfied() ||
+ // may be it is satisfied because is preselected
+ selectable->candidateObj().status().isToBeInstalled() )
+ displayPatch = true;
}
else
{
@@ -1296,7 +1192,7 @@
if ( patchPtr->category() == "yast" )
displayPatch = true;
}
-
+
if ( displayPatch )
packageList->createPatchEntry( patchPtr, selectable );
@@ -1323,13 +1219,13 @@
newStatus = oldStatus;
break;
- //Keep also those marked for deletion
+ //Keep also those marked for deletion
case S_Del:
case S_AutoDel:
newStatus = S_KeepInstalled;
NCDBG << "Keeping " << kind << " " << selectable->name().c_str() << endl;
break;
-
+
//Add not yet installed pkgs (if they have candidate available)
case S_NoInst:
case S_Taboo:
@@ -1340,12 +1236,12 @@
}
else
{
- NCDBG << "Cannot add " << kind << " " << selectable->name().c_str() <<
- " " << " - no candidate." << endl;
+ NCDBG << "Cannot add " << kind << " " << selectable->name().c_str() <<
+ " " << " - no candidate." << endl;
}
- break;
- }
- }
+ break;
+ }
+ }
//Package/Pattern is not on the list
else
{
@@ -1362,7 +1258,7 @@
NCDBG << "Deleting " << kind << " " << selectable->name().c_str() << endl;
break;
- //Keep status for not installed, taboo and to-be-deleted
+ //Keep status for not installed, taboo and to-be-deleted
case S_Del:
case S_AutoDel:
case S_NoInst:
@@ -1371,9 +1267,9 @@
break;
}
}
-
- if (oldStatus != newStatus)
- selectable->set_status( newStatus );
+
+ if (oldStatus != newStatus)
+ selectable->setStatus( newStatus );
}
///////////////////////////////////////////////////////////////////
@@ -1385,12 +1281,12 @@
bool PackageSelector::SearchHandler( const NCursesEvent& event)
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList || !searchPopup )
{
return false;
}
-
+
// open the search popup
NCursesEvent retEvent = searchPopup->showSearchPopup();
@@ -1405,7 +1301,7 @@
}
packageList->setKeyboardFocus();
-
+
return true;
}
@@ -1431,7 +1327,7 @@
NCERR << "*** InformationHandler RETURN false ***" << endl;
return false;
}
-
+
if ( visibleInfo->compare( event.selection ) == YO_EQUAL )
{
// information selection has not changed
@@ -1444,7 +1340,7 @@
if ( visibleInfo->compare( PkgNames::Versions() ) == YO_EQUAL )
{
// show the package table
- const char * tableLayout = "`PkgSpecial( `id(\"availpkgs\"), `opt(`notify), \"pkgTable\" )";
+ const char * tableLayout = "`PkgSpecial( `id(\"availpkgs\"), `opt(`notify), \"pkgTable\" )";
Parser parser( tableLayout );
YCodePtr parsed_code = parser.parse ();
YCPValue layout = YCPNull ();
@@ -1471,7 +1367,7 @@
else if ( visibleInfo->compare( PkgNames::PatchPackages() ) == YO_EQUAL )
{
// show the package table
- const char * tableLayout = "`PkgSpecial( `id(\"patchpkgs\"), `opt(`notify), \"pkgTable\" )";
+ const char * tableLayout = "`PkgSpecial( `id(\"patchpkgs\"), `opt(`notify), \"pkgTable\" )";
Parser parser( tableLayout );
YCodePtr parsed_code = parser.parse ();
YCPValue layout = YCPNull ();
@@ -1492,12 +1388,12 @@
patchPkgs->fillHeader( );
fillPatchPackages( patchPkgs, packageList->getDataPointer( packageList->getCurrentItem() ) );
- }
+ }
}
else if ( visibleInfo->compare( PkgNames::PatchPackagesVersions() ) == YO_EQUAL )
{
// show the package table
- const char * tableLayout = "`PkgSpecial( `id(\"pkgsversions\"), `opt(`notify), \"pkgTable\" )";
+ const char * tableLayout = "`PkgSpecial( `id(\"pkgsversions\"), `opt(`notify), \"pkgTable\" )";
Parser parser( tableLayout );
YCodePtr parsed_code = parser.parse ();
YCPValue layout = YCPNull ();
@@ -1518,12 +1414,12 @@
patchPkgsVersions->fillHeader( );
fillPatchPackages( patchPkgsVersions, packageList->getDataPointer( packageList->getCurrentItem() ), true );
- }
- }
+ }
+ }
else
{
// show the rich text widget
- const char * textLayout = "`RichText( `id(\"description\"), \" \")";
+ const char * textLayout = "`RichText( `id(\"description\"), \" \")";
Parser parser( textLayout );
YCodePtr parsed_code = parser.parse ();
YCPValue layout = YCPNull ();
@@ -1531,12 +1427,12 @@
layout = parsed_code->evaluate ();
if (!layout.isNull())
y2ui->evaluateReplaceWidget( YCPSymbol ("replaceinfo"), layout->asTerm() );
-
+
packageList->showInformation( );
}
packageList->setKeyboardFocus();
-
+
UIMIL << "Change package info to: " << visibleInfo->toString() << endl;
return true;
}
@@ -1559,7 +1455,7 @@
showPackageDependencies( true ); // do the check
// update the package list and the disk space info
updatePackageList();
- showDiskSpace();
+ showDiskSpace();
}
else if ( event.selection->compare( PkgNames::VerifySystem() ) == YO_EQUAL )
{
@@ -1570,7 +1466,7 @@
else if ( event.selection->compare( PkgNames::AutoDeps() ) == YO_EQUAL )
{
char menu[2000];
-
+
if ( autoCheck )
{
snprintf ( menu, sizeof(menu) - 1,
@@ -1600,7 +1496,7 @@
Parser parser( menu );
YCodePtr parsed_code = parser.parse ();
YCPValue layout = YCPNull ();
-
+
if ( parsed_code != NULL )
layout = parsed_code->evaluate();
@@ -1615,7 +1511,7 @@
snprintf ( menu, sizeof(menu) - 1,
"`MenuButton( \"%s\", ["
"`menu( \"%s\", [`item( `id(\"showdeps\"), \"%s\" ), `item( `id(\"autodeps\"), \"%s\" ), `item ( `id(\"verifysystem\"), \"%s\" ) ] ),"
- "`item( `id(\"testcase\"), \"%s\" )"
+ "`item( `id(\"testcase\"), \"%s\" )"
#ifdef FIXME
","
"`menu( \"%s\", [`item( `id(\"save\"), \"%s\" ), `item( `id(\"load\"), \"%s\" ) ] )"
@@ -1626,7 +1522,7 @@
PkgNames::MenuCheckDeps().c_str(),
PkgNames::MenuAutoDeps().c_str(),
PkgNames::MenuVerifySystem().c_str(),
- PkgNames::MenuTestCase().c_str()
+ PkgNames::MenuTestCase().c_str()
#ifdef FIXME
,
PkgNames::MenuSel().c_str(),
@@ -1639,20 +1535,20 @@
Parser parser( menu );
YCodePtr parsed_code = parser.parse ();
YCPValue layout = YCPNull ();
-
+
if ( parsed_code != NULL )
layout = parsed_code->evaluate();
if ( !layout.isNull() )
{
- y2ui->evaluateReplaceWidget( YCPSymbol ("replacemenu"), layout->asTerm() );
+ y2ui->evaluateReplaceWidget( YCPSymbol ("replacemenu"), layout->asTerm() );
autoCheck = true;
}
}
}
NCPkgTable * packageList = getPackageList();
-
+
if ( packageList )
{
packageList->setKeyboardFocus();
@@ -1672,7 +1568,7 @@
{
NCursesEvent retEvent;
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList
|| event.selection.isNull() )
{
@@ -1683,7 +1579,7 @@
{
if ( filterPopup )
{
- // show the filter popup (fills the package list)
+ // show the filter popup (fills the package list)
retEvent = filterPopup->showFilterPopup( );
}
}
@@ -1702,7 +1598,7 @@
// show the selection popup
retEvent = patternPopup->showSelectionPopup( );
}
- }
+ }
// patches
else if ( event.selection->compare( PkgNames::Recommended() ) == YO_EQUAL )
{
@@ -1719,7 +1615,7 @@
else if ( event.selection->compare( PkgNames::YaST2Patches() ) == YO_EQUAL )
{
fillPatchList( "YaST2" ); // patch kind
- }
+ }
else if ( event.selection->compare( PkgNames::AllPatches() ) == YO_EQUAL )
{
fillPatchList( "all" ); // show all patches
@@ -1748,11 +1644,11 @@
{
fillSummaryList( NCPkgTable::L_Installed );
}
-
+
packageList->showInformation();
- packageList->setKeyboardFocus();
-
- // return true means: don't leave the event loop in runPkgSelection
+ packageList->setKeyboardFocus();
+
+ // return true means: don't leave the event loop in runPkgSelection
return true;
}
@@ -1765,13 +1661,13 @@
bool PackageSelector::StatusHandler( const NCursesEvent& event )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList
|| event.selection.isNull() )
{
return false;
}
-
+
if ( packageList->getNumLines() == 0 )
{
// nothing to do
@@ -1806,24 +1702,24 @@
}
else if ( event.selection->compare( PkgNames::TabooOn() ) == YO_EQUAL )
{
- packageList->changeObjStatus( '!' );
+ packageList->changeObjStatus( '!' );
}
else if ( event.selection->compare( PkgNames::TabooOff() ) == YO_EQUAL )
{
- packageList->changeObjStatus( '%' );
- }
+ packageList->changeObjStatus( '%' );
+ }
else if ( event.selection->compare( PkgNames::SourceYes() ) == YO_EQUAL )
{
#ifdef FIXME
- packageList->SourceInstall( true );
+ packageList->SourceInstall( true );
#endif
}
else if ( event.selection->compare( PkgNames::SourceNo() ) == YO_EQUAL )
{
#ifdef FIXME
- packageList->SourceInstall( false );
+ packageList->SourceInstall( false );
#endif
- }
+ }
else if ( event.selection->compare( PkgNames::InstallAll() ) == YO_EQUAL )
{
packageList->changeListObjStatus( NCPkgTable::A_Install );
@@ -1852,9 +1748,9 @@
{
packageList->changeListObjStatus( NCPkgTable::A_DontUpdate );
}
-
+
packageList->setKeyboardFocus();
-
+
return true;
}
@@ -1863,7 +1759,7 @@
// PackageListHandler
//
// Handles actions not directly related to the package list.
-//
+//
bool PackageSelector::PackageListHandler( const NCursesEvent& event )
{
return true;
@@ -1874,7 +1770,7 @@
// DiskinfoHandler
//
// Opens a popup with disk space information.
-//
+//
bool PackageSelector::DiskinfoHandler( const NCursesEvent& event )
{
NCPkgTable * packageList = getPackageList();
@@ -1887,7 +1783,7 @@
{
packageList->setKeyboardFocus();
}
-
+
return true;
}
@@ -1902,7 +1798,7 @@
bool found = false;
// e.g. link is pkg://hp-officeJet
string pkgName = link.substr(6);
-
+
ZyppPoolIterator
b = zyppPkgBegin(),
e = zyppPkgEnd(),
@@ -1925,15 +1821,15 @@
NCERR << "Package " << pkgName << " NOT found" << endl;
// open error popup
}
-
+
return found;
}
///////////////////////////////////////////////////////////////////
//
// testcase handler
-//
-// generate solver testcase
+//
+// generate solver testcase
//
bool PackageSelector::TestcaseHandler ( const NCursesEvent& event )
{
@@ -1949,7 +1845,7 @@
YCPString( "" ),
YCPString( _("Dependency resolver test case written to ") + "<br>" + testCaseDir ) );
info.setNiceSize( 40, 8 );
- info.showInfoPopup( );
+ info.showInfoPopup( );
}
return success;
}
@@ -1957,7 +1853,7 @@
///////////////////////////////////////////////////////////////////
//
// File handler
-//
+//
// export/import all packages and patterns list to/from file
//
bool PackageSelector::FileHandler( const NCursesEvent& event )
@@ -1967,16 +1863,16 @@
return false;
}
- //Export package list into file
- if ( event.selection->compare( PkgNames::ExportToFile() ) == YO_EQUAL )
+ //Export package list into file
+ if ( event.selection->compare( PkgNames::ExportToFile() ) == YO_EQUAL )
{
//Ask for file to save into
- YCPValue filename = YNCursesUI::ui()->askForSaveFileName( YCPString(DEFAULT_EXPORT_FILE_NAME),
- YCPString("*.xml"),
- YCPString(_("Export List of All Packages and Patterns to File" )));
-
- if ( filename->isString() && !filename->asString()->value().empty() )
- {
+ YCPValue filename = YNCursesUI::ui()->askForSaveFileName( YCPString(DEFAULT_EXPORT_FILE_NAME),
+ YCPString("*.xml"),
+ YCPString(_("Export List of All Packages and Patterns to File" )));
+
+ if ( filename->isString() && !filename->asString()->value().empty() )
+ {
zypp::syscontent::Writer writer;
const zypp::ResPool & pool = zypp::getZYpp()->pool();
@@ -1986,21 +1882,21 @@
boost::ref(writer),
_1));
- try
+ try
{
//open file for writing and try to dump syscontent into it
std::ofstream exportFile( filename ->asString()->value_cstr() );
exportFile.exceptions(std::ios_base::badbit | std::ios_base::failbit );
exportFile << writer;
-
+
NCMIL << "Exported list of packages and patterns to " << filename->toString() << endl;
- }
-
+ }
+
catch (std::exception & exception)
{
NCWAR << "Error exporting list of packages and patterns to " << filename->toString() << endl;
- //delete partially written file (don't care if it doesn't exist)
+ //delete partially written file (don't care if it doesn't exist)
(void) unlink( filename->asString()->value_cstr() );
//present error popup to the user
@@ -2012,9 +1908,9 @@
NCursesEvent input = errorMsg.showInfoPopup();
}
-
+
return true;
- }
+ }
}
//Import package list from file
@@ -2026,12 +1922,12 @@
YCPString(_("Import List of All Packages and Patterns from File")));
if ( filename->isString() && !filename->asString()->value().empty() )
- {
+ {
NCPkgTable * packageList = getPackageList();
NCMIL << "Importing list of packages and patterns from " << filename->toString() << endl;
try
- {
+ {
std::ifstream importFile ( filename->asString()->value_cstr() );
zypp::syscontent::Reader reader (importFile);
@@ -2045,32 +1941,32 @@
it ++ )
{
string kind = it->kind();
-
+
// importMapPair => std::pair
- if ( kind == "package" )
+ if ( kind == "package" )
importPkgs.insert( importMapPair( it->name(), *it ) );
- else if ( kind == "pattern" )
+ else if ( kind == "pattern" )
importPatterns.insert( importMapPair( it->name(), *it ) );
- }
+ }
- NCMIL << "Found " << importPkgs.size() << " packages and " << importPatterns.size() << " patterns." << endl;
+ NCMIL << "Found " << importPkgs.size() << " packages and " << importPatterns.size() << " patterns." << endl;
//Change status of appropriate packages and patterns
for (ZyppPoolIterator it = zyppPkgBegin();
- it != zyppPkgEnd();
+ it != zyppPkgEnd();
it++ )
{
ZyppSel selectable = *it;
//isWanted => package name found in importPkgs map
- importSelectable ( *it, importPkgs.find( selectable->name() ) != importPkgs.end(), "package" );
+ importSelectable ( *it, importPkgs.find( selectable->name() ) != importPkgs.end(), "package" );
}
for (ZyppPoolIterator it = zyppPatternsBegin();
- it != zyppPatternsEnd();
+ it != zyppPatternsEnd();
it++ )
{
ZyppSel selectable = *it;
- importSelectable ( *it, importPatterns.find( selectable->name() ) != importPatterns.end(), "pattern" );
+ importSelectable ( *it, importPatterns.find( selectable->name() ) != importPatterns.end(), "pattern" );
}
//Switch to installation summary filter
@@ -2096,12 +1992,12 @@
}
}
}
- return true;
+ return true;
}
///////////////////////////////////////////////////////////////////
//
// HelpHandler
-//
+//
// Show the help popup
//
bool PackageSelector::HelpHandler( const NCursesEvent& event )
@@ -2109,12 +2005,12 @@
NCPkgTable * packageList = getPackageList();
string text = "";
YCPString headline = YCPString(PkgNames::PackageHelp());
-
+
if ( event.selection.isNull() )
{
return false;
}
-
+
if ( event.selection->compare( PkgNames::GeneralHelp() ) == YO_EQUAL )
{
text += PkgNames::HelpPkgInst1();
@@ -2145,7 +2041,7 @@
headline = YCPString(PkgNames::SearchHeadline());
text += PkgNames::HelpOnSearch();
}
-
+
// open the popup with the help text
NCPopupInfo pkgHelp( wpos( 1, 1 ), headline, YCPString( text ) );
pkgHelp.setNiceSize( (NCurses::cols()*65)/100, (NCurses::lines()*85)/100 );
@@ -2155,14 +2051,14 @@
{
packageList->setKeyboardFocus();
}
-
+
return true;
}
///////////////////////////////////////////////////////////////////
//
// YOUHelpHandler
-//
+//
// Show the Online Update Help
//
bool PackageSelector::YouHelpHandler( const NCursesEvent& event )
@@ -2182,14 +2078,14 @@
{
packageList->setKeyboardFocus();
}
-
+
return true;
}
///////////////////////////////////////////////////////////////////
//
// SelectionHandler
-//
+//
// Save/Load selections
//
bool PackageSelector::SelectionHandler( const NCursesEvent& event )
@@ -2200,7 +2096,7 @@
{
return false;
}
-
+
if ( event.selection->compare( PkgNames::SaveSel() ) == YO_EQUAL )
{
filePopup->saveToFile();
@@ -2216,7 +2112,7 @@
{
packageList->setKeyboardFocus();
}
-
+
return true;
}
@@ -2225,7 +2121,7 @@
// CancelHandler
//
// Cancel button handler.
-//
+//
bool PackageSelector::CancelHandler( const NCursesEvent& event )
{
bool changes = diffState ();
@@ -2237,7 +2133,7 @@
YCPString( PkgNames::CancelText() ),
PkgNames::OKLabel(),
PkgNames::CancelLabel() );
- cancelMsg.setNiceSize( 35, 8 );
+ cancelMsg.setNiceSize( 35, 8 );
NCursesEvent input = cancelMsg.showInfoPopup( );
if ( input == NCursesEvent::cancel ) {
// don't leave the package installation dialog
@@ -2249,7 +2145,7 @@
NCMIL << "Cancel button pressed - leaving package selection" << endl;
const_cast(event).result = YCPSymbol("cancel");
-
+
// return false, which means stop the event loop (see runPkgSelection)
return false;
}
@@ -2259,7 +2155,7 @@
// OkButtonHandler
//
// OK button handler.
-//
+//
bool PackageSelector::OkButtonHandler( const NCursesEvent& event )
{
bool closeDialog = true;
@@ -2277,7 +2173,7 @@
}
confirmedAllLicenses = showPendingLicenseAgreements();
-
+
} while ( !confirmedAllLicenses && closeDialog );
if ( !youMode ) // don't show automatic changes if YOU mode
@@ -2292,7 +2188,7 @@
closeDialog = false;
}
}
-
+
if ( diskspacePopup )
{
string message = "";
@@ -2305,8 +2201,8 @@
YCPString( PkgNames::DiskSpaceError() + "<br>" + message ),
PkgNames::OKLabel(),
PkgNames::CancelLabel() );
-
- spaceMsg.setNiceSize( 50, 10 );
+
+ spaceMsg.setNiceSize( 50, 10 );
NCursesEvent input = spaceMsg.showInfoPopup( );
if ( input == NCursesEvent::cancel )
@@ -2323,10 +2219,10 @@
// could free some memory?
// clearSaveState ();
- const_cast(event).result = YCPSymbol("accept");
+ const_cast(event).result = YCPSymbol("accept");
NCMIL << "OK button pressed - leaving package selection, starting installation" << endl;
- // return false, leave the package selection
+ // return false, leave the package selection
return false;
}
else
@@ -2355,7 +2251,7 @@
bool PackageSelector::showPendingLicenseAgreements( ZyppPoolIterator begin, ZyppPoolIterator end )
{
- y2milestone( "Showing all pending license agreements" );
+ NCMIL << "Showing all pending license agreements" << endl;
bool allConfirmed = true;
@@ -2376,7 +2272,8 @@
if ( ! licenseText.empty() )
{
- y2milestone( "Package/Patch %s has a license agreement", sel->name().c_str() );
+ NCMIL << "Package/Patch " << sel->name().c_str() <<
+ "has a license" << endl;
if( ! sel->hasLicenceConfirmed() )
{
@@ -2384,7 +2281,8 @@
}
else
{
- y2milestone( "Package/Patch %s's license is already confirmed", sel->name().c_str() );
+ NCMIL << "License for " << sel->name().c_str() <<
+ " is already confirmed" << endl;
}
}
}
@@ -2422,18 +2320,18 @@
{
case S_Install:
case S_AutoInstall:
- slbPtr->set_status( S_Taboo );
+ slbPtr->setStatus( S_Taboo );
break;
-
+
case S_Update:
case S_AutoUpdate:
- slbPtr->set_status( S_Protected );
+ slbPtr->setStatus( S_Protected );
break;
default:
break;
}
-
+
ok = false;
} else {
NCMIL << "User confirmed license agreement for " << pkgName << endl;
@@ -2464,13 +2362,13 @@
if ( visibleInfo.isNull() )
{
NCERR << "Visible package information NOT set" << endl;
- return false;
- }
+ return false;
+ }
if ( visibleInfo->compare( PkgNames::PatchDescr() ) == YO_EQUAL )
{
string descr;
-
+
descr += PkgNames::Patch();
descr += selectable->name();
descr += " ";
@@ -2487,22 +2385,22 @@
descr += "<br>";
if ( selectable->hasInstalledObj()
- && selectable->installedPoolItem().status().isIncomplete() )
+ && selectable->installedObj().isBroken() )
{
descr += _( "----- this patch is broken !!! -----" );
descr += "<br>";
}
// get and format the patch description
- zypp::Text value = patchPtr->description();
+ string value = patchPtr->description();
descr += createDescrText( value );
-
- // show the description
+
+ // show the description
YWidget * descrInfo = y2ui->widgetWithId( PkgNames::Description(), true );
-
+
if ( descrInfo )
{
static_cast(descrInfo)->setText( YCPString( descr ) );
- }
+ }
}
else if ( visibleInfo->compare( PkgNames::PatchPackages() ) == YO_EQUAL )
{
@@ -2520,7 +2418,7 @@
fillPatchPackages ( patchPkgsVersions, objPtr, true);
}
}
-
+
return true;
}
@@ -2534,7 +2432,7 @@
bool PackageSelector::showPackageDependencies ( bool doit )
{
bool cancel = false;
-
+
if ( depsPopup
&& (doit || autoCheck) )
{
@@ -2597,22 +2495,22 @@
NCERR << "Selectable not valid" << endl;
return false;
}
-
+
if ( visibleInfo.isNull() )
{
NCERR << "Visible package information NOT set" << endl;
- return false;
+ return false;
}
if ( visibleInfo->compare( PkgNames::LongDescr() ) == YO_EQUAL )
{
// ask the package manager for the description of this package
- zypp::Text value = pkgPtr->description();
+ string value = pkgPtr->description();
string descr = createDescrText( value );
- // show the description
+ // show the description
YWidget * descrInfo = y2ui->widgetWithId( PkgNames::Description(), true );
-
+
if ( descrInfo )
{
static_cast(descrInfo)->setText( YCPString(descr) );
@@ -2627,26 +2525,26 @@
if ( package )
{
// get the file list from the package manager/show the list
- list<string> fileList = package->filenames();
- text += createText( fileList, false ) ;
+ zypp::Package::FileList fileList = package->filelist();
+ text += createText( fileList.begin(), fileList.end(), false ) ;
}
-
- // get the widget id
- YWidget * descrInfo = y2ui->widgetWithId( PkgNames::Description(), true );
+
+ // get the widget id
+ YWidget * descrInfo = y2ui->widgetWithId( PkgNames::Description(), true );
if ( descrInfo )
{
static_cast(descrInfo)->setText( YCPString(text) );
- }
+ }
}
else if ( visibleInfo->compare( PkgNames::PkgInfo() ) == YO_EQUAL )
{
string instVersion = "";
string version = "";
string text = "";
-
+
text += slbPtr->name();
text += " - ";
-
+
text += pkgPtr->summary();
text += "<br>";
@@ -2665,9 +2563,9 @@
{
version = pkgPtr->edition().version();
version += "-";
- version += pkgPtr->edition().release();
+ version += pkgPtr->edition().release();
}
-
+
text += PkgNames::Version();
text += version;
if ( instVersion != "" )
@@ -2677,22 +2575,22 @@
text += instVersion;
}
text += " ";
-
+
// show the size
text += PkgNames::Size();
- text += pkgPtr->size().asString();
+ text += pkgPtr->installSize().asString();
text += " ";
-
+
ZyppPkg package = tryCastToZyppPkg (pkgPtr);
if ( package )
{
// add the media nr
text += PkgNames::MediaNo();
char num[5];
- int medianr = package->sourceMediaNr ();
+ int medianr = package->location().medianr();
sprintf( num, "%d", medianr );
text += num;
- text += "<br>";
+ text += "<br>";
// the license
text += PkgNames::License();
@@ -2705,10 +2603,10 @@
text += package->group ();
text += "<br>";
}
-
+
// show Provides:
text += PkgNames::Provides();
- zypp::CapSet provides = package->dep (zypp::Dep::PROVIDES);
+ zypp::Capabilities provides = package->dep (zypp::Dep::PROVIDES);
text += createRelLine(provides);
text += "<br>";
@@ -2716,11 +2614,11 @@
if ( package )
{
text += PkgNames::Authors();
- list<string> authors = package->authors(); // zypp::Package
- text += createText( authors, true );
+ list<string> authors = package->authors(); // zypp::Package
+ text += createText( authors.begin(), authors.end(), true );
}
-
- // show the description
+
+ // show the description
YWidget * descrInfo = y2ui->widgetWithId( PkgNames::Description(), true );
if ( descrInfo )
@@ -2753,14 +2651,13 @@
zypp::Dep::OBSOLETES,
zypp::Dep::RECOMMENDS,
zypp::Dep::SUGGESTS,
- zypp::Dep::FRESHENS,
zypp::Dep::ENHANCES,
zypp::Dep::SUPPLEMENTS,
};
for (size_t i = 0; i < sizeof (deptypes)/sizeof(deptypes[0]); ++i)
{
zypp::Dep deptype = deptypes[i];
- zypp::CapSet relations = pkgPtr->dep (deptype);
+ zypp::Capabilities relations = pkgPtr->dep (deptype);
string relline = createRelLine (relations);
if (!relline.empty ())
{
@@ -2769,18 +2666,18 @@
+ relline + "<br>";
}
}
-
- // show the package relations
+
+ // show the package relations
YWidget * descrInfo = y2ui->widgetWithId( PkgNames::Description(), true );
-
+
if ( descrInfo )
{
static_cast(descrInfo)->setText( YCPString( text ) );
}
}
-
+
NCDBG << "Showing package information: " << visibleInfo->toString() << endl;
-
+
return true;
}
@@ -2790,10 +2687,10 @@
//
#define DOCTYPETAG "<!-- DT:Rich -->"
-string PackageSelector::createDescrText( zypp::Text value )
+string PackageSelector::createDescrText( const string & value )
{
string html_text = "";
-
+
#ifdef FIXME
bool author_format = false;
bool htmlFormat = false; /* Is the description coming in html? */
@@ -2802,7 +2699,7 @@
* to be formatted in html. The yast (this method here) needs not to
* do further formatting for the text part.
*/
-
+
list<string>::const_iterator it = value.begin();
string line;
@@ -2853,15 +2750,15 @@
else
{
html_text += " ";
- }
+ }
}
-
+
++it;
}
#else
html_text = value;
#endif
-
+
return html_text;
}
@@ -2879,19 +2776,15 @@
}
}
-///////////////////////////////////////////////////////////////////
-//
-// createProvides
-//
-string PackageSelector::createRelLine( const zypp::CapSet & info )
+string PackageSelector::createRelLine( const zypp::Capabilities & info )
{
string text = "";
- zypp::CapSet::const_iterator
+ zypp::Capabilities::const_iterator
b = info.begin (),
e = info.end (),
it;
unsigned int i, n = info.size();
-
+
for ( it = b, i = 0; it != e; ++it, ++i )
{
text = text + (*it).asString();
@@ -2904,40 +2797,6 @@
return text;
}
-
-///////////////////////////////////////////////////////////////////
-//
-// createText
-//
-string PackageSelector::createText( list<string> info, bool oneline )
-{
- list<string>::iterator it;
- string text = "";
- unsigned int i;
-
- for ( i = 0, it = info.begin(); it != info.end() && i < 1000; ++it, i++ )
- {
- text += (*it);
- if ( i < info.size()-1 )
- {
- if ( oneline && i < 999 )
- {
- text += ", ";
- }
- else
- {
- text += "<br>";
- }
- }
- if ( i == 999 )
- {
- text += "...";
- }
- }
-
- return text;
-}
-
static
ostream & operator << (ostream & s, zypp::DiskUsageCounter::MountPoint mp)
{
@@ -2971,14 +2830,14 @@
zypp::ByteCount diff = 0;
for (it = b; it != e; ++it)
{
- UIMIL << *it << endl;
+ //NCMIL << *it << endl;
diff += (it->pkg_size - it->used_size) * 1024;
}
// show pkg_diff, i.e. total difference of disk space (can be negative in installed system
// if packages are deleted)
YCPString label( diff.asString () );
-
+
// show the required diskspace
YWidget * diskSpace = y2ui->widgetWithId( PkgNames::Diskspace(), true );
if ( diskSpace )
@@ -3010,18 +2869,17 @@
if ( patch )
{
- ZyppPatchContents patchContents( patch );
+ zypp::Patch::Contents patchContents(patch->contents());
- for ( ZyppPatchContentsIterator contents_it = patchContents.begin();
- contents_it != patchContents.end();
- ++contents_it )
- {
- ZyppPkg pkg = tryCastToZyppPkg( *contents_it );
- ZyppSel sel;
-
- if ( pkg )
- sel = selMapper.findZyppSel( pkg );
-
+ for ( ZyppPatchContentsIterator contents_it = patchContents.selectableBegin();
+ contents_it != patchContents.selectableEnd();
+ ++contents_it )
+ {
+ ZyppPkg pkg = tryCastToZyppPkg( (*contents_it)->theObj() );
+ ZyppSel sel;
+
+ if ( pkg )
+ sel = selMapper.findZyppSel( pkg );
if ( sel )
{
@@ -3063,7 +2921,7 @@
++it )
{
if ( (*it)->candidateObj() )
- totalSize += (*it)->candidateObj()->size();
+ totalSize += (*it)->candidateObj()->downloadSize();
}
YCPString label( totalSize.asString() );
@@ -3084,6 +2942,6 @@
NCPkgTable * PackageSelector::getPackageList()
{
YWidget * packages = y2ui->widgetWithId( PkgNames::Packages(), true );
-
+
return ( dynamic_cast(packages) );
}
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.h?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.h (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/PackageSelector.h Mon May 23 21:27:16 2011
@@ -24,7 +24,7 @@
#include "YNCursesUI.h"
#include "PkgNames.h"
-#include <map>
+#include <map>
#include <string>
#include <utility> // for STL pair
@@ -68,7 +68,7 @@
typedef std::map tHandlerMap;
tHandlerMap eventHandlerMap; // event handler map
-
+
YNCursesUI * y2ui; // the UI
YCPValue visibleInfo; // visible package info (description, file list, ...)
@@ -85,21 +85,21 @@
NCPopupSearch * searchPopup; // the package search popup
NCPopupFile * filePopup; // the save/load selection popup
-
+
bool youMode; // YOU
bool updateMode; // Update
bool testMode; // testing
-
+
bool autoCheck; // flag for automatic dependency check on/off
YRpmGroupsTree * _rpmGroupsTree; // rpm groups of the found packages
-
- // internal helper functions (format list of string)
- string createRelLine( const zypp::CapSet & info );
+
+ // internal helper functions (format list of string)
+ string createRelLine( const zypp::Capabilities & info );
// internal use (copies tree items got from YPkgRpmGroupTagsFilterView)
void cloneTree( YStringTreeItem * parentOrig, YTreeItem * parentClone );
- // the package (patch) list
+ // the package (patch) list
NCPkgTable * getPackageList();
// Mapping from ZyppPkg to the correspoinding ZyppSel.
@@ -123,9 +123,9 @@
/**
* Destructor
- */
+ */
virtual ~PackageSelector();
-
+
/**
* Fills the package table
* @param label The selected RPM group (the label)
@@ -141,7 +141,7 @@
* @return bool
*/
bool fillPatchList( string filter );
-
+
/**
* Fills the package table with packages with update problems
* @return bool
@@ -149,15 +149,15 @@
bool fillUpdateList( );
/**
- * Fills the package table with a summary packages
+ * Fills the package table with a summary packages
* @return bool
*/
bool fillSummaryList( NCPkgTable::NCPkgTableListType type );
-
+
/**
* Fills the list of available packages
* @param table The table widget
- * @param selectable Show all available versions of this package
+ * @param selectable Show all available versions of this package
* @return bool
*/
bool fillAvailableList( NCPkgTable *table, ZyppSel selectable );
@@ -168,9 +168,9 @@
* @param youPatch Show all packages belonging to the patch
* @param versions Show all versions of all packages belonging to the patch
* @return bool
- */
+ */
bool fillPatchPackages ( NCPkgTable * pkgTable, ZyppObj youPatch, bool versions = false );
-
+
/**
* Fills the package table with packages matching the search expression
* @param expr The search expression
@@ -180,7 +180,7 @@
* @param checkProvides Check in Provides (true or false)
* @param checkRequires Check in Requires (true or false)
* @return bool
- */
+ */
bool fillSearchList( const YCPString & expr,
bool ignoreCase,
bool checkName,
@@ -190,7 +190,7 @@
bool checkRequires );
bool fillPatchSearchList( const YCPString & expr );
-
+
bool isYouMode() { return youMode; }
/**
* Gets default RPM group (the first group)
@@ -231,7 +231,7 @@
* @return bool
*/
bool SelectionHandler( const NCursesEvent& event );
-
+
/**
* Handler function for the "Information" menu
* @param event The Ncurses event
@@ -254,7 +254,7 @@
/**
* Handler function for "OK button pressed"
* @param event The Ncurses event
- * @return bool
+ * @return bool
*/
bool OkButtonHandler ( const NCursesEvent& event );
@@ -271,26 +271,26 @@
* @return bool
*/
bool DiskinfoHandler ( const NCursesEvent& event );
-
+
/**
* Handler function for the package list which handles events not directly
* related to the list. Most events are handled in NCPkgTable itself.
* @param event The Ncurses event
* @return bool
- */
+ */
bool PackageListHandler( const NCursesEvent& event );
/**
* Handler function for the "Filter" menu
* @param event The Ncurses event
- * @return bool
+ * @return bool
*/
bool FilterHandler( const NCursesEvent& event );
/**
* Handler function for the "Action" menu (changes the package status)
* @param event The Ncurses event
- * @return bool
+ * @return bool
*/
bool StatusHandler( const NCursesEvent& event );
@@ -314,7 +314,7 @@
* @return bool
*/
bool LinkHandler ( string link );
-
+
/**
* Gets the required package info from package manager and shows it
* ( called from NCPkgTable )
@@ -333,12 +333,12 @@
* Verifies and shows the dependencies
*/
bool verifyPackageDependencies ();
-
+
/**
* Checks and shows the selectiondependencies
*/
void showSelectionDependencies ( );
-
+
/**
* Gets the required patch info from you patch manager and shows it
@@ -347,7 +347,7 @@
*/
bool showPatchInformation ( ZyppObj pkgPtr, ZyppSel slbPtr );
-
+
/**
* Sets the member variable to the currently visible information
* @param info
@@ -366,11 +366,11 @@
* Updates the status in list of packages
*/
void updatePackageList();
-
+
/**
* Check if 'pkg' matches 'selectedRpmGroup'.
* Returns true if there is a match, false otherwise or if 'pkg' is 0.
- * @return bool
+ * @return bool
**/
bool checkPackage( ZyppObj pkg, ZyppSel slb, YStringTreeItem * rpmGroup );
@@ -380,22 +380,22 @@
* @return bool
**/
bool checkPatch( ZyppPatch patch, ZyppSel selectable, string filter );
-
+
/**
- * Set status of a selectable according to its presence
+ * Set status of a selectable according to its presence
* in the list imported from xml file (zypp::syscontent::Reader)
- *
+ *
* @param selectable a selectable
* @param isWanted should be installed or not
- * @param kind "package" or "pattern"
- * @return void
+ * @param kind "package" or "pattern"
+ * @return void
**/
void importSelectable ( ZyppSel selectable, bool isWanted, const char* kind );
-
+
/**
* Returns whether automatic dependency is on or off
- * @return bool
- */
+ * @return bool
+ */
bool autoChecking() { return autoCheck; }
/**
@@ -403,14 +403,44 @@
* @param oneline true: create one line, items seperated by comma; false: every string is a line
* @return string The text
*/
- string createText( list<string> info, bool oneline );
+ template <class InputIterator>
+ std::string createText( InputIterator begin, InputIterator end, bool oneline )
+ {
+ string text = "";
+ unsigned int i;
+ InputIterator it;
+
+ for ( i = 0, it = begin; it != end && i < 1000; ++it, i++ )
+ {
+ text += (*it);
+ InputIterator next(it);
+ if ( ++next == end )
+ {
+ if ( oneline && i < 999 )
+ {
+ text += ", ";
+ }
+ else
+ {
+ text += "<br>";
+ }
+ }
+ if ( i == 999 )
+ {
+ text += "...";
+ }
+ }
+
+ return text;
+ }
+
/**
* Creates a text from a list of strings which may contain HTML tags
* @param t used to be list, now a single string. but what does it contain?
* @return string The text
*/
- string createDescrText( zypp::Text t );
+ string createDescrText( const string & t );
/**
* Used for package search
@@ -422,12 +452,12 @@
/**
* Calls the package mananager (updateDu()) and shows the required disk space
- */
+ */
void showDiskSpace();
/**
* Shows the total download size
- */
+ */
void showDownloadSize();
/**
@@ -446,9 +476,9 @@
/**
* Show popup with license.
* @return bool
- */
+ */
bool showLicenseAgreement( ZyppSel & slbPtr , string licenseText );
-
+
void createFilterMenu();
/**
@@ -456,7 +486,7 @@
* (usually via 'verify system' call)
* @return std::set <string>
*/
- set <string> getVerifiedPkgs()
+ set <string> getVerifiedPkgs()
{
return verified_pkgs;
}
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/YNCursesUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/YNCursesUI.cc?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/YNCursesUI.cc (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/YNCursesUI.cc Mon May 23 21:27:16 2011
@@ -26,7 +26,7 @@
#include
#include
-#include
+//#include
#include
#include
#include
@@ -87,11 +87,11 @@
setenv( "LC_CTYPE", locale.c_str(), 1 );
NCMIL << "setenv LC_CTYPE: " << locale << " encoding: " << encoding << endl;
-
+
// The encoding of a terminal (xterm, konsole usw. ) can never change; the encoding
- // of "real" console is changed in setConsoleFont().
+ // of "real" console is changed in setConsoleFont().
NCstring::setTerminalEncoding( encoding );
-
+
setLanguage( language );
}
@@ -106,7 +106,7 @@
if ( macro_file )
playMacro( macro_file );
-
+
topmostConstructorHasFinished();
}
@@ -201,19 +201,19 @@
{
// Note: libyui assumes ownership of YEvents, so they need to be
// created on the heap with 'new'. libyui takes care of deleting them.
-
+
case button:
if ( widget->isValid() )
return new YWidgetEvent( dynamic_cast (widget), reason );
else
return 0;
-
+
case menu:
return new YMenuEvent( selection );
-
+
case cancel:
return new YCancelEvent();
-
+
case timeout:
return new YTimeoutEvent();
@@ -222,17 +222,17 @@
return new YKeyEvent( keySymbol, dynamic_cast (widget) );
else
return 0;
-
+
case none:
case handled:
return 0;
// Intentionally omitting 'default' branch so the compiler can
- // detect unhandled enums
+ // detect unhandled enums
}
// If we get this far, there must be an error.
-
+
UIINT << "Can't propagate through (EventType*)0" << endl;
UIDBG << *this << endl;
return 0;
@@ -263,7 +263,7 @@
YEvent * yevent = cevent.propagate();
UIDBG << "Returning event: " << ( yevent ? yevent->ycpEvent()->toString().c_str() : "(nil)" ) << endl;
-
+
return yevent;
}
@@ -755,7 +755,7 @@
Refresh();
NCDBG << "Language: " << language << " Encoding: " << ((encoding!="")?encoding:"NOT SET") << endl;
-
+
return true;
}
@@ -792,9 +792,9 @@
//
int YNCursesUI::runInTerminal( const YCPString & module )
-{
+{
int ret;
- string cmd = module->value();
+ string cmd = module->value();
//Save tty modes and end ncurses mode temporarily
::def_prog_mode();
@@ -891,13 +891,13 @@
string code = language2encoding( language );
NCMIL << "setConsoleFont( ENCODING: " << code << " )" << endl;
-
+
if ( NCstring::setTerminalEncoding( code ) )
{
Redraw();
}
else
- {
+ {
Refresh();
}
}
@@ -997,7 +997,7 @@
const YCPString & headline )
{
NCAskForSaveFileName filePopup( wpos( 1, 1 ), startDir, filter, headline );
-
+
NCursesEvent retEvent = filePopup.showDirPopup( );
if ( !retEvent.result.isNull() )
@@ -1006,7 +1006,7 @@
return retEvent.result;
}
else
- return YCPVoid(); // nothing selected -> return 'nil'
+ return YCPVoid(); // nothing selected -> return 'nil'
}
///////////////////////////////////////////////////////////////////
@@ -1022,7 +1022,7 @@
const YCPString & headline )
{
NCAskForExistingFile filePopup( wpos( 1, 1 ), startDir, filter, headline );
-
+
NCursesEvent retEvent = filePopup.showDirPopup( );
if ( !retEvent.result.isNull() )
@@ -1031,7 +1031,7 @@
return retEvent.result;
}
else
- return YCPVoid(); // nothing selected -> return 'nil'
+ return YCPVoid(); // nothing selected -> return 'nil'
}
///////////////////////////////////////////////////////////////////
@@ -1046,7 +1046,7 @@
const YCPString & headline )
{
NCAskForExistingDirectory dirPopup( wpos( 1, 1 ), startDir, headline );
-
+
NCursesEvent retEvent = dirPopup.showDirPopup( );
if ( !retEvent.result.isNull() )
Modified: branches/tmp/dmacvicar/zc10/ncurses/src/YQZypp.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/ncurses/src/YQZypp.h?rev=64090&r1=64089&r2=64090&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/ncurses/src/YQZypp.h (original)
+++ branches/tmp/dmacvicar/zc10/ncurses/src/YQZypp.h Mon May 23 21:27:16 2011
@@ -10,40 +10,39 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: YQZypp.h
+ File: NCZypp.h
Author: Stefan Hundhammer
/-*/
-// -*- c++ -*-
-
-#ifndef YQZypp_h
-#define YQZypp_h
+#ifndef Yqzypp_h
+#define Yqzypp_h
#include <set>
#include
#include
#include
#include
-#include
#include
-#include
+#include
+//#include
#include
#include
#include
+#include
-using zypp::ui::S_Protected;
-using zypp::ui::S_Taboo;
-using zypp::ui::S_Del;
-using zypp::ui::S_Update;
-using zypp::ui::S_Install;
-using zypp::ui::S_AutoDel;
-using zypp::ui::S_AutoUpdate;
-using zypp::ui::S_AutoInstall;
-using zypp::ui::S_KeepInstalled;
-using zypp::ui::S_NoInst;
+using zypp::ui::S_Protected;
+using zypp::ui::S_Taboo;
+using zypp::ui::S_Del;
+using zypp::ui::S_Update;
+using zypp::ui::S_Install;
+using zypp::ui::S_AutoDel;
+using zypp::ui::S_AutoUpdate;
+using zypp::ui::S_AutoInstall;
+using zypp::ui::S_KeepInstalled;
+using zypp::ui::S_NoInst;
//
@@ -54,13 +53,15 @@
typedef zypp::ui::Selectable::Ptr ZyppSel;
typedef zypp::ResObject::constPtr ZyppObj;
typedef zypp::Package::constPtr ZyppPkg;
-typedef zypp::Selection::constPtr ZyppSelection;
typedef zypp::Pattern::constPtr ZyppPattern;
-typedef zypp::Language::constPtr ZyppLang;
+//typedef zypp::Language::constPtr ZyppLang;
typedef zypp::Patch::constPtr ZyppPatch;
+typedef zypp::Product::constPtr ZyppProduct;
+typedef zypp::Repository ZyppRepo;
typedef zypp::ResPoolProxy ZyppPool;
typedef zypp::ResPoolProxy::const_iterator ZyppPoolIterator;
+typedef zypp::ResPoolProxy::repository_iterator ZyppRepositoryIterator;
inline ZyppPool zyppPool() { return zypp::getZYpp()->poolProxy(); }
@@ -71,46 +72,49 @@
inline ZyppPoolIterator zyppPkgBegin() { return zyppBeginzypp::Package(); }
inline ZyppPoolIterator zyppPkgEnd() { return zyppEndzypp::Package(); }
-inline ZyppPoolIterator zyppSelectionsBegin() { return zyppBeginzypp::Selection(); }
-inline ZyppPoolIterator zyppSelectionsEnd() { return zyppEndzypp::Selection(); }
-
inline ZyppPoolIterator zyppPatternsBegin() { return zyppBeginzypp::Pattern(); }
inline ZyppPoolIterator zyppPatternsEnd() { return zyppEndzypp::Pattern(); }
-inline ZyppPoolIterator zyppLangBegin() { return zyppBeginzypp::Language(); }
-inline ZyppPoolIterator zyppLangEnd() { return zyppEndzypp::Language(); }
+//inline ZyppPoolIterator zyppLangBegin() { return zyppBeginzypp::Language(); }
+//inline ZyppPoolIterator zyppLangEnd() { return zyppEndzypp::Language(); }
inline ZyppPoolIterator zyppPatchesBegin() { return zyppBeginzypp::Patch(); }
inline ZyppPoolIterator zyppPatchesEnd() { return zyppEndzypp::Patch(); }
+inline ZyppPoolIterator zyppProductsBegin() { return zyppBeginzypp::Product(); }
+inline ZyppPoolIterator zyppProductsEnd() { return zyppEndzypp::Product(); }
+
+inline ZyppRepositoryIterator ZyppRepositoriesBegin() { return zyppPool().knownRepositoriesBegin(); }
+inline ZyppRepositoryIterator ZyppRepositoriesEnd() { return zyppPool().knownRepositoriesEnd(); }
+
inline ZyppPkg tryCastToZyppPkg( ZyppObj zyppObj )
{
return zypp::dynamic_pointer_cast<const zypp::Package>( zyppObj );
}
-inline ZyppSelection tryCastToZyppSelection( ZyppObj zyppObj )
-{
- return zypp::dynamic_pointer_cast<const zypp::Selection>( zyppObj );
-}
-
inline ZyppPattern tryCastToZyppPattern( ZyppObj zyppObj )
{
return zypp::dynamic_pointer_cast<const zypp::Pattern>( zyppObj );
}
+#if 0
inline ZyppLang tryCastToZyppLang( ZyppObj zyppObj )
{
return zypp::dynamic_pointer_cast<const zypp::Language>( zyppObj );
}
-
+#endif
inline ZyppPatch tryCastToZyppPatch( ZyppObj zyppObj )
{
return zypp::dynamic_pointer_cast<const zypp::Patch>( zyppObj );
}
+inline ZyppProduct tryCastToZyppProduct( ZyppObj zyppObj )
+{
+ return zypp::dynamic_pointer_cast<const zypp::Product>( zyppObj );
+}
-template<typename T> bool contains( const std::set<T> & container, T search )
+template<typename T> bool inContainer( const std::set<T> & container, T search )
{
return container.find( search ) != container.end();
}
@@ -121,5 +125,8 @@
return binary_search( sorted_vector.begin(), sorted_vector.end(), search);
}
-
-#endif // YQZypp_h
+inline bool sortByName( ZyppSel ptr1, ZyppSel ptr2 )
+{
+ return( ptr1->name() < ptr2->name() );
+}
+#endif // Yqzypp_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org