Commit 0ada1973 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

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
parent 186e6911
Pipeline #21350 passed with stage
in 22 minutes and 11 seconds
......@@ -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>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="okular_part_viewermode" version="5">
<kpartgui name="okular_part_viewermode" version="6">
<MenuBar>
<Menu name="file"><text>&amp;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"/>
......
......@@ -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 );
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="okular_part" version="43">
<kpartgui name="okular_part" version="44">
<MenuBar>
<Menu name="file"><text>&amp;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"/>
......
......@@ -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
......
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment