ksync Library API Documentation

ksyncview.h

00001 /* 00002 This file is part of ksync. 00003 00004 Copyright (c) 2001 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., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 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
KDE Logo
This file is part of the documentation for ksync Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:50 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003