Skip to content

Commit 640512d

Browse files
sync: from linuxdeepin/dde-session-shell
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#18
1 parent 6bd4bc0 commit 640512d

File tree

7 files changed

+2295
-11
lines changed

7 files changed

+2295
-11
lines changed

src/widgets/centertopwidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const int TOP_TIP_SPACING = 10;
1919

2020
#ifdef ENABLE_DSS_SNIPE
2121
static const QString localeNameKey = "localeName";
22-
static const QString longDateFormatKey = "longDateFormat";
22+
static const QString shortDateFormatKey = "shortDateFormat";
2323
static const QString shortTimeFormatKey = "shortTimeFormat";
2424
#endif // ENABLE_DSS_SNIPE
2525

@@ -178,7 +178,7 @@ void CenterTopWidget::onUserRegionFormatValueChanged(const QDBusMessage &dbusMes
178178
return;
179179

180180
QString key = dbusMessage.arguments().at(0).toString();
181-
if (key == localeNameKey || key == shortTimeFormatKey || key == longDateFormatKey) {
181+
if (key == localeNameKey || key == shortTimeFormatKey || key == shortDateFormatKey) {
182182
updateUserDateTimeFormat();
183183
}
184184
}
@@ -251,8 +251,8 @@ void CenterTopWidget::updateUserDateTimeFormat()
251251

252252
QString localeName = qApp->applicationName() == "dde-lock" ? QLocale::system().name() : getRegionFormatValue(userConfigDbusPath, localeNameKey);
253253
QString shortTimeFormat = getRegionFormatValue(userConfigDbusPath, shortTimeFormatKey);
254-
QString longDateFormat = getRegionFormatValue(userConfigDbusPath, longDateFormatKey);
254+
QString shortDateFormat = getRegionFormatValue(userConfigDbusPath, shortDateFormatKey);
255255

256-
m_timeWidget->updateLocale(localeName, shortTimeFormat, longDateFormat);
256+
m_timeWidget->updateLocale(localeName, shortTimeFormat, shortDateFormat);
257257
}
258258
#endif // ENABLE_DSS_SNIPE

src/widgets/timewidget.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ void TimeWidget::refreshTime()
8282
m_dateLabel->setText(m_locale.toString(QDateTime::currentDateTime(), date_format));
8383

8484
#ifdef ENABLE_DSS_SNIPE
85-
if (!m_shortTimeFormat.isEmpty() && !m_longDateFormat.isEmpty()) {
85+
if (!m_shortTimeFormat.isEmpty() && !m_shortDateFormat.isEmpty()) {
8686
m_timeLabel->setText(m_locale.toString(QTime::currentTime(), m_shortTimeFormat));
87-
m_dateLabel->setText(m_locale.toString(QDate::currentDate(), m_longDateFormat));
87+
m_dateLabel->setText(m_locale.toString(QDate::currentDate(), m_shortDateFormat + " " + weekdayFormat.at(m_weekdayIndex)));
8888
}
8989
#endif // ENABLE_DSS_SNIPE
9090
}
@@ -131,13 +131,13 @@ QSize TimeWidget::sizeHint() const
131131
}
132132

133133
#ifdef ENABLE_DSS_SNIPE
134-
void TimeWidget::updateLocale(const QString &locale, const QString &shortTimeFormat, const QString &longDateFormat)
134+
void TimeWidget::updateLocale(const QString &locale, const QString &shortTimeFormat, const QString &shortDateFormat)
135135
{
136136
m_locale = QLocale(locale);
137137
if (!shortTimeFormat.isEmpty())
138138
m_shortTimeFormat = shortTimeFormat;
139-
if (!longDateFormat.isEmpty())
140-
m_longDateFormat = longDateFormat;
139+
if (!shortDateFormat.isEmpty())
140+
m_shortDateFormat = shortDateFormat;
141141

142142
refreshTime();
143143
}

src/widgets/timewidget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TimeWidget : public QWidget
2424
QSize sizeHint() const override;
2525

2626
#ifdef ENABLE_DSS_SNIPE
27-
void updateLocale(const QString &locale, const QString &shortTimeFormat = "", const QString &longDateFormat = "");
27+
void updateLocale(const QString &locale, const QString &shortTimeFormat = "", const QString &shortDateFormat = "");
2828
#endif // ENABLE_DSS_SNIPE
2929

3030
public Q_SLOTS:
@@ -49,7 +49,7 @@ public Q_SLOTS:
4949

5050
#ifdef ENABLE_DSS_SNIPE
5151
QString m_shortTimeFormat;
52-
QString m_longDateFormat;
52+
QString m_shortDateFormat;
5353
#endif // ENABLE_DSS_SNIPE
5454
};
5555

0 commit comments

Comments
 (0)