kitchensync

konnector.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002,2003,2005 Holger Freyther <freyther@kde.org>
00005     Copyright (c) 2003 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 KSYNC_KONNECTOR_H
00023 #define KSYNC_KONNECTOR_H
00024 
00025 #include <qcstring.h>
00026 #include <qiconset.h>
00027 #include <qwidget.h>
00028 #include <qstringlist.h>
00029 #include <qptrlist.h>
00030 
00031 #include <kresources/resource.h>
00032 
00033 #include <filter.h>
00034 #include <syncee.h>
00035 #include <synceelist.h>
00036 
00037 namespace KPIM {
00038 class ProgressItem;
00039 }
00040 
00041 namespace KSync {
00042 
00043 class KonnectorInfo;
00044 
00053 class KDE_EXPORT Konnector : public KRES::Resource
00054 {
00055   Q_OBJECT
00056 
00057   public:
00058     typedef QPtrList<Konnector> List;
00059     static QString generateMD5Sum( const QString& );
00060     static void purgeRemovedEntries( Syncee* );
00061 
00062     enum FilterMode {
00063       FilterBeforeSync,
00064       FilterAfterSync
00065     };
00066 
00070     Konnector( const KConfig *config );
00071 
00076     void initDefaultFilters();
00077 
00081     virtual ~Konnector();
00082 
00086     void writeConfig( KConfig *config );
00087 
00093     virtual SynceeList syncees() = 0;
00094     virtual void appendSyncee( Syncee* ap);
00095 
00103     virtual bool readSyncees() = 0;
00104 
00113     virtual bool writeSyncees() = 0;
00114 
00123     QString storagePath()const;
00124 
00131     void setStoragePath(const QString& path );
00132 
00138     KPIM::ProgressItem *progressItem( const QString &msg );
00139 
00143     virtual bool connectDevice() = 0;
00144 
00148     virtual bool disconnectDevice() = 0;
00149 
00153     bool isConnected() const;
00154 
00158     virtual KonnectorInfo info() const = 0;
00159 
00160     // Obsolete ?
00161     virtual void add( const QString &res );
00162     virtual void remove( const QString &res );
00163     virtual QStringList resources() const;
00167     virtual QStringList builtIn() const;
00168 
00176     virtual QStringList supportedFilterTypes() const = 0;
00177 
00182     void addFilter( KSync::Filter* );
00183 
00189     void removeFilter( KSync::Filter* );
00190 
00194     KSync::Filter::List filters() const;
00195 
00199     KSync::Filter* filter( const QString &type );
00200 
00206     void applyFilters( FilterMode );
00208 
00209   signals:
00214     void synceesRead( KSync::Konnector * );
00215 
00219     void synceeReadError( KSync::Konnector * );
00220 
00225     void synceesWritten( KSync::Konnector * );
00226 
00230     void synceeWriteError( KSync::Konnector * );
00231 
00235     void storagePathChanged( const QString& path );
00236 
00237 
00238   protected slots:
00239     void progressItemCanceled( KPIM::ProgressItem* );
00240 
00241   private:
00242     KSync::Filter::List m_filterList;
00243     QStringList m_resources;
00244     QString m_sPath;
00245     bool m_isCon : 1;
00246 };
00247 
00248 }
00249 
00250 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys