diff --git a/panels/notification/center/NotifyViewDelegate.qml b/panels/notification/center/NotifyViewDelegate.qml index 7fcda825f..89fbc2d96 100644 --- a/panels/notification/center/NotifyViewDelegate.qml +++ b/panels/notification/center/NotifyViewDelegate.qml @@ -166,8 +166,8 @@ DelegateChooser { }) } onRemove: function () { - console.log("remove overlap", model.id) - notifyModel.remove(model.id) + console.log("remove overlap", model.appName) + notifyModel.removeByApp(model.appName) } onActionInvoked: function (actionId) { console.log("action overlap", model.id, actionId) diff --git a/panels/notification/center/OverlapNotify.qml b/panels/notification/center/OverlapNotify.qml index 8f11950fc..2e9c2ad1b 100644 --- a/panels/notification/center/OverlapNotify.qml +++ b/panels/notification/center/OverlapNotify.qml @@ -64,12 +64,15 @@ NotifyItem { contentIcon: root.contentIcon contentRowCount: root.contentRowCount enableDismissed: root.enableDismissed - - onRemove: function () { - root.removedCallback = function () { - root.remove() + clearButton: AnimationSettingButton { + icon.name: "clean-alone" + text: qsTr("Clean All") + onClicked: function () { + root.removedCallback = function() { + root.remove() + } + root.state = "removing" } - root.state = "removing" } onDismiss: function () { root.removedCallback = function () { diff --git a/panels/notification/center/notifymodel.cpp b/panels/notification/center/notifymodel.cpp index 9420aaeb7..f721e4e50 100644 --- a/panels/notification/center/notifymodel.cpp +++ b/panels/notification/center/notifymodel.cpp @@ -546,38 +546,41 @@ void NotifyModel::removeByApp(const QString &appName) int row = -1; for (int i = 0; i < m_appNotifies.size(); i++) { auto item = m_appNotifies[i]; - if (item->appName() == appName && item->type() == NotifyType::Group) { + if (item->appName() == appName && (item->type() == NotifyType::Group || item->type() == NotifyType::Overlap)) { row = i; break; } } - - if (row >= 0) { - auto notify = m_appNotifies[row]; - beginRemoveRows(QModelIndex(), row, row); - m_appNotifies.removeOne(notify); - endRemoveRows(); - notify->deleteLater(); + if (row < 0) { + qWarning(notifyLog) << "No notify for the app" << appName; + return; } + auto notify = m_appNotifies[row]; + beginRemoveRows(QModelIndex(), row, row); + m_appNotifies.removeOne(notify); + endRemoveRows(); - QList notifies; - for (int i = row; i < m_appNotifies.size(); i++) { - auto item = m_appNotifies[i]; - if (item->appName() == appName && item->type() == NotifyType::Normal) { - notifies.append(item); + if(notify->type() == NotifyType::Group) { + QList notifies; + for (int i = row; i < m_appNotifies.size(); i++) { + auto item = m_appNotifies[i]; + if (item->appName() == appName && item->type() == NotifyType::Normal) { + notifies.append(item); + } } - } - const auto start = row; - beginRemoveRows(QModelIndex(), start, start + notifies.size() - 1); - for (int i = 0; i < notifies.size(); i++) { - auto item = notifies[i]; - m_appNotifies.removeOne(item); - item->deleteLater(); - } - endRemoveRows(); + const auto start = row; + beginRemoveRows(QModelIndex(), start, start + notifies.size() - 1); + for (int i = 0; i < notifies.size(); i++) { + auto item = notifies[i]; + m_appNotifies.removeOne(item); + item->deleteLater(); + } + endRemoveRows(); + } m_accessor->removeEntityByApp(appName); + notify->deleteLater(); } void NotifyModel::clear() diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter.ts index 943a16b01..90240dfe1 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter.ts @@ -57,6 +57,13 @@ + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ar.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ar.ts index b7f82d0bc..b8745ec3f 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ar.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ar.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,18 +9,18 @@ Fold - + More - + NotifyCenter No recent notifications - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ إعداد الإخطارات + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ قبل دقيقة واحدة - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_az.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_az.ts index 79a8db536..e935f56ae 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_az.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_az.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,18 +9,18 @@ Fold - + More - + NotifyCenter No recent notifications - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ إعداد الإشعارات + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ الآن - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_bo.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_bo.ts index 943a16b01..90240dfe1 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_bo.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_bo.ts @@ -57,6 +57,13 @@ + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ca.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ca.ts index dc5c3a6af..24049af6b 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ca.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ca.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -55,6 +57,13 @@ Configuració de les notificacions + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Ara mateix - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_de.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_de.ts index fc585725d..d0662d432 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_de.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_de.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,18 +9,18 @@ Fold - + More - + NotifyCenter No recent notifications - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Benachrichtigungseinstellung + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Gerade eben - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_es.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_es.ts index 4411bc0e4..d92228354 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_es.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_es.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Ajustes de notificaciones + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Ahora mismo - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_fi.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_fi.ts index d27267b70..e02355e78 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_fi.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_fi.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Ilmoitusten asetukset + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Juuri nyt - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_fr.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_fr.ts index 2da39e20b..a89456b56 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_fr.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_fr.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Réglages des notifications + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ À l'instant - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_hu.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_hu.ts index 021c2089d..75a94816c 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_hu.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_hu.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,18 +9,18 @@ Fold - + More - + NotifyCenter No recent notifications - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Értesítési Beállítások + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Csak most - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_it.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_it.ts index 943a16b01..90240dfe1 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_it.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_it.ts @@ -57,6 +57,13 @@ + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ja.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ja.ts index 3c2ad8af3..934c5069d 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ja.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ja.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ 通知の設定 + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ たった今 - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ko.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ko.ts index 943a16b01..90240dfe1 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ko.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ko.ts @@ -57,6 +57,13 @@ + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_lo.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_lo.ts index 2693ed578..01ac9a790 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_lo.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_lo.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ ການຕັ້ງຄ່າການແຈ້ງເຕືອນ + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ ພຽງເທີ່ນີ້ - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_nb_NO.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_nb_NO.ts index 943a16b01..90240dfe1 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_nb_NO.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_nb_NO.ts @@ -57,6 +57,13 @@ + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_pl.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_pl.ts index a14b51ebc..35f56447b 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_pl.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_pl.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Ustawienia powiadomień + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Właśnie teraz - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_pt_BR.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_pt_BR.ts index f809e5185..a3c34be88 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_pt_BR.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_pt_BR.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Configurações de Notificações + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Há pouco - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ru.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ru.ts index ef94662e7..ba5b9fc2c 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_ru.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_ru.ts @@ -57,6 +57,13 @@ + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_sq.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_sq.ts index e9a364a26..6302250bb 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_sq.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_sq.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,18 +9,18 @@ Fold - + More - + NotifyCenter No recent notifications - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Rregullime Njoftimesh + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Mu tani - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_uk.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_uk.ts index 733e79e7a..86aff87c2 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_uk.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_uk.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -7,11 +9,11 @@ Fold - + More - + @@ -33,11 +35,11 @@ Fold - + More - + @@ -55,6 +57,13 @@ Параметри сповіщень + + OverlapNotify + + Clean All + + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ Щойно - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_CN.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_CN.ts index 6027d046e..9f15c96c3 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_CN.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_CN.ts @@ -1,4 +1,6 @@ - + + + GroupNotify @@ -55,6 +57,13 @@ 通知设置 + + OverlapNotify + + Clean All + 清除全部 + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ 刚刚 - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_HK.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_HK.ts index a1b8c4097..20cc071be 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_HK.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_HK.ts @@ -1,9 +1,11 @@ - + + + GroupNotify Clear All - 全部清除 + 清除全部 Fold @@ -55,6 +57,13 @@ 通知設置 + + OverlapNotify + + Clean All + 清除全部 + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ 剛剛 - \ No newline at end of file + diff --git a/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_TW.ts b/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_TW.ts index 7e1ab8cfc..1338115fb 100644 --- a/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_TW.ts +++ b/panels/notification/center/translations/org.deepin.ds.notificationcenter_zh_TW.ts @@ -1,9 +1,11 @@ - + + + GroupNotify Clear All - 全部清除 + 清除全部 Fold @@ -55,6 +57,13 @@ 通知設定 + + OverlapNotify + + Clean All + 清除全部 + + notifycenter::AppNotifyItem @@ -62,4 +71,4 @@ 剛剛 - \ No newline at end of file + diff --git a/panels/notification/plugin/NotifyItemContent.qml b/panels/notification/plugin/NotifyItemContent.qml index 965556f6d..dcf1266ac 100644 --- a/panels/notification/plugin/NotifyItemContent.qml +++ b/panels/notification/plugin/NotifyItemContent.qml @@ -16,6 +16,7 @@ NotifyItem { property bool closeVisible: activeFocus || impl.hovered property int miniContentHeight: NotifyStyle.contentItem.miniHeight property bool enableDismissed: true + property alias clearButton: clearLoader.sourceComponent Control { id: impl @@ -59,7 +60,9 @@ NotifyItem { height: 20 Loader { + id: clearLoader focus: true + anchors.right: parent.right active: !(root.strongInteractive && root.actions.length > 0) && (root.closeVisible || closePlaceHolder.hovered || activeFocus) sourceComponent: SettingActionButton { id: closeBtn