Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop/23h2 sp1 rebase master #1376

Merged
merged 27 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fb048c6
feat: Thumbnail creation optimization
Kakueeen Aug 11, 2023
9d335a2
fix: [disk] encrypted disk cannot be removed
itsXuSt Aug 14, 2023
7c608ae
fix: dtk upgraded, ci compilation not working.
liyigang1 Aug 14, 2023
4f86cfb
fix: [workspace]dde-file-manager list mode enters a directory and the…
liyigang1 Aug 14, 2023
73262b0
fix: [fileinfo]After renaming the shortcut application icon name, the…
liyigang1 Aug 14, 2023
b8efa74
fix: update the deamon logs to adhere the log safe rules check
max-lvs Aug 14, 2023
87f685f
fix: [thumbnail] File thumbnails are not displayed in mounted directo…
Kakueeen Aug 14, 2023
9dcbe61
fix: The completer view does not disappear after enter the directory
Kakueeen Aug 15, 2023
951a7ed
fix: [io]Open wps file error inside smb when wps is not installed.
liyigang1 Aug 14, 2023
364e4df
fix: [io]Cell phone MTP internal file copy failed
liyigang1 Aug 14, 2023
035eb25
chore: [smb] enable smb mount in root mode.
itsXuSt Aug 15, 2023
70f94c5
fix: [property-dialog] adjust property dialog UI
GongHeng2017 Aug 15, 2023
d160aae
fix: [search] No results after multiple quick search
Kakueeen Aug 17, 2023
3a0f90d
fix: [Recent] recentfile without monitor
pppanghu77 Aug 16, 2023
f0845fb
fix: [menu] fix issue of search menu
Kakueeen Aug 16, 2023
e1bb242
fix: The wallpaper size does not match the window
Clauszy Aug 16, 2023
9ad6d05
feat: [cifs] version probe and host parse.
itsXuSt Aug 15, 2023
127805c
fix: [dock] encrypted disks missing.
itsXuSt Aug 18, 2023
f4b765b
fix: [property] value not fallback when chmod failed.
itsXuSt Aug 18, 2023
ef80784
fix: [io]Slow display of folder information when multitasking copying…
liyigang1 Aug 17, 2023
46bd03e
fix: [property-dialog] the device name show error.
GongHeng2017 Aug 16, 2023
0b6ad9e
chore: update the baseline version to 6.0.28
max-lvs Aug 18, 2023
e45c342
fix: [property] add translate of property
GongHeng2017 Aug 18, 2023
4a3aed6
fix: [vault] cursor not show wait state.
GongHeng2017 Aug 18, 2023
36e7bca
fix: [fileoperation]open symlink dir issue
Lighto-Ku Aug 18, 2023
e42672e
feat: [audit] add erase log
Johnson-zs Aug 21, 2023
3ab43f6
fix: [property] adjust UI
GongHeng2017 Aug 21, 2023
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
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
dde-file-manager (6.0.28) unstable; urgency=medium

* update file manager baseline version to V6.0.28

-- lvwujun <[email protected]> Fri, 18 Aug 2023 14:29:09 +0800

dde-file-manager (6.0.27) unstable; urgency=medium

* update file manager baseline version to V6.0.27 that fixed some bugs
Expand Down
20 changes: 4 additions & 16 deletions src/apps/dde-file-manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ static bool isLoadVaultPlugin()
DSysInfo::UosEdition uosEdition = DSysInfo::uosEditionType();
if (DSysInfo::UosServer == uosType) {
if (DSysInfo::UosEnterprise == uosEdition
|| DSysInfo::UosEnterpriseC == uosEdition
|| DSysInfo::UosEuler == uosEdition) {
|| DSysInfo::UosEnterpriseC == uosEdition
|| DSysInfo::UosEuler == uosEdition) {
return true;
}
} else if (DSysInfo::UosDesktop == uosType) {
if (DSysInfo::UosProfessional == uosEdition
|| static_cast<int>(DSysInfo::UosEnterprise) == static_cast<int>(uosEdition + 1)
|| DSysInfo::UosEducation == uosEdition) {
|| static_cast<int>(DSysInfo::UosEnterprise) == static_cast<int>(uosEdition + 1)
|| DSysInfo::UosEducation == uosEdition) {
return true;
}
}
Expand Down Expand Up @@ -129,18 +129,6 @@ static bool pluginsLoad()
if (!isLoadVaultPlugin())
blackNames << "dfmplugin-vault";

#ifndef ENABLE_SMB_IN_ADMIN
/*
* NOTE(xust): the secret manager cannot be launched in WAYLAND ADMIN mode,
* which cause file-manager freeze when mount samba (dfm-mount using secret-manager
* to save/get the password of samba by sync).
* and the Admin mode is designed for operate files those normal user cannot write
* and should be the smallest dfm, so remove the smb-browser plugin in Admin mode
* */
if (SysInfoUtils::isOpenAsAdmin())
blackNames << "dfmplugin-smbbrowser";
#endif

// disbale lazy load if enbale headless
bool enableHeadless { DConfigManager::instance()->value(kDefaultCfgPath, "dfm.headless", false).toBool() };
if (enableHeadless && CommandParser::instance().isSet("d"))
Expand Down
2 changes: 1 addition & 1 deletion src/dfm-base/base/device/devicemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void DeviceManager::unmountBlockDevAsync(const QString &id, const QVariantMap &o
}

auto mpt = dev->mountPoint();
if (mpt.isEmpty()) {
if (mpt.isEmpty() && !dev->isEncrypted()) {
if (cb)
cb(true, Utils::genOperateErrorInfo(DeviceError::kNoError));
return;
Expand Down
36 changes: 36 additions & 0 deletions src/dfm-base/base/device/deviceutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,34 @@ bool DeviceUtils::isSftp(const QUrl &url)
return hasMatch(url.path(), smbMatch);
}

bool DeviceUtils::isMtpFile(const QUrl &url)
{
if (!url.isValid())
return false;

const QString &path = url.toLocalFile();
static const QString gvfsMatch { R"(^/run/user/\d+/gvfs/mtp:host|^/root/.gvfs/mtp:host)" };
QRegularExpression re { gvfsMatch };
QRegularExpressionMatch match { re.match(path) };
return match.hasMatch();
}

bool DeviceUtils::supportDfmioCopyDevice(const QUrl &url)
{
if (!url.isValid())
return false;

return !isMtpFile(url);
}

bool DeviceUtils::supportSetPermissionsDevice(const QUrl &url)
{
if (!url.isValid())
return false;

return !isMtpFile(url);
}

bool DeviceUtils::isExternalBlock(const QUrl &url)
{
return DeviceProxyManager::instance()->isFileOfExternalBlockMounts(url.path());
Expand Down Expand Up @@ -585,6 +613,14 @@ qint64 DeviceUtils::deviceBytesFree(const QUrl &url)
return DFMIO::DFMUtils::deviceBytesFree(url);
}

bool DeviceUtils::isUnmountSamba(const QUrl &url)
{
if (!isSamba(url))
return false;

return !DevProxyMng->isFileOfProtocolMounts(url.path());
}

bool DeviceUtils::findDlnfsPath(const QString &target, Compare func)
{
Q_ASSERT(func);
Expand Down
4 changes: 4 additions & 0 deletions src/dfm-base/base/device/deviceutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class DeviceUtils
static bool isSamba(const QUrl &url);
static bool isFtp(const QUrl &url);
static bool isSftp(const QUrl &url);
static bool isMtpFile(const QUrl &url);
static bool supportDfmioCopyDevice(const QUrl &url);
static bool supportSetPermissionsDevice(const QUrl &url);
static bool isExternalBlock(const QUrl &url);
static QUrl parseNetSourceUrl(const QUrl &target);

Expand All @@ -73,6 +76,7 @@ class DeviceUtils

static QString fileSystemType(const QUrl &url);
static qint64 deviceBytesFree(const QUrl &url);
static bool isUnmountSamba(const QUrl &url);

private:
static bool hasMatch(const QString &txt, const QString &rex);
Expand Down
4 changes: 3 additions & 1 deletion src/dfm-base/dialogs/taskdialog/taskwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ void TaskWidget::onShowTaskInfo(const JobInfoPointer JobInfo)
{
if (isShowError)
return;

QString source = JobInfo->value(AbstractJobHandler::NotifyInfoKey::kSourceMsgKey).toString();
QString target = JobInfo->value(AbstractJobHandler::NotifyInfoKey::kTargetMsgKey).toString();
lbSrcPath->setText(source);
Expand Down Expand Up @@ -424,6 +425,7 @@ void TaskWidget::initUI()
lbDstPath = new ElidedLable;
lbRmTime = new QLabel;
lbSrcPath->setFixedWidth(kMsgLabelWidth);
lbSrcPath->setText("In data statistics ...");
lbDstPath->setFixedWidth(kMsgLabelWidth);
lbSpeed->setFixedWidth(kSpeedLabelWidth);
lbRmTime->setFixedWidth(kSpeedLabelWidth);
Expand Down Expand Up @@ -759,7 +761,7 @@ bool TaskWidget::showFileInfo(const FileInfoPointer info, const bool isOrg)
.arg(info->timeOf(TimeInfoType::kLastModified).value<QDateTime>().isValid()
? info->timeOf(TimeInfoType::kLastModified).value<QDateTime>().toString("yyyy/MM/dd HH:mm:ss")
: qApp->translate("MimeTypeDisplayManager", "Unknown"));
auto sizeStr = tr("In data statistics");
auto sizeStr = tr("In data statistics ...");
auto titleStr = isOrg ? tr("Original folder") : tr("Target folder");
if (info->isAttributes(OptInfoType::kIsDir)) {
if (info->countChildFile() < 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/dfm-base/file/local/asyncfileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ QString AsyncFileInfoPrivate::path() const
*/
QString AsyncFileInfoPrivate::filePath() const
{
return this->attribute(DFileInfo::AttributeID::kStandardFilePath).toString();
return q->fileUrl().path();
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion src/dfm-base/file/local/localfilehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ bool LocalFileHandlerPrivate::doOpenFiles(const QList<QUrl> &urls, const QString
} else {
defaultDesktopFile = MimesAppsManager::getDefaultAppDesktopFileByMimeType(mimeType);
if (defaultDesktopFile.isEmpty()) {
if (DeviceUtils::isSamba(fileUrl)) {
if (DeviceUtils::isUnmountSamba(fileUrl)) {
mimeType = QString("inode/directory");
defaultDesktopFile = MimesAppsManager::getDefaultAppDesktopFileByMimeType(mimeType);
isOpenNow = true;
Expand Down
2 changes: 1 addition & 1 deletion src/dfm-base/file/local/syncfileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ QString SyncFileInfoPrivate::path() const
*/
QString SyncFileInfoPrivate::filePath() const
{
return this->attribute(DFileInfo::AttributeID::kStandardFilePath).toString();
return q->fileUrl().path();
}

/*!
Expand Down
22 changes: 21 additions & 1 deletion src/dfm-base/utils/thumbnail/thumbnailfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
using namespace dfmbase;
DFMGLOBAL_USE_NAMESPACE

static constexpr int kMaxCountLimit { 50 };
static constexpr int kPushInterval { 100 }; // ms

ThumbnailFactory::ThumbnailFactory(QObject *parent)
: QObject(parent),
thread(new QThread),
Expand Down Expand Up @@ -42,6 +45,10 @@ void ThumbnailFactory::init()
{
Q_ASSERT(qApp->thread() == QThread::currentThread());

taskPushTimer.setSingleShot(true);
taskPushTimer.setInterval(kPushInterval);
connect(&taskPushTimer, &QTimer::timeout, this, &ThumbnailFactory::pushTask);

connect(qApp, &QGuiApplication::aboutToQuit, this, &ThumbnailFactory::onAboutToQuit);

connect(this, &ThumbnailFactory::addTask, worker.data(), &ThumbnailWorker::onTaskAdded, Qt::QueuedConnection);
Expand All @@ -54,7 +61,14 @@ void ThumbnailFactory::init()

void ThumbnailFactory::joinThumbnailJob(const QUrl &url, ThumbnailSize size)
{
emit addTask(url, size);
if (taskMap.isEmpty())
taskPushTimer.start();

taskMap.insert(url, size);
if (taskMap.size() < kMaxCountLimit)
return;

pushTask();
}

bool ThumbnailFactory::registerThumbnailCreator(const QString &mimeType, ThumbnailCreator creator)
Expand All @@ -69,3 +83,9 @@ void ThumbnailFactory::onAboutToQuit()
thread->quit();
thread->wait(3000);
}

void ThumbnailFactory::pushTask()
{
auto map = std::move(taskMap);
emit addTask(map);
}
9 changes: 7 additions & 2 deletions src/dfm-base/utils/thumbnail/thumbnailfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <dfm-base/dfm_global_defines.h>
#include <dfm-base/interfaces/fileinfo.h>

#include <QTimer>

namespace dfmbase {

class ThumbnailFactory final : public QObject
Expand All @@ -31,19 +33,22 @@ class ThumbnailFactory final : public QObject
void produceFinished(const QUrl &src, const QString &thumb);
void produceFailed(const QUrl &src);

void addTask(const QUrl &url, DFMGLOBAL_NAMESPACE::ThumbnailSize size);
void addTask(const ThumbnailWorker::ThumbnailTaskMap &taskMap);

public Q_SLOTS:
private Q_SLOTS:
void onAboutToQuit();
void pushTask();

protected:
explicit ThumbnailFactory(QObject *parent = nullptr);
~ThumbnailFactory() override;
void init();

private:
ThumbnailWorker::ThumbnailTaskMap taskMap;
QSharedPointer<QThread> thread { nullptr };
QSharedPointer<ThumbnailWorker> worker { nullptr };
QTimer taskPushTimer;
};
} // namespace dfmbase

Expand Down
4 changes: 2 additions & 2 deletions src/dfm-base/utils/thumbnail/thumbnailhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ bool ThumbnailHelper::checkThumbEnable(const QUrl &url)
if (!enable) {
if (FileUtils::isMtpFile(url)) {
enable = DConfigManager::instance()->value("org.deepin.dde.file-manager.preview", "mtpThumbnailEnable", true).toBool();
} else if (FileUtils::isGvfsFile(url)) {
enable = Application::instance()->genericAttribute(Application::kShowThunmbnailInRemote).toBool();
} else if (DevProxyMng->isFileOfExternalBlockMounts(url.path())) {
enable = true;
} else {
enable = Application::instance()->genericAttribute(Application::kShowThunmbnailInRemote).toBool();
}
}

Expand Down
45 changes: 25 additions & 20 deletions src/dfm-base/utils/thumbnail/thumbnailworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ ThumbnailWorker::ThumbnailWorker(QObject *parent)
: QObject(parent),
d(new ThumbnailWorkerPrivate(this))
{
qRegisterMetaType<ThumbnailTaskMap>("ThumbnailTaskMap");
}

ThumbnailWorker::~ThumbnailWorker()
Expand All @@ -112,42 +113,46 @@ void ThumbnailWorker::stop()
d->isStoped = true;
}

void ThumbnailWorker::onTaskAdded(const QUrl &url, Global::ThumbnailSize size)
void ThumbnailWorker::onTaskAdded(const ThumbnailTaskMap &taskMap)
{
if (d->isStoped)
return;

QUrl fileUrl = d->originalUrl = url;
if (UrlRoute::isVirtual(url)) {
auto info { InfoFactory::create<FileInfo>(url) };
if (!info || !info->exists())
return;
QMapIterator<QUrl, Global::ThumbnailSize> iter(taskMap);
while (iter.hasNext()) {
iter.next();
QUrl fileUrl = d->originalUrl = iter.key();
if (UrlRoute::isVirtual(fileUrl)) {
auto info { InfoFactory::create<FileInfo>(fileUrl) };
if (!info || !info->exists())
continue;

fileUrl = QUrl::fromLocalFile(info->pathOf(PathInfoType::kAbsoluteFilePath));
if (!fileUrl.isLocalFile())
continue;
}

fileUrl = QUrl::fromLocalFile(info->pathOf(PathInfoType::kAbsoluteFilePath));
if (!fileUrl.isLocalFile())
return;
}
if (!d->thumbHelper.checkThumbEnable(fileUrl))
continue;

if (!d->thumbHelper.checkThumbEnable(fileUrl))
return;
const auto &img = d->thumbHelper.thumbnailImage(fileUrl, iter.value());
if (!img.isNull()) {
Q_EMIT thumbnailCreateFinished(iter.key(), img.text(QT_STRINGIFY(Thumb::Path)));
continue;
}

const auto &img = d->thumbHelper.thumbnailImage(fileUrl, size);
if (!img.isNull()) {
Q_EMIT thumbnailCreateFinished(url, img.text(QT_STRINGIFY(Thumb::Path)));
return;
createThumbnail(fileUrl, iter.value());
}

createThumbnail(fileUrl, size);
}

void ThumbnailWorker::createThumbnail(const QUrl &url, Global::ThumbnailSize size)
{
// check whether the file is stable
// if not, rejoin the event queue and create thumbnail later
if (!d->checkFileStable(url)) {
ThumbnailTaskMap taskMap { { url, size } };
QMetaObject::invokeMethod(this, "onTaskAdded", Qt::QueuedConnection,
Q_ARG(QUrl, d->originalUrl),
Q_ARG(dfmbase::Global::ThumbnailSize, size));
Q_ARG(ThumbnailTaskMap, taskMap));
return;
}

Expand Down
6 changes: 5 additions & 1 deletion src/dfm-base/utils/thumbnail/thumbnailworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <dfm-base/dfm_base_global.h>
#include <dfm-base/dfm_global_defines.h>

#include <QUrl>

#include <functional>

namespace dfmbase {
Expand All @@ -17,6 +19,8 @@ class ThumbnailWorker : public QObject
{
Q_OBJECT
public:
using ThumbnailTaskMap = QMap<QUrl, DFMGLOBAL_NAMESPACE::ThumbnailSize>;

explicit ThumbnailWorker(QObject *parent = nullptr);
~ThumbnailWorker();

Expand All @@ -25,7 +29,7 @@ class ThumbnailWorker : public QObject
void stop();

public Q_SLOTS:
void onTaskAdded(const QUrl &url, DFMGLOBAL_NAMESPACE::ThumbnailSize size);
void onTaskAdded(const ThumbnailTaskMap &taskMap);

Q_SIGNALS:
void thumbnailCreateFinished(const QUrl &url, const QString &thumbnail);
Expand Down
5 changes: 5 additions & 0 deletions src/dfm-base/widgets/dfmkeyvaluelabel/keyvaluelabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ QString KeyValueLabel::RightValue()
return rightValueLabel->text();
}

void KeyValueLabel::setLeftVauleLabelFixedWidth(int width)
{
leftValueLabel->setFixedWidth(width);
}

void KeyValueLabel::paintEvent(QPaintEvent *evt)
{
Qt::TextElideMode fontWeight = propertyMap.value(kLeftElideMode).value<Qt::TextElideMode>();
Expand Down
1 change: 1 addition & 0 deletions src/dfm-base/widgets/dfmkeyvaluelabel/keyvaluelabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private Q_SLOTS:
QString LeftValue();

QString RightValue();
void setLeftVauleLabelFixedWidth(int width);

Q_SIGNALS:
void valueAreaClicked();
Expand Down
Loading
Loading