diff --git a/doc/index.docbook b/doc/index.docbook --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1438,22 +1438,6 @@ to a value that, depending on the size relation between the page and the view area, automatically either makes the pages' width equal to the document view's width (like fit-width), the pages' height equal to the document view's height (like fit-height), or the whole page visible (like fit-page). - - - - View - Continuous - - - - Enable the continuous page mode. In continuous mode, - all pages of the document are shown, and you can scroll through - them without having to use the Go - Previous Page and - GoNext Page - options. - - @@ -1468,6 +1452,10 @@ Facing Pages (Center First Page) and Overview (the number of columns is the one specified in the &okular; settings). + Additionally, you can enable the Continuous mode. + In continuous mode, all pages of the document are shown, and you can smoothly + scroll through them. Otherwise, only one page (or one row of pages) is shown + at a time. diff --git a/part-viewermode.rc b/part-viewermode.rc --- a/part-viewermode.rc +++ b/part-viewermode.rc @@ -1,5 +1,5 @@ - + &File @@ -26,7 +26,6 @@ - &Orientation diff --git a/part.rc b/part.rc --- a/part.rc +++ b/part.rc @@ -1,5 +1,5 @@ - + &File @@ -37,7 +37,6 @@ - &Orientation diff --git a/ui/pageview.cpp b/ui/pageview.cpp --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -228,6 +228,7 @@ KToggleAction * aZoomFitPage; KToggleAction * aZoomAutoFit; KActionMenu * aViewMode; + QActionGroup * aViewModeActionGroup; KToggleAction * aViewContinuous; QAction * aPrevAction; QAction * aToggleForms; @@ -554,36 +555,45 @@ ac->addAction( QStringLiteral("fit_window_to_page"), d->aFitWindowToPage ); connect( d->aFitWindowToPage, &QAction::triggered, this, &PageView::slotFitWindowToPage ); - // View-Layout actions + // View Mode action menu (Single Page, Facing Pages,...(choose), and Continuous (on/off)) d->aViewMode = new KActionMenu( QIcon::fromTheme( QStringLiteral("view-split-left-right") ), i18n( "&View Mode" ), this ); d->aViewMode->setDelayed( false ); -#define ADD_VIEWMODE_ACTION( text, name, id ) \ -do { \ - QAction *vm = new QAction( text, this ); \ - vm->setCheckable( true ); \ - vm->setData( qVariantFromValue( id ) ); \ - d->aViewMode->addAction( vm ); \ - ac->addAction( QStringLiteral(name), vm ); \ - vmGroup->addAction( vm ); \ -} while( 0 ) - ac->addAction(QStringLiteral("view_render_mode"), d->aViewMode ); - QActionGroup *vmGroup = new QActionGroup( this ); //d->aViewMode->menu() ); - ADD_VIEWMODE_ACTION( i18n( "Single Page" ), "view_render_mode_single", (int)Okular::Settings::EnumViewMode::Single ); - ADD_VIEWMODE_ACTION( i18n( "Facing Pages" ), "view_render_mode_facing", (int)Okular::Settings::EnumViewMode::Facing ); - ADD_VIEWMODE_ACTION( i18n( "Facing Pages (Center First Page)" ), "view_render_mode_facing_center_first", (int)Okular::Settings::EnumViewMode::FacingFirstCentered ); - ADD_VIEWMODE_ACTION( i18n( "Overview" ), "view_render_mode_overview", (int)Okular::Settings::EnumViewMode::Summary ); - const QList viewModeActions = d->aViewMode->menu()->actions(); - foreach(QAction *viewModeAction, viewModeActions) - { - if (viewModeAction->data().toInt() == Okular::Settings::viewMode()) + ac->addAction( QStringLiteral( "view_render_mode" ), d->aViewMode ); + + d->aViewModeActionGroup = new QActionGroup( this ); + auto addViewMode = [=] ( QAction * a, QString name, Okular::Settings::EnumViewMode::type id ) { + a->setCheckable( true ); + a->setData( int( id ) ); + d->aViewMode->addAction( a ); + ac->addAction( name, a ); + d->aViewModeActionGroup->addAction( a ); + }; + addViewMode( new QAction( i18nc( "@item:inmenu", "&Single Page" ), this ), + "view_render_mode_single", + Okular::Settings::EnumViewMode::Single ); + addViewMode( new QAction( i18nc( "@item:inmenu", "&Facing Pages" ), this ), + "view_render_mode_single", + Okular::Settings::EnumViewMode::Facing ); + addViewMode( new QAction( i18nc( "@item:inmenu", "Facing Pages (&Center First Page)" ), this ), + "view_render_mode_single", + Okular::Settings::EnumViewMode::FacingFirstCentered ); + addViewMode( new QAction( i18nc( "@item:inmenu", "&Overview" ), this ), + "view_render_mode_single", + Okular::Settings::EnumViewMode::Summary ); + for ( QAction * action : d->aViewModeActionGroup->actions() ) + { + if ( action->data().toInt() == Okular::Settings::viewMode() ) { - viewModeAction->setChecked( true ); + action->setChecked( true ); + break; } } - connect( vmGroup, &QActionGroup::triggered, this, &PageView::slotViewMode ); -#undef ADD_VIEWMODE_ACTION + connect( d->aViewModeActionGroup, &QActionGroup::triggered, this, &PageView::slotViewMode ); + // Continuous view action, add to view mode action menu. + d->aViewMode->addSeparator(); d->aViewContinuous = new KToggleAction(QIcon::fromTheme( QStringLiteral("view-list-text") ), i18n("&Continuous"), this); + d->aViewMode->addAction(d->aViewContinuous); ac->addAction(QStringLiteral("view_continuous"), d->aViewContinuous ); connect( d->aViewContinuous, &QAction::toggled, this, &PageView::slotContinuousToggled ); d->aViewContinuous->setChecked( Okular::Settings::viewContinuous() );