work on notifications
This commit is contained in:
parent
48469bb635
commit
50e1d79c42
@ -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-06-17"/>
|
||||
<release version="3.9.2" date="2021-06-18"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -117,10 +117,10 @@ bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int
|
||||
|
||||
if (dragged_item_root != target_item_root) {
|
||||
// Transferring of items between different accounts is not possible.
|
||||
qApp->showGuiMessage(tr("Cannot perform drag & drop operation"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot perform drag & drop operation"),
|
||||
tr("You can't transfer dragged item into different account, this is not supported."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
qDebugNN << LOGSEC_FEEDMODEL
|
||||
<< "Dragged item cannot be dragged into different account. Cancelling drag-drop action.";
|
||||
|
@ -137,10 +137,10 @@ void MessagesModel::loadMessages(RootItem* item) {
|
||||
qCriticalNN << LOGSEC_MESSAGEMODEL
|
||||
<< "Loading of messages from item '"
|
||||
<< item->title() << "' failed.";
|
||||
qApp->showGuiMessage(tr("Loading of messages from item '%1' failed.").arg(item->title()),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Loading of messages from item '%1' failed.").arg(item->title()),
|
||||
tr("Loading of messages failed, maybe messages could not be downloaded."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
@ -119,9 +119,11 @@ void FormMain::showDbCleanupAssistant() {
|
||||
qApp->feedReader()->feedsModel()->reloadCountsOfWholeModel();
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Cannot cleanup database"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot cleanup database"),
|
||||
tr("Cannot cleanup database, because another critical action is running."),
|
||||
QSystemTrayIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::Warning,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,9 +467,10 @@ void FormMain::switchVisibility(bool force_hide) {
|
||||
if (SystemTrayIcon::isSystemTrayDesired() && SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
|
||||
if (QApplication::activeModalWidget() != nullptr) {
|
||||
qApp->showGuiMessage(QSL(APP_LONG_NAME),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
QSL(APP_LONG_NAME),
|
||||
tr("Close opened modal dialogs first."),
|
||||
QSystemTrayIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::Warning, true);
|
||||
}
|
||||
else {
|
||||
hide();
|
||||
|
@ -220,9 +220,12 @@ void FormUpdate::startUpdate() {
|
||||
|
||||
if (exec_result <= HINSTANCE(32)) {
|
||||
qDebugNN << LOGSEC_GUI << "External updater was not launched due to error.";
|
||||
qApp->showGuiMessage(tr("Cannot update application"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot update application"),
|
||||
tr("Cannot launch external updater. Update application manually."),
|
||||
QSystemTrayIcon::MessageIcon::Warning, this);
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
true,
|
||||
this);
|
||||
}
|
||||
else {
|
||||
qApp->quit();
|
||||
|
@ -165,10 +165,11 @@ void FeedsView::addFeedIntoSelectedAccount() {
|
||||
root->addNewFeed(selected, QGuiApplication::clipboard()->text(QClipboard::Mode::Clipboard));
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Not supported"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Not supported"),
|
||||
tr("Selected account does not support adding of new feeds."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainFormWidget(), true);
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,10 +184,11 @@ void FeedsView::addCategoryIntoSelectedAccount() {
|
||||
root->addNewCategory(selectedItem());
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Not supported"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Not supported"),
|
||||
tr("Selected account does not support adding of new categories."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainFormWidget(), true);
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -246,9 +248,11 @@ void FeedsView::editSelectedItem() {
|
||||
// Lock was not obtained because
|
||||
// it is used probably by feed updater or application
|
||||
// is quitting.
|
||||
qApp->showGuiMessage(tr("Cannot edit item"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot edit item"),
|
||||
tr("Selected item cannot be edited because another critical operation is ongoing."),
|
||||
QSystemTrayIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
true);
|
||||
|
||||
// Thus, cannot delete and quit the method.
|
||||
return;
|
||||
@ -258,10 +262,10 @@ void FeedsView::editSelectedItem() {
|
||||
selectedItem()->editViaGui();
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Cannot edit item"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot edit item"),
|
||||
tr("Selected item cannot be edited, this is not (yet?) supported."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
}
|
||||
|
||||
@ -274,9 +278,11 @@ void FeedsView::deleteSelectedItem() {
|
||||
// Lock was not obtained because
|
||||
// it is used probably by feed updater or application
|
||||
// is quitting.
|
||||
qApp->showGuiMessage(tr("Cannot delete item"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot delete item"),
|
||||
tr("Selected item cannot be deleted because another critical operation is ongoing."),
|
||||
QSystemTrayIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
true);
|
||||
|
||||
// Thus, cannot delete and quit the method.
|
||||
return;
|
||||
@ -307,18 +313,18 @@ void FeedsView::deleteSelectedItem() {
|
||||
|
||||
// We have deleteable item selected, remove it via GUI.
|
||||
if (!selected_item->deleteViaGui()) {
|
||||
qApp->showGuiMessage(tr("Cannot delete \"%1\"").arg(selected_item->title()),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot delete \"%1\"").arg(selected_item->title()),
|
||||
tr("This item cannot be deleted because something critically failed. Submit bug report."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Cannot delete \"%1\"").arg(selected_item->title()),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot delete \"%1\"").arg(selected_item->title()),
|
||||
tr("This item cannot be deleted, because it does not support it\nor this functionality is not implemented yet."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
@ -617,7 +617,8 @@ void MessagesView::openSelectedMessagesWithExternalTool() {
|
||||
|
||||
if (!link.isEmpty()) {
|
||||
if (!tool.run(link)) {
|
||||
qApp->showGuiMessage(tr("Cannot run external tool"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot run external tool"),
|
||||
tr("External tool '%1' could not be started.").arg(tool.executable()),
|
||||
QSystemTrayIcon::MessageIcon::Critical);
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ void NewspaperPreviewer::showMoreMessages() {
|
||||
m_ui->scrollArea->verticalScrollBar()->setValue(current_scroll);
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Cannot show more articles"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot show more articles"),
|
||||
tr("Cannot show more articles because parent feed was removed."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainForm(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
@ -51,10 +51,11 @@ void DiscoverFeedsButton::linkTriggered(QAction* action) {
|
||||
root->addNewFeed(qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->selectedItem(), url);
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Not supported"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Not supported"),
|
||||
tr("Given account does not support adding feeds."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainFormWidget(), true);
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblInfo">
|
||||
<property name="text">
|
||||
<string>You must have "tray icon" activated to have notifications working.</string>
|
||||
<string>You must have "tray icon" activated to have balloon notifications working.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -17,9 +17,11 @@ TrayIconMenu::TrayIconMenu(const QString& title, QWidget* parent) : QMenu(title,
|
||||
bool TrayIconMenu::event(QEvent* event) {
|
||||
if (event->type() == QEvent::Type::Show && Application::activeModalWidget() != nullptr) {
|
||||
QTimer::singleShot(0, this, &TrayIconMenu::hide);
|
||||
qApp->showGuiMessage(QSL(APP_LONG_NAME),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
QSL(APP_LONG_NAME),
|
||||
tr("Close opened modal dialogs first."),
|
||||
QSystemTrayIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::Warning,
|
||||
true);
|
||||
}
|
||||
|
||||
return QMenu::event(event);
|
||||
|
@ -172,9 +172,11 @@ void Application::showPolls() const {
|
||||
|
||||
void Application::offerChanges() const {
|
||||
if (isFirstRunCurrentVersion()) {
|
||||
qApp->showGuiMessage(QSL(APP_NAME), QObject::tr("Welcome to %1.\n\nPlease, check NEW stuff included in this\n"
|
||||
"version by clicking this popup notification.").arg(APP_LONG_NAME),
|
||||
QSystemTrayIcon::MessageIcon::NoIcon, nullptr, false, [] {
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
QSL(APP_NAME),
|
||||
QObject::tr("Welcome to %1.\n\nPlease, check NEW stuff included in this\n"
|
||||
"version by clicking this popup notification.").arg(APP_LONG_NAME),
|
||||
QSystemTrayIcon::MessageIcon::NoIcon, {}, {}, [] {
|
||||
FormAbout(qApp->mainForm()).exec();
|
||||
});
|
||||
}
|
||||
@ -432,15 +434,25 @@ 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::isSystemTrayDesired() &&
|
||||
SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||
trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, std::move(functor));
|
||||
void Application::showGuiMessage(Notification::Event event, const QString& title,
|
||||
const QString& message, QSystemTrayIcon::MessageIcon message_type, bool show_at_least_msgbox,
|
||||
QWidget* parent, std::function<void()> functor) {
|
||||
|
||||
if (SystemTrayIcon::areNotificationsEnabled()) {
|
||||
auto notification = m_notifications->notificationForEvent(event);
|
||||
|
||||
notification.playSound(this);
|
||||
|
||||
if (SystemTrayIcon::isSystemTrayDesired() &&
|
||||
SystemTrayIcon::isSystemTrayAreaAvailable() &&
|
||||
notification.balloonEnabled()) {
|
||||
trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, std::move(functor));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (show_at_least_msgbox) {
|
||||
|
||||
if (show_at_least_msgbox) {
|
||||
// Tray icon or OSD is not available, display simple text box.
|
||||
MessageBox::show(parent == nullptr ? mainFormWidget() : parent, QMessageBox::Icon(message_type), title, message);
|
||||
}
|
||||
@ -534,8 +546,10 @@ void Application::downloadRequested(QWebEngineDownloadItem* download_item) {
|
||||
void Application::onFeedUpdatesFinished(const FeedDownloadResults& results) {
|
||||
if (!results.updatedFeeds().isEmpty()) {
|
||||
// Now, inform about results via GUI message/notification.
|
||||
qApp->showGuiMessage(tr("New messages downloaded"), results.overview(10), QSystemTrayIcon::MessageIcon::NoIcon,
|
||||
nullptr, false);
|
||||
qApp->showGuiMessage(Notification::Event::NewArticlesFetched,
|
||||
tr("New articles fetched"),
|
||||
results.overview(10),
|
||||
QSystemTrayIcon::MessageIcon::NoIcon);
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,7 +616,10 @@ void Application::parseCmdArgumentsFromOtherInstance(const QString& message) {
|
||||
return;
|
||||
}
|
||||
else if (cmd_parser.isSet(CLI_IS_RUNNING)) {
|
||||
showGuiMessage(APP_NAME, tr("Application is already running."), QSystemTrayIcon::MessageIcon::Information);
|
||||
showGuiMessage(Notification::Event::GeneralEvent,
|
||||
APP_NAME,
|
||||
tr("Application is already running."),
|
||||
QSystemTrayIcon::MessageIcon::Information);
|
||||
mainForm()->display();
|
||||
}
|
||||
|
||||
@ -618,10 +635,10 @@ void Application::parseCmdArgumentsFromOtherInstance(const QString& message) {
|
||||
rt->addNewFeed(nullptr, msg);
|
||||
}
|
||||
else {
|
||||
showGuiMessage(tr("Cannot add feed"),
|
||||
showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot add feed"),
|
||||
tr("Feed cannot be added because there is no active account which can add feeds."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainForm(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "miscellaneous/feedreader.h"
|
||||
#include "miscellaneous/iofactory.h"
|
||||
#include "miscellaneous/localization.h"
|
||||
#include "miscellaneous/notification.h"
|
||||
#include "miscellaneous/settings.h"
|
||||
#include "miscellaneous/singleapplication.h"
|
||||
#include "miscellaneous/skinfactory.h"
|
||||
@ -110,9 +111,9 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||
|
||||
// Displays given simple message in tray icon bubble or OSD
|
||||
// or in message box if tray icon is disabled.
|
||||
void showGuiMessage(const QString& title, const QString& message, QSystemTrayIcon::MessageIcon message_type,
|
||||
QWidget* parent = nullptr, bool show_at_least_msgbox = false,
|
||||
std::function<void()> functor = nullptr);
|
||||
void showGuiMessage(Notification::Event event, const QString& title, const QString& message,
|
||||
QSystemTrayIcon::MessageIcon message_type, bool show_at_least_msgbox = false,
|
||||
QWidget* parent = nullptr, std::function<void()> functor = nullptr);
|
||||
|
||||
// Returns pointer to "GOD" application singleton.
|
||||
static Application* instance();
|
||||
|
@ -70,10 +70,12 @@ QList<ServiceEntryPoint*> FeedReader::feedServices() {
|
||||
|
||||
void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
||||
if (!qApp->feedUpdateLock()->tryLock()) {
|
||||
qApp->showGuiMessage(tr("Cannot update all items"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot update all items"),
|
||||
tr("You cannot download new messages for your items "
|
||||
"because another critical operation is ongoing."),
|
||||
QSystemTrayIcon::MessageIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,8 +317,9 @@ void FeedReader::executeNextAutoUpdate() {
|
||||
|
||||
// NOTE: OSD/bubble informing about performing of scheduled update can be shown now.
|
||||
if (qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::EnableAutoUpdateNotification)).toBool()) {
|
||||
qApp->showGuiMessage(tr("Starting auto-download of some feeds' messages"),
|
||||
tr("I will auto-download new messages for %n feed(s).", nullptr, feeds_for_update.size()),
|
||||
qApp->showGuiMessage(Notification::Event::ArticlesFetchingStarted,
|
||||
tr("Starting auto-download of some feeds' articles"),
|
||||
tr("I will auto-download new articles for %n feed(s).", nullptr, feeds_for_update.size()),
|
||||
QSystemTrayIcon::MessageIcon::Information);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,9 @@ void Notification::setSoundPath(const QString& sound_path) {
|
||||
}
|
||||
|
||||
void Notification::playSound(Application* app) const {
|
||||
QSound::play(QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath)));
|
||||
if (!m_soundPath.isEmpty()) {
|
||||
QSound::play(QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath)));
|
||||
}
|
||||
}
|
||||
|
||||
QList<Notification::Event> Notification::allEvents() {
|
||||
|
@ -14,11 +14,14 @@ class Notification {
|
||||
// not trigger any notifications.
|
||||
NoEvent = 0,
|
||||
|
||||
// Used for many events which happen throught application lifecycle.
|
||||
GeneralEvent = 1,
|
||||
|
||||
// New (unread) messages were downloaded for some feed.
|
||||
NewArticlesFetched = 1,
|
||||
NewArticlesFetched = 2,
|
||||
|
||||
// RSS Guard started downloading messages for some feed.
|
||||
ArticlesFetchingStarted = 2,
|
||||
ArticlesFetchingStarted = 3,
|
||||
|
||||
// Login tokens were successfuly refreshed.
|
||||
// NOTE: This is primarily used in accounts which use
|
||||
|
@ -226,9 +226,10 @@ void SystemFactory::checkForUpdatesOnStartup() {
|
||||
|
||||
if (!updates.first.isEmpty() && updates.second == QNetworkReply::NetworkError::NoError &&
|
||||
SystemFactory::isVersionNewer(updates.first.at(0).m_availableVersion, APP_VERSION)) {
|
||||
qApp->showGuiMessage(QObject::tr("New version available"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
QObject::tr("New version available"),
|
||||
QObject::tr("Click the bubble for more information."),
|
||||
QSystemTrayIcon::Information, qApp->mainForm(), false,
|
||||
QSystemTrayIcon::Information, {}, {},
|
||||
[] {
|
||||
FormUpdate(qApp->mainForm()).exec();
|
||||
});
|
||||
|
@ -118,11 +118,12 @@ void AdBlockManager::load(bool initial_load) {
|
||||
<< "Failed to write unified filters to file or re-start server, error:"
|
||||
<< QUOTE_W_SPACE_DOT(ex.message());
|
||||
|
||||
qApp->showGuiMessage(tr("AdBlock needs to be configured"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("AdBlock needs to be configured"),
|
||||
tr("AdBlock component is not configured properly."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
nullptr,
|
||||
true,
|
||||
{},
|
||||
[=]() {
|
||||
showDialog();
|
||||
});
|
||||
|
@ -194,8 +194,11 @@ void DownloadItem::stop() {
|
||||
|
||||
void DownloadItem::openFile() {
|
||||
if (!QDesktopServices::openUrl(QUrl::fromLocalFile(m_output.fileName()))) {
|
||||
qApp->showGuiMessage(tr("Cannot open file"), tr("Cannot open output file. Open it manually."),
|
||||
QSystemTrayIcon::Warning, qApp->mainFormWidget(), true);
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot open file"),
|
||||
tr("Cannot open output file. Open it manually."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,12 +413,13 @@ void DownloadItem::finished() {
|
||||
emit downloadFinished();
|
||||
|
||||
if (downloadedSuccessfully()) {
|
||||
qApp->showGuiMessage(tr("Download finished"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Download finished"),
|
||||
tr("File '%1' is downloaded.\nClick here to open parent directory.").arg(QDir::toNativeSeparators(
|
||||
m_output.fileName())),
|
||||
QSystemTrayIcon::MessageIcon::Information,
|
||||
nullptr,
|
||||
false,
|
||||
{},
|
||||
{},
|
||||
[this] {
|
||||
openFolder();
|
||||
});
|
||||
|
@ -81,10 +81,11 @@ OAuth2Service::~OAuth2Service() {
|
||||
|
||||
QString OAuth2Service::bearer() {
|
||||
if (!isFullyLoggedIn()) {
|
||||
qApp->showGuiMessage(tr("You have to login first"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("You have to login first"),
|
||||
tr("Click here to login."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr, false,
|
||||
{}, {},
|
||||
[this]() {
|
||||
login();
|
||||
});
|
||||
@ -188,7 +189,8 @@ void OAuth2Service::refreshAccessToken(const QString& refresh_token) {
|
||||
real_refresh_token,
|
||||
QSL("refresh_token"));
|
||||
|
||||
qApp->showGuiMessage(tr("Logging in via OAuth 2.0..."),
|
||||
qApp->showGuiMessage(Notification::Event::LoginDataRefreshed,
|
||||
tr("Logging in via OAuth 2.0..."),
|
||||
tr("Refreshing login tokens for '%1'...").arg(m_tokenUrl.toString()),
|
||||
QSystemTrayIcon::MessageIcon::Information);
|
||||
|
||||
|
@ -94,11 +94,12 @@ void FormFeedDetails::acceptIfPossible() {
|
||||
accept();
|
||||
}
|
||||
catch (const ApplicationException& ex) {
|
||||
qApp->showGuiMessage(tr("Error"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Error"),
|
||||
tr("Cannot save changes: %1").arg(ex.message()),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
this,
|
||||
true);
|
||||
true,
|
||||
this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,10 +67,10 @@ void LabelsNode::createLabel() {
|
||||
}
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("This account does not allow you to create labels."),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("This account does not allow you to create labels."),
|
||||
tr("Not allowed"),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
@ -419,10 +419,11 @@ QVariantHash GmailNetworkFactory::getProfile(const QNetworkProxy& custom_proxy)
|
||||
void GmailNetworkFactory::onTokensError(const QString& error, const QString& error_description) {
|
||||
Q_UNUSED(error)
|
||||
|
||||
qApp->showGuiMessage(tr("Gmail: authentication error"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Gmail: authentication error"),
|
||||
tr("Click this to login again. Error is: '%1'").arg(error_description),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr, false,
|
||||
{}, {},
|
||||
[this]() {
|
||||
m_oauth2->setAccessToken(QString());
|
||||
m_oauth2->setRefreshToken(QString());
|
||||
@ -431,10 +432,11 @@ void GmailNetworkFactory::onTokensError(const QString& error, const QString& err
|
||||
}
|
||||
|
||||
void GmailNetworkFactory::onAuthFailed() {
|
||||
qApp->showGuiMessage(tr("Gmail: authorization denied"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Gmail: authorization denied"),
|
||||
tr("Click this to login again."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr, false,
|
||||
{}, {},
|
||||
[this]() {
|
||||
m_oauth2->login();
|
||||
});
|
||||
|
@ -324,10 +324,11 @@ QNetworkReply::NetworkError InoreaderNetworkFactory::markMessagesStarred(RootIte
|
||||
void InoreaderNetworkFactory::onTokensError(const QString& error, const QString& error_description) {
|
||||
Q_UNUSED(error)
|
||||
|
||||
qApp->showGuiMessage(tr("Inoreader: authentication error"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Inoreader: authentication error"),
|
||||
tr("Click this to login again. Error is: '%1'").arg(error_description),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr, false,
|
||||
{}, {},
|
||||
[this]() {
|
||||
m_oauth2->setAccessToken(QString());
|
||||
m_oauth2->setRefreshToken(QString());
|
||||
@ -336,10 +337,11 @@ void InoreaderNetworkFactory::onTokensError(const QString& error, const QString&
|
||||
}
|
||||
|
||||
void InoreaderNetworkFactory::onAuthFailed() {
|
||||
qApp->showGuiMessage(tr("Inoreader: authorization denied"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Inoreader: authorization denied"),
|
||||
tr("Click this to login again."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr, false,
|
||||
{}, {},
|
||||
[this]() {
|
||||
m_oauth2->login();
|
||||
});
|
||||
|
@ -39,10 +39,10 @@ bool StandardCategory::performDragDropChange(RootItem* target_item) {
|
||||
qCriticalNN << LOGSEC_DB
|
||||
<< "Cannot overwrite category:"
|
||||
<< QUOTE_W_SPACE_DOT(ex.message());
|
||||
qApp->showGuiMessage(tr("Error"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Error"),
|
||||
tr("Cannot save data for category, detailed information was logged via debug log."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr,
|
||||
true);
|
||||
return false;
|
||||
}
|
||||
|
@ -211,10 +211,10 @@ void StandardFeed::fetchMetadataForItself() {
|
||||
qCriticalNN << LOGSEC_DB
|
||||
<< "Cannot overwrite feed:"
|
||||
<< QUOTE_W_SPACE_DOT(ex.message());
|
||||
qApp->showGuiMessage(tr("Error"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Error"),
|
||||
tr("Cannot save data for feed: %1").arg(ex.message()),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr,
|
||||
true);
|
||||
}
|
||||
}
|
||||
@ -476,10 +476,10 @@ bool StandardFeed::performDragDropChange(RootItem* target_item) {
|
||||
qCriticalNN << LOGSEC_DB
|
||||
<< "Cannot overwrite feed:"
|
||||
<< QUOTE_W_SPACE_DOT(ex.message());
|
||||
qApp->showGuiMessage(tr("Error"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Error"),
|
||||
tr("Cannot move feed, detailed information was logged via debug log."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
nullptr,
|
||||
true);
|
||||
return false;
|
||||
}
|
||||
|
@ -121,9 +121,11 @@ void StandardServiceRoot::addNewFeed(RootItem* selected_item, const QString& url
|
||||
// Lock was not obtained because
|
||||
// it is used probably by feed updater or application
|
||||
// is quitting.
|
||||
qApp->showGuiMessage(tr("Cannot add item"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot add item"),
|
||||
tr("Cannot add feed because another critical operation is ongoing."),
|
||||
QSystemTrayIcon::MessageIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
true);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -396,9 +398,11 @@ void StandardServiceRoot::addNewCategory(RootItem* selected_item) {
|
||||
// Lock was not obtained because
|
||||
// it is used probably by feed updater or application
|
||||
// is quitting.
|
||||
qApp->showGuiMessage(tr("Cannot add category"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot add category"),
|
||||
tr("Cannot add category because another critical operation is ongoing."),
|
||||
QSystemTrayIcon::Warning, qApp->mainFormWidget(), true);
|
||||
QSystemTrayIcon::Warning,
|
||||
true);
|
||||
|
||||
// Thus, cannot delete and quit the method.
|
||||
return;
|
||||
|
@ -44,7 +44,8 @@ void FormTtRssFeedDetails::apply() {
|
||||
|
||||
if (response.code() == STF_INSERTED) {
|
||||
// Feed was added online.
|
||||
qApp->showGuiMessage(tr("Feed added"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Feed added"),
|
||||
tr("Feed was added, obtaining new tree of feeds now."),
|
||||
QSystemTrayIcon::MessageIcon::Information);
|
||||
QTimer::singleShot(300, root, &TtRssServiceRoot::syncIn);
|
||||
|
@ -84,10 +84,10 @@ void TtRssServiceRoot::addNewFeed(RootItem* selected_item, const QString& url) {
|
||||
// Lock was not obtained because
|
||||
// it is used probably by feed updater or application
|
||||
// is quitting.
|
||||
qApp->showGuiMessage(tr("Cannot add item"),
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
tr("Cannot add item"),
|
||||
tr("Cannot add feed because another critical operation is ongoing."),
|
||||
QSystemTrayIcon::MessageIcon::Warning,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user