connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged);
- connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved);
+ // #473377: Use a QueuedConnection to avoid modifying KCoreDirLister before KCoreDirListerCache::deleteDir() returns.
+ connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved, Qt::QueuedConnection);
connect(this, &DolphinView::itemCountChanged, this, &DolphinView::updatePlaceholderLabel);
if (items.count() == 1 && GeneralSettings::renameInline()) {
const int index = m_model->index(items.first());
- QMetaObject::Connection *const connection = new QMetaObject::Connection;
- *connection = connect(m_view, &KItemListView::scrollingStopped, this, [=]() {
- QObject::disconnect(*connection);
- delete connection;
-
- m_view->editRole(index, "text");
+ connect(
+ m_view,
+ &KItemListView::scrollingStopped,
+ this,
+ [this, index]() {
+ m_view->editRole(index, "text");
- hideToolTip();
+ hideToolTip();
- connect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
- });
+ connect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
+ },
+ Qt::SingleShotConnection);
m_view->scrollToItem(index);
} else {
const QMimeDatabase db;
+ m_clearSelectionBeforeSelectingNewItems = true;
+ m_markFirstNewlySelectedItemAsCurrent = true;
+ m_selectJobCreatedItems = true;
+
// Duplicate all selected items and append "copy" to the end of the file name
// but before the filename extension, if present
- QList<QUrl> newSelection;
for (const auto &item : itemList) {
const QUrl originalURL = item.url();
const QString originalDirectoryPath = originalURL.adjusted(QUrl::RemoveFilename).path();
}
KIO::CopyJob *job = KIO::copyAs(originalURL, duplicateURL);
+ job->setAutoRename(true);
KJobWidgets::setWindow(job, this);
- if (job) {
- newSelection << duplicateURL;
- KIO::FileUndoManager::self()->recordCopyJob(job);
- }
+ connect(job, &KIO::CopyJob::result, this, &DolphinView::slotJobResult);
+ connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotItemCreatedFromJob);
+ connect(job, &KIO::CopyJob::copyingLinkDone, this, &DolphinView::slotItemLinkCreatedFromJob);
+ KIO::FileUndoManager::self()->recordCopyJob(job);
}
-
- forceUrlsSelection(newSelection.first(), newSelection);
}
void DolphinView::stopLoading()
const KFileItem &item = m_model->fileItem(index);
const QUrl &url = openItemAsFolderUrl(item);
const auto modifiers = QGuiApplication::keyboardModifiers();
- const QString &archiveProtocol = KProtocolManager::protocolForArchiveMimetype(item.mimetype());
if (!url.isEmpty()) {
// keep in sync with KUrlNavigator::slotNavigatorButtonClicked
if (modifiers & Qt::ShiftModifier) {
} else {
Q_EMIT tabRequested(url);
}
- } else if (!archiveProtocol.isEmpty() && isTabsForFilesEnabled()) {
+ } else if (isTabsForFilesEnabled()) {
// keep in sync with KUrlNavigator::slotNavigatorButtonClicked
if (modifiers & Qt::ShiftModifier) {
Q_EMIT activeTabRequested(item.url());
slotItemCreated(to);
}
+void DolphinView::slotItemLinkCreatedFromJob(KIO::Job *, const QUrl &, const QString &, const QUrl &to)
+{
+ slotItemCreated(to);
+}
+
void DolphinView::slotItemCreated(const QUrl &url)
{
if (m_markFirstNewlySelectedItemAsCurrent) {