X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f37ecd6ecfab9bc1d2929504b4f6e4363f8137b9..39f89141b06c:/src/panels/places/placespanel.cpp diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index e1e63ba9b..1ca9bf59a 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -1,5 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by Peter Penz * + * Copyright (C) 2010 by Christian Muehlhaeuser * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,9 +19,12 @@ ***************************************************************************/ #include "placespanel.h" -#include "draganddrophelper.h" + +#include "dolphin_generalsettings.h" #include #include +#include "settings/dolphinsettings.h" +#include "views/draganddrophelper.h" PlacesPanel::PlacesPanel(QWidget* parent) : KFilePlacesView(parent), @@ -43,6 +47,22 @@ void PlacesPanel::mousePressEvent(QMouseEvent* event) KFilePlacesView::mousePressEvent(event); } +void PlacesPanel::rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) +{ + Q_UNUSED(parent); + + const QModelIndexList indexes = selectedIndexes(); + if (!indexes.isEmpty()) { + const int selectedRow = indexes.first().row(); + if ((start >= selectedRow) && (end <= selectedRow)) { + // The currently selected item is about to be removed, reset view to home URL + const KUrl homeUrl = DolphinSettings::instance().generalSettings()->homeUrl(); + setUrl(homeUrl); + emit urlChanged(homeUrl, Qt::NoButton); + } + } +} + void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent) { DragAndDropHelper::instance().dropUrls(KFileItem(), dest, event, parent);