diff --git a/gio-qt/include/dgiodrive.h b/gio-qt/include/dgiodrive.h index d01ab8d..b95c490 100644 --- a/gio-qt/include/dgiodrive.h +++ b/gio-qt/include/dgiodrive.h @@ -31,7 +31,7 @@ class Drive; } class DGioDrivePrivate; -class DGioDrive : public QObject, public QSharedData{ +class DGioDrive : public QObject, public QSharedData { Q_OBJECT public: explicit DGioDrive(Gio::Drive *gmmDrivePtr, QObject *parent = nullptr); @@ -43,6 +43,8 @@ public: bool canStart() const; bool canStop() const; bool canEject() const; + bool isMediaRemovable() const; + bool isRemovable() const; private: QScopedPointer d_ptr; diff --git a/gio-qt/source/dgiodrive.cpp b/gio-qt/source/dgiodrive.cpp index 8004c55..b1f53cf 100644 --- a/gio-qt/source/dgiodrive.cpp +++ b/gio-qt/source/dgiodrive.cpp @@ -108,3 +108,33 @@ bool DGioDrive::canEject() const return d->getGmmDriveInstence()->can_eject(); } + +/*! + * \brief Checks if the drive supports removable media. + * + * Wrapper of Gio::Drive::is_media_removable() + * + * \return true if drive supports removable media, false otherwise. + */ +bool DGioDrive::isMediaRemovable() const +{ + Q_D(const DGioDrive); + + return d->getGmmDriveInstence()->is_media_removable(); +} + +/*! + * \brief Checks if the drive and/or its media is considered removable by the user. + * + * Wrapper of Gio::Drive::is_removable() + * + * \return true if drive and/or its media is considered removable, false otherwise. + * + * \sa isMediaRemovable() + */ +bool DGioDrive::isRemovable() const +{ + Q_D(const DGioDrive); + + return d->getGmmDriveInstence()->is_removable(); +} diff --git a/qgio-tools/main.cpp b/qgio-tools/main.cpp index 6dbf93b..4ae7e96 100644 --- a/qgio-tools/main.cpp +++ b/qgio-tools/main.cpp @@ -136,7 +136,7 @@ int main(int argc, char * argv[]) const QList > drvs = DGioVolumeManager::getDrives(); for (const QExplicitlySharedDataPointer &p : drvs) { - qDebug() << p->name(); + qDebug() << p->name() << p->isRemovable() << p->isMediaRemovable(); } qDebug() << "----------------------";