00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YQPkgYouPatchList.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 // -*- c++ -*- 00020 00021 00022 #ifndef YQPkgYouPatchList_h 00023 #define YQPkgYouPatchList_h 00024 00025 #include <YQPkgObjList.h> 00026 #include <y2pm/PMYouPatch.h> 00027 00028 00029 class QAction; 00030 class YQPkgYouPatchListItem; 00031 00035 class YQPkgYouPatchList : public YQPkgObjList 00036 { 00037 Q_OBJECT 00038 00039 public: 00040 00044 YQPkgYouPatchList( QWidget * parent ); 00045 00049 virtual ~YQPkgYouPatchList(); 00050 00051 00052 public slots: 00053 00061 void filter(); 00062 00066 void filterIfVisible(); 00067 00073 void addYouPatchItem( PMYouPatchPtr sel ); 00074 00078 void sendUpdatePackages() { emit updatePackages(); } 00079 00083 void fillList(); 00084 00088 void showRawPatchInfo(); 00089 00094 virtual void message( const QString & text ); 00095 00096 00097 public: 00098 00102 YQPkgYouPatchListItem * selection() const; 00103 00107 int kindCol() const { return _kindCol; } 00108 00112 enum PatchCategory 00113 { 00114 InstallablePatches, 00115 InstallableAndInstalledPatches, 00116 AllPatches 00117 }; 00118 00122 PatchCategory patchCategory() const { return _patchCategory; } 00123 00128 void setPatchCategory( PatchCategory newCt ) { _patchCategory = newCt; } 00129 00136 virtual QPopupMenu * addAllInListSubMenu( QPopupMenu * menu ); 00137 00142 QAction * actionShowRawPatchInfo; 00143 00144 00145 signals: 00146 00151 void updatePackages(); 00152 00157 void filterStart(); 00158 00162 void filterMatch( PMPackagePtr pkg ); 00163 00168 void filterMatch( const QString & name, 00169 const QString & summary, 00170 FSize size ); 00171 00175 void filterFinished(); 00176 00177 00178 protected: 00179 00185 virtual void createNotInstalledContextMenu(); 00186 00192 virtual void createInstalledContextMenu(); 00193 00200 virtual void keyPressEvent( QKeyEvent * ev ); 00201 00202 00203 // Data members 00204 00205 int _kindCol; 00206 PatchCategory _patchCategory; 00207 }; 00208 00209 00210 00211 class YQPkgYouPatchListItem: public YQPkgObjListItem 00212 { 00213 public: 00214 00219 YQPkgYouPatchListItem( YQPkgYouPatchList * youPatchList, PMYouPatchPtr youPatch ); 00220 00224 virtual ~YQPkgYouPatchListItem(); 00225 00229 PMYouPatchPtr pmYouPatch() { return _pmYouPatch; } 00230 00234 const PMYouPatchPtr constPMYouPatch() const { return _pmYouPatch; } 00235 00242 virtual void setStatus( PMSelectable::UI_Status newStatus ); 00243 00248 virtual void cycleStatus(); 00249 00256 virtual QString toolTip( int column ); 00257 00267 virtual int compare( QListViewItem * other, 00268 int col, 00269 bool ascending ) const; 00270 00271 // Columns 00272 00273 int statusCol() const { return _youPatchList->statusCol(); } 00274 int summaryCol() const { return _youPatchList->summaryCol(); } 00275 int kindCol() const { return _youPatchList->kindCol(); } 00276 00277 00278 protected: 00279 00280 00281 // Data members 00282 00283 YQPkgYouPatchList * _youPatchList; 00284 PMYouPatchPtr _pmYouPatch; 00285 }; 00286 00287 00288 #endif // ifndef YQPkgYouPatchList_h