┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/panels/places/placespanel.cpp20
-rw-r--r--src/panels/places/placespanel.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index e1e63ba9b..0da932154 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Penz <[email protected]> *
+ * Copyright (C) 2010 by Christian Muehlhaeuser <[email protected]> *
* *
* 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 "dolphin_generalsettings.h"
#include "draganddrophelper.h"
#include <kfileitem.h>
#include <konq_operations.h>
+#include "settings/dolphinsettings.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);
diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h
index 1b6681af8..f39bdec47 100644
--- a/src/panels/places/placespanel.h
+++ b/src/panels/places/placespanel.h
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2008 by Peter Penz <[email protected]> *
+ * Copyright (C) 2010 by Christian Muehlhaeuser <[email protected]> *
* *
* 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 *
@@ -38,6 +39,7 @@ signals:
protected:
virtual void mousePressEvent(QMouseEvent* event);
+ virtual void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
private slots:
void slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent);