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

YQPkgList.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:       YQPkgList.h
00014 
00015   Author:     Stefan Hundhammer <sh@suse.de>
00016 
00017 /-*/
00018 
00019 // -*- c++ -*-
00020 
00021 
00022 #ifndef YQPkgList_h
00023 #define YQPkgList_h
00024 
00025 #include <YQPkgObjList.h>
00026 #include <y2pm/PMPackage.h>
00027 
00028 
00029 class YQPkgListItem;
00030 
00031 
00035 class YQPkgList : public YQPkgObjList
00036 {
00037     Q_OBJECT
00038 
00039 public:
00040 
00044     YQPkgList( QWidget * parent );
00045 
00049     virtual ~YQPkgList();
00050 
00051 
00052     // Column numbers
00053 
00054     int srpmStatusCol()         const   { return _srpmStatusCol;        }
00055 
00062     void exportList( const QString filename, bool interactive ) const;
00063 
00070     virtual QPopupMenu * addAllInListSubMenu( QPopupMenu * menu );
00071 
00072 
00073 public slots:
00074 
00080     void addPkgItem( PMPackagePtr pmPkg );
00081 
00082 
00088     virtual void pkgObjClicked( int             button,
00089                                 QListViewItem * item,
00090                                 int             col,
00091                                 const QPoint &  pos );
00092 
00098     virtual void updateActions( YQPkgObjListItem * item );
00099 
00104     virtual QSize sizeHint() const;
00105 
00109     void askExportList() const;
00110 
00111 
00112     // Direct access to some states for menu actions
00113 
00114     void setInstallCurrentSourceRpm()     { setInstallCurrentSourceRpm( true  ); }
00115     void setDontInstallCurrentSourceRpm() { setInstallCurrentSourceRpm( false ); }
00116 
00117     void setInstallListSourceRpms()       { setInstallListSourceRpms( true  ); }
00118     void setDontInstallListSourceRpms()   { setInstallListSourceRpms( false ); }
00119 
00120 
00121     // No separate selectionChanged( PMPackagePtr ) signal:
00122     // Use YQPkgObjList::selectionChanged( PMObjectPtr ) instead
00123     // and dynamic_cast to PMPackagePtr if required.
00124     // This saves duplicating a lot of code.
00125 
00126 
00127 protected:
00128 
00132     void createActions();
00133     
00139     virtual void createNotInstalledContextMenu();
00140 
00146     virtual void createInstalledContextMenu();
00147 
00151     void createSourceRpmContextMenu();
00152 
00157     void setInstallCurrentSourceRpm( bool inst, bool selectNextItem = false );
00158 
00162     void setInstallListSourceRpms( bool inst );
00163 
00164 
00165     // Data members
00166 
00167     int                 _srpmStatusCol;
00168     QPopupMenu *        _sourceRpmContextMenu;
00169 
00170 
00171 public:
00172 
00173     QAction *           actionInstallSourceRpm;
00174     QAction *           actionDontInstallSourceRpm;
00175     QAction *           actionInstallListSourceRpms;
00176     QAction *           actionDontInstallListSourceRpms;
00177 };
00178 
00179 
00180 
00181 class YQPkgListItem: public YQPkgObjListItem
00182 {
00183 public:
00184 
00189     YQPkgListItem( YQPkgList * pkgList, PMPackagePtr pmPkg );
00190 
00194     virtual ~YQPkgListItem();
00195 
00199     YQPkgList * pkgList() { return _pkgList; }
00200 
00204     PMPackagePtr pmPkg() { return _pmPkg; }
00205 
00209     const PMPackagePtr constPMPkg() const { return _pmPkg; }
00210 
00215     bool installSourceRpm() const;
00216 
00220     void setInstallSourceRpm( bool installSourceRpm );
00221 
00225     void toggleSourceRpmStatus();
00226 
00230     bool hasSourceRpm() const;
00231 
00232 
00242     virtual int compare( QListViewItem *        other,
00243                          int                    col,
00244                          bool                   ascending ) const;
00245 
00246 
00253     virtual void updateData();
00254 
00261     virtual QString toolTip( int column );
00262 
00263 
00264     // Columns
00265 
00266     int srpmStatusCol() const { return _pkgList->srpmStatusCol(); }
00267 
00268 
00269 protected:
00270 
00274     void setSourceRpmIcon();
00275 
00282     virtual void paintCell( QPainter *          painter,
00283                             const QColorGroup & colorGroup,
00284                             int                 column,
00285                             int                 width,
00286                             int                 alignment );
00287 
00288     // Data members
00289 
00290     YQPkgList *         _pkgList;
00291     PMPackagePtr        _pmPkg;
00292 };
00293 
00294 
00295 #endif // ifndef YQPkgList_h

Generated on Wed Sep 14 10:59:02 2005 for yast2-qt by  doxygen 1.4.4