diff options
| author | Frank Reininghaus <[email protected]> | 2013-02-19 15:45:44 +0100 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-02-19 15:45:44 +0100 |
| commit | cc1455c0e6076c4abd5e321343be456184c51f5e (patch) | |
| tree | d9421bcd8ae237cd1eb97f30d1e645d10de9eb90 /src/panels/places/placespanel.cpp | |
| parent | e6ef1eec3a5c0b9fdabff144990d06250fc1839e (diff) | |
| parent | 518b53feb43325d5c194fa15118e80ab0729b620 (diff) | |
Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
dolphin/src/tests/kfileitemmodeltest.cpp
lib/konq/konq_operations.cpp
Diffstat (limited to 'src/panels/places/placespanel.cpp')
| -rw-r--r-- | src/panels/places/placespanel.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index e23732c97..0f5b83ad5 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -262,23 +262,34 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) emptyTrash(); } else if (action == addAction) { addEntry(); - } else if (action == editAction) { - editEntry(index); - } else if (action == removeAction) { - m_model->removeItem(index); - } else if (action == hideAction) { - item->setHidden(hideAction->isChecked()); - } else if (action == openInNewTabAction) { - const KUrl url = m_model->item(index)->dataValue("url").value<KUrl>(); - emit placeMiddleClicked(url); } else if (action == showAllAction) { m_model->setHiddenItemsShown(showAllAction->isChecked()); - } else if (action == teardownAction) { - m_model->requestTeardown(index); - } else if (action == ejectAction) { - m_model->requestEject(index); } else if (iconSizeActionMap.contains(action)) { m_view->setIconSize(iconSizeActionMap.value(action)); + } else { + // The index might have changed if devices were added/removed while + // the context menu was open. + index = m_model->index(item); + if (index < 0) { + // The item is not in the model any more, probably because it was an + // external device that has been removed while the context menu was open. + return; + } + + if (action == editAction) { + editEntry(index); + } else if (action == removeAction) { + m_model->removeItem(index); + } else if (action == hideAction) { + item->setHidden(hideAction->isChecked()); + } else if (action == openInNewTabAction) { + const KUrl url = m_model->item(index)->dataValue("url").value<KUrl>(); + emit placeMiddleClicked(url); + } else if (action == teardownAction) { + m_model->requestTeardown(index); + } else if (action == ejectAction) { + m_model->requestEject(index); + } } } |
