Diffstat (limited to 'noncore/settings/aqpkg/categoryfilterimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/categoryfilterimpl.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp index e8ce7e7..61e1f93 100644 --- a/noncore/settings/aqpkg/categoryfilterimpl.cpp +++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp | |||
@@ -1,64 +1,77 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | categoryfilterimpl.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Sun Nov 17 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | ***************************************************************************/ | 7 | _;:, .> :=|. This file is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | /*************************************************************************** | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | * * | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | * it under the terms of the GNU General Public License as published by * | 12 | ._= =} : or (at your option) any later version. |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | .%`+i> _;_. |
14 | * (at your option) any later version. * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | ***************************************************************************/ | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
17 | #include <iostream> | 30 | #include <iostream> |
18 | using namespace std; | 31 | using namespace std; |
19 | 32 | ||
20 | #include <qgroupbox.h> | 33 | #include <qgroupbox.h> |
21 | #include <qlayout.h> | 34 | #include <qlayout.h> |
22 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
23 | #include <qstring.h> | 36 | #include <qstring.h> |
24 | 37 | ||
25 | #include "categoryfilterimpl.h" | 38 | #include "categoryfilterimpl.h" |
26 | 39 | ||
27 | CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) | 40 | CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) |
28 | : QDialog( parent, name, true ) | 41 | : QDialog( parent, name, true ) |
29 | { | 42 | { |
30 | setCaption( tr( "Category Filter" ) ); | 43 | setCaption( tr( "Category Filter" ) ); |
31 | 44 | ||
32 | QVBoxLayout *layout = new QVBoxLayout( this ); | 45 | QVBoxLayout *layout = new QVBoxLayout( this ); |
33 | layout->setMargin( 2 ); | 46 | layout->setMargin( 2 ); |
34 | layout->setSpacing( 4 ); | 47 | layout->setSpacing( 4 ); |
35 | 48 | ||
36 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Select one or more groups" ), this ); | 49 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Select one or more groups" ), this ); |
37 | grpbox->layout()->setSpacing( 2 ); | 50 | grpbox->layout()->setSpacing( 2 ); |
38 | grpbox->layout()->setMargin( 4 ); | 51 | grpbox->layout()->setMargin( 4 ); |
39 | layout->addWidget( grpbox ); | 52 | layout->addWidget( grpbox ); |
40 | 53 | ||
41 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 54 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
42 | 55 | ||
43 | lstCategories = new QListBox( grpbox ); | 56 | lstCategories = new QListBox( grpbox ); |
44 | lstCategories->setSelectionMode( QListBox::Multi ); | 57 | lstCategories->setSelectionMode( QListBox::Multi ); |
45 | grplayout->addWidget( lstCategories ); | 58 | grplayout->addWidget( lstCategories ); |
46 | 59 | ||
47 | // Split up categories and add them to the listbox | 60 | // Split up categories and add them to the listbox |
48 | int start = 1; | 61 | int start = 1; |
49 | 62 | ||
50 | QString item; | 63 | QString item; |
51 | int end; | 64 | int end; |
52 | QString finditem; | 65 | QString finditem; |
53 | do | 66 | do |
54 | { | 67 | { |
55 | end = categories.find( "#", start ); | 68 | end = categories.find( "#", start ); |
56 | item = categories.mid( start, end - start ); | 69 | item = categories.mid( start, end - start ); |
57 | if ( item != "" ) | 70 | if ( item != "" ) |
58 | { | 71 | { |
59 | lstCategories->insertItem( item ); | 72 | lstCategories->insertItem( item ); |
60 | finditem = QString( "#%1#" ).arg( item ); | 73 | finditem = QString( "#%1#" ).arg( item ); |
61 | if ( selectedCategories.find( finditem ) != -1 ) | 74 | if ( selectedCategories.find( finditem ) != -1 ) |
62 | lstCategories->setSelected( lstCategories->count()-1, true ); | 75 | lstCategories->setSelected( lstCategories->count()-1, true ); |
63 | } | 76 | } |
64 | 77 | ||