00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PackageSelector_h
00020 #define PackageSelector_h
00021
00022 #include <iosfwd>
00023
00024 #include "YNCursesUI.h"
00025 #include "PkgNames.h"
00026
00027 #include <map>
00028 #include <string>
00029 #include <utility>
00030
00031 #include <y2util/YRpmGroupsTree.h>
00032
00033 #include <y2pm/PMObject.h>
00034 #include <y2pm/PMSelectable.h>
00035 #include <y2pm/PMYouPatch.h>
00036
00037 #include "NCPopupTree.h"
00038 #include "NCPkgTable.h"
00039
00040 class NCPopupSelection;
00041 class LangCode;
00042 class NCPopupPkgDeps;
00043 class NCPopupSelDeps;
00044 class NCPopupDiskspace;
00045 class NCPopupSearch;
00046 class NCPopupFile;
00047
00049
00050
00051
00052
00053
00054 class PackageSelector
00055 {
00056
00057 friend std::ostream & operator<<( std::ostream & STREAM, const PackageSelector & OBJ );
00058
00059 PackageSelector & operator=( const PackageSelector & );
00060 PackageSelector ( const PackageSelector & );
00061
00062 private:
00063
00064
00065 typedef bool (PackageSelector::* tHandlerFctPtr) ( const NCursesEvent& event );
00066
00067
00068 typedef std::map<std::string, tHandlerFctPtr> tHandlerMap;
00069
00070 tHandlerMap eventHandlerMap;
00071
00072 YNCursesUI * y2ui;
00073
00074 YCPValue visibleInfo;
00075
00076 NCPopupTree * filterPopup;
00077
00078 NCPopupPkgDeps * pkgDepsPopup;
00079
00080 NCPopupSelDeps * selDepsPopup;
00081
00082 NCPopupSelection * selectionPopup;
00083
00084 NCPopupDiskspace * diskspacePopup;
00085
00086 NCPopupSearch * searchPopup;
00087
00088 NCPopupFile * filePopup;
00089
00090 bool youMode;
00091 bool updateMode;
00092
00093 bool autoCheck;
00094
00095
00096 string createRelLine( list<PkgRelation> info );
00097
00098
00099 void cloneTree( YStringTreeItem * parentOrig, YTreeItem * parentClone );
00100
00101
00102 NCPkgTable * getPackageList();
00103
00104 protected:
00105
00106
00107 public:
00108
00116 PackageSelector( YNCursesUI * ui, const YWidgetOpt & opt, string floppyDevice );
00117
00121 virtual ~PackageSelector();
00122
00129 bool fillPackageList( const YCPString & label, YStringTreeItem * group );
00130
00136 bool fillPatchList( string filter,
00137 PMYouPatch::Kind kind = PMYouPatch::kind_all);
00138
00143 bool fillUpdateList( );
00144
00149 bool fillSummaryList( NCPkgTable::NCPkgTableListType type );
00150
00157 bool fillAvailableList( NCPkgTable *table, PMObjectPtr pkgPtr );
00158
00165 bool fillPatchPackages ( NCPkgTable * pkgTable, PMObjectPtr youPatch );
00166
00177 bool fillSearchList( const YCPString & expr,
00178 bool ignoreCase,
00179 bool checkName,
00180 bool checkSummary,
00181 bool checkDescr,
00182 bool checkProvides,
00183 bool checkRequires );
00184
00189 YStringTreeItem * getDefaultRpmGroup() { return filterPopup->getDefaultGroup(); }
00190
00197 bool handleEvent( const NCursesEvent& event );
00198
00204 bool SearchHandler ( const NCursesEvent& event );
00205
00211 bool DependencyHandler( const NCursesEvent& event );
00212
00218 bool SelectionHandler( const NCursesEvent& event );
00219
00225 bool InformationHandler ( const NCursesEvent& event );
00226
00232 bool OkButtonHandler ( const NCursesEvent& event );
00233
00239 bool CancelHandler ( const NCursesEvent& event );
00240
00246 bool DiskinfoHandler ( const NCursesEvent& event );
00247
00254 bool PackageListHandler( const NCursesEvent& event );
00255
00261 bool FilterHandler( const NCursesEvent& event );
00262
00268 bool StatusHandler( const NCursesEvent& event );
00269
00275 bool HelpHandler( const NCursesEvent& event );
00276
00282 bool YouHelpHandler( const NCursesEvent& event );
00283
00289 bool LinkHandler ( string link );
00290
00297 bool showPackageInformation ( PMObjectPtr pkgPtr );
00298
00304 bool showConcretelyPkgDependency ( int index );
00305
00311 bool showConcretelySelDependency ( int index );
00312
00317 bool showPackageDependencies ( bool doit );
00318
00322 void showSelectionDependencies ( );
00323
00329 bool showPatchInformation ( PMObjectPtr pkgPtr );
00330
00335 void setVisibleInfo( const YCPValue & info );
00336
00343 bool showSelPackages( const YCPString & label, PMSelectionPtr selPtr );
00344
00348 void updatePackageList();
00349
00355 bool checkPackage( PMPackagePtr pkg, YStringTreeItem * rpmGroup );
00356
00362 bool checkPatch( PMYouPatchPtr patch, string filter, PMYouPatch::Kind kind );
00363
00368 bool autoChecking() { return autoCheck; }
00369
00375 string createText( list<string> info, bool oneline );
00376
00381 string createDescrText( list<string> info );
00382
00389 bool match( string s1, string s2, bool ignoreCase );
00390
00394 void showDiskSpace();
00395
00399 void showDownloadSize();
00400 };
00401
00403
00404 #endif // PackageSelector_h