kitchensync

socket.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002,2003 Holger Freyther <freyther@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., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef QTOPIA_OPIE_SOCKET_H
00022 #define QTOPIA_OPIE_SOCKET_H
00023 
00024 #include <qobject.h>
00025 
00026 #include "qtopiakonnector.h"
00027 
00028 class KURL;
00029 
00030 namespace KSync {
00031 class AddressBookSyncee;
00032 class CalendarSyncee;
00033 
00034 class QtopiaSocket : public QObject
00035 {
00036   Q_OBJECT
00037 
00038   public:
00039     QtopiaSocket( QObject *obj, const char *name );
00040     ~QtopiaSocket();
00041 
00042     QString storagePath()const;
00043 
00044     void setUser( const QString &user );
00045     void setPassword( const QString &pass );
00046     void setSrcIP( const QString & );
00047     void setDestIP( const QString & );
00048     void setModel( const QString &model, const QString &name );
00049 
00050     void startUp();
00051     void hangUp();
00052 
00053     bool startSync();
00054     bool isConnected();
00055 
00056     void write( SynceeList );
00057     void download( const QString &res );
00058     void setResources( const QStringList & );
00059     QString metaId() const;
00060 
00061   signals:
00062     void sync( SynceeList );
00063 
00064   public slots:
00065     void setStoragePath(const QString&);
00066 
00067   private slots:
00068     void slotError(int);
00069     void slotConnected();
00070     void slotClosed();
00071     void slotNOOP();
00072     void process();
00073     void slotStartSync();
00074 
00075   private:
00076     enum Type
00077     {
00078       AddressBook,
00079       TodoList,
00080       DateBook
00081     };
00082 
00083 
00084     KURL url( Type );
00085     KURL url( const QString &path );
00086     void writeCategory();
00087     void writeAddressbook( AddressBookSyncee * );
00088     void writeDatebook( CalendarSyncee * );
00089     void writeTodoList( CalendarSyncee * );
00090     void writeUnknown( KSync::UnknownSyncee * );
00091 
00092     void readAddressbook();
00093     void readDatebook();
00094     void readTodoList();
00095     void doCalendarMeta();
00096 
00097     CalendarSyncee* defaultCalendarSyncee();
00098 
00099     /* for processing the connection and authentication */
00100     void start(const QString & );
00101     void user( const QString & );
00102     void pass( const QString & );
00103     void call( const QString & );
00104     void flush( const QString & );
00105     void noop( const QString & );
00106 
00107     void handshake( const QString & );
00108     void download();
00109     void initSync( const QString & );
00110 
00111     void initFiles();
00112     QString partnerIdPath() const;
00113     void readTimeZones();
00114 
00115     void sendCommand( const QString& cmd );
00116 
00117     /* download relative from the home dir */
00118     bool downloadFile( const QString &str, QString &newDest );
00119     int m_flushedApps;
00120 
00121     KPIM::ProgressItem *mProgressItem;
00122 
00123     class Private;
00124     Private *d;
00125 };
00126 
00127 }
00128 
00129 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys