mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-13 13:11:41 +00:00
make sure actionsForUrl() returns actions sorted by page number
CCBUG: 205952 svn path=/trunk/KDE/kdegraphics/okular/; revision=1129512
This commit is contained in:
parent
1de3285d37
commit
45e62fa320
|
@ -37,12 +37,27 @@ class OkularBookmarkAction : public KBookmarkAction
|
|||
public:
|
||||
OkularBookmarkAction( const Okular::DocumentViewport& vp, const KBookmark& bk, KBookmarkOwner* owner, QObject *parent )
|
||||
: KBookmarkAction( bk, owner, parent )
|
||||
, m_pageNumber( vp.pageNumber + 1 )
|
||||
{
|
||||
if ( vp.isValid() )
|
||||
setText( QString::number( vp.pageNumber + 1 ) + " - " + text() );
|
||||
}
|
||||
|
||||
inline int pageNumber() const
|
||||
{
|
||||
return m_pageNumber;
|
||||
}
|
||||
|
||||
private:
|
||||
const int m_pageNumber;
|
||||
};
|
||||
|
||||
inline bool okularBookmarkActionLessThan( QAction * a1, QAction * a2 )
|
||||
{
|
||||
return static_cast< OkularBookmarkAction * >( a1 )->pageNumber()
|
||||
< static_cast< OkularBookmarkAction * >( a2 )->pageNumber();
|
||||
}
|
||||
|
||||
class BookmarkManager::Private : public KBookmarkOwner
|
||||
{
|
||||
public:
|
||||
|
@ -399,6 +414,7 @@ QList< QAction * > BookmarkManager::actionsForUrl( const KUrl& url ) const
|
|||
}
|
||||
break;
|
||||
}
|
||||
qSort( ret.begin(), ret.end(), okularBookmarkActionLessThan );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue