Fixed #135.
This commit is contained in:
parent
62a0d29903
commit
261e76c539
@ -5,6 +5,7 @@ Added:
|
||||
|
||||
▪ Background color of notifications is now changeable. (issue #134)
|
||||
▪ Auto-update setting of individual Tiny Tiny RSS feeds can now be changed.
|
||||
▪ RSS Guard is now useable as external RSS reader by common web browsers like Firefox etc. (issue #135)
|
||||
|
||||
3.0.0
|
||||
—————
|
||||
|
@ -66,8 +66,10 @@ int main(int argc, char *argv[]) {
|
||||
Application application(APP_LOW_NAME, argc, argv);
|
||||
qDebug("Instantiated Application class.");
|
||||
|
||||
// TODO: dat '\n' do konstant
|
||||
|
||||
// Check if another instance is running.
|
||||
if (application.sendMessage(APP_IS_RUNNING)) {
|
||||
if (application.sendMessage((QStringList() << APP_IS_RUNNING << application.arguments().mid(1)).join('\n'))) {
|
||||
qWarning("Another instance of the application is already running. Notifying it.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "adblock/adblockmanager.h"
|
||||
|
||||
#include "services/abstract/serviceroot.h"
|
||||
#include "services/standard/standardserviceroot.h"
|
||||
#include "services/standard/standardserviceentrypoint.h"
|
||||
#include "services/tt-rss/ttrssserviceentrypoint.h"
|
||||
|
||||
@ -158,13 +159,31 @@ void Application::restoreDatabaseSettings(bool restore_database, bool restore_se
|
||||
void Application::processExecutionMessage(const QString &message) {
|
||||
qDebug("Received '%s' execution message from another application instance.", qPrintable(message));
|
||||
|
||||
if (message == APP_IS_RUNNING) {
|
||||
// TODO: dat '\n' do konstant a taky "feed:"
|
||||
|
||||
foreach (QString msg, message.split('\n')) {
|
||||
if (msg == APP_IS_RUNNING) {
|
||||
showGuiMessage(APP_NAME, tr("Application is already running."), QSystemTrayIcon::Information);
|
||||
mainForm()->display();
|
||||
}
|
||||
else if (message == APP_QUIT_INSTANCE) {
|
||||
else if (msg == APP_QUIT_INSTANCE) {
|
||||
quit();
|
||||
}
|
||||
else if (msg.startsWith(QL1S("feed:"))) {
|
||||
// Application was running, and someone wants to add new feed.
|
||||
StandardServiceRoot *root = qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->standardServiceRoot();
|
||||
|
||||
if (root != NULL) {
|
||||
root->checkArgumentForFeedAdding(msg);
|
||||
}
|
||||
else {
|
||||
showGuiMessage(tr("Cannot add feed"),
|
||||
tr("Feed cannot be added because standard RSS/ATOM account is not enabled."),
|
||||
QSystemTrayIcon::Warning, qApp->mainForm(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SystemTrayIcon *Application::trayIcon() {
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <QAction>
|
||||
#include <QPointer>
|
||||
#include <QSqlTableModel>
|
||||
#include <QClipboard>
|
||||
|
||||
|
||||
StandardServiceRoot::StandardServiceRoot(RootItem *parent)
|
||||
@ -95,6 +96,8 @@ void StandardServiceRoot::start() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkArgumentsForFeedAdding();
|
||||
}
|
||||
|
||||
void StandardServiceRoot::stop() {
|
||||
@ -296,6 +299,19 @@ void StandardServiceRoot::loadFromDatabase(){
|
||||
m_recycleBin->updateCounts(true);
|
||||
}
|
||||
|
||||
void StandardServiceRoot::checkArgumentsForFeedAdding() {
|
||||
foreach (QString arg, qApp->arguments().mid(1)) {
|
||||
checkArgumentForFeedAdding(arg);
|
||||
}
|
||||
}
|
||||
|
||||
void StandardServiceRoot::checkArgumentForFeedAdding(const QString &argument) {
|
||||
if (argument.startsWith(QL1S("feed:"))) {
|
||||
qApp->clipboard()->setText(argument);
|
||||
addNewFeed();
|
||||
}
|
||||
}
|
||||
|
||||
QList<StandardCategory*> StandardServiceRoot::allCategories() {
|
||||
QList<Category*> cats = getSubTreeCategories();
|
||||
QList<StandardCategory*> std_cats;
|
||||
|
@ -95,6 +95,7 @@ class StandardServiceRoot : public ServiceRoot {
|
||||
bool cleanFeeds(QList<Feed*> items, bool clean_read_only);
|
||||
|
||||
void loadFromDatabase();
|
||||
void checkArgumentForFeedAdding(const QString &argument);
|
||||
|
||||
public slots:
|
||||
void addNewCategory();
|
||||
@ -103,6 +104,8 @@ class StandardServiceRoot : public ServiceRoot {
|
||||
void exportFeeds();
|
||||
|
||||
private:
|
||||
void checkArgumentsForFeedAdding();
|
||||
|
||||
// Returns converted ids of given feeds
|
||||
// which are suitable as IN clause for SQL queries.
|
||||
QStringList textualFeedIds(const QList<Feed *> &feeds);
|
||||
|
Loading…
x
Reference in New Issue
Block a user