]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placespanel.cpp
Show an error when dragging above a folder without write access
[dolphin.git] / src / panels / places / placespanel.cpp
1 /***************************************************************************
2 * Copyright (C) 2008 by Peter Penz <peter.penz19@gmail.com> *
3 * Copyright (C) 2010 by Christian Muehlhaeuser <muesli@gmail.com> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #include "placespanel.h"
22
23 #include <KFileItem>
24 #include <konq_operations.h>
25 #include <views/draganddrophelper.h>
26
27 PlacesPanel::PlacesPanel(QWidget* parent) :
28 KFilePlacesView(parent),
29 m_mouseButtons(Qt::NoButton)
30 {
31 setDropOnPlaceEnabled(true);
32 connect(this, SIGNAL(urlsDropped(KUrl,QDropEvent*,QWidget*)),
33 this, SLOT(slotUrlsDropped(KUrl,QDropEvent*,QWidget*)));
34 connect(this, SIGNAL(urlChanged(KUrl)),
35 this, SLOT(emitExtendedUrlChangedSignal(KUrl)));
36 }
37
38 PlacesPanel::~PlacesPanel()
39 {
40 }
41
42 void PlacesPanel::mousePressEvent(QMouseEvent* event)
43 {
44 m_mouseButtons = event->buttons();
45 KFilePlacesView::mousePressEvent(event);
46 }
47
48 void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent)
49 {
50 Q_UNUSED(parent);
51 const KFileItem destItem(KFileItem::Unknown, KFileItem::Unknown, dest);
52 DragAndDropHelper::dropUrls(destItem, event);
53 }
54
55 void PlacesPanel::emitExtendedUrlChangedSignal(const KUrl& url)
56 {
57 emit urlChanged(url, m_mouseButtons);
58 }
59
60 #include "placespanel.moc"