2020-09-16 00:35:12 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2009-2010 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2014-2017 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2010-01-28 16:27:28 +00:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#if !defined(LISTDEVICES_H)
|
2010-01-28 16:27:28 +00:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#define LISTDEVICES_H
|
2010-01-28 16:27:28 +00:00
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <core/operationstack.h>
|
2010-02-12 11:29:12 +00:00
|
|
|
|
2010-01-28 16:27:28 +00:00
|
|
|
#include "ui_listdevicesbase.h"
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
class QPoint;
|
|
|
|
class KActionCollection;
|
|
|
|
|
2010-05-18 23:27:30 +01:00
|
|
|
/** A list of devices.
|
2015-07-13 15:17:41 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2010-01-28 16:27:28 +00:00
|
|
|
*/
|
2016-01-06 13:56:32 +00:00
|
|
|
class ListDevices : public QWidget, public Ui::ListDevicesBase
|
2010-01-28 16:27:28 +00:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
Q_OBJECT
|
|
|
|
Q_DISABLE_COPY(ListDevices)
|
|
|
|
|
|
|
|
public:
|
2019-12-09 16:33:04 +00:00
|
|
|
explicit ListDevices(QWidget* parent = nullptr);
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void selectionChanged(const QString& device_node);
|
|
|
|
void deviceDoubleClicked(const QString& device_node);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setActionCollection(KActionCollection* coll) {
|
|
|
|
m_ActionCollection = coll;
|
|
|
|
}
|
2021-11-30 13:18:31 +00:00
|
|
|
|
|
|
|
// Selects the device specified by the device node, such as /dev/sda
|
2015-07-13 15:17:41 +01:00
|
|
|
bool setSelectedDevice(const QString& device_node);
|
|
|
|
|
2016-08-08 19:39:20 +01:00
|
|
|
void updateDevices(const OperationStack::Devices& devices);
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
QListWidget& listDevices() {
|
|
|
|
Q_ASSERT(m_ListDevices);
|
|
|
|
return *m_ListDevices;
|
|
|
|
}
|
2016-07-02 12:12:56 +01:00
|
|
|
protected:
|
2015-07-13 15:17:41 +01:00
|
|
|
const QListWidget& listDevices() const {
|
|
|
|
Q_ASSERT(m_ListDevices);
|
|
|
|
return *m_ListDevices;
|
|
|
|
}
|
|
|
|
KActionCollection* actionCollection() {
|
|
|
|
return m_ActionCollection;
|
|
|
|
}
|
|
|
|
|
2016-07-02 12:12:56 +01:00
|
|
|
void customContextMenuRequested(const QPoint& pos);
|
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
protected Q_SLOTS:
|
|
|
|
void on_m_ListDevices_itemSelectionChanged();
|
|
|
|
void on_m_ListDevices_itemDoubleClicked(QListWidgetItem* list_item);
|
|
|
|
|
|
|
|
private:
|
|
|
|
KActionCollection* m_ActionCollection;
|
2010-01-28 16:27:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|