Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

PackageSelector.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       PackageSelector.h
00014 
00015    Author:     Gabriele Strattner <gs@suse.de>
00016    Maintainer: Michael Andres <ma@suse.de>
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>      // for STL pair
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 //      CLASS NAME : PackageSelector
00051 //
00052 //      DESCRIPTION : holds the data and handles events
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     // typedef for the pointer to handler member function
00065     typedef bool (PackageSelector::* tHandlerFctPtr) ( const NCursesEvent& event );
00066 
00067     // typedef for the internal map: key=nameId, value=handler-fct-ptr
00068     typedef std::map<std::string, tHandlerFctPtr> tHandlerMap;
00069 
00070     tHandlerMap eventHandlerMap;        // event handler map
00071     
00072     YNCursesUI * y2ui;                  // the UI
00073 
00074     YCPValue visibleInfo;               // visible package info (description, file list, ...)
00075 
00076     NCPopupTree * filterPopup;          // the rpm group tags popup
00077 
00078     NCPopupPkgDeps * pkgDepsPopup;      // the package dependeny popup
00079 
00080     NCPopupSelDeps * selDepsPopup;      // the selection dependency popup
00081     
00082     NCPopupSelection * selectionPopup;  // the selections popup
00083 
00084     NCPopupDiskspace * diskspacePopup;  // the popup showing the disk usage
00085 
00086     NCPopupSearch * searchPopup;        // the package search popup
00087 
00088     NCPopupFile * filePopup;            // the save/load selection popup
00089     
00090     bool youMode;                       // YOU
00091     bool updateMode;                    // Update
00092 
00093     bool autoCheck;                     // flag for automatic dependency check on/off
00094     
00095     // internal helper functions (format list of string) 
00096     string createRelLine( list<PkgRelation> info );
00097 
00098     // internal use (copies tree items got from YPkgRpmGroupTagsFilterView)
00099     void cloneTree( YStringTreeItem * parentOrig, YTreeItem * parentClone );
00100 
00101     // the package (patch) list 
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

Generated on Wed Sep 5 17:18:55 2007 for yast2-ncurses by doxygen 1.3.6