X-Git-Url: http://git.maemo.org/git/?p=onlineservices;a=blobdiff_plain;f=googledocumentservice.h;fp=googledocumentservice.h;h=83939d908d71f59b460dbef042790f1fafcd1dd3;hp=0000000000000000000000000000000000000000;hb=e884546178976e5db16be63d1faaf0a127fe60d6;hpb=e3f8ac15b2beb8c1b8513132401a75648488de62 diff --git a/googledocumentservice.h b/googledocumentservice.h new file mode 100644 index 0000000..83939d9 --- /dev/null +++ b/googledocumentservice.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2010 Mani Chandrasekar + * Kaushal M + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef GOOGLEDOCUMENTSERVICE_H +#define GOOGLEDOCUMENTSERVICE_H + +#include +#include +#include +#include +//#include "documentlistwindow.h" + +class GoogleDocumentList; +class GoogleDocument; +class GoogleContentHandler; +//class DocumentListWindow; + +class GoogleDocumentService : public QObject +{ + Q_OBJECT + +public: + GoogleDocumentService(); + void clientLogin(const QString & username, const QString & password); + void listDocuments(); + void prepareLists(); + void uploadDocument(QString *filename, QString *title); + void downloadDocument (GoogleDocument *, QString *saveFileName); + bool alreadyAuthenticated() { return loggedin; } + + QList documentList; + QList presentationList; + QList spreadsheetList; + QList othersList; + +signals: + void userAuthenticated(bool success); + void listDone(bool); + void downloadDone(bool); + void uploadDone(bool); + void downloadProgress(qint64 bytesSent, qint64 bytesTotal); + void uploadProgress(qint64 bytesSent, qint64 bytesTotal); + +private slots: + void handleNetworkData(QNetworkReply *networkReply); + +private: + QXmlSimpleReader xmlReader; + QXmlInputSource xmlInput; + bool newInformation; + bool waitingForDoc; + bool uploadingDoc; + bool loggedin; + bool haveDocAuthToken; + GoogleContentHandler *gHandler; + QString authToken; + QString docAuthToken; + QString spreadAuthToken; + QString *saveFileName; + QString username; + QString password; + QNetworkAccessManager networkManager; + + static const QString GOOGLE_DOCUMENT_URL; + static const QString GOOGLE_SPREADSHEET_URL; +}; + +#endif // GOOGLEDOCUMENTSERVICE_H