kitchensync

bookmarksyncee.h

00001 /*
00002     This file is part of ksync.
00003 
00004     Copyright (c) 2001,2004 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef KSYNC_BOOKMARKSYNCEE_H
00022 #define KSYNC_BOOKMARKSYNCEE_H
00023 
00024 #include "syncee.h"
00025 
00026 #include <kbookmarkmanager.h>
00027 
00028 #include <qvaluelist.h>
00029 #include <qmap.h>
00030 
00031 class KBookmarkManager;
00032 
00033 namespace KSync {
00034 
00035 class KDE_EXPORT BookmarkSyncEntry : public SyncEntry
00036 {
00037     friend class BookmarkSyncee;
00038   public:
00039     BookmarkSyncEntry( KBookmark , Syncee *parent );
00040     BookmarkSyncEntry( Syncee* parent );
00041 
00042     QString name();
00043     QString id();
00044     QString timestamp();
00045 
00046     bool equals( SyncEntry *entry );
00047 
00048     BookmarkSyncEntry *clone();
00049 
00050     KBookmark bookmark() const { return mBookmark; }
00051 
00052   private:
00053     void setBookmark( const KBookmark& );
00054     KBookmark mBookmark;
00055 };
00056 
00061 class KDE_EXPORT BookmarkSyncee : public Syncee
00062 {
00063   public:
00064     BookmarkSyncee(Merger * m= 0);
00065     BookmarkSyncee( KBookmarkManager *, Merger* m = 0);
00066     ~BookmarkSyncee();
00067 
00068 
00069     BookmarkSyncEntry *firstEntry();
00070     BookmarkSyncEntry *nextEntry();
00071 
00072     void addEntry( SyncEntry * );
00073     void removeEntry( SyncEntry * );
00074 
00075     bool writeBackup( const QString & );
00076     bool restoreBackup( const QString & );
00077 
00078   private:
00079     void init();
00080 
00081     BookmarkSyncEntry *createEntry( KBookmark );
00082     /* ### naming */
00083     void listGroup( KBookmarkGroup );
00084     KBookmarkGroup findGroup( KBookmarkGroup group );
00085 
00086     KBookmarkManager *mBookmarkManager;
00087     bool mOwnBookmarkManager;
00088     QValueList<QDomElement> mBookmarks;
00089     QValueList<QDomElement>::ConstIterator mBookmarkIterator;
00090     QMap<QString, BookmarkSyncEntry*> mEntries;
00091 };
00092 
00093 }
00094 
00095 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys