mirror of
https://github.com/linuxdeepin/gio-qt.git
synced 2024-11-10 12:03:46 +01:00
feat: interfaces for checking drive is removable
This commit is contained in:
parent
8e0557c8c2
commit
1102267f03
@ -43,6 +43,8 @@ public:
|
||||
bool canStart() const;
|
||||
bool canStop() const;
|
||||
bool canEject() const;
|
||||
bool isMediaRemovable() const;
|
||||
bool isRemovable() const;
|
||||
|
||||
private:
|
||||
QScopedPointer<DGioDrivePrivate> d_ptr;
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ int main(int argc, char * argv[])
|
||||
const QList<QExplicitlySharedDataPointer<DGioDrive> > drvs = DGioVolumeManager::getDrives();
|
||||
|
||||
for (const QExplicitlySharedDataPointer<DGioDrive> &p : drvs) {
|
||||
qDebug() << p->name();
|
||||
qDebug() << p->name() << p->isRemovable() << p->isMediaRemovable();
|
||||
}
|
||||
|
||||
qDebug() << "----------------------";
|
||||
|
Loading…
Reference in New Issue
Block a user