Skip to content

Commit d712157

Browse files
committed
fix(dock): polish fashion mode behavior
Polish the fashion mode behavior based on follow-up fixes. Tighten layout, interaction, and popup handling details.
1 parent 2e77be2 commit d712157

24 files changed

Lines changed: 1167 additions & 190 deletions

debian/dde-shell.install

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.ds.dde-apps.json
3131
usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.ds.dock.json
3232
usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.ds.dock.taskmanager.json
3333
usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.ds.dock.tray.json
34+
usr/share/dsg/configs/org.deepin.dde.dock/
35+
usr/share/dsg/configs/org.deepin.dde.tray-loader/
3436
usr/share/dsg/configs/org.deepin.ds.dock/
3537
usr/share/deepin-debug-config/deepin-debug-config.d/*.json
3638
usr/share/deepin-log-viewer/deepin-log.conf.d/*.json

panels/dock/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,7 @@ dtk_add_config_meta_files(APPID org.deepin.ds.dock FILES dconfig/org.deepin.ds.d
195195
dtk_add_config_meta_files(APPID org.deepin.ds.dock FILES dconfig/org.deepin.ds.dock.tray.json) # compat
196196
dtk_add_config_meta_files(APPID org.deepin.dde.shell FILES dconfig/org.deepin.ds.dock.json)
197197
dtk_add_config_meta_files(APPID org.deepin.dde.shell FILES dconfig/org.deepin.ds.dock.tray.json)
198+
dtk_add_config_meta_files(APPID org.deepin.dde.dock FILES dconfig/org.deepin.dde.dock.json)
199+
dtk_add_config_meta_files(APPID org.deepin.dde.dock FILES dconfig/org.deepin.dde.dock.plugin.quick-panel.json)
200+
dtk_add_config_meta_files(APPID org.deepin.dde.tray-loader FILES dconfig/org.deepin.dde.dock.json)
201+
dtk_add_config_meta_files(APPID org.deepin.dde.tray-loader FILES dconfig/org.deepin.dde.dock.plugin.quick-panel.json)

panels/dock/OverflowContainer.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Item {
1919
property alias addDisplaced: listView.addDisplaced
2020
property alias removeDisplaced: listView.removeDisplaced
2121
property alias moveDisplaced: listView.moveDisplaced
22+
property alias footer: listView.footer
23+
property alias footerPositioning: listView.footerPositioning
2224
ListView {
2325
id: listView
2426
anchors.fill: parent
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"magic": "dsg.config.meta",
3+
"version": "1.0",
4+
"contents": {
5+
"Dock_Size": {
6+
"value": 48,
7+
"serial": 0,
8+
"flags": [],
9+
"name": "Dock_Size",
10+
"name[zh_CN]": "*****",
11+
"description": "",
12+
"permissions": "readwrite",
13+
"visibility": "private"
14+
},
15+
"Position": {
16+
"value": "bottom",
17+
"serial": 0,
18+
"flags": [],
19+
"name": "Position",
20+
"name[zh_CN]": "*****",
21+
"description": "",
22+
"permissions": "readwrite",
23+
"visibility": "private"
24+
},
25+
"Hide_Mode": {
26+
"value": "keep-showing",
27+
"serial": 0,
28+
"flags": [],
29+
"name": "Hide_Mode",
30+
"name[zh_CN]": "*****",
31+
"description": "The value will influence when the dock is shown or hidden.",
32+
"permissions": "readwrite",
33+
"visibility": "private"
34+
},
35+
"Item_Alignment": {
36+
"value": "center",
37+
"serial": 0,
38+
"flags": [],
39+
"name": "Item_Alignment",
40+
"name[zh_CN]": "*****",
41+
"description": "",
42+
"permissions": "readwrite",
43+
"visibility": "private"
44+
},
45+
"View_Mode": {
46+
"value": "center",
47+
"serial": 0,
48+
"flags": [],
49+
"name": "View_Mode",
50+
"name[zh_CN]": "*****",
51+
"description": "",
52+
"permissions": "readwrite",
53+
"visibility": "private"
54+
},
55+
"Indicator_Style": {
56+
"value": "Fashion",
57+
"serial": 0,
58+
"flags": [],
59+
"name": "Indicator_Style",
60+
"name[zh_CN]": "*****",
61+
"description": "",
62+
"permissions": "readwrite",
63+
"visibility": "private"
64+
},
65+
"Plugins_Visible": {
66+
"value": {},
67+
"serial": 0,
68+
"flags": [],
69+
"name": "The visibilities of plugins",
70+
"name[zh_CN]": "插件可见性",
71+
"description": "The loaded plugin which is visible when dock is started.",
72+
"permissions": "readwrite",
73+
"visibility": "private"
74+
},
75+
"Show_In_Primary": {
76+
"value": true,
77+
"serial": 0,
78+
"flags": [],
79+
"name": "show_in_primary",
80+
"name[zh_CN]": "任务栏显示在主屏幕",
81+
"description": "show dock in primary screen",
82+
"permissions": "readwrite",
83+
"visibility": "private"
84+
},
85+
"Locked": {
86+
"value": false,
87+
"serial": 0,
88+
"flags": [],
89+
"name": "locked",
90+
"name[zh_CN]": "禁用自由调节",
91+
"description": "lock dock to prevent dragging resize",
92+
"permissions": "readwrite",
93+
"visibility": "private"
94+
},
95+
"enableShowDesktop": {
96+
"value": true,
97+
"serial": 0,
98+
"flags": [],
99+
"name": "Enable ShowDesktop",
100+
"name[zh_CN]": "启用显示桌面区域",
101+
"description": "Enable or disable the show desktop area on the right side of the dock",
102+
"permissions": "readwrite",
103+
"visibility": "private"
104+
}
105+
}
106+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"magic": "dsg.config.meta",
3+
"version": "1.0",
4+
"contents": {
5+
"Dock_Quick_Plugins": {
6+
"value": [
7+
"network-item-key",
8+
"bluetooth-item-key"
9+
],
10+
"serial": 0,
11+
"flags": [],
12+
"name": "Dock_Quick_Plugins",
13+
"name[zh_CN]": "停靠在任务栏上的快捷面板插件",
14+
"description": "Quick panel plugin item keys that should also stay visible on the dock by default.",
15+
"description[zh_CN]": "默认同时显示在任务栏上的快捷面板插件 item key 列表。",
16+
"permissions": "readwrite",
17+
"visibility": "private"
18+
}
19+
}
20+
}

panels/dock/dockpanel.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,12 @@ void DockPanel::setPosition(const Position& position)
547547

548548
// Directly commit the position change
549549
SETTINGS->setPosition(position);
550+
551+
if (SETTINGS->viewMode() == ViewMode::FashionMode) {
552+
SETTINGS->setItemAlignment(position == Position::Bottom
553+
? ItemAlignment::LeftAlignment
554+
: ItemAlignment::CenterAlignment);
555+
}
550556
}
551557

552558
void DockPanel::setViewMode(const ViewMode &mode)
@@ -564,7 +570,9 @@ void DockPanel::setViewMode(const ViewMode &mode)
564570
SETTINGS->setItemAlignment(ItemAlignment::LeftAlignment);
565571
break;
566572
case ViewMode::FashionMode:
567-
SETTINGS->setItemAlignment(ItemAlignment::LeftAlignment);
573+
SETTINGS->setItemAlignment(SETTINGS->position() == Position::Bottom
574+
? ItemAlignment::LeftAlignment
575+
: ItemAlignment::CenterAlignment);
568576
SETTINGS->setIndicatorStyle(IndicatorStyle::Fashion);
569577
break;
570578
}

panels/dock/fashionleftpluginprovider.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2573,6 +2573,11 @@ QString FashionLeftPluginProvider::mailSummaryText() const
25732573
return m_mailSummaryText;
25742574
}
25752575

2576+
bool FashionLeftPluginProvider::mailConfigured() const
2577+
{
2578+
return m_mailConfigured;
2579+
}
2580+
25762581
QString FashionLeftPluginProvider::mailIconName() const
25772582
{
25782583
return m_mailIconName;
@@ -2817,6 +2822,11 @@ void FashionLeftPluginProvider::openWeatherPopup(int taskbarLeft, int taskbarTop
28172822

28182823
void FashionLeftPluginProvider::openMailClient()
28192824
{
2825+
refreshMailState();
2826+
if (!m_mailConfigured) {
2827+
return;
2828+
}
2829+
28202830
refreshMailClient();
28212831

28222832
if (!m_mailDesktopFilePath.isEmpty()
@@ -3119,6 +3129,7 @@ void FashionLeftPluginProvider::refreshMailState()
31193129

31203130
int nextMailUnreadCount = 0;
31213131
QString nextMailSummaryText = QStringLiteral("邮箱信息不可用");
3132+
bool nextMailConfigured = false;
31223133

31233134
if (mailInterface.isValid()) {
31243135
const QDBusReply<QString> accountsReply = mailInterface.call(QStringLiteral("GetAccounts"));
@@ -3129,6 +3140,7 @@ void FashionLeftPluginProvider::refreshMailState()
31293140
if (accountIds.isEmpty()) {
31303141
nextMailSummaryText = QStringLiteral("未配置邮箱账户");
31313142
} else {
3143+
nextMailConfigured = true;
31323144
nextMailSummaryText = accountIds.size() == 1
31333145
? accountIds.constFirst()
31343146
: QStringLiteral("%1个邮箱").arg(accountIds.size());
@@ -3150,10 +3162,13 @@ void FashionLeftPluginProvider::refreshMailState()
31503162
}
31513163
}
31523164

3153-
if (m_mailUnreadCount == nextMailUnreadCount && m_mailSummaryText == nextMailSummaryText) {
3165+
if (m_mailConfigured == nextMailConfigured
3166+
&& m_mailUnreadCount == nextMailUnreadCount
3167+
&& m_mailSummaryText == nextMailSummaryText) {
31543168
return;
31553169
}
31563170

3171+
m_mailConfigured = nextMailConfigured;
31573172
m_mailUnreadCount = nextMailUnreadCount;
31583173
m_mailSummaryText = nextMailSummaryText;
31593174
emit mailStateChanged();

panels/dock/fashionleftpluginprovider.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class FashionLeftPluginProvider : public QObject
2525
Q_PROPERTY(int mailUnreadCount READ mailUnreadCount NOTIFY mailStateChanged FINAL)
2626
Q_PROPERTY(QString mailUnreadCountText READ mailUnreadCountText NOTIFY mailStateChanged FINAL)
2727
Q_PROPERTY(QString mailSummaryText READ mailSummaryText NOTIFY mailStateChanged FINAL)
28+
Q_PROPERTY(bool mailConfigured READ mailConfigured NOTIFY mailStateChanged FINAL)
2829
Q_PROPERTY(QString mailIconName READ mailIconName NOTIFY mailClientChanged FINAL)
2930
Q_PROPERTY(QString mailClientName READ mailClientName NOTIFY mailClientChanged FINAL)
3031
Q_PROPERTY(bool musicAvailable READ musicAvailable NOTIFY musicStateChanged FINAL)
@@ -67,6 +68,7 @@ class FashionLeftPluginProvider : public QObject
6768
int mailUnreadCount() const;
6869
QString mailUnreadCountText() const;
6970
QString mailSummaryText() const;
71+
bool mailConfigured() const;
7072
QString mailIconName() const;
7173
QString mailClientName() const;
7274
bool musicAvailable() const;
@@ -165,6 +167,7 @@ private slots:
165167
int m_notificationCount = 0;
166168
int m_mailUnreadCount = 0;
167169
QString m_mailSummaryText = QStringLiteral("邮箱信息不可用");
170+
bool m_mailConfigured = false;
168171
QString m_mailDesktopId;
169172
QString m_mailDesktopFilePath;
170173
QString m_mailIconName = QStringLiteral("deepin-mail");

panels/dock/package/FashionLeftDockArea.qml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Control {
8282
readonly property color aiIconTintColor: Panel.colorTheme === Dock.Dark ? Qt.rgba(1, 1, 1, 0.92) : Qt.rgba(0, 0, 0, 0.86)
8383
readonly property int weatherTextSpacing: root.tightSpacing - 2
8484
readonly property bool musicPageVisible: provider.musicAvailable
85+
readonly property bool mailPageVisible: provider.mailConfigured
8586
readonly property bool aiPageVisible: provider.aiRunningCount > 0 && aiEntries.length > 0
8687
readonly property var pageIds: {
8788
const ids = ["weather"]
@@ -91,7 +92,9 @@ Control {
9192
if (musicPageVisible) {
9293
ids.push("music")
9394
}
94-
ids.push("mail")
95+
if (mailPageVisible) {
96+
ids.push("mail")
97+
}
9598
ids.push("system")
9699
return ids
97100
}
@@ -563,6 +566,11 @@ Control {
563566
}
564567

565568
function handleMailUnreadCountChange() {
569+
if (!provider.mailConfigured) {
570+
root.previousMailUnreadCount = provider.mailUnreadCount
571+
return
572+
}
573+
566574
const unreadIncreased = provider.mailUnreadCount > root.previousMailUnreadCount
567575
if (unreadIncreased && root.currentPageId !== "mail") {
568576
root.mailReturnPageId = root.normalizedPageId(root.currentPageId)
@@ -573,6 +581,26 @@ Control {
573581
root.previousMailUnreadCount = provider.mailUnreadCount
574582
}
575583

584+
function handleMailVisibilityChange() {
585+
if (provider.mailConfigured) {
586+
return
587+
}
588+
589+
const fallbackPageId = root.normalizedPageId(root.mailAutoActive ? root.mailReturnPageId : root.manualPageId)
590+
if (root.currentPageId === "mail"
591+
|| root.transitionFromPageId === "mail"
592+
|| root.transitionToPageId === "mail") {
593+
root.showPage(fallbackPageId, false)
594+
}
595+
596+
if (root.manualPageId === "mail") {
597+
root.manualPageId = "weather"
598+
}
599+
600+
root.mailAutoActive = false
601+
root.previousMailUnreadCount = provider.mailUnreadCount
602+
}
603+
576604
function completeMailAutoFocus() {
577605
if (!root.mailAutoActive) {
578606
return
@@ -635,6 +663,7 @@ Control {
635663
}
636664

637665
function onMailStateChanged() {
666+
root.handleMailVisibilityChange()
638667
root.handleMailUnreadCountChange()
639668
if (rootHoverHandler.hovered && root.currentPageId === "mail") {
640669
if (pageToolTip.toolTipVisible) {

0 commit comments

Comments
 (0)