kitchensync

remotekonnector.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 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_REMOTEKONNECTOR_H
00022 #define KSYNC_REMOTEKONNECTOR_H
00023 
00024 #include <libkcal/calendarlocal.h>
00025 #include <kabc/addressbook.h>
00026 #include <kbookmarkmanager.h>
00027 #include <kio/job.h>
00028 
00029 #include <konnector.h>
00030 
00031 #include <qiconset.h>
00032 #include <qptrlist.h>
00033 
00034 namespace KABC {
00035 class ResourceFile;
00036 }
00037 
00038 namespace KSync {
00039 
00040 class RemoteKonnectorConfig;
00041 
00042 class RemoteKonnector : public KSync::Konnector
00043 {
00044     Q_OBJECT
00045   public:
00046     RemoteKonnector( const KConfig *config );
00047     ~RemoteKonnector();
00048 
00049     void writeConfig( KConfig * );
00050 
00051     SynceeList syncees() { return mSyncees; }
00052 
00053     bool readSyncees();
00054     bool writeSyncees();
00055 
00056     bool connectDevice();
00057     bool disconnectDevice();
00058 
00059     KSync::KonnectorInfo info() const;
00060     virtual QStringList supportedFilterTypes() const;
00061 
00062     void setCalendarUrl( const QString &f ) { mCalendarUrl = f; }
00063     QString calendarUrl() const { return mCalendarUrl; }
00064 
00065     void setAddressBookUrl( const QString &f ) { mAddressBookUrl = f; }
00066     QString addressBookUrl() const { return mAddressBookUrl; }
00067 
00068     void setBookmarkUrl( const QString &f ) { mBookmarkUrl = f; }
00069     QString bookmarkUrl() const { return mBookmarkUrl; }
00070 
00071   protected:
00072     void finishRead();
00073     void finishWrite();
00074 
00075   protected slots:
00076     void slotCalendarData( KIO::Job *, const QByteArray &d );
00077     void slotCalendarReadResult( KIO::Job *job );
00078     void slotAddressBookData( KIO::Job *, const QByteArray &d );
00079     void slotAddressBookReadResult( KIO::Job *job );
00080     void slotCalendarDataReq( KIO::Job *, QByteArray &d );
00081     void slotCalendarWriteResult( KIO::Job *job );
00082     void slotAddressBookDataReq( KIO::Job *, QByteArray &d );
00083     void slotAddressBookWriteResult( KIO::Job *job );
00084 
00085   private:
00086     RemoteKonnectorConfig *mConfigWidget;
00087     QString mCalendarUrl;
00088     QString mAddressBookUrl;
00089     QString mBookmarkUrl;
00090 
00091     QString mMd5sumCal;
00092     QString mMd5sumBkm;
00093     QString mMd5sumAbk;
00094 
00095     KCal::CalendarLocal mCalendar;
00096     KABC::AddressBook mAddressBook;
00097 
00098     KSync::AddressBookSyncee *mAddressBookSyncee;
00099     KSync::CalendarSyncee *mCalendarSyncee;
00100 
00101     class LocalBookmarkManager : public KBookmarkManager
00102     {
00103       public:
00104         LocalBookmarkManager() : KBookmarkManager() {}
00105     };
00106     LocalBookmarkManager mBookmarkManager;
00107 
00108     SynceeList mSyncees;
00109 
00110     int mSynceeReadCount;
00111     int mSynceeWriteCount;
00112 
00113     QString mCalendarData;
00114     QString mAddressBookData;
00115 };
00116 
00117 }
00118 
00119 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys