some minor fixups
This commit is contained in:
parent
fbcae2b101
commit
c1ada2fb21
@ -462,7 +462,6 @@ set(UI_FILES
|
||||
gui/dialogs/formsettings.ui
|
||||
gui/dialogs/formupdate.ui
|
||||
gui/itemdetails.ui
|
||||
gui/newspaperpreviewer.ui
|
||||
gui/notifications/articlelistnotification.ui
|
||||
gui/notifications/notificationseditor.ui
|
||||
gui/notifications/singlenotificationeditor.ui
|
||||
|
@ -1765,12 +1765,15 @@ UpdatedArticles DatabaseQueries::updateMessages(const QSqlDatabase& db,
|
||||
// just to keep the data consistent.
|
||||
QMutexLocker lck(db_mutex);
|
||||
|
||||
if (db.exec("UPDATE Messages "
|
||||
"SET custom_id = id "
|
||||
"WHERE custom_id IS NULL OR custom_id = '';")
|
||||
.lastError()
|
||||
.isValid()) {
|
||||
qCriticalNN << LOGSEC_DB << "Failed to set custom ID for all messages:" << QUOTE_W_SPACE_DOT(db.lastError().text());
|
||||
QSqlQuery fixup_custom_ids_query(QSL("UPDATE Messages "
|
||||
"SET custom_id = id "
|
||||
"WHERE custom_id IS NULL OR custom_id = '';"),
|
||||
db);
|
||||
QSqlError fixup_custom_ids_error = fixup_custom_ids_query.lastError();
|
||||
|
||||
if (fixup_custom_ids_error.isValid()) {
|
||||
qCriticalNN << LOGSEC_DB
|
||||
<< "Failed to set custom ID for all messages:" << QUOTE_W_SPACE_DOT(fixup_custom_ids_error.text());
|
||||
}
|
||||
|
||||
if (ok != nullptr) {
|
||||
|
@ -1,55 +0,0 @@
|
||||
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||
|
||||
#include "gui/newspaperpreviewer.h"
|
||||
|
||||
#include "gui/dialogs/formmain.h"
|
||||
#include "gui/messagepreviewer.h"
|
||||
#include "miscellaneous/application.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
|
||||
NewspaperPreviewer::NewspaperPreviewer(int msg_height, RootItem* root, QList<Message> messages, QWidget* parent)
|
||||
: TabContent(parent), m_msgHeight(msg_height), m_ui(new Ui::NewspaperPreviewer), m_root(root), m_messages(std::move(messages)) {
|
||||
m_ui->setupUi(this);
|
||||
m_ui->m_btnShowMoreMessages->setIcon(qApp->icons()->fromTheme(QSL("view-refresh")));
|
||||
connect(m_ui->m_btnShowMoreMessages, &QPushButton::clicked, this, &NewspaperPreviewer::showMoreMessages);
|
||||
showMoreMessages();
|
||||
}
|
||||
|
||||
#if defined(NO_LITE)
|
||||
|
||||
WebBrowser* NewspaperPreviewer::webBrowser() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void NewspaperPreviewer::showMoreMessages() {
|
||||
if (!m_root.isNull()) {
|
||||
int current_scroll = m_ui->scrollArea->verticalScrollBar()->value();
|
||||
|
||||
for (int i = 0; i < 5 && !m_messages.isEmpty(); i++) {
|
||||
Message msg = m_messages.takeFirst();
|
||||
auto* prev = new MessagePreviewer(true, this);
|
||||
QMargins margins = prev->layout()->contentsMargins();
|
||||
|
||||
prev->setContentsMargins(margins);
|
||||
|
||||
connect(prev, &MessagePreviewer::markMessageRead, this, &NewspaperPreviewer::markMessageRead);
|
||||
connect(prev, &MessagePreviewer::markMessageImportant, this, &NewspaperPreviewer::markMessageImportant);
|
||||
|
||||
m_ui->m_layout->insertWidget(m_ui->m_layout->count() - 1, prev);
|
||||
prev->loadMessage(msg, m_root.data());
|
||||
}
|
||||
|
||||
m_ui->m_btnShowMoreMessages->setText(tr("Show more articles (%n remaining)", "", m_messages.size()));
|
||||
m_ui->m_btnShowMoreMessages->setEnabled(!m_messages.isEmpty());
|
||||
m_ui->scrollArea->verticalScrollBar()->setValue(current_scroll);
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent, {
|
||||
tr("Cannot show more articles"),
|
||||
tr("Cannot show more articles because parent feed was removed."),
|
||||
QSystemTrayIcon::MessageIcon::Warning });
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user