connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged);
- // #473377: Use a QueuedConnection to avoid modifying KCoreDirLister before KCoreDirListerCache::deleteDir() returns.
- connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved, Qt::QueuedConnection);
+ connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved);
connect(this, &DolphinView::itemCountChanged, this, &DolphinView::updatePlaceholderLabel);
m_versionControlObserver->setView(this);
m_versionControlObserver->setModel(m_model);
connect(m_versionControlObserver, &VersionControlObserver::infoMessage, this, &DolphinView::infoMessage);
- connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, &DolphinView::errorMessage);
+ connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, [this](const QString &message) {
+ Q_EMIT errorMessage(message, KIO::ERR_UNKNOWN);
+ });
connect(m_versionControlObserver, &VersionControlObserver::operationCompletedMessage, this, &DolphinView::operationCompletedMessage);
m_twoClicksRenamingTimer = new QTimer(this);
ViewProperties props(viewPropertiesUrl());
props.setGroupedSorting(grouped);
- props.save();
- m_container->controller()->model()->setGroupedSorting(grouped);
+ m_model->setGroupedSorting(grouped);
Q_EMIT groupedSortingChanged(grouped);
}
} else {
KIO::RenameFileDialog *dialog = new KIO::RenameFileDialog(items, this);
- connect(dialog, &KIO::RenameFileDialog::renamingFinished, this, &DolphinView::slotRenameDialogRenamingFinished);
+ connect(dialog, &KIO::RenameFileDialog::renamingFinished, this, [this, items](const QList<QUrl> &urls) {
+ // The model may have already been updated, so it's possible that we don't find the old items.
+ for (int i = 0; i < items.count(); ++i) {
+ const int index = m_model->index(items[i]);
+ if (index >= 0) {
+ QHash<QByteArray, QVariant> data;
+ data.insert("text", urls[i].fileName());
+ m_model->setData(index, data);
+ }
+ }
+
+ forceUrlsSelection(urls.first(), urls);
+ updateSelectionState();
+ });
+ connect(dialog, &KIO::RenameFileDialog::error, this, [this](KJob *job) {
+ KMessageBox::error(this, job->errorString());
+ });
dialog->open();
}
void DolphinView::slotItemMiddleClicked(int index)
{
const KFileItem &item = m_model->fileItem(index);
- const QUrl &url = openItemAsFolderUrl(item);
+ const QUrl &url = openItemAsFolderUrl(item, GeneralSettings::browseThroughArchives());
const auto modifiers = QGuiApplication::keyboardModifiers();
if (!url.isEmpty()) {
// keep in sync with KUrlNavigator::slotNavigatorButtonClicked
void DolphinView::slotJobResult(KJob *job)
{
if (job->error() && job->error() != KIO::ERR_USER_CANCELED) {
- Q_EMIT errorMessage(job->errorString());
+ Q_EMIT errorMessage(job->errorString(), job->error());
}
if (!m_selectJobCreatedItems) {
m_selectedUrls.clear();
selectNextItem(); // Fixes BUG: 419914 via selecting next item
Q_EMIT operationCompletedMessage(i18nc("@info:status", "Trash operation completed."));
} else if (job->error() != KIO::ERR_USER_CANCELED) {
- Q_EMIT errorMessage(job->errorString());
+ Q_EMIT errorMessage(job->errorString(), job->error());
}
}
selectNextItem(); // Fixes BUG: 419914 via selecting next item
Q_EMIT operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
} else if (job->error() != KIO::ERR_USER_CANCELED) {
- Q_EMIT errorMessage(job->errorString());
+ Q_EMIT errorMessage(job->errorString(), job->error());
}
}
if (!newNameExistsAlready) {
forceUrlsSelection(newUrl, {newUrl});
+ updateSelectionState();
// Only connect the result signal if there is no item with the new name
// in the model yet, see bug 328262.
if (!url.isValid()) {
const QString location(url.toDisplayString(QUrl::PreferLocalFile));
if (location.isEmpty()) {
- Q_EMIT errorMessage(i18nc("@info:status", "The location is empty."));
+ Q_EMIT errorMessage(i18nc("@info:status", "The location is empty."), KIO::ERR_UNKNOWN);
} else {
- Q_EMIT errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location));
+ Q_EMIT errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location), KIO::ERR_UNKNOWN);
}
return;
}
return url;
}
-void DolphinView::slotRenameDialogRenamingFinished(const QList<QUrl> &urls)
-{
- forceUrlsSelection(urls.first(), urls);
-}
-
void DolphinView::forceUrlsSelection(const QUrl ¤t, const QList<QUrl> &selected)
{
clearSelection();