#include "dolphinitemlistview.h"
#include "dolphinnewfilemenuobserver.h"
#include "draganddrophelper.h"
+#ifndef QT_NO_ACCESSIBILITY
+#include "kitemviews/accessibility/kitemlistviewaccessible.h"
+#endif
#include "kitemviews/kfileitemlistview.h"
#include "kitemviews/kfileitemmodel.h"
#include "kitemviews/kitemlistcontainer.h"
#include <kwidgetsaddons_version.h>
#include <QAbstractItemView>
+#ifndef QT_NO_ACCESSIBILITY
+#include <QAccessible>
+#endif
#include <QActionGroup>
#include <QApplication>
#include <QClipboard>
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());
});
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.
return url;
}
-void DolphinView::slotRenameDialogRenamingFinished(const QList<QUrl> &urls)
-{
- forceUrlsSelection(urls.first(), urls);
-}
-
void DolphinView::forceUrlsSelection(const QUrl ¤t, const QList<QUrl> &selected)
{
clearSelection();
{
m_placeholderLabel->setText(i18n("Loading…"));
m_placeholderLabel->setVisible(true);
+#ifndef QT_NO_ACCESSIBILITY
+ if (QAccessible::isActive()) {
+ auto accessibleViewInterface = static_cast<KItemListViewAccessible *>(QAccessible::queryAccessibleInterface(m_view));
+ accessibleViewInterface->announceOverallViewState(m_placeholderLabel->text());
+ }
+#endif
}
void DolphinView::updatePlaceholderLabel()
}
m_placeholderLabel->setVisible(true);
+#ifndef QT_NO_ACCESSIBILITY
+ if (QAccessible::isActive()) {
+ auto accessibleViewInterface = static_cast<KItemListViewAccessible *>(QAccessible::queryAccessibleInterface(m_view));
+ accessibleViewInterface->announceOverallViewState(m_placeholderLabel->text());
+ }
+#endif
}
bool DolphinView::tryShowNameToolTip(QHelpEvent *event)