summaryrefslogtreecommitdiff
path: root/padmin/source
diff options
context:
space:
mode:
authorPhilipp Lohmann <Philipp.Lohmann@Sun.COM>2009-10-09 15:11:54 +0200
committerPhilipp Lohmann <Philipp.Lohmann@Sun.COM>2009-10-09 15:11:54 +0200
commit834e45248a6fa97d8b0246c2ce8666ffd9c3cf6b (patch)
treec1222c6e5899327891b31adc93938b9b49a130ac /padmin/source
parent2589f7adbf0066980b8da68355c2d48369465764 (diff)
parent9b9d44ee50a38180c2451ca527bf7b9f6f46f0fe (diff)
merge with m61
Diffstat (limited to 'padmin/source')
-rw-r--r--padmin/source/adddlg.cxx34
-rw-r--r--padmin/source/adddlg.hxx2
-rw-r--r--padmin/source/makefile.mk3
-rw-r--r--padmin/source/newppdlg.cxx4
-rw-r--r--padmin/source/newppdlg.hxx5
5 files changed, 33 insertions, 15 deletions
diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx
index c10be2d83fcd..052de2cbb731 100644
--- a/padmin/source/adddlg.cxx
+++ b/padmin/source/adddlg.cxx
@@ -147,27 +147,31 @@ void APChooseDriverPage::fill( PrinterInfo& rInfo )
}
}
-void APChooseDriverPage::updateDrivers()
+void APChooseDriverPage::updateDrivers( bool bRefresh, const rtl::OUString& rSelectDriver )
{
for( int k = 0; k < m_aDriverBox.GetEntryCount(); k++ )
delete (String*)m_aDriverBox.GetEntryData( k );
m_aDriverBox.Clear();
std::list< rtl::OUString > aDrivers;
- psp::PPDParser::getKnownPPDDrivers( aDrivers );
+ psp::PPDParser::getKnownPPDDrivers( aDrivers, bRefresh );
+ rtl::OUString aSelectDriver( psp::PPDParser::getPPDPrinterName( rSelectDriver ) );
+
+ rtl::OUString aSelectedEntry;
for( std::list< rtl::OUString >::const_iterator it = aDrivers.begin(); it != aDrivers.end(); ++it )
{
- String aDriver( ::psp::PPDParser::getPPDPrinterName( *it ) );
- if( aDriver.Len() )
+ rtl::OUString aDriver( psp::PPDParser::getPPDPrinterName( *it ) );
+ if( aDriver.getLength() )
{
int nPos = m_aDriverBox.InsertEntry( aDriver );
m_aDriverBox.SetEntryData( nPos, new String( *it ) );
- if( it->equalsAscii( "SGENPRT" ) )
- m_aDriverBox.SelectEntryPos( nPos );
+ if( aDriver == aSelectDriver )
+ aSelectedEntry = aDriver;
}
}
+ m_aDriverBox.SelectEntry( aSelectedEntry );
m_aRemBtn.Enable( m_aDriverBox.GetEntryCount() > 0 );
}
@@ -185,7 +189,13 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton )
{
PPDImportDialog aDlg( this );
if( aDlg.Execute() )
- updateDrivers();
+ {
+ const std::list< rtl::OUString >& rImported( aDlg.getImportedFiles() );
+ if( rImported.empty() )
+ updateDrivers( true );
+ else
+ updateDrivers( true, rImported.front() );
+ }
}
else if( pButton == &m_aRemBtn )
{
@@ -259,11 +269,10 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton )
rPIManager.removePrinter( *it );
}
- ::std::list< rtl::OUString > aDirs;
+ std::list< rtl::OUString > aDirs;
// get only psprint's directories, not eventual system dirs
psp::getPrinterPathList( aDirs, NULL );
- ::std::list< rtl::OUString >::iterator dir;
-
+ std::list< rtl::OUString >::iterator dir;
for( dir = aDirs.begin(); dir != aDirs.end(); ++dir )
{
::std::list< String > aFiles;
@@ -271,10 +280,11 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton )
OUStringBuffer aDir( *dir );
aDir.append( sal_Unicode( '/' ) );
aDir.appendAscii( PRINTER_PPDDIR );
- FindFiles( aDir.makeStringAndClear(), aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PS;PPD;PS.GZ;PPD.GZ" ) ), true );
+ rtl::OUString aPPDDir( aDir.makeStringAndClear() );
+ FindFiles( aPPDDir, aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PS;PPD;PS.GZ;PPD.GZ" ) ), true );
for( file = aFiles.begin(); file != aFiles.end(); ++file )
{
- String aFile( *dir );
+ String aFile( aPPDDir );
if( aFile.GetChar( aFile.Len() ) != '/' )
aFile.AppendAscii( "/" );
aFile.Append( *file );
diff --git a/padmin/source/adddlg.hxx b/padmin/source/adddlg.hxx
index e6fe17f30188..bb17044e800a 100644
--- a/padmin/source/adddlg.hxx
+++ b/padmin/source/adddlg.hxx
@@ -96,7 +96,7 @@ class APChooseDriverPage : public APTabPage
DECL_LINK( ClickBtnHdl, PushButton* );
DECL_LINK( DelPressedHdl, ListBox* );
- void updateDrivers();
+ void updateDrivers( bool bRefresh = false, const rtl::OUString& rSelectDriver = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) );
public:
APChooseDriverPage( AddPrinterDialog* pParent );
~APChooseDriverPage();
diff --git a/padmin/source/makefile.mk b/padmin/source/makefile.mk
index 336631f1ceaa..91e4ca2a25f4 100644
--- a/padmin/source/makefile.mk
+++ b/padmin/source/makefile.mk
@@ -105,8 +105,7 @@ APP1STDLIBS= \
$(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
- $(SALLIB) \
- -lXext -lX11
+ $(SALLIB)
UNIXTEXT = $(MISC)$/spadmin.sh
diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx
index 8d5414a2ceef..0fd6aa32c984 100644
--- a/padmin/source/newppdlg.cxx
+++ b/padmin/source/newppdlg.cxx
@@ -172,6 +172,7 @@ IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton )
::std::list< rtl::OUString > aToDirs;
psp::getPrinterPathList( aToDirs, PRINTER_PPDDIR );
::std::list< rtl::OUString >::iterator writeDir = aToDirs.begin();
+ m_aImportedFiles.clear();
for( int i = 0; i < m_aDriverLB.GetSelectEntryCount(); i++ )
{
@@ -186,7 +187,10 @@ IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton )
aToFile.Append( aFile.GetName() );
OUString aToUni( aToFile.GetMainURL(INetURLObject::DECODE_TO_IURI) );
if( ! File::copy( aFromUni, aToUni ) )
+ {
+ m_aImportedFiles.push_back( aToUni );
break;
+ }
++writeDir;
} while( writeDir != aToDirs.end() );
}
diff --git a/padmin/source/newppdlg.hxx b/padmin/source/newppdlg.hxx
index 4d6d637efcc9..bd73b5ffed3e 100644
--- a/padmin/source/newppdlg.hxx
+++ b/padmin/source/newppdlg.hxx
@@ -64,9 +64,14 @@ namespace padmin {
DECL_LINK( ModifyHdl, ComboBox* );
void Import();
+
+ std::list< rtl::OUString > m_aImportedFiles;
public:
PPDImportDialog( Window* pParent );
~PPDImportDialog();
+
+ const std::list< rtl::OUString >& getImportedFiles() const
+ { return m_aImportedFiles; }
};
} // namespace