00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YQPkgSearchFilterView.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 // -*- c++ -*- 00020 00021 00022 #ifndef YQPkgSearchFilterView_h 00023 #define YQPkgSearchFilterView_h 00024 00025 #include <qvbox.h> 00026 #include <qregexp.h> 00027 #include <y2pm/PMPackage.h> 00028 00029 00030 class QComboBox; 00031 class QCheckBox; 00032 class QPushButton; 00033 class QRadioButton; 00034 00035 using std::list; 00036 using std::string; 00037 00038 00042 class YQPkgSearchFilterView : public QVBox 00043 { 00044 Q_OBJECT 00045 00046 public: 00047 00051 YQPkgSearchFilterView( QWidget * parent ); 00052 00056 virtual ~YQPkgSearchFilterView(); 00057 00062 virtual QSize minimumSizeHint() const; 00063 00064 00065 public slots: 00066 00074 void filter(); 00075 00079 void filterIfVisible(); 00080 00084 void setFocus(); 00085 00086 00087 signals: 00088 00093 void filterStart(); 00094 00098 void filterMatch( PMPackagePtr pkg ); 00099 00103 void filterFinished(); 00104 00108 void message( const QString & text ); 00109 00110 00111 protected: 00112 00113 // Caution: Enum order must match corresponding message strings in combo box! 00114 typedef enum SearchMode 00115 { 00116 Contains = 0, 00117 BeginsWith, 00118 ExactMatch, 00119 UseWildcards, 00120 UseRegExp 00121 }; 00122 00123 00127 bool check( PMPackagePtr pkg, const QRegExp & regexp ); 00128 00132 bool check( const string & attribute, const QRegExp & regexp ); 00133 00137 bool check( const list<string> & strList, const QRegExp & regexp ); 00138 00142 bool check( const PMSolvable::PkgRelList_type & relList, const QRegExp & regexp ); 00143 00148 virtual void keyPressEvent( QKeyEvent * event ); 00149 00150 00151 // Data members 00152 00153 QComboBox * _searchText; 00154 QPushButton * _searchButton; 00155 00156 QCheckBox * _searchInName; 00157 QCheckBox * _searchInSummary; 00158 QCheckBox * _searchInDescription; 00159 QCheckBox * _searchInRequires; 00160 QCheckBox * _searchInProvides; 00161 00162 QComboBox * _searchMode; 00163 QCheckBox * _caseSensitive; 00164 00165 int _matchCount; 00166 }; 00167 00168 00169 00170 #endif // ifndef YQPkgSearchFilterView_h