From 08c6e651148410acea2d23567ce4bffd2b1c4b63 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Wed, 16 Apr 2025 10:58:59 +0300 Subject: KPDF Shell: fix printing action Signed-off-by: Mavridis Philippe (cherry picked from commit 65c9ed251d7726102bff3b5f4d2c6729433be4b1) --- kpdf/shell/shell.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'kpdf/shell/shell.cpp') diff --git a/kpdf/shell/shell.cpp b/kpdf/shell/shell.cpp index ed9f27cb..b1f60bd7 100644 --- a/kpdf/shell/shell.cpp +++ b/kpdf/shell/shell.cpp @@ -203,7 +203,7 @@ void Shell::setupActions() m_recent = KStdAction::openRecent( this, TQ_SLOT(openURL(const KURL&)), actionCollection()); connect(m_recent, TQ_SIGNAL(activated()), openAction, TQ_SLOT( activate())); m_recent->setWhatsThis(i18n("Click to open a file or Click and hold to select a recent file")); - m_printAction = KStdAction::print(m_manager->activePart(), TQ_SLOT(slotPrint()), actionCollection()); + m_printAction = KStdAction::print(this, TQ_SLOT(slotPrint()), actionCollection()); m_printAction->setEnabled(false); KStdAction::quit(this, TQ_SLOT(slotQuit()), actionCollection()); @@ -299,6 +299,20 @@ void Shell::applyNewToolbarConfig() applyMainWindowSettings(TDEGlobal::config(), "MainWindow"); } +void Shell::slotSetPrintActionEnabled(bool enabled) +{ + const KParts::Part *part = static_cast(TQObject::sender()); + if (part == m_manager->activePart()) + { + m_printAction->setEnabled(enabled); + } +} + +void Shell::slotPrint() +{ + TQTimer::singleShot(0, m_manager->activePart(), TQ_SLOT(slotPrint())); +} + void Shell::slotQuit() { kapp->closeAllWindows(); @@ -364,7 +378,7 @@ KParts::ReadOnlyPart* Shell::createTab() connect(this, TQ_SIGNAL(saveDocumentRestoreInfo(TDEConfig*)), part, TQ_SLOT(saveDocumentRestoreInfo(TDEConfig*))); connect(part, TQ_SIGNAL(enablePrintAction(bool)), - m_printAction, TQ_SLOT(setEnabled(bool))); + this, TQ_SLOT(slotSetPrintActionEnabled(bool))); connect(part, TQ_SIGNAL(setWindowCaption(const TQString&)), this, TQ_SLOT(slotSetTabCaption(const TQString&))); -- cgit v1.2.3