ksync Library API Documentation

ksyncview.h

00001 #ifndef KSYNCVIEW_H
00002 #define KSYNCVIEW_H
00003 
00004 #include <qptrlist.h>
00005 #include <qwidget.h>
00006 
00007 #include <ktempfile.h>
00008 #include <kurl.h>
00009 #include <kio/job.h>
00010 #include <kdebug.h>
00011 
00012 #include <ksyncer.h>
00013 
00014 class QListView;
00015 class QCheckBox;
00016 class QComboBox;
00017 class QPushButton;
00018 class KConfig;
00019 class KURLRequester;
00020 
00021 class KSyncer;
00022 
00023 
00032 class KSyncView : public QWidget
00033 {
00034     Q_OBJECT
00035   public:
00037     KSyncView(QWidget *parent = 0, const char *name=0);
00039     ~KSyncView();
00040 
00041     enum { TypeCalendar, TypeBookmarks, TypeAddressBook };
00042 
00044     void print(QPrinter *pPrinter);
00045 
00046     void readConfig(KConfig *);
00047     void readTypeConfig(KConfig *);
00048     void writeConfig(KConfig *);
00049     void writeTypeConfig(KConfig *);
00050 
00051     void synceeLoadError();
00052     void synceeLoaded();
00053 
00054   private slots:
00055     void addSource();
00056     void removeSource();
00057     void showSource();
00058     void doSync();
00059     void checkSyncBack();
00060     void reloadSyncees();
00061     void finishSync();
00062     void jobFinished(KIO::Job *job);
00063     void slotSelectionChanged();  
00064   private:
00065     void checkFinish();
00066     KSyncee *createSyncee(const KURL &);
00067     QString createTempFile();
00068     
00069     QListView *mSourceListView;
00070     QComboBox *mTypeCombo;
00071     KURLRequester *mTargetReq;
00072     QCheckBox *mSyncBackCheck;
00073     
00074     int mCurrentType;
00075     
00076     KSyncer *mSyncer;
00077     KSyncee *mTarget;
00078     QPtrList<KTempFile> mTmpFiles;
00079     int mLoadCount;
00080     bool mLoadError;
00081     QPushButton *showButton,*removeButton;
00082 };
00083 
00084 
00085 class SynceeLoader : public QObject
00086 {
00087     Q_OBJECT
00088   public:
00089     SynceeLoader(KSyncView *parent,KSyncee *syncee,const QString &filename) :
00090       mSyncee(syncee), mParent(parent)
00091     {
00092       mSyncee->setFilename(filename);
00093     }
00094     virtual ~SynceeLoader() {}
00095     
00096   public slots:
00097     void loadSyncee(KIO::Job *job)
00098     {
00099       if (job->error()) {
00100         job->showErrorDialog(mParent);
00101         mParent->synceeLoadError();
00102       } else {
00103         loadSyncee();
00104         mParent->synceeLoaded();
00105       }
00106       delete this;
00107     }
00108     
00109     void loadSyncee()
00110     {
00111       kdDebug() << "SynceeLoader::loadSyncee(): " << mSyncee->filename()
00112                 << endl;
00113       if (!mSyncee->load()) {
00114         mParent->synceeLoadError();
00115       }
00116     }
00117     
00118   private:
00119     KSyncee *mSyncee;
00120     KSyncView *mParent;
00121 };
00122 
00123 #endif // KSYNCVIEW_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:17 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001