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
13 changes: 1 addition & 12 deletions panels/notification/bubble/bubblemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
return nullptr;
}
for (const auto &item : m_bubbles) {
if (item->bubbleId() == id) {
if (item->id() == id) {

Check warning on line 138 in panels/notification/bubble/bubblemodel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Consider using std::find_if algorithm instead of a raw loop.
m_delayBubbles.removeAll(id);
remove(m_bubbles.indexOf(item));
return item;
Expand All @@ -145,18 +145,7 @@
return nullptr;
}

uint BubbleModel::getBubbleIdByStorageId(qint64 id) const
{
for (const auto &item : m_bubbles) {
if (item->id() == id) {
return item->bubbleId();
}
}

return 0;
}

BubbleItem *BubbleModel::bubbleItem(int bubbleIndex) const

Check warning on line 148 in panels/notification/bubble/bubblemodel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'bubbleItem' is never used.
{
if (bubbleIndex < 0 || bubbleIndex >= items().count())
return nullptr;
Expand Down
1 change: 0 additions & 1 deletion panels/notification/bubble/bubblemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class BubbleModel : public QAbstractListModel
Q_INVOKABLE void remove(int index);
void remove(const BubbleItem *bubble);
BubbleItem *removeById(qint64 id);
uint getBubbleIdByStorageId(qint64 id) const;
void clear();

BubbleItem *bubbleItem(int bubbleIndex) const;
Expand Down
10 changes: 1 addition & 9 deletions panels/notification/bubble/bubblepanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,10 @@ void BubblePanel::addBubble(qint64 id)

void BubblePanel::closeBubble(qint64 id)
{
const auto entity = m_accessor->fetchEntity(id);
if (entity.isValid()) {
id = entity.bubbleId();
} else {
qDebug(notifyLog) << "Entity not found or invalid for close bubble, using storage id lookup:" << id;
id = m_bubbles->getBubbleIdByStorageId(id);
}

if (id > 0) {
m_bubbles->removeById(id);
} else {
qWarning(notifyLog) << "Failed to close bubble: invalid bubble id for entity id:" << id << "appName:" << entity.appName() << "cTime:" << entity.cTime();
qWarning(notifyLog) << "Failed to close bubble: invalid bubble id for entity id:" << id;
clearInvalidBubbles();
}
}
Expand Down