, m_view(nullptr)
, m_container(nullptr)
, m_toolTipManager(nullptr)
+ , m_selectNextItem(false)
, m_selectionChangedTimer(nullptr)
, m_currentItemUrl()
, m_scrollToCurrentItem(false)
using Iface = KIO::AskUserActionInterface;
auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Trash, Iface::DefaultConfirmation, this);
connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished);
+ m_selectNextItem = true;
trashJob->start();
#else
KIO::JobUiDelegate uiDelegate;
using Iface = KIO::AskUserActionInterface;
auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Delete, Iface::DefaultConfirmation, this);
connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished);
+ m_selectNextItem = true;
trashJob->start();
#else
KIO::JobUiDelegate uiDelegate;
void DolphinView::slotSelectionChanged(const KItemSet ¤t, const KItemSet &previous)
{
+ m_selectNextItem = false;
const int currentCount = current.count();
const int previousCount = previous.count();
const bool selectionStateChanged = (currentCount == 0 && previousCount > 0) || (currentCount > 0 && previousCount == 0);
void DolphinView::slotTrashFileFinished(KJob *job)
{
if (job->error() == 0) {
+ 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());
void DolphinView::slotDeleteFileFinished(KJob *job)
{
if (job->error() == 0) {
+ 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());
}
}
+void DolphinView::selectNextItem()
+{
+ if (m_active && m_selectNextItem) {
+ KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ if (selectedItems().isEmpty()) {
+ Q_ASSERT_X(false, "DolphinView", "Selecting the next item failed.");
+ return;
+ }
+ const auto lastSelectedIndex = m_model->index(selectedItems().last());
+ if (lastSelectedIndex < 0) {
+ Q_ASSERT_X(false, "DolphinView", "Selecting the next item failed.");
+ return;
+ }
+ auto nextItem = lastSelectedIndex + 1;
+ if (nextItem >= itemsCount()) {
+ nextItem = lastSelectedIndex - selectedItemsCount();
+ }
+ if (nextItem >= 0) {
+ selectionManager->setSelected(nextItem, 1);
+ }
+ m_selectNextItem = false;
+ }
+}
+
void DolphinView::slotRenamingResult(KJob *job)
{
if (job->error()) {
auto trashAction = KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection);
auto trashShortcuts = trashAction->shortcuts();
+ trashAction->setAutoRepeat(false);
if (!trashShortcuts.contains(QKeySequence::Delete)) {
trashShortcuts.append(QKeySequence::Delete);
m_actionCollection->setDefaultShortcuts(trashAction, trashShortcuts);
auto deleteAction = KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection);
auto deleteShortcuts = deleteAction->shortcuts();
+ deleteAction->setAutoRepeat(false);
if (!deleteShortcuts.contains(Qt::SHIFT | Qt::Key_Delete)) {
deleteShortcuts.append(Qt::SHIFT | Qt::Key_Delete);
m_actionCollection->setDefaultShortcuts(deleteAction, deleteShortcuts);