certmanager/lib

kconfigbasedkeyfilter.h

00001 /*
00002     kconfigbasedkeyfilter.h
00003 
00004     This file is part of libkleopatra, the KDE keymanagement library
00005     Copyright (c) 2004 Klarälvdalens Datakonsult AB
00006 
00007     Libkleopatra is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU General Public License as
00009     published by the Free Software Foundation; either version 2 of the
00010     License, or (at your option) any later version.
00011 
00012     Libkleopatra is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021     In addition, as a special exception, the copyright holders give
00022     permission to link the code of this program with any edition of
00023     the Qt library by Trolltech AS, Norway (or with modified versions
00024     of Qt that use the same license as Qt), and distribute linked
00025     combinations including the two.  You must obey the GNU General
00026     Public License in all respects for all of the code used other than
00027     Qt.  If you modify this file, you may extend this exception to
00028     your version of the file, but you are not obligated to do so.  If
00029     you do not wish to do so, delete this exception statement from
00030     your version.
00031 */
00032 
00033 #ifndef __KLEO_KCONFIGBASEDKEYFILTER_H__
00034 #define __KLEO_KCONFIGBASEDKEYFILTER_H__
00035 
00036 #include "keyfilter.h"
00037 
00038 #include <qfont.h>
00039 #include <qstring.h>
00040 #include <qcolor.h>
00041 
00042 #include <gpgmepp/key.h>
00043 
00044 class KConfigBase;
00045 
00046 namespace Kleo {
00047 
00048   class KConfigBasedKeyFilter : public KeyFilter {
00049   public:
00050     explicit KConfigBasedKeyFilter( const KConfigBase & config );
00051     ~KConfigBasedKeyFilter();
00052     bool matches( const GpgME::Key & key ) const;
00053 
00054     unsigned int specificity() const { return mSpecificity; }
00055 
00056     QColor fgColor() const { return mFgColor; }
00057     QColor bgColor() const { return mBgColor; }
00058     QFont  font( const QFont & ) const;
00059     QString name() const { return mName; }
00060     QString icon() const { return mIcon; }
00061 
00062   private:
00063     QColor mFgColor, mBgColor;
00064     QString mName;
00065     QString mIcon;
00066     unsigned int mSpecificity;
00067     bool mItalic;
00068     bool mBold;
00069     bool mStrikeOut;
00070     bool mUseFullFont;
00071     QFont mFont;
00072 
00073     enum TriState {
00074       DoesNotMatter = 0,
00075       Set = 1,
00076       NotSet = 2
00077     };
00078     TriState mRevoked;
00079     TriState mExpired;
00080     TriState mDisabled;
00081     TriState mRoot;
00082     TriState mCanEncrypt;
00083     TriState mCanSign;
00084     TriState mCanCertify;
00085     TriState mCanAuthenticate;
00086     TriState mHasSecret;
00087     TriState mIsOpenPGP;
00088     TriState mWasValidated;
00089     enum LevelState {
00090       LevelDoesNotMatter = 0,
00091       Is = 1,
00092       IsNot = 2,
00093       IsAtLeast = 3,
00094       IsAtMost = 4
00095     };
00096     LevelState mOwnerTrust;
00097     GpgME::Key::OwnerTrust mOwnerTrustReferenceLevel;
00098     LevelState mValidity;
00099     GpgME::UserID::Validity mValidityReferenceLevel;
00100   };
00101 
00102 }
00103 
00104 #endif // __KLEO_KCONFIGBASEDKEYFILTER_H__
KDE Home | KDE Accessibility Home | Description of Access Keys