xref: /aoo41x/main/padmin/source/cmddlg.cxx (revision 466d5a0b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include <stdio.h>
25 #include <vcl/msgbox.hxx>
26 #include <vcl/svapp.hxx>
27 #ifndef _PAD_RTSETUP_HRC_
28 #include <rtsetup.hrc>
29 #endif
30 #include <cmddlg.hxx>
31 #include <padialog.hxx>
32 #include <helper.hxx>
33 #include <prtsetup.hxx>
34 
35 using namespace psp;
36 using namespace rtl;
37 using namespace padmin;
38 
39 #define PRINTER_PERSISTENCE_GROUP "KnownPrinterCommands"
40 #define FAX_PERSISTENCE_GROUP "KnownFaxCommands"
41 #define PDF_PERSISTENCE_GROUP "KnowPdfCommands"
42 #define MAX_COMMANDS 50
43 
getSystemPrintCommands(::std::list<String> & rCommands)44 void CommandStore::getSystemPrintCommands( ::std::list< String >& rCommands )
45 {
46 	static ::std::list< OUString > aSysCommands;
47 	static bool bOnce = false;
48 	if( ! bOnce )
49 	{
50 		bOnce = true;
51 		PrinterInfoManager::get().getSystemPrintCommands( aSysCommands );
52 	}
53 
54 	::std::list< OUString >::const_iterator it;
55 	for( it = aSysCommands.begin(); it != aSysCommands.end(); ++it )
56 		rCommands.push_back( *it );
57 }
58 
getSystemPdfCommands(::std::list<String> & rCommands)59 void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands )
60 {
61 	static bool bOnce = false;
62 	static ::std::list< String > aSysCommands;
63 
64 	if( ! bOnce )
65 	{
66 		bOnce = true;
67 		char pBuffer[1024];
68 		FILE* pPipe;
69 		String aCommand;
70 		rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
71 
72 		pPipe = popen( "which gs 2>/dev/null", "r" );
73 		if( pPipe )
74 		{
75 			if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL)
76 			{
77 				int nLen = strlen( pBuffer );
78 	            if( pBuffer[nLen-1] == '\n' ) // strip newline
79 	                pBuffer[--nLen] = 0;
80 	            aCommand = String( ByteString( pBuffer ), aEncoding );
81 	            if( ( ( aCommand.GetChar( 0 ) == '/' )
82 	                  || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
83 	                  || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
84 	                && nLen > 2
85 	                && aCommand.GetChar( nLen-2 ) == 'g'
86 	                && aCommand.GetChar( nLen-1 ) == 's' )
87 	            {
88 					aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" );
89 					aSysCommands.push_back( aCommand );
90 				}
91 			}
92 			pclose( pPipe );
93 		}
94 
95 		pPipe = popen( "which distill 2>/dev/null", "r" );
96 		if( pPipe )
97 		{
98 			if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL)
99 			{
100 				int nLen = strlen( pBuffer );
101 	            if( pBuffer[nLen-1] == '\n' ) // strip newline
102 	                pBuffer[--nLen] = 0;
103 	            aCommand = String( ByteString( pBuffer ), aEncoding );
104 	            if( ( ( aCommand.GetChar( 0 ) == '/' )
105 	                  || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
106 	                  || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
107 	                && nLen > 7
108 	                && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) )
109 				{
110 					aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" );
111 					aSysCommands.push_back( aCommand );
112 				}
113 			}
114 			pclose( pPipe );
115 		}
116 	}
117 	::std::list< String >::const_iterator it;
118 	for( it = aSysCommands.begin(); it != aSysCommands.end(); ++it )
119 		rCommands.push_back( *it );
120 }
121 
122 
123 
getStoredCommands(const char * pGroup,::std::list<String> & rCommands)124 void CommandStore::getStoredCommands( const char* pGroup, ::std::list< String >& rCommands )
125 {
126 	Config& rConfig( getPadminRC() );
127 	rConfig.SetGroup( pGroup );
128 	int nKeys = rConfig.GetKeyCount();
129 	::std::list< String >::const_iterator it;
130 	while( nKeys-- )
131 	{
132 		String aCommand( rConfig.ReadKey( ByteString::CreateFromInt32( nKeys ), RTL_TEXTENCODING_UTF8 ) );
133         if( aCommand.Len() )
134         {
135             for( it = rCommands.begin(); it != rCommands.end() && *it != aCommand; ++it )
136                 ;
137             if( it == rCommands.end() )
138                 rCommands.push_back( aCommand );
139         }
140 	}
141 }
142 
setCommands(const char * pGroup,const::std::list<String> & rCommands,const::std::list<String> & rSysCommands)143 void CommandStore::setCommands(
144 							   const char* pGroup,
145 							   const ::std::list< String >& rCommands,
146 							   const ::std::list< String >& rSysCommands
147 							   )
148 {
149 	Config& rConfig( getPadminRC() );
150 	rConfig.DeleteGroup( pGroup );
151 	rConfig.SetGroup( pGroup );
152 	::std::list< String >::const_iterator it, loop;
153 	::std::list< String > aWriteList;
154 
155 	int nWritten = 0;
156 	for( it = rCommands.begin(); it != rCommands.end(); ++it )
157 	{
158         if( it->Len() )
159         {
160             for( loop = rSysCommands.begin(); loop != rSysCommands.end() && *loop != *it; ++loop )
161                 ;
162             if( loop == rSysCommands.end() )
163             {
164                 aWriteList.push_back( *it );
165                 nWritten++;
166             }
167         }
168 	}
169 	while( nWritten > MAX_COMMANDS )
170 	{
171 		aWriteList.pop_front();
172 		nWritten--;
173 	}
174 	for( nWritten = 0, it = aWriteList.begin(); it != aWriteList.end(); ++it, ++nWritten )
175 		rConfig.WriteKey( ByteString::CreateFromInt32( nWritten ), ByteString( *it, RTL_TEXTENCODING_UTF8 ) );
176 }
177 
178 
getPrintCommands(::std::list<String> & rCommands)179 void CommandStore::getPrintCommands( ::std::list< String >& rCommands )
180 {
181 	rCommands.clear();
182 	getSystemPrintCommands( rCommands );
183 	getStoredCommands( PRINTER_PERSISTENCE_GROUP, rCommands );
184 }
185 
getPdfCommands(::std::list<String> & rCommands)186 void CommandStore::getPdfCommands( ::std::list< String >& rCommands )
187 {
188 	rCommands.clear();
189 	getSystemPdfCommands( rCommands );
190 	getStoredCommands( PDF_PERSISTENCE_GROUP, rCommands );
191 }
192 
getFaxCommands(::std::list<String> & rCommands)193 void CommandStore::getFaxCommands( ::std::list< String >& rCommands )
194 {
195 	rCommands.clear();
196 	getStoredCommands( FAX_PERSISTENCE_GROUP, rCommands );
197 }
198 
setPrintCommands(const::std::list<String> & rCommands)199 void CommandStore::setPrintCommands( const ::std::list< String >& rCommands )
200 {
201 	::std::list< String > aSysCmds;
202 	getSystemPrintCommands( aSysCmds );
203 	setCommands( PRINTER_PERSISTENCE_GROUP, rCommands, aSysCmds );
204 }
205 
setPdfCommands(const::std::list<String> & rCommands)206 void CommandStore::setPdfCommands( const ::std::list< String >& rCommands )
207 {
208 	::std::list< String > aSysCmds;
209 	getSystemPdfCommands( aSysCmds );
210 	setCommands( PDF_PERSISTENCE_GROUP, rCommands, aSysCmds );
211 }
212 
setFaxCommands(const::std::list<String> & rCommands)213 void CommandStore::setFaxCommands( const ::std::list< String >& rCommands )
214 {
215 	::std::list< String > aSysCmds;
216 	setCommands( FAX_PERSISTENCE_GROUP, rCommands, aSysCmds );
217 }
218 
219 
RTSCommandPage(RTSDialog * pParent)220 RTSCommandPage::RTSCommandPage( RTSDialog* pParent ) :
221 		TabPage( &pParent->m_aTabControl, PaResId( RID_RTS_COMMANDPAGE ) ),
222 		m_pParent( pParent ),
223 		m_aCommandsCB( this, PaResId( RID_RTS_CMD_CB_COMMANDS ) ),
224         m_aExternalCB( this, PaResId( RID_RTS_CMD_CB_EXTERNAL ) ),
225         m_aQuickFT( this, PaResId( RID_RTS_CMD_FT_QUICKCMD ) ),
226         m_aQuickCB( this, PaResId( RIT_RTS_CMD_CB_QUICKCMD ) ),
227 		m_aCommandTitle( this, PaResId( RID_RTS_CMD_FL_INSTALL ) ),
228 		m_aPrinterName( this, PaResId( RID_RTS_CMD_TXT_PRTNAME ) ),
229 		m_aConnectedTo( this, PaResId( RID_RTS_CMD_TXT_CONNECT ) ),
230 		m_aPrinterFL( this, PaResId( RID_RTS_CMD_FL_DEFAULT ) ),
231 		m_aConfigureText( this, PaResId( RID_RTS_CMD_TXT_CONFIGURE ) ),
232 		m_aConfigureBox( this, PaResId( RID_RTS_CMD_LB_CONFIGURE ) ),
233 		m_aPdfDirectoryText( this, PaResId( RID_RTS_CMD_TXT_PDFDIR ) ),
234 		m_aPdfDirectoryButton( this, PaResId( RID_RTS_CMD_BTN_PDFDIR ) ),
235 		m_aPdfDirectoryEdit( this, PaResId( RID_RTS_CMD_EDT_PDFDIR ) ),
236 		m_aFaxSwallowBox( this, PaResId( RID_RTS_CMD_BOX_SWALLOWFAXNO ) ),
237 		m_aHelpButton( this, PaResId( RID_RTS_CMD_BTN_HELP ) ),
238 		m_aRemovePB( this, PaResId( RID_RTS_CMD_BTN_REMOVE ) ),
239 		m_aFaxHelp( PaResId( RID_RTS_CMD_STR_FAXHELP ) ),
240 		m_aPrinterHelp( PaResId( RID_RTS_CMD_STR_PRINTERHELP ) ),
241 		m_aPdfHelp( PaResId( RID_RTS_CMD_STR_PDFHELP ) )
242 {
243     // configuring as printer is only sensible in default print system
244     PrinterInfoManager& rMgr( PrinterInfoManager::get() );
245     if( rMgr.getType() == PrinterInfoManager::Default || rMgr.isCUPSDisabled() )
246         m_nPrinterEntry = m_aConfigureBox.InsertEntry( String( PaResId( RID_RTS_CMD_STR_CONFIGURE_PRINTER ) ) );
247     else
248         m_nPrinterEntry = ~0;
249 	m_nFaxEntry = m_aConfigureBox.InsertEntry( String( PaResId( RID_RTS_CMD_STR_CONFIGURE_FAX ) ) );
250 	m_nPdfEntry = m_aConfigureBox.InsertEntry( String( PaResId( RID_RTS_CMD_STR_CONFIGURE_PDF ) ) );
251 
252 	FreeResource();
253 
254 	CommandStore::getPrintCommands( m_aPrinterCommands );
255 	CommandStore::getFaxCommands( m_aFaxCommands );
256 	CommandStore::getPdfCommands( m_aPdfCommands );
257 
258 	m_aPrinterName.SetText( m_pParent->m_aPrinter );
259 
260 	m_aCommandsCB.SetDoubleClickHdl( LINK( this, RTSCommandPage, DoubleClickHdl ) );
261 	m_aCommandsCB.SetSelectHdl( LINK( this, RTSCommandPage, SelectHdl ) );
262 	m_aCommandsCB.SetModifyHdl( LINK( this, RTSCommandPage, ModifyHdl ) );
263 	m_aConfigureBox.SetSelectHdl( LINK( this, RTSCommandPage, SelectHdl ) );
264 	m_aHelpButton.SetClickHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
265 	m_aRemovePB.SetClickHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
266 	m_aPdfDirectoryButton.SetClickHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
267     m_aExternalCB.SetToggleHdl( LINK( this, RTSCommandPage, ClickBtnHdl ) );
268 
269 	m_aPdfDirectoryButton.Show( sal_False );
270 	m_aPdfDirectoryEdit.Show( sal_False );
271 	m_aPdfDirectoryText.Show( sal_False );
272 	m_aFaxSwallowBox.Show( sal_False );
273 	m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
274     m_aQuickCB.SetText( m_pParent->m_aJobData.m_aQuickCommand );
275 
276 	m_bWasFax = false;
277 	m_bWasPdf = false;
278 	m_aConfigureBox.SelectEntryPos( m_nPrinterEntry );
279     sal_Int32 nIndex = 0;
280     while( nIndex != -1 )
281 	{
282 		OUString aToken( m_pParent->m_aJobData.m_aFeatures.getToken( 0, ',', nIndex ) );
283 		if( ! aToken.compareToAscii( "fax", 3 ) )
284 		{
285 			m_bWasFax = true;
286 			m_aFaxSwallowBox.Show( sal_True );
287             sal_Int32 nPos = 0;
288 			m_aFaxSwallowBox.Check( ! aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? sal_True : sal_False );
289 			m_aConfigureBox.SelectEntryPos( m_nFaxEntry );
290 		}
291 		else if( ! aToken.compareToAscii( "pdf=", 4 ) )
292 		{
293 			m_bWasPdf = true;
294             sal_Int32 nPos = 0;
295 			m_aPdfDirectoryEdit.SetText( aToken.getToken( 1, '=', nPos ) );
296 			m_aPdfDirectoryEdit.Show( sal_True );
297 			m_aPdfDirectoryButton.Show( sal_True );
298 			m_aPdfDirectoryText.Show( sal_True );
299 			m_aConfigureBox.SelectEntryPos( m_nPdfEntry );
300 		}
301         else if( ! aToken.compareToAscii( "external_dialog" ) )
302         {
303             m_aExternalCB.Check();
304             m_bWasExternalDialog = true;
305         }
306 	}
307 
308     m_aQuickCB.Enable( m_aExternalCB.IsChecked() );
309 
310 	String aString( m_aConnectedTo.GetText() );
311 	aString += String( m_pParent->m_aJobData.m_aCommand );
312 	m_aConnectedTo.SetText( aString );
313 
314 	UpdateCommands();
315 }
316 
~RTSCommandPage()317 RTSCommandPage::~RTSCommandPage()
318 {
319 }
320 
save()321 void RTSCommandPage::save()
322 {
323 	String aCommand,aQuickCommand;
324 	bool bHaveFax = m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry ? true : false;
325 	bool bHavePdf = m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry ? true : false;
326 	::std::list< String >::iterator it;
327 
328 	String aFeatures;
329     sal_Int32 nIndex = 0;
330 	String aOldPdfPath;
331 	bool bOldFaxSwallow = false;
332 	bool bFaxSwallow = m_aFaxSwallowBox.IsChecked() ? true : false;
333     bool bOldExternalDialog = false, bExternalDialog = m_aExternalCB.IsChecked() ? true : false;
334 
335     while( nIndex != -1 )
336 	{
337 		OUString aToken( m_pParent->m_aJobData.m_aFeatures.getToken( 0, ',', nIndex ) );
338 		if( aToken.compareToAscii( "fax", 3 ) &&
339 			aToken.compareToAscii( "pdf", 3 ) &&
340             aToken.compareToAscii( "external_dialog" )
341           )
342 		{
343 			if( aToken.getLength() )
344 			{
345 				if( aFeatures.Len() )
346 					aFeatures += ',';
347 				aFeatures += String( aToken );
348 			}
349 		}
350 		else if( ! aToken.compareToAscii( "pdf=", 4 ) )
351         {
352             sal_Int32 nPos = 0;
353 			aOldPdfPath = aToken.getToken( 1, '=', nPos );
354         }
355 		else if( ! aToken.compareToAscii( "fax=", 4 ) )
356         {
357             sal_Int32 nPos = 0;
358 			bOldFaxSwallow = aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? false : true;
359         }
360         else if( ! aToken.compareToAscii( "external_dialog" ) )
361         {
362             bOldExternalDialog = true;
363         }
364 	}
365 	::std::list< String >* pList = &m_aPrinterCommands;
366     if( bExternalDialog )
367 	{
368 		if( aFeatures.Len() )
369 			aFeatures += ',';
370 		aFeatures.AppendAscii( "external_dialog" );
371 	}
372 	if( bHaveFax )
373 	{
374 		if( aFeatures.Len() )
375 			aFeatures += ',';
376 		aFeatures.AppendAscii( "fax=" );
377 		if( bFaxSwallow )
378 			aFeatures.AppendAscii( "swallow" );
379 		pList = &m_aFaxCommands;
380 	}
381 	if( bHavePdf )
382 	{
383 		if( aFeatures.Len() )
384 			aFeatures += ',';
385 		aFeatures.AppendAscii( "pdf=" );
386 		aFeatures.Append( m_aPdfDirectoryEdit.GetText() );
387 		pList = &m_aPdfCommands;
388 	}
389 	aCommand = m_aCommandsCB.GetText();
390     aQuickCommand = m_aQuickCB.GetText();
391 	for( it = pList->begin(); it != pList->end() && *it != aCommand; ++it )
392 		;
393 	if( it == pList->end() )
394 		pList->push_back( aCommand );
395 
396 	if( aCommand != String( m_pParent->m_aJobData.m_aCommand )		        ||
397         aQuickCommand != String( m_pParent->m_aJobData.m_aQuickCommand )    ||
398 		( m_bWasFax && ! bHaveFax )									        ||
399 		( ! m_bWasFax && bHaveFax )									        ||
400 		( m_bWasPdf && ! bHavePdf )									        ||
401 		( ! m_bWasPdf && bHavePdf )									        ||
402 		( bHavePdf && aOldPdfPath != m_aPdfDirectoryEdit.GetText() )        ||
403 		( bHaveFax && bFaxSwallow != bOldFaxSwallow )                       ||
404         ( m_bWasExternalDialog && ! bExternalDialog )                       ||
405         ( ! m_bWasExternalDialog && bExternalDialog )
406 		)
407 	{
408 		m_pParent->m_aJobData.m_aCommand	    = aCommand;
409         m_pParent->m_aJobData.m_aQuickCommand   = aQuickCommand;
410 		m_pParent->m_aJobData.m_aFeatures	    = aFeatures;
411 
412 		PrinterInfoManager::get().changePrinterInfo( m_pParent->m_aPrinter, m_pParent->m_aJobData );
413 	}
414 	CommandStore::setPrintCommands( m_aPrinterCommands );
415 	CommandStore::setFaxCommands( m_aFaxCommands );
416 	CommandStore::setPdfCommands( m_aPdfCommands );
417 }
418 
419 
IMPL_LINK(RTSCommandPage,SelectHdl,Control *,pBox)420 IMPL_LINK( RTSCommandPage, SelectHdl, Control*, pBox )
421 {
422 	if( pBox == &m_aConfigureBox )
423 	{
424 		sal_Bool bEnable = m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry ? sal_True : sal_False;
425 		m_aPdfDirectoryButton.Show( bEnable );
426 		m_aPdfDirectoryEdit.Show( bEnable );
427 		m_aPdfDirectoryText.Show( bEnable );
428 		bEnable = m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry ? sal_True : sal_False;
429 		m_aFaxSwallowBox.Show( bEnable );
430 		UpdateCommands();
431 	}
432 	else if( pBox == &m_aCommandsCB )
433 	{
434 		m_aRemovePB.Enable( sal_True );
435 	}
436 
437 	return 0;
438 }
439 
IMPL_LINK(RTSCommandPage,ClickBtnHdl,Button *,pButton)440 IMPL_LINK( RTSCommandPage, ClickBtnHdl, Button*, pButton )
441 {
442 	if( pButton == & m_aPdfDirectoryButton )
443 	{
444         String aPath( m_aPdfDirectoryEdit.GetText() );
445         if( chooseDirectory( aPath ) )
446 			m_aPdfDirectoryEdit.SetText( aPath );
447 	}
448 	else if( pButton == &m_aRemovePB )
449 	{
450 		String aEntry( m_aCommandsCB.GetText() );
451 		::std::list< String >* pList;
452 		if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
453 			pList = &m_aPrinterCommands;
454 		else if( m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry )
455 			pList = &m_aFaxCommands;
456 		else
457 			pList = &m_aPdfCommands;
458 
459 		pList->remove( aEntry );
460 		m_aCommandsCB.RemoveEntry( aEntry );
461         m_aQuickCB.RemoveEntry( aEntry );
462 	}
463 	else if( pButton == &m_aHelpButton )
464 	{
465 		String aHelpText;
466 		if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
467 			aHelpText = m_aPrinterHelp;
468 		else if( m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry )
469 			aHelpText = m_aFaxHelp;
470 		else if( m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry )
471 			aHelpText = m_aPdfHelp;
472 
473 		InfoBox aBox( this, aHelpText );
474 		aBox.Execute();
475 	}
476     else if( pButton == &m_aExternalCB )
477     {
478         m_aQuickCB.Enable( m_aExternalCB.IsChecked() );
479     }
480 	return 0;
481 }
482 
IMPL_LINK(RTSCommandPage,DoubleClickHdl,ComboBox *,pComboBox)483 IMPL_LINK( RTSCommandPage, DoubleClickHdl, ComboBox*, pComboBox )
484 {
485 	if( pComboBox == &m_aCommandsCB )
486 		ConnectCommand();
487 	return 0;
488 }
489 
IMPL_LINK(RTSCommandPage,ModifyHdl,Edit *,pEdit)490 IMPL_LINK( RTSCommandPage, ModifyHdl, Edit*, pEdit )
491 {
492 	if( pEdit == &m_aCommandsCB )
493 		m_aRemovePB.Enable( m_aCommandsCB.GetEntryPos( m_aCommandsCB.GetText() ) != LISTBOX_ENTRY_NOTFOUND );
494 
495 	return 0;
496 }
497 
UpdateCommands()498 void RTSCommandPage::UpdateCommands()
499 {
500 	m_aCommandsCB.Clear();
501 	::std::list< String >::iterator it;
502 	if( m_aConfigureBox.GetSelectEntryPos() == m_nPrinterEntry )
503 	{
504 		for( it = m_aPrinterCommands.begin(); it != m_aPrinterCommands.end(); ++it )
505         {
506 			m_aCommandsCB.InsertEntry( *it );
507             m_aQuickCB.InsertEntry( *it );
508         }
509 		if( ! m_bWasFax )
510 			m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
511 		else
512 			m_aCommandsCB.SetText( String() );
513 	}
514 	else if( m_aConfigureBox.GetSelectEntryPos() == m_nFaxEntry )
515 	{
516 		for( it = m_aFaxCommands.begin(); it != m_aFaxCommands.end(); ++it )
517         {
518 			m_aCommandsCB.InsertEntry( *it );
519             m_aQuickCB.InsertEntry( *it );
520         }
521 		if( m_bWasFax )
522 			m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
523 		else
524 			m_aCommandsCB.SetText( String() );
525 	}
526 	else if( m_aConfigureBox.GetSelectEntryPos() == m_nPdfEntry )
527 	{
528 		for( it = m_aPdfCommands.begin(); it != m_aPdfCommands.end(); ++it )
529         {
530 			m_aCommandsCB.InsertEntry( *it );
531             m_aQuickCB.InsertEntry( *it );
532         }
533 		if( m_bWasPdf )
534 			m_aCommandsCB.SetText( m_pParent->m_aJobData.m_aCommand );
535 		else
536 			m_aCommandsCB.SetText( String() );
537 	}
538 }
539 
ConnectCommand()540 void RTSCommandPage::ConnectCommand()
541 {
542 	String aString( m_aConnectedTo.GetText().GetToken( 0, ':' ) );
543 	aString.AppendAscii( ": " );
544 	aString += m_aCommandsCB.GetText();
545 
546 	m_aConnectedTo.SetText( aString );
547 }
548