mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-01 02:48:05 +01:00
some refactorings, tray icon test
This commit is contained in:
parent
1fc0337211
commit
44ee50ab76
@ -30,7 +30,7 @@
|
||||
<url type="donation">https://martinrotter.github.io/donate/</url>
|
||||
<content_rating type="oars-1.1" />
|
||||
<releases>
|
||||
<release version="3.9.2" date="2021-04-28"/>
|
||||
<release version="3.9.0" date="2021-02-25"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "services/owncloud/network/owncloudnetworkfactory.h"
|
||||
#include "services/standard/gui/formstandardimportexport.h"
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
#include "network-web/adblock/adblockicon.h"
|
||||
#include "network-web/adblock/adblockmanager.h"
|
||||
#endif
|
||||
@ -62,7 +62,7 @@ FormMain::FormMain(QWidget* parent, Qt::WindowFlags f)
|
||||
setWindowIcon(qApp->desktopAwareIcon());
|
||||
setWindowTitle(APP_LONG_NAME);
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
m_ui->m_menuWebBrowserTabs->addAction(qApp->web()->adBlock()->adBlockIcon());
|
||||
m_ui->m_menuWebBrowserTabs->addAction(qApp->web()->engineSettingsAction());
|
||||
#endif
|
||||
@ -204,7 +204,7 @@ QList<QAction*> FormMain::allActions() const {
|
||||
|
||||
void FormMain::prepareMenus() {
|
||||
// Setup menu for tray icon.
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
if (SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
#if defined(Q_OS_WIN)
|
||||
m_trayMenu = new TrayIconMenu(APP_NAME, this);
|
||||
#else
|
||||
@ -449,7 +449,7 @@ void FormMain::updateFeedButtonsAvailability() {
|
||||
|
||||
void FormMain::switchVisibility(bool force_hide) {
|
||||
if (force_hide || isVisible()) {
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
if (SystemTrayIcon::isSystemTrayDesired() && SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
hide();
|
||||
}
|
||||
else {
|
||||
@ -813,7 +813,8 @@ void FormMain::changeEvent(QEvent* event) {
|
||||
switch (event->type()) {
|
||||
case QEvent::WindowStateChange: {
|
||||
if ((windowState() & Qt::WindowState::WindowMinimized) == Qt::WindowState::WindowMinimized &&
|
||||
SystemTrayIcon::isSystemTrayActivated() &&
|
||||
SystemTrayIcon::isSystemTrayDesired() &&
|
||||
SystemTrayIcon::isSystemTrayAreaAvailable() &&
|
||||
qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideMainWindowWhenMinimized)).toBool()) {
|
||||
event->ignore();
|
||||
QTimer::singleShot(CHANGE_EVENT_DELAY, this, [this]() {
|
||||
|
@ -515,7 +515,7 @@ void FormMessageFiltersManager::beautifyScript() {
|
||||
proc_clang_format.setInputChannelMode(QProcess::InputChannelMode::ManagedInputChannel);
|
||||
proc_clang_format.setArguments({ "--assume-filename=script.js", "--style=Chromium" });
|
||||
|
||||
#if defined (Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
proc_clang_format.setProgram(qApp->applicationDirPath() + QDir::separator() +
|
||||
QSL("clang-format") + QDir::separator() +
|
||||
QSL("clang-format.exe"));
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "definitions/definitions.h"
|
||||
|
||||
#if defined (Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QSize>
|
||||
@ -31,7 +31,7 @@ void GuiUtilities::applyDialogProperties(QWidget& widget, const QIcon& icon, con
|
||||
}
|
||||
|
||||
void GuiUtilities::applyResponsiveDialogResize(QWidget& widget, double factor) {
|
||||
#if defined (Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID)
|
||||
auto desktop_geom = QApplication::desktop()->screenGeometry();
|
||||
auto ratio = double(widget.size().height()) / widget.size().width();
|
||||
int widt = desktop_geom.width() * factor;
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "services/abstract/labelsnode.h"
|
||||
#include "services/abstract/serviceroot.h"
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
#include "gui/webbrowser.h"
|
||||
#include "gui/webviewer.h"
|
||||
#else
|
||||
@ -48,7 +48,7 @@ void MessagePreviewer::createConnections() {
|
||||
MessagePreviewer::MessagePreviewer(bool should_resize_to_fit, QWidget* parent)
|
||||
: QWidget(parent), m_layout(new QGridLayout(this)), m_toolBar(new QToolBar(this)), m_verticalScrollBarPosition(0.0),
|
||||
m_separator(nullptr), m_btnLabels(QList<QPair<LabelButton*, QAction*>>()) {
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
m_txtMessage = new WebBrowser(this);
|
||||
|
||||
if (should_resize_to_fit) {
|
||||
@ -82,14 +82,14 @@ void MessagePreviewer::reloadFontSettings() {
|
||||
void MessagePreviewer::setToolbarsVisible(bool visible) {
|
||||
m_toolBar->setVisible(visible);
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
m_txtMessage->setNavigationBarVisible(visible);
|
||||
#endif
|
||||
|
||||
qApp->settings()->setValue(GROUP(GUI), GUI::MessageViewerToolbarsVisible, visible);
|
||||
}
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
|
||||
WebBrowser* MessagePreviewer::webBrowser() const {
|
||||
return m_txtMessage;
|
||||
|
@ -14,7 +14,7 @@
|
||||
class QGridLayout;
|
||||
class QToolBar;
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
class WebBrowser;
|
||||
#else
|
||||
class MessageBrowser;
|
||||
@ -41,7 +41,7 @@ class MessagePreviewer : public QWidget {
|
||||
|
||||
void reloadFontSettings();
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
WebBrowser* webBrowser() const;
|
||||
#endif
|
||||
|
||||
@ -72,7 +72,7 @@ class MessagePreviewer : public QWidget {
|
||||
QGridLayout* m_layout;
|
||||
QToolBar* m_toolBar;
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
WebBrowser* m_txtMessage;
|
||||
#else
|
||||
MessageBrowser* m_txtMessage;
|
||||
|
@ -25,7 +25,7 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
|
||||
initializeMessageDateFormats();
|
||||
GuiUtilities::setLabelAsNotice(*m_ui->label_9, false);
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
m_ui->m_tabMessages->layout()->removeWidget(m_ui->m_checkDisplayPlaceholders);
|
||||
m_ui->m_checkDisplayPlaceholders->hide();
|
||||
#else
|
||||
|
@ -84,14 +84,11 @@ void SettingsGui::loadSettings() {
|
||||
onBeginLoadSettings();
|
||||
|
||||
// Load settings of tray icon.
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
m_ui->m_grpTray->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool());
|
||||
}
|
||||
m_ui->m_grpTray->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool());
|
||||
|
||||
// Tray icon is not supported on this machine.
|
||||
else {
|
||||
m_ui->m_grpTray->setTitle(m_ui->m_grpTray->title() + QL1C(' ') + tr("(Tray icon is not available.)"));
|
||||
m_ui->m_grpTray->setChecked(false);
|
||||
if (!SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
m_ui->m_grpTray->setTitle(m_ui->m_grpTray->title() + QL1C(' ') + tr("(Your OS does not support tray icons at the moment.)"));
|
||||
m_ui->m_grpTray->setEnabled(false);
|
||||
}
|
||||
|
||||
m_ui->m_checkHidden->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::MainWindowStartsHidden)).toBool());
|
||||
@ -200,7 +197,7 @@ void SettingsGui::saveSettings() {
|
||||
m_ui->m_cmbToolbarButtonStyle->itemData(m_ui->m_cmbToolbarButtonStyle->currentIndex()));
|
||||
|
||||
// Save tray icon.
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
if (SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
settings()->setValue(GROUP(GUI), GUI::UseTrayIcon, m_ui->m_grpTray->isChecked());
|
||||
|
||||
if (m_ui->m_grpTray->isChecked()) {
|
||||
|
@ -60,12 +60,12 @@ void SystemTrayIcon::onActivated(QSystemTrayIcon::ActivationReason reason) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SystemTrayIcon::isSystemTrayAvailable() {
|
||||
bool SystemTrayIcon::isSystemTrayAreaAvailable() {
|
||||
return QSystemTrayIcon::isSystemTrayAvailable() && QSystemTrayIcon::supportsMessages();
|
||||
}
|
||||
|
||||
bool SystemTrayIcon::isSystemTrayActivated() {
|
||||
return SystemTrayIcon::isSystemTrayAvailable() && qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool();
|
||||
bool SystemTrayIcon::isSystemTrayDesired() {
|
||||
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool();
|
||||
}
|
||||
|
||||
bool SystemTrayIcon::areNotificationsEnabled() {
|
||||
@ -92,8 +92,8 @@ void SystemTrayIcon::show() {
|
||||
showPrivate();
|
||||
#else
|
||||
// Delay avoids race conditions and tray icon is properly displayed.
|
||||
qDebugNN << LOGSEC_GUI << "Showing tray icon with 1000 ms delay.";
|
||||
QTimer::singleShot(1000, this, &SystemTrayIcon::showPrivate);
|
||||
qDebugNN << LOGSEC_GUI << "Showing tray icon with 3000 ms delay.";
|
||||
QTimer::singleShot(3000, this, &SystemTrayIcon::showPrivate);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -46,12 +46,11 @@ class SystemTrayIcon : public QSystemTrayIcon {
|
||||
void showMessage(const QString& title, const QString& message, MessageIcon icon = Information,
|
||||
int milliseconds_timeout_hint = TRAY_ICON_BUBBLE_TIMEOUT, std::function<void()> functor = nullptr);
|
||||
|
||||
// Returns true if tray icon CAN be constructed on this machine.
|
||||
static bool isSystemTrayAvailable();
|
||||
// Returns true if tray area is available and icon can be displayed.
|
||||
static bool isSystemTrayAreaAvailable();
|
||||
|
||||
// Returns true if tray icon CAN be costructed and IS enabled in
|
||||
// application settings.
|
||||
static bool isSystemTrayActivated();
|
||||
// Returns true if user wants to have tray icon displayed.
|
||||
static bool isSystemTrayDesired();
|
||||
|
||||
// Determines whether balloon tips are enabled or not on tray icons.
|
||||
static bool areNotificationsEnabled();
|
||||
|
@ -221,7 +221,7 @@ int TabWidget::addBrowser(bool move_after_current, bool make_active, const QUrl&
|
||||
int final_index;
|
||||
QString browser_tab_name = tr("Web browser");
|
||||
|
||||
#if defined (Q_OS_MACOSOS)
|
||||
#if defined(Q_OS_MACOSOS)
|
||||
browser_tab_name = browser_tab_name.prepend(QSL(" "));
|
||||
#endif
|
||||
|
||||
@ -283,7 +283,7 @@ void TabWidget::gotoPreviousTab() {
|
||||
}
|
||||
|
||||
void TabWidget::indentTabText(int index) {
|
||||
#if defined (Q_OS_MACOSOS)
|
||||
#if defined(Q_OS_MACOSOS)
|
||||
if (tabBar()->tabType(index) != TabBar::FeedReader && !tabIcon(index).isNull()) {
|
||||
// We have closable tab with some icon, fix the title.
|
||||
const QString text = tabText(index);
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <QProcess>
|
||||
#include <QSessionManager>
|
||||
#include <QTimer>
|
||||
|
||||
#if defined(USE_WEBENGINE)
|
||||
#include "network-web/adblock/adblockicon.h"
|
||||
@ -122,7 +123,9 @@ void Application::reactOnForeignNotifications() {
|
||||
|
||||
void Application::hideOrShowMainForm() {
|
||||
// Display main window.
|
||||
if (qApp->settings()->value(GROUP(GUI), SETTING(GUI::MainWindowStartsHidden)).toBool() && SystemTrayIcon::isSystemTrayActivated()) {
|
||||
if (qApp->settings()->value(GROUP(GUI), SETTING(GUI::MainWindowStartsHidden)).toBool() &&
|
||||
SystemTrayIcon::isSystemTrayDesired() &&
|
||||
SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
qDebugNN << LOGSEC_CORE << "Hiding the main window when the application is starting.";
|
||||
mainForm()->switchVisibility(true);
|
||||
}
|
||||
@ -158,7 +161,7 @@ bool Application::isAlreadyRunning() {
|
||||
: sendMessage((QStringList() << APP_IS_RUNNING << Application::arguments().mid(1)).join(ARGUMENTS_LIST_SEPARATOR));
|
||||
}
|
||||
|
||||
FeedReader* Application::feedReader() {
|
||||
FeedReader* Application:: feedReader() {
|
||||
return m_feedReader;
|
||||
}
|
||||
|
||||
@ -280,7 +283,7 @@ QString Application::userDataHomeFolder() const {
|
||||
return home_folder;
|
||||
}
|
||||
else {
|
||||
#if defined (Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID)
|
||||
return IOFactory::getSystemFolder(QStandardPaths::GenericDataLocation) + QDir::separator() + QSL(APP_NAME);
|
||||
#else
|
||||
return configFolder() + QDir::separator() + QSL(APP_NAME);
|
||||
@ -297,7 +300,7 @@ QString Application::documentsFolder() const {
|
||||
}
|
||||
|
||||
QString Application::homeFolder() const {
|
||||
#if defined (Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID)
|
||||
return IOFactory::getSystemFolder(QStandardPaths::GenericDataLocation);
|
||||
#else
|
||||
return IOFactory::getSystemFolder(QStandardPaths::HomeLocation);
|
||||
@ -412,8 +415,15 @@ QIcon Application::desktopAwareIcon() const {
|
||||
|
||||
void Application::showTrayIcon() {
|
||||
// Display tray icon if it is enabled and available.
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
qDebugNN << LOGSEC_CORE << "Showing tray icon.";
|
||||
if (SystemTrayIcon::isSystemTrayDesired()) {
|
||||
#if !defined(Q_OS_LINUX)
|
||||
if (!SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
qWarningNN << LOGSEC_GUI << "Tray icon area is not available.";
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
qDebugNN << LOGSEC_GUI << "Showing tray icon.";
|
||||
trayIcon()->show();
|
||||
}
|
||||
}
|
||||
@ -433,7 +443,9 @@ void Application::deleteTrayIcon() {
|
||||
void Application::showGuiMessage(const QString& title, const QString& message,
|
||||
QSystemTrayIcon::MessageIcon message_type, QWidget* parent,
|
||||
bool show_at_least_msgbox, std::function<void()> functor) {
|
||||
if (SystemTrayIcon::areNotificationsEnabled() && SystemTrayIcon::isSystemTrayActivated()) {
|
||||
if (SystemTrayIcon::areNotificationsEnabled() &&
|
||||
SystemTrayIcon::isSystemTrayDesired() &&
|
||||
SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, std::move(functor));
|
||||
}
|
||||
else if (show_at_least_msgbox) {
|
||||
|
@ -2637,7 +2637,7 @@ QList<ServiceRoot*> DatabaseQueries::getFeedlyAccounts(const QSqlDatabase& db, b
|
||||
root->network()->setUsername(query.value(1).toString());
|
||||
root->network()->setDeveloperAccessToken(query.value(2).toString());
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
root->network()->oauth()->setRefreshToken(query.value(3).toString());
|
||||
#endif
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QLocale>
|
||||
#include <QPointer>
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
|
||||
// WebEngine.
|
||||
DKEY WebEngineAttributes::ID = "web_engine_attributes";
|
||||
@ -425,7 +425,7 @@ SettingsProperties Settings::determineProperties() {
|
||||
else {
|
||||
// We will use PORTABLE settings only and only if it is available and NON-PORTABLE
|
||||
// settings was not initialized before.
|
||||
#if defined (Q_OS_LINUX) || defined (Q_OS_ANDROID) || defined (Q_OS_MACOSOS)
|
||||
#if defined(Q_OS_LINUX) || defined (Q_OS_ANDROID) || defined (Q_OS_MACOSOS)
|
||||
// DO NOT use portable settings for Linux, it is really not used on that platform.
|
||||
const bool will_we_use_portable_settings = false;
|
||||
#else
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define DEFAULT_VALUE(x) x ## Def
|
||||
#define GROUP(x) x::ID
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
namespace WebEngineAttributes {
|
||||
KEY ID;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
WebFactory::WebFactory(QObject* parent)
|
||||
: QObject(parent) {
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
m_engineSettings = nullptr;
|
||||
m_adBlock = new AdBlockManager(this);
|
||||
m_urlInterceptor = new NetworkUrlInterceptor(this);
|
||||
@ -41,7 +41,7 @@ WebFactory::WebFactory(QObject* parent)
|
||||
}
|
||||
|
||||
WebFactory::~WebFactory() {
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
if (m_engineSettings != nullptr && m_engineSettings->menu() != nullptr) {
|
||||
m_engineSettings->menu()->deleteLater();
|
||||
}
|
||||
@ -222,7 +222,7 @@ void WebFactory::updateProxy() {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
AdBlockManager* WebFactory::adBlock() {
|
||||
return m_adBlock;
|
||||
}
|
||||
|
@ -9,11 +9,11 @@
|
||||
|
||||
#include <QMap>
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
#include <QWebEngineSettings>
|
||||
#endif
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
class QMenu;
|
||||
class AdBlockManager;
|
||||
class NetworkUrlInterceptor;
|
||||
@ -35,7 +35,7 @@ class WebFactory : public QObject {
|
||||
// ∀ = ∀ (entity name), ∀ (base-10 entity), ∀ (base-16 entity)
|
||||
QString unescapeHtml(const QString& html);
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
QAction* engineSettingsAction();
|
||||
AdBlockManager* adBlock();
|
||||
NetworkUrlInterceptor* urlIinterceptor();
|
||||
@ -46,7 +46,7 @@ class WebFactory : public QObject {
|
||||
bool openUrlInExternalBrowser(const QString& url) const;
|
||||
bool sendMessageViaEmail(const Message& message);
|
||||
|
||||
#if defined (USE_WEBENGINE)
|
||||
#if defined(USE_WEBENGINE)
|
||||
private slots:
|
||||
void createMenu(QMenu* menu = nullptr);
|
||||
void webEngineSettingChanged(bool enabled);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "services/feedly/feedlyfeed.h"
|
||||
#include "services/feedly/feedlyserviceroot.h"
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
#include "network-web/oauth2service.h"
|
||||
#endif
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
FeedlyNetwork::FeedlyNetwork(QObject* parent)
|
||||
: QObject(parent), m_service(nullptr),
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
m_oauth(new OAuth2Service(QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_AUTH,
|
||||
QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_TOKEN,
|
||||
FEEDLY_CLIENT_ID,
|
||||
@ -36,7 +36,7 @@ FeedlyNetwork::FeedlyNetwork(QObject* parent)
|
||||
m_username(QString()),
|
||||
m_developerAccessToken(QString()), m_batchSize(FEEDLY_DEFAULT_BATCH_SIZE), m_downloadOnlyUnreadMessages(false) {
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
m_oauth->setRedirectUrl(QString(OAUTH_REDIRECT_URI) + QL1C(':') + QString::number(FEEDLY_API_REDIRECT_URI_PORT));
|
||||
|
||||
connect(m_oauth, &OAuth2Service::tokensRetrieveError, this, &FeedlyNetwork::onTokensError);
|
||||
@ -490,7 +490,7 @@ void FeedlyNetwork::setBatchSize(int batch_size) {
|
||||
m_batchSize = batch_size;
|
||||
}
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
|
||||
void FeedlyNetwork::onTokensError(const QString& error, const QString& error_description) {
|
||||
Q_UNUSED(error)
|
||||
@ -561,7 +561,7 @@ QString FeedlyNetwork::fullUrl(FeedlyNetwork::Service service) const {
|
||||
}
|
||||
|
||||
QString FeedlyNetwork::bearer() const {
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
if (m_developerAccessToken.simplified().isEmpty()) {
|
||||
return m_oauth->bearer().toLocal8Bit();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "network-web/networkfactory.h"
|
||||
#include "services/abstract/feed.h"
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
class OAuth2Service;
|
||||
#endif
|
||||
|
||||
@ -44,7 +44,7 @@ class FeedlyNetwork : public QObject {
|
||||
|
||||
void setService(FeedlyServiceRoot* service);
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
OAuth2Service* oauth() const;
|
||||
void setOauth(OAuth2Service* oauth);
|
||||
|
||||
@ -73,7 +73,7 @@ class FeedlyNetwork : public QObject {
|
||||
private:
|
||||
FeedlyServiceRoot* m_service;
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
OAuth2Service* m_oauth;
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "services/feedly/feedlynetwork.h"
|
||||
#include "services/feedly/gui/formeditfeedlyaccount.h"
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
#include "network-web/oauth2service.h"
|
||||
#endif
|
||||
|
||||
@ -205,7 +205,7 @@ void FeedlyServiceRoot::saveAccountDataToDatabase(bool creating_new) {
|
||||
if (DatabaseQueries::overwriteFeedlyAccount(database,
|
||||
m_network->username(),
|
||||
m_network->developerAccessToken(),
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
m_network->oauth()->refreshToken(),
|
||||
#else
|
||||
{},
|
||||
@ -221,7 +221,7 @@ void FeedlyServiceRoot::saveAccountDataToDatabase(bool creating_new) {
|
||||
if (DatabaseQueries::createFeedlyAccount(database,
|
||||
m_network->username(),
|
||||
m_network->developerAccessToken(),
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
m_network->oauth()->refreshToken(),
|
||||
#else
|
||||
{},
|
||||
|
@ -81,7 +81,7 @@ FeedlyAccountDetails::FeedlyAccountDetails(QWidget* parent) : QWidget(parent) {
|
||||
onDeveloperAccessTokenChanged();
|
||||
onUsernameChanged();
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
hookNetwork();
|
||||
#endif
|
||||
}
|
||||
@ -90,7 +90,7 @@ void FeedlyAccountDetails::getDeveloperAccessToken() {
|
||||
qApp->web()->openUrlInExternalBrowser(FEEDLY_GENERATE_DAT);
|
||||
}
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
|
||||
void FeedlyAccountDetails::hookNetwork() {
|
||||
connect(m_oauth, &OAuth2Service::tokensRetrieved, this, &FeedlyAccountDetails::onAuthGranted);
|
||||
@ -121,7 +121,7 @@ void FeedlyAccountDetails::onAuthGranted() {
|
||||
#endif
|
||||
|
||||
void FeedlyAccountDetails::performTest(const QNetworkProxy& custom_proxy) {
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
m_oauth->logout(false);
|
||||
|
||||
if (m_ui.m_txtDeveloperAccessToken->lineEdit()->text().simplified().isEmpty()) {
|
||||
@ -168,7 +168,7 @@ void FeedlyAccountDetails::onDeveloperAccessTokenChanged() {
|
||||
const QString token = m_ui.m_txtDeveloperAccessToken->lineEdit()->text();
|
||||
|
||||
if (token.isEmpty()) {
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
WidgetWithStatus::StatusType stat = WidgetWithStatus::StatusType::Ok;
|
||||
#else
|
||||
WidgetWithStatus::StatusType stat = WidgetWithStatus::StatusType::Error;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include <QNetworkProxy>
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
class OAuth2Service;
|
||||
#endif
|
||||
|
||||
@ -29,7 +29,7 @@ class FeedlyAccountDetails : public QWidget {
|
||||
void onUsernameChanged();
|
||||
void onDeveloperAccessTokenChanged();
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
private slots:
|
||||
void onAuthFailed();
|
||||
void onAuthError(const QString& error, const QString& detailed_description);
|
||||
@ -42,7 +42,7 @@ class FeedlyAccountDetails : public QWidget {
|
||||
private:
|
||||
Ui::FeedlyAccountDetails m_ui;
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
OAuth2Service* m_oauth;
|
||||
#endif
|
||||
};
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "services/feedly/feedlyserviceroot.h"
|
||||
#include "services/feedly/gui/feedlyaccountdetails.h"
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
#include "network-web/oauth2service.h"
|
||||
#endif
|
||||
|
||||
@ -26,7 +26,7 @@ FormEditFeedlyAccount::FormEditFeedlyAccount(QWidget* parent)
|
||||
void FormEditFeedlyAccount::apply() {
|
||||
bool editing_account = !applyInternal<FeedlyServiceRoot>();
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
if (!editing_account) {
|
||||
// We transfer refresh token to avoid the need to login once more,
|
||||
// then we delete testing OAuth service.
|
||||
@ -60,7 +60,7 @@ void FormEditFeedlyAccount::apply() {
|
||||
void FormEditFeedlyAccount::setEditableAccount(ServiceRoot* editable_account) {
|
||||
FormAccountDetails::setEditableAccount(editable_account);
|
||||
|
||||
#if defined (FEEDLY_OFFICIAL_SUPPORT)
|
||||
#if defined(FEEDLY_OFFICIAL_SUPPORT)
|
||||
if (m_details->m_oauth != nullptr) {
|
||||
// We will use live OAuth service for testing.
|
||||
m_details->m_oauth->logout(true);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <QtPlatformHeaders/QWindowsWindowFunctions>
|
||||
#endif
|
||||
|
||||
#if defined (Q_OS_MACOS)
|
||||
#if defined(Q_OS_MACOS)
|
||||
extern void disableWindowTabbing();
|
||||
|
||||
#endif
|
||||
@ -25,14 +25,14 @@ int main(int argc, char* argv[]) {
|
||||
QApplication::setAttribute(Qt::ApplicationAttribute::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
#if defined (Q_OS_LINUX)
|
||||
#if defined(Q_OS_LINUX)
|
||||
QApplication::setDesktopFileName(APP_DESKTOP_ENTRY_FILE);
|
||||
#endif
|
||||
|
||||
// Ensure that ini format is used as application settings storage on Mac OS.
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
|
||||
#if defined (Q_OS_MACOS)
|
||||
#if defined(Q_OS_MACOS)
|
||||
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
|
||||
disableWindowTabbing();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user