summaryrefslogtreecommitdiff
authordrw <drw>2004-11-16 17:38:05 (UTC)
committer drw <drw>2004-11-16 17:38:05 (UTC)
commit3ba09273d96a32263bb22bfbc32fcc6290bde6e8 (patch) (unidiff)
tree5191d954dd0769bbf47445daeec024888e523773
parent36f98a2f0438edf82e4f326660786207ee46d87d (diff)
downloadopie-3ba09273d96a32263bb22bfbc32fcc6290bde6e8.zip
opie-3ba09273d96a32263bb22bfbc32fcc6290bde6e8.tar.gz
opie-3ba09273d96a32263bb22bfbc32fcc6290bde6e8.tar.bz2
Minor UI tweak - in filter dialog, when option is enabled, set focus to widget that corresponds to that option (less tapping)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/filterdlg.cpp47
1 files changed, 26 insertions, 21 deletions
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp
index 70875bd..0e1ea52 100644
--- a/noncore/settings/packagemanager/filterdlg.cpp
+++ b/noncore/settings/packagemanager/filterdlg.cpp
@@ -1,48 +1,48 @@
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) 2003 Dan Williams <drw@handhelds.org>
5             .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7_;:, .> :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++=   -.     .`     .: 20++= -. .` .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "filterdlg.h" 30#include "filterdlg.h"
31 31
32#include <qwhatsthis.h> 32#include <qwhatsthis.h>
33 33
34FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, 34FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
35 const QString &server, const QString &destination, 35 const QString &server, const QString &destination,
36 OPackageManager::Status status, const QString &category ) 36 OPackageManager::Status status, const QString &category )
37 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 37 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
38{ 38{
39 setCaption( tr( "Filter packages" ) ); 39 setCaption( tr( "Filter packages" ) );
40 40
41 QVBoxLayout *layout = new QVBoxLayout( this ); 41 QVBoxLayout *layout = new QVBoxLayout( this );
42 QScrollView *sv = new QScrollView( this ); 42 QScrollView *sv = new QScrollView( this );
43 layout->addWidget( sv, 0, 0 ); 43 layout->addWidget( sv, 0, 0 );
44 sv->setResizePolicy( QScrollView::AutoOneFit ); 44 sv->setResizePolicy( QScrollView::AutoOneFit );
45 sv->setFrameStyle( QFrame::NoFrame ); 45 sv->setFrameStyle( QFrame::NoFrame );
46 QWidget *container = new QWidget( sv->viewport() ); 46 QWidget *container = new QWidget( sv->viewport() );
47 sv->addChild( container ); 47 sv->addChild( container );
48 layout = new QVBoxLayout( container, 4, 4 ); 48 layout = new QVBoxLayout( container, 4, 4 );
@@ -121,69 +121,74 @@ FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
121 layout->addWidget( m_destination ); 121 layout->addWidget( m_destination );
122} 122}
123 123
124void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) 124void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection )
125{ 125{
126 if ( !selection.isNull() ) 126 if ( !selection.isNull() )
127 { 127 {
128 checkBox->setChecked( true ); 128 checkBox->setChecked( true );
129 129
130 for ( int i = 0; i < comboBox->count(); i++ ) 130 for ( int i = 0; i < comboBox->count(); i++ )
131 { 131 {
132 if ( comboBox->text( i ) == selection ) 132 if ( comboBox->text( i ) == selection )
133 { 133 {
134 comboBox->setCurrentItem( i ); 134 comboBox->setCurrentItem( i );
135 return; 135 return;
136 } 136 }
137 } 137 }
138 } 138 }
139 comboBox->setEnabled( !selection.isNull() ); 139 comboBox->setEnabled( !selection.isNull() );
140} 140}
141 141
142void FilterDlg::slotNameSelected( bool selected ) 142void FilterDlg::slotNameSelected( bool selected )
143{ 143{
144 m_name->setEnabled( selected ); 144 m_name->setEnabled( selected );
145 m_name->setFocus();
145} 146}
146 147
147void FilterDlg::slotServerSelected( bool selected ) 148void FilterDlg::slotServerSelected( bool selected )
148{ 149{
149 m_server->setEnabled( selected ); 150 m_server->setEnabled( selected );
151 m_server->setFocus();
150} 152}
151 153
152void FilterDlg::slotDestSelected( bool selected ) 154void FilterDlg::slotDestSelected( bool selected )
153{ 155{
154 m_destination->setEnabled( selected ); 156 m_destination->setEnabled( selected );
157 m_destination->setFocus();
155} 158}
156 159
157void FilterDlg::slotStatusSelected( bool selected ) 160void FilterDlg::slotStatusSelected( bool selected )
158{ 161{
159 m_status->setEnabled( selected ); 162 m_status->setEnabled( selected );
163 m_status->setFocus();
160 164
161 if ( !selected && !m_destCB->isEnabled() ) 165 if ( !selected && !m_destCB->isEnabled() )
162 { 166 {
163 // If status check box has been deselected and destination option was previously deselected 167 // If status check box has been deselected and destination option was previously deselected
164 // (because status == "Not installed"), re-enable destination option 168 // (because status == "Not installed"), re-enable destination option
165 m_destCB->setEnabled( true ); 169 m_destCB->setEnabled( true );
166 m_destination->setEnabled( true ); 170 m_destination->setEnabled( true );
167 } 171 }
168 else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) ) 172 else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) )
169 { 173 {
170 // If status check box has been selected and status == "Not installed", disable destination option 174 // If status check box has been selected and status == "Not installed", disable destination option
171 m_destCB->setEnabled( false ); 175 m_destCB->setEnabled( false );
172 m_destCB->setChecked( false ); 176 m_destCB->setChecked( false );
173 m_destination->setEnabled( false ); 177 m_destination->setEnabled( false );
174 } 178 }
175} 179}
176 180
177void FilterDlg::slotStatusChanged( const QString &category ) 181void FilterDlg::slotStatusChanged( const QString &category )
178{ 182{
179 bool notInstalled = ( category == tr( "Not installed" ) ); 183 bool notInstalled = ( category == tr( "Not installed" ) );
180 m_destCB->setEnabled( !notInstalled ); 184 m_destCB->setEnabled( !notInstalled );
181 m_destination->setEnabled( !notInstalled ); 185 m_destination->setEnabled( !notInstalled );
182 if ( notInstalled ) 186 if ( notInstalled )
183 m_destCB->setChecked( false ); 187 m_destCB->setChecked( false );
184} 188}
185 189
186void FilterDlg::slotCategorySelected( bool selected ) 190void FilterDlg::slotCategorySelected( bool selected )
187{ 191{
188 m_category->setEnabled( selected ); 192 m_category->setEnabled( selected );
193 m_category->setFocus();
189} 194}