Added "custom_id" columns for cats/feeds/messages to hold custom ID of the items from online services.

This commit is contained in:
Martin Rotter 2015-12-03 13:37:32 +01:00
parent aeb7f98cbb
commit ff67c86517
7 changed files with 32 additions and 2 deletions

View File

@ -39,6 +39,7 @@ CREATE TABLE IF NOT EXISTS Categories (
date_created BIGINT NOT NULL CHECK (date_created != 0), date_created BIGINT NOT NULL CHECK (date_created != 0),
icon BLOB, icon BLOB,
account_id INTEGER NOT NULL, account_id INTEGER NOT NULL,
custom_id INTEGER,
FOREIGN KEY (account_id) REFERENCES Accounts (id) FOREIGN KEY (account_id) REFERENCES Accounts (id)
); );
@ -61,6 +62,7 @@ CREATE TABLE IF NOT EXISTS Feeds (
update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 5), update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 5),
type INTEGER NOT NULL CHECK (type >= 0), type INTEGER NOT NULL CHECK (type >= 0),
account_id INTEGER NOT NULL, account_id INTEGER NOT NULL,
custom_id INTEGER,
FOREIGN KEY (account_id) REFERENCES Accounts (id) FOREIGN KEY (account_id) REFERENCES Accounts (id)
); );
@ -81,6 +83,7 @@ CREATE TABLE IF NOT EXISTS Messages (
is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1), is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1),
enclosures TEXT, enclosures TEXT,
account_id INTEGER NOT NULL, account_id INTEGER NOT NULL,
custom_id INTEGER,
FOREIGN KEY (feed) REFERENCES Feeds (id), FOREIGN KEY (feed) REFERENCES Feeds (id),
FOREIGN KEY (account_id) REFERENCES Accounts (id) FOREIGN KEY (account_id) REFERENCES Accounts (id)

View File

@ -34,6 +34,7 @@ CREATE TABLE IF NOT EXISTS Categories (
date_created INTEGER NOT NULL CHECK (date_created != 0), date_created INTEGER NOT NULL CHECK (date_created != 0),
icon BLOB, icon BLOB,
account_id INTEGER NOT NULL, account_id INTEGER NOT NULL,
custom_id INTEGER,
FOREIGN KEY (account_id) REFERENCES Accounts (id) FOREIGN KEY (account_id) REFERENCES Accounts (id)
); );
@ -56,6 +57,7 @@ CREATE TABLE IF NOT EXISTS Feeds (
update_interval INTEGER NOT NULL CHECK (update_interval >= 5) DEFAULT 15, update_interval INTEGER NOT NULL CHECK (update_interval >= 5) DEFAULT 15,
type INTEGER NOT NULL CHECK (type >= 0), type INTEGER NOT NULL CHECK (type >= 0),
account_id INTEGER NOT NULL, account_id INTEGER NOT NULL,
custom_id INTEGER,
FOREIGN KEY (account_id) REFERENCES Accounts (id) FOREIGN KEY (account_id) REFERENCES Accounts (id)
); );
@ -76,6 +78,7 @@ CREATE TABLE IF NOT EXISTS Messages (
is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1), is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1),
enclosures TEXT, enclosures TEXT,
account_id INTEGER NOT NULL, account_id INTEGER NOT NULL,
custom_id INTEGER,
FOREIGN KEY (feed) REFERENCES Feeds (id), FOREIGN KEY (feed) REFERENCES Feeds (id),
FOREIGN KEY (account_id) REFERENCES Accounts (id) FOREIGN KEY (account_id) REFERENCES Accounts (id)

View File

@ -25,4 +25,13 @@ ADD COLUMN account_id INTEGER NOT NULL DEFAULT (1);
ALTER TABLE Categories ALTER TABLE Categories
ADD COLUMN account_id INTEGER NOT NULL DEFAULT (1); ADD COLUMN account_id INTEGER NOT NULL DEFAULT (1);
-- ! -- !
ALTER TABLE Messages
ADD COLUMN custom_id INTEGER;
-- !
ALTER TABLE Feeds
ADD COLUMN custom_id INTEGER;
-- !
ALTER TABLE Categories
ADD COLUMN custom_id INTEGER;
-- !
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version'; UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';

View File

@ -25,4 +25,13 @@ ADD COLUMN account_id INTEGER NOT NULL DEFAULT (1);
ALTER TABLE Categories ALTER TABLE Categories
ADD COLUMN account_id INTEGER NOT NULL DEFAULT (1); ADD COLUMN account_id INTEGER NOT NULL DEFAULT (1);
-- ! -- !
ALTER TABLE Messages
ADD COLUMN custom_id INTEGER;
-- !
ALTER TABLE Feeds
ADD COLUMN custom_id INTEGER;
-- !
ALTER TABLE Categories
ADD COLUMN custom_id INTEGER;
-- !
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version'; UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';

View File

@ -158,7 +158,8 @@ void MessagesModel::setupHeaderData() {
/*: Tooltip for contents of message.*/ tr("Contents") << /*: Tooltip for contents of message.*/ tr("Contents") <<
/*: Tooltip for "pdeleted" column in msg list.*/ tr("Permanently deleted") << /*: Tooltip for "pdeleted" column in msg list.*/ tr("Permanently deleted") <<
/*: Tooltip for attachments of message.*/ tr("Attachments") << /*: Tooltip for attachments of message.*/ tr("Attachments") <<
/*: Tooltip for account ID of message.*/ tr("Account ID"); /*: Tooltip for account ID of message.*/ tr("Account ID") <<
/*: Tooltip for custom ID of message.*/ tr("Custom ID");
m_tooltipData << tr("Id of the message.") << tr("Is message read?") << m_tooltipData << tr("Id of the message.") << tr("Is message read?") <<
tr("Is message deleted?") << tr("Is message important?") << tr("Is message deleted?") << tr("Is message important?") <<
@ -166,7 +167,7 @@ void MessagesModel::setupHeaderData() {
tr("Title of the message.") << tr("Url of the message.") << tr("Title of the message.") << tr("Url of the message.") <<
tr("Author of the message.") << tr("Creation date of the message.") << tr("Author of the message.") << tr("Creation date of the message.") <<
tr("Contents of the message.") << tr("Is message permanently deleted from recycle bin?") << tr("Contents of the message.") << tr("Is message permanently deleted from recycle bin?") <<
tr("List of attachments.") << tr("Account ID of message."); tr("List of attachments.") << tr("Account ID of the message.") << tr("Custom ID of the message");
} }
Qt::ItemFlags MessagesModel::flags(const QModelIndex &index) const { Qt::ItemFlags MessagesModel::flags(const QModelIndex &index) const {

View File

@ -184,6 +184,7 @@
#define MSG_DB_PDELETED_INDEX 10 #define MSG_DB_PDELETED_INDEX 10
#define MSG_DB_ENCLOSURES_INDEX 11 #define MSG_DB_ENCLOSURES_INDEX 11
#define MSG_DB_ACCOUNT_ID_INDEX 12 #define MSG_DB_ACCOUNT_ID_INDEX 12
#define MSG_DB_CUSTOM_ID_INDEX 13
// Indexes of columns as they are DEFINED IN THE TABLE for CATEGORIES. // Indexes of columns as they are DEFINED IN THE TABLE for CATEGORIES.
#define CAT_DB_ID_INDEX 0 #define CAT_DB_ID_INDEX 0
@ -192,6 +193,8 @@
#define CAT_DB_DESCRIPTION_INDEX 3 #define CAT_DB_DESCRIPTION_INDEX 3
#define CAT_DB_DCREATED_INDEX 4 #define CAT_DB_DCREATED_INDEX 4
#define CAT_DB_ICON_INDEX 5 #define CAT_DB_ICON_INDEX 5
#define CAT_DB_ACCOUNT_ID_INDEX 6
#define CAT_DB_CUSTOM_ID_INDEX 7
// Indexes of columns as they are DEFINED IN THE TABLE for FEEDS. // Indexes of columns as they are DEFINED IN THE TABLE for FEEDS.
#define FDS_DB_ID_INDEX 0 #define FDS_DB_ID_INDEX 0
@ -209,6 +212,7 @@
#define FDS_DB_UPDATE_INTERVAL_INDEX 12 #define FDS_DB_UPDATE_INTERVAL_INDEX 12
#define FDS_DB_TYPE_INDEX 13 #define FDS_DB_TYPE_INDEX 13
#define FDS_DB_ACCOUNT_ID_INDEX 14 #define FDS_DB_ACCOUNT_ID_INDEX 14
#define FDS_DB_CUSTOM_ID_INDEX 15
// Indexes of columns for feed models. // Indexes of columns for feed models.
#define FDS_MODEL_TITLE_INDEX 0 #define FDS_MODEL_TITLE_INDEX 0

View File

@ -548,6 +548,7 @@ void MessagesView::adjustColumns() {
hideColumn(MSG_DB_PDELETED_INDEX); hideColumn(MSG_DB_PDELETED_INDEX);
hideColumn(MSG_DB_ENCLOSURES_INDEX); hideColumn(MSG_DB_ENCLOSURES_INDEX);
hideColumn(MSG_DB_ACCOUNT_ID_INDEX); hideColumn(MSG_DB_ACCOUNT_ID_INDEX);
hideColumn(MSG_DB_CUSTOM_ID_INDEX);
qDebug("Adjusting column resize modes for MessagesView."); qDebug("Adjusting column resize modes for MessagesView.");
} }