summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-01-16 14:10:42 (UTC)
committer zautrix <zautrix>2005-01-16 14:10:42 (UTC)
commitde5f08d69c716f85cc92f20700cd24fb1ad41295 (patch) (side-by-side diff)
tree0a4f5dbbdb4fc24215ab85fa4b5e073d0e8104ef /kaddressbook
parent3f61f5a339e9c0c67c17b16214abded0d123f246 (diff)
downloadkdepimpi-de5f08d69c716f85cc92f20700cd24fb1ad41295.zip
kdepimpi-de5f08d69c716f85cc92f20700cd24fb1ad41295.tar.gz
kdepimpi-de5f08d69c716f85cc92f20700cd24fb1ad41295.tar.bz2
added AB filter settings
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/filter.cpp22
-rw-r--r--kaddressbook/filter.h6
-rw-r--r--kaddressbook/filtereditdialog.cpp40
-rw-r--r--kaddressbook/filtereditdialog.h7
4 files changed, 60 insertions, 15 deletions
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index 39d2ae4..9cb4c2d 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -30,2 +30,3 @@
#include "filter.h"
+#include <secrecy.h>
@@ -35,2 +36,3 @@ Filter::Filter()
{
+ mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
@@ -41,2 +43,3 @@ Filter::Filter( const QString &name )
{
+ mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
@@ -81,2 +84,19 @@ bool Filter::filterAddressee( const KABC::Addressee &a )
{
+ switch ( a.secrecy().type()) {
+ case KABC::Secrecy::Public:
+ if (! (mCriteria & ShowPublic ))
+ return false;
+ break;
+ case KABC::Secrecy::Private:
+ if (! (mCriteria & ShowPrivate ))
+ return false;
+ break;
+ case KABC::Secrecy::Confidential:
+ if (! (mCriteria & ShowConfidential ))
+ return false;
+ break;
+ default:
+ return false;
+ break;
+ }
QStringList::Iterator iter;
@@ -122,2 +142,3 @@ void Filter::save( KConfig *config )
config->writeEntry( "MatchRule", (int)mMatchRule );
+ config->writeEntry( "Criteria", (int)mCriteria );
}
@@ -130,2 +151,3 @@ void Filter::restore( KConfig *config )
mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching );
+ mCriteria = config->readNumEntry( "Criteria", (ShowPublic | ShowPrivate| ShowConfidential) );
}
diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h
index cf2c0a1..26870d7 100644
--- a/kaddressbook/filter.h
+++ b/kaddressbook/filter.h
@@ -40,3 +40,6 @@ class Filter
{
- public:
+ public:
+ enum { ShowPublic = 1, ShowPrivate = 2, ShowConfidential = 4};
+ void setCriteria(int c) { mCriteria = c ;}
+ int criteria() const { return mCriteria;}
typedef QValueList<Filter> List;
@@ -145,2 +148,3 @@ class Filter
private:
+ int mCriteria;
QString mName;
diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp
index 063585a..987f234 100644
--- a/kaddressbook/filtereditdialog.cpp
+++ b/kaddressbook/filtereditdialog.cpp
@@ -36,2 +36,3 @@ $Id$
#include <qradiobutton.h>
+#include <qcheckbox.h>
#include <qregexp.h>
@@ -92,2 +93,8 @@ void FilterEditDialog::setFilter( const Filter &filter )
mMatchRuleGroup->setButton( 1 );
+
+ int c = filter.criteria() ;
+ mPublic->setChecked(c &Filter::ShowPublic);
+ mPrivate->setChecked(c & Filter::ShowPrivate);
+ mConfidential->setChecked(c & Filter::ShowConfidential);
+
}
@@ -116,2 +123,8 @@ Filter FilterEditDialog::filter()
+ int c = 0;
+ if (mPublic->isChecked()) c |= Filter::ShowPublic;
+ if (mPrivate->isChecked()) c |= Filter::ShowPrivate;
+ if (mConfidential->isChecked()) c |= Filter::ShowConfidential;
+ filter.setCriteria( c ) ;
+
return filter;
@@ -145,19 +158,20 @@ void FilterEditDialog::initGUI()
- mMatchRuleGroup = new QButtonGroup( page );
+ mMatchRuleGroup = new QHButtonGroup( i18n( "Category rule" ), page );
mMatchRuleGroup->setExclusive( true );
-
- QBoxLayout *gbLayout = new QVBoxLayout( mMatchRuleGroup );
- gbLayout->setSpacing( KDialog::spacingHint() );
- gbLayout->setMargin( KDialog::marginHint() );
-
- QRadioButton *radio = new QRadioButton( i18n( "Show only contacts matching\n the selected categories" ), mMatchRuleGroup );
+ QRadioButton *radio = new QRadioButton( i18n( "Include categories" ), mMatchRuleGroup );
radio->setChecked( true );
- mMatchRuleGroup->insert( radio );
- gbLayout->addWidget( radio );
+ //mMatchRuleGroup->insert( radio );
+ radio = new QRadioButton( i18n( "Exclude categories" ), mMatchRuleGroup );
+ //mMatchRuleGroup->insert( radio );
+ topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 );
- radio = new QRadioButton( i18n( "Show all contacts except those\n matching the selected categories" ), mMatchRuleGroup );
- mMatchRuleGroup->insert( radio );
- gbLayout->addWidget( radio );
+ QHButtonGroup * mMatchPPCGroup = new QHButtonGroup(i18n( "Include contacts, that are:" ), page );
+ mPublic = new QCheckBox( i18n( "public" ), mMatchPPCGroup );
+ mPrivate = new QCheckBox( i18n( "private" ), mMatchPPCGroup );
+ mConfidential = new QCheckBox( i18n( "confidential" ), mMatchPPCGroup );
+ mPublic->setChecked( true );
+ mPrivate->setChecked( true );
+ mConfidential->setChecked( true );
+ topLayout->addMultiCellWidget( mMatchPPCGroup, 3, 3, 0, 1 );
- topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 );
}
diff --git a/kaddressbook/filtereditdialog.h b/kaddressbook/filtereditdialog.h
index 4dd75e4..5a8bad1 100644
--- a/kaddressbook/filtereditdialog.h
+++ b/kaddressbook/filtereditdialog.h
@@ -38,2 +38,3 @@ class QWidget;
class QListBoxItem;
+class QCheckBox;
@@ -44,2 +45,3 @@ class KListView;
#include <kdialogbase.h>
+#include <qhbuttongroup.h>
@@ -98,3 +100,6 @@ class FilterEditDialog : public KDialogBase
KListView *mCategoriesView;
- QButtonGroup *mMatchRuleGroup;
+ QHButtonGroup *mMatchRuleGroup;
+ QCheckBox *mPrivate;
+ QCheckBox *mPublic;
+ QCheckBox *mConfidential;
QPushButton *mEditButton;