ksyncview.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KSYNCVIEW_H
00022 #define KSYNCVIEW_H
00023
00024 #include <qptrlist.h>
00025 #include <qwidget.h>
00026
00027 #include <ktempfile.h>
00028 #include <kurl.h>
00029 #include <kio/job.h>
00030 #include <kdebug.h>
00031
00032 #include <ksyncer.h>
00033
00034 class QListView;
00035 class QCheckBox;
00036 class QComboBox;
00037 class QPushButton;
00038 class KConfig;
00039 class KURLRequester;
00040
00041 class KSyncer;
00042
00043
00052 class KSyncView : public QWidget
00053 {
00054 Q_OBJECT
00055 public:
00057 KSyncView(QWidget *parent = 0, const char *name=0);
00059 ~KSyncView();
00060
00061 enum { TypeCalendar, TypeBookmarks, TypeAddressBook };
00062
00064 void print(QPrinter *pPrinter);
00065
00066 void readConfig(KConfig *);
00067 void readTypeConfig(KConfig *);
00068 void writeConfig(KConfig *);
00069 void writeTypeConfig(KConfig *);
00070
00071 void synceeLoadError();
00072 void synceeLoaded();
00073
00074 private slots:
00075 void addSource();
00076 void removeSource();
00077 void showSource();
00078 void doSync();
00079 void checkSyncBack();
00080 void reloadSyncees();
00081 void finishSync();
00082 void jobFinished(KIO::Job *job);
00083 void slotSelectionChanged();
00084 private:
00085 void checkFinish();
00086 KSyncee *createSyncee(const KURL &);
00087 QString createTempFile();
00088
00089 QListView *mSourceListView;
00090 QComboBox *mTypeCombo;
00091 KURLRequester *mTargetReq;
00092 QCheckBox *mSyncBackCheck;
00093
00094 int mCurrentType;
00095
00096 KSyncer *mSyncer;
00097 KSyncee *mTarget;
00098 QPtrList<KTempFile> mTmpFiles;
00099 int mLoadCount;
00100 bool mLoadError;
00101 QPushButton *showButton,*removeButton;
00102 };
00103
00104
00105 class SynceeLoader : public QObject
00106 {
00107 Q_OBJECT
00108 public:
00109 SynceeLoader(KSyncView *parent,KSyncee *syncee,const QString &filename) :
00110 mSyncee(syncee), mParent(parent)
00111 {
00112 mSyncee->setFilename(filename);
00113 }
00114 virtual ~SynceeLoader() {}
00115
00116 public slots:
00117 void loadSyncee(KIO::Job *job)
00118 {
00119 if (job->error()) {
00120 job->showErrorDialog(mParent);
00121 mParent->synceeLoadError();
00122 } else {
00123 loadSyncee();
00124 mParent->synceeLoaded();
00125 }
00126 delete this;
00127 }
00128
00129 void loadSyncee()
00130 {
00131 kdDebug() << "SynceeLoader::loadSyncee(): " << mSyncee->filename()
00132 << endl;
00133 if (!mSyncee->load()) {
00134 mParent->synceeLoadError();
00135 }
00136 }
00137
00138 private:
00139 KSyncee *mSyncee;
00140 KSyncView *mParent;
00141 };
00142
00143 #endif // KSYNCVIEW_H
This file is part of the documentation for ksync Library Version 3.2.2.