2 * Copyright (c) 2010 Mani Chandrasekar <maninc@gmail.com>
3 * Kaushal M <kshlmster@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef GOOGLEDOCUMENTSERVICE_H
21 #define GOOGLEDOCUMENTSERVICE_H
24 #include <QXmlInputSource>
25 #include <QNetworkAccessManager>
27 //#include "documentlistwindow.h"
29 class GoogleDocumentList;
31 class GoogleContentHandler;
32 //class DocumentListWindow;
34 class GoogleDocumentService : public QObject
39 GoogleDocumentService();
40 void clientLogin(const QString & username, const QString & password);
43 void uploadDocument(QString *filename, QString *title);
44 void downloadDocument(GoogleDocument *, QString *saveFileName);
45 bool alreadyAuthenticated() {
49 QList<GoogleDocument *> documentList;
50 QList<GoogleDocument *> presentationList;
51 QList<GoogleDocument *> spreadsheetList;
52 QList<GoogleDocument *> othersList;
55 void userAuthenticated(bool success);
57 void downloadDone(bool);
58 void uploadDone(bool);
59 void downloadProgress(qint64 bytesSent, qint64 bytesTotal);
60 void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
63 void handleNetworkData(QNetworkReply *networkReply);
66 QXmlSimpleReader xmlReader;
67 QXmlInputSource xmlInput;
72 bool haveDocAuthToken;
73 GoogleContentHandler *gHandler;
76 QString spreadAuthToken;
77 QString *saveFileName;
80 QNetworkAccessManager networkManager;
82 static const QString GOOGLE_DOCUMENT_URL;
83 static const QString GOOGLE_SPREADSHEET_URL;
86 #endif // GOOGLEDOCUMENTSERVICE_H