libemailfunctions

idmapper.h

Go to the documentation of this file.
00001 /*
00002     This file is part of kdepim.
00003 
00004     Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
00005     Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library 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     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef KPIM_IDMAPPER_H
00023 #define KPIM_IDMAPPER_H
00024 
00025 #include <qmap.h>
00026 #include <qvariant.h>
00027 
00028 #include <kdepimmacros.h>
00029 
00030 namespace KPIM {
00031 
00037 class KDE_EXPORT IdMapper
00038 {
00039   public:
00044     IdMapper();
00055     IdMapper( const QString &path, const QString &identifier = QString::null );
00057     ~IdMapper();
00058 
00062     void setPath( const QString &path );
00066     QString path() const { return mPath; }
00067 
00071     void setIdentifier( const QString &identifier );
00075     QString identifier() const { return mIdentifier; }
00076 
00080     bool load();
00081 
00085     bool save();
00086 
00090     void clear();
00091 
00095     void setRemoteId( const QString &localId, const QString &remoteId );
00096 
00100     void removeRemoteId( const QString &remoteId );
00101 
00105     QString remoteId( const QString &localId ) const;
00106 
00110     QString localId( const QString &remoteId ) const;
00111 
00112 
00119     void setFingerprint( const QString &localId, const QString &fingerprint );
00120 
00127     const QString &fingerprint( const QString &localId ) const;
00128 
00129 
00135     QMap<QString, QString> remoteIdMap() const;
00136 
00141     QString asString() const;
00142 
00143   protected:
00147     QString filename();
00148 
00149   private:
00150     QMap<QString, QVariant> mIdMap;
00151     QMap<QString, QString> mFingerprintMap;
00152 
00153     QString mPath;
00154     QString mIdentifier;
00155 };
00156 
00157 }
00158 
00159 #endif