diff --git a/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp b/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp --- a/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp +++ b/solid-device-automounter/kcm/DeviceAutomounterKCM.cpp @@ -63,13 +63,12 @@ deviceView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); deviceView->header()->setSectionResizeMode(0, QHeaderView::Stretch); - auto emitChanged = [this] { - m_devices->setAutomaticMountOnLogin(kcfg_AutomountOnLogin->isChecked()); - m_devices->setAutomaticMountOnPlugin(kcfg_AutomountOnPlugin->isChecked()); - emit markAsChanged(); - }; - - connect(m_devices, &DeviceModel::dataChanged, this, emitChanged); + connect(kcfg_AutomountOnLogin, &QCheckBox::stateChanged, [this](int state) { + m_devices->setAutomaticMountOnLogin(state == Qt::Checked); + }); + connect(kcfg_AutomountOnPlugin, &QCheckBox::stateChanged, [this](int state) { + m_devices->setAutomaticMountOnPlugin(state == Qt::Checked); + }); connect(deviceView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &DeviceAutomounterKCM::updateForgetDeviceButton); diff --git a/solid-device-automounter/kcm/DeviceModel.cpp b/solid-device-automounter/kcm/DeviceModel.cpp --- a/solid-device-automounter/kcm/DeviceModel.cpp +++ b/solid-device-automounter/kcm/DeviceModel.cpp @@ -95,11 +95,17 @@ m_attached.removeOne(udi); endRemoveRows(); - // NOTE the device is not moved to the "Disconnected" section - // when removing it while the KCM is opened because we need to check - // whether the device that just got detached is ignored + // We move the device to the "Disconnected" section only if it + // is a known device, meaning we have some setting for this device. + // Otherwise the device is not moved to the "Disconnected" section + // because we need to check whether the device that just got detached is ignored // (don't show partition tables and other garbage) but this information - // is no longer available when the device is gone + // is no longer available once the device is gone + if (m_settings->knownDevices().contains(udi)) { + beginInsertRows(index(rowCount() + 1, 0), m_disconnected.size(), m_disconnected.size()); + m_disconnected << udi; + endInsertRows(); + } } }