[graphics/okular] /: Remove the "Page Sizes" action from the menu

Albert Astals Cid null at kde.org
Tue May 26 22:05:30 BST 2020


Git commit 0ada1973255ea36757e2f61ace5df045a0f015a1 by Albert Astals Cid.
Committed on 24/05/2020 at 17:35.
Pushed by aacid into branch 'master'.

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

M  +0    -19   doc/index.docbook
M  +1    -2    part-viewermode.rc
M  +1    -1    part.cpp
M  +1    -2    part.rc
M  +2    -37   ui/pageview.cpp
M  +1    -2    ui/pageview.h

https://invent.kde.org/graphics/okular/commit/0ada1973255ea36757e2f61ace5df045a0f015a1

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.)
 						</para>
 					</listitem>
 				</varlistentry>
-				<varlistentry>
-					<term>
-						<menuchoice>
-							<guimenu>View</guimenu>
-							<guisubmenu>Page Size</guisubmenu>
-						</menuchoice>
-					</term>
-					<listitem>
-						<para>
-							<action>Changes the size of the pages</action> of the document.
-						</para>
-						<note>
-							<para>
-								This submenu is active only if the current type of document
-								supports different page sizes.
-							</para>
-						</note>
-					</listitem>
-				</varlistentry>
 				<varlistentry>
 					<term>
 						<menuchoice>
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 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="okular_part_viewermode" version="5">
+<kpartgui name="okular_part_viewermode" version="6">
 
 <MenuBar>
   <Menu name="file"><text>&File</text>
@@ -33,7 +33,6 @@
     <Action name="view_orientation_rotate_cw" group="viewer_menu_merge"/>
     <Action name="view_orientation_original" group="viewer_menu_merge"/>
   </Menu>
-  <Action name="view_pagesizes" group="viewer_menu_merge"/>
   <Action name="view_trim" group="viewer_menu_merge"/>
   <Separator group="viewer_menu_merge"/>
   <Action name="go_previous" group="viewer_menu_merge"/>
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 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="okular_part" version="43">
+<kpartgui name="okular_part" version="44">
 <MenuBar>
   <Menu name="file"><text>&File</text>
     <Action name="get_new_stuff" group="file_open"/>
@@ -45,7 +45,6 @@
       <Action name="view_orientation_rotate_cw"/>
       <Action name="view_orientation_original"/>
     </Menu>
-    <Action name="view_pagesizes"/>
     <Action name="view_trim_mode"/>
     <Separator/>
     <Action name="view_toggle_forms"/>
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<int>::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<Okular::PageSize> 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();


More information about the kde-doc-english mailing list