Removed "date_updated" column.
This commit is contained in:
parent
55dcca35be
commit
81ec000e48
@ -59,7 +59,6 @@ CREATE TABLE IF NOT EXISTS Messages (
|
||||
url TEXT,
|
||||
author TEXT,
|
||||
date_created TEXT NOT NULL CHECK (date_created != ''),
|
||||
date_updated TEXT,
|
||||
contents TEXT,
|
||||
|
||||
FOREIGN KEY (feed) REFERENCES Feeds (id)
|
||||
|
@ -67,8 +67,7 @@
|
||||
#define MSG_DB_URL_INDEX 6
|
||||
#define MSG_DB_AUTHOR_INDEX 7
|
||||
#define MSG_DB_DCREATED_INDEX 8
|
||||
#define MSG_DB_DUPDATED_INDEX 9
|
||||
#define MSG_DB_CONTENTS_INDEX 10
|
||||
#define MSG_DB_CONTENTS_INDEX 9
|
||||
|
||||
// Indexes of columns as they are DEFINED IN THE TABLE for CATEGORIES.
|
||||
#define CAT_DB_ID_INDEX 0
|
||||
|
@ -205,8 +205,8 @@ void FeedsModelStandardFeed::updateMessages(const QList<Message> &messages) {
|
||||
"WHERE feed = :feed AND title = :title AND url = :url;");
|
||||
|
||||
query_insert.prepare("INSERT INTO Messages "
|
||||
"(feed, title, url, author, date_created, date_updated, contents) "
|
||||
"VALUES (:feed, :title, :url, :author, :date_created, :date_updated, :contents);");
|
||||
"(feed, title, url, author, date_created, contents) "
|
||||
"VALUES (:feed, :title, :url, :author, :date_created, :contents);");
|
||||
|
||||
foreach (const Message &message, messages) {
|
||||
query_select.bindValue(":feed", feed_id);
|
||||
@ -231,7 +231,6 @@ void FeedsModelStandardFeed::updateMessages(const QList<Message> &messages) {
|
||||
query_insert.bindValue(":url", message.m_url);
|
||||
query_insert.bindValue(":author", message.m_author);
|
||||
query_insert.bindValue(":date_created", message.m_created.toString(Qt::ISODate));
|
||||
query_insert.bindValue(":date_updated", message.m_updated.toString(Qt::ISODate));
|
||||
query_insert.bindValue(":contents", message.m_contents);
|
||||
|
||||
query_insert.exec();
|
||||
|
@ -93,7 +93,7 @@ Message MessagesModel::messageAt(int row_index) const {
|
||||
message.m_contents = rec.value(MSG_DB_CONTENTS_INDEX).toString();
|
||||
message.m_title = rec.value(MSG_DB_TITLE_INDEX).toString();
|
||||
message.m_url = rec.value(MSG_DB_URL_INDEX).toString();
|
||||
message.m_updated = TextFactory::parseDateTime(rec.value(MSG_DB_DUPDATED_INDEX).toString());
|
||||
message.m_created = TextFactory::parseDateTime(rec.value(MSG_DB_DCREATED_INDEX).toString());
|
||||
|
||||
return message;
|
||||
}
|
||||
@ -101,13 +101,13 @@ Message MessagesModel::messageAt(int row_index) const {
|
||||
void MessagesModel::setupHeaderData() {
|
||||
m_headerData << tr("Id") << tr("Read") << tr("Deleted") << tr("Important") <<
|
||||
tr("Feed") << tr("Title") << tr("Url") << tr("Author") <<
|
||||
tr("Created on") << tr("Updated on") << tr("Contents");
|
||||
tr("Created on") << tr("Contents");
|
||||
m_tooltipData << tr("Id of the message.") << tr("Is message read?") <<
|
||||
tr("Is message deleted?") << tr("Is message important?") <<
|
||||
tr("Id of feed which this message belongs to.") <<
|
||||
tr("Title of the message.") << tr("Url of the message.") <<
|
||||
tr("Author of the message.") << tr("Creation date of the message.") <<
|
||||
tr("Date of the most recent update of the message.") << tr("Contents of the message.");
|
||||
tr("Contents of the message.");
|
||||
}
|
||||
|
||||
Qt::ItemFlags MessagesModel::flags(const QModelIndex &index) const {
|
||||
@ -136,7 +136,7 @@ QVariant MessagesModel::data(const QModelIndex &index, int role) const {
|
||||
case Qt::DisplayRole: {
|
||||
int index_column = index.column();
|
||||
|
||||
if (index_column == MSG_DB_DUPDATED_INDEX) {
|
||||
if (index_column == MSG_DB_DCREATED_INDEX) {
|
||||
// This column contains QDateTime.
|
||||
return TextFactory::parseDateTime(QSqlTableModel::data(index,
|
||||
role).toString()).toString(Qt::DefaultLocaleShortDate);
|
||||
|
@ -17,7 +17,6 @@ class Message {
|
||||
QString m_author;
|
||||
QString m_contents;
|
||||
QDateTime m_created;
|
||||
QDateTime m_updated;
|
||||
};
|
||||
|
||||
class MessagesModel : public QSqlTableModel {
|
||||
|
@ -48,8 +48,7 @@ QList<Message> ParsingFactory::parseAsRSS20(const QString &data) {
|
||||
new_message.m_author = elem_author2.text();
|
||||
}
|
||||
|
||||
new_message.m_updated = TextFactory::parseDateTime(elem_updated.text());
|
||||
new_message.m_created = new_message.m_updated;
|
||||
new_message.m_created = TextFactory::parseDateTime(elem_updated.text());
|
||||
|
||||
messages.append(new_message);
|
||||
}
|
||||
|
@ -9,6 +9,9 @@
|
||||
// This class contains methods to
|
||||
// parse input Unicode textual data into
|
||||
// another objects.
|
||||
//
|
||||
// NOTE: Each parsed message MUST CONTAINT THESE FIELDS.
|
||||
|
||||
class ParsingFactory {
|
||||
private:
|
||||
// Constructors and destructors.
|
||||
|
@ -61,8 +61,8 @@ void FeedMessageViewer::saveSize() {
|
||||
KEY_MESSAGES_VIEW + QString::number(MSG_DB_AUTHOR_INDEX),
|
||||
m_messagesView->columnWidth(MSG_DB_AUTHOR_INDEX));
|
||||
settings->setValue(APP_CFG_GUI,
|
||||
KEY_MESSAGES_VIEW + QString::number(MSG_DB_DUPDATED_INDEX),
|
||||
m_messagesView->columnWidth(MSG_DB_DUPDATED_INDEX));
|
||||
KEY_MESSAGES_VIEW + QString::number(MSG_DB_DCREATED_INDEX),
|
||||
m_messagesView->columnWidth(MSG_DB_DCREATED_INDEX));
|
||||
}
|
||||
|
||||
void FeedMessageViewer::loadSize() {
|
||||
@ -78,9 +78,9 @@ void FeedMessageViewer::loadSize() {
|
||||
settings->value(APP_CFG_GUI,
|
||||
KEY_MESSAGES_VIEW + QString::number(MSG_DB_AUTHOR_INDEX),
|
||||
default_msg_section_size).toInt());
|
||||
m_messagesView->setColumnWidth(MSG_DB_DUPDATED_INDEX,
|
||||
m_messagesView->setColumnWidth(MSG_DB_DCREATED_INDEX,
|
||||
settings->value(APP_CFG_GUI,
|
||||
KEY_MESSAGES_VIEW + QString::number(MSG_DB_DUPDATED_INDEX),
|
||||
KEY_MESSAGES_VIEW + QString::number(MSG_DB_DCREATED_INDEX),
|
||||
default_msg_section_size).toInt());
|
||||
// TODO: Perhaps make toolbar icon size changeable,
|
||||
// this concerns toolbars of web browsers too.
|
||||
|
@ -73,7 +73,6 @@ void MessagesView::setupAppearance() {
|
||||
header()->setSectionResizeMode(MSG_DB_URL_INDEX, QHeaderView::Interactive);
|
||||
header()->setSectionResizeMode(MSG_DB_AUTHOR_INDEX, QHeaderView::Interactive);
|
||||
header()->setSectionResizeMode(MSG_DB_DCREATED_INDEX, QHeaderView::Interactive);
|
||||
header()->setSectionResizeMode(MSG_DB_DUPDATED_INDEX, QHeaderView::Interactive);
|
||||
header()->setSectionResizeMode(MSG_DB_CONTENTS_INDEX, QHeaderView::Interactive);
|
||||
#else
|
||||
// Setup column resize strategies.
|
||||
@ -86,7 +85,6 @@ void MessagesView::setupAppearance() {
|
||||
header()->setResizeMode(MSG_DB_URL_INDEX, QHeaderView::Interactive);
|
||||
header()->setResizeMode(MSG_DB_AUTHOR_INDEX, QHeaderView::Interactive);
|
||||
header()->setResizeMode(MSG_DB_DCREATED_INDEX, QHeaderView::Interactive);
|
||||
header()->setResizeMode(MSG_DB_DUPDATED_INDEX, QHeaderView::Interactive);
|
||||
header()->setResizeMode(MSG_DB_CONTENTS_INDEX, QHeaderView::Interactive);
|
||||
#endif
|
||||
|
||||
@ -96,7 +94,6 @@ void MessagesView::setupAppearance() {
|
||||
hideColumn(MSG_DB_DELETED_INDEX);
|
||||
hideColumn(MSG_DB_FEED_INDEX);
|
||||
hideColumn(MSG_DB_URL_INDEX);
|
||||
hideColumn(MSG_DB_DCREATED_INDEX);
|
||||
hideColumn(MSG_DB_CONTENTS_INDEX);
|
||||
}
|
||||
|
||||
@ -116,7 +113,7 @@ void MessagesView::setupAppearance() {
|
||||
// Make sure that initial sorting is that unread messages are visible
|
||||
// first.
|
||||
// NOTE: This can be rewritten so that it's changeable.
|
||||
sortByColumn(MSG_DB_DUPDATED_INDEX, Qt::AscendingOrder);
|
||||
sortByColumn(MSG_DB_DCREATED_INDEX, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void MessagesView::keyPressEvent(QKeyEvent *event) {
|
||||
|
@ -170,7 +170,7 @@ void WebBrowser::navigateToMessage(const Message &message) {
|
||||
tr("Written by ") + message.m_author,
|
||||
message.m_url,
|
||||
message.m_contents,
|
||||
message.m_updated.toString(Qt::DefaultLocaleLongDate)));
|
||||
message.m_created.toString(Qt::DefaultLocaleLongDate)));
|
||||
emit iconChanged(m_index,
|
||||
IconThemeFactory::getInstance()->fromTheme("mail-mark-read"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user