-
Notifications
You must be signed in to change notification settings - Fork 2
/
evernotesession.h
116 lines (92 loc) · 3.03 KB
/
evernotesession.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#ifndef EVERNOTESESSION_H
#define EVERNOTESESSION_H
#include "edam/UserStore.h"
#include "constants/constants.h"
#include "cache.h"
#include "thrift/transport/THttpClient.h"
#include "thrift/protocol/TBinaryProtocol.h"
#include "thrift/transport/TSSLSocket.h"
#include "thrift/Thrift.h"
#include "edam/UserStore.h"
#include "edam/UserStore_constants.h"
#include "edam/NoteStore.h"
#include "edam/NoteStore_constants.h"
#include "edam/NoteStore_types.h"
#include "edam/Errors_constants.h"
#include "edam/Errors_types.h"
#include "db/databasemanager.h"
#include "db/databaseconstants.h"
#include "constants/settingskeys.h"
#include <boost/shared_ptr.hpp>
#include <QObject>
#include "settings.h"
#include "fileutils.h"
#include "wrappers/resourcewrapper.h"
#include "wrappers/savedsearchwrapper.h"
using namespace std;
using namespace boost;
using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;
using namespace apache::thrift;
using namespace evernote::edam;
class EvernoteSession : public QObject
{
Q_OBJECT
public:
static const std::string CONSUMER_KEY;
static const std::string CONSUMER_SECRET;
static EvernoteSession* instance();
EvernoteSession(QObject *parent = 0);
~EvernoteSession();
signals:
void authenticationSuccess();
void authenticationFailed(QString error);
void syncFailed(QString error);
void syncStarted(int percent);
void syncFinished();
void tagsSyncStarted();
void notebooksSyncStarted();
void noteLoadStarted(NoteWrapper* note);
void noteLoadFinished(NoteWrapper* note);
void noteLoadError(QString error);
void noteContentDownloaded(NoteWrapper* note);
void resourceDownloaded(ResourceWrapper* r);
void logoutStarted();
void logoutFinished();
public slots:
void reauth();
void auth(const QString& username, const QString& password);
void recreateUserStoreClient(bool force);
void recreateSyncClient(bool force); void authAsync(const QString& username, const QString& password);
void sync();
void syncAsync();
void getNoteContentAsync(NoteWrapper* note);
void getNoteContent(NoteWrapper* note);
void getNoteTags(NoteWrapper* note);
void addNote(NoteWrapper* note);
void updateNote(NoteWrapper* note);
void updateNoteTags(NoteWrapper* note);
void deleteNote(NoteWrapper* note);
void addSavedSearch(SavedSearchWrapper* search);
void updateSavedSearch(SavedSearchWrapper* search);
void addNotebook(NotebookWrapper* notebook);
QString createTag(QString name);
void searchNotes(QString query);
void exit();
static void drop();
void logout();
void logoutAsync();
bool isSyncInProgress();
void cancelGetNoteContent();
void cancelSync();
private:
static EvernoteSession* m_instance;
UserStoreClient* userStoreClient;
shared_ptr<TTransport> userStoreTransport;
NoteStoreClient* syncClient;
shared_ptr<TTransport> syncTransport;
bool syncInProgress;
bool cancelGetNote;
bool syncCancelled;
};
#endif // EVERNOTESESSION_H