Skip to content

Commit 1c72a25

Browse files
sync: from linuxdeepin/dtkcore
Synchronize source files from linuxdeepin/dtkcore. Source-pull-request: linuxdeepin/dtkcore#495
1 parent 2d93c38 commit 1c72a25

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.packit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
specfile_path: rpm/dtkcore.spec
55

66
# add or remove files that should be synced
7-
files_to_sync:
7+
synced_files:
88
- rpm/dtkcore.spec
99
- .packit.yaml
1010

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ find_package(ICU REQUIRED COMPONENTS uc)
2525
pkg_check_modules(uchardet REQUIRED uchardet)
2626
# end text encoding
2727

28+
# 为不包含实际QObject类的头文件跳过AutoMOC处理
29+
set_property(SOURCE ../include/base/dsingleton.h PROPERTY SKIP_AUTOMOC ON)
30+
if("${DTK_VERSION_MAJOR}" STREQUAL "6")
31+
set_property(SOURCE ../include/util/dthreadutils.h PROPERTY SKIP_AUTOMOC ON)
32+
endif()
33+
2834
# start base
2935
include(base/base.cmake)
3036
# end base

src/dconfig.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <QLoggingCategory>
1919
#include <QCoreApplication>
2020
#include <unistd.h>
21+
#include <memory>
2122

2223
// https://gitlabwh.uniontech.com/wuhan/se/deepin-specifications/-/issues/3
2324

@@ -173,13 +174,13 @@ class Q_DECL_HIDDEN FileBackend : public DConfigBackend
173174
if (owner->appId == NoAppId)
174175
return true;
175176

176-
QScopedPointer<DConfigFile> file(new DConfigFile(NoAppId, owner->name, owner->subpath));
177+
std::unique_ptr<DConfigFile> file(new DConfigFile(NoAppId, owner->name, owner->subpath));
177178
const bool canFallbackToGeneric = !file->meta()->metaPath(prefix).isEmpty();
178179
if (canFallbackToGeneric) {
179-
QScopedPointer<DConfigCache> cache(file->createUserCache(getuid()));
180+
std::unique_ptr<DConfigCache> cache(file->createUserCache(getuid()));
180181
if (file->load(prefix) && cache->load(prefix)) {
181-
genericConfigFile.reset(file.take());
182-
genericConfigCache.reset(cache.take());
182+
genericConfigFile.reset(file.release());
183+
genericConfigCache.reset(cache.release());
183184
}
184185
}
185186
return true;
@@ -370,7 +371,7 @@ class Q_DECL_HIDDEN DBusBackend : public DConfigBackend
370371
complexType >> list;
371372
QVariantList res;
372373
res.reserve(list.size());
373-
for (const auto &item : qAsConst(list)) {
374+
for (const auto &item : std::as_const(list)) {
374375
res << decodeQDBusArgument(item);
375376
}
376377
return res;

src/util/drecentmanager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <QUrl>
1414
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
1515
#include <QStringConverter>
16+
#include <QTimeZone>
1617
#endif
1718

1819
DCORE_BEGIN_NAMESPACE
@@ -67,7 +68,11 @@ bool DRecentManager::addItem(const QString &uri, DRecentData &data)
6768
QFile file(RECENT_PATH);
6869
file.open(QIODevice::ReadWrite | QIODevice::Text);
6970

71+
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
72+
QString dateTime = QDateTime::currentDateTime().toTimeZone(QTimeZone::UTC).toString(Qt::ISODate);
73+
#else
7074
QString dateTime = QDateTime::currentDateTime().toTimeSpec(Qt::OffsetFromUTC).toString(Qt::ISODate);
75+
#endif
7176
QDomDocument doc;
7277

7378
if (!doc.setContent(&file)) {

0 commit comments

Comments
 (0)