┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2014-04-29 21:44:46 +0200
committerFrank Reininghaus <[email protected]>2014-04-29 21:44:46 +0200
commiteddb62ac0c9cf2c37991401ea5332a7f334c05a9 (patch)
treed22b2e9c05d3fe8be3d8ba62d7e46ca5fa7ab380 /src/kitemviews
parentae5bcfcdeece23915e7272af1046a7e71e269474 (diff)
parent5f29eec07572503679ca1dd354236065f33ff4a7 (diff)
Merge branch 'KDE/4.13'
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp2
-rw-r--r--src/kitemviews/kitemlistselectionmanager.cpp11
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp6
-rw-r--r--src/kitemviews/private/kdirectorycontentscounter.cpp15
4 files changed, 26 insertions, 8 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index fd773e1e9..a0f9305cb 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -216,7 +216,7 @@ void KFileItemModel::setShowHiddenFiles(bool show)
m_dirLister->setShowingDotFiles(show);
m_dirLister->emitChanges();
if (show) {
- slotCompleted();
+ dispatchPendingItemsToInsert();
}
}
diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp
index ebff1a30e..1f0a89d06 100644
--- a/src/kitemviews/kitemlistselectionmanager.cpp
+++ b/src/kitemviews/kitemlistselectionmanager.cpp
@@ -331,6 +331,11 @@ void KItemListSelectionManager::itemsMoved(const KItemRange& itemRange, const QL
// Store the current selection (needed in the selectionChanged() signal)
const KItemSet previousSelection = selectedItems();
+ // endAnchoredSelection() adds all items between m_currentItem and
+ // m_anchorItem to m_selectedItems. They can then be moved
+ // individually later in this function.
+ endAnchoredSelection();
+
// Update the current item
if (m_currentItem >= itemRange.index && m_currentItem < itemRange.index + itemRange.count) {
const int previousCurrentItem = m_currentItem;
@@ -342,10 +347,8 @@ void KItemListSelectionManager::itemsMoved(const KItemRange& itemRange, const QL
emit currentChanged(newCurrentItem, previousCurrentItem);
}
- // Update the anchor item
- if (m_anchorItem >= itemRange.index && m_anchorItem < itemRange.index + itemRange.count) {
- m_anchorItem = movedToIndexes.at(m_anchorItem - itemRange.index);
- }
+ // Start a new anchored selection.
+ beginAnchoredSelection(m_currentItem);
// Update the selections
if (!m_selectedItems.isEmpty()) {
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index d8b5ad908..037226997 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -658,6 +658,12 @@ void KStandardItemListWidget::dataChanged(const QHash<QByteArray, QVariant>& cur
dirtyRoles = roles;
}
+ // The URL might have changed (i.e., if the sort order of the items has
+ // been changed). Therefore, the "is cut" state must be updated.
+ KFileItemClipboard* clipboard = KFileItemClipboard::instance();
+ const KUrl itemUrl = data().value("url").value<KUrl>();
+ m_isCut = clipboard->isCut(itemUrl);
+
// The icon-state might depend from other roles and hence is
// marked as dirty whenever a role has been changed
dirtyRoles.insert("iconPixmap");
diff --git a/src/kitemviews/private/kdirectorycontentscounter.cpp b/src/kitemviews/private/kdirectorycontentscounter.cpp
index 65afb7c3e..7d1e76999 100644
--- a/src/kitemviews/private/kdirectorycontentscounter.cpp
+++ b/src/kitemviews/private/kdirectorycontentscounter.cpp
@@ -60,14 +60,23 @@ KDirectoryContentsCounter::~KDirectoryContentsCounter()
{
--m_workersCount;
- if (m_workersCount == 0) {
+ if (m_workersCount > 0) {
+ // The worker thread will continue running. It could even be running
+ // a method of m_worker at the moment, so we delete it using
+ // deleteLater() to prevent a crash.
+ m_worker->deleteLater();
+ } else {
+ // There are no remaining workers -> stop the worker thread.
m_workerThread->quit();
m_workerThread->wait();
delete m_workerThread;
m_workerThread = 0;
- }
- delete m_worker;
+ // The worker thread has finished running now, so it's safe to delete
+ // m_worker. deleteLater() would not work at all because the event loop
+ // which would deliver the event to m_worker is not running any more.
+ delete m_worker;
+ }
}
void KDirectoryContentsCounter::addDirectory(const QString& path)