mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-06 20:33:38 +01:00
Added empty gmail entry point.
This commit is contained in:
parent
a10a78ab47
commit
67254d209c
@ -497,7 +497,9 @@ equals(USE_WEBENGINE, true) {
|
|||||||
src/services/inoreader/gui/formeditinoreaderaccount.h \
|
src/services/inoreader/gui/formeditinoreaderaccount.h \
|
||||||
src/services/inoreader/inoreaderfeed.h \
|
src/services/inoreader/inoreaderfeed.h \
|
||||||
src/network-web/oauth2service.h \
|
src/network-web/oauth2service.h \
|
||||||
src/gui/dialogs/oauthlogin.h
|
src/gui/dialogs/oauthlogin.h \
|
||||||
|
src/services/gmail/definitions.h \
|
||||||
|
src/services/gmail/gmailentrypoint.h
|
||||||
|
|
||||||
SOURCES += src/gui/locationlineedit.cpp \
|
SOURCES += src/gui/locationlineedit.cpp \
|
||||||
src/gui/webviewer.cpp \
|
src/gui/webviewer.cpp \
|
||||||
@ -512,7 +514,8 @@ equals(USE_WEBENGINE, true) {
|
|||||||
src/services/inoreader/gui/formeditinoreaderaccount.cpp \
|
src/services/inoreader/gui/formeditinoreaderaccount.cpp \
|
||||||
src/services/inoreader/inoreaderfeed.cpp \
|
src/services/inoreader/inoreaderfeed.cpp \
|
||||||
src/network-web/oauth2service.cpp \
|
src/network-web/oauth2service.cpp \
|
||||||
src/gui/dialogs/oauthlogin.cpp
|
src/gui/dialogs/oauthlogin.cpp \
|
||||||
|
src/services/gmail/gmailentrypoint.cpp
|
||||||
|
|
||||||
# Add AdBlock sources.
|
# Add AdBlock sources.
|
||||||
HEADERS += src/network-web/adblock/adblockaddsubscriptiondialog.h \
|
HEADERS += src/network-web/adblock/adblockaddsubscriptiondialog.h \
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#define SERVICE_CODE_TT_RSS "tt-rss"
|
#define SERVICE_CODE_TT_RSS "tt-rss"
|
||||||
#define SERVICE_CODE_OWNCLOUD "owncloud"
|
#define SERVICE_CODE_OWNCLOUD "owncloud"
|
||||||
#define SERVICE_CODE_INOREADER "inoreader"
|
#define SERVICE_CODE_INOREADER "inoreader"
|
||||||
|
#define SERVICE_CODE_GMAIL "gmail"
|
||||||
|
|
||||||
#define ARGUMENTS_LIST_SEPARATOR "\n"
|
#define ARGUMENTS_LIST_SEPARATOR "\n"
|
||||||
|
|
||||||
|
80
src/main.cpp
80
src/main.cpp
@ -175,58 +175,58 @@ int main(int argc, char* argv[]) {
|
|||||||
qApp->showPolls();
|
qApp->showPolls();
|
||||||
qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->loadAllExpandStates();
|
qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->loadAllExpandStates();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
OAuth2Service * srv = new OAuth2Service(
|
OAuth2Service* srv = new OAuth2Service(
|
||||||
"https://accounts.google.com/o/oauth2/auth",
|
"https://accounts.google.com/o/oauth2/auth",
|
||||||
"https://accounts.google.com/o/oauth2/token",
|
"https://accounts.google.com/o/oauth2/token",
|
||||||
"369069180494-j66bgeciouinec1eem7fhvj6qm0as7q3.apps.googleusercontent.com",
|
"369069180494-j66bgeciouinec1eem7fhvj6qm0as7q3.apps.googleusercontent.com",
|
||||||
"vppQtxrEeBkImiXcjGYl9NxZ",
|
"vppQtxrEeBkImiXcjGYl9NxZ",
|
||||||
"https://mail.google.com/");
|
"https://mail.google.com/");
|
||||||
|
|
||||||
srv->setRefreshToken("1/RKE3oohSoTHE54L0IPflvndK-DcI7l0of3lVdLa1Q9Q");
|
srv->setRefreshToken("1/RKE3oohSoTHE54L0IPflvndK-DcI7l0of3lVdLa1Q9Q");
|
||||||
QObject::connect(srv, &OAuth2Service::authCodeObtained, [](QString auth_code) {
|
QObject::connect(srv, &OAuth2Service::authCodeObtained, [](QString auth_code) {
|
||||||
int a = 5;
|
int a = 5;
|
||||||
});
|
});
|
||||||
QObject::connect(srv, &OAuth2Service::authFailed, []() {
|
QObject::connect(srv, &OAuth2Service::authFailed, []() {
|
||||||
int a = 5;
|
int a = 5;
|
||||||
});
|
});
|
||||||
QObject::connect(srv, &OAuth2Service::tokensReceived, [srv](QString acc, QString ref, int exp) {
|
QObject::connect(srv, &OAuth2Service::tokensReceived, [srv](QString acc, QString ref, int exp) {
|
||||||
|
|
||||||
QHttpMultiPart* multi = new QHttpMultiPart(srv);
|
QHttpMultiPart* multi = new QHttpMultiPart(srv);
|
||||||
QHttpPart p1;
|
QHttpPart p1;
|
||||||
QHttpPart p2;
|
QHttpPart p2;
|
||||||
|
|
||||||
multi->setContentType(QHttpMultiPart::ContentType::MixedType);
|
multi->setContentType(QHttpMultiPart::ContentType::MixedType);
|
||||||
p1.setRawHeader("Content-Type", "application/http");
|
p1.setRawHeader("Content-Type", "application/http");
|
||||||
p2.setRawHeader("Content-Type", "application/http");
|
p2.setRawHeader("Content-Type", "application/http");
|
||||||
p1.setBody("GET /gmail/v1/users/me/messages\r\n");
|
p1.setBody("GET /gmail/v1/users/me/messages\r\n");
|
||||||
p2.setBody("GET /gmail/v1/users/me/labels\r\n");
|
p2.setBody("GET /gmail/v1/users/me/labels\r\n");
|
||||||
multi->append(p1);
|
multi->append(p1);
|
||||||
multi->append(p2);
|
multi->append(p2);
|
||||||
QNetworkRequest req;
|
QNetworkRequest req;
|
||||||
|
|
||||||
auto bearer = srv->bearer();
|
auto bearer = srv->bearer();
|
||||||
req.setRawHeader(QString("Authorization").toLocal8Bit(), bearer.toLocal8Bit());
|
req.setRawHeader(QString("Authorization").toLocal8Bit(), bearer.toLocal8Bit());
|
||||||
|
|
||||||
req.setUrl(QUrl::fromUserInput("https://www.googleapis.com/batch"));
|
req.setUrl(QUrl::fromUserInput("https://www.googleapis.com/batch"));
|
||||||
auto* repl = SilentNetworkAccessManager::instance()->post(req, multi);
|
auto* repl = SilentNetworkAccessManager::instance()->post(req, multi);
|
||||||
|
|
||||||
//req.setUrl(QUrl::fromUserInput("https://www.googleapis.com/gmail/v1/users/me/labels"));
|
//req.setUrl(QUrl::fromUserInput("https://www.googleapis.com/gmail/v1/users/me/labels"));
|
||||||
//auto* repl = SilentNetworkAccessManager::instance()->get(req);
|
//auto* repl = SilentNetworkAccessManager::instance()->get(req);
|
||||||
|
|
||||||
QObject::connect(repl, &QNetworkReply::finished, [repl]() {
|
QObject::connect(repl, &QNetworkReply::finished, [repl]() {
|
||||||
auto resp = repl->readAll();
|
auto resp = repl->readAll();
|
||||||
auto a = 8;
|
auto a = 8;
|
||||||
|
|
||||||
IOFactory::writeTextFile("b.html", resp);
|
IOFactory::writeTextFile("b.html", resp);
|
||||||
});
|
});
|
||||||
|
|
||||||
int a = 5;
|
int a = 5;
|
||||||
});
|
});
|
||||||
QObject::connect(srv, &OAuth2Service::tokensRetrieveError, [](QString err, QString desc) {
|
QObject::connect(srv, &OAuth2Service::tokensRetrieveError, [](QString err, QString desc) {
|
||||||
int a = 5;
|
int a = 5;
|
||||||
});
|
});
|
||||||
srv->login(); */
|
srv->login();*/
|
||||||
|
|
||||||
// Enter global event loop.
|
// Enter global event loop.
|
||||||
return Application::exec();
|
return Application::exec();
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "services/abstract/serviceroot.h"
|
#include "services/abstract/serviceroot.h"
|
||||||
|
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
|
#include "services/gmail/gmailentrypoint.h"
|
||||||
#include "services/inoreader/inoreaderentrypoint.h"
|
#include "services/inoreader/inoreaderentrypoint.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ QList<ServiceEntryPoint*> FeedReader::feedServices() {
|
|||||||
if (m_feedServices.isEmpty()) {
|
if (m_feedServices.isEmpty()) {
|
||||||
// NOTE: All installed services create their entry points here.
|
// NOTE: All installed services create their entry points here.
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
|
m_feedServices.append(new GmailEntryPoint());
|
||||||
m_feedServices.append(new InoreaderEntryPoint());
|
m_feedServices.append(new InoreaderEntryPoint());
|
||||||
#endif
|
#endif
|
||||||
m_feedServices.append(new OwnCloudServiceEntryPoint());
|
m_feedServices.append(new OwnCloudServiceEntryPoint());
|
||||||
|
@ -289,9 +289,10 @@ void OAuth2Service::killRefreshTimer() {
|
|||||||
|
|
||||||
void OAuth2Service::retrieveAuthCode() {
|
void OAuth2Service::retrieveAuthCode() {
|
||||||
QString auth_url = m_authUrl + QString("?client_id=%1&scope=%2&"
|
QString auth_url = m_authUrl + QString("?client_id=%1&scope=%2&"
|
||||||
"redirect_uri=%3&response_type=code&state=abcdef").arg(m_clientId,
|
"redirect_uri=%3&response_type=code&state=abcdef&"
|
||||||
m_scope,
|
"prompt=consent&access_type=offline").arg(m_clientId,
|
||||||
m_redirectUrl);
|
m_scope,
|
||||||
|
m_redirectUrl);
|
||||||
OAuthLogin login_page(qApp->mainFormWidget());
|
OAuthLogin login_page(qApp->mainFormWidget());
|
||||||
|
|
||||||
connect(&login_page, &OAuthLogin::authGranted, this, &OAuth2Service::authCodeObtained);
|
connect(&login_page, &OAuthLogin::authGranted, this, &OAuth2Service::authCodeObtained);
|
||||||
|
22
src/services/gmail/definitions.h
Executable file
22
src/services/gmail/definitions.h
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
// This file is part of RSS Guard.
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copyright (C) 2011-2017 by Martin Rotter <rotter.martinos@gmail.com>
|
||||||
|
//
|
||||||
|
// RSS Guard 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 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef GMAIL_DEFINITIONS_H
|
||||||
|
#define GMAIL_DEFINITIONS_H
|
||||||
|
|
||||||
|
#endif // GMAIL_DEFINITIONS_H
|
61
src/services/gmail/gmailentrypoint.cpp
Executable file
61
src/services/gmail/gmailentrypoint.cpp
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
// This file is part of RSS Guard.
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copyright (C) 2011-2017 by Martin Rotter <rotter.martinos@gmail.com>
|
||||||
|
//
|
||||||
|
// RSS Guard 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 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "services/gmail/gmailentrypoint.h"
|
||||||
|
|
||||||
|
#include "definitions/definitions.h"
|
||||||
|
#include "miscellaneous/application.h"
|
||||||
|
#include "miscellaneous/databasequeries.h"
|
||||||
|
#include "miscellaneous/iconfactory.h"
|
||||||
|
#include "services/gmail/definitions.h"
|
||||||
|
|
||||||
|
ServiceRoot* GmailEntryPoint::createNewRoot() const {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ServiceRoot*> GmailEntryPoint::initializeSubtree() const {
|
||||||
|
QSqlDatabase database = qApp->database()->connection(QSL("GmailEntryPoint"), DatabaseFactory::FromSettings);
|
||||||
|
|
||||||
|
return QList<ServiceRoot*>();
|
||||||
|
|
||||||
|
//return DatabaseQueries::getInoreaderAccounts(database);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GmailEntryPoint::isSingleInstanceService() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GmailEntryPoint::name() const {
|
||||||
|
return QSL("Gmail (not yet implemented)");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GmailEntryPoint::code() const {
|
||||||
|
return SERVICE_CODE_GMAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GmailEntryPoint::description() const {
|
||||||
|
return QObject::tr("Simple Gmail integration via JSON API. Allows sending e-mails too.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GmailEntryPoint::author() const {
|
||||||
|
return APP_AUTHOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon GmailEntryPoint::icon() const {
|
||||||
|
return qApp->icons()->miscIcon(QSL("gmail"));
|
||||||
|
}
|
37
src/services/gmail/gmailentrypoint.h
Executable file
37
src/services/gmail/gmailentrypoint.h
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
// This file is part of RSS Guard.
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copyright (C) 2011-2017 by Martin Rotter <rotter.martinos@gmail.com>
|
||||||
|
//
|
||||||
|
// RSS Guard 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 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef GMAILENTRYPOINT_H
|
||||||
|
#define GMAILENTRYPOINT_H
|
||||||
|
|
||||||
|
#include "services/abstract/serviceentrypoint.h"
|
||||||
|
|
||||||
|
class GmailEntryPoint : public ServiceEntryPoint {
|
||||||
|
public:
|
||||||
|
ServiceRoot* createNewRoot() const;
|
||||||
|
|
||||||
|
QList<ServiceRoot*> initializeSubtree() const;
|
||||||
|
bool isSingleInstanceService() const;
|
||||||
|
QString name() const;
|
||||||
|
QString code() const;
|
||||||
|
QString description() const;
|
||||||
|
QString author() const;
|
||||||
|
QIcon icon() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GMAILENTRYPOINT_H
|
Loading…
x
Reference in New Issue
Block a user