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 
00141     KPIM::ProgressItem *progressItem( const QString &msg );
00142 
00146     virtual bool connectDevice() = 0;
00147 
00151     virtual bool disconnectDevice() = 0;
00152 
00156     bool isConnected() const;
00157 
00161     virtual KonnectorInfo info() const = 0;
00162 
00163     // Obsolete ?
00164     virtual void add( const QString &res );
00165     virtual void remove( const QString &res );
00166     virtual QStringList resources() const;
00170     virtual QStringList builtIn() const;
00171 
00179     virtual QStringList supportedFilterTypes() const = 0;
00180 
00185     void addFilter( KSync::Filter* );
00186 
00192     void removeFilter( KSync::Filter* );
00193 
00197     KSync::Filter::List filters() const;
00198 
00202     KSync::Filter* filter( const QString &type );
00203 
00209     void applyFilters( FilterMode );
00211 
00212   signals:
00217     void synceesRead( KSync::Konnector * );
00218 
00222     void synceeReadError( KSync::Konnector * );
00223 
00228     void synceesWritten( KSync::Konnector * );
00229 
00233     void synceeWriteError( KSync::Konnector * );
00234 
00238     void storagePathChanged( const QString& path );
00239 
00240 
00241   protected slots:
00242     void progressItemCanceled( KPIM::ProgressItem* );
00243 
00244   private:
00245     KSync::Filter::List m_filterList;
00246     QStringList m_resources;
00247     QString m_sPath;
00248     bool m_isCon : 1;
00249 };
00250 
00251 }
00252 
00253 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys