D9836: Use BatchRenameJob to rename multiple files in Dolphin

Kai Uwe Broulik noreply at phabricator.kde.org
Fri Jan 12 14:43:21 GMT 2018


broulik added inline comments.

INLINE COMMENTS

> renamedialog.cpp:168
> +    QList<QUrl> srcList;
> +    foreach (const KFileItem& item, m_items) {
> +        srcList << item.url();

`KFileItemList` has a `urlList()` method that does that

> renamedialog.cpp:174
> +    KJobWidgets::setWindow(job, widget);
> +    const QUrl parentUrl = srcList.first().adjusted(QUrl::RemoveFilename);
> +    KIO::FileUndoManager::self()->recordJob(cmdType, srcList, parentUrl, job);

Do we need `QUrl::StripTrailingSlash` here? At least most other places in KIO that use `RemoveFileName` set it

> renamedialog.cpp:179
>  
> -    if (m_renameOneItem) {
> -        Q_ASSERT(m_items.count() == 1);
> -        renameItem(m_items.first(), m_newName);
> -    } else {
> -        renameItems();
> +    if (!job->error()) {
> +        emit renamingFinished(m_renamedItems);

The job is async, so by the time you end up here the job hasn't even started yet, your handling should be in `slotFileRenamed` or rather connect to `result` signal?

REPOSITORY
  R318 Dolphin

REVISION DETAIL
  https://phabricator.kde.org/D9836

To: chinmoyr, #dolphin
Cc: broulik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180112/7db8ce96/attachment.htm>


More information about the kfm-devel mailing list