summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/filterdlg.cpp
Unidiff
Diffstat (limited to 'noncore/settings/packagemanager/filterdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/filterdlg.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp
index e69b6eb..4924972 100644
--- a/noncore/settings/packagemanager/filterdlg.cpp
+++ b/noncore/settings/packagemanager/filterdlg.cpp
@@ -1,123 +1,124 @@
1/* 1/*
2 This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 3
4 =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 Copyright (C)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "filterdlg.h" 31#include "filterdlg.h"
31 32
32#include <qwhatsthis.h> 33#include <qwhatsthis.h>
33 34
34FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, 35FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
35 const QString &server, const QString &destination, 36 const QString &server, const QString &destination,
36 OPackageManager::Status status, const QString &category ) 37 OPackageManager::Status status, const QString &category )
37 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 38 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
38{ 39{
39 setCaption( tr( "Filter packages" ) ); 40 setCaption( tr( "Filter packages" ) );
40 41
41 QVBoxLayout *layout = new QVBoxLayout( this ); 42 QVBoxLayout *layout = new QVBoxLayout( this );
42 QScrollView *sv = new QScrollView( this ); 43 QScrollView *sv = new QScrollView( this );
43 layout->addWidget( sv, 0, 0 ); 44 layout->addWidget( sv, 0, 0 );
44 sv->setResizePolicy( QScrollView::AutoOneFit ); 45 sv->setResizePolicy( QScrollView::AutoOneFit );
45 sv->setFrameStyle( QFrame::NoFrame ); 46 sv->setFrameStyle( QFrame::NoFrame );
46 QWidget *container = new QWidget( sv->viewport() ); 47 QWidget *container = new QWidget( sv->viewport() );
47 sv->addChild( container ); 48 sv->addChild( container );
48 layout = new QVBoxLayout( container, 4, 4 ); 49 layout = new QVBoxLayout( container, 4, 4 );
49 50
50 // Category 51 // Category
51 m_categoryCB = new QCheckBox( tr( "Category:" ), container ); 52 m_categoryCB = new QCheckBox( tr( "Category:" ), container );
52 QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) ); 53 QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) );
53 connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); 54 connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) );
54 m_category = new QComboBox( container ); 55 m_category = new QComboBox( container );
55 QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) ); 56 QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) );
56 m_category->insertStringList( pm->categories() ); 57 m_category->insertStringList( pm->categories() );
57 initItem( m_category, m_categoryCB, category ); 58 initItem( m_category, m_categoryCB, category );
58 layout->addWidget( m_categoryCB ); 59 layout->addWidget( m_categoryCB );
59 layout->addWidget( m_category ); 60 layout->addWidget( m_category );
60 61
61 // Package name 62 // Package name
62 m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); 63 m_nameCB = new QCheckBox( tr( "Names containing:" ), container );
63 QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) ); 64 QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) );
64 connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); 65 connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) );
65 m_name = new QLineEdit( name, container ); 66 m_name = new QLineEdit( name, container );
66 QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) ); 67 QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) );
67 if ( !name.isNull() ) 68 if ( !name.isNull() )
68 m_nameCB->setChecked( true ); 69 m_nameCB->setChecked( true );
69 m_name->setEnabled( !name.isNull() ); 70 m_name->setEnabled( !name.isNull() );
70 layout->addWidget( m_nameCB ); 71 layout->addWidget( m_nameCB );
71 layout->addWidget( m_name ); 72 layout->addWidget( m_name );
72 73
73 // Status 74 // Status
74 m_statusCB = new QCheckBox( tr( "With the status:" ), container ); 75 m_statusCB = new QCheckBox( tr( "With the status:" ), container );
75 QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) ); 76 QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) );
76 connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) ); 77 connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) );
77 m_status = new QComboBox( container ); 78 m_status = new QComboBox( container );
78 QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) ); 79 QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) );
79 connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) ); 80 connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) );
80 QString currStatus; 81 QString currStatus;
81 switch ( status ) 82 switch ( status )
82 { 83 {
83 case OPackageManager::All : currStatus = tr( "All" ); 84 case OPackageManager::All : currStatus = tr( "All" );
84 break; 85 break;
85 case OPackageManager::Installed : currStatus = tr( "Installed" ); 86 case OPackageManager::Installed : currStatus = tr( "Installed" );
86 break; 87 break;
87 case OPackageManager::NotInstalled : currStatus = tr( "Not installed" ); 88 case OPackageManager::NotInstalled : currStatus = tr( "Not installed" );
88 break; 89 break;
89 case OPackageManager::Updated : currStatus = tr( "Updated" ); 90 case OPackageManager::Updated : currStatus = tr( "Updated" );
90 break; 91 break;
91 default : currStatus = QString::null; 92 default : currStatus = QString::null;
92 }; 93 };
93 m_status->insertItem( tr( "All" ) ); 94 m_status->insertItem( tr( "All" ) );
94 m_status->insertItem( tr( "Installed" ) ); 95 m_status->insertItem( tr( "Installed" ) );
95 m_status->insertItem( tr( "Not installed" ) ); 96 m_status->insertItem( tr( "Not installed" ) );
96 m_status->insertItem( tr( "Updated" ) ); 97 m_status->insertItem( tr( "Updated" ) );
97 initItem( m_status, m_statusCB, currStatus ); 98 initItem( m_status, m_statusCB, currStatus );
98 layout->addWidget( m_statusCB ); 99 layout->addWidget( m_statusCB );
99 layout->addWidget( m_status ); 100 layout->addWidget( m_status );
100 101
101 // Server 102 // Server
102 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); 103 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
103 QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) ); 104 QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) );
104 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); 105 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
105 m_server = new QComboBox( container ); 106 m_server = new QComboBox( container );
106 QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) ); 107 QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) );
107 m_server->insertStringList( pm->servers() ); 108 m_server->insertStringList( pm->servers() );
108 initItem( m_server, m_serverCB, server ); 109 initItem( m_server, m_serverCB, server );
109 layout->addWidget( m_serverCB ); 110 layout->addWidget( m_serverCB );
110 layout->addWidget( m_server ); 111 layout->addWidget( m_server );
111 112
112 // Destination 113 // Destination
113 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); 114 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
114 QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) ); 115 QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) );
115 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); 116 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
116 m_destination = new QComboBox( container ); 117 m_destination = new QComboBox( container );
117 QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) ); 118 QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) );
118 m_destination->insertStringList( pm->destinations() ); 119 m_destination->insertStringList( pm->destinations() );
119 initItem( m_destination, m_destCB, destination ); 120 initItem( m_destination, m_destCB, destination );
120 layout->addWidget( m_destCB ); 121 layout->addWidget( m_destCB );
121 layout->addWidget( m_destination ); 122 layout->addWidget( m_destination );
122} 123}
123 124