Skip to content

Commit

Permalink
fix: Local directory attribute box statistics file size and quantity …
Browse files Browse the repository at this point in the history
…errors

Local directory attribute box statistics file size and quantity errors

Log: Local directory attribute box statistics file size and quantity errors
  • Loading branch information
liyigang1 authored and Johnson-zs committed Sep 3, 2024
1 parent e23e891 commit 3de5926
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/dfm-base/file/local/syncfileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,10 +659,9 @@ FileInfo::FileType SyncFileInfoPrivate::updateFileType()
const QString &absoluteFilePath = filePath();
const QByteArray &nativeFilePath = QFile::encodeName(absoluteFilePath);
QT_STATBUF statBuffer;
auto fileMode = attribute(DFileInfo::AttributeID::kStandardType).toUInt();
if (fileMode <= 0 || QT_STAT(nativeFilePath.constData(), &statBuffer) != 0)
if (QT_STAT(nativeFilePath.constData(), &statBuffer) != 0)
return fileType;
fileMode = fileMode <= 0 ? statBuffer.st_mode : fileMode;
auto fileMode = statBuffer.st_mode;
if (S_ISDIR(fileMode))
fileType = FileInfo::FileType::kDirectory;
else if (S_ISCHR(fileMode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ void BasicWidget::basicFill(const QUrl &url)
fileType->setRightValue(info->displayOf(DisPlayInfoType::kMimeTypeDisplayName), Qt::ElideMiddle, Qt::AlignVCenter, true);
if (type == FileInfo::FileType::kDirectory && fileCount && fileCount->RightValue().isEmpty()) {
fileCount->setRightValue(tr("%1 item").arg(0), Qt::ElideNone, Qt::AlignVCenter, true);
connect(fileCalculationUtils, &FileStatisticsJob::dataNotify, this, &BasicWidget::slotFileCountAndSizeChange);
if (info->canAttributes(CanableInfoType::kCanRedirectionFileUrl)) {
fileCalculationUtils->start(QList<QUrl>() << info->urlOf(UrlInfoType::kRedirectedFileUrl));
} else {
fileCalculationUtils->start(QList<QUrl>() << url);
}
connect(fileCalculationUtils, &FileStatisticsJob::dataNotify, this, &BasicWidget::slotFileCountAndSizeChange);
} else {
layoutMain->removeWidget(fileCount);
fieldMap.remove(BasicFieldExpandEnum::kFileCount);
Expand Down

0 comments on commit 3de5926

Please sign in to comment.