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
24 changes: 23 additions & 1 deletion panels/dock/taskmanager/package/AppItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,19 @@ Item {

PanelToolTip {
id: toolTip
text: root.name
text: root.itemId === "dde-trash" ? root.name + "-" + taskmanager.Applet.getTrashTipText() : root.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是加载cpp里比较好,AppItem里直接区分dde-trash后返回需要的name,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不太好加, 因为 从AM获取的数据,如果在name那边加,意义差不多,性能方面也一样。

toolTipX: DockPanelPositioner.x
toolTipY: DockPanelPositioner.y
}

PanelToolTip {
id: dragToolTip
text: qsTr("Move to Trash")
toolTipX: DockPanelPositioner.x
toolTipY: DockPanelPositioner.y
visible: false
}

Timer {
id: toolTipShowTimer
interval: 50
Expand All @@ -397,6 +405,20 @@ Item {
anchors.fill: parent
keys: ["dfm_app_type_for_drag"]

onEntered: function (drag) {
if (root.itemId === "dde-trash") {
var point = root.mapToItem(null, root.width / 2, root.height / 2)
dragToolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, dragToolTip.width, dragToolTip.height)
dragToolTip.open()
}
}

onExited: function (drag) {
if (root.itemId === "dde-trash") {
dragToolTip.close()
}
}

onDropped: function (drop){
root.dropFilesOnItem(root.itemId, drop.urls)
}
Expand Down
16 changes: 16 additions & 0 deletions panels/dock/taskmanager/taskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <QGuiApplication>
#include <QStringLiteral>
#include <QUrl>
#include <QDir>
#include <QStandardPaths>
#include <DTrashManager>

#include <appletbridge.h>
Expand Down Expand Up @@ -425,6 +427,20 @@ void TaskManager::saveDockElementsOrder(const QStringList &appIds)
TaskManagerSettings::instance()->setDockedElements(newDockedElements);
}

QString TaskManager::getTrashTipText()
{
int fileCount = 0;
QString trashPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/Trash/files";
QDir trashDir(trashPath);

if (trashDir.exists()) {
QStringList entries = trashDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
fileCount = entries.size();
}

return tr("%1 files").arg(fileCount);
}

void TaskManager::modifyOpacityChanged()
{
DS_NAMESPACE::DAppletBridge appearanceBridge("org.deepin.ds.dde-appearance");
Expand Down
1 change: 1 addition & 0 deletions panels/dock/taskmanager/taskmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class TaskManager : public DS_NAMESPACE::DContainment, public AbstractTaskManage

Q_INVOKABLE void activateWindow(uint32_t windowID);
Q_INVOKABLE void saveDockElementsOrder(const QStringList &appIds);
Q_INVOKABLE QString getTrashTipText();

private:
void moveFilesToTrash(const QStringList& urls);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -47,4 +54,11 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="ar">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ar">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -26,23 +35,30 @@
<name>dock::DockGlobalElementModel</name>
<message>
<source>Open</source>
<translation type="unfinished"/>
<translation type="unfinished">افتح</translation>
</message>
<message>
<source>Undock</source>
<translation type="unfinished"/>
<translation type="unfinished">فك الربط</translation>
</message>
<message>
<source>Dock</source>
<translation type="unfinished"/>
<translation type="unfinished">الرسو</translation>
</message>
<message>
<source>Force Quit</source>
<translation type="unfinished"/>
<translation type="unfinished">إنهاء قسري</translation>
</message>
<message>
<source>Close All</source>
<translation type="unfinished"/>
<translation type="unfinished">إغلاق الكل</translation>
</message>
</context>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
</TS>
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="az">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="az">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -26,23 +35,30 @@
<name>dock::DockGlobalElementModel</name>
<message>
<source>Open</source>
<translation type="unfinished"/>
<translation type="unfinished">Aç</translation>
</message>
<message>
<source>Undock</source>
<translation type="unfinished"/>
<translation type="unfinished">Undock</translation>
</message>
<message>
<source>Dock</source>
<translation type="unfinished"/>
<translation type="unfinished">Dock</translation>
</message>
<message>
<source>Force Quit</source>
<translation type="unfinished"/>
<translation type="unfinished">Zəmanətli Çıxış</translation>
</message>
<message>
<source>Close All</source>
<translation type="unfinished"/>
<translation type="unfinished">Hər Birı Kapat</translation>
</message>
</context>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
</TS>
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -47,4 +54,11 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="ca">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ca">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -45,4 +54,11 @@
<translation>Tanca-ho tot</translation>
</message>
</context>
</TS>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="de">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -26,23 +35,30 @@
<name>dock::DockGlobalElementModel</name>
<message>
<source>Open</source>
<translation type="unfinished"/>
<translation type="unfinished">Öffnen</translation>
</message>
<message>
<source>Undock</source>
<translation type="unfinished"/>
<translation type="unfinished">Abdocken</translation>
</message>
<message>
<source>Dock</source>
<translation type="unfinished"/>
<translation type="unfinished">Dock</translation>
</message>
<message>
<source>Force Quit</source>
<translation type="unfinished"/>
<translation type="unfinished">Beenden erzwingen</translation>
</message>
<message>
<source>Close All</source>
<translation type="unfinished"/>
<translation type="unfinished">Alle schließen</translation>
</message>
</context>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
</TS>
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="es">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="es">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -45,4 +54,11 @@
<translation>Cerrar todo</translation>
</message>
</context>
</TS>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="fi">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="fi">
<context>
<name>AppItem</name>
<message>
<source>Move to Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dock::AppItem</name>
<message>
Expand Down Expand Up @@ -45,4 +54,11 @@
<translation>Sulje kaikki</translation>
</message>
</context>
</TS>
<context>
<name>dock::TaskManager</name>
<message>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
Loading