disallow disabling cups

which means that there is only one option left in
"add a printer" in spadmin, that to add a pdf so remove
the intermediate page

Change-Id: I5f19b526b5da9307bec77c731f305280b0ebecc3
This commit is contained in:
Caolán McNamara
2014-03-20 15:51:06 +00:00
parent a475c6963e
commit aa4e31ab27
13 changed files with 13 additions and 238 deletions

View File

@@ -112,8 +112,6 @@ protected:
bool m_bUseJobPatch; bool m_bUseJobPatch;
OUString m_aSystemDefaultPaper; OUString m_aSystemDefaultPaper;
bool m_bDisableCUPS;
PrinterInfoManager( Type eType = Default ); PrinterInfoManager( Type eType = Default );
virtual void initialize(); virtual void initialize();
@@ -195,21 +193,12 @@ public:
// returns true on success // returns true on success
virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString &rFaxNumber ); virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString &rFaxNumber );
// for spadmin: whether adding or removing a printer is possible
virtual bool addOrRemovePossible() const;
bool getUseIncludeFeature() const { return m_bUseIncludeFeature; } bool getUseIncludeFeature() const { return m_bUseIncludeFeature; }
bool getUseJobPatch() const { return m_bUseJobPatch; } bool getUseJobPatch() const { return m_bUseJobPatch; }
// check whether a printer's feature string contains a subfeature // check whether a printer's feature string contains a subfeature
bool checkFeatureToken( const OUString& rPrinterName, const char* pToken ) const; bool checkFeatureToken( const OUString& rPrinterName, const char* pToken ) const;
// set m_bDisableCUPS and update printer config
void setCUPSDisabled( bool );
// gets m_bDisableCUPS, initialized from printer config
bool isCUPSDisabled() const;
virtual ~PrinterInfoManager(); virtual ~PrinterInfoManager();
}; };

View File

@@ -46,41 +46,6 @@ APTabPage::APTabPage( AddPrinterDialog* pParent, const ResId& rResId )
{ {
} }
APChooseDevicePage::APChooseDevicePage( AddPrinterDialog* pParent ) :
APTabPage( pParent, PaResId( RID_ADDP_PAGE_CHOOSEDEV ) ),
m_aPrinterBtn( this, PaResId( RID_ADDP_CHDEV_BTN_PRINTER ) ),
m_aPDFBtn( this, PaResId( RID_ADDP_CHDEV_BTN_PDF ) ),
m_aOverTxt( this, PaResId( RID_ADDP_CHDEV_TXT_OVER ) )
{
FreeResource();
m_aPrinterBtn.Check( true );
m_aPDFBtn.Check( false );
if( ! PrinterInfoManager::get().addOrRemovePossible() )
{
m_aPrinterBtn.Check( false );
m_aPrinterBtn.Enable( false );
}
}
APChooseDevicePage::~APChooseDevicePage()
{
}
bool APChooseDevicePage::check()
{
return true;
}
void APChooseDevicePage::fill( PrinterInfo& rInfo )
{
if( m_aPDFBtn.IsChecked() )
{
rInfo.m_aFeatures = "pdf=";
}
else
rInfo.m_aFeatures = "";
}
APChooseDriverPage::APChooseDriverPage( AddPrinterDialog* pParent ) APChooseDriverPage::APChooseDriverPage( AddPrinterDialog* pParent )
: APTabPage( pParent, PaResId( RID_ADDP_PAGE_CHOOSEDRIVER ) ), : APTabPage( pParent, PaResId( RID_ADDP_PAGE_CHOOSEDRIVER ) ),
m_aDriverTxt( this, PaResId( RID_ADDP_CHDRV_TXT_DRIVER ) ), m_aDriverTxt( this, PaResId( RID_ADDP_CHDRV_TXT_DRIVER ) ),
@@ -489,7 +454,6 @@ AddPrinterDialog::AddPrinterDialog( Window* pParent )
m_aLine( this, PaResId( RID_ADDP_LINE ) ), m_aLine( this, PaResId( RID_ADDP_LINE ) ),
m_aTitleImage( this, PaResId( RID_ADDP_CTRL_TITLE ) ), m_aTitleImage( this, PaResId( RID_ADDP_CTRL_TITLE ) ),
m_pCurrentPage( NULL ), m_pCurrentPage( NULL ),
m_pChooseDevicePage( NULL ),
m_pCommandPage( NULL ), m_pCommandPage( NULL ),
m_pChooseDriverPage( NULL ), m_pChooseDriverPage( NULL ),
m_pNamePage( NULL ), m_pNamePage( NULL ),
@@ -499,7 +463,8 @@ AddPrinterDialog::AddPrinterDialog( Window* pParent )
m_pPdfCommandPage( NULL ) m_pPdfCommandPage( NULL )
{ {
FreeResource(); FreeResource();
m_pCurrentPage = m_pChooseDevicePage = new APChooseDevicePage( this ); m_pCurrentPage = m_pPdfDriverPage = new APPdfDriverPage( this );
m_pCurrentPage->Show( true ); m_pCurrentPage->Show( true );
m_aFinishPB.Enable( false ); m_aFinishPB.Enable( false );
m_aPrevPB.Enable( false ); m_aPrevPB.Enable( false );
@@ -516,7 +481,6 @@ AddPrinterDialog::AddPrinterDialog( Window* pParent )
AddPrinterDialog::~AddPrinterDialog() AddPrinterDialog::~AddPrinterDialog()
{ {
delete m_pChooseDevicePage;
delete m_pChooseDriverPage; delete m_pChooseDriverPage;
delete m_pNamePage; delete m_pNamePage;
delete m_pCommandPage; delete m_pCommandPage;
@@ -544,24 +508,7 @@ void AddPrinterDialog::DataChanged( const DataChangedEvent& rEv )
void AddPrinterDialog::advance() void AddPrinterDialog::advance()
{ {
m_pCurrentPage->Show( false ); m_pCurrentPage->Show( false );
if( m_pCurrentPage == m_pChooseDevicePage ) if( m_pCurrentPage == m_pChooseDriverPage )
{
if( m_pChooseDevicePage->isPrinter() )
{
if( ! m_pChooseDriverPage )
m_pChooseDriverPage = new APChooseDriverPage( this );
m_pCurrentPage = m_pChooseDriverPage;
m_aPrevPB.Enable( true );
}
else if( m_pChooseDevicePage->isPDF() )
{
if( ! m_pPdfDriverPage )
m_pPdfDriverPage = new APPdfDriverPage( this );
m_pCurrentPage = m_pPdfDriverPage;
m_aPrevPB.Enable( true );
}
}
else if( m_pCurrentPage == m_pChooseDriverPage )
{ {
if( ! m_pCommandPage ) if( ! m_pCommandPage )
m_pCommandPage = new APCommandPage( this, DeviceKind::Printer ); m_pCommandPage = new APCommandPage( this, DeviceKind::Printer );
@@ -591,6 +538,7 @@ void AddPrinterDialog::advance()
m_pPdfCommandPage = new APCommandPage( this, DeviceKind::Pdf ); m_pPdfCommandPage = new APCommandPage( this, DeviceKind::Pdf );
m_pCurrentPage = m_pPdfCommandPage; m_pCurrentPage = m_pPdfCommandPage;
} }
m_aPrevPB.Enable( true );
} }
else if( m_pCurrentPage == m_pPdfSelectDriverPage ) else if( m_pCurrentPage == m_pPdfSelectDriverPage )
{ {
@@ -614,12 +562,7 @@ void AddPrinterDialog::advance()
void AddPrinterDialog::back() void AddPrinterDialog::back()
{ {
m_pCurrentPage->Show( false ); m_pCurrentPage->Show( false );
if( m_pCurrentPage == m_pChooseDriverPage ) if( m_pCurrentPage == m_pNamePage )
{
m_pCurrentPage = m_pChooseDevicePage;
m_aPrevPB.Enable( false );
}
else if( m_pCurrentPage == m_pNamePage )
{ {
m_pCurrentPage = m_pCommandPage; m_pCurrentPage = m_pCommandPage;
m_aNextPB.Enable( true ); m_aNextPB.Enable( true );
@@ -628,11 +571,6 @@ void AddPrinterDialog::back()
{ {
m_pCurrentPage = m_pChooseDriverPage; m_pCurrentPage = m_pChooseDriverPage;
} }
else if( m_pCurrentPage == m_pPdfDriverPage )
{
m_pCurrentPage = m_pChooseDevicePage;
m_aPrevPB.Enable( false );
}
else if( m_pCurrentPage == m_pPdfSelectDriverPage ) else if( m_pCurrentPage == m_pPdfSelectDriverPage )
{ {
m_pCurrentPage = m_pPdfDriverPage; m_pCurrentPage = m_pPdfDriverPage;
@@ -659,17 +597,9 @@ void AddPrinterDialog::addPrinter()
{ {
PrinterInfo aInfo( rManager.getPrinterInfo( m_aPrinter.m_aPrinterName ) ); PrinterInfo aInfo( rManager.getPrinterInfo( m_aPrinter.m_aPrinterName ) );
aInfo.m_aCommand = m_aPrinter.m_aCommand; aInfo.m_aCommand = m_aPrinter.m_aCommand;
if( m_pChooseDevicePage->isPrinter() )
{
if( m_pNamePage->isDefault() )
rManager.setDefaultPrinter( m_aPrinter.m_aPrinterName );
}
else if( m_pChooseDevicePage->isPDF() )
{
OUString aPdf( "pdf=" ); OUString aPdf( "pdf=" );
aPdf += m_pPdfCommandPage->getPdfDir(); aPdf += m_pPdfCommandPage->getPdfDir();
aInfo.m_aFeatures = aPdf; aInfo.m_aFeatures = aPdf;
}
rManager.changePrinterInfo( m_aPrinter.m_aPrinterName, aInfo ); rManager.changePrinterInfo( m_aPrinter.m_aPrinterName, aInfo );
} }
} }

View File

@@ -53,16 +53,12 @@ public:
class APChooseDevicePage : public APTabPage class APChooseDevicePage : public APTabPage
{ {
RadioButton m_aPrinterBtn;
RadioButton m_aPDFBtn; RadioButton m_aPDFBtn;
FixedText m_aOverTxt; FixedText m_aOverTxt;
public: public:
APChooseDevicePage( AddPrinterDialog* pParent ); APChooseDevicePage( AddPrinterDialog* pParent );
~APChooseDevicePage(); ~APChooseDevicePage();
bool isPrinter() { return m_aPrinterBtn.IsChecked(); }
bool isPDF() { return m_aPDFBtn.IsChecked(); }
virtual bool check(); virtual bool check();
virtual void fill( ::psp::PrinterInfo& rInfo ); virtual void fill( ::psp::PrinterInfo& rInfo );
}; };
@@ -180,7 +176,6 @@ class AddPrinterDialog : public ModalDialog
APTabPage* m_pCurrentPage; APTabPage* m_pCurrentPage;
APChooseDevicePage* m_pChooseDevicePage;
APCommandPage* m_pCommandPage; APCommandPage* m_pCommandPage;
APChooseDriverPage* m_pChooseDriverPage; APChooseDriverPage* m_pChooseDriverPage;
APNamePage* m_pNamePage; APNamePage* m_pNamePage;

View File

@@ -221,7 +221,7 @@ RTSCommandPage::RTSCommandPage( RTSDialog* pParent ) :
{ {
// configuring as printer is only sensible in default print system // configuring as printer is only sensible in default print system
PrinterInfoManager& rMgr( PrinterInfoManager::get() ); PrinterInfoManager& rMgr( PrinterInfoManager::get() );
if( rMgr.getType() == PrinterInfoManager::Default || rMgr.isCUPSDisabled() ) if( rMgr.getType() == PrinterInfoManager::Default )
m_nPrinterEntry = m_aConfigureBox.InsertEntry( OUString( PaResId( RID_RTS_CMD_STR_CONFIGURE_PRINTER ) ) ); m_nPrinterEntry = m_aConfigureBox.InsertEntry( OUString( PaResId( RID_RTS_CMD_STR_CONFIGURE_PRINTER ) ) );
else else
m_nPrinterEntry = ~0; m_nPrinterEntry = ~0;

View File

@@ -84,8 +84,6 @@ PADialog::PADialog( Window* pParent, sal_Bool /*bAdmin*/ ) :
m_aCommand( this, PaResId( RID_PA_TXT_COMMAND_STRING ) ), m_aCommand( this, PaResId( RID_PA_TXT_COMMAND_STRING ) ),
m_aCommentTxt( this, PaResId( RID_PA_TXT_COMMENT ) ), m_aCommentTxt( this, PaResId( RID_PA_TXT_COMMENT ) ),
m_aComment( this, PaResId( RID_PA_TXT_COMMENT_STRING ) ), m_aComment( this, PaResId( RID_PA_TXT_COMMENT_STRING ) ),
m_aCUPSFL( this, PaResId( RID_PA_FL_CUPSUSAGE ) ),
m_aCUPSCB( this, PaResId( RID_PA_CB_CUPSUSAGE ) ),
m_aSepButtonFL( this, PaResId( RID_PA_FL_SEPBUTTON ) ), m_aSepButtonFL( this, PaResId( RID_PA_FL_SEPBUTTON ) ),
m_aAddPB( this, PaResId( RID_PA_BTN_ADD ) ), m_aAddPB( this, PaResId( RID_PA_BTN_ADD ) ),
m_aCancelButton( this, PaResId( RID_PA_BTN_CANCEL ) ), m_aCancelButton( this, PaResId( RID_PA_BTN_CANCEL ) ),
@@ -108,7 +106,6 @@ void PADialog::Init()
{ {
// #i79787# initially ensure printer discovery has ended // #i79787# initially ensure printer discovery has ended
m_rPIManager.checkPrintersChanged( true ); m_rPIManager.checkPrintersChanged( true );
m_aCUPSCB.Check( m_rPIManager.isCUPSDisabled() );
UpdateDevice(); UpdateDevice();
UpdateText(); UpdateText();
@@ -124,7 +121,6 @@ void PADialog::Init()
m_aTestPagePB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) ); m_aTestPagePB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
m_aAddPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) ); m_aAddPB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
m_aDevicesLB.setDelPressedLink( LINK( this, PADialog, DelPressedHdl ) ); m_aDevicesLB.setDelPressedLink( LINK( this, PADialog, DelPressedHdl ) );
m_aCUPSCB.SetClickHdl( LINK( this, PADialog, ClickBtnHdl ) );
// at this point no actual changes will be written // at this point no actual changes will be written
// but the write will have checked whether any writeable config exists // but the write will have checked whether any writeable config exists
@@ -135,7 +131,6 @@ void PADialog::Init()
m_aConfPB.Enable( false ); m_aConfPB.Enable( false );
m_aRenamePB.Enable( false ); m_aRenamePB.Enable( false );
m_aStdPB.Enable( false ); m_aStdPB.Enable( false );
m_aCUPSCB.Enable( false );
ErrorBox aBox( GetParent(), WB_OK | WB_DEF_OK, OUString( PaResId( RID_ERR_NOWRITE ) ) ); ErrorBox aBox( GetParent(), WB_OK | WB_DEF_OK, OUString( PaResId( RID_ERR_NOWRITE ) ) );
aBox.Execute(); aBox.Execute();
} }
@@ -204,12 +199,6 @@ IMPL_LINK( PADialog, ClickBtnHdl, PushButton*, pButton )
PrintTestPage(); PrintTestPage();
else if( pButton == &m_aAddPB ) else if( pButton == &m_aAddPB )
AddDevice(); AddDevice();
else if( static_cast<Button*>(pButton) == &m_aCUPSCB )
{
m_rPIManager.setCUPSDisabled( m_aCUPSCB.IsChecked() );
UpdateDevice();
UpdateText();
}
return 0; return 0;
} }

View File

@@ -43,8 +43,6 @@
#define RID_PA_STR_RENAME 21 #define RID_PA_STR_RENAME 21
#define RID_PA_FL_SEPBUTTON 22 #define RID_PA_FL_SEPBUTTON 22
#define RID_PA_FL_CUPSUSAGE 23
#define RID_PA_CB_CUPSUSAGE 23
#define RID_PPDIMPORT_DLG 1004 #define RID_PPDIMPORT_DLG 1004
#define RID_PPDIMP_BTN_OK 1 #define RID_PPDIMP_BTN_OK 1
@@ -106,11 +104,6 @@
#define RID_ADDP_CTRL_TITLE 6 #define RID_ADDP_CTRL_TITLE 6
#define RID_ADDP_STR_TITLE 127 #define RID_ADDP_STR_TITLE 127
#define RID_ADDP_PAGE_CHOOSEDEV 2001
#define RID_ADDP_CHDEV_TXT_OVER 1
#define RID_ADDP_CHDEV_BTN_PRINTER 2
#define RID_ADDP_CHDEV_BTN_PDF 3
#define RID_ADDP_PAGE_CHOOSEDRIVER 2002 #define RID_ADDP_PAGE_CHOOSEDRIVER 2002
#define RID_ADDP_CHDRV_TXT_DRIVER 1 #define RID_ADDP_CHDRV_TXT_DRIVER 1
#define RID_ADDP_CHDRV_BOX_DRIVER 2 #define RID_ADDP_CHDRV_BOX_DRIVER 2

View File

@@ -53,9 +53,6 @@ namespace padmin {
FixedText m_aCommentTxt; FixedText m_aCommentTxt;
FixedText m_aComment; FixedText m_aComment;
FixedLine m_aCUPSFL;
CheckBox m_aCUPSCB;
FixedLine m_aSepButtonFL; FixedLine m_aSepButtonFL;
PushButton m_aAddPB; PushButton m_aAddPB;
CancelButton m_aCancelButton; CancelButton m_aCancelButton;

View File

@@ -28,20 +28,6 @@ ModalDialog RID_PADIALOG
Moveable = TRUE ; Moveable = TRUE ;
Closeable = TRUE ; Closeable = TRUE ;
FixedLine RID_PA_FL_CUPSUSAGE
{
Pos = MAP_APPFONT( 6, 145 );
Size = MAP_APPFONT( 248, 8 );
Text [ en-US ] = "CUPS support";
};
CheckBox RID_PA_CB_CUPSUSAGE
{
HelpID = "padmin:CheckBox:RID_PADIALOG:RID_PA_CB_CUPSUSAGE";
Pos = MAP_APPFONT( 12, 158 );
Size = MAP_APPFONT( 168, 8 );
Text [ en-US ] = "Disable CUPS Support";
};
FixedLine RID_PA_FL_SEPBUTTON FixedLine RID_PA_FL_SEPBUTTON
{ {
Pos = MAP_APPFONT( 0, 176 ); Pos = MAP_APPFONT( 0, 176 );
@@ -154,7 +140,7 @@ ModalDialog RID_PADIALOG
HelpID = "padmin:PushButton:RID_PADIALOG:RID_PA_BTN_ADD"; HelpID = "padmin:PushButton:RID_PADIALOG:RID_PA_BTN_ADD";
Pos = MAP_APPFONT( 5, 181 ); Pos = MAP_APPFONT( 5, 181 );
Size = MAP_APPFONT( 70, 12 ); Size = MAP_APPFONT( 70, 12 );
Text [ en-US ] = "New Printer..."; Text [ en-US ] = "New PDF Converter...";
}; };
String RID_PA_STR_DEFPRT String RID_PA_STR_DEFPRT
@@ -506,38 +492,6 @@ TabPage RID_ADDP_PAGE_CHOOSEDRIVER
}; };
}; };
TabPage RID_ADDP_PAGE_CHOOSEDEV
{
HelpID = "padmin:TabPage:RID_ADDP_PAGE_CHOOSEDEV";
Hide = TRUE;
Pos = MAP_APPFONT( 0, 30 );
Size = MAP_APPFONT( 240, 110 );
String RID_ADDP_STR_TITLE
{
Text [ en-US ] = "Choose a device type";
};
FixedText RID_ADDP_CHDEV_TXT_OVER
{
Pos = MAP_APPFONT( 40, 25 );
Size = MAP_APPFONT( 180, 8 );
Text [ en-US ] = "Do you want to";
};
RadioButton RID_ADDP_CHDEV_BTN_PRINTER
{
HelpID = "padmin:RadioButton:RID_ADDP_PAGE_CHOOSEDEV:RID_ADDP_CHDEV_BTN_PRINTER";
Pos = MAP_APPFONT ( 40, 40 );
Size = MAP_APPFONT( 180, 10 );
Text [ en-US ] = "Add a ~printer";
};
RadioButton RID_ADDP_CHDEV_BTN_PDF
{
HelpID = "padmin:RadioButton:RID_ADDP_PAGE_CHOOSEDEV:RID_ADDP_CHDEV_BTN_PDF";
Pos = MAP_APPFONT ( 40, 50 );
Size = MAP_APPFONT( 180, 10 );
Text [ en-US ] = "Connect a P~DF converter";
};
};
TabPage RID_ADDP_PAGE_NAME TabPage RID_ADDP_PAGE_NAME
{ {
HelpID = "padmin:TabPage:RID_ADDP_PAGE_NAME"; HelpID = "padmin:TabPage:RID_ADDP_PAGE_NAME";

View File

@@ -96,7 +96,7 @@ RTSDialog::RTSDialog( const PrinterInfo& rJobData, const OUString& rPrinter, boo
m_pTabControl->RemovePage(m_pTabControl->GetPageId("other")); m_pTabControl->RemovePage(m_pTabControl->GetPageId("other"));
m_pTabControl->RemovePage(m_pTabControl->GetPageId("command")); m_pTabControl->RemovePage(m_pTabControl->GetPageId("command"));
} }
else if( m_aJobData.m_aDriverName.startsWith("CUPS:") && ! PrinterInfoManager::get().isCUPSDisabled() ) else if (m_aJobData.m_aDriverName.startsWith("CUPS:"))
{ {
// command page makes no sense for CUPS printers // command page makes no sense for CUPS printers
m_pTabControl->RemovePage(m_pTabControl->GetPageId("command")); m_pTabControl->RemovePage(m_pTabControl->GetPageId("command"));

View File

@@ -92,8 +92,6 @@ public:
virtual bool removePrinter( const OUString& rPrinterName, bool bCheckOnly = false ); virtual bool removePrinter( const OUString& rPrinterName, bool bCheckOnly = false );
virtual bool writePrinterConfig(); virtual bool writePrinterConfig();
virtual bool setDefaultPrinter( const OUString& rPrinterName ); virtual bool setDefaultPrinter( const OUString& rPrinterName );
virtual bool addOrRemovePossible() const;
}; };
} // namespace psp } // namespace psp

View File

@@ -46,11 +46,6 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) :
m_bUseIncludeFeature( false ), m_bUseIncludeFeature( false ),
m_bUseJobPatch( true ), m_bUseJobPatch( true ),
m_aSystemDefaultPaper( "A4" ), m_aSystemDefaultPaper( "A4" ),
#ifdef LIBO_HEADLESS
m_bDisableCUPS( true )
#else
m_bDisableCUPS( false )
#endif
{ {
// initSystemDefaultPaper(); // initSystemDefaultPaper();
} }
@@ -70,16 +65,6 @@ void PrinterInfoManager::initialize()
// ??? // ???
} }
bool PrinterInfoManager::isCUPSDisabled() const
{
return m_bDisableCUPS;
}
void PrinterInfoManager::setCUPSDisabled( bool /* bDisable */ )
{
// cups is already disabled in config so do nothing
}
void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const
{ {
rList.clear(); rList.clear();
@@ -117,11 +102,6 @@ bool PrinterInfoManager::setDefaultPrinter( const OUString& /* rPrinterName */ )
return false; return false;
} }
bool PrinterInfoManager::addOrRemovePossible() const
{
return false;
}
void PrinterInfoManager::getSystemPrintCommands( std::list< OUString >& /* rCommands */ ) void PrinterInfoManager::getSystemPrintCommands( std::list< OUString >& /* rCommands */ )
{ {

View File

@@ -256,9 +256,6 @@ void CUPSManager::initialize()
if( ! (m_nDests && m_pDests ) ) if( ! (m_nDests && m_pDests ) )
return; return;
if( isCUPSDisabled() )
return;
// check for CUPS server(?) > 1.2 // check for CUPS server(?) > 1.2
// since there is no API to query, check for options that were // since there is no API to query, check for options that were
// introduced in dests with 1.2 // introduced in dests with 1.2
@@ -424,7 +421,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
if( m_aCUPSMutex.tryToAcquire() ) if( m_aCUPSMutex.tryToAcquire() )
{ {
if( m_nDests && m_pDests && ! isCUPSDisabled() ) if (m_nDests && m_pDests)
{ {
boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it = boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it =
m_aCUPSDestMap.find( aPrinter ); m_aCUPSDestMap.find( aPrinter );
@@ -830,11 +827,6 @@ bool CUPSManager::writePrinterConfig()
return PrinterInfoManager::writePrinterConfig(); return PrinterInfoManager::writePrinterConfig();
} }
bool CUPSManager::addOrRemovePossible() const
{
return (m_nDests && m_pDests && ! isCUPSDisabled())? false : PrinterInfoManager::addOrRemovePossible();
}
const char* CUPSManager::authenticateUser( const char* /*pIn*/ ) const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
{ {
const char* pRet = NULL; const char* pRet = NULL;

View File

@@ -117,16 +117,13 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) :
m_eType( eType ), m_eType( eType ),
m_bUseIncludeFeature( false ), m_bUseIncludeFeature( false ),
m_bUseJobPatch( true ), m_bUseJobPatch( true ),
m_aSystemDefaultPaper( "A4" ), m_aSystemDefaultPaper( "A4" )
m_bDisableCUPS( false )
{ {
if( eType == Default ) if( eType == Default )
m_pQueueInfo = new SystemQueueInfo(); m_pQueueInfo = new SystemQueueInfo();
initSystemDefaultPaper(); initSystemDefaultPaper();
} }
PrinterInfoManager::~PrinterInfoManager() PrinterInfoManager::~PrinterInfoManager()
{ {
delete m_pQueueInfo; delete m_pQueueInfo;
@@ -135,26 +132,6 @@ PrinterInfoManager::~PrinterInfoManager()
#endif #endif
} }
bool PrinterInfoManager::isCUPSDisabled() const
{
return m_bDisableCUPS;
}
void PrinterInfoManager::setCUPSDisabled( bool bDisable )
{
m_bDisableCUPS = bDisable;
writePrinterConfig();
// actually we know the printers changed
// however this triggers reinitialization the right way
checkPrintersChanged( true );
}
void PrinterInfoManager::initSystemDefaultPaper() void PrinterInfoManager::initSystemDefaultPaper()
{ {
m_aSystemDefaultPaper = OStringToOUString( m_aSystemDefaultPaper = OStringToOUString(
@@ -231,7 +208,6 @@ void PrinterInfoManager::initialize()
// need a parser for the PPDContext. generic printer should do. // need a parser for the PPDContext. generic printer should do.
m_aGlobalDefaults.m_pParser = PPDParser::getParser( OUString( "SGENPRT" ) ); m_aGlobalDefaults.m_pParser = PPDParser::getParser( OUString( "SGENPRT" ) );
m_aGlobalDefaults.m_aContext.setParser( m_aGlobalDefaults.m_pParser ); m_aGlobalDefaults.m_aContext.setParser( m_aGlobalDefaults.m_pParser );
m_bDisableCUPS = false;
if( ! m_aGlobalDefaults.m_pParser ) if( ! m_aGlobalDefaults.m_pParser )
{ {
@@ -291,15 +267,6 @@ void PrinterInfoManager::initialize()
if (!aValue.isEmpty()) if (!aValue.isEmpty())
m_aGlobalDefaults.m_nPDFDevice = aValue.toInt32(); m_aGlobalDefaults.m_nPDFDevice = aValue.toInt32();
aValue = aConfig.ReadKey( "DisableCUPS" );
if (!aValue.isEmpty())
{
if (aValue.equals("1") || aValue.equalsIgnoreAsciiCase("true"))
m_bDisableCUPS = true;
else
m_bDisableCUPS = false;
}
// get the PPDContext of global JobData // get the PPDContext of global JobData
for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey ) for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey )
{ {
@@ -656,7 +623,6 @@ bool PrinterInfoManager::writePrinterConfig()
Config* pGlobal = files.begin()->second; Config* pGlobal = files.begin()->second;
pGlobal->SetGroup( GLOBAL_DEFAULTS_GROUP ); pGlobal->SetGroup( GLOBAL_DEFAULTS_GROUP );
pGlobal->WriteKey( "DisableCUPS", m_bDisableCUPS ? "true" : "false" );
::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it; ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it;
for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it ) for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it )
@@ -900,14 +866,6 @@ bool PrinterInfoManager::setDefaultPrinter( const OUString& rPrinterName )
return bSuccess; return bSuccess;
} }
bool PrinterInfoManager::addOrRemovePossible() const
{
return true;
}
void PrinterInfoManager::getSystemPrintCommands( std::list< OUString >& rCommands ) void PrinterInfoManager::getSystemPrintCommands( std::list< OUString >& rCommands )
{ {
if( m_pQueueInfo && m_pQueueInfo->hasChanged() ) if( m_pQueueInfo && m_pQueueInfo->hasChanged() )