00001 /* 00002 This file is part of the Opie Project 00003 00004 Copyright (C)2004, 2005 Dan Williams <drw@handhelds.org> 00005 =. 00006 .=l. 00007 .>+-= 00008 _;:, .> :=|. This program is free software; you can 00009 .> <`_, > . <= redistribute it and/or modify it under 00010 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00011 .="- .-=="i, .._ License as published by the Free Software 00012 - . .-<_> .<> Foundation; either version 2 of the License, 00013 ._= =} : or (at your option) any later version. 00014 .%`+i> _;_. 00015 .i_,=:_. -<s. This program is distributed in the hope that 00016 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00017 : .. .:, . . . without even the implied warranty of 00018 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00019 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00020 ..}^=.= = ; Library General Public License for more 00021 ++= -. .` .: details. 00022 : = ...= . :.=- 00023 -. .:....=;==+<; You should have received a copy of the GNU 00024 -_. . . )=. = Library General Public License along with 00025 -- :-=` this library; see the file COPYING.LIB. 00026 If not, write to the Free Software Foundation, 00027 Inc., 59 Temple Place - Suite 330, 00028 Boston, MA 02111-1307, USA. 00029 */ 00030 00031 #ifndef FILTERDLG_H 00032 #define FILTERDLG_H 00033 00034 #include "opackagemanager.h" 00035 00036 #include <qcheckbox.h> 00037 #include <qdialog.h> 00038 #include <qcombobox.h> 00039 #include <qlayout.h> 00040 #include <qlineedit.h> 00041 #include <qscrollview.h> 00042 00043 class FilterDlg : public QDialog 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 FilterDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &name = 0x0, 00049 const QString &server = 0x0, const QString &destination = 0x0, 00050 OPackageManager::Status status = OPackageManager::All, 00051 const QString &category = 0x0 ); 00052 00053 QString name() 00054 { return m_nameCB->isChecked() ? m_name->text() : QString::null; }; 00055 QString server() 00056 { return m_serverCB->isChecked() ? m_server->currentText() : QString::null; }; 00057 QString destination() 00058 { return m_destCB->isChecked() ? m_destination->currentText() : QString::null; }; 00059 OPackageManager::Status status() 00060 { 00061 if ( m_statusCB->isChecked() ) 00062 { 00063 if ( m_status->currentText() == tr( "All" ) ) 00064 return OPackageManager::All; 00065 else if ( m_status->currentText() == tr( "Installed" ) ) 00066 return OPackageManager::Installed; 00067 else if ( m_status->currentText() == tr( "Not installed" ) ) 00068 return OPackageManager::NotInstalled; 00069 else if ( m_status->currentText() == tr( "Updated" ) ) 00070 return OPackageManager::Updated; 00071 } 00072 00073 return OPackageManager::NotDefined; 00074 }; 00075 QString category() 00076 { return m_categoryCB->isChecked() ? m_category->currentText() : QString::null; }; 00077 00078 private: 00079 QCheckBox *m_nameCB; 00080 QCheckBox *m_serverCB; 00081 QCheckBox *m_destCB; 00082 QCheckBox *m_statusCB; 00083 QCheckBox *m_categoryCB; 00084 00085 QLineEdit *m_name; 00086 QComboBox *m_server; 00087 QComboBox *m_destination; 00088 QComboBox *m_status; 00089 QComboBox *m_category; 00090 00091 void initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ); 00092 00093 private slots: 00094 void slotNameSelected( bool ); 00095 void slotServerSelected( bool ); 00096 void slotDestSelected( bool ); 00097 void slotStatusSelected( bool ); 00098 void slotStatusChanged( const QString & ); 00099 void slotCategorySelected( bool ); 00100 }; 00101 00102 #endif
1.4.2