Hello community, here is the log from the commit of package okular for openSUSE:Factory checked in at 2013-12-11 14:34:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2013-12-02 12:32:59.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.okular.new/okular.changes 2013-12-11 14:34:19.000000000 +0100 @@ -1,0 +2,14 @@ +Fri Nov 29 07:12:50 UTC 2013 - [email protected] + +- Update to 4.11.97 + * KDE 4.12 RC 1 release + * See http://www.kde.org/announcements/announce-4.12-rc.php + +------------------------------------------------------------------- +Sat Nov 23 22:26:56 UTC 2013 - [email protected] + +- Update to 4.11.95 + * KDE 4.12 Beta 3 release + * See http://www.kde.org/announcements/announce-4.12-beta3.php + +------------------------------------------------------------------- Old: ---- okular-4.11.90.tar.xz New: ---- okular-4.11.97.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ okular.spec ++++++ --- /var/tmp/diff_new_pack.u0FUS5/_old 2013-12-11 14:34:20.000000000 +0100 +++ /var/tmp/diff_new_pack.u0FUS5/_new 2013-12-11 14:34:20.000000000 +0100 @@ -17,7 +17,7 @@ Name: okular -Version: 4.11.90 +Version: 4.11.97 Release: 0 Summary: Document Viewer License: GPL-2.0+ ++++++ okular-4.11.90.tar.xz -> okular-4.11.97.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/VERSION new/okular-4.11.97/VERSION --- old/okular-4.11.90/VERSION 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/VERSION 2013-11-28 00:06:13.000000000 +0100 @@ -1 +1 @@ -okular v0.17.80 +okular v0.17.97 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/core/document.cpp new/okular-4.11.97/core/document.cpp --- old/okular-4.11.90/core/document.cpp 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/core/document.cpp 2013-11-28 00:06:13.000000000 +0100 @@ -3193,9 +3193,15 @@ { if ( d->m_viewportIterator != d->m_viewportHistory.begin() ) { + const int oldViewportPage = (*d->m_viewportIterator).pageNumber; + // restore previous viewport and notify it to observers --d->m_viewportIterator; foreachObserver( notifyViewportChanged( true ) ); + + const int currentViewportPage = (*d->m_viewportIterator).pageNumber; + if (oldViewportPage != currentViewportPage) + foreachObserver( notifyCurrentPageChanged( oldViewportPage, currentViewportPage ) ); } } @@ -3206,9 +3212,15 @@ ++nextIterator; if ( nextIterator != d->m_viewportHistory.end() ) { + const int oldViewportPage = (*d->m_viewportIterator).pageNumber; + // restore next viewport and notify it to observers ++d->m_viewportIterator; foreachObserver( notifyViewportChanged( true ) ); + + const int currentViewportPage = (*d->m_viewportIterator).pageNumber; + if (oldViewportPage != currentViewportPage) + foreachObserver( notifyCurrentPageChanged( oldViewportPage, currentViewportPage ) ); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/core/version.h new/okular-4.11.97/core/version.h --- old/okular-4.11.90/core/version.h 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/core/version.h 2013-11-28 00:06:13.000000000 +0100 @@ -10,10 +10,10 @@ #ifndef _OKULAR_VERSION_H_ #define _OKULAR_VERSION_H_ -#define OKULAR_VERSION_STRING "0.17.80" +#define OKULAR_VERSION_STRING "0.17.97" #define OKULAR_VERSION_MAJOR 0 #define OKULAR_VERSION_MINOR 17 -#define OKULAR_VERSION_RELEASE 80 +#define OKULAR_VERSION_RELEASE 97 #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-4.11.90/doc/index.docbook new/okular-4.11.97/doc/index.docbook --- old/okular-4.11.90/doc/index.docbook 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/doc/index.docbook 2013-11-28 00:06:13.000000000 +0100 @@ -1318,7 +1318,7 @@ </term> <listitem> <para><action>Change the magnification</action> of the document view - to a value that, depending on the size relation between the page and the view area, automatically either makes the pages' width equal to the document view's width (like fit-page), the pages' height equal to the document view's height (like fit-height), or the whole page visible (like fit-page).</para> + to a value that, depending on the size relation between the page and the view area, automatically either makes the pages' width equal to the document view's width (like fit-width), the pages' height equal to the document view's height (like fit-height), or the whole page visible (like fit-page).</para> </listitem> </varlistentry> <varlistentry> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/generators/epub/generator_epub.cpp new/okular-4.11.97/generators/epub/generator_epub.cpp --- old/okular-4.11.90/generators/epub/generator_epub.cpp 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/generators/epub/generator_epub.cpp 2013-11-28 00:06:13.000000000 +0100 @@ -20,7 +20,7 @@ "okular_epub", "okular_epub", ki18n("EPub Backend"), - "0.2.1", + "0.2.2", ki18n("An EPub backend"), KAboutData::License_GPL, ki18n("© 2008 Ely Levy") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/generators/kimgio/generator_kimgio.cpp new/okular-4.11.97/generators/kimgio/generator_kimgio.cpp --- old/okular-4.11.90/generators/kimgio/generator_kimgio.cpp 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/generators/kimgio/generator_kimgio.cpp 2013-11-28 00:06:13.000000000 +0100 @@ -33,7 +33,7 @@ "okular_kimgio", "okular_kimgio", ki18n( "Image Backend" ), - "0.1.1", + "0.1.2", ki18n( "A simple image backend" ), KAboutData::License_GPL, ki18n( "© 2005, 2009 Albert Astals Cid\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/generators/mobipocket/libokularGenerator_mobi.desktop new/okular-4.11.97/generators/mobipocket/libokularGenerator_mobi.desktop --- old/okular-4.11.90/generators/mobipocket/libokularGenerator_mobi.desktop 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/generators/mobipocket/libokularGenerator_mobi.desktop 2013-11-28 00:06:13.000000000 +0100 @@ -15,6 +15,7 @@ Name[et]=Mobipocketi dokument Name[eu]=Mobipocket dokumentua Name[fi]=Mobipocket-asiakirja +Name[fr]=Document « Mobipocket » Name[ga]=Cáipéis Mobipocket Name[gl]=Documento mobipocket Name[hu]=Mobipocket-dokumentum @@ -25,6 +26,7 @@ Name[lv]=Mobipocket dokuments Name[nds]=Mobipocket-Dokment Name[nl]=Mobipocket-document +Name[nn]=Mobipocket-dokument Name[pa]=ਮੋਬੀਪਾਕਟ ਡੌਕੂਮੈਂਟ Name[pl]=Dokument Mobipocket Name[pt]=Documento do Mobipocket @@ -59,6 +61,7 @@ Comment[et]=Okulari Mobipocketi taustaprogramm Comment[eu]=Okular-en Mobipocket motorra Comment[fi]=Mobipocket-taustaosa Okular-lukijalle +Comment[fr]=Moteur « Mobipocket » pour Okular Comment[ga]=Inneall Mobipocket le haghaidh Okular Comment[gl]=Infraestrutura de mobipocket para Okular Comment[hu]=Mobipocket-bővítmény az Okularhoz @@ -69,6 +72,7 @@ Comment[lv]=Mobipocket Okular aizmugure Comment[nds]=Mobipocket-Hülppropgramm för Okular Comment[nl]=Mobipocket-backend voor Okular +Comment[nn]=Mobipocket-motor for Okular Comment[pa]=ਓਕੁਲਾਰ ਲਈ ਮੋਬੀਪਾਕਟ ਬੈਕਐਂਡ Comment[pl]=Obsługa formatu Mobipocket dla Okulara Comment[pt]=Infra-estrutura do Mobipocket para o Okular diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/generators/mobipocket/okularApplication_mobi.desktop new/okular-4.11.97/generators/mobipocket/okularApplication_mobi.desktop --- old/okular-4.11.90/generators/mobipocket/okularApplication_mobi.desktop 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/generators/mobipocket/okularApplication_mobi.desktop 2013-11-28 00:06:13.000000000 +0100 @@ -139,6 +139,7 @@ X-KDE-Keywords[de]=Mobipocket X-KDE-Keywords[es]=mobipocket X-KDE-Keywords[fi]=mobipocket +X-KDE-Keywords[fr]=mobipocket X-KDE-Keywords[gl]=mobipocket X-KDE-Keywords[hu]=mobipocket X-KDE-Keywords[ia]=mobipocket Files old/okular-4.11.90/generators/spectre/hi16-app-okular-gv.png and new/okular-4.11.97/generators/spectre/hi16-app-okular-gv.png differ Files old/okular-4.11.90/generators/spectre/hi32-app-okular-gv.png and new/okular-4.11.97/generators/spectre/hi32-app-okular-gv.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/part.cpp new/okular-4.11.97/part.cpp --- old/okular-4.11.90/part.cpp 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/part.cpp 2013-11-28 00:06:13.000000000 +0100 @@ -1307,9 +1307,7 @@ // if the 'OpenTOC' flag is set, open the TOC if ( m_document->metaData( "OpenTOC" ).toBool() && m_sidebar->isItemEnabled( 0 ) && !m_sidebar->isCollapsed() ) { - const bool sidebarVisible = m_sidebar->isSidebarVisible(); - m_sidebar->setCurrentIndex( 0 ); - m_sidebar->setSidebarVisibility( sidebarVisible ); + m_sidebar->setCurrentIndex( 0, Sidebar::DoNotUncollapseIfCollapsed ); } // if the 'StartFullScreen' flag is set, or the command line flag was // specified, start presentation @@ -1779,7 +1777,7 @@ // If present, show the TOC when a document is opened if ( enable ) { - m_sidebar->setCurrentIndex( 0 ); + m_sidebar->setCurrentIndex( 0, Sidebar::DoNotUncollapseIfCollapsed ); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/tests/CMakeLists.txt new/okular-4.11.97/tests/CMakeLists.txt --- old/okular-4.11.90/tests/CMakeLists.txt 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/tests/CMakeLists.txt 2013-11-28 00:06:13.000000000 +0100 @@ -29,3 +29,6 @@ kde4_add_unit_test( modifyannotationpropertiestest modifyannotationpropertiestest.cpp testingutils.cpp) target_link_libraries( modifyannotationpropertiestest ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTXML_LIBRARY} okularcore ) + +kde4_add_unit_test( editformstest editformstest.cpp ) +target_link_libraries( editformstest ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTXML_LIBRARY} okularcore ) Files old/okular-4.11.90/tests/data/formSamples.pdf and new/okular-4.11.97/tests/data/formSamples.pdf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/tests/editformstest.cpp new/okular-4.11.97/tests/editformstest.cpp --- old/okular-4.11.90/tests/editformstest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/okular-4.11.97/tests/editformstest.cpp 2013-11-28 00:06:13.000000000 +0100 @@ -0,0 +1,431 @@ +/*************************************************************************** + * Copyright (C) 2013 by Jon Mease <[email protected]> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include <qtest_kde.h> +#include <kmimetype.h> +#include "../settings_core.h" +#include "core/document.h" +#include <core/page.h> +#include <core/form.h> + +class EditFormsTest : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + + void testRadioButtonForm(); + void testCheckBoxForm(); + void testTextLineForm(); + void testTextAreaForm(); + void testFileEditForm(); + void testComboEditForm(); + void testListSingleEdit(); + void testListMultiEdit(); + + // helper methods + void verifyRadioButtonStates(bool state1, bool state2, bool state3); + void setRadioButtonStates(bool state1, bool state2, bool state3); + void verifyTextForm( Okular::FormFieldText *form ); + +private: + Okular::Document *m_document; + QList<Okular::FormFieldButton*> m_radioButtonForms; + QList<Okular::FormFieldButton*> m_checkBoxForms; + Okular::FormFieldText* m_textLineForm; + Okular::FormFieldText* m_textAreaForm; + Okular::FormFieldText* m_fileEditForm; + Okular::FormFieldChoice* m_comboEdit; + Okular::FormFieldChoice* m_listSingleEdit; + Okular::FormFieldChoice* m_listMultiEdit; +}; + +void EditFormsTest::initTestCase() +{ + Okular::SettingsCore::instance( "editformstest" ); + m_document = new Okular::Document( 0 ); +} + +void EditFormsTest::cleanupTestCase() +{ + delete m_document; +} + +void EditFormsTest::init() +{ + const QString testFile = KDESRCDIR "data/formSamples.pdf"; + const KMimeType::Ptr mime = KMimeType::findByPath( testFile ); + m_document->openDocument( testFile, KUrl(), mime ); + + // Undo and Redo should be unavailable when docuemnt is first opened. + QVERIFY( !m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + const Okular::Page* page = m_document->page( 0 ); + QLinkedList<Okular::FormField*> pageFields = page->formFields(); + + // Clear lists + m_checkBoxForms.clear(); + m_radioButtonForms.clear(); + + // Collect forms of the various types + QLinkedList< Okular::FormField * >::const_iterator ffIt = pageFields.constBegin(), ffEnd = pageFields.constEnd(); + for ( ; ffIt != ffEnd; ++ffIt ) + { + Okular::FormField * ff = *ffIt; + ff->type(); + + switch ( ff->type() ) + { + case Okular::FormField::FormButton: + { + Okular::FormFieldButton * ffb = static_cast< Okular::FormFieldButton * >( ff ); + switch ( ffb->buttonType() ) + { + case Okular::FormFieldButton::Push: + break; + case Okular::FormFieldButton::CheckBox: + m_checkBoxForms.append(ffb); + break; + case Okular::FormFieldButton::Radio: + m_radioButtonForms.append(ffb); + break; + default: ; + } + break; + } + case Okular::FormField::FormText: + { + Okular::FormFieldText * fft = static_cast< Okular::FormFieldText * >( ff ); + switch ( fft->textType() ) + { + case Okular::FormFieldText::Multiline: + m_textAreaForm = fft; + break; + case Okular::FormFieldText::Normal: + m_textLineForm = fft; + break; + case Okular::FormFieldText::FileSelect: + m_fileEditForm = fft; + break; + } + break; + } + case Okular::FormField::FormChoice: + { + Okular::FormFieldChoice * ffc = static_cast< Okular::FormFieldChoice * >( ff ); + switch ( ffc->choiceType() ) + { + case Okular::FormFieldChoice::ListBox: + if ( ffc->multiSelect() ) + { + m_listMultiEdit = ffc; + } + else + { + m_listSingleEdit = ffc; + } + break; + case Okular::FormFieldChoice::ComboBox: + m_comboEdit = ffc; + break; + } + break; + } + default: ; + } + } +} + +void EditFormsTest::cleanup() +{ + m_document->closeDocument(); +} + +void EditFormsTest::testRadioButtonForm() +{ + // Initially the first radio button is checked + verifyRadioButtonStates( true, false, false ); + + // Set the second radio to checked and make sure the first + // is now unchecked and that an undo action is available + setRadioButtonStates( false, true, false); + verifyRadioButtonStates( false, true, false ); + QVERIFY( m_document->canUndo() ); + + // Now undo the action + m_document->undo(); + verifyRadioButtonStates( true, false, false ); + QVERIFY( !m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Now redo the action + m_document->redo(); + verifyRadioButtonStates( false, true, false ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); +} + +void EditFormsTest::testCheckBoxForm() +{ + // Examine the first and second checkboxes + // Initially both checkboxes are unchecked + QVERIFY ( m_checkBoxForms[0]->state() == false ); + QVERIFY ( m_checkBoxForms[1]->state() == false ); + + // Set checkbox 1 to true + m_document->editFormButtons( 0, QList<Okular::FormFieldButton*>() << m_checkBoxForms[0], QList<bool>() << true); + QVERIFY ( m_checkBoxForms[0]->state() == true ); + QVERIFY ( m_checkBoxForms[1]->state() == false ); + QVERIFY( m_document->canUndo() ); + + // Set checkbox 2 to true + m_document->editFormButtons( 0, QList<Okular::FormFieldButton*>() << m_checkBoxForms[1], QList<bool>() << true); + QVERIFY ( m_checkBoxForms[0]->state() == true ); + QVERIFY ( m_checkBoxForms[1]->state() == true ); + QVERIFY( m_document->canUndo() ); + + // Undo checking of second checkbox + m_document->undo(); + QVERIFY ( m_checkBoxForms[0]->state() == true ); + QVERIFY ( m_checkBoxForms[1]->state() == false ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Undo checking of first checkbox + m_document->undo(); + QVERIFY ( m_checkBoxForms[0]->state() == false ); + QVERIFY ( m_checkBoxForms[1]->state() == false ); + QVERIFY( !m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Redo checking of first checkbox + m_document->redo(); + QVERIFY ( m_checkBoxForms[0]->state() == true ); + QVERIFY ( m_checkBoxForms[1]->state() == false ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); +} + +void EditFormsTest::testTextLineForm() +{ + verifyTextForm( m_textLineForm ); +} + +void EditFormsTest::testTextAreaForm() +{ + verifyTextForm( m_textAreaForm ); +} + +void EditFormsTest::testFileEditForm() +{ + verifyTextForm( m_fileEditForm ); +} + +void EditFormsTest::testComboEditForm() +{ + // Editable combo with predefined choices: + // - combo1 + // - combo2 + // - combo3 + + // Initially no choice is selected + QCOMPARE( m_comboEdit->currentChoices().length(), 0 ); + QCOMPARE( m_comboEdit->editChoice(), QString( "" ) ); + + // Select first choice + m_document->editFormCombo( 0, m_comboEdit, "combo1", 0, 0, 0); + QCOMPARE( m_comboEdit->currentChoices().length(), 1 ); + QCOMPARE( m_comboEdit->currentChoices()[0], 0 ); + QCOMPARE( m_comboEdit->editChoice(), QString( "" ) ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Select third choice + m_document->editFormCombo( 0, m_comboEdit, "combo3", 0, 0, 0); + QCOMPARE( m_comboEdit->currentChoices().length(), 1 ); + QCOMPARE( m_comboEdit->currentChoices()[0], 2 ); + QCOMPARE( m_comboEdit->editChoice(), QString( "" ) ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Undo and verify that first choice is selected + m_document->undo(); + QCOMPARE( m_comboEdit->currentChoices().length(), 1 ); + QCOMPARE( m_comboEdit->currentChoices()[0], 0 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Redo and verify that third choice is selected + m_document->redo(); + QCOMPARE( m_comboEdit->currentChoices().length(), 1 ); + QCOMPARE( m_comboEdit->currentChoices()[0], 2 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Select a custom choice and verify that no predefined choices are selected + m_document->editFormCombo( 0, m_comboEdit, "comboEdit", 0, 0, 0); + QCOMPARE( m_comboEdit->currentChoices().length(), 0 ); + QCOMPARE( m_comboEdit->editChoice(), QString( "comboEdit" ) ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Undo and verify that third choice is selected + m_document->undo(); + QCOMPARE( m_comboEdit->currentChoices().length(), 1 ); + QCOMPARE( m_comboEdit->currentChoices()[0], 2 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); +} + +void EditFormsTest::testListSingleEdit() +{ + // A list with three items that allows only single selections + // Initially no choice is selected + QCOMPARE( m_listSingleEdit->currentChoices().length(), 0 ); + + // Select first item + m_document->editFormList( 0, m_listSingleEdit, QList<int>() << 0); + QCOMPARE( m_listSingleEdit->currentChoices().length(), 1 ); + QCOMPARE( m_listSingleEdit->currentChoices()[0], 0 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Select second item + m_document->editFormList( 0, m_listSingleEdit, QList<int>() << 1); + QCOMPARE( m_listSingleEdit->currentChoices().length(), 1 ); + QCOMPARE( m_listSingleEdit->currentChoices()[0], 1 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Undo and verify that first item is selected + m_document->undo(); + QCOMPARE( m_listSingleEdit->currentChoices().length(), 1 ); + QCOMPARE( m_listSingleEdit->currentChoices()[0], 0 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Redo and verify that second item is selected + m_document->redo(); + QCOMPARE( m_listSingleEdit->currentChoices().length(), 1 ); + QCOMPARE( m_listSingleEdit->currentChoices()[0], 1 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); +} + +void EditFormsTest::testListMultiEdit() +{ + // A list with three items that allows for multiple selections + // Initially no choice is selected + QCOMPARE( m_listMultiEdit->currentChoices().length(), 0 ); + + // Select first item + m_document->editFormList( 0, m_listMultiEdit, QList<int>() << 0); + QCOMPARE( m_listMultiEdit->currentChoices(), QList<int>() << 0 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Select first and third items + m_document->editFormList( 0, m_listMultiEdit, QList<int>() << 0 << 2); + QCOMPARE( m_listMultiEdit->currentChoices(), QList<int>() << 0 << 2 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Select all three items + m_document->editFormList( 0, m_listMultiEdit, QList<int>() << 0 << 1 << 2); + QCOMPARE( m_listMultiEdit->currentChoices(), QList<int>() << 0 << 1 << 2); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Undo and verify that first and third items are selected + m_document->undo(); + QCOMPARE( m_listMultiEdit->currentChoices(), QList<int>() << 0 << 2 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Undo and verify that first item is selected + m_document->undo(); + QCOMPARE( m_listMultiEdit->currentChoices(), QList<int>() << 0 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Redo and verify that first and third items are selected + m_document->redo(); + QCOMPARE( m_listMultiEdit->currentChoices(), QList<int>() << 0 << 2 ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); +} + +// helper methods +void EditFormsTest::verifyRadioButtonStates( bool state1, bool state2, bool state3 ) +{ + QVERIFY ( m_radioButtonForms[0]->state() == state1 ); + QVERIFY ( m_radioButtonForms[1]->state() == state2 ); + QVERIFY ( m_radioButtonForms[2]->state() == state3 ); +} + +void EditFormsTest::setRadioButtonStates( bool state1, bool state2, bool state3 ) +{ + QList<bool> newButtonStates; + newButtonStates.append(state1); + newButtonStates.append(state2); + newButtonStates.append(state3); + m_document->editFormButtons( 0, m_radioButtonForms, newButtonStates); +} + +void EditFormsTest::verifyTextForm( Okular::FormFieldText* form ) +{ + // Text in form is initially empty + QCOMPARE( form->text(), QString("") ); + + // Insert the string "Hello" into the form + m_document->editFormText(0, form, QString("Hello"), 5, 0, 0); + QCOMPARE( form->text(), QString("Hello") ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Undo the insertion and verify that form is empty again + m_document->undo(); + QCOMPARE( form->text(), QString("") ); + QVERIFY( !m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Redo the insertion of "Hello" + m_document->redo(); + QCOMPARE( form->text(), QString("Hello") ); + QVERIFY( m_document->canUndo() ); + QVERIFY( !m_document->canRedo() ); + + // Type "_World" after "Hello" + m_document->editFormText(0, form, QString("Hello_"), 6, 5, 5); + m_document->editFormText(0, form, QString("Hello_W"), 7, 6, 6); + m_document->editFormText(0, form, QString("Hello_Wo"), 8, 7, 7); + m_document->editFormText(0, form, QString("Hello_Wor"), 9, 8, 8); + m_document->editFormText(0, form, QString("Hello_Worl"), 10, 9, 9); + m_document->editFormText(0, form, QString("Hello_World"), 11, 10, 10); + + // Verify that character insertion operations were merged together into a single undo command + m_document->undo(); + QCOMPARE( form->text(), QString("Hello") ); + QVERIFY( m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); + + // Verify that one more undo gets us back to the original state (empty form) + m_document->undo(); + QCOMPARE( form->text(), QString("") ); + QVERIFY( !m_document->canUndo() ); + QVERIFY( m_document->canRedo() ); +} + +QTEST_KDEMAIN( EditFormsTest, GUI ) +#include "editformstest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/ui/sidebar.cpp new/okular-4.11.97/ui/sidebar.cpp --- old/okular-4.11.90/ui/sidebar.cpp 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/ui/sidebar.cpp 2013-11-28 00:06:13.000000000 +0100 @@ -592,12 +592,12 @@ return ( f & Qt::ItemIsEnabled ) == Qt::ItemIsEnabled; } -void Sidebar::setCurrentIndex( int index ) +void Sidebar::setCurrentIndex( int index, SetCurrentIndexBehaviour b ) { if ( index < 0 || index >= d->pages.count() || !isItemEnabled( index ) ) return; - itemClicked( d->pages.at( index ) ); + itemClicked( d->pages.at( index ), b ); QModelIndex modelindex = d->list->model()->index( index, 0 ); d->list->setCurrentIndex( modelindex ); d->list->selectionModel()->select( modelindex, QItemSelectionModel::ClearAndSelect ); @@ -645,6 +645,11 @@ void Sidebar::itemClicked( QListWidgetItem *item ) { + itemClicked( item, UncollapseIfCollapsed ); +} + +void Sidebar::itemClicked( QListWidgetItem *item, SetCurrentIndexBehaviour b ) +{ if ( !item ) return; @@ -661,13 +666,16 @@ } else { - setCollapsed( false ); - d->list->show(); + if ( b == UncollapseIfCollapsed ) + { + setCollapsed( false ); + d->list->show(); + } } } else { - if ( isCollapsed() ) + if ( isCollapsed() && b == UncollapseIfCollapsed ) { setCollapsed( false ); d->list->show(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.11.90/ui/sidebar.h new/okular-4.11.97/ui/sidebar.h --- old/okular-4.11.90/ui/sidebar.h 2013-11-14 07:34:37.000000000 +0100 +++ new/okular-4.11.97/ui/sidebar.h 2013-11-28 00:06:13.000000000 +0100 @@ -30,7 +30,9 @@ void setItemEnabled( int index, bool enabled ); bool isItemEnabled( int index ) const; - void setCurrentIndex( int index ); + enum SetCurrentIndexBehaviour { UncollapseIfCollapsed, DoNotUncollapseIfCollapsed }; + + void setCurrentIndex( int index, SetCurrentIndexBehaviour b = UncollapseIfCollapsed ); int currentIndex() const; void setSidebarVisibility( bool visible ); @@ -48,6 +50,7 @@ void appearanceChanged(); private: + void itemClicked( QListWidgetItem *item, SetCurrentIndexBehaviour b ); void saveSplitterSize() const; // private storage -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
