author | zautrix <zautrix> | 2005-01-16 14:10:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-16 14:10:42 (UTC) |
commit | de5f08d69c716f85cc92f20700cd24fb1ad41295 (patch) (side-by-side diff) | |
tree | 0a4f5dbbdb4fc24215ab85fa4b5e073d0e8104ef | |
parent | 3f61f5a339e9c0c67c17b16214abded0d123f246 (diff) | |
download | kdepimpi-de5f08d69c716f85cc92f20700cd24fb1ad41295.zip kdepimpi-de5f08d69c716f85cc92f20700cd24fb1ad41295.tar.gz kdepimpi-de5f08d69c716f85cc92f20700cd24fb1ad41295.tar.bz2 |
added AB filter settings
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | kaddressbook/filter.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/filter.h | 4 | ||||
-rw-r--r-- | kaddressbook/filtereditdialog.cpp | 40 | ||||
-rw-r--r-- | kaddressbook/filtereditdialog.h | 7 |
5 files changed, 64 insertions, 14 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 5d8ef41..d8f8323 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -15,17 +15,22 @@ calendars without writing back private or confidential data (via the outgoing filters). To sync only with particular parts of a shared calendar, the incoming filter settings can be used. An example can be found in the SyncHowTo. KO/Pi: The timeedit input has a pulldown list for times. If opened, this pulldown list should now has the right time highlighted. +Added the possibility to exclude events/todos/journals in a filter. +You should exclude journals, if you do not want them to sync with a public calendar. +KA/Pi: +Added the possibility to in/exclude public/private/confidential contacts to a filter. +If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... ********** VERSION 1.9.17 ************ KO/Pi: Fixed that tooltips were not updated after moving an item in agenda view. Fixed a bug in sorting start date for recurring events in list view. Changed the left button in todo viewer from "Agenda" to "Set completed". diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp index 39d2ae4..9cb4c2d 100644 --- a/kaddressbook/filter.cpp +++ b/kaddressbook/filter.cpp @@ -23,27 +23,30 @@ #include <kconfig.h> #include <kconfigbase.h> #include <kdebug.h> #include "kabprefs.h" #include "filter.h" +#include <secrecy.h> Filter::Filter() : mName( QString::null ), mMatchRule( Matching ), mEnabled( true ), mInternal( false ) { + mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; } Filter::Filter( const QString &name ) : mName( name ), mMatchRule( Matching ), mEnabled( true ), mInternal( false ) { + mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; } Filter::~Filter() { } void Filter::setName( const QString &name ) { @@ -74,16 +77,33 @@ void Filter::apply( KABC::Addressee::List &addresseeList ) iter = addresseeList.remove( iter ); #endif //KAB_EMBEDDED } } } 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; iter = mCategoryList.begin(); // empty filter always matches if ( iter == mCategoryList.end() ) return true; for ( ; iter != mCategoryList.end(); ++iter ) { @@ -115,24 +135,26 @@ const QStringList &Filter::categories() const } void Filter::save( KConfig *config ) { config->writeEntry( "Name", mName ); config->writeEntry( "Enabled", mEnabled ); config->writeEntry( "Categories", mCategoryList ); config->writeEntry( "MatchRule", (int)mMatchRule ); + config->writeEntry( "Criteria", (int)mCriteria ); } void Filter::restore( KConfig *config ) { mName = config->readEntry( "Name", "<internal error>" ); mEnabled = config->readBoolEntry( "Enabled", true ); mCategoryList = config->readListEntry( "Categories" ); mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching ); + mCriteria = config->readNumEntry( "Criteria", (ShowPublic | ShowPrivate| ShowConfidential) ); } void Filter::save( KConfig *config, QString baseGroup, Filter::List &list ) { { KConfigGroupSaver s( config, baseGroup ); // remove the old filters diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h index cf2c0a1..26870d7 100644 --- a/kaddressbook/filter.h +++ b/kaddressbook/filter.h @@ -34,16 +34,19 @@ /** Filter for AddressBook related objects (Addressees) @todo This class should be switched to use shared data. */ class Filter { public: + enum { ShowPublic = 1, ShowPrivate = 2, ShowConfidential = 4}; + void setCriteria(int c) { mCriteria = c ;} + int criteria() const { return mCriteria;} typedef QValueList<Filter> List; enum MatchRule { Matching = 0, NotMatching = 1 }; Filter(); Filter( const QString& name ); ~Filter(); @@ -138,16 +141,17 @@ class Filter */ void setMatchRule( MatchRule rule ); /** @return The current match rule. */ MatchRule matchRule() const; private: + int mCriteria; QString mName; QStringList mCategoryList; MatchRule mMatchRule; bool mEnabled; bool mInternal; }; #endif diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp index 063585a..987f234 100644 --- a/kaddressbook/filtereditdialog.cpp +++ b/kaddressbook/filtereditdialog.cpp @@ -29,16 +29,17 @@ $Id$ */ #include <qbuttongroup.h> #include <qhbox.h> #include <qlabel.h> #include <qlayout.h> #include <qpushbutton.h> #include <qradiobutton.h> +#include <qcheckbox.h> #include <qregexp.h> #include <qstring.h> #include <qtoolbutton.h> #include <qtooltip.h> #include <qwidget.h> #include <kapplication.h> #include <kbuttonbox.h> @@ -85,16 +86,22 @@ void FilterEditDialog::setFilter( const Filter &filter ) item = item->nextSibling(); } if ( filter.matchRule() == Filter::Matching ) mMatchRuleGroup->setButton( 0 ); else mMatchRuleGroup->setButton( 1 ); + + int c = filter.criteria() ; + mPublic->setChecked(c &Filter::ShowPublic); + mPrivate->setChecked(c & Filter::ShowPrivate); + mConfidential->setChecked(c & Filter::ShowConfidential); + } Filter FilterEditDialog::filter() { Filter filter; filter.setName( mNameEdit->text() ); @@ -109,16 +116,22 @@ Filter FilterEditDialog::filter() } filter.setCategories( categories ); if ( mMatchRuleGroup->find( 0 )->isOn() ) filter.setMatchRule( Filter::Matching ); else filter.setMatchRule( Filter::NotMatching ); + 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; } void FilterEditDialog::initGUI() { #ifndef KAB_EMBEDDED resize( 490, 300 ); #else //KAB_EMBEDDED @@ -138,33 +151,34 @@ void FilterEditDialog::initGUI() topLayout->addWidget( mNameEdit, 0, 1 ); connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( filterNameTextChanged( const QString&) ) ); mCategoriesView = new KListView( page ); mCategoriesView->addColumn( i18n( "Categories" ) ); topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 ); - 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 ); } void FilterEditDialog::filterNameTextChanged( const QString &text ) { enableButtonOK( !text.isEmpty() ); } void FilterEditDialog::slotHelp() diff --git a/kaddressbook/filtereditdialog.h b/kaddressbook/filtereditdialog.h index 4dd75e4..5a8bad1 100644 --- a/kaddressbook/filtereditdialog.h +++ b/kaddressbook/filtereditdialog.h @@ -31,22 +31,24 @@ $Id$ #ifndef FILTEREDITDIALOG_H #define FILTEREDITDIALOG_H class QButtonGroup; class QString; class QToolButton; class QWidget; class QListBoxItem; +class QCheckBox; class KLineEdit; class KListBox; class KListView; #include <kdialogbase.h> +#include <qhbuttongroup.h> #include "filter.h" class FilterDialog : public KDialogBase { Q_OBJECT public: @@ -91,14 +93,17 @@ class FilterEditDialog : public KDialogBase private: void initGUI(); Filter mFilter; KLineEdit *mNameEdit; KListView *mCategoriesView; - QButtonGroup *mMatchRuleGroup; + QHButtonGroup *mMatchRuleGroup; + QCheckBox *mPrivate; + QCheckBox *mPublic; + QCheckBox *mConfidential; QPushButton *mEditButton; QPushButton *mRemoveButton; }; #endif |