summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/categoryfilterimpl.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/categoryfilterimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/categoryfilterimpl.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp
index 0746da6..e8ce7e7 100644
--- a/noncore/settings/aqpkg/categoryfilterimpl.cpp
+++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp
@@ -16,20 +16,40 @@
16 ***************************************************************************/ 16 ***************************************************************************/
17#include <iostream> 17#include <iostream>
18using namespace std; 18using namespace std;
19 19
20#include <qgroupbox.h>
21#include <qlayout.h>
20#include <qlistbox.h> 22#include <qlistbox.h>
21#include <qstring.h> 23#include <qstring.h>
22 24
23#include "categoryfilterimpl.h" 25#include "categoryfilterimpl.h"
24 26
25CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) 27CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name )
26 : CategoryFilterDlg(parent,name, true) 28 : QDialog( parent, name, true )
27{ 29{
30 setCaption( tr( "Category Filter" ) );
31
32 QVBoxLayout *layout = new QVBoxLayout( this );
33 layout->setMargin( 2 );
34 layout->setSpacing( 4 );
35
36 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Select one or more groups" ), this );
37 grpbox->layout()->setSpacing( 2 );
38 grpbox->layout()->setMargin( 4 );
39 layout->addWidget( grpbox );
40
41 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
42
43 lstCategories = new QListBox( grpbox );
44 lstCategories->setSelectionMode( QListBox::Multi );
45 grplayout->addWidget( lstCategories );
46
28 // Split up categories and add them to the listbox 47 // Split up categories and add them to the listbox
29 int start = 1; 48 int start = 1;
30 49
31 QString item; 50 QString item;
32 int end; 51 int end;
52 QString finditem;
33 do 53 do
34 { 54 {
35 end = categories.find( "#", start ); 55 end = categories.find( "#", start );
@@ -37,8 +57,8 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin
37 if ( item != "" ) 57 if ( item != "" )
38 { 58 {
39 lstCategories->insertItem( item ); 59 lstCategories->insertItem( item );
40 60 finditem = QString( "#%1#" ).arg( item );
41 if ( selectedCategories.find( "#" + item + "#" ) != -1 ) 61 if ( selectedCategories.find( finditem ) != -1 )
42 lstCategories->setSelected( lstCategories->count()-1, true ); 62 lstCategories->setSelected( lstCategories->count()-1, true );
43 } 63 }
44 64
@@ -62,7 +82,10 @@ QString CategoryFilterImpl :: getSelectedFilter()
62 for ( int i = 0 ; i < (int)lstCategories->count() ; ++i ) 82 for ( int i = 0 ; i < (int)lstCategories->count() ; ++i )
63 { 83 {
64 if ( lstCategories->isSelected( i ) ) 84 if ( lstCategories->isSelected( i ) )
65 ret += lstCategories->text( i ) + "#"; 85 {
86 ret.append( lstCategories->text( i ) );
87 ret.append( "#" );
88 }
66 } 89 }
67 90
68 if ( ret == "#" ) 91 if ( ret == "#" )