Added KOfficemeego dependency
[froff-onlinedoc] / slideshare.h
1 /*
2  *  Copyright (c) 2010 Kaushal M <kshlmster@gmail.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef SLIDESHARE_H
20 #define SLIDESHARE_H
21
22 #include <QObject>
23 #include <QtCore>
24 #include <QUrl>
25 #include <QNetworkAccessManager>
26 #include <QNetworkRequest>
27 #include <QNetworkCookieJar>
28
29
30 struct SlideShareDocument;
31
32 class SlideShare : public QObject
33 {
34     Q_OBJECT
35
36 public:
37     SlideShare(QObject *parent = 0);
38     SlideShare(QString *username, QString *password, QObject *parent = 0);
39     SlideShare(QString *username, QString *password, QString *apiKey, QString *secretKey, QObject *parent);
40     ~SlideShare();
41
42     void login();
43     void upload();
44     void download(QString *durl);
45     void listDocuments();
46     void searchByTags(QString *tag);
47
48     void setApikey(QString *apiKey);
49     void setsecretKey(QString *secretKey);
50
51     void setUsername(QString *username);
52     void setPassword(QString *password);
53
54     void setSlideTitle(QString *title);
55     void setDescription(QString *description);
56     void setTags(QString *tags);
57     void setFormat(QString *format);
58
59     void setSourceFile(QString *filename);
60     void setSaveFileName(QString *saveFileName);
61
62     QList<SlideShareDocument> textDocList;
63     QList<SlideShareDocument> presentationList;
64     QList<SlideShareDocument> spreadsheetList;
65
66 private:
67     QString *apiKey;
68     QString *secretKey;
69     QString *username;
70     QString *password;
71
72     QString *sourceFilename;
73     QString *saveFileName;
74
75     SlideShareDocument *doc;
76
77     bool loginStatus;
78
79     QNetworkAccessManager manager;
80     QNetworkCookieJar cookieJar;
81     QNetworkReply *reply;
82
83     void getThumbnailSmall();
84     void getThumbnailBig();
85
86
87 private slots:
88     void afterLogin();
89     void parseList();
90     void saveFile();
91
92 signals:
93     void downloadProgress(qint64 bytesSent, qint64 bytesTotal);
94     void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
95     void loginDone(bool);
96     void uploadDone();
97     void listDone();
98     void downloadDone();
99
100 };
101
102 #endif // SLIDESHARE_H