Fix device open
Now we do not have to click twice to open a external disk.
This commit is contained in:
parent
845c0b40f0
commit
ce2a66656f
3 changed files with 7 additions and 0 deletions
|
@ -220,6 +220,9 @@ void PlacesModel::requestSetup(const int &index)
|
||||||
Solid::Device device = Solid::Device(item->udi());
|
Solid::Device device = Solid::Device(item->udi());
|
||||||
Solid::StorageAccess *access = device.as<Solid::StorageAccess>();
|
Solid::StorageAccess *access = device.as<Solid::StorageAccess>();
|
||||||
access->setup();
|
access->setup();
|
||||||
|
connect(access, &Solid::StorageAccess::setupDone, this, [this, access]() {
|
||||||
|
emit deviceSetupDone(access->filePath());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,9 @@ public:
|
||||||
Q_INVOKABLE void requestSetup(const int &index);
|
Q_INVOKABLE void requestSetup(const int &index);
|
||||||
Q_INVOKABLE void requestEject(const int &index);
|
Q_INVOKABLE void requestEject(const int &index);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void deviceSetupDone(const QString &filePath);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDeviceAdded(const QString &udi);
|
void onDeviceAdded(const QString &udi);
|
||||||
void onDeviceRemoved(const QString &udi);
|
void onDeviceRemoved(const QString &udi);
|
||||||
|
|
|
@ -13,6 +13,7 @@ ListView {
|
||||||
|
|
||||||
PlacesModel {
|
PlacesModel {
|
||||||
id: placesModel
|
id: placesModel
|
||||||
|
onDeviceSetupDone: sideBar.clicked(filePath) // 设备挂载上后,模拟点击了该设备以打开该页面
|
||||||
}
|
}
|
||||||
|
|
||||||
model: placesModel
|
model: placesModel
|
||||||
|
|
Loading…
Reference in a new issue