X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f65b0899c3666561cafac14f67ab0bb8a5bfa00a..e9bd295b:/src/panels/places/placespanel.h diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 39f8da365..97be1f735 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -1,6 +1,7 @@ /* * SPDX-FileCopyrightText: 2008-2012 Peter Penz * SPDX-FileCopyrightText: 2010 Christian Muehlhaeuser + * SPDX-FileCopyrightText: 2021 Kai Uwe Broulik * * SPDX-License-Identifier: GPL-2.0-or-later */ @@ -11,86 +12,69 @@ #include "panels/panel.h" #include -#include - -class KItemListController; -class PlacesItemModel; -class PlacesView; -class QGraphicsSceneDragDropEvent; -class QMenu; -class QMimeData; +#include + +#include // Solid::ErrorType + +class QTimer; +namespace Solid +{ +class StorageAccess; +} + /** * @brief Combines bookmarks and mounted devices as list. */ -class PlacesPanel : public Panel +class PlacesPanel : public KFilePlacesView { Q_OBJECT public: explicit PlacesPanel(QWidget* parent); ~PlacesPanel() override; + + void setUrl(const QUrl &url); // override + + // for compatibility with Panel, actions that are shown + // on the view's context menu + QList customContextMenuActions() const; + void setCustomContextMenuActions(const QList& actions); + + void requestTearDown(); void proceedWithTearDown(); - bool eventFilter(QObject *obj, QEvent *event) override; +public Q_SLOTS: + void readSettings(); Q_SIGNALS: - void placeActivated(const QUrl& url); - void placeMiddleClicked(const QUrl& url); void errorMessage(const QString& error); void storageTearDownRequested(const QString& mountPath); void storageTearDownExternallyRequested(const QString& mountPath); - void showHiddenEntriesChanged(bool shown); void storageTearDownSuccessful(); protected: - bool urlChanged() override; void showEvent(QShowEvent* event) override; -public Q_SLOTS: - void readSettings() override; - void showHiddenEntries(bool shown); - int hiddenListCount(); - private Q_SLOTS: - void slotItemActivated(int index); - void slotItemMiddleClicked(int index); - void slotItemContextMenuRequested(int index, const QPointF& pos); - void slotViewContextMenuRequested(const QPointF& pos); - void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event); - void slotItemDropEventStorageSetupDone(int index, bool success); - void slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event); + void slotConfigureTrash(); void slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent); - void slotStorageSetupDone(int index, bool success); - void slotShowTooltip(); + void slotContextMenuAboutToShow(const QModelIndex &index, QMenu *menu); + void slotTearDownRequested(const QModelIndex &index); + void slotTearDownRequestedExternally(const QString &udi); + void slotTearDownDone(Solid::ErrorType error, const QVariant& errorData); + void slotRowsInserted(const QModelIndex &parent, int first, int last); + void slotRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); private: - void addEntry(); - void editEntry(int index); - - /** - * Selects the item that matches the URL set - * for the panel (see Panel::setUrl()). - */ - void selectItem(); + void connectDeviceSignals(const QModelIndex &idx); - void triggerItem(int index, Qt::MouseButton button); + QUrl m_url; // only used for initial setUrl + QList m_customContextMenuActions; - QAction* buildGroupContextMenu(QMenu* menu, int index); + Solid::StorageAccess *m_deviceToTearDown = nullptr; -private: - KItemListController* m_controller; - PlacesItemModel* m_model; - PlacesView* m_view; - - QUrl m_storageSetupFailedUrl; - Qt::MouseButton m_triggerStorageSetupButton; - - int m_itemDropEventIndex; - QMimeData* m_itemDropEventMimeData; - QDropEvent* m_itemDropEvent; - QTimer m_tooltipTimer; - int m_hoveredIndex; - QPoint m_hoverPos; + QAction *m_configureTrashAction; + QAction *m_lockPanelsAction; }; #endif // PLACESPANEL_H