mirror of
https://github.com/linuxdeepin/gio-qt.git
synced 2024-12-27 07:26:09 +01:00
feat:add Wrapper of Gio::Mount and Gio::MountOperation (#16)
* fix: move test code to test project * feat:add Wrapper of Gio::Mount and Gio::MountOperation
This commit is contained in:
parent
f392d08bdf
commit
7bef27bc0a
5 changed files with 110 additions and 0 deletions
|
@ -54,6 +54,8 @@ public:
|
||||||
QExplicitlySharedDataPointer<DGioFile> getDefaultLocationFile();
|
QExplicitlySharedDataPointer<DGioFile> getDefaultLocationFile();
|
||||||
QExplicitlySharedDataPointer<DGioVolume> getVolume();
|
QExplicitlySharedDataPointer<DGioVolume> getVolume();
|
||||||
|
|
||||||
|
QString getSortKey()const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<DGioMountPrivate> d_ptr;
|
QScopedPointer<DGioMountPrivate> d_ptr;
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,14 @@ enum DGioMountOperationResult
|
||||||
};
|
};
|
||||||
Q_ENUMS(DGioMountOperationResult);
|
Q_ENUMS(DGioMountOperationResult);
|
||||||
|
|
||||||
|
enum DGioPasswordSave
|
||||||
|
{
|
||||||
|
PASSWORD_SAVE_NEVER,
|
||||||
|
PASSWORD_SAVE_FOR_SESSION,
|
||||||
|
PASSWORD_SAVE_PERMANENTLY
|
||||||
|
};
|
||||||
|
Q_ENUMS(DGioPasswordSave);
|
||||||
|
|
||||||
class DGioMountOperationPrivate;
|
class DGioMountOperationPrivate;
|
||||||
class DGioMountOperation : public QObject
|
class DGioMountOperation : public QObject
|
||||||
{
|
{
|
||||||
|
@ -54,6 +62,18 @@ public:
|
||||||
~DGioMountOperation();
|
~DGioMountOperation();
|
||||||
|
|
||||||
QString username() const;
|
QString username() const;
|
||||||
|
void setUsername(QString name);
|
||||||
|
QString password() const;
|
||||||
|
void setPassword(QString password);
|
||||||
|
DGioPasswordSave passwordSave();
|
||||||
|
void setPasswordSave(DGioPasswordSave save);
|
||||||
|
QString domain() const;
|
||||||
|
void setDomain(QString domain);
|
||||||
|
|
||||||
|
bool anonymous()const;
|
||||||
|
void setAnonymous(bool anonymous = true);
|
||||||
|
int choice()const;
|
||||||
|
void setChoice(int choice);
|
||||||
|
|
||||||
void reply(DGioMountOperationResult result);
|
void reply(DGioMountOperationResult result);
|
||||||
|
|
||||||
|
|
|
@ -227,3 +227,10 @@ QExplicitlySharedDataPointer<DGioVolume> DGioMount::getVolume()
|
||||||
return QExplicitlySharedDataPointer<DGioVolume>(nullptr);
|
return QExplicitlySharedDataPointer<DGioVolume>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DGioMount::getSortKey()const
|
||||||
|
{
|
||||||
|
Q_D(const DGioMount);
|
||||||
|
|
||||||
|
return QString::fromStdString(d->getGmmMountInstance()->get_sort_key());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,83 @@ QString DGioMountOperation::username() const
|
||||||
return d->username();
|
return d->username();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DGioMountOperation::setUsername(QString name)
|
||||||
|
{
|
||||||
|
Q_D(DGioMountOperation);
|
||||||
|
|
||||||
|
d->getGmmMountOperationInstance()->set_username(name.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DGioMountOperation::password() const
|
||||||
|
{
|
||||||
|
Q_D(const DGioMountOperation);
|
||||||
|
|
||||||
|
return QString::fromStdString(d->getGmmMountOperationInstance()->get_password());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DGioMountOperation::setPassword(QString password)
|
||||||
|
{
|
||||||
|
Q_D(DGioMountOperation);
|
||||||
|
|
||||||
|
d->getGmmMountOperationInstance()->set_password(password.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
DGioPasswordSave DGioMountOperation::passwordSave()
|
||||||
|
{
|
||||||
|
Q_D(const DGioMountOperation);
|
||||||
|
|
||||||
|
return static_cast<DGioPasswordSave>(d->getGmmMountOperationInstance()->get_password_save());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DGioMountOperation::setPasswordSave(DGioPasswordSave save)
|
||||||
|
{
|
||||||
|
Q_D(DGioMountOperation);
|
||||||
|
|
||||||
|
d->getGmmMountOperationInstance()->set_password_save(static_cast<PasswordSave>(save));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DGioMountOperation::domain() const
|
||||||
|
{
|
||||||
|
Q_D(const DGioMountOperation);
|
||||||
|
|
||||||
|
return QString::fromStdString(d->getGmmMountOperationInstance()->get_domain());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DGioMountOperation::setDomain(QString domain)
|
||||||
|
{
|
||||||
|
Q_D(DGioMountOperation);
|
||||||
|
|
||||||
|
d->getGmmMountOperationInstance()->set_domain(domain.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DGioMountOperation::anonymous() const
|
||||||
|
{
|
||||||
|
Q_D(const DGioMountOperation);
|
||||||
|
|
||||||
|
return d->getGmmMountOperationInstance()->get_anonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DGioMountOperation::setAnonymous(bool anonymous)
|
||||||
|
{
|
||||||
|
Q_D(DGioMountOperation);
|
||||||
|
|
||||||
|
d->getGmmMountOperationInstance()->set_anonymous(anonymous);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DGioMountOperation::choice() const
|
||||||
|
{
|
||||||
|
Q_D(const DGioMountOperation);
|
||||||
|
|
||||||
|
return d->getGmmMountOperationInstance()->get_choice();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DGioMountOperation::setChoice(int choice)
|
||||||
|
{
|
||||||
|
Q_D(DGioMountOperation);
|
||||||
|
|
||||||
|
d->getGmmMountOperationInstance()->set_choice(choice);
|
||||||
|
}
|
||||||
|
|
||||||
void DGioMountOperation::reply(DGioMountOperationResult result)
|
void DGioMountOperation::reply(DGioMountOperationResult result)
|
||||||
{
|
{
|
||||||
Q_D(DGioMountOperation);
|
Q_D(DGioMountOperation);
|
||||||
|
|
|
@ -53,6 +53,10 @@ void DGioMatchGioEnumTest::testCase_DGioMountOperationClass()
|
||||||
QCOMPARE(DGioAskPasswordFlag::ASK_PASSWORD_NEED_PASSWORD, Gio::ASK_PASSWORD_NEED_PASSWORD);
|
QCOMPARE(DGioAskPasswordFlag::ASK_PASSWORD_NEED_PASSWORD, Gio::ASK_PASSWORD_NEED_PASSWORD);
|
||||||
QCOMPARE(DGioAskPasswordFlag::ASK_PASSWORD_NEED_DOMAIN, Gio::ASK_PASSWORD_NEED_DOMAIN);
|
QCOMPARE(DGioAskPasswordFlag::ASK_PASSWORD_NEED_DOMAIN, Gio::ASK_PASSWORD_NEED_DOMAIN);
|
||||||
QCOMPARE(DGioAskPasswordFlag::ASK_PASSWORD_ANONYMOUS_SUPPORTED, Gio::ASK_PASSWORD_ANONYMOUS_SUPPORTED);
|
QCOMPARE(DGioAskPasswordFlag::ASK_PASSWORD_ANONYMOUS_SUPPORTED, Gio::ASK_PASSWORD_ANONYMOUS_SUPPORTED);
|
||||||
|
|
||||||
|
QCOMPARE(DGioMountOperationResult::MOUNT_OPERATION_ABORTED, Gio::MountOperationResult::MOUNT_OPERATION_ABORTED);
|
||||||
|
QCOMPARE(DGioMountOperationResult::MOUNT_OPERATION_HANDLED, Gio::MountOperationResult::MOUNT_OPERATION_HANDLED);
|
||||||
|
QCOMPARE(DGioMountOperationResult::MOUNT_OPERATION_UNHANDLED, Gio::MountOperationResult::MOUNT_OPERATION_UNHANDLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(DGioMatchGioEnumTest)
|
QTEST_APPLESS_MAIN(DGioMatchGioEnumTest)
|
||||||
|
|
Loading…
Reference in a new issue