Skip to content

Instantly share code, notes, and snippets.

@ShadowKyogre
Created March 26, 2013 22:13
Show Gist options
  • Save ShadowKyogre/5249804 to your computer and use it in GitHub Desktop.
Save ShadowKyogre/5249804 to your computer and use it in GitHub Desktop.
Updated PKGBUILD and patch to make lp work for printing
--- pdfviewer/lib/src/printhandler.cpp 2012-07-03 09:08:51.000000000 -0700
+++ pdfviewer.cpy/lib/src/printhandler.cpp 2013-03-26 15:07:34.877746626 -0700
@@ -142,8 +142,8 @@
int startPage, endPage;
if (printer.printRange() == QPrinter::PageRange)
{
- startPage = printer.fromPage() - 1;
- endPage = printer.toPage() - 1;
+ startPage = printer.fromPage();
+ endPage = printer.toPage();
}
else if (printer.printRange() == QPrinter::CurrentPage)
{
@@ -152,8 +152,8 @@
}
else
{
- startPage = 0;
- endPage = popplerDocument->numPages() - 1;
+ startPage = 1;
+ endPage = popplerDocument->numPages();
}
// print
@@ -179,27 +179,34 @@
if (!printer.printerName().isEmpty())
{
QStringList args;
- if (!printer.printerName().contains(QLatin1Char(' ')))
- args << QString(QLatin1String("-d %1")).arg(printer.printerName());
- args << QString(QLatin1String("-n %1")).arg(printer.copyCount());
- args << QString(QLatin1String("-P %1-%2")).arg(startPage).arg(endPage);
+ if (!printer.printerName().contains(QLatin1Char(' '))) {
+ args << QString(QLatin1String("-d"));
+ args << printer.printerName();
+ }
+ args << QString(QLatin1String("-n"));
+ args << QString(QLatin1String("%1")).arg(printer.copyCount());
+ args << QString(QLatin1String("-P"));
+ args << QString(QLatin1String("%1-%2")).arg(startPage).arg(endPage);
switch(printer.duplex())
{
case QPrinter::DuplexNone:
- args << QLatin1String("-o sides=one-sided");
+ args << QLatin1String("-o");
+ args << QLatin1String("sides=one-sided");
break;
case QPrinter::DuplexShortSide:
- args << QLatin1String("-o sides=two-sided-short-edge");
+ args << QLatin1String("-o");
+ args << QLatin1String("sides=two-sided-short-edge");
break;
case QPrinter::DuplexLongSide:
- args << QLatin1String("-o sides=two-sided-long-edge");
+ args << QLatin1String("-o");
+ args << QLatin1String("sides=two-sided-long-edge");
break;
default:
break;
}
args << cupsOptions();
args << QLatin1String("--");
- args << QString(QLatin1String("\"%1\"")).arg(fileName);
+ args << QString(QLatin1String("%1")).arg(fileName);
// QProcess::execute(PDFVIEWLIB_PRINT_PROGRAM, args);
QProcess::startDetached(QString::fromLocal8Bit(PDFVIEWLIB_PRINT_PROGRAM), args);
# Contributer: [email protected]
pkgname=pdfviewer
pkgver=0.7
pkgrel=3
pkgdesc="Lightweight Qt-only PDF viewer"
arch=('i686' 'x86_64')
url="http://opendesktop.org/content/show.php/Pdf+Viewer?content=149637"
license=('GPL')
depends=('qt4' 'poppler-qt')
makedepends=('cmake' 'gettext' 'automoc4')
options=('')
source=(http://opendesktop.org/CONTENT/content-files/149637-${pkgname}-${pkgver}.tar.bz2
dont_enclose_filename_in_quotes.patch)
sha1sums=('46d853e7d4289f3059dcd30a1a254761978042ee'
'7f548e5ff4717d506faca5e4dcc7fd2c5e9705b9')
build() {
cd "${srcdir}/${pkgname}"
patch -Np1 -i "${srcdir}/dont_enclose_filename_in_quotes.patch"
qmake-qt4 ${srcdir}/${pkgname}/pdfviewer.pro \
"CONFIG+=LINUX_INTEGRATED" \
"INSTALL_ROOT_PATH=${pkgdir}"
#sed -i '49s|"c"|"c;/usr/lib/libcrypto.so.1.0.0"|g' $srcdir/build/CMakeFiles/CMakeCCompiler.cmake
make INSTALL_ROOT="$pkgdir" install
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment