Hello community,

here is the log from the commit of package okular for openSUSE:Factory checked 
in at 2016-05-31 12:19:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/okular (Old)
 and      /work/SRC/openSUSE:Factory/.okular.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "okular"

Changes:
--------
--- /work/SRC/openSUSE:Factory/okular/okular.changes    2016-03-26 
15:19:45.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.okular.new/okular.changes       2016-05-31 
12:19:58.000000000 +0200
@@ -1,0 +2,24 @@
+Sat May  7 10:44:25 UTC 2016 - tittiatc...@gmail.com
+
+- Update to KDE Applications 16.04.1
+   * KDE Applications 16.04.1
+   * https://www.kde.org/announcements/announce-applications-16.04.1.php
+
+
+-------------------------------------------------------------------
+Sun Apr 17 06:20:31 UTC 2016 - tittiatc...@gmail.com
+
+- Update to KDE Applications 16.04.0
+   * KDE Applications 16.04.0
+   * https://www.kde.org/announcements/announce-applications-16.04.0.php
+
+
+-------------------------------------------------------------------
+Mon Apr 11 06:55:30 UTC 2016 - tittiatc...@gmail.com
+
+- Update to KDE Applications 16.03.90
+   * KDE Applications 16.04.0 RC
+   * https://www.kde.org/announcements/announce-applications-16.04-rc.php
+
+
+-------------------------------------------------------------------

Old:
----
  okular-15.12.3.tar.xz

New:
----
  okular-16.04.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ okular.spec ++++++
--- /var/tmp/diff_new_pack.2b10bb/_old  2016-05-31 12:19:59.000000000 +0200
+++ /var/tmp/diff_new_pack.2b10bb/_new  2016-05-31 12:19:59.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           okular
-Version:        15.12.3
+Version:        16.04.1
 Release:        0
 Summary:        Document Viewer
 License:        GPL-2.0+

++++++ okular-15.12.3.tar.xz -> okular-16.04.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/cmake/modules/FindPoppler.cmake 
new/okular-16.04.1/cmake/modules/FindPoppler.cmake
--- old/okular-15.12.3/cmake/modules/FindPoppler.cmake  2016-02-12 
06:08:29.000000000 +0100
+++ new/okular-16.04.1/cmake/modules/FindPoppler.cmake  2016-04-13 
22:08:21.000000000 +0200
@@ -162,7 +162,7 @@
     set(popplerVersionMessage "0.12.1")
   else (HAVE_POPPLER_0_28)
     set(popplerVersionMessage "0.5.4")
-  endif (HAVE_POPPLER_0_28)
+  endif ()
   if (NOT Poppler_FIND_QUIETLY)
     message(STATUS "Found Poppler-Qt4: ${POPPLER_LIBRARY}, (>= 
${popplerVersionMessage})")
   endif (NOT Poppler_FIND_QUIETLY)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/conf/widgetannottools.cpp 
new/okular-16.04.1/conf/widgetannottools.cpp
--- old/okular-15.12.3/conf/widgetannottools.cpp        2016-02-12 
06:08:29.000000000 +0100
+++ new/okular-16.04.1/conf/widgetannottools.cpp        2016-04-13 
22:08:21.000000000 +0200
@@ -360,6 +360,7 @@
         engineElement.setAttribute( "block", "true" );
         annotationElement.setAttribute( "type", "FreeText" );
         annotationElement.setAttribute( "color", color );
+        annotationElement.setAttribute( "width", width );
         if ( ta->inplaceAlignment() != 0 )
             annotationElement.setAttribute( "align", ta->inplaceAlignment() );
         if ( ta->textFont() != QApplication::font() )
@@ -495,6 +496,7 @@
     {
         Okular::TextAnnotation * ta = new Okular::TextAnnotation();
         ta->setTextType( Okular::TextAnnotation::InPlace );
+        ta->style().setWidth( 1.0 );
         ta->style().setColor( Qt::yellow );
         m_stubann = ta;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/core/version.h 
new/okular-16.04.1/core/version.h
--- old/okular-15.12.3/core/version.h   2016-02-12 06:08:29.000000000 +0100
+++ new/okular-16.04.1/core/version.h   2016-04-13 22:08:21.000000000 +0200
@@ -10,10 +10,10 @@
 #ifndef _OKULAR_VERSION_H_
 #define _OKULAR_VERSION_H_
 
-#define OKULAR_VERSION_STRING "0.24.2"
+#define OKULAR_VERSION_STRING "0.25.0"
 #define OKULAR_VERSION_MAJOR 0
-#define OKULAR_VERSION_MINOR 24
-#define OKULAR_VERSION_RELEASE 2
+#define OKULAR_VERSION_MINOR 25
+#define OKULAR_VERSION_RELEASE 0
 #define OKULAR_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
 
 #define OKULAR_VERSION \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/tests/parttest.cpp 
new/okular-16.04.1/tests/parttest.cpp
--- old/okular-15.12.3/tests/parttest.cpp       2016-02-12 06:08:29.000000000 
+0100
+++ new/okular-16.04.1/tests/parttest.cpp       2016-04-13 22:08:21.000000000 
+0200
@@ -121,7 +121,20 @@
     QProcess process;
     process.setWorkingDirectory(tempDir.name());
     process.start("pdflatex", QStringList() << "-synctex=1" << 
"-interaction=nonstopmode" << texDestination);
+    bool started = process.waitForStarted();
+    if (!started) {
+        qDebug() << "start error:" << process.error();
+        qDebug() << "start stdout:" << process.readAllStandardOutput();
+        qDebug() << "start stderr:" << process.readAllStandardError();
+    }
+    QVERIFY(started);
+
     process.waitForFinished();
+    if (process.exitStatus() != QProcess::NormalExit || process.exitCode() != 
0) {
+        qDebug() << "exit error:" << process.error() << "status" << 
process.exitStatus() << "code" << process.exitCode();
+        qDebug() << "exit stdout:" << process.readAllStandardOutput();
+        qDebug() << "exit stderr:" << process.readAllStandardError();
+    }
 
     const QString pdfResult = tempDir.name() + "synctextest.pdf";
     
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/annotationwidgets.cpp 
new/okular-16.04.1/ui/annotationwidgets.cpp
--- old/okular-15.12.3/ui/annotationwidgets.cpp 2016-02-12 06:08:29.000000000 
+0100
+++ new/okular-16.04.1/ui/annotationwidgets.cpp 2016-04-13 22:08:21.000000000 
+0200
@@ -289,8 +289,18 @@
         m_textAlign->addItem( i18n("Right") );
         m_textAlign->setCurrentIndex( m_textAnn->inplaceAlignment() );
 
+        tmplabel = new QLabel( i18n( "Border Width:" ), widget );
+        innerlay->addWidget( tmplabel, 2, 0, Qt::AlignRight );
+        m_spinWidth = new QDoubleSpinBox( widget );
+        innerlay->addWidget( m_spinWidth, 2, 1 );
+        tmplabel->setBuddy( m_spinWidth );
+        m_spinWidth->setRange( 0, 100 );
+        m_spinWidth->setValue( m_textAnn->style().width() );
+        m_spinWidth->setSingleStep( 0.1 );
+
         connect( m_fontReq, SIGNAL(fontSelected(QFont)), this, 
SIGNAL(dataChanged()) );
         connect( m_textAlign, SIGNAL(currentIndexChanged(int)), this, 
SIGNAL(dataChanged()) );
+        connect( m_spinWidth, SIGNAL(valueChanged(double)), this, 
SIGNAL(dataChanged()) );
     }
 
     return widget;
@@ -307,6 +317,7 @@
     {
         m_textAnn->setTextFont( m_fontReq->font() );
         m_textAnn->setInplaceAlignment( m_textAlign->currentIndex() );
+        m_textAnn->style().setWidth( m_spinWidth->value() );
     }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/annotationwidgets.h 
new/okular-16.04.1/ui/annotationwidgets.h
--- old/okular-15.12.3/ui/annotationwidgets.h   2016-02-12 06:08:29.000000000 
+0100
+++ new/okular-16.04.1/ui/annotationwidgets.h   2016-04-13 22:08:21.000000000 
+0200
@@ -116,6 +116,7 @@
     PixmapPreviewSelector * m_pixmapSelector;
     KFontRequester * m_fontReq;
     QComboBox * m_textAlign;
+    QDoubleSpinBox * m_spinWidth;
 };
 
 class StampAnnotationWidget
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/embeddedfilesdialog.cpp 
new/okular-16.04.1/ui/embeddedfilesdialog.cpp
--- old/okular-15.12.3/ui/embeddedfilesdialog.cpp       2016-02-12 
06:08:29.000000000 +0100
+++ new/okular-16.04.1/ui/embeddedfilesdialog.cpp       2016-04-13 
22:08:21.000000000 +0200
@@ -11,15 +11,19 @@
 
 #include <QAction>
 #include <QCursor>
+#include <QDir>
 #include <QDateTime>
+#include <QFileInfo>
 #include <QMenu>
 #include <QTreeWidget>
+#include <QTemporaryFile>
 
 #include <kglobal.h>
 #include <kicon.h>
 #include <klocale.h>
 #include <kmimetype.h>
 #include <kstandardguiitem.h>
+#include <krun.h>
 
 #include "core/document.h"
 #include "guiutils.h"
@@ -38,10 +42,12 @@
 EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const 
Okular::Document *document) : KDialog(parent)
 {
        setCaption(i18nc("@title:window", "Embedded Files"));
-       setButtons(Close | User1);
+       setButtons(Close | User1 | User2);
        setDefaultButton(Close);
        setButtonGuiItem(User1, KStandardGuiItem::save());
+       setButtonGuiItem(User2, KGuiItem(i18nc("@action:button", "View"), 
"document-open"));
        enableButton(User1, false);
+       enableButton(User2, false);
 
        m_tw = new QTreeWidget(this);
        setMainWidget(m_tw);
@@ -81,14 +87,18 @@
         m_tw->updateGeometry();
 
        connect(this, SIGNAL(user1Clicked()), this, SLOT(saveFile()));
+       connect(this, SIGNAL(user2Clicked()), this, SLOT(viewFile()));
+
        connect(m_tw, SIGNAL(customContextMenuRequested(QPoint)), this, 
SLOT(attachViewContextMenu(QPoint)));
        connect(m_tw, SIGNAL(itemSelectionChanged()), this, 
SLOT(updateSaveButton()));
+       connect(m_tw, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, 
SLOT(viewFileItem(QTreeWidgetItem*,int)));
 }
 
 void EmbeddedFilesDialog::updateSaveButton()
 {
        bool enable = (m_tw->selectedItems().count() > 0);
        enableButton(User1, enable);
+       enableButton(User2, enable);
 }
 
 void EmbeddedFilesDialog::saveFile()
@@ -101,6 +111,22 @@
        }
 }
 
+void EmbeddedFilesDialog::viewFile()
+{
+       QList<QTreeWidgetItem *> selected = m_tw->selectedItems();
+       foreach(QTreeWidgetItem *twi, selected)
+       {
+               Okular::EmbeddedFile* ef = qvariant_cast< Okular::EmbeddedFile* 
>( twi->data( 0, EmbeddedFileRole ) );
+               viewFile( ef );
+       }
+}
+
+void EmbeddedFilesDialog::viewFileItem( QTreeWidgetItem* item, int /*column*/ )
+{
+       Okular::EmbeddedFile* ef = qvariant_cast< Okular::EmbeddedFile* >( 
item->data( 0, EmbeddedFileRole ) );
+       viewFile( ef );
+}
+
 void EmbeddedFilesDialog::attachViewContextMenu( const QPoint& /*pos*/ )
 {
     QList<QTreeWidgetItem *> selected = m_tw->selectedItems();
@@ -112,16 +138,47 @@
 
     QMenu menu( this );
     QAction* saveAsAct = menu.addAction( KIcon( "document-save-as" ), i18nc( 
"@action:inmenu", "&Save As..." ) );
+    QAction* viewAct = menu.addAction( KIcon( "document-open" ), i18nc( 
"@action:inmenu", "&View..." ) );
 
     QAction* act = menu.exec( QCursor::pos() );
     if ( !act )
         return;
 
+    Okular::EmbeddedFile* ef = qvariant_cast< Okular::EmbeddedFile* >( 
selected.at( 0 )->data( 0, EmbeddedFileRole ) );
     if ( act == saveAsAct )
     {
-        Okular::EmbeddedFile* ef = qvariant_cast< Okular::EmbeddedFile* >( 
selected.at( 0 )->data( 0, EmbeddedFileRole ) );
         saveFile( ef );
     }
+    else if ( act == viewAct )
+    {
+        viewFile( ef );
+    }
+}
+
+void EmbeddedFilesDialog::viewFile( Okular::EmbeddedFile* ef )
+{
+       // get name and extension
+       QFileInfo fileInfo(ef->name());
+
+       // save in temporary directory with a unique name resembling the 
attachment name,
+       // using QTemporaryFile's XXXXXX placeholder
+       QTemporaryFile *tmpFile = new QTemporaryFile(
+               QDir::tempPath()
+               + QDir::separator()
+               + fileInfo.baseName()
+               + ".XXXXXX"
+               + (fileInfo.completeSuffix().isEmpty() ? QString("") : "." + 
fileInfo.completeSuffix())
+       );
+       GuiUtils::writeEmbeddedFile( ef, this, *tmpFile );
+
+       // set readonly to prevent the viewer application from modifying it
+       tmpFile->setPermissions( QFile::ReadOwner );
+
+       // keep temporary file alive while the dialog is open
+       m_openedFiles.push_back( QSharedPointer< QTemporaryFile >( tmpFile ) );
+
+       // view the temporary file with the default application
+       new KRun( QUrl( "file://" + tmpFile->fileName() ), this );
 }
 
 void EmbeddedFilesDialog::saveFile( Okular::EmbeddedFile* ef )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/embeddedfilesdialog.h 
new/okular-16.04.1/ui/embeddedfilesdialog.h
--- old/okular-15.12.3/ui/embeddedfilesdialog.h 2016-02-12 06:08:29.000000000 
+0100
+++ new/okular-16.04.1/ui/embeddedfilesdialog.h 2016-04-13 22:08:21.000000000 
+0200
@@ -13,6 +13,8 @@
 #include <kdialog.h>
 
 class QTreeWidget;
+class QTemporaryFile;
+class QTreeWidgetItem;
 
 namespace Okular {
 class Document;
@@ -29,11 +31,15 @@
                void saveFile();
                void attachViewContextMenu( const QPoint& pos );
                void updateSaveButton();
+               void viewFile();
+               void viewFileItem( QTreeWidgetItem* index, int column );
 
        private:
                void saveFile( Okular::EmbeddedFile* );
+               void viewFile( Okular::EmbeddedFile* );
 
                QTreeWidget *m_tw;
+               QList< QSharedPointer<QTemporaryFile> > m_openedFiles;
 };
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/guiutils.cpp 
new/okular-16.04.1/ui/guiutils.cpp
--- old/okular-15.12.3/ui/guiutils.cpp  2016-02-12 06:08:29.000000000 +0100
+++ new/okular-16.04.1/ui/guiutils.cpp  2016-04-13 22:08:21.000000000 +0200
@@ -206,15 +206,18 @@
                                                        
KFileDialog::ConfirmOverwrite );
     if ( path.isEmpty() )
         return;
+    QFile targetFile( path );
+    writeEmbeddedFile( ef, parent, targetFile );
+}
 
-    QFile f( path );
-    if ( !f.open( QIODevice::WriteOnly ) )
+void writeEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent, QFile& 
target ) {
+    if ( !target.open( QIODevice::WriteOnly ) )
     {
-        KMessageBox::error( parent, i18n( "Could not open \"%1\" for writing. 
File was not saved.", path ) );
+        KMessageBox::error( parent, i18n( "Could not open \"%1\" for writing. 
File was not saved.", target.fileName() ) );
         return;
     }
-    f.write( ef->data() );
-    f.close();
+    target.write( ef->data() );
+    target.close();
 }
 
 Okular::Movie* renditionMovieFromScreenAnnotation( const 
Okular::ScreenAnnotation *annotation )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/guiutils.h 
new/okular-16.04.1/ui/guiutils.h
--- old/okular-15.12.3/ui/guiutils.h    2016-02-12 06:08:29.000000000 +0100
+++ new/okular-16.04.1/ui/guiutils.h    2016-04-13 22:08:21.000000000 +0200
@@ -17,6 +17,7 @@
 class QPixmap;
 class QSize;
 class QWidget;
+class QFile;
 class KIconLoader;
 
 namespace Okular {
@@ -45,6 +46,7 @@
     KIconLoader* iconLoader();
 
     void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent );
+    void writeEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent, QFile& 
targetFile );
 
     /**
      * Returns the movie object that is referenced by a rendition action of 
the passed screen @p annotation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/pagepainter.cpp 
new/okular-16.04.1/ui/pagepainter.cpp
--- old/okular-15.12.3/ui/pagepainter.cpp       2016-02-12 06:08:29.000000000 
+0100
+++ new/okular-16.04.1/ui/pagepainter.cpp       2016-04-13 22:08:21.000000000 
+0200
@@ -63,10 +63,10 @@
     Okular::DocumentObserver *observer, int flags, int scaledWidth, int 
scaledHeight, const QRect &limits,
     const Okular::NormalizedRect &crop, Okular::NormalizedPoint *viewPortPoint 
)
 {
-       /* Calculate the cropped geometry of the page */
-       QRect scaledCrop = crop.geometry( scaledWidth, scaledHeight );
-       int croppedWidth = scaledCrop.width();
-       int croppedHeight = scaledCrop.height();
+    /* Calculate the cropped geometry of the page */
+    QRect scaledCrop = crop.geometry( scaledWidth, scaledHeight );
+    int croppedWidth = scaledCrop.width();
+    int croppedHeight = scaledCrop.height();
 
     QColor paperColor = Qt::white;
     QColor backgroundColor = paperColor;
@@ -694,19 +694,26 @@
                     QImage image( annotBoundary.size(), QImage::Format_ARGB32 
);
                     image.fill( acolor.rgba() );
                     QPainter painter( &image );
-                    painter.setPen( Qt::black );
                     painter.setFont( text->textFont() );
                     Qt::AlignmentFlag halign = ( text->inplaceAlignment() == 1 
? Qt::AlignHCenter : ( text->inplaceAlignment() == 2 ? Qt::AlignRight : 
Qt::AlignLeft ) );
                     const double invXScale = (double)page->width() / 
scaledWidth;
                     const double invYScale = (double)page->height() / 
scaledHeight;
+                    const double borderWidth = text->style().width();
                     painter.scale( 1 / invXScale, 1 / invYScale );
-                    painter.drawText( 2 * invXScale, 2 * invYScale,
-                                      (image.width() - 2) * invXScale,
-                                      (image.height() - 2) * invYScale,
-                                      Qt::AlignTop | halign | Qt::TextWordWrap,
+                    painter.drawText( borderWidth * invXScale, borderWidth * 
invYScale,
+                                      (image.width() - 2 * borderWidth) * 
invXScale,
+                                      (image.height() - 2 * borderWidth) * 
invYScale,
+                                      Qt::AlignTop | halign | 
Qt::TextWrapAnywhere,
                                       text->contents() );
                     painter.resetTransform();
-                    painter.drawRect( 0, 0, image.width() - 1, image.height() 
- 1 );
+                    //Required as asking for a zero width pen results
+                    //in a default width pen (1.0) being created
+                    if ( borderWidth != 0 )
+                    {
+                        QPen pen( Qt::black, borderWidth );
+                        painter.setPen( pen );
+                        painter.drawRect( 0, 0, image.width() - 1, 
image.height() - 1 );
+                    }
                     painter.end();
 
                     mixedPainter->drawImage( annotBoundary.topLeft(), image );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/pageviewannotator.cpp 
new/okular-16.04.1/ui/pageviewannotator.cpp
--- old/okular-15.12.3/ui/pageviewannotator.cpp 2016-02-12 06:08:29.000000000 
+0100
+++ new/okular-16.04.1/ui/pageviewannotator.cpp 2016-04-13 22:08:21.000000000 
+0200
@@ -180,6 +180,11 @@
                         f.fromString( m_annotElement.attribute( "font" ) );
                         ta->setTextFont( f );
                     }
+                    //set width
+                    if ( m_annotElement.hasAttribute( "width" ) )
+                    {
+                        ta->style().setWidth( m_annotElement.attribute( 
"width" ).toDouble() );
+                    }
                     //set boundary
                     rect.left = qMin(startpoint.x,point.x);
                     rect.top = qMin(startpoint.y,point.y);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/thumbnaillist.cpp 
new/okular-16.04.1/ui/thumbnaillist.cpp
--- old/okular-15.12.3/ui/thumbnaillist.cpp     2016-02-12 06:08:29.000000000 
+0100
+++ new/okular-16.04.1/ui/thumbnaillist.cpp     2016-04-13 22:08:21.000000000 
+0200
@@ -731,31 +731,21 @@
         return e->ignore();
 
     QRect r = item->visibleRect();
-    const int margin = ThumbnailWidget::margin();
     const QPoint p = e->pos() - item->pos();
 
-    if ( r.contains( p - QPoint( margin / 2, margin / 2 ) ) )
+    // jump center of viewport to cursor if it wasn't dragged
+    if ( m_mouseGrabPos.isNull() )
     {
-        setCursor( Qt::OpenHandCursor );
-    }
-    else
-    {
-        setCursor( Qt::ArrowCursor );
-        if ( m_mouseGrabPos.isNull() )
-        {
-            if ( m_document->viewport().pageNumber != item->pageNumber() )
-            {
-                m_document->setViewportPage( item->pageNumber() );
-                r = item->visibleRect();
-                Okular::DocumentViewport vp = Okular::DocumentViewport( 
item->pageNumber() );
-                vp.rePos.normalizedX = 0.5;
-                vp.rePos.normalizedY = (double) r.height() / 2.0  / (double) 
item->pixmapHeight();
-                vp.rePos.pos = Okular::DocumentViewport::Center;
-                vp.rePos.enabled = true;
-                m_document->setViewport( vp );
-            }
-        }
+        m_document->setViewportPage( item->pageNumber() );
+        r = item->visibleRect();
+        Okular::DocumentViewport vp = Okular::DocumentViewport( 
item->pageNumber() );
+        vp.rePos.normalizedX = double(p.x()) / double(item->rect().width());
+        vp.rePos.normalizedY = double(p.y()) / double(item->rect().height());
+        vp.rePos.pos = Okular::DocumentViewport::Center;
+        vp.rePos.enabled = true;
+        m_document->setViewport( vp );
     }
+    setCursor( Qt::OpenHandCursor );
     m_mouseGrabPos.setX( 0 );
     m_mouseGrabPos.setY( 0 );
 }
@@ -763,7 +753,25 @@
 void ThumbnailListPrivate::mouseMoveEvent( QMouseEvent * e )
 {
     if ( e->buttons() == Qt::NoButton )
+    {
+        ThumbnailWidget* item = itemFor( e->pos() );
+        if ( !item ) // mouse on the spacing between items
+            return e->ignore();
+
+        QRect r = item->visibleRect();
+        const int margin = ThumbnailWidget::margin();
+        const QPoint p = e->pos() - item->pos();
+        if ( r.contains( p - QPoint( margin / 2, margin / 2 ) ) )
+        {
+            setCursor( Qt::OpenHandCursor );
+        }
+        else
+        {
+            setCursor( Qt::ArrowCursor );
+        }
+
         return e->ignore();
+    }
     // no item under the mouse or previously selected
     if ( !m_mouseGrabItem )
         return e->ignore();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/okular-15.12.3/ui/tocmodel.cpp 
new/okular-16.04.1/ui/tocmodel.cpp
--- old/okular-15.12.3/ui/tocmodel.cpp  2016-02-12 06:08:29.000000000 +0100
+++ new/okular-16.04.1/ui/tocmodel.cpp  2016-04-13 22:08:21.000000000 +0200
@@ -12,6 +12,7 @@
 #include <qapplication.h>
 #include <qdom.h>
 #include <qlist.h>
+#include <qtreeview.h>
 
 #include <kicon.h>
 
@@ -148,11 +149,38 @@
 
 void TOCModelPrivate::findViewport( const Okular::DocumentViewport &viewport, 
TOCItem *item, QList< TOCItem* > &list ) const
 {
-    if ( item->viewport.isValid() && item->viewport.pageNumber == 
viewport.pageNumber )
-        list.append( item );
+    TOCItem *todo = item;
 
-    foreach ( TOCItem *child, item->children )
-        findViewport( viewport, child, list );
+    while ( todo )
+    {
+        TOCItem *current = todo;
+        todo = 0;
+        TOCItem *pos = 0;
+
+        foreach ( TOCItem *child, current->children )
+        {
+            if ( child->viewport.isValid() )
+            {
+                if ( child->viewport.pageNumber <= viewport.pageNumber )
+                {
+                    pos = child;
+                    if ( child->viewport.pageNumber == viewport.pageNumber )
+                    {
+                        break;
+                    }
+                }
+                else
+                {
+                    break;
+                }
+            }
+        }
+        if ( pos )
+        {
+            list.append( pos );
+            todo = pos;
+        }
+    }
 }
 
 
@@ -189,7 +217,31 @@
             break;
         case Qt::DecorationRole:
             if ( item->highlight )
-                return KIcon( QApplication::layoutDirection() == 
Qt::RightToLeft ? "arrow-left" : "arrow-right" );
+            {
+                const QVariant icon = KIcon( QApplication::layoutDirection() 
== Qt::RightToLeft ? "arrow-left" : "arrow-right" );
+                TOCItem *lastHighlighted = d->currentPage.last();
+
+                // in the mobile version our parent is not a QTreeView; add 
icon to the last highlighted item
+                // TODO misusing parent() here, fix
+                QTreeView *view = dynamic_cast< QTreeView* > ( 
QObject::parent() );
+                if ( !view )
+                {
+                    if ( item == lastHighlighted )
+                        return icon;
+                    return QVariant();
+                }
+
+                if ( view->isExpanded( index ) )
+                {
+                    // if this is the last highlighted node, its child is on a 
page below, thus it needs icon
+                    if ( item == lastHighlighted )
+                        return icon;
+                }
+                else
+                {
+                    return icon;
+                }
+            }
             break;
         case PageItemDelegate::PageRole:
             if ( item->viewport.isValid() )
@@ -282,6 +334,7 @@
             if ( !index.isValid() )
                 continue;
 
+            // TODO misusing parent() here, fix
             QMetaObject::invokeMethod( QObject::parent(), "expand", 
Qt::QueuedConnection, Q_ARG( QModelIndex, index ) );
         }
     }
@@ -293,6 +346,7 @@
             if ( !index.isValid() )
                 continue;
 
+            // TODO misusing parent() here, fix
             QMetaObject::invokeMethod( QObject::parent(), "expand", 
Qt::QueuedConnection, Q_ARG( QModelIndex, index ) );
         }
     }
@@ -329,13 +383,6 @@
 
     QList< TOCItem* > newCurrentPage;
     d->findViewport( viewport, d->root, newCurrentPage );
-    // HACK: for now, support only the first item found
-    if ( newCurrentPage.count() > 0 )
-    {
-        TOCItem *first = newCurrentPage.first();
-        newCurrentPage.clear();
-        newCurrentPage.append( first );
-    }
 
     d->currentPage = newCurrentPage;
 


Reply via email to