00001 /* 00002 =. This file is part of the OPIE Project 00003 .=l. Copyright (c) 2002,2004 Holger Hans Peter Freyther <freyther@handhelds.org> 00004 .>+-= 00005 _;:, .> :=|. This program is free software; you can 00006 .> <`_, > . <= redistribute it and/or modify it under 00007 :`=1 )Y*s>-.-- : the terms of the GNU General Public 00008 .="- .-=="i, .._ License as published by the Free Software 00009 - . .-<_> .<> Foundation; either version 2 of the License, 00010 ._= =} : or (at your option) any later version. 00011 .%`+i> _;_. 00012 .i_,=:_. -<s. This program is distributed in the hope that 00013 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00014 : .. .:, . . . without even the implied warranty of 00015 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00016 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00017 ..}^=.= = ; General Public License for more 00018 ++= -. .` .: details. 00019 : = ...= . :.=- 00020 -. .:....=;==+<; You should have received a copy of the GNU 00021 -_. . . )=. = General Public License along with 00022 -- :-=` this library; see the file COPYING.BIN. 00023 If not, write to the Free Software Foundation, 00024 Inc., 59 Temple Place - Suite 330, 00025 Boston, MA 02111-1307, USA. 00026 00027 */ 00028 00029 #include "comboboxhelper.h" 00030 00031 #include <qstring.h> 00032 #include <qcombobox.h> 00033 00044 void ComboboxHelper::setCurrent( const QString& str, QComboBox* bo ) { 00045 const uint b = bo->count(); 00046 for (uint i = 0; i < b; i++ ) { 00047 if ( bo->text(i) == str ) { 00048 bo->setCurrentItem( i ); 00049 return; 00050 } 00051 } 00052 00053 bo->insertItem( str ); 00054 bo->setCurrentItem( b ); 00055 }
1.4.2