Some changes for notifications and some tiny preps for messages part of new "plugin" API.
This commit is contained in:
parent
8bef6daf00
commit
ad0771ffe0
@ -21,6 +21,8 @@
|
||||
|
||||
Fixed:
|
||||
<ul>
|
||||
<li>Improved popup informing about changes in newly installed version.</li>
|
||||
<li>Icons in notification popups are now smaller (22 x 22 pixels).</li>
|
||||
<li>Encoding selection widget in feed add/edit dialog now detects encodings via case insensitive string matching.</li>
|
||||
<li>When removing download item from download manager via DELETE key, then "Cleanup" button is correctly disabled.</li>
|
||||
</ul>
|
||||
|
@ -394,7 +394,7 @@ bool MessagesModel::setBatchMessagesDeleted(const QModelIndexList &messages, int
|
||||
}
|
||||
}
|
||||
|
||||
bool MessagesModel::setBatchMessagesRead(const QModelIndexList &messages, int read) {
|
||||
bool MessagesModel::setBatchMessagesRead(const QModelIndexList &messages, RootItem::ReadStatus read) {
|
||||
QSqlDatabase db_handle = database();
|
||||
QSqlQuery query_read_msg(db_handle);
|
||||
QStringList message_ids;
|
||||
@ -406,8 +406,9 @@ bool MessagesModel::setBatchMessagesRead(const QModelIndexList &messages, int re
|
||||
message_ids.append(QString::number(messageId(message.row())));
|
||||
}
|
||||
|
||||
if (query_read_msg.exec(QString(QSL("UPDATE Messages SET is_read = %2 WHERE id IN (%1);")).arg(message_ids.join(QSL(", ")),
|
||||
QString::number(read)))) {
|
||||
if (query_read_msg.exec(QString(QSL("UPDATE Messages SET is_read = %2 WHERE id IN (%1);"))
|
||||
.arg(message_ids.join(QSL(", ")),
|
||||
read == RootItem::Read ? QSL("1") : QSL("0")))) {
|
||||
select();
|
||||
fetchAll();
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "core/feedsselection.h"
|
||||
#include "core/message.h"
|
||||
#include "core/rootitem.h"
|
||||
|
||||
#include <QSqlTableModel>
|
||||
#include <QFont>
|
||||
@ -80,7 +81,7 @@ class MessagesModel : public QSqlTableModel {
|
||||
// changes ARE written to the database.
|
||||
bool switchBatchMessageImportance(const QModelIndexList &messages);
|
||||
bool setBatchMessagesDeleted(const QModelIndexList &messages, int deleted);
|
||||
bool setBatchMessagesRead(const QModelIndexList &messages, int read);
|
||||
bool setBatchMessagesRead(const QModelIndexList &messages, RootItem::ReadStatus read);
|
||||
bool setBatchMessagesRestored(const QModelIndexList &messages);
|
||||
|
||||
// Fetches ALL available data to the model.
|
||||
|
@ -88,6 +88,12 @@ bool RootItem::cleanMessages(bool clear_only_read) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void RootItem::updateCounts(bool including_total_count) {
|
||||
foreach (RootItem *child, m_childItems) {
|
||||
child->updateCounts(including_total_count);
|
||||
}
|
||||
}
|
||||
|
||||
void RootItem::setupFonts() {
|
||||
m_normalFont = Application::font("FeedsView");
|
||||
m_boldFont = m_normalFont;
|
||||
|
@ -107,6 +107,9 @@ class RootItem : public QObject {
|
||||
// service account, it should not do anything.
|
||||
virtual bool cleanMessages(bool clear_only_read);
|
||||
|
||||
// Updates counts of all/unread messages for this feed.
|
||||
virtual void updateCounts(bool including_total_count);
|
||||
|
||||
virtual int row() const;
|
||||
virtual QVariant data(int column, int role) const;
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
#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 "@APP_LOW_NAME@/itempointer"
|
||||
#define DOWNLOADER_ICON_SIZE 48
|
||||
#define NOTIFICATION_ICON_SIZE 64
|
||||
#define NOTIFICATION_ICON_SIZE 32
|
||||
#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"
|
||||
|
8
src/gui/dialogs/formabout.ui
Normal file → Executable file
8
src/gui/dialogs/formabout.ui
Normal file → Executable file
@ -104,7 +104,7 @@
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_tabInfo">
|
||||
<attribute name="title">
|
||||
@ -166,8 +166,8 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>685</width>
|
||||
<height>184</height>
|
||||
<width>98</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
@ -242,7 +242,7 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>83</width>
|
||||
<width>98</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -318,14 +318,14 @@ void MessagesView::sendSelectedMessageViaEmail() {
|
||||
}
|
||||
|
||||
void MessagesView::markSelectedMessagesRead() {
|
||||
setSelectedMessagesReadStatus(1);
|
||||
setSelectedMessagesReadStatus(RootItem::Read);
|
||||
}
|
||||
|
||||
void MessagesView::markSelectedMessagesUnread() {
|
||||
setSelectedMessagesReadStatus(0);
|
||||
setSelectedMessagesReadStatus(RootItem::Unread);
|
||||
}
|
||||
|
||||
void MessagesView::setSelectedMessagesReadStatus(int read) {
|
||||
void MessagesView::setSelectedMessagesReadStatus(RootItem::ReadStatus read) {
|
||||
QModelIndex current_index = selectionModel()->currentIndex();
|
||||
|
||||
if (!current_index.isValid()) {
|
||||
@ -342,7 +342,7 @@ void MessagesView::setSelectedMessagesReadStatus(int read) {
|
||||
selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true);
|
||||
current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), mapped_current_index.column()));
|
||||
|
||||
if (read == 0) {
|
||||
if (read == RootItem::Unread) {
|
||||
// User selected to mark some messages as unread, if one
|
||||
// of them will be marked as current, then it will be read again.
|
||||
m_batchUnreadSwitch = true;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "core/messagesmodel.h"
|
||||
|
||||
#include "core/feedsselection.h"
|
||||
#include "core/rootitem.h"
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QHeaderView>
|
||||
@ -47,9 +48,6 @@ class MessagesView : public QTreeView {
|
||||
return m_sourceModel;
|
||||
}
|
||||
|
||||
// Creates needed connections.
|
||||
void createConnections();
|
||||
|
||||
public slots:
|
||||
void keyboardSearch(const QString &search);
|
||||
|
||||
@ -70,7 +68,7 @@ class MessagesView : public QTreeView {
|
||||
void sendSelectedMessageViaEmail();
|
||||
|
||||
// Works with SELECTED messages only.
|
||||
void setSelectedMessagesReadStatus(int read);
|
||||
void setSelectedMessagesReadStatus(RootItem::ReadStatus read);
|
||||
void markSelectedMessagesRead();
|
||||
void markSelectedMessagesUnread();
|
||||
void switchSelectedMessagesImportance();
|
||||
@ -94,7 +92,20 @@ class MessagesView : public QTreeView {
|
||||
// Saves current sort state.
|
||||
void saveSortState(int column, Qt::SortOrder order);
|
||||
|
||||
protected:
|
||||
signals:
|
||||
// Link/message openers.
|
||||
void openLinkNewTab(const QString &link);
|
||||
void openLinkMiniBrowser(const QString &link);
|
||||
void openMessagesInNewspaperView(const QList<Message> &messages);
|
||||
|
||||
// Notify others about message selections.
|
||||
void currentMessagesChanged(const QList<Message> &messages);
|
||||
void currentMessagesRemoved();
|
||||
|
||||
private:
|
||||
// Creates needed connections.
|
||||
void createConnections();
|
||||
|
||||
// Initializes context menu.
|
||||
void initializeContextMenu();
|
||||
|
||||
@ -108,17 +119,6 @@ class MessagesView : public QTreeView {
|
||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
|
||||
signals:
|
||||
// Link/message openers.
|
||||
void openLinkNewTab(const QString &link);
|
||||
void openLinkMiniBrowser(const QString &link);
|
||||
void openMessagesInNewspaperView(const QList<Message> &messages);
|
||||
|
||||
// Notify others about message selections.
|
||||
void currentMessagesChanged(const QList<Message> &messages);
|
||||
void currentMessagesRemoved();
|
||||
|
||||
private:
|
||||
QMenu *m_contextMenu;
|
||||
|
||||
MessagesProxyModel *m_proxyModel;
|
||||
|
0
src/gui/notifications/notification.cpp
Normal file → Executable file
0
src/gui/notifications/notification.cpp
Normal file → Executable file
10
src/main.cpp
10
src/main.cpp
@ -120,7 +120,15 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Setup single-instance behavior.
|
||||
QObject::connect(&application, SIGNAL(messageReceived(QString)), &application, SLOT(processExecutionMessage(QString)));
|
||||
qApp->showGuiMessage(QSL(APP_NAME), QObject::tr("Welcome to %1 %2.").arg(APP_NAME, APP_VERSION), QSystemTrayIcon::NoIcon);
|
||||
|
||||
if (qApp->isFirstRun() || qApp->isFirstRun(APP_VERSION)) {
|
||||
qApp->showGuiMessage(QSL(APP_NAME), QObject::tr("Welcome to %1.\n\nPlease, check NEW stuff included in this\n"
|
||||
"version by clicking this popup notification.").arg(APP_LONG_NAME),
|
||||
QSystemTrayIcon::NoIcon, 0, false, QIcon(), &main_window, SLOT(showAbout()));
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(QSL(APP_NAME), QObject::tr("Welcome to %1.").arg(APP_LONG_NAME), QSystemTrayIcon::NoIcon);
|
||||
}
|
||||
|
||||
// Enter global event loop.
|
||||
return Application::exec();
|
||||
|
@ -59,9 +59,6 @@ class Feed : public RootItem {
|
||||
// Performs synchronous update and returns number of newly updated messages.
|
||||
virtual int update() = 0;
|
||||
|
||||
// Updates counts of all/unread messages for this feed.
|
||||
virtual void updateCounts(bool including_total_count) = 0;
|
||||
|
||||
// Get ALL undeleted messages from this feed in one single list.
|
||||
virtual QList<Message> undeletedMessages() const = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user