diff options
author | Philipp Lohmann <pl@openoffice.org> | 2002-10-31 16:14:45 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2002-10-31 16:14:45 +0000 |
commit | 9dc16c1c44ea4e7a0912106765a6040b583ad5c0 (patch) | |
tree | 26dba5a42a3e9ad5602cce53f390d59b02f5bfeb /psprint/source | |
parent | 9d821432ead992b3ffd113155a7a91db4bcc3de4 (diff) |
#104127# a printer is not removable unless all config files it is contained in are writeable
Diffstat (limited to 'psprint/source')
-rw-r--r-- | psprint/source/printer/printerinfomanager.cxx | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/psprint/source/printer/printerinfomanager.cxx b/psprint/source/printer/printerinfomanager.cxx index 18b135488d6c..de3d5df28884 100644 --- a/psprint/source/printer/printerinfomanager.cxx +++ b/psprint/source/printer/printerinfomanager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: printerinfomanager.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: pl $ $Date: 2002-07-24 09:21:04 $ + * last change: $Author: pl $ $Date: 2002-10-31 17:14:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -435,6 +435,13 @@ void PrinterInfoManager::initialize() FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), aPrinter.m_aFile ); aPrinter.m_bModified = false; aPrinter.m_aGroup = aConfig.GetGroupName( nGroup ); + std::hash_map< OUString, Printer, OUStringHash >::const_iterator find_it = + m_aPrinters.find( aPrinterName ); + if( find_it != m_aPrinters.end() ) + { + aPrinter.m_aAlternateFiles = find_it->second.m_aAlternateFiles; + aPrinter.m_aAlternateFiles.push_front( find_it->second.m_aFile ); + } m_aPrinters[ aPrinterName ] = aPrinter; } } @@ -732,14 +739,33 @@ bool PrinterInfoManager::removePrinter( const OUString& rPrinterName, bool bChec if( it->second.m_aFile.getLength() ) { // this printer already exists in a config file - // check writeability of config file + + + // check writeability of config file(s) if( ! checkWriteability( it->second.m_aFile ) ) bSuccess = false; - else if( ! bCheckOnly ) + else + { + for( std::list< OUString >::const_iterator file_it = it->second.m_aAlternateFiles.begin(); + file_it != it->second.m_aAlternateFiles.end() && bSuccess; ++file_it ) + { + if( ! checkWriteability( *file_it ) ) + bSuccess = false; + } + } + if( bSuccess && ! bCheckOnly ) { + Config aConfig( it->second.m_aFile ); aConfig.DeleteGroup( it->second.m_aGroup ); aConfig.Flush(); + for( std::list< OUString >::const_iterator file_it = it->second.m_aAlternateFiles.begin(); + file_it != it->second.m_aAlternateFiles.end() && bSuccess; ++file_it ) + { + Config aConfig( *file_it ); + aConfig.DeleteGroup( it->second.m_aGroup ); + aConfig.Flush(); + } } } if( bSuccess && ! bCheckOnly ) |