diff --git a/doc/index.docbook b/doc/index.docbook
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -1508,22 +1508,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
- Go Next Page
- options.
-
-
@@ -1538,6 +1522,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
@@ -38,7 +38,6 @@
-
&Orientation
diff --git a/ui/pageview.cpp b/ui/pageview.cpp
--- a/ui/pageview.cpp
+++ b/ui/pageview.cpp
@@ -232,7 +232,8 @@
KToggleAction * aZoomFitWidth;
KToggleAction * aZoomFitPage;
KToggleAction * aZoomAutoFit;
- KActionMenu * aViewMode;
+ KActionMenu * aViewModeMenu;
+ QActionGroup * viewModeActionGroup;
KToggleAction * aViewContinuous;
QAction * aPrevAction;
QAction * aToggleForms;
@@ -338,7 +339,7 @@
d->aRotateClockwise = nullptr;
d->aRotateCounterClockwise = nullptr;
d->aRotateOriginal = nullptr;
- d->aViewMode = nullptr;
+ d->aViewModeMenu = nullptr;
d->zoomMode = PageView::ZoomFitWidth;
d->zoomFactor = 1.0;
d->mouseSelecting = false;
@@ -378,8 +379,9 @@
d->aZoomFitWidth = nullptr;
d->aZoomFitPage = nullptr;
d->aZoomAutoFit = nullptr;
- d->aViewMode = nullptr;
+ d->aViewModeMenu = nullptr;
d->aViewContinuous = nullptr;
+ d->viewModeActionGroup = nullptr;
d->aPrevAction = nullptr;
d->aToggleForms = nullptr;
d->aSpeakDoc = nullptr;
@@ -608,36 +610,46 @@
ac->addAction( QStringLiteral("fit_window_to_page"), d->aFitWindowToPage );
connect( d->aFitWindowToPage, &QAction::triggered, this, &PageView::slotFitWindowToPage );
- // View-Layout actions
- 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( QVariant::fromValue( 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();
- for (QAction *viewModeAction : viewModeActions)
- {
- if (viewModeAction->data().toInt() == Okular::Settings::viewMode())
+ // View Mode action menu (Single Page, Facing Pages,...(choose), and Continuous (on/off))
+ d->aViewModeMenu = new KActionMenu( QIcon::fromTheme( QStringLiteral("view-split-left-right") ), i18n( "&View Mode" ), this );
+ d->aViewModeMenu->setDelayed( false );
+ ac->addAction( QStringLiteral( "view_render_mode" ), d->aViewModeMenu );
+
+ d->viewModeActionGroup = new QActionGroup( this );
+ auto addViewMode = [=] ( QAction * a, const QString &name, Okular::Settings::EnumViewMode::type id ) {
+ a->setCheckable( true );
+ a->setData( int( id ) );
+ d->aViewModeMenu->addAction( a );
+ ac->addAction( name, a );
+ d->viewModeActionGroup->addAction( a );
+ };
+ addViewMode( new QAction( i18nc( "@item:inmenu", "&Single Page" ), this ),
+ QStringLiteral("view_render_mode_single"),
+ Okular::Settings::EnumViewMode::Single );
+ addViewMode( new QAction( i18nc( "@item:inmenu", "&Facing Pages" ), this ),
+ QStringLiteral("view_render_mode_single"),
+ Okular::Settings::EnumViewMode::Facing );
+ addViewMode( new QAction( i18nc( "@item:inmenu", "Facing Pages (&Center First Page)" ), this ),
+ QStringLiteral("view_render_mode_single"),
+ Okular::Settings::EnumViewMode::FacingFirstCentered );
+ addViewMode( new QAction( i18nc( "@item:inmenu", "&Overview" ), this ),
+ QStringLiteral("view_render_mode_single"),
+ Okular::Settings::EnumViewMode::Summary );
+ const QList< QAction* > viewModeActions = d->viewModeActionGroup->actions();
+ for ( QAction * viewModeAction : viewModeActions )
+ {
+ if ( viewModeAction->data().toInt() == Okular::Settings::viewMode() )
{
viewModeAction->setChecked( true );
+ break;
}
}
- connect( vmGroup, &QActionGroup::triggered, this, &PageView::slotViewMode );
-#undef ADD_VIEWMODE_ACTION
+ connect( d->viewModeActionGroup, &QActionGroup::triggered, this, &PageView::slotViewMode );
+ // Continuous view action, add to view mode action menu.
+ d->aViewModeMenu->addSeparator();
d->aViewContinuous = new KToggleAction(QIcon::fromTheme( QStringLiteral("view-list-text") ), i18n("&Continuous"), this);
+ d->aViewModeMenu->addAction(d->aViewContinuous);
ac->addAction(QStringLiteral("view_continuous"), d->aViewContinuous );
connect( d->aViewContinuous, &QAction::toggled, this, &PageView::slotContinuousToggled );
d->aViewContinuous->setChecked( Okular::Settings::viewContinuous() );
@@ -806,7 +818,7 @@
d->aZoomFitWidth->setChecked( true );
d->aZoomFitPage->setChecked( false );
d->aZoomAutoFit->setChecked( false );
- d->aViewMode->menu()->actions().at( 0 )->setChecked( true );
+ updateViewMode( 0 );
viewport()->setUpdatesEnabled( false );
slotRelayoutPages();
viewport()->setUpdatesEnabled( true );
@@ -1241,8 +1253,8 @@
if ( d->aTrimToSelection )
d->aTrimToSelection->setEnabled( haspages );
- if ( d->aViewMode )
- d->aViewMode->setEnabled( haspages );
+ if ( d->aViewModeMenu )
+ d->aViewModeMenu->setEnabled( haspages );
if ( d->aViewContinuous )
d->aViewContinuous->setEnabled( haspages );
@@ -1610,12 +1622,16 @@
return d->aViewContinuous ? d->aViewContinuous->isChecked() : true;
case ViewModeModality:
{
- const int nActions = d->aViewMode ? d->aViewMode->menu()->actions().size() : 0;
- for (int i=0; i < nActions; ++i)
+ if ( d->viewModeActionGroup )
{
- const QAction* action = d->aViewMode->menu()->actions().at(i);
- if ( action->isChecked() )
- return action->data();
+ const QList actions = d->viewModeActionGroup->actions();
+ for ( const QAction* action : actions )
+ {
+ if (action->isChecked())
+ {
+ return action->data();
+ }
+ }
}
return QVariant();
}
@@ -4272,7 +4288,7 @@
void PageView::updateViewMode(const int nr)
{
- const QList actions = d->aViewMode->menu()->actions();
+ const QList actions = d->viewModeActionGroup->actions();
for ( QAction* action : actions ) {
QVariant mode_id = action->data();
if (mode_id.toInt() == nr) {