vcl/unx/generic/print/genprnpsp.cxx | 49 +++--------------------------------- 1 file changed, 5 insertions(+), 44 deletions(-)
New commits: commit f139d60d424f7fdf9fd4d73d29298894737a3ea2 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Aug 26 14:34:36 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Aug 27 07:30:29 2024 +0200 vcl: Merge PrinterUpdate code into SalGenericInstance Move the logic from `PrinterUpdate::update` and `PrinterUpdate::doUpdate` directly into `SalGenericInstance::updatePrinterUpdate` and drop the extra helper class `PrinterUpdate` altogether. This also allows dropping retrieving the `SalGenericInstance` using SalGenericInstance *pInst = GetGenericInstance(); , as that is the object itself (`this`) in `SalGenericInstance::updatePrinterUpdate`. Change-Id: Ie201bead42f51b976c4bbffd6da650280bb45925 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172400 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index ad006d60a869..b9dd1ec6f465 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -1018,43 +1018,21 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo return true; } -namespace { - -class PrinterUpdate -{ - static void doUpdate(); -public: - static void update(SalGenericInstance const &rInstance); -}; - -} - -void PrinterUpdate::doUpdate() -{ - ::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() ); - SalGenericInstance *pInst = GetGenericInstance(); - if( pInst && rManager.checkPrintersChanged( false ) ) - pInst->PostPrintersChanged(); -} - -void PrinterUpdate::update(SalGenericInstance const &rInstance) +void SalGenericInstance::updatePrinterUpdate() { if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() ) return; - if( ! rInstance.isPrinterInit() ) + if (!isPrinterInit()) { // #i45389# start background printer detection psp::PrinterInfoManager::get(); return; } - doUpdate(); -} - -void SalGenericInstance::updatePrinterUpdate() -{ - PrinterUpdate::update(*this); + ::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() ); + if (rManager.checkPrintersChanged(false)) + PostPrintersChanged(); } void SalGenericInstance::jobEndedPrinterUpdate() commit 6ff0fde4c31196312d0f6fc74db1d67117a0e486 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Aug 26 14:26:26 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Aug 27 07:30:22 2024 +0200 vcl: Drop always null PrinterUpdate::pPrinterUpdateIdle After Change-Id: I431171094d4981552f641af89940d877147ffa71 Author: Michael Weghorn <[email protected]> Date: Mon Aug 26 14:18:46 2024 +0200 vcl: Drop logically dead "PrinterUpdate::nActiveJobs > 0" code , it's clear that `PrinterUpdate::pPrinterUpdateIdle` is always nullptr, so drop it and `PrinterUpdate::jobEnded`. Change-Id: Ieb1e1fdabc98d8d612a0af2c68f1dcdfc17852cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172399 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index c2beec916b56..ad006d60a869 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -1022,18 +1022,13 @@ namespace { class PrinterUpdate { - static Idle* pPrinterUpdateIdle; - static void doUpdate(); public: static void update(SalGenericInstance const &rInstance); - static void jobEnded(); }; } -Idle* PrinterUpdate::pPrinterUpdateIdle = nullptr; - void PrinterUpdate::doUpdate() { ::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() ); @@ -1062,20 +1057,8 @@ void SalGenericInstance::updatePrinterUpdate() PrinterUpdate::update(*this); } -void PrinterUpdate::jobEnded() -{ - if( pPrinterUpdateIdle ) - { - pPrinterUpdateIdle->Stop(); - delete pPrinterUpdateIdle; - pPrinterUpdateIdle = nullptr; - doUpdate(); - } -} - void SalGenericInstance::jobEndedPrinterUpdate() { - PrinterUpdate::jobEnded(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
