Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions panels/notification/common/dataaccessorproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ qint64 DataAccessorProxy::addEntity(const NotifyEntity &entity)
if (entity.processedType() == NotifyEntity::NotProcessed) {
return m_impl->addEntity(entity);
} else {
if (m_source && m_source->isValid()) {
if (m_source && m_source->isValid() && !filterToSource(entity)) {
return m_source->addEntity(entity);
}
}
Expand All @@ -63,10 +63,14 @@ void DataAccessorProxy::updateEntityProcessedType(qint64 id, int processedType)
m_impl->updateEntityProcessedType(id, processedType);
if (m_source && m_source->isValid()) {
auto entity = m_impl->fetchEntity(id);
const auto sId = m_source->addEntity(entity);
if (sId > 0) {
if (!filterToSource(entity)) {
const auto sId = m_source->addEntity(entity);
if (sId > 0) {
m_impl->removeEntity(id);
entity.setId(sId);
}
} else {
m_impl->removeEntity(id);
entity.setId(sId);
}
}
return;
Expand Down Expand Up @@ -177,4 +181,11 @@ bool DataAccessorProxy::routerToSource(qint64 id, int processedType) const
}
return false;
}

bool DataAccessorProxy::filterToSource(const NotifyEntity &entity) const
{
// "cancel"表示正在发送蓝牙文件,不需要发送到通知中心
const auto bluetooth = entity.body().contains("%") && entity.actions().contains("cancel");
return bluetooth;
}
}
1 change: 1 addition & 0 deletions panels/notification/common/dataaccessorproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class DataAccessorProxy : public DataAccessor

private:
bool routerToSource(qint64 id, int processedType) const;
bool filterToSource(const NotifyEntity &entity) const;

private:
DataAccessor *m_source = nullptr;
Expand Down
4 changes: 1 addition & 3 deletions panels/notification/server/notificationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,7 @@ void NotificationManager::updateEntityProcessed(const NotifyEntity &entity)
if (entity.hints().contains("x-deepin-ShowInNotifyCenter")) {
showInCenter = entity.hints()["x-deepin-ShowInNotifyCenter"].toBool();
}
// "cancel"表示正在发送蓝牙文件,不需要发送到通知中心
const auto bluetooth = entity.body().contains("%") && entity.actions().contains("cancel");
if (removed || !showInCenter || bluetooth) {
if (removed || !showInCenter) {
// remove it from memory
m_persistence->removeEntity(id);
} else {
Expand Down