1 /***************************************************************************
2 * Copyright (C) 2008-2012 by Peter Penz <peter.penz19@gmail.com> *
3 * Copyright (C) 2010 by Christian Muehlhaeuser <muesli@gmail.com> *
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. *
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. *
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 ***************************************************************************/
24 #include "panels/panel.h"
29 class KItemListController
;
31 class PlacesItemModel
;
33 class QGraphicsSceneDragDropEvent
;
37 * @brief Combines bookmarks and mounted devices as list.
39 class PlacesPanel
: public Panel
44 explicit PlacesPanel(QWidget
* parent
);
45 ~PlacesPanel() override
;
46 void proceedWithTearDown();
49 void placeActivated(const QUrl
& url
);
50 void placeMiddleClicked(const QUrl
& url
);
51 void errorMessage(const QString
& error
);
52 void storageTearDownRequested(const QString
& mountPath
);
53 void storageTearDownExternallyRequested(const QString
& mountPath
);
56 bool urlChanged() override
;
57 void showEvent(QShowEvent
* event
) override
;
60 void readSettings() override
;
63 void slotItemActivated(int index
);
64 void slotItemMiddleClicked(int index
);
65 void slotItemContextMenuRequested(int index
, const QPointF
& pos
);
66 void slotViewContextMenuRequested(const QPointF
& pos
);
67 void slotItemDropEvent(int index
, QGraphicsSceneDragDropEvent
* event
);
68 void slotItemDropEventStorageSetupDone(int index
, bool success
);
69 void slotAboveItemDropEvent(int index
, QGraphicsSceneDragDropEvent
* event
);
70 void slotUrlsDropped(const QUrl
& dest
, QDropEvent
* event
, QWidget
* parent
);
71 void slotStorageSetupDone(int index
, bool success
);
75 void editEntry(int index
);
78 * Selects the item that has the closest URL for the URL set
79 * for the panel (see Panel::setUrl()).
81 void selectClosestItem();
83 void triggerItem(int index
, Qt::MouseButton button
);
85 QAction
* buildGroupContextMenu(QMenu
* menu
, int index
);
88 KItemListController
* m_controller
;
89 PlacesItemModel
* m_model
;
92 QUrl m_storageSetupFailedUrl
;
93 Qt::MouseButton m_triggerStorageSetupButton
;
95 int m_itemDropEventIndex
;
96 QMimeData
* m_itemDropEventMimeData
;
97 QDropEvent
* m_itemDropEvent
;
100 #endif // PLACESPANEL_H