|
|
@ -167,7 +167,10 @@ TDEHardwareDevices::TDEHardwareDevices() {
|
|
|
|
if ( file.open( IO_ReadOnly ) ) {
|
|
|
|
if ( file.open( IO_ReadOnly ) ) {
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
while ( !stream.atEnd() ) {
|
|
|
|
while ( !stream.atEnd() ) {
|
|
|
|
m_mountTable.append(stream.readLine());
|
|
|
|
TQString line = stream.readLine();
|
|
|
|
|
|
|
|
if (!line.isEmpty()) {
|
|
|
|
|
|
|
|
m_mountTable[line] = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
file.close();
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -934,7 +937,7 @@ void TDEHardwareDevices::processModifiedMounts() {
|
|
|
|
// Detect what changed between the old mount table and the new one,
|
|
|
|
// Detect what changed between the old mount table and the new one,
|
|
|
|
// and emit appropriate events
|
|
|
|
// and emit appropriate events
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList deletedEntries = m_mountTable;
|
|
|
|
TQMap<TQString, bool> deletedEntries = m_mountTable;
|
|
|
|
|
|
|
|
|
|
|
|
// Read in the new mount table
|
|
|
|
// Read in the new mount table
|
|
|
|
m_mountTable.clear();
|
|
|
|
m_mountTable.clear();
|
|
|
@ -942,31 +945,26 @@ void TDEHardwareDevices::processModifiedMounts() {
|
|
|
|
if ( file.open( IO_ReadOnly ) ) {
|
|
|
|
if ( file.open( IO_ReadOnly ) ) {
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
TQTextStream stream( &file );
|
|
|
|
while ( !stream.atEnd() ) {
|
|
|
|
while ( !stream.atEnd() ) {
|
|
|
|
m_mountTable.append(stream.readLine());
|
|
|
|
TQString line = stream.readLine();
|
|
|
|
|
|
|
|
if (!line.isEmpty()) {
|
|
|
|
|
|
|
|
m_mountTable[line] = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
file.close();
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TQMap<TQString, bool> addedEntries = m_mountTable;
|
|
|
|
TQStringList addedEntries = m_mountTable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove all entries that are identical in both tables
|
|
|
|
// Remove all entries that are identical in both tables
|
|
|
|
processModifiedMounts_removeagain:
|
|
|
|
for ( TQMap<TQString, bool>::ConstIterator mtIt = m_mountTable.begin(); mtIt != m_mountTable.end(); ++mtIt ) {
|
|
|
|
for ( TQStringList::Iterator delit = deletedEntries.begin(); delit != deletedEntries.end(); ++delit ) {
|
|
|
|
if (deletedEntries.contains(mtIt.key())) {
|
|
|
|
for ( TQStringList::Iterator addit = addedEntries.begin(); addit != addedEntries.end(); ++addit ) {
|
|
|
|
deletedEntries.remove(mtIt.key());
|
|
|
|
if ((*delit) == (*addit)) {
|
|
|
|
addedEntries.remove(mtIt.key());
|
|
|
|
deletedEntries.remove(delit);
|
|
|
|
|
|
|
|
addedEntries.remove(addit);
|
|
|
|
|
|
|
|
// Reset iterators to prevent bugs/crashes
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
|
|
|
// Is there any way to completely reset both loops without using goto?
|
|
|
|
|
|
|
|
goto processModifiedMounts_removeagain;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList::Iterator it;
|
|
|
|
TQMap<TQString, bool>::Iterator it;
|
|
|
|
for ( it = addedEntries.begin(); it != addedEntries.end(); ++it ) {
|
|
|
|
for ( it = addedEntries.begin(); it != addedEntries.end(); ++it ) {
|
|
|
|
TQStringList mountInfo = TQStringList::split(" ", (*it), true);
|
|
|
|
TQStringList mountInfo = TQStringList::split(" ", it.key(), true);
|
|
|
|
// Try to find a device that matches the altered node
|
|
|
|
// Try to find a device that matches the altered node
|
|
|
|
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
|
|
|
|
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
|
|
|
|
if (hwdevice) {
|
|
|
|
if (hwdevice) {
|
|
|
@ -987,7 +985,7 @@ void TDEHardwareDevices::processModifiedMounts() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for ( it = deletedEntries.begin(); it != deletedEntries.end(); ++it ) {
|
|
|
|
for ( it = deletedEntries.begin(); it != deletedEntries.end(); ++it ) {
|
|
|
|
TQStringList mountInfo = TQStringList::split(" ", (*it), true);
|
|
|
|
TQStringList mountInfo = TQStringList::split(" ", it.key(), true);
|
|
|
|
// Try to find a device that matches the altered node
|
|
|
|
// Try to find a device that matches the altered node
|
|
|
|
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
|
|
|
|
TDEGenericDevice* hwdevice = findByDeviceNode(*mountInfo.at(0));
|
|
|
|
if (hwdevice) {
|
|
|
|
if (hwdevice) {
|
|
|
|