This commit is contained in:
Martin Rotter 2020-07-26 09:08:27 +02:00
parent 13655c900f
commit 1fc908257a
23 changed files with 134 additions and 45 deletions

View file

@ -2144,6 +2144,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2139,6 +2139,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2140,6 +2140,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2167,6 +2167,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2142,6 +2142,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2142,6 +2142,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2139,6 +2139,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2138,6 +2138,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2141,6 +2141,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2142,6 +2142,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2138,6 +2138,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2144,6 +2144,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2142,6 +2142,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2144,6 +2144,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -448,7 +448,7 @@ Clique para abrir a pasta de destino.</translation>
</message>
<message>
<source>E-mail address</source>
<translation type="unfinished"/>
<translation>Endereço de e-mail</translation>
</message>
</context>
<context>
@ -737,7 +737,7 @@ ou esta função ainda não foi implementada.</translation>
</message>
<message>
<source>GNU GPL License (applies to RSS Guard and mimesis source code)</source>
<translation type="unfinished"/>
<translation>Licença GNU GPL (aplica-se ao código fonte do RSS Guard e mimesis)</translation>
</message>
</context>
<context>
@ -771,19 +771,19 @@ ou esta função ainda não foi implementada.</translation>
</message>
<message>
<source>Subject</source>
<translation type="unfinished"/>
<translation>Assunto</translation>
</message>
<message>
<source>Title of your message</source>
<translation type="unfinished"/>
<translation>Título da sua mensagem</translation>
</message>
<message>
<source>E-mail NOT sent</source>
<translation type="unfinished"/>
<translation>E-mail NÃO enviado</translation>
</message>
<message>
<source>Your e-mail message wasn&apos;t sent.</source>
<translation type="unfinished"/>
<translation>Sua mensagem de e-mail não foi enviada.</translation>
</message>
</context>
<context>
@ -1047,7 +1047,7 @@ ou esta função ainda não foi implementada.</translation>
</message>
<message>
<source>Specified redirect URL must start with &quot;http://localhost&quot; and must be configured in your OAuth &quot;application&quot;.</source>
<translation type="unfinished"/>
<translation>A URL de redirecionamento especificada deve começar com &quot;http://localhost&quot; e deve ser configurada no &quot;aplicativo&quot; OAuth.</translation>
</message>
</context>
<context>
@ -1146,13 +1146,15 @@ ou esta função ainda não foi implementada.</translation>
</message>
<message>
<source>Get my own Application ID</source>
<translation type="unfinished"/>
<translation>Obter minha própria ID de Aplicativo</translation>
</message>
<message>
<source>Specified redirect URL must start with &quot;http://localhost&quot; and must be configured in your OAuth &quot;application&quot;.
It is highly recommended to create your own &quot;Application ID&quot;.</source>
<translation type="unfinished"/>
<translation>A URL de redirecionamento especificada deve começar com &quot;http://localhost&quot; e deve ser configurada no &quot;aplicativo&quot; OAuth.
É altamente recomendado criar seu próprio &quot;ID de Aplicativo&quot;.</translation>
</message>
</context>
<context>
@ -2144,6 +2146,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation>&amp;Filtros de mensagem</translation>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>
@ -2309,7 +2315,7 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
</message>
<message>
<source>Cannot save new filter, error: &apos;&apos;.</source>
<translation type="unfinished"/>
<translation>Não foi possível salvar o novo filtro, erro: &quot;.</translation>
</message>
</context>
<context>
@ -2880,15 +2886,15 @@ Você pode instalá-lo agora.</translation>
</message>
<message>
<source>you aren&apos;t logged in</source>
<translation type="unfinished"/>
<translation>você não está logado</translation>
</message>
<message>
<source>not logged-in</source>
<translation type="unfinished"/>
<translation>não logado</translation>
</message>
<message>
<source>comm error when asking for recipients</source>
<translation type="unfinished"/>
<translation>erro comm ao perguntar por destinatários</translation>
</message>
</context>
<context>
@ -3523,7 +3529,7 @@ versão, clicando nesta notificação popup.</translation>
</message>
<message>
<source>Cannot insert message filter, because current database cannot return last inserted row ID.</source>
<translation type="unfinished"/>
<translation>Não é possível inserir o filtro de mensagens, porque o banco de dados atual não pode retornar o último ID da linha inserida.</translation>
</message>
</context>
<context>

View file

@ -2143,6 +2143,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -448,7 +448,7 @@ Klicka här för att öppna målmappen.</translation>
</message>
<message>
<source>E-mail address</source>
<translation type="unfinished"/>
<translation>E-postadress</translation>
</message>
</context>
<context>
@ -737,7 +737,7 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>GNU GPL License (applies to RSS Guard and mimesis source code)</source>
<translation type="unfinished"/>
<translation>GNU GPL Licens (gäller RSS Guard och mimesis källkod)</translation>
</message>
</context>
<context>
@ -771,19 +771,19 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>Subject</source>
<translation type="unfinished"/>
<translation>Ämne</translation>
</message>
<message>
<source>Title of your message</source>
<translation type="unfinished"/>
<translation>Meddelandetitel</translation>
</message>
<message>
<source>E-mail NOT sent</source>
<translation type="unfinished"/>
<translation>E-postmeddelande INTE skickat</translation>
</message>
<message>
<source>Your e-mail message wasn&apos;t sent.</source>
<translation type="unfinished"/>
<translation>Ditt e-postmeddelande skickades inte.</translation>
</message>
</context>
<context>
@ -1047,7 +1047,7 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>Specified redirect URL must start with &quot;http://localhost&quot; and must be configured in your OAuth &quot;application&quot;.</source>
<translation type="unfinished"/>
<translation>Angiven omdirigerings-URL måste börja med &quot;http://localhost&quot; och måste konfigureras i ditt &quot;OAuth-program&quot;.</translation>
</message>
</context>
<context>
@ -1146,13 +1146,15 @@ att funktionen inte är implementerad än.</translation>
</message>
<message>
<source>Get my own Application ID</source>
<translation type="unfinished"/>
<translation>Skapa mitt eget applikations-ID</translation>
</message>
<message>
<source>Specified redirect URL must start with &quot;http://localhost&quot; and must be configured in your OAuth &quot;application&quot;.
It is highly recommended to create your own &quot;Application ID&quot;.</source>
<translation type="unfinished"/>
<translation>Angiven omdirigerings-URL måste börja med &quot;http://localhost&quot; och måste konfigureras i ditt &quot;OAuth-program&quot;.
Det rekommenderas starkt att du skapar ditt eget applikations-ID.</translation>
</message>
</context>
<context>
@ -2144,6 +2146,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation>Meddelande&amp;filter</translation>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>
@ -2309,7 +2315,7 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
</message>
<message>
<source>Cannot save new filter, error: &apos;&apos;.</source>
<translation type="unfinished"/>
<translation>Kan inte spara nytt filter, fel: &quot;.</translation>
</message>
</context>
<context>
@ -2879,15 +2885,15 @@ Du kan installera det nu.</translation>
</message>
<message>
<source>you aren&apos;t logged in</source>
<translation type="unfinished"/>
<translation>Du är inte inloggad</translation>
</message>
<message>
<source>not logged-in</source>
<translation type="unfinished"/>
<translation>Inte inloggad</translation>
</message>
<message>
<source>comm error when asking for recipients</source>
<translation type="unfinished"/>
<translation>comm-fel när mottagare efterfrågas</translation>
</message>
</context>
<context>
@ -3522,7 +3528,7 @@ genom att klicka på denna popup-avisering.</translation>
</message>
<message>
<source>Cannot insert message filter, because current database cannot return last inserted row ID.</source>
<translation type="unfinished"/>
<translation>Kan inte infoga meddelandefilter eftersom den aktuella databasen inte kan returnera senast infogat rad-ID.</translation>
</message>
</context>
<context>

View file

@ -2140,6 +2140,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2141,6 +2141,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation type="unfinished"/>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -2143,6 +2143,10 @@ It is highly recommended to create your own &quot;Application ID&quot;.</source>
<source>Message &amp;filters</source>
<translation>(&amp;F)</translation>
</message>
<message>
<source>&amp;Show tree branches</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>FormMessageFiltersManager</name>

View file

@ -42,11 +42,12 @@
#include <cstdlib>
#include <utility>
Q_GLOBAL_STATIC(OAuthHttpHandler, qz_silent_acmanager)
OAuth2Service::OAuth2Service(const QString& auth_url, const QString& token_url, const QString& client_id,
const QString& client_secret, const QString& scope, QObject* parent)
: QObject(parent), m_id(QString::number(QRandomGenerator::global()->generate())), m_timerId(-1), m_redirectionHandler(new OAuthHttpHandler(this)) {
: QObject(parent),
m_id(QString::number(QRandomGenerator::global()->generate())), m_timerId(-1),
m_redirectionHandler(new OAuthHttpHandler(tr("You can close this window now. Go back to %1").arg(APP_NAME),
this)) {
m_tokenGrantType = QSL("authorization_code");
m_tokenUrl = QUrl(token_url);
m_authUrl = auth_url;

View file

@ -10,9 +10,7 @@
#include <QTcpSocket>
#include <QUrlQuery>
OAuthHttpHandler::OAuthHttpHandler(QObject* parent) : QObject(parent) {
m_text = tr("You can close this window now. Go back to %1").arg(APP_NAME);
OAuthHttpHandler::OAuthHttpHandler(const QString& success_text, QObject* parent) : QObject(parent), m_successText(success_text) {
connect(&m_httpServer, &QTcpServer::newConnection, this, &OAuthHttpHandler::clientConnected);
setListenAddressPort(QString(OAUTH_REDIRECT_URI) + QL1C(':') + QString::number(OAUTH_REDIRECT_URI_PORT));
}
@ -118,17 +116,17 @@ void OAuthHttpHandler::answerClient(QTcpSocket* socket, const QUrl& url) {
handleRedirection(received_data);
const QByteArray html = QByteArrayLiteral("<html><head><title>") +
qApp->applicationName().toUtf8() +
QByteArrayLiteral("</title></head><body>") +
m_text.toUtf8() +
QByteArrayLiteral("</body></html>");
const QByteArray html_size = QString::number(html.size()).toUtf8();
const QString html = QSL("<html><head><title>") +
qApp->applicationName() +
QSL("</title></head><body>") +
m_successText +
QSL("</body></html>");
const QByteArray html_utf = html.toUtf8();
const QByteArray html_size = QString::number(html_utf.size()).toLocal8Bit();
const QByteArray reply_message = QByteArrayLiteral("HTTP/1.0 200 OK \r\n"
"Content-Type: text/html; "
"charset=\"utf-8\"\r\n"
"Content-Type: text/html; charset=\"utf-8\"\r\n"
"Content-Length: ") + html_size +
QByteArrayLiteral("\r\n\r\n") + html;
QByteArrayLiteral("\r\n\r\n") + html_utf;
socket->write(reply_message);
}

View file

@ -12,15 +12,21 @@ class OAuthHttpHandler : public QObject {
Q_OBJECT
public:
explicit OAuthHttpHandler(QObject* parent = nullptr);
explicit OAuthHttpHandler(const QString& success_text, QObject* parent = nullptr);
virtual ~OAuthHttpHandler();
bool isListening() const;
// Returns listening portnumber.
quint16 listenPort() const;
// Returns listening IP address, usually something like "127.0.0.1".
QHostAddress listenAddress() const;
// Returns full URL string.
QString listenAddressPort() const;
// Sets full URL string, for example "http://localhost:123456".
void setListenAddressPort(const QString& full_uri);
signals:
@ -72,7 +78,7 @@ class OAuthHttpHandler : public QObject {
QHostAddress m_listenAddress;
quint16 m_listenPort;
QString m_listenAddressPort;
QString m_text;
QString m_successText;
};
#endif // OAUTHHTTPHANDLER_H