Hello community, here is the log from the commit of package okular for openSUSE:Factory checked in at 2015-05-11 19:22:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2015-03-11 09:54:42.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.okular.new/okular.changes 2015-05-11 19:22:04.000000000 +0200 @@ -1,0 +2,22 @@ +Sat Apr 11 13:28:24 UTC 2015 - [email protected] + +- Update to KDE Applications 15.04.0 + * KDE Applications 15.04.0 + * https://www.kde.org/announcements/announce-applications-15.04.0.php + + +------------------------------------------------------------------- +Sat Mar 21 18:26:24 UTC 2015 - [email protected] + +- Update to KDE Applications 15.03.95 + * KDE Applications 15.04 RC + + +------------------------------------------------------------------- +Sun Mar 8 12:52:35 UTC 2015 - [email protected] + +- Update to KDE Applications 15.03.80 + * KDE Applications 15.04 Beta + + +------------------------------------------------------------------- Old: ---- okular-14.12.3.tar.xz New: ---- okular-15.04.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ okular.spec ++++++ --- /var/tmp/diff_new_pack.9z11UJ/_old 2015-05-11 19:22:06.000000000 +0200 +++ /var/tmp/diff_new_pack.9z11UJ/_new 2015-05-11 19:22:06.000000000 +0200 @@ -17,7 +17,7 @@ Name: okular -Version: 14.12.3 +Version: 15.04.0 Release: 0 Summary: Document Viewer License: GPL-2.0+ ++++++ okular-14.12.3.tar.xz -> okular-15.04.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/VERSION new/okular-15.04.0/VERSION --- old/okular-14.12.3/VERSION 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/VERSION 2015-04-07 22:37:49.000000000 +0200 @@ -1 +1 @@ -okular v0.21.3 +okular v0.22.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/core/audioplayer.cpp new/okular-15.04.0/core/audioplayer.cpp --- old/okular-14.12.3/core/audioplayer.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/core/audioplayer.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -15,7 +15,7 @@ #include <qdir.h> #include <kdebug.h> #include <krandom.h> -#include <Phonon/Path> +#include <phonon/path.h> #include <phonon/audiooutput.h> #include <phonon/abstractmediastream.h> #include <phonon/mediaobject.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/core/document.cpp new/okular-15.04.0/core/document.cpp --- old/okular-14.12.3/core/document.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/core/document.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -979,7 +979,11 @@ m_generator->d_func()->m_document = 0; QObject::disconnect( m_generator, 0, m_parent, 0 ); - // TODO this is a hack just for 14.12 not to break API + // TODO this is a bit of a hack, since basically means that + // you can only call walletDataForFile after calling openDocument + // but since in reality it's what happens I've decided not to refactor/break API + // One solution is just kill walletDataForFile and make OpenResult be an object + // where the wallet data is also returned when OpenNeedsPassword m_walletGenerator = m_generator; m_generator = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/core/version.h new/okular-15.04.0/core/version.h --- old/okular-14.12.3/core/version.h 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/core/version.h 2015-04-07 22:37:49.000000000 +0200 @@ -10,10 +10,10 @@ #ifndef _OKULAR_VERSION_H_ #define _OKULAR_VERSION_H_ -#define OKULAR_VERSION_STRING "0.21.3" +#define OKULAR_VERSION_STRING "0.22.0" #define OKULAR_VERSION_MAJOR 0 -#define OKULAR_VERSION_MINOR 21 -#define OKULAR_VERSION_RELEASE 3 +#define OKULAR_VERSION_MINOR 22 +#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-14.12.3/generators/plucker/unpluck/config.cpp new/okular-15.04.0/generators/plucker/unpluck/config.cpp --- old/okular-14.12.3/generators/plucker/unpluck/config.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/generators/plucker/unpluck/config.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -393,7 +393,7 @@ || (strcmp (svalue, "off") == 0) || (strcmp (svalue, "OFF") == 0) || (strcmp (svalue, "F") == 0) - || (strcmp (svalue, "F") == 0) + || (strcmp (svalue, "f") == 0) || (strcmp (svalue, "False") == 0)) return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/part.cpp new/okular-15.04.0/part.cpp --- old/okular-14.12.3/part.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/part.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -2744,26 +2744,6 @@ } } - -void Part::restoreDocument(const KConfigGroup &group) -{ - KUrl url ( group.readPathEntry( "URL", QString() ) ); - if ( url.isValid() ) - { - QString viewport = group.readEntry( "Viewport" ); - if (!viewport.isEmpty()) m_document->setNextDocumentViewport( Okular::DocumentViewport( viewport ) ); - openUrl( url ); - } -} - - -void Part::saveDocumentRestoreInfo(KConfigGroup &group) -{ - group.writePathEntry( "URL", url().url() ); - group.writeEntry( "Viewport", m_document->viewport().toString() ); -} - - void Part::psTransformEnded(int exit, QProcess::ExitStatus status) { Q_UNUSED( exit ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/part.h new/okular-15.04.0/part.h --- old/okular-14.12.3/part.h 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/part.h 2015-04-07 22:37:49.000000000 +0200 @@ -222,8 +222,6 @@ public slots: // connected to Shell action (and browserExtension), not local one void slotPrint(); - void restoreDocument(const KConfigGroup &group); - void saveDocumentRestoreInfo(KConfigGroup &group); void slotFileDirty( const QString& ); void slotDoFileDirty(); void psTransformEnded(int, QProcess::ExitStatus); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/shell/main.cpp new/okular-15.04.0/shell/main.cpp --- old/okular-14.12.3/shell/main.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/shell/main.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -39,7 +39,7 @@ // see if we are starting with session management if (app.isSessionRestored()) { - RESTORE(Shell); + kRestoreMainWindows<Shell>(); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/shell/okular_main.cpp new/okular-15.04.0/shell/okular_main.cpp --- old/okular-14.12.3/shell/okular_main.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/shell/okular_main.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -138,14 +138,14 @@ if (ShellUtils::showPrintDialog(serializedOptions) && paths.count() > 1) { QTextStream stream(stderr); - stream << i18n( "Error: Can't open more than one document with the --presentation switch" ) << endl; + stream << i18n( "Error: Can't open more than one document with the --print switch" ) << endl; return Error; } if (!ShellUtils::page(serializedOptions).isEmpty() && paths.count() > 1) { QTextStream stream(stderr); - stream << i18n( "Error: Can't open more than one document with the --presentation switch" ) << endl; + stream << i18n( "Error: Can't open more than one document with the --page switch" ) << endl; return Error; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/shell/shell.cpp new/okular-15.04.0/shell/shell.cpp --- old/okular-14.12.3/shell/shell.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/shell/shell.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -59,6 +59,9 @@ static const char *shouldShowMenuBarComingFromFullScreen = "shouldShowMenuBarComingFromFullScreen"; static const char *shouldShowToolBarComingFromFullScreen = "shouldShowToolBarComingFromFullScreen"; +static const char* const SESSION_URL_KEY = "Urls"; +static const char* const SESSION_TAB_KEY = "ActiveTab"; + Shell::Shell( const QString &serializedOptions ) : KParts::MainWindow(), m_menuBarWasShown(true), m_toolBarWasShown(true) #ifdef KActivities_FOUND @@ -66,7 +69,7 @@ #endif , m_isValid(true) { - setObjectName( QLatin1String( "okular::Shell" ) ); + setObjectName( QLatin1String( "okular::Shell#" ) ); setContextMenuPolicy( Qt::NoContextMenu ); // set the shell's ui resource file setXMLFile("shell.rc"); @@ -106,6 +109,7 @@ // then, setup our actions setupActions(); + connect( QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(deleteLater()) ); // and integrate the part's GUI with the shell's setupGUI(Keys | ToolBar | Save); createGUI(firstPart); @@ -156,6 +160,7 @@ { it->part->closeUrl( false ); } + m_tabs.clear(); } if (m_unique) QDBusConnection::sessionBus().unregisterService("org.kde.okular"); @@ -321,19 +326,31 @@ void Shell::saveProperties(KConfigGroup &group) { - // the 'config' object points to the session managed - // config file. anything you write here will be available - // later when this app is restored - emit saveDocumentRestoreInfo(group); + // Gather lists of settings to preserve + QStringList urls; + for( int i = 0; i < m_tabs.size(); ++i ) + { + urls.append( m_tabs[i].part->url().url() ); + } + group.writePathEntry( SESSION_URL_KEY, urls ); + group.writeEntry( SESSION_TAB_KEY, m_tabWidget->currentIndex() ); } void Shell::readProperties(const KConfigGroup &group) { - // the 'config' object points to the session managed - // config file. this function is automatically called whenever - // the app is being restored. read in here whatever you wrote - // in 'saveProperties' - emit restoreDocument(group); + // Reopen documents based on saved settings + QStringList urls = group.readPathEntry( SESSION_URL_KEY, QStringList() ); + + while( !urls.isEmpty() ) + { + openUrl( urls.takeFirst() ); + } + + int desiredTab = group.readEntry<int>( SESSION_TAB_KEY, 0 ); + if( desiredTab < m_tabs.size() ) + { + setActiveTab( desiredTab ); + } } QStringList Shell::fileFormats() const @@ -399,11 +416,6 @@ } } -void Shell::slotQuit() -{ - close(); -} - void Shell::tryRaise() { KWindowSystem::forceActiveWindow( window()->effectiveWinId() ); @@ -553,8 +565,6 @@ void Shell::connectPart( QObject* part ) { - connect( this, SIGNAL(restoreDocument(KConfigGroup)), part, SLOT(restoreDocument(KConfigGroup))); - connect( this, SIGNAL(saveDocumentRestoreInfo(KConfigGroup&)), part, SLOT(saveDocumentRestoreInfo(KConfigGroup&))); connect( part, SIGNAL(enablePrintAction(bool)), this, SLOT(setPrintEnabled(bool))); connect( part, SIGNAL(enableCloseAction(bool)), this, SLOT(setCloseEnabled(bool))); connect( part, SIGNAL(mimeTypeChanged(KMimeType::Ptr)), this, SLOT(setTabIcon(KMimeType::Ptr))); @@ -655,6 +665,4 @@ m_tabs.move( from, to ); } -#include "shell.moc" - /* kate: replace-tabs on; indent-width 4; */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/shell/shell.h new/okular-15.04.0/shell/shell.h --- old/okular-14.12.3/shell/shell.h 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/shell/shell.h 2015-04-07 22:37:49.000000000 +0200 @@ -67,8 +67,6 @@ bool isValid() const; public slots: - void slotQuit(); - Q_SCRIPTABLE Q_NOREPLY void tryRaise(); Q_SCRIPTABLE bool openDocument( const QString& url, const QString &serializedOptions = QString() ); Q_SCRIPTABLE bool canOpenDocs( int numDocs, int desktop ); @@ -86,6 +84,13 @@ * with @ref saveProperties */ void readProperties(const KConfigGroup&); + + /** + * Expose internal functions for session restore testing + */ + void savePropertiesInternal(KConfig* config, int num) {KMainWindow::savePropertiesInternal(config,num);} + void readPropertiesInternal(KConfig* config, int num) {KMainWindow::readPropertiesInternal(config,num);} + void readSettings(); void writeSettings(); void setFullScreen( bool ); @@ -117,10 +122,6 @@ void handleTabDrop( QDropEvent* event ); void moveTabData( int from, int to ); -signals: - void restoreDocument(const KConfigGroup &group); - void saveDocumentRestoreInfo(KConfigGroup &group); - private: void setupAccel(); void setupActions(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/tests/mainshelltest.cpp new/okular-15.04.0/tests/mainshelltest.cpp --- old/okular-14.12.3/tests/mainshelltest.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/tests/mainshelltest.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -11,6 +11,7 @@ #include <qprintdialog.h> #include <qwidget.h> #include <ktabwidget.h> +#include <kconfiggroup.h> #include "../shell/okular_main.h" #include "../shell/shell.h" @@ -73,10 +74,26 @@ void testFileRemembersPagePosition(); void test2FilesError_data(); void test2FilesError(); + void testSessionRestore_data(); + void testSessionRestore(); private: }; +QList<Shell*> getShells() +{ + QList<Shell*> shells; + foreach( KMainWindow* kmw, KMainWindow::memberList() ) + { + Shell* shell = qobject_cast<Shell*>( kmw ); + if( shell ) + { + shells.append( shell ); + } + } + return shells; +} + Shell *findShell(Shell *ignore = 0) { foreach (QWidget *widget, QApplication::topLevelWidgets()) @@ -467,6 +484,108 @@ QVERIFY(!s); } +void MainShellTest::testSessionRestore_data() +{ + QTest::addColumn<QStringList>("paths"); + QTest::addColumn<QString>("options"); + QTest::addColumn<bool>("useTabsOpen"); + QTest::addColumn<bool>("useTabsRestore"); + + QStringList oneDocPaths( KDESRCDIR "data/file1.pdf" ); + QStringList twoDocPaths( oneDocPaths ); + twoDocPaths << KDESRCDIR "data/formSamples.pdf"; + + const QString options = ShellUtils::serializeOptions(false, false, false, false, QString()); + + QTest::newRow("1 doc, 1 window, tabs") << oneDocPaths << options << true << true; + QTest::newRow("2 docs, 1 window, tabs") << twoDocPaths << options << true << true; + QTest::newRow("2 docs, 2 windows, tabs") << twoDocPaths << options << false << true; + QTest::newRow("2 docs, 2 windows, no tabs") << twoDocPaths << options << false << false; + QTest::newRow("2 docs, 1 window, no tabs") << twoDocPaths << options << true << false; +} + +void MainShellTest::testSessionRestore() +{ + QFETCH( QStringList, paths ); + QFETCH( QString, options ); + QFETCH( bool, useTabsOpen ); + QFETCH( bool, useTabsRestore ); + + Okular::Settings::self()->setShellOpenFileInTabs( useTabsOpen ); + + Okular::Status status = Okular::main( paths, options ); + QCOMPARE( status, Okular::Success ); + + // Gather some information about the state + // Verify that the correct number of windows/tabs were opened + QList<Shell*> shells = getShells(); + QVERIFY( !shells.isEmpty() ); + int numDocs = 0; + foreach( Shell* shell, shells ) + { + QTest::qWaitForWindowShown( shell ); + numDocs += shell->m_tabs.size(); + } + + QCOMPARE( numDocs, paths.size() ); + QCOMPARE( shells.size(), useTabsOpen ? 1 : paths.size() ); + QTest::qWait( 100 ); + + // Simulate session shutdown. The actual shutdown path comes through + // QSessionManager XSMP handlers, then KApplication::commitData/saveState, + // then KMWSessionManager::commitData/saveState. Without simulating an X + // session manager, the best we can do here is to make a temporary Config + // and call KMainWindows save functions directly. + QTemporaryFile configFile; + QVERIFY( configFile.open() ); + + int numWindows = 0; + { // Scope for config so that we can reconstruct from file + KConfig config( configFile.fileName(), KConfig::SimpleConfig ); + foreach( Shell* shell, shells ) + { + shell->savePropertiesInternal( &config, ++numWindows ); + // Windows aren't necessarily closed on shutdown, but we'll use + // this as a way to trigger the destructor code, which is normally + // connected to the aboutToQuit signal + shell->close(); + } + } + + // Wait for shells to delete themselves. QTest::qWait doesn't do deferred + // deletions so we'll set up a full event loop to do that. + QEventLoop eventLoop; + QTimer::singleShot( 100, &eventLoop, SLOT(quit()) ); + eventLoop.exec( QEventLoop::AllEvents | QEventLoop::DeferredDeletion ); + shells = getShells(); + QVERIFY( shells.isEmpty() ); + + Okular::Settings::self()->setShellOpenFileInTabs( useTabsRestore ); + + // Simulate session restore. We can't call KMainWindow::restore() directly + // because it asks for info from the session manager, which doesn't know + // about our temporary config. But the logic here mostly mirrors restore(). + KConfig config( configFile.fileName(), KConfig::SimpleConfig ); + for( int i = 1; i <= numWindows; ++i ) + { + Shell* shell = new Shell; + shell->readPropertiesInternal( &config, i ); + shell->show(); + } + + // Verify that the restore state is reasonable + shells = getShells(); + QVERIFY( !shells.isEmpty() ); + numDocs = 0; + foreach( Shell* shell, shells ) + { + QTest::qWaitForWindowShown( shell ); + numDocs += shell->m_tabs.size(); + } + + QCOMPARE( numDocs, paths.size() ); + QCOMPARE( shells.size(), useTabsRestore ? numWindows : paths.size() ); +} QTEST_KDEMAIN( MainShellTest, GUI ) #include "mainshelltest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-14.12.3/ui/pageview.cpp new/okular-15.04.0/ui/pageview.cpp --- old/okular-14.12.3/ui/pageview.cpp 2015-02-27 01:22:09.000000000 +0100 +++ new/okular-15.04.0/ui/pageview.cpp 2015-04-07 22:37:49.000000000 +0200 @@ -2125,7 +2125,7 @@ d->leftClickTimer.start( QApplication::doubleClickInterval() + 10 ); } } - else if ( rightButton ) + else if ( rightButton && !d->mouseAnn ) { PageViewItem * pageItem = pickItemOnPoint( eventPos.x(), eventPos.y() ); if ( pageItem ) @@ -2274,6 +2274,18 @@ d->leftClickTimer.stop(); + const bool leftButton = e->button() == Qt::LeftButton; + const bool rightButton = e->button() == Qt::RightButton; + + if ( d->mouseAnn && leftButton ) + { + // Just finished to move the annotation + d->mouseAnn->setFlags( d->mouseAnn->flags() & ~Okular::Annotation::BeingMoved ); + d->document->translatePageAnnotation(d->mouseAnnPageNum, d->mouseAnn, Okular::NormalizedPoint( 0.0, 0.0 ) ); + setCursor( Qt::ArrowCursor ); + d->mouseAnn = 0; + } + // don't perform any mouse action when no document is shown.. if ( d->items.isEmpty() ) { @@ -2307,17 +2319,6 @@ return; } - if ( d->mouseAnn ) - { - // Just finished to move the annotation - d->mouseAnn->setFlags( d->mouseAnn->flags() & ~Okular::Annotation::BeingMoved ); - d->document->translatePageAnnotation(d->mouseAnnPageNum, d->mouseAnn, Okular::NormalizedPoint( 0.0, 0.0 ) ); - setCursor( Qt::ArrowCursor ); - d->mouseAnn = 0; - } - - bool leftButton = e->button() == Qt::LeftButton; - bool rightButton = e->button() == Qt::RightButton; switch ( d->mouseMode ) { case Okular::Settings::EnumMouseMode::Browse:{ @@ -2413,7 +2414,7 @@ #endif } } - else if ( rightButton ) + else if ( rightButton && !d->mouseAnn ) { if ( pageItem && pageItem == pageItemPressPos && ( (d->mousePressPos - e->globalPos()).manhattanLength() < QApplication::startDragDistance() ) ) @@ -2430,8 +2431,12 @@ KMenu menu( this ); QAction * actProcessLink = menu.addAction( i18n( "Follow This Link" ) ); QAction * actStopSound = 0; - if ( link->actionType() == Okular::Action::Sound ) - actStopSound = menu.addAction( i18n( "Stop Sound" ) ); + if ( link->actionType() == Okular::Action::Sound ) { + actProcessLink->setText( i18n( "Play this Sound" ) ); + if ( Okular::AudioPlayer::instance()->state() == Okular::AudioPlayer::PlayingState ) { + actStopSound = menu.addAction( i18n( "Stop Sound" ) ); + } + } QAction * actCopyLinkLocation = 0; if ( dynamic_cast< const Okular::BrowseAction * >( link ) ) actCopyLinkLocation = menu.addAction( KIcon( "edit-copy" ), i18n( "Copy Link Address" ) );
