fix many warnings, remove redundant SQL scripts, refactor some preprocessor constants

This commit is contained in:
Martin Rotter 2021-02-25 19:59:08 +01:00 committed by Martin Rotter
parent ee5de37805
commit 6dda15eb00
55 changed files with 971 additions and 1656 deletions

View File

@ -1,7 +1,7 @@
APP_NAME = "RSS Guard"
APP_LOW_NAME = "rssguard"
APP_REVERSE_NAME = "com.github.rssguard"
APP_LOW_H_NAME = ".rssguard"
APP_LOW_H_NAME = ".rssguard4"
APP_AUTHOR = "Martin Rotter"
APP_COPYRIGHT = "(C) 2011-2021 $$APP_AUTHOR"
APP_VERSION = "4.0.0"

@ -1 +1 @@
Subproject commit 47f4125753452eff8800dbd6600c5a05540b15d9
Subproject commit 9c10723bfbaf6cb85107d6ee16e0324e9e487749

View File

@ -1,47 +1,7 @@
<RCC>
<qresource prefix="/">
<file>sql/db_init_mysql.sql</file>
<file>sql/db_update_mysql_1_2.sql</file>
<file>sql/db_update_mysql_2_3.sql</file>
<file>sql/db_update_mysql_3_4.sql</file>
<file>sql/db_update_mysql_4_5.sql</file>
<file>sql/db_update_mysql_5_6.sql</file>
<file>sql/db_update_mysql_6_7.sql</file>
<file>sql/db_update_mysql_7_8.sql</file>
<file>sql/db_update_mysql_8_9.sql</file>
<file>sql/db_update_mysql_9_10.sql</file>
<file>sql/db_update_mysql_10_11.sql</file>
<file>sql/db_update_mysql_11_12.sql</file>
<file>sql/db_update_mysql_12_13.sql</file>
<file>sql/db_update_mysql_13_14.sql</file>
<file>sql/db_update_mysql_14_15.sql</file>
<file>sql/db_update_mysql_15_16.sql</file>
<file>sql/db_update_mysql_16_17.sql</file>
<file>sql/db_update_mysql_17_18.sql</file>
<file>sql/db_update_mysql_18_19.sql</file>
<file>sql/db_update_mysql_19_20.sql</file>
<file>sql/db_update_mysql_20_21.sql</file>
<file>sql/db_init_sqlite.sql</file>
<file>sql/db_update_sqlite_1_2.sql</file>
<file>sql/db_update_sqlite_2_3.sql</file>
<file>sql/db_update_sqlite_3_4.sql</file>
<file>sql/db_update_sqlite_4_5.sql</file>
<file>sql/db_update_sqlite_5_6.sql</file>
<file>sql/db_update_sqlite_6_7.sql</file>
<file>sql/db_update_sqlite_7_8.sql</file>
<file>sql/db_update_sqlite_8_9.sql</file>
<file>sql/db_update_sqlite_9_10.sql</file>
<file>sql/db_update_sqlite_10_11.sql</file>
<file>sql/db_update_sqlite_11_12.sql</file>
<file>sql/db_update_sqlite_12_13.sql</file>
<file>sql/db_update_sqlite_13_14.sql</file>
<file>sql/db_update_sqlite_14_15.sql</file>
<file>sql/db_update_sqlite_15_16.sql</file>
<file>sql/db_update_sqlite_16_17.sql</file>
<file>sql/db_update_sqlite_17_18.sql</file>
<file>sql/db_update_sqlite_18_19.sql</file>
<file>sql/db_update_sqlite_19_20.sql</file>
<file>sql/db_update_sqlite_20_21.sql</file>
</qresource>
</RCC>

View File

@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Information (
inf_value TEXT NOT NULL
);
-- !
INSERT INTO Information VALUES (1, 'schema_version', '21');
INSERT INTO Information VALUES (1, 'schema_version', '1');
-- !
CREATE TABLE IF NOT EXISTS Accounts (
id INTEGER AUTO_INCREMENT PRIMARY KEY,

View File

@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS Information (
inf_value TEXT NOT NULL
);
-- !
INSERT INTO Information VALUES (1, 'schema_version', '21');
INSERT INTO Information VALUES (1, 'schema_version', '1');
-- !
CREATE TABLE IF NOT EXISTS Accounts (
id INTEGER PRIMARY KEY,

View File

@ -1,15 +0,0 @@
USE ##;
-- !
CREATE TABLE IF NOT EXISTS GmailAccounts (
id INTEGER,
username TEXT NOT NULL,
app_id TEXT,
app_key TEXT,
redirect_url TEXT,
refresh_token TEXT,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '11' WHERE inf_key = 'schema_version';

View File

@ -1,6 +0,0 @@
USE ##;
-- !
ALTER TABLE Feeds
MODIFY url VARCHAR(1000);
-- !
UPDATE Information SET inf_value = '12' WHERE inf_key = 'schema_version';

View File

@ -1,6 +0,0 @@
USE ##;
-- !
ALTER TABLE TtRssAccounts
ADD COLUMN update_only_unread INTEGER(1) NOT NULL DEFAULT 0 CHECK (update_only_unread >= 0 AND update_only_unread <= 1);
-- !
UPDATE Information SET inf_value = '13' WHERE inf_key = 'schema_version';

View File

@ -1,6 +0,0 @@
USE ##;
-- !
ALTER TABLE OwnCloudAccounts
ADD COLUMN update_only_unread INTEGER(1) NOT NULL DEFAULT 0 CHECK (update_only_unread >= 0 AND update_only_unread <= 1);
-- !
UPDATE Information SET inf_value = '14' WHERE inf_key = 'schema_version';

View File

@ -1,18 +0,0 @@
USE ##;
-- !
CREATE TABLE IF NOT EXISTS MessageFilters (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL CHECK (name != ''),
script TEXT NOT NULL CHECK (script != '')
);
-- !
CREATE TABLE IF NOT EXISTS MessageFiltersInFeeds (
filter INTEGER NOT NULL,
feed_custom_id TEXT NOT NULL,
account_id INTEGER NOT NULL,
FOREIGN KEY (filter) REFERENCES MessageFilters (id) ON DELETE CASCADE,
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
);
-- !
UPDATE Information SET inf_value = '15' WHERE inf_key = 'schema_version';

View File

@ -1,21 +0,0 @@
USE ##;
-- !
CREATE TABLE IF NOT EXISTS Labels (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL CHECK (name != ''),
color VARCHAR(7),
custom_id TEXT,
account_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
CREATE TABLE IF NOT EXISTS LabelsInMessages (
label TEXT NOT NULL, /* Custom ID of label. */
message TEXT NOT NULL, /* Custom ID of message. */
account_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
);
-- !
UPDATE Information SET inf_value = '16' WHERE inf_key = 'schema_version';

View File

@ -1,11 +0,0 @@
USE ##;
-- !
SET FOREIGN_KEY_CHECKS = 0;
-- !
ALTER TABLE Labels MODIFY id INTEGER AUTO_INCREMENT;
-- !
ALTER TABLE MessageFilters MODIFY id INTEGER AUTO_INCREMENT;
-- !
SET FOREIGN_KEY_CHECKS = 1;
-- !
UPDATE Information SET inf_value = '17' WHERE inf_key = 'schema_version';

View File

@ -1,13 +0,0 @@
USE ##;
-- !
ALTER TABLE Accounts ADD COLUMN proxy_type INTEGER NOT NULL DEFAULT 0 CHECK (proxy_type >= 0);
-- !
ALTER TABLE Accounts ADD COLUMN proxy_host TEXT;
-- !
ALTER TABLE Accounts ADD COLUMN proxy_port INTEGER;
-- !
ALTER TABLE Accounts ADD COLUMN proxy_username TEXT;
-- !
ALTER TABLE Accounts ADD COLUMN proxy_password TEXT;
-- !
UPDATE Information SET inf_value = '18' WHERE inf_key = 'schema_version';

View File

@ -1,12 +0,0 @@
CREATE TABLE IF NOT EXISTS GoogleReaderApiAccounts (
id INTEGER,
type INTEGER NOT NULL CHECK (type >= 1),
username TEXT NOT NULL,
password TEXT,
url TEXT NOT NULL,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '19' WHERE inf_key = 'schema_version';

View File

@ -1,33 +0,0 @@
CREATE TABLE backup_feeds AS SELECT * FROM Feeds;
-- !
DROP TABLE Feeds;
-- !
CREATE TABLE IF NOT EXISTS Feeds (
id INTEGER AUTO_INCREMENT PRIMARY KEY,
title TEXT NOT NULL CHECK (title != ''),
description TEXT,
date_created BIGINT,
icon BLOB,
category INTEGER NOT NULL CHECK (category >= -1),
encoding TEXT,
source_type INTEGER,
url VARCHAR(1000),
post_process TEXT,
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
username TEXT,
password TEXT,
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 1),
type INTEGER,
account_id INTEGER NOT NULL,
custom_id TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
INSERT INTO Feeds (id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id)
SELECT id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id FROM backup_feeds;
-- !
DROP TABLE backup_feeds;
-- !
UPDATE Information SET inf_value = '20' WHERE inf_key = 'schema_version';

View File

@ -1,4 +0,0 @@
ALTER TABLE Messages
ADD COLUMN is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1);
-- !
UPDATE Information SET inf_value = '2' WHERE inf_key = 'schema_version';

View File

@ -1,12 +0,0 @@
CREATE TABLE IF NOT EXISTS FeedlyAccounts (
id INTEGER,
username TEXT NOT NULL,
developer_access_token TEXT,
refresh_token TEXT,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
update_only_unread INTEGER(1) NOT NULL DEFAULT 0 CHECK (update_only_unread >= 0 AND update_only_unread <= 1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '21' WHERE inf_key = 'schema_version';

View File

@ -1,6 +0,0 @@
USE ##;
-- !
ALTER TABLE Messages
ADD COLUMN enclosures TEXT;
-- !
UPDATE Information SET inf_value = '3' WHERE inf_key = 'schema_version';

View File

@ -1,70 +0,0 @@
USE ##;
-- !
CREATE TABLE Accounts (
id INTEGER PRIMARY KEY,
type TEXT NOT NULL
);
-- !
INSERT INTO Accounts (type) VALUES ('std-rss');
-- !
DROP TABLE IF EXISTS FeedsData;
-- !
CREATE TABLE TtRssAccounts (
id INTEGER,
username TEXT NOT NULL,
password TEXT,
auth_protected INTEGER(1) NOT NULL DEFAULT 0 CHECK (auth_protected >= 0 AND auth_protected <= 1),
auth_username TEXT,
auth_password TEXT,
url TEXT NOT NULL,
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
ALTER TABLE Messages
ADD COLUMN account_id INTEGER NOT NULL DEFAULT 1;
-- !
ALTER TABLE Messages
ADD COLUMN custom_id TEXT;
-- !
ALTER TABLE Messages
DROP FOREIGN KEY feed;
-- !
ALTER TABLE Messages
MODIFY feed TEXT NOT NULL;
-- !
ALTER TABLE Messages
MODIFY author TEXT;
-- !
ALTER TABLE Messages
MODIFY url TEXT;
-- !
ALTER TABLE Feeds
ADD COLUMN account_id INTEGER NOT NULL DEFAULT 1;
-- !
ALTER TABLE Feeds
ADD COLUMN custom_id TEXT;
-- !
ALTER TABLE Feeds
MODIFY date_created BIGINT;
-- !
ALTER TABLE Feeds
MODIFY encoding TEXT;
-- !
ALTER TABLE Feeds
MODIFY url VARCHAR(100);
-- !
ALTER TABLE Feeds
MODIFY type INTEGER;
-- !
ALTER TABLE Categories
ADD COLUMN account_id INTEGER NOT NULL DEFAULT 1;
-- !
ALTER TABLE Categories
ADD COLUMN custom_id TEXT;
-- !
ALTER TABLE Categories
MODIFY date_created BIGINT;
-- !
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';

View File

@ -1,25 +0,0 @@
USE ##;
-- !
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
id INTEGER,
username TEXT NOT NULL,
password TEXT,
url TEXT NOT NULL,
force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Categories
SET custom_id = (SELECT id FROM Categories t WHERE t.id = Categories.id)
WHERE Categories.custom_id IS NULL OR Categories.custom_id = '';
-- !
UPDATE Feeds
SET custom_id = (SELECT id FROM Feeds t WHERE t.id = Feeds.id)
WHERE Feeds.custom_id IS NULL OR Feeds.custom_id = '';
-- !
UPDATE Messages
SET custom_id = (SELECT id FROM Messages t WHERE t.id = Messages.id)
WHERE Messages.custom_id IS NULL OR Messages.custom_id = '';
-- !
UPDATE Information SET inf_value = '5' WHERE inf_key = 'schema_version';

View File

@ -1,6 +0,0 @@
USE ##;
-- !
ALTER TABLE Messages
ADD COLUMN custom_hash TEXT;
-- !
UPDATE Information SET inf_value = '6' WHERE inf_key = 'schema_version';

View File

@ -1,22 +0,0 @@
-- !
ALTER DATABASE ##
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci;
-- !
USE ##;
-- !
ALTER TABLE Messages
CONVERT TO CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
-- !
ALTER TABLE Messages
CHANGE title title TEXT
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
-- !
ALTER TABLE Messages
CHANGE contents contents TEXT
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
-- !
UPDATE Information SET inf_value = '7' WHERE inf_key = 'schema_version';

View File

@ -1,25 +0,0 @@
USE ##;
-- !
CREATE TABLE IF NOT EXISTS Labels (
id INTEGER AUTO_INCREMENT PRIMARY KEY,
account_id INTEGER NOT NULL,
color_fg TEXT NOT NULL,
color_bg TEXT NOT NULL,
title TEXT NOT NULL,
description TEXT,
custom_id TEXT,
custom_hash TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
CREATE TABLE IF NOT EXISTS LabelsInMessages (
id INTEGER AUTO_INCREMENT PRIMARY KEY,
message_custom_id TEXT NOT NULL,
label_custom_id TEXT NOT NULL,
account_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '8' WHERE inf_key = 'schema_version';

View File

@ -1,10 +0,0 @@
USE ##;
-- !
ALTER TABLE OwnCloudAccounts
ADD COLUMN msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1);
-- !
DROP TABLE IF EXISTS Labels;
-- !
DROP TABLE IF EXISTS LabelsInMessages;
-- !
UPDATE Information SET inf_value = '9' WHERE inf_key = 'schema_version';

View File

@ -1,15 +0,0 @@
USE ##;
-- !
CREATE TABLE IF NOT EXISTS InoreaderAccounts (
id INTEGER,
username TEXT NOT NULL,
app_id TEXT,
app_key TEXT,
redirect_url TEXT,
refresh_token TEXT,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '10' WHERE inf_key = 'schema_version';

View File

@ -1,13 +0,0 @@
CREATE TABLE IF NOT EXISTS GmailAccounts (
id INTEGER,
username TEXT NOT NULL,
app_id TEXT,
app_key TEXT,
redirect_url TEXT,
refresh_token TEXT,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '11' WHERE inf_key = 'schema_version';

View File

@ -1 +0,0 @@
UPDATE Information SET inf_value = '12' WHERE inf_key = 'schema_version';

View File

@ -1,24 +0,0 @@
CREATE TABLE backup_ta AS SELECT * FROM TtRssAccounts;
-- !
DROP TABLE TtRssAccounts;
-- !
CREATE TABLE IF NOT EXISTS TtRssAccounts (
id INTEGER,
username TEXT NOT NULL,
password TEXT,
auth_protected INTEGER(1) NOT NULL CHECK (auth_protected >= 0 AND auth_protected <= 1) DEFAULT 0,
auth_username TEXT,
auth_password TEXT,
url TEXT NOT NULL,
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
update_only_unread INTEGER(1) NOT NULL CHECK (update_only_unread >= 0 AND update_only_unread <= 1) DEFAULT 0,
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
INSERT INTO TtRssAccounts (id, username, password, auth_protected, auth_username, auth_password, url, force_update, update_only_unread)
SELECT id, username, password, auth_protected, auth_username, auth_password, url, force_update, 0 FROM backup_ta;
-- !
DROP TABLE backup_ta;
-- !
UPDATE Information SET inf_value = '13' WHERE inf_key = 'schema_version';

View File

@ -1,22 +0,0 @@
CREATE TABLE backup_ta AS SELECT * FROM OwnCloudAccounts;
-- !
DROP TABLE OwnCloudAccounts;
-- !
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
id INTEGER,
username TEXT NOT NULL,
password TEXT,
url TEXT NOT NULL,
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
update_only_unread INTEGER(1) NOT NULL CHECK (update_only_unread >= 0 AND update_only_unread <= 1) DEFAULT 0,
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
INSERT INTO OwnCloudAccounts (id, username, password, url, force_update, msg_limit, update_only_unread)
SELECT id, username, password, url, force_update, msg_limit, 0 FROM backup_ta;
-- !
DROP TABLE backup_ta;
-- !
UPDATE Information SET inf_value = '14' WHERE inf_key = 'schema_version';

View File

@ -1,16 +0,0 @@
CREATE TABLE IF NOT EXISTS MessageFilters (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL CHECK (name != ''),
script TEXT NOT NULL CHECK (script != '')
);
-- !
CREATE TABLE IF NOT EXISTS MessageFiltersInFeeds (
filter INTEGER NOT NULL,
feed_custom_id TEXT NOT NULL,
account_id INTEGER NOT NULL,
FOREIGN KEY (filter) REFERENCES MessageFilters (id) ON DELETE CASCADE,
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
);
-- !
UPDATE Information SET inf_value = '15' WHERE inf_key = 'schema_version';

View File

@ -1,19 +0,0 @@
CREATE TABLE IF NOT EXISTS Labels (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL CHECK (name != ''),
color VARCHAR(7),
custom_id TEXT,
account_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
CREATE TABLE IF NOT EXISTS LabelsInMessages (
label TEXT NOT NULL, /* Custom ID of label. */
message TEXT NOT NULL, /* Custom ID of message. */
account_id INTEGER NOT NULL,
FOREIGN KEY (account_id) REFERENCES Accounts (id) ON DELETE CASCADE
);
-- !
UPDATE Information SET inf_value = '16' WHERE inf_key = 'schema_version';

View File

@ -1 +0,0 @@
UPDATE Information SET inf_value = '17' WHERE inf_key = 'schema_version';

View File

@ -1,23 +0,0 @@
CREATE TABLE backup_acc AS SELECT * FROM Accounts;
-- !
PRAGMA foreign_keys = OFF;
-- !
DROP TABLE Accounts;
-- !
CREATE TABLE IF NOT EXISTS Accounts (
id INTEGER PRIMARY KEY,
type TEXT NOT NULL CHECK (type != ''),
proxy_type INTEGER NOT NULL CHECK (proxy_type >= 0) DEFAULT 0,
proxy_host TEXT,
proxy_port INTEGER,
proxy_username TEXT,
proxy_password TEXT
);
-- !
INSERT INTO Accounts (id, type) SELECT id, type FROM backup_acc;
-- !
DROP TABLE backup_acc;
-- !
PRAGMA foreign_keys = ON;
-- !
UPDATE Information SET inf_value = '18' WHERE inf_key = 'schema_version';

View File

@ -1,12 +0,0 @@
CREATE TABLE IF NOT EXISTS GoogleReaderApiAccounts (
id INTEGER,
type INTEGER NOT NULL CHECK (type >= 1),
username TEXT NOT NULL,
password TEXT,
url TEXT NOT NULL,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '19' WHERE inf_key = 'schema_version';

View File

@ -1,33 +0,0 @@
CREATE TABLE backup_feeds AS SELECT * FROM Feeds;
-- !
DROP TABLE Feeds;
-- !
CREATE TABLE IF NOT EXISTS Feeds (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL CHECK (title != ''),
description TEXT,
date_created INTEGER,
icon BLOB,
category INTEGER NOT NULL CHECK (category >= -1),
encoding TEXT,
source_type INTEGER,
url TEXT,
post_process TEXT,
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
username TEXT,
password TEXT,
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
update_interval INTEGER NOT NULL CHECK (update_interval >= 1) DEFAULT 15,
type INTEGER,
account_id INTEGER NOT NULL,
custom_id TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
INSERT INTO Feeds (id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id)
SELECT id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id FROM backup_feeds;
-- !
DROP TABLE backup_feeds;
-- !
UPDATE Information SET inf_value = '20' WHERE inf_key = 'schema_version';

View File

@ -1,4 +0,0 @@
ALTER TABLE Messages
ADD COLUMN is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1);
-- !
UPDATE Information SET inf_value = '2' WHERE inf_key = 'schema_version';

View File

@ -1,12 +0,0 @@
CREATE TABLE IF NOT EXISTS FeedlyAccounts (
id INTEGER,
username TEXT NOT NULL,
developer_access_token TEXT,
refresh_token TEXT,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
update_only_unread INTEGER(1) NOT NULL DEFAULT 0 CHECK (update_only_unread >= 0 AND update_only_unread <= 1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '21' WHERE inf_key = 'schema_version';

View File

@ -1,4 +0,0 @@
ALTER TABLE Messages
ADD COLUMN enclosures TEXT;
-- !
UPDATE Information SET inf_value = '3' WHERE inf_key = 'schema_version';

View File

@ -1,103 +0,0 @@
CREATE TABLE Accounts (
id INTEGER PRIMARY KEY,
type TEXT NOT NULL
);
-- !
INSERT INTO Accounts (type) VALUES ('std-rss');
-- !
DROP TABLE IF EXISTS FeedsData;
-- !
CREATE TABLE TtRssAccounts (
id INTEGER,
username TEXT NOT NULL,
password TEXT,
auth_protected INTEGER(1) NOT NULL CHECK (auth_protected >= 0 AND auth_protected <= 1) DEFAULT 0,
auth_username TEXT,
auth_password TEXT,
url TEXT NOT NULL,
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
CREATE TABLE backup_Messages AS SELECT * FROM Messages;
-- !
DROP TABLE Messages;
-- !
CREATE TABLE Messages (
id INTEGER PRIMARY KEY,
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT 0,
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT 0,
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT 0,
feed TEXT NOT NULL,
title TEXT NOT NULL CHECK (title != ''),
url TEXT,
author TEXT,
date_created INTEGER NOT NULL CHECK (date_created != 0),
contents TEXT,
is_pdeleted INTEGER(1) NOT NULL CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1) DEFAULT 0,
enclosures TEXT,
account_id INTEGER NOT NULL,
custom_id TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
INSERT INTO Messages (id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id)
SELECT id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, 1 FROM backup_Messages;
-- !
DROP TABLE backup_Messages;
-- !
CREATE TABLE backup_Feeds AS SELECT * FROM Feeds;
-- !
DROP TABLE Feeds;
-- !
CREATE TABLE Feeds (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL CHECK (title != ''),
description TEXT,
date_created INTEGER,
icon BLOB,
category INTEGER NOT NULL CHECK (category >= -1),
encoding TEXT,
url TEXT,
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
username TEXT,
password TEXT,
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
update_interval INTEGER NOT NULL CHECK (update_interval >= 1) DEFAULT 15,
type INTEGER,
account_id INTEGER NOT NULL,
custom_id TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
INSERT INTO Feeds (id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_type, type, account_id)
SELECT id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_type, type, 1 FROM backup_Feeds;
-- !
DROP TABLE backup_Feeds;
-- !
CREATE TABLE backup_Categories AS SELECT * FROM Categories;
-- !
DROP TABLE Categories;
-- !
CREATE TABLE Categories (
id INTEGER PRIMARY KEY,
parent_id INTEGER NOT NULL,
title TEXT NOT NULL CHECK (title != ''),
description TEXT,
date_created INTEGER,
icon BLOB,
account_id INTEGER NOT NULL,
custom_id TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
INSERT INTO Categories (id, parent_id, title, description, date_created, icon, account_id)
SELECT id, parent_id, title, description, date_created, icon, 1 FROM backup_Categories;
-- !
DROP TABLE backup_Categories;
-- !
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';

View File

@ -1,23 +0,0 @@
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
id INTEGER,
username TEXT NOT NULL,
password TEXT,
url TEXT NOT NULL,
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Categories
SET custom_id = (SELECT id FROM Categories t WHERE t.id = Categories.id)
WHERE Categories.custom_id IS NULL OR Categories.custom_id = '';
-- !
UPDATE Feeds
SET custom_id = (SELECT id FROM Feeds t WHERE t.id = Feeds.id)
WHERE Feeds.custom_id IS NULL OR Feeds.custom_id = '';
-- !
UPDATE Messages
SET custom_id = (SELECT id FROM Messages t WHERE t.id = Messages.id)
WHERE Messages.custom_id IS NULL OR Messages.custom_id = '';
-- !
UPDATE Information SET inf_value = '5' WHERE inf_key = 'schema_version';

View File

@ -1,30 +0,0 @@
CREATE TABLE backup_Messages AS SELECT * FROM Messages;
-- !
DROP TABLE Messages;
-- !
CREATE TABLE Messages (
id INTEGER PRIMARY KEY,
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT 0,
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT 0,
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT 0,
feed TEXT NOT NULL,
title TEXT NOT NULL CHECK (title != ''),
url TEXT,
author TEXT,
date_created INTEGER NOT NULL CHECK (date_created != 0),
contents TEXT,
is_pdeleted INTEGER(1) NOT NULL CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1) DEFAULT 0,
enclosures TEXT,
account_id INTEGER NOT NULL,
custom_id TEXT,
custom_hash TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
INSERT INTO Messages (id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id, custom_id)
SELECT id, is_read, is_deleted, is_important, feed, title, url, author, date_created, contents, is_pdeleted, enclosures, account_id, custom_id FROM backup_Messages;
-- !
DROP TABLE backup_Messages;
-- !
UPDATE Information SET inf_value = '6' WHERE inf_key = 'schema_version';

View File

@ -1 +0,0 @@
UPDATE Information SET inf_value = '7' WHERE inf_key = 'schema_version';

View File

@ -1,25 +0,0 @@
CREATE TABLE IF NOT EXISTS Labels (
id INTEGER PRIMARY KEY,
account_id INTEGER NOT NULL,
color_fg TEXT NOT NULL,
color_bg TEXT NOT NULL,
title TEXT NOT NULL,
description TEXT,
custom_id TEXT,
custom_hash TEXT,
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
CREATE TABLE IF NOT EXISTS LabelsInMessages (
id INTEGER PRIMARY KEY,
message_custom_id TEXT NOT NULL,
label_custom_id TEXT NOT NULL,
account_id INTEGER NOT NULL,
FOREIGN KEY (message_custom_id) REFERENCES Messages (custom_id),
FOREIGN KEY (label_custom_id) REFERENCES Labels (custom_id),
FOREIGN KEY (account_id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '8' WHERE inf_key = 'schema_version';

View File

@ -1,25 +0,0 @@
CREATE TABLE backup_oa AS SELECT * FROM OwnCloudAccounts;
-- !
DROP TABLE OwnCloudAccounts;
-- !
CREATE TABLE IF NOT EXISTS OwnCloudAccounts (
id INTEGER,
username TEXT NOT NULL,
password TEXT,
url TEXT NOT NULL,
force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
INSERT INTO OwnCloudAccounts (id, username, password, url, force_update)
SELECT id, username, password, url, force_update FROM backup_oa;
-- !
DROP TABLE backup_oa;
-- !
DROP TABLE IF EXISTS Labels;
-- !
DROP TABLE IF EXISTS LabelsInMessages;
-- !
UPDATE Information SET inf_value = '9' WHERE inf_key = 'schema_version';

View File

@ -1,13 +0,0 @@
CREATE TABLE IF NOT EXISTS InoreaderAccounts (
id INTEGER,
username TEXT NOT NULL,
app_id TEXT,
app_key TEXT,
redirect_url TEXT,
refresh_token TEXT,
msg_limit INTEGER NOT NULL DEFAULT -1 CHECK (msg_limit >= -1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
-- !
UPDATE Information SET inf_value = '10' WHERE inf_key = 'schema_version';

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@ bool FeedDownloader::isUpdateRunning() const {
}
void FeedDownloader::updateAvailableFeeds() {
for (const Feed* feed : m_feeds) {
for (const Feed* feed : qAsConst(m_feeds)) {
auto* cache = dynamic_cast<CacheForServiceRoot*>(feed->getParentServiceRoot());
if (cache != nullptr) {

View File

@ -6,9 +6,6 @@
#include <QDebug>
#include <QtGlobal>
//
// Constants.
//
#define SERVICE_CODE_STD_RSS "std-rss"
#define SERVICE_CODE_TT_RSS "tt-rss"
#define SERVICE_CODE_OWNCLOUD "owncloud"
@ -17,51 +14,52 @@
#define SERVICE_CODE_INOREADER "inoreader"
#define SERVICE_CODE_GMAIL "gmail"
#define ARGUMENTS_LIST_SEPARATOR "\n"
#define OAUTH_DECRYPTION_KEY 11451167756100761335ul
#define ADBLOCK_HOWTO_FILTERS "https://help.eyeo.com/en/adblockplus/how-to-write-filters"
#define ADBLOCK_UPDATE_DAYS_INTERVAL 14
#define ADBLOCK_ICON_ACTIVE "adblock"
#define ADBLOCK_ICON_DISABLED "adblock-disabled"
#define IS_IN_ARRAY(offset, array) ((offset >= 0) && (offset < array.count()))
#define ADBLOCK_CUSTOMLIST_NAME "customlist.txt"
#define ADBLOCK_LISTS_SUBDIRECTORY "adblock"
#define ADBLOCK_EASYLIST_URL "https://easylist.to/easylist/easylist.txt"
#define DEFAULT_SQL_MESSAGES_FILTER "0 > 1"
#define MAX_MULTICOLUMN_SORT_STATES 3
#define OAUTH_DECRYPTION_KEY 11451167756100761335ul
#define OAUTH_REDIRECT_URI_PORT 14488
#define OAUTH_REDIRECT_URI "http://localhost"
#define ENCLOSURES_OUTER_SEPARATOR '#'
#define ECNLOSURES_INNER_SEPARATOR '&'
#define URI_SCHEME_FEED_SHORT "feed:"
#define URI_SCHEME_FEED "feed://"
#define URI_SCHEME_HTTP "http://"
#define RELEASES_LIST "https://api.github.com/repos/martinrotter/rssguard/releases"
#define DEFAULT_LOCALE "en"
#define DEFAULT_FEED_ENCODING "UTF-8"
#define NO_PARENT_CATEGORY -1
#define ID_RECYCLE_BIN -2
#define ID_IMPORTANT -3
#define ID_LABELS -4
#define ARGUMENTS_LIST_SEPARATOR "\n"
#define IS_IN_ARRAY(offset, array) ((offset >= 0) && (offset < array.count()))
#define DEFAULT_SQL_MESSAGES_FILTER "0 > 1"
#define MAX_MULTICOLUMN_SORT_STATES 3
#define RELEASES_LIST "https://api.github.com/repos/martinrotter/rssguard/releases"
#define MSG_FILTERING_HELP "https://github.com/martinrotter/rssguard/blob/master/resources/docs/Message-filters.md#message-filtering"
#define DEFAULT_FEED_TYPE "RSS"
#define URL_REGEXP "^(http|https|feed|ftp):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&amp;:/~\\+#]*[\\w\\-\\@?^=%&amp;/~\\+#])?$"
#define SCRIPT_SOURCE_TYPE_REGEXP "^.+#.*$"
#define TEXT_TITLE_LIMIT 30
#define RESELECT_MESSAGE_THRESSHOLD 500
#define ICON_SIZE_SETTINGS 16
#define NO_PARENT_CATEGORY -1
#define ID_RECYCLE_BIN -2
#define ID_IMPORTANT -3
#define ID_LABELS -4
#define TRAY_ICON_BUBBLE_TIMEOUT 20000
#define CLOSE_LOCK_TIMEOUT 500
#define DOWNLOAD_TIMEOUT 30000
#define MESSAGES_VIEW_DEFAULT_COL 100
#define MESSAGES_VIEW_MINIMUM_COL 16
#define FEEDS_VIEW_COLUMN_COUNT 2
#define FEED_DOWNLOADER_MAX_THREADS 3
#define DEFAULT_DAYS_TO_DELETE_MSG 14
#define ELLIPSIS_LENGTH 3
#define MIN_CATEGORY_NAME_LENGTH 1
#define DEFAULT_AUTO_UPDATE_INTERVAL 15
#define OAUTH_REDIRECT_URI_PORT 14488
#define OAUTH_REDIRECT_URI "http://localhost"
#define AUTO_UPDATE_INTERVAL 60000
#define STARTUP_UPDATE_DELAY 15.0 // In seconds.
#define TIMEZONE_OFFSET_LIMIT 6
@ -74,13 +72,14 @@
#define FILTER_WIDTH 150
#define FILTER_RIGHT_MARGIN 5
#define FEEDS_VIEW_INDENTATION 10
#define ACCEPT_HEADER_FOR_FEED_DOWNLOADER "application/atom+xml,application/xml;q=0.9,text/xml;q=0.8,*/*;q=0.7"
#define MIME_TYPE_ITEM_POINTER "rssguard/itempointer"
#define DOWNLOADER_ICON_SIZE 48
#define GOOGLE_SEARCH_URL "https://www.google.com/search?q=%1&ie=utf-8&oe=utf-8"
#define GOOGLE_SUGGEST_URL "http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=%1"
#define ENCRYPTION_FILE_NAME "key.private"
#define RELOAD_MODEL_BORDER_NUM 10
#define GOOGLE_SEARCH_URL "https://www.google.com/search?q=%1&ie=utf-8&oe=utf-8"
#define GOOGLE_SUGGEST_URL "http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=%1"
#define EXTERNAL_TOOL_SEPARATOR "###"
#define EXTERNAL_TOOL_PARAM_SEPARATOR "|||"
#define EXECUTION_LINE_USER_DATA_PLACEHOLDER "%data%"
@ -127,11 +126,8 @@
#define INTERNAL_URL_BLANK "http://rssguard.blank"
#define INTERNAL_URL_ADBLOCKED "http://rssguard.adblocked"
#define INTERNAL_URL_MESSAGE_HOST "rssguard.message"
#define INTERNAL_URL_BLANK_HOST "rssguard.blank"
#define INTERNAL_URL_PASSATTACHMENT "http://rssguard.passattachment"
#define FEED_INITIAL_OPML_PATTERN "feeds-%1.opml"
#define FEED_REGEX_MATCHER "<link[^>]+type=\"application\\/(?:atom\\+xml|rss\\+xml|feed\\+json|json)\"[^>]*>"
#define FEED_HREF_REGEX_MATCHER "href=\"([^\"]+)\""
@ -154,7 +150,7 @@
#define APP_DB_SQLITE_FILE "database.db"
// Keep this in sync with schema versions declared in SQL initialization code.
#define APP_DB_SCHEMA_VERSION "21"
#define APP_DB_SCHEMA_VERSION "1"
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
#define APP_DB_COMMENT_SPLIT "-- !\n"
#define APP_DB_NAME_PLACEHOLDER "##"
@ -242,6 +238,8 @@
#if defined(Q_OS_LINUX)
#define OS_ID "Linux"
#elif defined(Q_OS_OS2)
#define OS_ID "OS/2"
#elif defined(Q_OS_OSX)
#define OS_ID "Mac OS X"
#elif defined(Q_OS_WIN)

View File

@ -181,6 +181,7 @@ HEADERS += core/feeddownloader.h \
services/owncloud/owncloudserviceentrypoint.h \
services/owncloud/owncloudserviceroot.h \
services/standard/atomparser.h \
services/standard/definitions.h \
services/standard/feedparser.h \
services/abstract/gui/authenticationdetails.h \
services/standard/gui/formeditstandardaccount.h \

View File

@ -0,0 +1,9 @@
#ifndef STANDARD_DEFINITIONS_H
#define STANDARD_DEFINITIONS_H
#define DEFAULT_FEED_ENCODING "UTF-8"
#define DEFAULT_FEED_TYPE "RSS"
#define MIN_CATEGORY_NAME_LENGTH 1
#define FEED_INITIAL_OPML_PATTERN "feeds-%1.opml"
#endif // STANDARD_DEFINITIONS_H

View File

@ -11,6 +11,7 @@
#include "miscellaneous/iconfactory.h"
#include "services/abstract/category.h"
#include "services/abstract/rootitem.h"
#include "services/standard/definitions.h"
#include "services/standard/standardcategory.h"
#include "services/standard/standardserviceroot.h"

View File

@ -6,6 +6,7 @@
#include "miscellaneous/iconfactory.h"
#include "network-web/networkfactory.h"
#include "services/abstract/category.h"
#include "services/standard/definitions.h"
#include <QClipboard>
#include <QFileDialog>

View File

@ -16,6 +16,7 @@
#include "network-web/networkfactory.h"
#include "services/abstract/recyclebin.h"
#include "services/standard/atomparser.h"
#include "services/standard/definitions.h"
#include "services/standard/gui/formstandardfeeddetails.h"
#include "services/standard/jsonparser.h"
#include "services/standard/rdfparser.h"

View File

@ -5,6 +5,7 @@
#include "definitions/definitions.h"
#include "miscellaneous/application.h"
#include "miscellaneous/iconfactory.h"
#include "services/standard/definitions.h"
#include "services/standard/standardcategory.h"
#include "services/standard/standardfeed.h"
#include "services/standard/standardserviceroot.h"

View File

@ -14,6 +14,7 @@
#include "services/abstract/importantnode.h"
#include "services/abstract/labelsnode.h"
#include "services/abstract/recyclebin.h"
#include "services/standard/definitions.h"
#include "services/standard/gui/formeditstandardaccount.h"
#include "services/standard/gui/formstandardcategorydetails.h"
#include "services/standard/gui/formstandardfeeddetails.h"