Bug 422098 - Notification shown after a batch renaming of items reports the total number of items (files and dirs) as "files"
Summary: Notification shown after a batch renaming of items reports the total number o...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.70.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-26 12:44 UTC by Patrick Silva
Modified: 2020-06-22 09:53 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
notification after mass renaming (53.15 KB, image/png)
2020-05-26 12:44 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-05-26 12:44:53 UTC
Created attachment 128801 [details]
notification after mass renaming

STEPS TO REPRODUCE
1. open a Samba share with Dolphin
2. select several folders or several folders + several files (I selected 17 folders with files inside them and 44 jpg files)
3. press F2, type any name and confirm mass renaming by pressing enter/return

OBSERVED RESULT
When mass renaming is completed, a notification from Dolphin says "Job Finished - X of X files"
despite the renamed items include folders. See the attached screenshot please.

EXPECTED RESULT
From the end user point of view, files and folders are different things.
Therefore, when folders are included in the renamed items, the notification should mention this fact.

Suggestion:
When both folders and files are renamed, maybe something like:

"Job Finished
X of X folders
X of X files"

When only folders are renamed, maybe something like: 

"Job Finished
X of X folders"

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.18.90
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0 rc2
Comment 1 Ahmad Samir 2020-06-03 12:11:49 UTC
To be able to get isDir on each item, we'd have to use a StatJob, which depending on whether the ioslave is local or remote would be slow.

A simple alternative/hack is changing the message to "x of y files/folders"...
Comment 2 Ahmad Samir 2020-06-03 12:13:15 UTC
This affects kio_file too, you just need to rename many files to actually see the progress dialogue.
Comment 3 David Faure 2020-06-06 11:54:32 UTC
We sometimes say "items" to mean "files or directories".

Renaming is the exact same thing for both, so "x of y items" sounds correct to me.
Let's not make it slower just for a slightly improved progress message.
Comment 4 Ahmad Samir 2020-06-07 13:29:06 UTC
Git commit 4eebde22a47cf6411ba1c20dd6fcb971b81eaa3e by Ahmad Samir.
Committed on 07/06/2020 at 13:14.
Pushed by dfaure into branch 'master'.

[KJob] Add a new Unit, Items

This is intended to be neutral e.g. it could include both files and
directories in a batch rename job, where the progress info is reported
as a total without specifying the number of files and dirs respectively.

M  +11   -1    src/lib/jobs/kjob.h

https://invent.kde.org/frameworks/kcoreaddons/commit/4eebde22a47cf6411ba1c20dd6fcb971b81eaa3e
Comment 5 Ahmad Samir 2020-06-07 19:23:17 UTC
Git commit 7ef49de74f7feb973df80f2997548e548c1d6a26 by Ahmad Samir.
Committed on 07/06/2020 at 13:26.
Pushed by dfaure into branch 'master'.

Integrate the KJob::Unit::Items

This unit can be used to report the progress info as a total, without
distinguishing between the respective number of e.g. files and dirs
handled by the job.

M  +6    -0    src/kuiserverjobtracker.cpp
M  +29   -12   src/kwidgetjobtracker.cpp
M  +4    -2    src/kwidgetjobtracker_p.h

https://invent.kde.org/frameworks/kjobwidgets/commit/7ef49de74f7feb973df80f2997548e548c1d6a26
Comment 6 Ahmad Samir 2020-06-07 22:59:18 UTC
Git commit a874dc35c049df7877d9d5dee1c7e67dd2061a89 by Ahmad Samir.
Committed on 07/06/2020 at 12:42.
Pushed by dfaure into branch 'master'.

[BatchRenameJob] Use KJob::Items when reporting the progress info

A batch rename job is usually fast (direct renaming), calculating the
number of individual files and dirs would mean stat'ing which would make
things slower for little gain. Instead, per dfaure's suggestion in the bug
report, use "items" as a neutral term to represent files and dirs, this
way the notification message would be "correct" when reporting "Job Finished, x
of y items".

Also note that if the user is using Dolphin, or other KIO based file
managers, that data is already visible in the status bar when the user
selects the files/dirs to be renamed.

M  +2    -2    src/core/batchrenamejob.cpp

https://invent.kde.org/frameworks/kio/commit/a874dc35c049df7877d9d5dee1c7e67dd2061a89
Comment 7 Ahmad Samir 2020-06-22 09:53:42 UTC
Git commit dcaa4cfcb18fcdf3f0334df91a46e8c8db8c4ddf by Ahmad Samir.
Committed on 22/06/2020 at 09:53.
Pushed by ahmadsamir into branch 'master'.

[libnotificationmanager] Integrate KJob::Unit::Items

This unit is neutral, it doesn't distinguish between e.g. file and dirs,
just counting items. Useful in e.g. notifications of batch rename jobs.

M  +6    -1    applets/notifications/package/contents/ui/JobDetails.qml
M  +10   -0    libnotificationmanager/job.cpp
M  +6    -0    libnotificationmanager/job.h
M  +8    -0    libnotificationmanager/job_p.cpp
M  +2    -0    libnotificationmanager/job_p.h

https://invent.kde.org/plasma/plasma-workspace/commit/dcaa4cfcb18fcdf3f0334df91a46e8c8db8c4ddf