summaryrefslogtreecommitdiffabout
path: root/kaddressbook/filtereditdialog.cpp
Unidiff
Diffstat (limited to 'kaddressbook/filtereditdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/filtereditdialog.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp
index 063585a..987f234 100644
--- a/kaddressbook/filtereditdialog.cpp
+++ b/kaddressbook/filtereditdialog.cpp
@@ -34,6 +34,7 @@ $Id$
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qradiobutton.h> 36#include <qradiobutton.h>
37#include <qcheckbox.h>
37#include <qregexp.h> 38#include <qregexp.h>
38#include <qstring.h> 39#include <qstring.h>
39#include <qtoolbutton.h> 40#include <qtoolbutton.h>
@@ -90,6 +91,12 @@ void FilterEditDialog::setFilter( const Filter &filter )
90 mMatchRuleGroup->setButton( 0 ); 91 mMatchRuleGroup->setButton( 0 );
91 else 92 else
92 mMatchRuleGroup->setButton( 1 ); 93 mMatchRuleGroup->setButton( 1 );
94
95 int c = filter.criteria() ;
96 mPublic->setChecked(c &Filter::ShowPublic);
97 mPrivate->setChecked(c & Filter::ShowPrivate);
98 mConfidential->setChecked(c & Filter::ShowConfidential);
99
93} 100}
94 101
95Filter FilterEditDialog::filter() 102Filter FilterEditDialog::filter()
@@ -114,6 +121,12 @@ Filter FilterEditDialog::filter()
114 else 121 else
115 filter.setMatchRule( Filter::NotMatching ); 122 filter.setMatchRule( Filter::NotMatching );
116 123
124 int c = 0;
125 if (mPublic->isChecked()) c |= Filter::ShowPublic;
126 if (mPrivate->isChecked()) c |= Filter::ShowPrivate;
127 if (mConfidential->isChecked()) c |= Filter::ShowConfidential;
128 filter.setCriteria( c ) ;
129
117 return filter; 130 return filter;
118} 131}
119 132
@@ -143,23 +156,24 @@ void FilterEditDialog::initGUI()
143 mCategoriesView->addColumn( i18n( "Categories" ) ); 156 mCategoriesView->addColumn( i18n( "Categories" ) );
144 topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 ); 157 topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 );
145 158
146 mMatchRuleGroup = new QButtonGroup( page ); 159 mMatchRuleGroup = new QHButtonGroup( i18n( "Category rule" ), page );
147 mMatchRuleGroup->setExclusive( true ); 160 mMatchRuleGroup->setExclusive( true );
148 161 QRadioButton *radio = new QRadioButton( i18n( "Include categories" ), mMatchRuleGroup );
149 QBoxLayout *gbLayout = new QVBoxLayout( mMatchRuleGroup );
150 gbLayout->setSpacing( KDialog::spacingHint() );
151 gbLayout->setMargin( KDialog::marginHint() );
152
153 QRadioButton *radio = new QRadioButton( i18n( "Show only contacts matching\n the selected categories" ), mMatchRuleGroup );
154 radio->setChecked( true ); 162 radio->setChecked( true );
155 mMatchRuleGroup->insert( radio ); 163 //mMatchRuleGroup->insert( radio );
156 gbLayout->addWidget( radio ); 164 radio = new QRadioButton( i18n( "Exclude categories" ), mMatchRuleGroup );
165 //mMatchRuleGroup->insert( radio );
166 topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 );
157 167
158 radio = new QRadioButton( i18n( "Show all contacts except those\n matching the selected categories" ), mMatchRuleGroup ); 168 QHButtonGroup * mMatchPPCGroup = new QHButtonGroup(i18n( "Include contacts, that are:" ), page );
159 mMatchRuleGroup->insert( radio ); 169 mPublic = new QCheckBox( i18n( "public" ), mMatchPPCGroup );
160 gbLayout->addWidget( radio ); 170 mPrivate = new QCheckBox( i18n( "private" ), mMatchPPCGroup );
171 mConfidential = new QCheckBox( i18n( "confidential" ), mMatchPPCGroup );
172 mPublic->setChecked( true );
173 mPrivate->setChecked( true );
174 mConfidential->setChecked( true );
175 topLayout->addMultiCellWidget( mMatchPPCGroup, 3, 3, 0, 1 );
161 176
162 topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 );
163} 177}
164 178
165void FilterEditDialog::filterNameTextChanged( const QString &text ) 179void FilterEditDialog::filterNameTextChanged( const QString &text )