Skip to content

Commit

Permalink
Merge branch 'jb12571_dont_notify_on_part_change' into 'master'
Browse files Browse the repository at this point in the history
Don't notify unnecessarily

See merge request mer-core/qmf-notifications-plugin!5
  • Loading branch information
Tomin1 committed Nov 7, 2019
2 parents 353835d + 681b631 commit c70501b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
8 changes: 3 additions & 5 deletions rpm/qmf-notifications-plugin.spec
Expand Up @@ -2,7 +2,6 @@ Name: qmf-notifications-plugin
Summary: Notifications plugin for Qt Messaging Framework (QMF)
Version: 0.1.1
Release: 1
Group: System/Libraries
License: BSD
URL: https://git.merproject.org/mer-core/qmf-notifications-plugin
Source0: %{name}-%{version}.tar.bz2
Expand All @@ -15,7 +14,7 @@ BuildRequires: pkgconfig(nemonotifications-qt5) >= 1.0.5
BuildRequires: qt5-qttools-linguist

%description
Notifications plugin for Qt Messaging Framework (QMF)
%{summary}.

%prep
%setup -q -n %{name}-%{version}
Expand All @@ -24,7 +23,7 @@ Notifications plugin for Qt Messaging Framework (QMF)

%qmake5 QMF_INSTALL_ROOT=/usr

make %{?jobs:-j%jobs}
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
Expand All @@ -39,10 +38,9 @@ rm -rf %{buildroot}
%package ts-devel
Summary: Translation source for qmf-notifications-plugin
License: BSD
Group: System/Applications

%description ts-devel
Translation source for qmf-notifications-plugin
%{summary}.

%files ts-devel
%defattr(-,root,root,-)
Expand Down
10 changes: 3 additions & 7 deletions src/mailstoreobserver.cpp
Expand Up @@ -266,8 +266,8 @@ void MailStoreObserver::updateNotifications()
const QMailMessageId messageId(it.key());
const MessageInfo *message(it.value().data());

// Only republish this message if it has been updated
if (!_updatedMessages.contains(messageId) && !_newMessages.contains(messageId))
// Only republish this message if there is something to show
if (!_newMessages.contains(messageId))
continue;

Notification notification;
Expand Down Expand Up @@ -295,8 +295,6 @@ void MailStoreObserver::updateNotifications()

notification.publish();
}

_updatedMessages.clear();
}

// ################ Slots #####################
Expand Down Expand Up @@ -407,10 +405,8 @@ void MailStoreObserver::updateMessages(const QMailMessageIdList &ids)
if (!notifyMessage(message)) {
_publishedMessages.remove(id);
_newMessages.remove(id);
} else {
_updatedMessages.insert(id);
_publicationChanges = true;
}
_publicationChanges = true;
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/mailstoreobserver.h
Expand Up @@ -83,7 +83,6 @@ private slots:
QMailStore *_storage;
MessageHash _publishedMessages;
QSet<QMailMessageId> _newMessages;
QSet<QMailMessageId> _updatedMessages;

void reloadNotifications();
void closeNotifications();
Expand Down

0 comments on commit c70501b

Please sign in to comment.