author | drw <drw> | 2004-11-16 17:38:05 (UTC) |
---|---|---|
committer | drw <drw> | 2004-11-16 17:38:05 (UTC) |
commit | 3ba09273d96a32263bb22bfbc32fcc6290bde6e8 (patch) (side-by-side diff) | |
tree | 5191d954dd0769bbf47445daeec024888e523773 | |
parent | 36f98a2f0438edf82e4f326660786207ee46d87d (diff) | |
download | opie-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)
-rw-r--r-- | noncore/settings/packagemanager/filterdlg.cpp | 47 |
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,72 +1,72 @@ /* - This file is part of the OPIE Project + This file is part of the OPIE Project =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> - .=l. - .>+-= - _;:, .> :=|. This file is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This file is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General -..}^=.= = ; Public License for more details. -++= -. .` .: - : = ...= . :.=- You should have received a copy of the GNU - -. .:....=;==+<; General Public License along with this file; - -_. . . )=. = see the file COPYING. If not, write to the - -- :-=` Free Software Foundation, Inc., + .=l. + .>+-= +_;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; Public License for more details. +++= -. .` .: +: = ...= . :.=- You should have received a copy of the GNU +-. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "filterdlg.h" #include <qwhatsthis.h> FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, const QString &server, const QString &destination, OPackageManager::Status status, const QString &category ) : QDialog( parent, QString::null, true, WStyle_ContextHelp ) { setCaption( tr( "Filter packages" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); layout->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); layout = new QVBoxLayout( container, 4, 4 ); // Category m_categoryCB = new QCheckBox( tr( "Category:" ), container ); QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) ); connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); m_category = new QComboBox( container ); QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) ); m_category->insertStringList( pm->categories() ); initItem( m_category, m_categoryCB, category ); layout->addWidget( m_categoryCB ); layout->addWidget( m_category ); // Package name m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) ); connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); m_name = new QLineEdit( name, container ); QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) ); if ( !name.isNull() ) m_nameCB->setChecked( true ); m_name->setEnabled( !name.isNull() ); layout->addWidget( m_nameCB ); layout->addWidget( m_name ); @@ -97,93 +97,98 @@ FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, initItem( m_status, m_statusCB, currStatus ); layout->addWidget( m_statusCB ); layout->addWidget( m_status ); // Server m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) ); connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); m_server = new QComboBox( container ); QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) ); m_server->insertStringList( *(pm->servers()) ); initItem( m_server, m_serverCB, server ); layout->addWidget( m_serverCB ); layout->addWidget( m_server ); // Destination m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) ); connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); m_destination = new QComboBox( container ); QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) ); m_destination->insertStringList( *(pm->destinations()) ); initItem( m_destination, m_destCB, destination ); layout->addWidget( m_destCB ); layout->addWidget( m_destination ); } void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) { if ( !selection.isNull() ) { checkBox->setChecked( true ); for ( int i = 0; i < comboBox->count(); i++ ) { if ( comboBox->text( i ) == selection ) { comboBox->setCurrentItem( i ); return; } } } comboBox->setEnabled( !selection.isNull() ); } void FilterDlg::slotNameSelected( bool selected ) { m_name->setEnabled( selected ); + m_name->setFocus(); } void FilterDlg::slotServerSelected( bool selected ) { m_server->setEnabled( selected ); + m_server->setFocus(); } void FilterDlg::slotDestSelected( bool selected ) { m_destination->setEnabled( selected ); + m_destination->setFocus(); } void FilterDlg::slotStatusSelected( bool selected ) { m_status->setEnabled( selected ); + m_status->setFocus(); if ( !selected && !m_destCB->isEnabled() ) { // If status check box has been deselected and destination option was previously deselected // (because status == "Not installed"), re-enable destination option m_destCB->setEnabled( true ); m_destination->setEnabled( true ); } else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) ) { // If status check box has been selected and status == "Not installed", disable destination option m_destCB->setEnabled( false ); m_destCB->setChecked( false ); m_destination->setEnabled( false ); } } void FilterDlg::slotStatusChanged( const QString &category ) { bool notInstalled = ( category == tr( "Not installed" ) ); m_destCB->setEnabled( !notInstalled ); m_destination->setEnabled( !notInstalled ); if ( notInstalled ) m_destCB->setChecked( false ); } void FilterDlg::slotCategorySelected( bool selected ) { m_category->setEnabled( selected ); + m_category->setFocus(); } |