[app] Handle storage change action
This commit is contained in:
parent
08602a53f8
commit
143f3a3a3b
1 changed files with 10 additions and 5 deletions
|
@ -319,6 +319,7 @@ BooksStorage::set(
|
||||||
#define STORAGE_PARTITION "partition"
|
#define STORAGE_PARTITION "partition"
|
||||||
|
|
||||||
#define STORAGE_ACTION_ADD "add"
|
#define STORAGE_ACTION_ADD "add"
|
||||||
|
#define STORAGE_ACTION_CHANGE "change"
|
||||||
#define STORAGE_ACTION_REMOVE "remove"
|
#define STORAGE_ACTION_REMOVE "remove"
|
||||||
|
|
||||||
#define STORAGE_SCAN_INTERVAL 100
|
#define STORAGE_SCAN_INTERVAL 100
|
||||||
|
@ -599,11 +600,15 @@ BooksStorageManager::Private::onDeviceEvent(
|
||||||
HDEBUG(" devtype:" << udev_device_get_devtype(dev));
|
HDEBUG(" devtype:" << udev_device_get_devtype(dev));
|
||||||
HDEBUG(" action:" << action);
|
HDEBUG(" action:" << action);
|
||||||
if (devnode && action) {
|
if (devnode && action) {
|
||||||
if (!strcmp(action, STORAGE_ACTION_ADD)) {
|
if (!strcmp(action, STORAGE_ACTION_ADD) ||
|
||||||
// Mount list isn't updated yet when we receive this
|
!strcmp(action, STORAGE_ACTION_CHANGE)) {
|
||||||
// notification. It takes hundreds of milliseconds until
|
// Mount list may not be updated yet when we receive a
|
||||||
// it gets mounted and becomes accessible.
|
// notification.
|
||||||
if (!scanMounts()) {
|
if (scanMounts()) {
|
||||||
|
if (iScanMountsTimer) {
|
||||||
|
iScanMountsTimer->stop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
HDEBUG("no new mounts found");
|
HDEBUG("no new mounts found");
|
||||||
if (!iScanMountsTimer) {
|
if (!iScanMountsTimer) {
|
||||||
QTimer* timer = new QTimer(this);
|
QTimer* timer = new QTimer(this);
|
||||||
|
|
Loading…
Reference in a new issue