diff --git a/core/page.h b/core/page.h --- a/core/page.h +++ b/core/page.h @@ -393,11 +393,12 @@ * @since 0.19 (KDE 4.13) */ QList tilesAt( const DocumentObserver *observer, const NormalizedRect &rect ) const; - - private: + PagePrivate* d; - /// @cond PRIVATE friend class PagePrivate; + private: + //PagePrivate* d; + // @cond PRIVATE friend class Document; friend class DocumentPrivate; friend class PixmapRequestPrivate; diff --git a/part.h b/part.h --- a/part.h +++ b/part.h @@ -34,6 +34,8 @@ #include "core/observer.h" #include "core/document.h" +#include "core/page.h" +#include "core/page_p.h" #include "kdocumentviewer.h" #include "interfaces/viewerinterface.h" @@ -75,6 +77,7 @@ class DrawingToolActions; class Layers; class SignaturePanel; +class PagePrivate; #if PURPOSE_FOUND namespace Purpose { class Menu; } @@ -204,6 +207,8 @@ void slotRenameBookmarkFromMenu(); void slotRemoveBookmarkFromMenu(); void slotRenameCurrentViewportBookmark(); + void slotRotateAntiClockwise(); + void slotRotateClockwise(); void slotPreviousBookmark(); void slotNextBookmark(); void slotFindNext(); @@ -371,6 +376,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 @@ -458,7 +459,7 @@ connect( m_signaturePanel.data(), &SignaturePanel::documentHasSignatures, this, &Part::showSidebarSignaturesItem ); m_sidebar->addItem( m_signaturePanel, QIcon::fromTheme(QStringLiteral("application-pkcs7-signature")), i18n("Signatures") ); showSidebarSignaturesItem( false ); - + // widgets: [../miniBarContainer] | [] #ifdef OKULAR_ENABLE_MINIBAR QWidget * miniBarContainer = new QWidget( 0 ); @@ -704,6 +705,18 @@ 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"))); + m_rotateAntiClockwise->setWhatsThis( i18n( "Rotate the selected page 90 degrees counter clockwise" ) ); + 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"))); + m_rotateClockwise->setWhatsThis( i18n( "Rotate the selected page 90 degrees clockwise" ) ); + 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 +2444,22 @@ return ba; } +void Part::slotRotateAntiClockwise() +{ + const Okular::Page *page = m_document->page( m_document->currentPage()); + int value = ( page->rotation() + 3 ) % 4; + page->d->rotateAt( static_cast(value) ); +} + +void Part::slotRotateClockwise() +{ + //int id = ( (int)d->document->rotation() + 3 ) % 4; + //d->document->setRotation( id ); + const Okular::Page *page = m_document->page( m_document->currentPage() ); + int value = ( page->rotation() + 1 ) % 4; + page->d->rotateAt( static_cast(value) ); +} + void Part::slotPreviousBookmark() { const KBookmark bookmark = m_document->bookmarkManager()->previousBookmark( m_document->viewport() ); @@ -3074,6 +3103,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") );