-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogleaccess.cpp
80 lines (64 loc) · 1.73 KB
/
googleaccess.cpp
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
/*
*
*
*/
#include "googleaccess.h"
#include "../Lib/supportfunctions.h"
#include "configuration.h"
#include "calendar.h"
#include <QDir>
#include <QFile>
//
// Public: GoogleAccess - Constructor
//
// Initialises, and saves the refresh token to the internal data structures
// if it has been provided. If it is not provided, no function will work, and
// a refresh token must be acquired by calling the Authorise function.
//
GoogleAccess::GoogleAccess()
{
username="" ;
refreshtoken="" ;
errorstatus="" ;
accesstoken="" ;
refreshtokenandusername = "" ;
logsequencenumber = 1 ;
}
//=====================================================================================================
//
// Public: getUsername
//
// Returns the username associated with the current google login
//
QString GoogleAccess::getUsername()
{
return username ;
}
//=====================================================================================================
//
// Public: resetLogFiles & debugGetDataResponse & debugPutDataResponse
//
// Debug functions
//
void GoogleAccess::resetLogFiles()
{
QStringList nameFilter, files ;
QDir logdir(gConf->getDatabasePath()) ;
// Longhand to prevent trigraph warning
nameFilter << QString("?") + QString("?") + QString("?") + QString("?-*.cmlog") ;
logdir.setNameFilters(nameFilter) ;
files = logdir.entryList() ;
for (int i=files.size()-1; i>=0; i--) {
QString filename = gConf->getDatabasePath() + "/" + files.at(i) ;
QFile::remove(filename) ;
}
logsequencenumber=1 ;
}
QString GoogleAccess::debugGetDataResponse()
{
return googleGetResponse ;
}
QString GoogleAccess::debugPutPostDataResponse()
{
return googlePutPostResponse ;
}