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