From 0ada1973255ea36757e2f61ace5df045a0f015a1 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 24 May 2020 18:54:32 +0200 Subject: [PATCH] Remove the "Page Sizes" action from the menu It's only enabled when the document supports multiple page sizes, that at the time of writing (and since 13 years) is none So not great to have an always disabled menu :D The backend part (Document::supportsPageSizes) is still there, so if we ever reintroduce a backend that supports it part of the code is there, and probably we may want to rethink the UI so it only shows when useful, and not being disabled without possibility of enabling it for say PDF --- doc/index.docbook | 19 ------------------- part-viewermode.rc | 3 +-- part.cpp | 2 +- part.rc | 3 +-- ui/pageview.cpp | 39 ++------------------------------------- ui/pageview.h | 3 +-- 6 files changed, 6 insertions(+), 63 deletions(-) diff --git a/doc/index.docbook b/doc/index.docbook index 9dbc4821d..26fe49551 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1552,25 +1552,6 @@ Context menu actions like Rename Bookmarks etc.) - - - - View - Page Size - - - - - Changes the size of the pages of the document. - - - - This submenu is active only if the current type of document - supports different page sizes. - - - - diff --git a/part-viewermode.rc b/part-viewermode.rc index f281baa4e..862679a30 100644 --- a/part-viewermode.rc +++ b/part-viewermode.rc @@ -1,5 +1,5 @@ - + &File @@ -33,7 +33,6 @@ - diff --git a/part.cpp b/part.cpp index 0ba257899..b79e6056b 100644 --- a/part.cpp +++ b/part.cpp @@ -641,7 +641,7 @@ m_cliPresentation(false), m_cliPrint(false), m_cliPrintAndExit(false), m_embedMo updateViewActions(); // also update the state of the actions in the page view - m_pageView->updateActionState( false, false, false ); + m_pageView->updateActionState( false, false ); if ( m_embedMode == NativeShellMode ) m_sidebar->setAutoFillBackground( false ); diff --git a/part.rc b/part.rc index 48649b522..f71168ca8 100644 --- a/part.rc +++ b/part.rc @@ -1,5 +1,5 @@ - + &File @@ -45,7 +45,6 @@ - diff --git a/ui/pageview.cpp b/ui/pageview.cpp index 50f8073ec..7318e9603 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -215,7 +215,6 @@ public: QAction * aRotateClockwise; QAction * aRotateCounterClockwise; QAction * aRotateOriginal; - KSelectAction * aPageSizes; KActionMenu * aTrimMode; KToggleAction * aTrimMargins; QAction * aMouseNormal; @@ -368,7 +367,6 @@ PageView::PageView( QWidget *parent, Okular::Document *document ) d->aRotateClockwise = nullptr; d->aRotateCounterClockwise = nullptr; d->aRotateOriginal = nullptr; - d->aPageSizes = nullptr; d->aTrimMode = nullptr; d->aTrimMargins = nullptr; d->aTrimToSelection = nullptr; @@ -389,7 +387,6 @@ PageView::PageView( QWidget *parent, Okular::Document *document ) d->aSpeakStop = nullptr; d->aSpeakPauseResume = nullptr; d->actionCollection = nullptr; - d->aPageSizes=nullptr; d->setting_viewCols = Okular::Settings::viewColumns(); d->rtl_Mode = Okular::Settings::rtlReadingDirection(); d->mouseModeActionGroup = nullptr; @@ -567,13 +564,6 @@ void PageView::setupViewerActions( KActionCollection * ac ) d->aRotateOriginal->setEnabled( false ); connect( d->aRotateOriginal, &QAction::triggered, this, &PageView::slotRotateOriginal ); - d->aPageSizes = new KSelectAction(i18n("&Page Size"), this); - ac->addAction(QStringLiteral("view_pagesizes"), d->aPageSizes); - d->aPageSizes->setEnabled( false ); - - connect( d->aPageSizes , QOverload::of(&KSelectAction::triggered), - this, &PageView::slotPageSizes ); - // Trim View actions d->aTrimMode = new KActionMenu(i18n( "&Trim View" ), this ); d->aTrimMode->setDelayed( false ); @@ -1221,7 +1211,7 @@ void PageView::notifySetup( const QVector< Okular::Page * > & pageSet, int setup QString(), PageViewMessage::Info, 4000 ); - updateActionState( haspages, documentChanged, hasformwidgets ); + updateActionState( haspages, hasformwidgets ); // We need to assign it to a different list otherwise slotAnnotationWindowDestroyed // will bite us and clear d->m_annowindows @@ -1232,25 +1222,8 @@ void PageView::notifySetup( const QVector< Okular::Page * > & pageSet, int setup selectionClear(); } -void PageView::updateActionState( bool haspages, bool documentChanged, bool hasformwidgets ) +void PageView::updateActionState( bool haspages, bool hasformwidgets ) { - if ( d->aPageSizes ) - { // may be null if dummy mode is on - bool pageSizes = d->document->supportsPageSizes(); - d->aPageSizes->setEnabled( pageSizes ); - // set the new page sizes: - // - if the generator supports them - // - if the document changed - if ( pageSizes && documentChanged ) - { - QStringList items; - const QList sizes = d->document->pageSizes(); - for ( const Okular::PageSize &p : sizes ) - items.append( p.name() ); - d->aPageSizes->setItems( items ); - } - } - if ( d->aTrimMargins ) d->aTrimMargins->setEnabled( haspages ); @@ -5436,14 +5409,6 @@ void PageView::slotRotateOriginal() d->document->setRotation( 0 ); } -void PageView::slotPageSizes( int newsize ) -{ - if ( newsize < 0 || newsize >= d->document->pageSizes().count() ) - return; - - d->document->setPageSize( d->document->pageSizes().at( newsize ) ); -} - // Enforce mutual-exclusion between trim modes // Each mode is uniquely identified by a single value // From Okular::Settings::EnumTrimMode diff --git a/ui/pageview.h b/ui/pageview.h index 614735140..1cfeb043c 100644 --- a/ui/pageview.h +++ b/ui/pageview.h @@ -70,7 +70,7 @@ Q_OBJECT void setupBaseActions( KActionCollection * ac ); void setupViewerActions( KActionCollection * ac ); void setupActions( KActionCollection * ac ); - void updateActionState( bool docHasPages, bool documentChanged, bool docHasFormWidgets ); + void updateActionState( bool docHasPages, bool docHasFormWidgets ); // misc methods (from RMB menu/children) bool canFitPageWidth() const; @@ -267,7 +267,6 @@ Q_OBJECT void slotRotateClockwise(); void slotRotateCounterClockwise(); void slotRotateOriginal(); - void slotPageSizes( int ); void slotTrimMarginsToggled( bool ); void slotTrimToSelectionToggled( bool ); void slotToggleForms();