From b6615bcc6b43926ee185c0ecda60bda9030c2f48 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Jun 17 2011 15:22:50 +0000 Subject: Merge remote-tracking branch 'origin/f15' into f14 --- diff --git a/.gitignore b/.gitignore index 1a443ef..f01bea9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /kdegraphics-4.6.2.tar.bz2 /kdegraphics-4.6.3.tar.bz2 /kdegraphics-4.6.4.tar.bz2 +/okular-0.12.4-20110617.tar.bz2 diff --git a/kdegraphics-okular-0.12.4-landscape.patch b/kdegraphics-okular-0.12.4-landscape.patch new file mode 100644 index 0000000..a4a66cc --- /dev/null +++ b/kdegraphics-okular-0.12.4-landscape.patch @@ -0,0 +1,427 @@ +diff -up kdegraphics-4.6.4/okular/core/document.cpp.okular-landscape kdegraphics-4.6.4/okular/core/document.cpp +--- kdegraphics-4.6.4/okular/core/document.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/core/document.cpp 2011-06-17 10:05:44.645023837 -0500 +@@ -3456,6 +3456,28 @@ bool Document::saveDocumentArchive( cons + return true; + } + ++QPrinter::Orientation Document::orientation() const ++{ ++ double width, height; ++ int landscape, portrait; ++ const Okular::Page *currentPage; ++ ++ // if some pages are landscape and others are not, the most common wins, as ++ // QPrinter does not accept a per-page setting ++ landscape = 0; ++ portrait = 0; ++ for (uint i = 0; i < pages(); i++) ++ { ++ currentPage = page(i); ++ width = currentPage->width(); ++ height = currentPage->height(); ++ if (currentPage->orientation() == Okular::Rotation90 || currentPage->orientation() == Okular::Rotation270) qSwap(width, height); ++ if (width > height) landscape++; ++ else portrait++; ++ } ++ return (landscape > portrait) ? QPrinter::Landscape : QPrinter::Portrait; ++} ++ + void DocumentPrivate::requestDone( PixmapRequest * req ) + { + if ( !req ) +diff -up kdegraphics-4.6.4/okular/core/document.h.okular-landscape kdegraphics-4.6.4/okular/core/document.h +--- kdegraphics-4.6.4/okular/core/document.h.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/core/document.h 2011-06-17 10:05:44.646023844 -0500 +@@ -19,11 +19,11 @@ + #include + #include + #include ++#include + #include + + #include + +-class QPrinter; + class QPrintDialog; + class KComponentData; + class KBookmark; +@@ -604,6 +604,15 @@ class OKULAR_EXPORT Document : public QO + */ + const SourceReference * dynamicSourceReference( int pageNr, double absX, double absY ); + ++ /** ++ * Returns the orientation of the document (for printing purposes). This ++ * is used in the KPart to initialize the print dialog and in the ++ * generators to check whether the document needs to be rotated or not. ++ * ++ * @since 0.13 (KDE 4.7) ++ */ ++ QPrinter::Orientation orientation() const; ++ + + public Q_SLOTS: + /** +diff -up kdegraphics-4.6.4/okular/core/fileprinter.cpp.okular-landscape kdegraphics-4.6.4/okular/core/fileprinter.cpp +--- kdegraphics-4.6.4/okular/core/fileprinter.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/core/fileprinter.cpp 2011-06-17 10:05:44.646023844 -0500 +@@ -34,20 +34,26 @@ + using namespace Okular; + + int FilePrinter::printFile( QPrinter &printer, const QString file, FileDeletePolicy fileDeletePolicy, +- PageSelectPolicy pageSelectPolicy, const QString &pageRange ) ++ PageSelectPolicy pageSelectPolicy, const QString &pageRange, ++ QPrinter::Orientation documentOrientation ) + { + FilePrinter fp; +- return fp.doPrintFiles( printer, QStringList( file ), fileDeletePolicy, pageSelectPolicy, pageRange ); ++ return fp.doPrintFiles( printer, QStringList( file ), fileDeletePolicy, pageSelectPolicy, pageRange, ++ documentOrientation ); + } + + int FilePrinter::printFiles( QPrinter &printer, const QStringList &fileList, FileDeletePolicy fileDeletePolicy ) + { + FilePrinter fp; +- return fp.doPrintFiles( printer, fileList, fileDeletePolicy, FilePrinter::ApplicationSelectsPages, QString() ); ++ // FIXME: Does anything actually use this function? If so, we need to fix it ++ // to support a list of orientations for each document. ++ return fp.doPrintFiles( printer, fileList, fileDeletePolicy, FilePrinter::ApplicationSelectsPages, QString(), ++ QPrinter::Portrait ); + } + + int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDeletePolicy fileDeletePolicy, +- PageSelectPolicy pageSelectPolicy, const QString &pageRange ) ++ PageSelectPolicy pageSelectPolicy, const QString &pageRange, ++ QPrinter::Orientation documentOrientation ) + { + + if ( fileList.size() < 1 ) { +@@ -135,7 +141,7 @@ int FilePrinter::doPrintFiles( QPrinter + + bool useCupsOptions = cupsAvailable(); + argList = printArguments( printer, fileDeletePolicy, pageSelectPolicy, +- useCupsOptions, pageRange, exe ) << fileList; ++ useCupsOptions, pageRange, exe, documentOrientation ) << fileList; + kDebug(OkularDebug) << "Executing" << exe << "with arguments" << argList; + + ret = KProcess::execute( exe, argList ); +@@ -360,7 +366,8 @@ Generator::PrintError FilePrinter::print + + QStringList FilePrinter::printArguments( QPrinter &printer, FileDeletePolicy fileDeletePolicy, + PageSelectPolicy pageSelectPolicy, bool useCupsOptions, +- const QString &pageRange, const QString &version ) ++ const QString &pageRange, const QString &version, ++ QPrinter::Orientation documentOrientation ) + { + QStringList argList; + +@@ -380,8 +387,8 @@ QStringList FilePrinter::printArguments( + argList << pages( printer, pageSelectPolicy, pageRange, useCupsOptions, version ); + } + +- if ( useCupsOptions && ! cupsOptions( printer ).isEmpty() ) { +- argList << cupsOptions( printer ); ++ if ( useCupsOptions && ! cupsOptions( printer, documentOrientation ).isEmpty() ) { ++ argList << cupsOptions( printer, documentOrientation); + } + + if ( ! deleteFile( printer, fileDeletePolicy, version ).isEmpty() ) { +@@ -484,7 +491,7 @@ QStringList FilePrinter::pages( QPrinter + return QStringList(); // AllPages + } + +-QStringList FilePrinter::cupsOptions( QPrinter &printer ) ++QStringList FilePrinter::cupsOptions( QPrinter &printer, QPrinter::Orientation documentOrientation ) + { + QStringList optionList; + +@@ -492,8 +499,8 @@ QStringList FilePrinter::cupsOptions( QP + optionList << optionMedia( printer ); + } + +- if ( ! optionOrientation( printer ).isEmpty() ) { +- optionList << optionOrientation( printer ); ++ if ( ! optionOrientation( printer, documentOrientation ).isEmpty() ) { ++ optionList << optionOrientation( printer, documentOrientation ); + } + + if ( ! optionDoubleSidedPrinting( printer ).isEmpty() ) { +@@ -597,12 +604,17 @@ QString FilePrinter::mediaPaperSource( Q + } + } + +-QStringList FilePrinter::optionOrientation( QPrinter &printer ) ++QStringList FilePrinter::optionOrientation( QPrinter &printer, QPrinter::Orientation documentOrientation ) + { +- switch ( printer.orientation() ) { +- case QPrinter::Portrait: return QStringList("-o") << "portrait"; +- case QPrinter::Landscape: return QStringList("-o") << "landscape"; +- default: return QStringList(); ++ // portrait and landscape options rotate the document according to the document orientation ++ // If we want to print a landscape document as one would expect it, we have to pass the ++ // portrait option so that the document is not rotated additionaly ++ if ( printer.orientation() == documentOrientation ) { ++ // the user wants the document printed as is ++ return QStringList("-o") << "portrait"; ++ } else { ++ // the user expects the document being rotated by 90 degrees ++ return QStringList("-o") << "landscape"; + } + } + +diff -up kdegraphics-4.6.4/okular/core/fileprinter.h.okular-landscape kdegraphics-4.6.4/okular/core/fileprinter.h +--- kdegraphics-4.6.4/okular/core/fileprinter.h.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/core/fileprinter.h 2011-06-17 10:07:07.502467746 -0500 +@@ -16,11 +16,11 @@ + + #include + #include ++#include + + #include "okular_export.h" + #include "generator.h" + +-class QPrinter; + class QSize; + + namespace Okular { +@@ -58,6 +58,7 @@ public: + * @param fileDeletePolicy if the application or system deletes the file + * @param pageSelectPolicy if the application or system selects the pages to print + * @param pageRange page range to print if SystemSlectsPages and user chooses Selection in Print Dialog ++ * @param documentOrientation the orientation stored in the document itself (Default is Portrait) + * + * @returns Returns exit code: + * -9 if lpr not found +@@ -73,7 +74,9 @@ public: + static int printFile( QPrinter &printer, const QString file, + FileDeletePolicy fileDeletePolicy = FilePrinter::ApplicationDeletesFiles, + PageSelectPolicy pageSelectPolicy = FilePrinter::ApplicationSelectsPages, +- const QString &pageRange = QString() ); ++ const QString &pageRange = QString(), ++ QPrinter::Orientation documentOrientation = QPrinter::Portrait ++ ); + + /** Print a list of files using the settings in QPrinter + * +@@ -171,11 +174,13 @@ protected: + + int doPrintFiles( QPrinter &printer, const QStringList fileList, + FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, +- const QString &pageRange ); ++ const QString &pageRange, ++ QPrinter::Orientation documentOrientation); + + QStringList printArguments( QPrinter &printer, + FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, +- bool useCupsOptions, const QString &pageRange, const QString &version ); ++ bool useCupsOptions, const QString &pageRange, const QString &version, ++ QPrinter::Orientation documentOrientation); + + QStringList destination( QPrinter &printer, const QString &version ); + QStringList copies( QPrinter &printer, const QString &version ); +@@ -185,11 +190,11 @@ protected: + QStringList pages( QPrinter &printer, PageSelectPolicy pageSelectPolicy, + const QString &pageRange, bool useCupsOptions, const QString &version ); + +- QStringList cupsOptions( QPrinter &printer ); ++ QStringList cupsOptions( QPrinter &printer, QPrinter::Orientation documentOrientation ); + QStringList optionMedia( QPrinter &printer ); + QString mediaPageSize( QPrinter &printer ); + QString mediaPaperSource( QPrinter &printer ); +- QStringList optionOrientation( QPrinter &printer ); ++ QStringList optionOrientation( QPrinter &printer, QPrinter::Orientation documentOrientation ); + QStringList optionDoubleSidedPrinting( QPrinter &printer ); + QStringList optionPageOrder( QPrinter &printer ); + QStringList optionCollateCopies( QPrinter &printer ); +diff -up kdegraphics-4.6.4/okular/generators/djvu/generator_djvu.cpp.okular-landscape kdegraphics-4.6.4/okular/generators/djvu/generator_djvu.cpp +--- kdegraphics-4.6.4/okular/generators/djvu/generator_djvu.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/djvu/generator_djvu.cpp 2011-06-17 10:05:44.647023850 -0500 +@@ -220,7 +220,8 @@ bool DjVuGenerator::print( QPrinter& pri + int ret = Okular::FilePrinter::printFile( printer, fileName, + Okular::FilePrinter::SystemDeletesFiles, + Okular::FilePrinter::ApplicationSelectsPages, +- document()->bookmarkedPageRange() ); ++ document()->bookmarkedPageRange(), ++ document()->orientation() ); + result = ( ret >=0 ); + } + +diff -up kdegraphics-4.6.4/okular/generators/dvi/dviexport.cpp.okular-landscape kdegraphics-4.6.4/okular/generators/dvi/dviexport.cpp +--- kdegraphics-4.6.4/okular/generators/dvi/dviexport.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/dvi/dviexport.cpp 2011-06-17 10:05:44.647023850 -0500 +@@ -288,9 +288,11 @@ DVIExportToPS::DVIExportToPS(dviRenderer + const QString& output_name, + const QStringList& options, + QPrinter* printer, +- bool useFontHinting) ++ bool useFontHinting, ++ QPrinter::Orientation orientation) + : DVIExport(parent, parent_widget), +- printer_(printer) ++ printer_(printer), ++ orientation_(orientation) + { + // None of these should happen. Paranoia checks. + if (!parent.dviFile) +@@ -460,7 +462,8 @@ void DVIExportToPS::finished_impl(int ex + Okular::FilePrinter::printFile( (*printer_), output_name_, + Okular::FilePrinter::ApplicationDeletesFiles, + Okular::FilePrinter::ApplicationSelectsPages, +- QString() ); ++ QString(), ++ orientation_ ); + } + } + +diff -up kdegraphics-4.6.4/okular/generators/dvi/dviexport.h.okular-landscape kdegraphics-4.6.4/okular/generators/dvi/dviexport.h +--- kdegraphics-4.6.4/okular/generators/dvi/dviexport.h.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/dvi/dviexport.h 2011-06-17 10:05:44.647023850 -0500 +@@ -22,11 +22,11 @@ + #include + + #include ++#include + + + class dviRenderer; + class fontProgressDialog; +-class QPrinter; + class KProcess; + class QStringList; + +@@ -124,13 +124,15 @@ public: + * passed to the external process's argv command line. + * @param printer having generated the PostScript file, it is passed + * to @c printer (if not null). ++ * @param orientation the original orientation of the document + */ + DVIExportToPS(dviRenderer& parent, + QWidget* parent_widget, + const QString& output_name, + const QStringList& options, + QPrinter* printer, +- bool useFontHinting); ++ bool useFontHinting, ++ QPrinter::Orientation orientation = QPrinter::Portrait); + + private: + virtual void abort_process_impl(); +@@ -139,6 +141,7 @@ private: + QPrinter* printer_; + QString output_name_; + QString tmpfile_name_; ++ QPrinter::Orientation orientation_; + }; + + #endif +diff -up kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.cpp.okular-landscape kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.cpp +--- kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.cpp 2011-06-17 10:05:44.648023855 -0500 +@@ -767,9 +767,9 @@ void dviRenderer::exportPDF() + } + + +-void dviRenderer::exportPS(const QString& fname, const QStringList& options, QPrinter* printer) ++void dviRenderer::exportPS(const QString& fname, const QStringList& options, QPrinter* printer, QPrinter::Orientation orientation) + { +- KSharedPtr exporter(new DVIExportToPS(*this, parentWidget, fname, options, printer, font_pool.getUseFontHints())); ++ KSharedPtr exporter(new DVIExportToPS(*this, parentWidget, fname, options, printer, font_pool.getUseFontHints(), orientation)); + if (exporter->started()) + all_exports_[exporter.data()] = exporter; + } +diff -up kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.h.okular-landscape kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.h +--- kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.h.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/dvi/dviRenderer.h 2011-06-17 10:05:44.648023855 -0500 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + class Anchor; + class DocumentWidget; +@@ -37,7 +38,6 @@ class dviRenderer; + class ghostscript_interface; + //class infoDialog; + class QEventLoop; +-class QPrinter; + class KProgressDialog; + class PreBookmark; + class TeXFontDefinition; +@@ -154,7 +154,7 @@ public: + //void editor_finished(const DVISourceEditor*); + + public slots: +- void exportPS(const QString& fname = QString(), const QStringList& options = QStringList(), QPrinter* printer = 0); ++ void exportPS(const QString& fname = QString(), const QStringList& options = QStringList(), QPrinter* printer = 0, QPrinter::Orientation orientation = QPrinter::Portrait); + void exportPDF(); + + //void showInfo(); +diff -up kdegraphics-4.6.4/okular/generators/dvi/generator_dvi.cpp.okular-landscape kdegraphics-4.6.4/okular/generators/dvi/generator_dvi.cpp +--- kdegraphics-4.6.4/okular/generators/dvi/generator_dvi.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/dvi/generator_dvi.cpp 2011-06-17 10:05:44.648023855 -0500 +@@ -567,7 +567,7 @@ bool DviGenerator::print( QPrinter& prin + + QEventLoop el; + m_dviRenderer->setEventLoop( &el ); +- m_dviRenderer->exportPS( tf.fileName(), printOptions, &printer ); ++ m_dviRenderer->exportPS( tf.fileName(), printOptions, &printer, document()->orientation() ); + + tf.close(); + +diff -up kdegraphics-4.6.4/okular/generators/poppler/generator_pdf.cpp.okular-landscape kdegraphics-4.6.4/okular/generators/poppler/generator_pdf.cpp +--- kdegraphics-4.6.4/okular/generators/poppler/generator_pdf.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/poppler/generator_pdf.cpp 2011-06-17 10:05:44.649023859 -0500 +@@ -964,7 +964,8 @@ bool PDFGenerator::print( QPrinter& prin + int ret = Okular::FilePrinter::printFile( printer, tempfilename, + Okular::FilePrinter::SystemDeletesFiles, + Okular::FilePrinter::ApplicationSelectsPages, +- document()->bookmarkedPageRange() ); ++ document()->bookmarkedPageRange(), ++ document()->orientation() ); + + lastPrintError = Okular::FilePrinter::printError( ret ); + +diff -up kdegraphics-4.6.4/okular/generators/spectre/generator_ghostview.cpp.okular-landscape kdegraphics-4.6.4/okular/generators/spectre/generator_ghostview.cpp +--- kdegraphics-4.6.4/okular/generators/spectre/generator_ghostview.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/generators/spectre/generator_ghostview.cpp 2011-06-17 10:05:44.649023859 -0500 +@@ -148,7 +148,8 @@ bool GSGenerator::print( QPrinter& print + int ret = Okular::FilePrinter::printFile( printer, fileName, + Okular::FilePrinter::SystemDeletesFiles, + Okular::FilePrinter::ApplicationSelectsPages, +- document()->bookmarkedPageRange() ); ++ document()->bookmarkedPageRange(), ++ document()->orientation() ); + if ( ret >= 0 ) result = true; + } + +diff -up kdegraphics-4.6.4/okular/part.cpp.okular-landscape kdegraphics-4.6.4/okular/part.cpp +--- kdegraphics-4.6.4/okular/part.cpp.okular-landscape 2011-06-06 10:27:23.000000000 -0500 ++++ kdegraphics-4.6.4/okular/part.cpp 2011-06-17 10:05:44.650023865 -0500 +@@ -2057,24 +2057,7 @@ void Part::slotPrint() + + void Part::setupPrint( QPrinter &printer ) + { +- double width, height; +- int landscape, portrait; +- const Okular::Page *page; +- +- // if some pages are landscape and others are not the most common win as QPrinter does +- // not accept a per page setting +- landscape = 0; +- portrait = 0; +- for (uint i = 0; i < m_document->pages(); i++) +- { +- page = m_document->page(i); +- width = page->width(); +- height = page->height(); +- if (page->orientation() == Okular::Rotation90 || page->orientation() == Okular::Rotation270) qSwap(width, height); +- if (width > height) landscape++; +- else portrait++; +- } +- if (landscape > portrait) printer.setOrientation(QPrinter::Landscape); ++ printer.setOrientation(m_document->orientation()); + + // title + QString title = m_document->metaData( "DocumentTitle" ).toString(); diff --git a/kdegraphics.spec b/kdegraphics.spec index e31ee7b..8fb1b52 100644 --- a/kdegraphics.spec +++ b/kdegraphics.spec @@ -13,7 +13,7 @@ Summary: KDE Graphics Applications Epoch: 7 Version: 4.6.4 -Release: 1%{?dist} +Release: 2%{?dist} Name: kdegraphics #Obsoletes: kdegraphics4 < %{version}-%{release} @@ -23,6 +23,9 @@ Group: Applications/Multimedia License: GPLv2 URL: http://www.kde.org/ Source0: ftp://ftp.kde.org/pub/kde/stable/%{version}/src/kdegraphics-%{version}.tar.bz2 +# HACK, 4.6.4 included an older version of okular by mistake, here's what it should be +# git archive --prefix=okular/ 4.6 | bzip2 -9 > ../okular-0.12.4-20110617.tar.bz2 +Source1: okular-0.12.4-20110617.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ## upstreamable patches @@ -36,6 +39,8 @@ Patch53: kdegraphics-4.6.2-libjpeg_version.patch # fix printing of landscape documents in Okular (#509645, kde#181290) # https://git.reviewboard.kde.org/r/101513/ Patch54: kdegraphics-4.6.3-okular-landscape.patch +# rebase patch54 against okular-0.12.4 +Patch55: kdegraphics-okular-0.12.4-landscape.patch ## upstream patches @@ -128,10 +133,13 @@ Summary: A kioslave for displaying WinHelp files %prep %setup -q -n kdegraphics-%{version}%{?alphatag} +rm -rf okular/ +%setup -q -T -D -a 1 + %patch50 -p1 -b .okular_dt %patch51 -p1 -b .OkularConfig %patch53 -p1 -b .libjpeg_version -%patch54 -p1 -b .okular-landscape +%patch55 -p1 -b .okular-landscape %build @@ -282,6 +290,9 @@ fi %changelog +* Fri Jun 17 2011 Rex Dieter 4.6.4-2 +- include okular-0.12.4 (kdegraphics-4.6.4.tar.bz2 inadvertantly included an older version) + * Mon Jun 06 2011 Than Ngo - 4.6.4-1 - 4.6.4 diff --git a/sources b/sources index a30d6f6..f9d9f0e 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ 91b52d9a7b5bd9874d5f947b4c196327 kdegraphics-4.6.4.tar.bz2 +6fd0bc698467b960ba893155c32cb6fa okular-0.12.4-20110617.tar.bz2