diff --git a/part.h b/part.h --- a/part.h +++ b/part.h @@ -204,6 +204,8 @@ void slotRenameBookmarkFromMenu(); void slotRemoveBookmarkFromMenu(); void slotRenameCurrentViewportBookmark(); + void slotRotateAntiClockwise(); + void slotRotateClockwise(); void slotPreviousBookmark(); void slotNextBookmark(); void slotFindNext(); @@ -371,6 +373,8 @@ QAction *m_exportAs; QAction *m_exportAsText; QAction *m_exportAsDocArchive; + QAction *m_rotateClockwise; + QAction *m_rotateAntiClockwise; #if PURPOSE_FOUND QAction *m_share; #endif diff --git a/part.cpp b/part.cpp --- a/part.cpp +++ b/part.cpp @@ -116,6 +116,7 @@ #include "core/document_p.h" #include "core/generator.h" #include "core/page.h" +#include "core/page_p.h" #include "core/fileprinter.h" #include @@ -704,6 +705,16 @@ m_renameBookmark->setWhatsThis( i18n( "Rename the current bookmark" ) ); connect( m_renameBookmark, &QAction::triggered, this, &Part::slotRenameCurrentViewportBookmark ); + m_rotateAntiClockwise = ac->addAction(QStringLiteral("Rotate Left")); + m_rotateAntiClockwise->setText(i18n("Rotate Left")); + m_rotateAntiClockwise->setIcon(QIcon::fromTheme(QStringLiteral("object-rotate-left"))); + connect(m_rotateAntiClockwise, &QAction::triggered, this, &Part::slotRotateAntiClockwise); + + m_rotateClockwise = ac->addAction(QStringLiteral("Rotate Right")); + m_rotateClockwise->setText(i18n("Rotate Right")); + m_rotateClockwise->setIcon(QIcon::fromTheme(QStringLiteral("object-rotate-right"))); + connect(m_rotateClockwise, &QAction::triggered, this, &Part::slotRotateClockwise); + m_prevBookmark = ac->addAction(QStringLiteral("previous_bookmark")); m_prevBookmark->setText(i18n( "Previous Bookmark" )); m_prevBookmark->setIcon(QIcon::fromTheme( QStringLiteral("go-up-search") )); @@ -2431,6 +2442,21 @@ return ba; } +void Part::slotRotateAntiClockwise() +{ + const Okular::Page *page = m_document->page( m_document->viewport().pageNumber ); + //int value = ( (int)m_pageView->d->document->rotation() + 3 ) % 4; + int value = ( page->rotation() + 3 ) % 4; + page->d->rotateAt( static_cast(value) ); +} + +void Part::slotRotateClockwise() +{ + const Okular::Page *page = m_document->page( m_document->viewport().pageNumber ); + int value = ( page->rotation() + 3 ) % 4; + page->d->rotateAt( static_cast(value) ); +} + void Part::slotPreviousBookmark() { const KBookmark bookmark = m_document->bookmarkManager()->previousBookmark( m_document->viewport() ); @@ -3074,6 +3100,8 @@ if (page) { popup->addAction( new OKMenuTitle( popup, i18n( "Page %1", page->number() + 1 ) ) ); + popup->addAction( m_rotateAntiClockwise ); + popup->addAction( m_rotateClockwise ); if ( ( !currentPage && m_document->bookmarkManager()->isBookmarked( page->number() ) ) || ( currentPage && m_document->bookmarkManager()->isBookmarked( m_document->viewport() ) ) ) removeBookmark = popup->addAction( QIcon::fromTheme(QStringLiteral("edit-delete-bookmark")), i18n("Remove Bookmark") );