From 369628a8a96032aa3befeafffe6093c53f085062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E5=86=B2?= Date: Mon, 5 Aug 2019 13:30:10 +0800 Subject: [PATCH] feat: new interface for eject --- gio-qt/include/dgiomount.h | 4 ++-- gio-qt/source/dgiomount.cpp | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gio-qt/include/dgiomount.h b/gio-qt/include/dgiomount.h index e8982e4..ee2d64d 100644 --- a/gio-qt/include/dgiomount.h +++ b/gio-qt/include/dgiomount.h @@ -45,17 +45,17 @@ public: bool isShadowed() const; bool canUnmount() const; bool canEject() const; + QString sortKey() const; QStringList themedIconNames() const; QStringList themedSymbolicIconNames() const; void unmount(bool forceUnmount = false); + void eject(bool forceEject = false); QExplicitlySharedDataPointer getRootFile(); QExplicitlySharedDataPointer getDefaultLocationFile(); QExplicitlySharedDataPointer getVolume(); - QString getSortKey()const; - private: QScopedPointer d_ptr; diff --git a/gio-qt/source/dgiomount.cpp b/gio-qt/source/dgiomount.cpp index 8c106ee..6927d8d 100644 --- a/gio-qt/source/dgiomount.cpp +++ b/gio-qt/source/dgiomount.cpp @@ -169,6 +169,13 @@ bool DGioMount::canEject() const return d->getGmmMountInstance()->can_eject(); } +QString DGioMount::sortKey() const +{ + Q_D(const DGioMount); + + return QString::fromStdString(d->getGmmMountInstance()->get_sort_key()); +} + QStringList DGioMount::themedIconNames() const { Q_D(const DGioMount); @@ -194,6 +201,13 @@ void DGioMount::unmount(bool forceUnmount) return d->getGmmMountInstance()->unmount(forceUnmount ? MOUNT_UNMOUNT_FORCE : MOUNT_UNMOUNT_NONE); } +void DGioMount::eject(bool forceEject) +{ + Q_D(const DGioMount); + + return d->getGmmMountInstance()->eject(forceEject ? MOUNT_UNMOUNT_FORCE : MOUNT_UNMOUNT_NONE); +} + QExplicitlySharedDataPointer DGioMount::getRootFile() { Q_D(const DGioMount); @@ -226,11 +240,3 @@ QExplicitlySharedDataPointer DGioMount::getVolume() return QExplicitlySharedDataPointer(nullptr); } - -QString DGioMount::getSortKey()const -{ - Q_D(const DGioMount); - - return QString::fromStdString(d->getGmmMountInstance()->get_sort_key()); -} -