X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/e280e7f68c021bfbd7be0689721f7aa1f955aa92..e9bd295b:/src/panels/places/placespanel.h diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 52fa153bc..97be1f735 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -1,88 +1,80 @@ -/*************************************************************************** - * Copyright (C) 2008-2012 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 * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * 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 + */ #ifndef PLACESPANEL_H #define PLACESPANEL_H -#include -#include +#include "panels/panel.h" + +#include +#include + +#include // Solid::ErrorType -class KItemListController; -class PlacesItemEditDialog; -class PlacesItem; -class PlacesItemModel; -class QGraphicsSceneDragDropEvent; +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: - PlacesPanel(QWidget* parent); - virtual ~PlacesPanel(); + 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); -signals: - void placeActivated(const KUrl& url); - void placeMiddleClicked(const KUrl& url); + void requestTearDown(); + void proceedWithTearDown(); + +public Q_SLOTS: + void readSettings(); + +Q_SIGNALS: void errorMessage(const QString& error); + void storageTearDownRequested(const QString& mountPath); + void storageTearDownExternallyRequested(const QString& mountPath); + void storageTearDownSuccessful(); protected: - virtual bool urlChanged(); - virtual void showEvent(QShowEvent* event); - -public slots: - virtual void readSettings(); - -private 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 slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event); - void slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent); - void slotTrashUpdated(KJob* job); - void slotStorageSetupDone(int index, bool success); + void showEvent(QShowEvent* event) override; -private: - void emptyTrash(); - void addEntry(); - void editEntry(int index); +private Q_SLOTS: + void slotConfigureTrash(); + void slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent); + 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); - /** - * Selects the item that has the closest URL for the URL set - * for the panel (see Panel::setUrl()). - */ - void selectClosestItem(); +private: + void connectDeviceSignals(const QModelIndex &idx); - void triggerItem(int index, Qt::MouseButton button); + QUrl m_url; // only used for initial setUrl + QList m_customContextMenuActions; -private: - KItemListController* m_controller; - PlacesItemModel* m_model; + Solid::StorageAccess *m_deviceToTearDown = nullptr; - KUrl m_storageSetupFailedUrl; - Qt::MouseButton m_triggerStorageSetupButton; + QAction *m_configureTrashAction; + QAction *m_lockPanelsAction; }; #endif // PLACESPANEL_H