kprinter4-12/ 0000755 0001750 0001750 00000000000 12354274532 011307 5 ustar mba mba kprinter4-12/README.md 0000644 0001750 0001750 00000001432 12354274517 012571 0 ustar mba mba KPrinter4
=========
KPrinter4 is a simple stand-alone PostScript document printer modelled after the
KDE 4 print dialog. It can be used in place of /bin/lpr in order to better
control the print setup of non-KDE applications.
Main features:
* Printing PostScript documents with KDE 4 print dialog.
* Scaling and positioning of documents.
* Poster printing (backported from the known KDE 3 KPrinter tool).
Known limitations so far:
* Poster printing with multi-page documents: Only first page will be taken.
### Prerequisites
Debian Packages: psutils, ghostscript, poster
### Compile
mkdir build
cd build
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr ..
make
(sudo) make install
### Run
build/kprinter4 --help
build/kprinter4 [options] file.ps
kprinter4-12/CMakeLists.txt 0000644 0001750 0001750 00000002633 12354274532 014053 0 ustar mba mba project(kprinter4)
cmake_minimum_required(VERSION 2.8)
set(KPRINTER4_VERSION "12")
set(LIBSPECTRE_MINIMUM_VERSION "0.2")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
include(MacroOptionalAddSubdirectory)
find_package(LibSpectre REQUIRED)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
${KDE4_INCLUDE_DIR}
${QT_INCLUDES}
${LIBSPECTRE_INCLUDE_DIR}
)
set(kprinter4_SRCS
main.cpp
fileprinter.cpp
postscriptdocument.cpp
utils/papersizeutils.cpp
utils/tmpdir.cpp
utils/pid.cpp
widgets/printscalingoptionswidget.cpp
widgets/posterwidget.cpp
widgets/posterpreview.cpp
)
kde4_add_ui_files(kprinter4_SRCS
widgets/printscalingoptionswidgetUI.ui
)
kde4_add_executable(kprinter4 ${kprinter4_SRCS})
target_link_libraries(kprinter4
${KDE4_KDEUI_LIBS}
${KDE4_KDECORE_LIBS}
${KDE4_KUTILS_LIBS}
${KDE4_KIO_LIBRARY}
${KDE4_KPRINTUTILS_LIBS}
${QT_QTNETWORK_LIBRARY}
${QT_QTGUI_LIBRARY}
${LIBSPECTRE_LIBRARY}
)
install(TARGETS kprinter4 DESTINATION ${BIN_INSTALL_DIR})
install(FILES kprinter4.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
add_subdirectory(icons)
add_subdirectory(po)
kprinter4-12/postscriptdocument.cpp 0000644 0001750 0001750 00000024760 12354274517 016000 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "postscriptdocument.h"
PostScriptDocumentPage::PostScriptDocumentPage() {
clear();
}
PostScriptDocumentPage::PostScriptDocumentPage(const QSize& size, const QPrinter::Orientation orientation, const bool reversePage) {
p_size = size;
p_orientation = orientation;
p_reverse_page = reversePage;
p_is_valid = TRUE;
}
PostScriptDocumentPage::PostScriptDocumentPage(const PostScriptDocumentPage& other) {
p_size = other.p_size;
p_orientation = other.p_orientation;
p_reverse_page = other.p_reverse_page;
p_is_valid = other.p_is_valid;
}
PostScriptDocumentPage& PostScriptDocumentPage::operator=(const PostScriptDocumentPage& other) {
p_size = other.p_size;
p_orientation = other.p_orientation;
p_reverse_page = other.p_reverse_page;
p_is_valid = other.p_is_valid;
return *this;
}
PostScriptDocumentPage::~PostScriptDocumentPage() {
}
void PostScriptDocumentPage::clear() {
p_size = QSize(0, 0);
p_orientation = DEFAULT_ORIENTATION;
p_reverse_page = FALSE;
p_is_valid = FALSE;
}
PostScriptDocument::PostScriptDocument() {
p_tmp_dir = NULL;
p_tmp_path.clear();
}
PostScriptDocument::PostScriptDocument(const QString& fileName) {
load(fileName);
}
PostScriptDocument::~PostScriptDocument() {
}
bool PostScriptDocument::load(const QString& fileName) {
p_filename = fileName;
p_internal_document = spectre_document_new();
spectre_document_load(p_internal_document, QFile::encodeName(p_filename));
const SpectreStatus loadStatus = spectre_document_status(p_internal_document);
if (loadStatus != SPECTRE_STATUS_SUCCESS) {
kDebug() << "ERR:" << spectre_status_to_string(loadStatus);
spectre_document_free(p_internal_document);
clear();
return FALSE;
}
int numPages = spectre_document_get_n_pages(p_internal_document);
if (numPages > 0) {
kDebug() << "Page Count: " << numPages;
} else {
kWarning() << "Unable to calculate number of pages.";
numPages = 0;
}
int width, height;
spectre_document_get_page_size(p_internal_document, &width, &height);
if ((width > 0) && (height > 0)) {
p_page_size = QSize(width, height);
kDebug() << "Page Size: " << width << "x" << height << " (" << PaperSizeUtils::paperSizeToString(PaperSizeUtils::sizeToPaperSize(p_page_size)) << ")";
} else {
kWarning() << "Unable to calculate page size.";
}
SpectreOrientation orientation = spectre_document_get_orientation(p_internal_document);
bool reversePage;
p_orientation = spectreOrientationToOrientation(orientation, &reversePage);
kDebug() << "Page Orientation: " << PaperSizeUtils::orientationToString(p_orientation);
kDebug() << "Note: The page orientation may differ from orientation for each page.";
/* Load the pages now */
SpectrePage *page;
SpectreOrientation pageOrientation;
QPrinter::Orientation pageOrientation2;
width = 0; height = 0;
for (int i = 0; i < numPages; ++i) {
pageOrientation = SPECTRE_ORIENTATION_PORTRAIT;
page = spectre_document_get_page(p_internal_document, i);
if (spectre_document_status(p_internal_document)) {
kWarning() << "Error getting page " << i << spectre_status_to_string(spectre_document_status(p_internal_document));
} else {
spectre_page_get_size(page, &width, &height);
pageOrientation = spectre_page_get_orientation(page);
}
spectre_page_free(page);
pageOrientation2 = spectreOrientationToOrientation(pageOrientation, &reversePage);
p_pages.append(PostScriptDocumentPage(QSize(width, height), pageOrientation2, reversePage));
kDebug() << "Append page" << i+1 << "with Size (" << width << "," << height << ")," << PaperSizeUtils::orientationToString(pageOrientation2);
}
kDebug() << "Loaded" << p_pages.count() << "pages";
p_is_valid = TRUE;
return TRUE;
}
bool PostScriptDocument::close() {
spectre_document_free(p_internal_document);
clear();
return TRUE;
}
void PostScriptDocument::clear() {
p_filename.clear();
p_pages.clear();
p_page_size = QSize();
p_orientation = DEFAULT_ORIENTATION;
p_is_valid = FALSE;
p_internal_document = NULL;
}
QImage* PostScriptDocument::renderPage(const int pageNum, const int dpiX, const int dpiY) {
Q_UNUSED(dpiX);
Q_UNUSED(dpiY);
if ((pageNum < 0) || (pageNum >= p_pages.count())) return NULL;
PostScriptDocumentPage page = p_pages[pageNum];
/*int width = reqSize.width();
int height = reqSize.height();
double magnify = 1.0f;
if (page.orientation() == QPrinter::Landscape) {
magnify = qMax((double)height / (double)page.size().width(),
(double)width / (double)page.size().height());
} else {
magnify = qMax((double)width / (double)page.size().width(),
(double)height / (double)page.size().height());
}*/
SpectrePage *spage = spectre_document_get_page(p_internal_document, pageNum);
SpectreRenderContext *renderContext = spectre_render_context_new();
/*spectre_render_context_set_scale(renderContext, magnify, magnify);*/
spectre_render_context_set_use_platform_fonts(renderContext, false);
spectre_render_context_set_antialias_bits(renderContext, 4, 4);
/* Do not use spectre_render_context_set_rotation makes some files not render correctly, e.g. bug210499.ps
* so we basically do the rendering without any rotation and then rotate to the orientation as needed
* spectre_render_context_set_rotation(m_renderContext, req.orientation);
*/
unsigned char *data = NULL;
int row_length = 0;
spectre_page_render(spage, renderContext, &data, &row_length);
if (spectre_page_status(spage) != SPECTRE_STATUS_SUCCESS) {
kDebug() << "Failed to render page" << pageNum+1 << ". Spectre fail status:" << spectre_page_status(spage);
return NULL;
}
int width = page.size().width();
int height = page.size().height();
kDebug() << "Size of page" << pageNum+1 << "to render: " << width << "x" << height;
// Qt4 needs the missing alpha of QImage::Format_RGB32 to be 0xff
if (data && data[3] != 0xff)
for (int i = 3; i < row_length * height; i += 4)
data[i] = 0xff;
QImage image;
if (row_length == width * 4) {
image = QImage(data, width, height, QImage::Format_RGB32);
} else {
// In case this ends up beign very slow we can try with some memmove
QImage aux(data, row_length / 4, height, QImage::Format_RGB32);
image = QImage(aux.copy(0, 0, width, height));
}
/*if (page.reversePage()) {
if (page.orientation() == QPrinter::Portrait) {
QTransform m;
m.rotate(180);
image = image.transformed(m);
} else if (page.orientation() == QPrinter::Landscape) {
QTransform m;
m.rotate(270);
image = image.transformed(m);
}
} else {
if (page.orientation() == QPrinter::Landscape) {
QTransform m;
m.rotate(90);
image = image.transformed(m);
}
}*/
QImage *result = new QImage(image.copy());
if ((result->width() != width) || (result->height() != height)) {
kWarning().nospace() << "Generated image does not match wanted size: "
<< "[" << result->width() << "x" << result->height() << "] vs requested "
<< "[" << width << "x" << height << "]";
QImage aux = result->scaled(width, height);
delete result;
result = new QImage(aux);
}
spectre_page_free(spage);
spectre_render_context_free(renderContext);
return result;
}
void PostScriptDocument::renderPagesGS(const int dpiX, const int dpiY) {
Q_UNUSED(dpiX);
Q_UNUSED(dpiY);
if (p_tmp_dir) return;
p_tmp_dir = new TmpDir("kprinter4");
p_tmp_path = p_tmp_dir->tmpPath();
if (p_tmp_dir->error()) return;
QStringList args;
args << "-q";
args << "-dNOPAUSE";
args << "-dSAFER";
args << "-dQUIET";
args << "-dBATCH";
args << "-dNOPROMPT";
//args << QString("-r%1x%2").arg(dpiX).arg(dpiY);
args << QString("-sPAPERSIZE=%1").arg(PaperSizeUtils::paperSizeToString(PaperSizeUtils::sizeToPaperSize(p_page_size)).toLower());
args << "-sDEVICE=png16m";
args << "-dTextAlphaBits=4";
args << "-dGraphicsAlphaBits=4";
args << QString("-sOutputFile=%1").arg(p_tmp_path+"%d.png");
args << p_filename;
kDebug() << "Executing" << "gs" << "with arguments" << args;
if (KProcess::execute("gs", args) != 0) {
kDebug() << "Rendering pages failed: Execution of GhostScript (gs) failed.";
return;
}
}
QImage* PostScriptDocument::fetchRenderedPageGS(const int pageNum) {
if ((pageNum < 0) || (pageNum >= p_pages.count())) return NULL;
PostScriptDocumentPage page = p_pages[pageNum];
int width = page.size().width();
int height = page.size().height();
kDebug() << "Fetching page from file" << p_tmp_path+QString("%1.png").arg(pageNum+1);
QImage image(p_tmp_path+QString("%1.png").arg(pageNum+1));
QImage *result = new QImage(image.copy());
if ((result->width() != width) || (result->height() != height)) {
kWarning().nospace() << "Generated image does not match wanted size: "
<< "[" << result->width() << "x" << result->height() << "] vs requested "
<< "[" << width << "x" << height << "]";
QImage aux = result->scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
delete result;
result = new QImage(aux);
}
return result;
}
void PostScriptDocument::clearRenderedPagesGS() {
p_tmp_path.clear();
if (p_tmp_dir) delete p_tmp_dir;
}
QPrinter::Orientation PostScriptDocument::spectreOrientationToOrientation(SpectreOrientation orientation, bool *reversePage) {
*reversePage = TRUE;
switch (orientation) {
case SPECTRE_ORIENTATION_PORTRAIT : *reversePage = FALSE;
case SPECTRE_ORIENTATION_REVERSE_PORTRAIT : return QPrinter::Portrait;
case SPECTRE_ORIENTATION_LANDSCAPE : *reversePage = FALSE;
case SPECTRE_ORIENTATION_REVERSE_LANDSCAPE : return QPrinter::Landscape;
}
return DEFAULT_ORIENTATION;
}
kprinter4-12/po/ 0000755 0001750 0001750 00000000000 12354274517 011730 5 ustar mba mba kprinter4-12/po/CMakeLists.txt 0000644 0001750 0001750 00000000167 12354274517 014474 0 ustar mba mba find_package(Gettext REQUIRED)
file(GLOB catalogs *.po)
gettext_create_translations("kprinter4.pot" ALL ${catalogs})
kprinter4-12/po/kprinter4.pot 0000644 0001750 0001750 00000024051 12354274517 014400 0 ustar mba mba # SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-13 16:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: widgets/posterwidget.cpp:41
msgid " 5. "
msgstr ""
#: widgets/posterwidget.cpp:45
msgid ""
" Print Poster (enabled or disabled). If you enable this "
"option, you can print posters of different sizes The printout will happen "
"in the form 'tiles' printed on smaller paper sizes, which you can "
"stitch together later. If you enable this option here, the 'Poster "
"Printing' filter will be auto-loaded in the 'Filters' tab of this "
"dialog.
This tab is only visible if the external 'poster' "
"utility is discovered by KDEPrint on your system. ['poster' is a "
"commandline utility that enables you to convert PostScript files into tiled "
"printouts which allow for oversized appearance of the stitched-together "
"tiles.]
Note: The standard version of 'poster' will not work. "
"Your system must use a patched version of 'poster'. Ask your operating "
"system vendor to provide a patched version of 'poster' if he does not "
"already.
"
msgstr ""
#: widgets/posterwidget.cpp:61
msgid ""
" Tile Selection widget This GUI element is not only for "
"viewing your selections: it also lets you interactively select the tile"
"(s) you want to print.
Hints
Click any tile to "
"select it for printing. To select multiple tiles to be printed at "
"once, 'shift-click' on the tiles ('shift-click' means: hold down "
"the [SHIFT]-key on your keyboard and click with the mouse while [SHIFT]-key "
"is held.) Be aware that the order of your clicking is also "
"significant to the order of printing the different tiles. "
"Note 1: The order of your selection (and the order for printout of "
"the tiles) is indicated by the contents of the text field below, labelled "
"as 'Tile pages (to be printed):' Note 2: By default no "
"tile is selected. Before you can print (a part of) your poster, you must "
"select at least one tile.
"
msgstr ""
#: widgets/posterwidget.cpp:82
msgid ""
" Poster Size Select the poster size you want from the "
"dropdown list.
Available sizes are all standard paper sizes up to "
"'A0'. [A0 is the same size as 16 sheets of A4, or '84cm x 118.2cm'.]
"
"Notice , how the little preview window below changes with your "
"change of poster size. It indicates to you how many tiles need to be "
"printed to make the poster, given the selected paper size.
Hint:"
" The little preview window below is not just a passive icon. You can "
"click on its individual tiles to select them for printing. To select "
"multiple tiles to be printed at once, you need to 'shift-click' on "
"the tiles ('shift-click' means: hold down the [SHIFT]-key on your keyboard "
"and click with the mouse while [SHIFT]-key is held.) The order of your "
"clicking is significant to the order of printing the different tiles. The "
"order of your selection (and for the printed tiles) is indicated by the "
"contents of the text field labelled as 'Tile pages (to be printed):'"
"em> Note: By default no tile is selected. Before you can print (a "
"part of) your poster, you must select at least one tile.
"
msgstr ""
#: widgets/posterwidget.cpp:101
msgid ""
" Paper Size This field indicates the paper size the poster "
"tiles will be printed on. To select a different paper size for your poster "
"tiles, go to the 'General' tab of this dialog and select one from the "
"dropdown list.
Available sizes are most standard paper sizes supported "
"by your printer. Your printer's supported paper sizes are read from the "
"printer driver info (as laid down in the 'PPD' , the printer "
"description file). Be aware that the 'Paper Size' selected may not be "
"supported by 'poster' (example: 'HalfLetter') while it may well be "
"supported by your printer. If you hit that obstacle, simply use "
"another, supported Paper Size, like 'A4' or 'Letter'. Notice , how "
"the little preview window below changes with your change of paper size. It "
"indicates how many tiles need to be printed to make up the poster, given "
"the selected paper and poster size.
Hint: The little preview "
"window below is not just a passive icon. You can click on its individual "
"tiles to select them for printing. To select multiple tiles to be printed "
"at once, you need to 'shift-click' on the tiles ('shift-click' "
"means: hold down the [SHIFT]-key on your keyboard and click with the mouse "
"while [SHIFT]-key is held.) The order of your clicking is significant to "
"the order of printing the different tiles. The order of your selection (and "
"for the printed tiles) is indicated by the contents of the text field "
"labelled as 'Tile pages (to be printed):'
Note: By "
"default no tile is selected. Before you can print (a part of) your poster, "
"you must select at least one tile.
"
msgstr ""
#: widgets/posterwidget.cpp:125
msgid ""
" Cut Margin selection Slider and spinbox let you determine "
"a 'cut margin' which will be printed onto each tile of your poster "
"to help you cut the pieces as needed.
Notice , how the little "
"preview window above changes with your change of cut margins. It indicates "
"to you how much space the cut margins will take away from each tile. "
"
Be aware , that your cut margins need to be equal to or greater "
"than the margins your printer uses. The printer's capabilities are "
"described in the 'ImageableArea' keywords of its driver PPD file. "
"
"
msgstr ""
#: widgets/posterwidget.cpp:136
msgid ""
" Order and number of tile pages to be printed This field "
"displays and sets the individual tiles to be printed, as well as the order "
"for their printout.
You can file the field with 2 different methods: "
" Either use the interactive thumbnail preview above and '[SHIFT]-"
"click' on the tiles. Or edit this text field accordingly. "
" When editing the field, you can use a '3-7' syntax instead of a "
"'3,4,5,6,7' one.
Examples:
\"2,3,7,9,3\" "
" \"1-3,6,8-11\" "
msgstr ""
#: widgets/posterwidget.cpp:153
msgid "Poster"
msgstr ""
#: widgets/posterwidget.cpp:155
msgid "&Print poster"
msgstr ""
#: widgets/posterwidget.cpp:170
msgid "Poste&r size:"
msgstr ""
#: widgets/posterwidget.cpp:172
msgid "Media size:"
msgstr ""
#: widgets/posterwidget.cpp:174
msgid "Pri&nt size:"
msgstr ""
#: widgets/posterwidget.cpp:181
#, no-c-format
msgid "C&ut margin (% of media):"
msgstr ""
#: widgets/posterwidget.cpp:186
msgid "&Tile pages (to be printed):"
msgstr ""
#: widgets/posterwidget.cpp:193
msgid "Link/unlink poster and print size"
msgstr ""
#: widgets/posterwidget.cpp:204
msgid "Note: Only first page will be taken for poster print. "
msgstr ""
#: widgets/posterwidget.cpp:419
msgid "Unknown"
msgstr ""
#: widgets/posterpreview.cpp:118
msgid ""
"Poster preview not available. Either the poster executable is not "
"properly installed, or you don't have the required version; available at "
"http://printing.kde.org/downloads/."
msgstr ""
#: rc.cpp:3 rc.cpp:6
msgid "Scaling"
msgstr ""
#: rc.cpp:9
msgid "&No scaling"
msgstr ""
#: rc.cpp:12
msgid "&Fit document to page"
msgstr ""
#: rc.cpp:15
msgid "Enlarge smaller pages"
msgstr ""
#: rc.cpp:18
msgid "&Scale to:"
msgstr ""
#: rc.cpp:22
#, no-c-format
msgid " %"
msgstr ""
#: rc.cpp:25
msgid "Document Position"
msgstr ""
#: main.cpp:87 main.cpp:261
msgid "KPrinter4"
msgstr ""
#: main.cpp:262
msgid "Simple PostScript document printer"
msgstr ""
#: main.cpp:264
msgid "Copyright © 2014 by Marco Nelles (credativ GmbH)"
msgstr ""
#: main.cpp:268
msgid "Marco Nelles"
msgstr ""
#: main.cpp:268
msgid "Current maintainer, main developer"
msgstr ""
#: main.cpp:269
msgid "City of Munich"
msgstr ""
#: main.cpp:269
msgid "LiMux project"
msgstr ""
#: main.cpp:270
msgid "credativ GmbH"
msgstr ""
#: main.cpp:270
msgid "credativ GmbH (Germany)"
msgstr ""
#: main.cpp:275
msgid "Make an internal copy of the files to print"
msgstr ""
#: main.cpp:276
msgid "Printer/destination to print on"
msgstr ""
#: main.cpp:277
msgid "Title/Name for the print job"
msgstr ""
#: main.cpp:278
msgid "Number of copies"
msgstr ""
#: main.cpp:279
msgid "Printer/Job option(s)"
msgstr ""
#: main.cpp:280
msgid "Job output mode (gui, console, none)"
msgstr ""
#: main.cpp:281
msgid "Print system to use (autodetect, lpd, cups)"
msgstr ""
#: main.cpp:282
msgid "Print from STDIN"
msgstr ""
#: main.cpp:283
msgid "Do not show the print dialog (print directly)"
msgstr ""
#: main.cpp:284
msgid "Show file dialog instead of printing from STDIN."
msgstr ""
#: main.cpp:285
msgid "PostScript document(s) to print"
msgstr ""
#: main.cpp:294
msgid "Option -c not implemented yet"
msgstr ""
#: main.cpp:311
msgid "Unknown value \"%1\" for option -j. Using default value \"gui\"."
msgstr ""
#: main.cpp:317
msgid ""
"Unknown value \"%1\" for option --system. Using default value \"autodetect\"."
msgstr ""
#: main.cpp:328
msgid "Found more than one file parameter. Using only the first one."
msgstr ""
#: main.cpp:336
msgid "Open PostScript document"
msgstr ""
#: main.cpp:342
msgid "Wait for STDIN..."
msgstr ""
#: utils/papersizeutils.cpp:187
msgid "Portrait"
msgstr ""
#: utils/papersizeutils.cpp:188
msgid "Landscape"
msgstr ""
kprinter4-12/po/de.po 0000644 0001750 0001750 00000042461 12354274517 012667 0 ustar mba mba # This file is distributed under the same license as the KPRINTER4 package.
# Marco Nelles , 2014.
msgid ""
msgstr ""
"Project-Id-Version: kprinter4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-13 16:48+0100\n"
"PO-Revision-Date: 2014-01-22 07:00+0100\n"
"Last-Translator: Marco Nelles \n"
"Language-Team: Marco Nelles \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: rc.cpp:22
#, no-c-format
msgid " %"
msgstr " %"
#: widgets/posterwidget.cpp:41
msgid " 5. "
msgstr ""
#: widgets/posterwidget.cpp:125
msgid ""
" Cut Margin selection Slider and spinbox let you determine "
"a 'cut margin' which will be printed onto each tile of your poster "
"to help you cut the pieces as needed.
Notice , how the little "
"preview window above changes with your change of cut margins. It indicates "
"to you how much space the cut margins will take away from each tile. "
"
Be aware , that your cut margins need to be equal to or greater "
"than the margins your printer uses. The printer's capabilities are "
"described in the 'ImageableArea' keywords of its driver PPD file. "
"
"
msgstr ""
" Schnittrand-Auswahl Der Schieberegler und das Drehfeld "
"ermöglichen die Bestimmung eines 'Schnittrandes' , der auf jede "
"Kachel gedruckt wird und Ihnen hilft, die Stücke Ihres Posters wie "
"erforderlich zuzuschneiden.
Beachten Sie , wie sich das kleine "
"Vorschaufenster oberhalb mit den Änderungen des Schnittrandes ändert. Es "
"zeigt an, wieviel Platz der Schnittrand von jeder Kachel wegnimmt."
"
Beachten Sie , dass der Schnittrand unbedingt gleich oder größer "
"des Druckrandes sein muss. Die Fähigkeiten des Druckers sind in der "
"Einstellung 'ImageableArea' der PPD-Datei enthalten.
"
#: widgets/posterwidget.cpp:136
msgid ""
" Order and number of tile pages to be printed This field "
"displays and sets the individual tiles to be printed, as well as the order "
"for their printout.
You can file the field with 2 different methods: "
" Either use the interactive thumbnail preview above and '[SHIFT]-"
"click' on the tiles. Or edit this text field accordingly. "
" When editing the field, you can use a '3-7' syntax instead of a "
"'3,4,5,6,7' one.
Examples:
\"2,3,7,9,3\" "
" \"1-3,6,8-11\" "
msgstr ""
" Reihenfolge und Anzahl der zu druckenden Kachelseiten Dieses "
"Feld zeigt die einzeln zu druckenden Kacheln an, sowie die Reihenfolge des "
"Ausdrucks.
Die Einstellung kann auf zwei Arten geändert werden: "
"Entweder mit der interaktiven Mini-Vorschau und Klicken bei gedrückter "
"Umschalt-Taste auf die Kacheln. oder durch Eingeben der Daten in "
"das Textfeld. Beim Bearbeiten des Feldes können Sie auch "
"'3-7' anstelle von'3,4,5,6,7' eingeben.
Beispiele:
"
" \"2,3,7,9,3\" \"1-3,6,8-11\" "
#: widgets/posterwidget.cpp:101
msgid ""
" Paper Size This field indicates the paper size the poster "
"tiles will be printed on. To select a different paper size for your poster "
"tiles, go to the 'General' tab of this dialog and select one from the "
"dropdown list.
Available sizes are most standard paper sizes supported "
"by your printer. Your printer's supported paper sizes are read from the "
"printer driver info (as laid down in the 'PPD' , the printer "
"description file). Be aware that the 'Paper Size' selected may not be "
"supported by 'poster' (example: 'HalfLetter') while it may well be "
"supported by your printer. If you hit that obstacle, simply use "
"another, supported Paper Size, like 'A4' or 'Letter'. Notice , how "
"the little preview window below changes with your change of paper size. It "
"indicates how many tiles need to be printed to make up the poster, given "
"the selected paper and poster size.
Hint: The little preview "
"window below is not just a passive icon. You can click on its individual "
"tiles to select them for printing. To select multiple tiles to be printed "
"at once, you need to 'shift-click' on the tiles ('shift-click' "
"means: hold down the [SHIFT]-key on your keyboard and click with the mouse "
"while [SHIFT]-key is held.) The order of your clicking is significant to "
"the order of printing the different tiles. The order of your selection (and "
"for the printed tiles) is indicated by the contents of the text field "
"labelled as 'Tile pages (to be printed):'
Note: By "
"default no tile is selected. Before you can print (a part of) your poster, "
"you must select at least one tile.
"
msgstr ""
" Papiergröße Dieses Feld zeigt die Papiergröße, auf die die "
"Posterkacheln gedruckt werden. Um eine andere Papiergröße für die Kacheln "
"auszuwählen, gehen Sie zum Reiter \"Allgemeines\" dieses Dialogs und wählen "
"Sie eine aus der Auswahlliste.
Verfügbare Größen sind die meisten "
"Standard-Papiergrößen Ihres Druckers. Die vom Drucker unterstützten "
"Papiergrößen werden aus der Druckerdefinitionsdatei ('PPD' ) "
"gelesen. Beachten Sie , dass nicht jede von Ihrem Drucker "
"unterstützte Papiergröße (Beispiel: HalfLetter) auch von 'poster' "
"unterstützt wird. Sollte Ihnen dieses Pech widerfahren, verwenden Sie "
"einfach eine unterstützte Papiergröße, wie \"A4\" ode \"Letter\". "
"
Beachten Sie , wie sich das kleine Vorschaufenster unten mit dem "
"Wechsel der Papiergröße ändert. Es zeigt an, wie viele Kacheln bei der "
"gewählten Papiergröße für die Postergröße notwendig sind.
Tipp:"
"b> Das kleine Vorschaufenster ist nicht nur ein passives Symbol. Sie können "
"auf die einzelnen Kacheln klicken, um sie zum Druck auswählen. Um mehrere "
"Kacheln auf einmal zum Drucken auszuwählen, halten Sie die Umschalt-"
"Taste gedrückt. Die Reihenfolge des Anklickens bestimmt auch die "
"Druckreihenfolge. Die Reihenfolge der Auswahl (und die Reihenfolge des "
"Ausdrucks) wird durch den Inhalt des Textfeldes unten angezeigt, bezeichnet "
"mit 'Kachel-Seiten (zum Drucken):'
Anmerkung: "
"Standardmäßig ist keine Kachel ausgewählt. Vor dem Druck (einem Teil) des "
"Posters muss mindestens eine Kachel ausgewählt werden.
"
#: widgets/posterwidget.cpp:82
msgid ""
" Poster Size Select the poster size you want from the "
"dropdown list.
Available sizes are all standard paper sizes up to "
"'A0'. [A0 is the same size as 16 sheets of A4, or '84cm x 118.2cm'.] "
"Notice , how the little preview window below changes with your "
"change of poster size. It indicates to you how many tiles need to be "
"printed to make the poster, given the selected paper size.
Hint:"
" The little preview window below is not just a passive icon. You can "
"click on its individual tiles to select them for printing. To select "
"multiple tiles to be printed at once, you need to 'shift-click' on "
"the tiles ('shift-click' means: hold down the [SHIFT]-key on your keyboard "
"and click with the mouse while [SHIFT]-key is held.) The order of your "
"clicking is significant to the order of printing the different tiles. The "
"order of your selection (and for the printed tiles) is indicated by the "
"contents of the text field labelled as 'Tile pages (to be printed):'"
"em> Note: By default no tile is selected. Before you can print (a "
"part of) your poster, you must select at least one tile.
"
msgstr ""
" Postergröße Wählen Sie die gewünschte Postergröße aus dem "
"Auswahlliste.
Verfügbare Größen sind alle Standard-Papiergrößen bis zu "
"'A0'. [A0 entspricht 16 A4-Blättern, oder '84cm x 118.2cm'.] "
"Beachten Sie , wie das kleine Vorschaufenster unten sich mit der "
"Größe des Posters ändert. Es zeigt an, wie viele Kacheln bei der gewählten "
"Papiergröße für die Postergröße notwendig sind.
Tipp: Das "
"kleine Vorschaufenster ist nicht nur ein passives Symbol. Sie können auf die "
"einzelnen Kacheln klicken, um diese zum Druck auswählen. Um mehrere Kacheln "
"auf einmal zum Drucken auszuwählen, halten Sie beim Klicken die Umschalt-"
"Taste gedrückt. Die Reihenfolge des Anklickens bestimmt auch die "
"Druckreihenfolge. Die Reihenfolge der Auswahl (und die Reihenfolge des "
"Ausdrucks) wird durch den Inhalt des Textfeldes unten angezeigt, bezeichnet "
"mit 'Kachel-Seiten (zum Drucken):'
Anmerkung: "
"Standardmäßig ist keine Kachel ausgewählt. Vor dem Druck (einem Teil) des "
"Posters muss mindestens eine Kachel ausgewählt werden.
"
#: widgets/posterwidget.cpp:45
msgid ""
" Print Poster (enabled or disabled). If you enable this "
"option, you can print posters of different sizes The printout will happen "
"in the form 'tiles' printed on smaller paper sizes, which you can "
"stitch together later. If you enable this option here, the 'Poster "
"Printing' filter will be auto-loaded in the 'Filters' tab of this "
"dialog.
This tab is only visible if the external 'poster' "
"utility is discovered by KDEPrint on your system. ['poster' is a "
"commandline utility that enables you to convert PostScript files into tiled "
"printouts which allow for oversized appearance of the stitched-together "
"tiles.]
Note: The standard version of 'poster' will not work. "
"Your system must use a patched version of 'poster'. Ask your operating "
"system vendor to provide a patched version of 'poster' if he does not "
"already.
"
msgstr ""
" Posterdruck (eingeschaltet oder ausgeschaltet). Wenn diese "
"Option eingeschaltet ist, können Poster verschiedener Größe gedruckt werden. "
"Der Ausdruck geschieht in Form von 'Kacheln' gedruckt auf kleinere "
"Papiergrößen, die später zusammengefügt werden können. Wenn diese Option "
"aktiviert ist, wird der 'Posterdruck'-Filter automatisch in den "
"Reiter \"Filter\" dieses Dialoges geladen.
Dieser Reiter ist nur "
"sichtbar, wenn das externe Programm 'poster' von KDEPrint auf dem "
"System gefunden wurde. ['poster' ist ein Konsolenprogramm, das die "
"Umwandlung von PostScript-Dateien in gekachelte Ausdrucke so ermöglicht, "
"dass mit den zusammengefügten Kacheln die Übergröße erreicht wird .]
"
"Anmerkung: Die Standardversion von 'poster' funktioniert hier "
"nicht. Es muss eine gepatchte Version verwendet werden. Suchen Sie bei Ihrem "
"Distributor (z. B. SuSe) nach einer gepatchten Version, falls Sie keine "
"haben.
"
#: widgets/posterwidget.cpp:61
msgid ""
" Tile Selection widget This GUI element is not only for "
"viewing your selections: it also lets you interactively select the tile"
"(s) you want to print.
Hints
Click any tile to "
"select it for printing. To select multiple tiles to be printed at "
"once, 'shift-click' on the tiles ('shift-click' means: hold down "
"the [SHIFT]-key on your keyboard and click with the mouse while [SHIFT]-key "
"is held.) Be aware that the order of your clicking is also "
"significant to the order of printing the different tiles. "
"Note 1: The order of your selection (and the order for printout of "
"the tiles) is indicated by the contents of the text field below, labelled "
"as 'Tile pages (to be printed):' Note 2: By default no "
"tile is selected. Before you can print (a part of) your poster, you must "
"select at least one tile.
"
msgstr ""
" Kachel-Auswahl Dieses Bedien-Element ist nicht nur zum "
"Betrachten Ihrer Auswahl: es kann auch zur interaktiven Auswahl der "
"Kachel(n) zum Druck dienen.
Tipps
Wählen Sie eine "
"beliebige Kachel durch Anklicken zum Druck aus. Um mehrere Kacheln "
"auf einmal zum Drucken auszuwählen, halten Sie beim Klicken die "
"'Umschalt-Taste' gedrückt. Hinweis: Die Reihenfolge des "
"Anklickens bestimmt auch die Druckreihenfolge. Anmerkung 1:"
"b> Die Reihenfolge der Auswahl (und die Reihenfolge des Ausdrucks) wird "
"durch den Inhalt des Textfeldes unten angezeigt, bezeichnet mit 'Kachel-"
"Seiten (zum Drucken):' Anmerkung 2: Standardmäßig ist keine "
"Kachel ausgewählt. Vor dem Druck (einem Teil) des Posters muss mindestens "
"eine Kachel ausgewählt werden.
"
#: rc.cpp:12
msgid "&Fit document to page"
msgstr "Dokument auf &Seitengröße einpassen"
#: rc.cpp:9
msgid "&No scaling"
msgstr "Keine Skalierung"
#: widgets/posterwidget.cpp:155
msgid "&Print poster"
msgstr "P&oster drucken"
#: rc.cpp:18
msgid "&Scale to:"
msgstr "&Vergrößern auf:"
#: widgets/posterwidget.cpp:186
msgid "&Tile pages (to be printed):"
msgstr "Auf Seiten &verteilen:"
#: widgets/posterwidget.cpp:204
msgid "Note: Only first page will be taken for poster print. "
msgstr ""
"Hinweis: Zum Poster-Druck wird nur die erste Seite des Dokuments "
"verwendet. "
#: widgets/posterwidget.cpp:181
#, no-c-format
msgid "C&ut margin (% of media):"
msgstr "&Beschnittbereich (% des Mediums):"
#: main.cpp:269
msgid "City of Munich"
msgstr "Landeshauptstadt München"
#: main.cpp:264
msgid "Copyright © 2014 by Marco Nelles (credativ GmbH)"
msgstr ""
#: main.cpp:268
msgid "Current maintainer, main developer"
msgstr "Aktiver Entwickler"
#: main.cpp:283
msgid "Do not show the print dialog (print directly)"
msgstr "Druck-Dialog nicht anzeigen (Direkt-Druck)"
#: rc.cpp:25
msgid "Document Position"
msgstr "Position des Dokuments"
#: rc.cpp:15
msgid "Enlarge smaller pages"
msgstr "K&leine Seiten vergößern"
#: main.cpp:328
msgid "Found more than one file parameter. Using only the first one."
msgstr "Mehr als einen Datei-Parameter gefunden. Verwende nur den ersten."
#: main.cpp:280
msgid "Job output mode (gui, console, none)"
msgstr "Ausgabe-Modus (gui, console, none)"
#: main.cpp:87 main.cpp:261
msgid "KPrinter4"
msgstr ""
#: utils/papersizeutils.cpp:188
msgid "Landscape"
msgstr ""
#: main.cpp:269
msgid "LiMux project"
msgstr "LiMux-Projekt"
#: widgets/posterwidget.cpp:193
msgid "Link/unlink poster and print size"
msgstr ""
"Poster- und Druckmedien-Größe verknüpfen bzw. ihre Verknüpfung aufheben"
#: main.cpp:275
msgid "Make an internal copy of the files to print"
msgstr "Erzeugt eine interne Kopie der Datei zum Drucken"
#: main.cpp:268
msgid "Marco Nelles"
msgstr ""
#: widgets/posterwidget.cpp:172
msgid "Media size:"
msgstr "Format des Mediums:"
#: main.cpp:278
msgid "Number of copies"
msgstr "Anzahl der Kopien"
#: main.cpp:336
msgid "Open PostScript document"
msgstr "Öffne PostScript-Dokument"
#: main.cpp:294
msgid "Option -c not implemented yet"
msgstr "Option -c bisher nicht implementiert"
#: utils/papersizeutils.cpp:187
msgid "Portrait"
msgstr ""
#: main.cpp:285
msgid "PostScript document(s) to print"
msgstr "PostScript-Dokumente zum Drucken"
#: widgets/posterwidget.cpp:170
msgid "Poste&r size:"
msgstr "Poster&format"
#: widgets/posterwidget.cpp:153
msgid "Poster"
msgstr "Poster"
#: widgets/posterpreview.cpp:118
msgid ""
"Poster preview not available. Either the poster executable is not "
"properly installed, or you don't have the required version; available at "
"http://printing.kde.org/downloads/."
msgstr ""
"Keine Postervorschau verfügbar. Entweder ist das Programm poster "
"nicht korrekt installiert, oder Sie verwenden nicht die benötigte Version, "
"die über http://printing.kde.org/downloads/ verfügbar ist."
#: widgets/posterwidget.cpp:174
msgid "Pri&nt size:"
msgstr "&Bedruckbarer Bereich:"
#: main.cpp:282
#, fuzzy
msgid "Print from STDIN"
msgstr "Erlaube STDIN-Eingaben"
#: main.cpp:281
msgid "Print system to use (autodetect, lpd, cups)"
msgstr "Druck-System (autodetect, lpd, cups)"
#: main.cpp:279
msgid "Printer/Job option(s)"
msgstr "Drucker/Auftrags-Option(en)"
#: main.cpp:276
msgid "Printer/destination to print on"
msgstr "Drucker/Ziel zum Drucken"
#: rc.cpp:3 rc.cpp:6
msgid "Scaling"
msgstr "Skalierung"
#: main.cpp:284
#, fuzzy
msgid "Show file dialog instead of printing from STDIN."
msgstr "Erlaube STDIN-Eingaben"
#: main.cpp:262
msgid "Simple PostScript document printer"
msgstr "Einfacher Drucker für PostScript-Dokumente"
#: main.cpp:277
msgid "Title/Name for the print job"
msgstr "Name des Druckauftrags"
#: widgets/posterwidget.cpp:419
msgid "Unknown"
msgstr "Unbekannt"
#: main.cpp:317
msgid ""
"Unknown value \"%1\" for option --system. Using default value \"autodetect\"."
msgstr ""
"Unbekannter Wert \"%1\" für Option --system. Benutze Standard-Wert "
"\"autodetect\"."
#: main.cpp:311
msgid "Unknown value \"%1\" for option -j. Using default value \"gui\"."
msgstr "Unbekannter Wert \"%1\" für Option -j. Benutze Standard-Wert \"gui\"."
#: main.cpp:342
msgid "Wait for STDIN..."
msgstr "Warte auf STDIN..."
#: main.cpp:270
msgid "credativ GmbH"
msgstr ""
#: main.cpp:270
msgid "credativ GmbH (Germany)"
msgstr "credativ GmbH (Deutschland)"
kprinter4-12/fileprinter.h 0000644 0001750 0001750 00000020423 12354274517 014007 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* This class is derived from fileprinter class from:
* Copyright (C) 2007, 2010 by John Layt
*/
#ifndef FILEPRINTER_H
#define FILEPRINTER_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
class QSize;
class FilePrinter {
public:
/** Whether file(s) get deleted by the application or by the print system.
*
* You may need to chose system deletion if your temp file clean-up
* deletes the file before the print system is finished with it.
*/
enum FileDeletePolicy { ApplicationDeletesFiles, SystemDeletesFiles };
/** Whether pages to be printed are selected by the application or the print system.
*
* If application side, then the generated file will only contain those pages
* selected by the user, so FilePrinter will print all the pages in the file.
*
* If system side, then the file will contain all the pages in the document, and
* the print system will print the users selected print range from out of the file.
*
* Note system side only works in CUPS, not LPR.
*/
enum PageSelectPolicy { ApplicationSelectsPages, SystemSelectsPages };
/** Print a file using the settings in QPrinter
*
* Only supports CUPS and LPR on *NIX. Page Range only supported in CUPS.
* Most settings unsupported by LPR, some settings unsupported by CUPS.
*
* The documentOrientation parameter was added in version 0.14.
*
* @param printer the print settings to use
* @param fileList the file list to print
* @param documentOrientation the orientation stored in the document itself
* @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
*
* @returns Returns exit code:
* -11 CUPS not detected
* -10 if temporary file could not be created
* -9 if lp/lpr not found
* -8 if empty file name
* -7 if unable to find file
* -6 if invalid printer state
* -5 if print to file copy failed
* -2 if the KProcess could not be started
* -1 if the KProcess crashed
* otherwise the KProcess exit code
*
* @since 0.14 (KDE 4.8)
*/
static int printFiles(QPrinter& printer, const QStringList fileList,
QPrinter::Orientation documentOrientation,
FileDeletePolicy fileDeletePolicy = FilePrinter::ApplicationDeletesFiles,
PageSelectPolicy pageSelectPolicy = FilePrinter::ApplicationSelectsPages,
const QString& pageRange = QString(),
const QStringList& printerOptions = QStringList(),
const QString& system = QString("autodetect"));
/** Return the list of pages selected by the user in the Print Dialog
*
* @param printer the print settings to use
* @param lastPage the last page number, needed if AllPages option is selected
* @param currentPage the current page number, needed if CurrentPage option is selected
* @param selectedPageList list of pages to use if Selection option is selected
* @returns Returns list of pages to print
*/
static QList pageList(QPrinter& printer, int lastPage,
int currentPage, const QList& selectedPageList);
/** Return the list of pages selected by the user in the Print Dialog
*
* @param printer the print settings to use
* @param lastPage the last page number, needed if AllPages option is selected
* @param selectedPageList list of pages to use if Selection option is selected
* @returns Returns list of pages to print
*/
static QList pageList(QPrinter& printer, int lastPage, const QList& selectedPageList);
/** Return the range of pages selected by the user in the Print Dialog
*
* @param printer the print settings to use
* @param lastPage the last page number, needed if AllPages option is selected
* @param selectedPageList list of pages to use if Selection option is selected
* @returns Returns range of pages to print
*/
static QString pageRange(QPrinter& printer, int lastPage, const QList& selectedPageList);
/** convert a Page List into a Page Range
*
* @param pageList list of pages to convert
* @returns Returns equivalent page range
*/
static QString pageListToPageRange(const QList& pageList);
/** Return if Ghostscript ps2pdf is available on this system
*
* @returns Returns true if Ghostscript ps2pdf available
*/
static bool ps2pdfAvailable();
/** Return if psselect is available on this system
*
* @returns Returns true if psselect gs available
*/
static bool psselectAvailable();
/** Return if CUPS Print System is available on this system
*
* @returns Returns true if CUPS available
*/
static bool cupsAvailable();
protected:
bool detectCupsService();
bool detectCupsConfig();
int doPrintFiles(QPrinter& printer, const QStringList fileList,
FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy,
const QString& pageRange,
QPrinter::Orientation documentOrientation,
const QStringList& printerOptions,
const QString& system);
QStringList printArguments(QPrinter& printer,
FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy,
bool useCupsOptions, const QString& pageRange, const QString& version,
const QStringList& printerOptions,
QPrinter::Orientation documentOrientation);
QStringList destination(QPrinter& printer, const QString& version);
QStringList copies(QPrinter& printer, const QString& version);
QStringList jobname(QPrinter& printer, const QString& version);
QStringList deleteFile(QPrinter& printer, FileDeletePolicy fileDeletePolicy,
const QString& version);
QStringList pages(QPrinter& printer, PageSelectPolicy pageSelectPolicy,
const QString& pageRange, bool useCupsOptions, const QString& version);
QStringList customPrinterOptions(const QStringList& options);
QStringList cupsOptions(QPrinter& printer, QPrinter::Orientation documentOrientation);
QStringList optionMedia(QPrinter& printer);
QString mediaPageSize(QPrinter& printer);
QString mediaPaperSource(QPrinter& printer);
QStringList optionOrientation(QPrinter& printer, QPrinter::Orientation documentOrientation);
QStringList optionDoubleSidedPrinting(QPrinter& printer);
QStringList optionPageOrder(QPrinter& printer);
QStringList optionCollateCopies(QPrinter& printer);
QStringList optionPageMargins(QPrinter& printer);
QStringList optionCupsProperties(QPrinter& printer);
};
#endif
kprinter4-12/main.cpp 0000644 0001750 0001750 00000026642 12354274517 012754 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "config.h"
#include "postscriptdocument.h"
#include "fileprinter.h"
#include "utils/papersizeutils.h"
#include "widgets/printscalingoptionswidget.h"
#include "widgets/posterwidget.h"
/* Return codes:
* 1: No parameters given. Exit.
* 2: No PostScript file(s) given. Exit.
* 3: All PostScript file(s) invalid. Exit.
* 4: Page rendering error. Exit.
* 5: Poster print error. Exit.
* 6: Writing temporary file for data from STDIN failed. Exit.
*/
int showPrintDialogAndPrint(const QString& filename,
const QString& printername,
const QString& printtitle,
const int numCopies,
const QStringList& printerOptions,
bool nodialog,
const QString& system) {
PostScriptDocument doc;
if (!doc.load(filename)) {
kDebug() << "Loading of document " << filename << " failed.";
return -1;
}
int numPages = doc.numPages();
QPrinter::PaperSize paperSize = doc.paperSize();
QPrinter printer;
printer.setPaperSize(paperSize);
if (!printername.isEmpty()) printer.setPrinterName(printername);
if (!printtitle.isEmpty()) printer.setDocName(printtitle);
printer.setCopyCount(numCopies);
printScalingOptionsWidget scaleWidget;
PosterWidget posterWidget;
posterWidget.setMediaSizeDescription(PaperSizeUtils::paperSizeToFancyString(printer.paperSize()));
posterWidget.setMediaSize(doc.pageSize());
QObject::connect(&scaleWidget, SIGNAL(scalingEnabled(bool)), &posterWidget, SLOT(setDisabled(bool)));
QObject::connect(&posterWidget, SIGNAL(posterEnabled(bool)), &scaleWidget, SLOT(setDisabled(bool)));
QPrintDialog *printDialog = KdePrint::createPrintDialog(&printer, QList() << &scaleWidget << &posterWidget);
printDialog->setWindowTitle(i18n("KPrinter4"));
if (numPages > 0) {
printDialog->setMinMax(1, numPages);
printDialog->setFromTo(1, numPages);
}
posterWidget.showMultiPageNote((numPages > 1));
int ret = 0;
if ((nodialog) || printDialog->exec()) {
QString pageRange;
if ((printer.fromPage() > 0) && (printer.toPage() > 0)) {
pageRange = QString("%1-%2").arg(printer.fromPage()).arg(printer.toPage());
}
if (scaleWidget.scaleMode() != printScalingOptionsWidget::NoScale) {
// Render (selected) pages
QPainter painter;
painter.begin(&printer);
int firstPage = 0;
int lastPage = numPages;
if (printer.fromPage() > 0) firstPage = printer.fromPage();
if (printer.toPage() > 0) lastPage = printer.toPage();
QMutex mutex;
doc.renderPagesGS(180, 180);
QRect viewport = painter.viewport();
for (int i = firstPage; i < lastPage; ++i) {
if (i > 0) printer.newPage();
mutex.lock();
QImage *pageImage = doc.fetchRenderedPageGS(i);
if (pageImage) {
QSizeF pageSize = pageImage->size();
QSizeF pagePaperSize = printer.paperSize(QPrinter::Point);
QSize size = scaleWidget.adjustPainterSize(*pageImage, viewport.size(), pageSize, pagePaperSize);
QPoint pos = scaleWidget.adjustPainterPosition(size, viewport.size());
painter.setViewport(pos.x(), pos.y(), size.width(), size.height());
painter.setWindow(pageImage->rect());
painter.drawImage(0, 0, *pageImage);
delete pageImage;
} else {
kDebug() << "Rendering page" << i << "failed.";
return 4;
}
mutex.unlock();
}
doc.clearRenderedPagesGS();
painter.end();
} else {
QString filenameToPrint = filename;
KTemporaryFile tf;
if (posterWidget.isEnabled()) {
bool keepFirstPageOnly = FALSE;
if (doc.numPages() > 1) {
kWarning() << "Poster is not able to process multi page postscript documents. Keeping first page only.";
keepFirstPageOnly = TRUE;
}
QStringList argList;
KTemporaryFile tf2;
tf2.setSuffix(".ps");
if (!tf2.open()) {
kDebug() << "Poster print failed. Creation of temporary file" << tf2.fileName() << "failed.";
return 5;
}
QString filenameToPoster = filename;
if (keepFirstPageOnly) {
QString exe = "psselect";
argList << "-p1";
argList << filename << tf2.fileName();
kDebug() << "Executing" << exe << "with arguments" << argList;
if (KProcess::execute(exe, argList) != 0) {
kDebug() << "Poster print failed: Execution of" << exe << "failed.";
return 5;
}
filenameToPoster = tf2.fileName();
}
// Poster print
QMap settings;
posterWidget.getOptions(settings);
QString size = settings["_kde-poster-size"];
QString cut = settings["_kde-poster-cut"];
QString select = settings["_kde-poster-select"];
QString printSize = settings["kde-printsize"];
argList.clear();
if (!printSize.isEmpty()) {
argList << QString("-m%1").arg(printSize);
}
if (!size.isEmpty()) {
argList << QString("-p%1").arg(size);
}
if (!cut.isEmpty()) {
argList << QString("-c%1%").arg(cut);
}
if (!select.isEmpty()) {
argList << QString("-P%1").arg(select);
}
tf.setSuffix(".ps");
if (!tf.open()) {
kDebug() << "Poster print failed. Creation of temporary file" << tf.fileName() << "failed.";
return 5;
}
argList << filenameToPoster << QString("-o%1").arg(tf.fileName());
QString exe = "poster";
kDebug() << "Executing" << exe << "with arguments" << argList;
if (KProcess::execute(exe, argList) != 0) {
kDebug() << "Poster print failed: Execution of" << exe << "failed.";
return 5;
}
filenameToPrint = tf.fileName();
pageRange.clear();
printer.setPrintRange(QPrinter::AllPages);
printer.setFromTo(0, 0);
}
// Just passthrough to CUPS/LPR/LP
ret = FilePrinter::printFiles(printer, QStringList(filenameToPrint),
doc.orientation(),
FilePrinter::ApplicationDeletesFiles,
FilePrinter::SystemSelectsPages,
pageRange,
printerOptions,
system);
}
}
return ret;
}
int main(int argc, char *argv[]) {
KAboutData aboutData("kprinter4", 0, ki18n("KPrinter4"), KPRINTER4_VERSION,
ki18n("Simple PostScript document printer"),
KAboutData::License_GPL,
ki18n("Copyright © 2014 by Marco Nelles (credativ GmbH)"),
KLocalizedString(),
"http://www.credativ.com/",
"marco.nelles@credativ.de");
aboutData.addAuthor(ki18n("Marco Nelles"), ki18n("Current maintainer, main developer"), "marco.nelles@credativ.de");
aboutData.addCredit(ki18n("City of Munich"), ki18n("LiMux project"), 0, "http://www.muenchen.de/");
aboutData.addCredit(ki18n("credativ GmbH"), ki18n("credativ GmbH (Germany)"), 0, "http://www.credativ.com/");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("c", ki18n("Make an internal copy of the files to print"));
options.add("P").add("d ", ki18n("Printer/destination to print on"));
options.add("J").add("t ", ki18n("Title/Name for the print job"));
options.add("#").add("n ", ki18n("Number of copies"), "1");
options.add("o ", ki18n("Printer/Job option(s)"));
options.add("j ", ki18n("Job output mode (gui, console, none)"), "gui");
options.add("system ", ki18n("Print system to use (autodetect, lpd, cups)"), "autodetect");
options.add("stdin", ki18n("Print from STDIN"));
options.add("nd").add("nodialog", ki18n("Do not show the print dialog (print directly)"));
options.add("ofd").add("openfiledialog", ki18n("Show file dialog instead of printing from STDIN."));
options.add("+[file(s)]", ki18n("PostScript document(s) to print"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
/* Parsing command line arguments */
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("c")) kWarning() << i18n("Option -c not implemented yet");
QString printer = args->getOption("d");
QString title = args->getOption("t");
int numCopies = 1;
if (!args->getOption("n").isEmpty()) {
bool ok;
int i = args->getOption("n").toInt(&ok);
if (ok) numCopies = i;
}
QStringList printerOptions = args->getOptionList("o");
QString output_mode = args->getOption("j");
if ((output_mode != "gui") && (output_mode != "console") && (output_mode != "none")) {
kWarning() << i18n("Unknown value \"%1\" for option -j. Using default value \"gui\".", output_mode);
output_mode = "gui";
}
QString system = args->getOption("system");
if ((system != "autodetect") && (system != "cups") && (system != "lpd")) {
kWarning() << i18n("Unknown value \"%1\" for option --system. Using default value \"autodetect\".", system);
system = "autodetect";
}
bool nodialog = ((args->getOption("j") != "gui") || !args->isSet("nd"));
QString psFileName;
KTemporaryFile tmpPSFile;
if ((args->count()) && (!args->isSet("stdin"))) {
if (args->count() > 1)
kWarning() << i18n("Found more than one file parameter. Using only the first one.");
psFileName = args->url(0).path();
} else {
if ((args->isSet("ofd")) && (!args->isSet("stdin"))) {
psFileName = KFileDialog::getOpenFileName(KUrl(QDir::homePath()), "*.ps", NULL, i18n("Open PostScript document"));
} else {
//sync read from stdin
kWarning() << i18n("Wait for STDIN...");
QTextStream instream(stdin, QIODevice::ReadOnly);
QString doc = instream.readAll();
tmpPSFile.setSuffix(".ps");
if (tmpPSFile.open()) {
QTextStream outstream(&tmpPSFile);
outstream << doc;
psFileName = tmpPSFile.fileName();
} else {
kDebug() << "Error writing temporary file" << tmpPSFile.fileName();
return 6;
}
}
}
if (psFileName.isEmpty()) return 2;
return showPrintDialogAndPrint(psFileName,
printer,
title,
numCopies,
printerOptions,
nodialog,
system);
}
kprinter4-12/Messages.sh 0000755 0001750 0001750 00000000316 12354274517 013420 0 ustar mba mba extractrc $(find . -name \*.rc -o -name \*.ui -o -name \*.kcfg) >> rc.cpp
xgettext --from-code=utf-8 -kde --keyword=i18n --keyword=ki18n -o po/kprinter4.pot $(find . -name \*.cpp -o -name \*.h)
rm -f rc.cpp kprinter4-12/widgets/ 0000755 0001750 0001750 00000000000 12354274517 012760 5 ustar mba mba kprinter4-12/widgets/posterpreview.h 0000644 0001750 0001750 00000004655 12354274517 016061 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* Copyright (c) 2001-2002 Michael Goffioul */
#ifndef POSTERPREVIEW_H
#define POSTERPREVIEW_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "utils/papersizeutils.h"
class PosterPreview : public QFrame
{
Q_OBJECT
public:
PosterPreview( QWidget *parent = 0 );
PosterPreview( const QString& postersize, const QString& mediasize, QWidget *parent = 0 );
~PosterPreview();
QSize minimumSizeHint() const;
public slots:
void setPosterSize( int );
void setPosterSize( const QString& );
void setMediaSize( int );
void setMediaSize( const QString& );
void setCutMargin( int );
void updatePoster();
void setSelectedPages( const QString& );
signals:
void selectionChanged( const QString& );
protected:
void parseBuffer();
void paintEvent( QPaintEvent* );
void init();
void setDirty();
void mouseMoveEvent( QMouseEvent* );
void mousePressEvent( QMouseEvent* );
void emitSelectedPages();
protected slots:
void slotProcessStderr();
void slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus );
private:
int m_rows, m_cols;
int m_pw, m_ph; // page size
int m_mw, m_mh; // cur margins
QRect m_posterbb; // poster bounding box (without any margin)
KProcess *m_process;
QString m_buffer;
QString m_postersize, m_mediasize;
int m_cutmargin;
bool m_dirty;
QRect m_boundingrect;
QList m_selectedpages;
};
#endif /* POSTERPREVIEW_H */
kprinter4-12/widgets/printscalingoptionswidget.h 0000644 0001750 0001750 00000004225 12354274517 020451 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
Gwenview:
Copyright 2007 Aurélien Gâteau
*/
#ifndef PRINTOPTIONSPAGE_H
#define PRINTOPTIONSPAGE_H
#include
#include
#include
#include
#include
#include
#include
#include "ui_printscalingoptionswidgetUI.h"
class printScalingOptionsWidgetUI : public QWidget, public Ui::PrintScalingOptionsWidgetUI {
public:
explicit printScalingOptionsWidgetUI(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class printScalingOptionsWidget : public printScalingOptionsWidgetUI {
Q_OBJECT
public:
enum ScaleMode {
NoScale,
ScaleToPage,
ScaleToCustomSize
};
printScalingOptionsWidget(QWidget *parent = NULL);
~printScalingOptionsWidget();
Qt::Alignment alignment() const;
ScaleMode scaleMode() const;
bool enlargeSmallerImages() const;
double scaleFactor() const;
QSize adjustPainterSize(const QImage& img, const QSize& viewportSize, const QSizeF& pageSize, const QSizeF& paperSize);
QPoint adjustPainterPosition(const QSize& imageSize, const QSize& viewportSize);
signals:
void scalingEnabled(bool enabled);
private slots:
void emitScalingEnabled(bool noScale);
private:
QButtonGroup mScaleGroup;
QButtonGroup mPositionGroup;
KConfigDialogManager* mConfigDialogManager;
void initPositionFrame();
};
#endif
kprinter4-12/widgets/printscalingoptionswidgetUI.ui 0000644 0001750 0001750 00000014621 12354274517 021076 0 ustar mba mba
PrintScalingOptionsWidgetUI
0
0
511
252
Scaling
-
Scaling
-
&No scaling
true
-
&Fit document to page
false
-
6
0
-
Qt::Horizontal
QSizePolicy::Fixed
20
20
-
false
Enlarge smaller pages
-
Qt::Horizontal
QSizePolicy::Expanding
24
21
-
&Scale to:
-
6
0
-
Qt::Horizontal
QSizePolicy::Fixed
20
20
-
false
%
1
1000
100
-
Qt::Horizontal
QSizePolicy::Expanding
24
21
-
Qt::Vertical
20
16
-
Document Position
-
-
Qt::Vertical
20
40
kcombobox.h
knuminput.h
knuminput.h
kcombobox.h
mScaleToPage
toggled(bool)
kcfg_PrintEnlargeSmallerImages
setEnabled(bool)
20
20
20
20
mScaleTo
toggled(bool)
kcfg_PrintScalePercent
setEnabled(bool)
314
121
193
148
kprinter4-12/widgets/posterwidget.h 0000644 0001750 0001750 00000004257 12354274517 015661 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* Copyright (c) 2001-2002 Michael Goffioul */
#ifndef POSTERWIDGET_H
#define POSTERWIDGET_H
#include
#include
#include
#include
#include
#include
#include
#include "utils/papersizeutils.h"
#include "posterpreview.h"
class PosterWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(QSizeF mediaSize READ mediaSize WRITE setMediaSize)
Q_PROPERTY(QString mediaSizeDescription READ mediaSizeDescription WRITE setMediaSizeDescription)
public:
PosterWidget( QWidget *parent = 0 );
~PosterWidget();
void getOptions( QMap& opts, bool incldef = false );
bool isEnabled();
QSizeF mediaSize() const;
void setMediaSize(const QSizeF& mediaSizeFloat);
QString mediaSizeDescription() const;
void setMediaSizeDescription(const QString& mediaSize);
void showMultiPageNote(const bool show);
signals:
void posterEnabled(bool enabled);
protected slots:
void slotPosterSizeChanged( int );
void slotPrintSizeChanged( int );
void slotMarginChanged( int );
void slotLockToggled( bool );
private:
QComboBox *m_postersize;
QComboBox *m_printsize;
PosterPreview *m_preview;
QCheckBox *m_postercheck;
QLabel *m_mediasize;
KIntNumInput *m_cutmargin;
QPushButton *m_lockbtn;
QLineEdit *m_selection;
QLabel *m_multipage_note_label;
};
#endif
kprinter4-12/widgets/printscalingoptionswidget.cpp 0000644 0001750 0001750 00000012570 12354274517 021006 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
Gwenview:
Copyright 2007 Aurélien Gâteau
*/
#include "printscalingoptionswidget.h"
printScalingOptionsWidget::printScalingOptionsWidget(QWidget *parent) : printScalingOptionsWidgetUI(parent) {
initPositionFrame();
mScaleGroup.addButton(mNoScale, NoScale);
mScaleGroup.addButton(mScaleToPage, ScaleToPage);
mScaleGroup.addButton(mScaleTo, ScaleToCustomSize);
connect(mNoScale, SIGNAL(toggled(bool)), SLOT(emitScalingEnabled(bool)));
}
printScalingOptionsWidget::~printScalingOptionsWidget() {
}
void printScalingOptionsWidget::initPositionFrame() {
mPositionFrame->setStyleSheet(
"QFrame {"
" background-color: palette(mid);"
" border: 1px solid palette(dark);"
"}"
"QToolButton {"
" border: none;"
" background: palette(base);"
"}"
"QToolButton:hover {"
" background: palette(alternate-base);"
" border: 1px solid palette(highlight);"
"}"
"QToolButton:checked {"
" background-color: palette(highlight);"
"}"
);
QGridLayout* layout = new QGridLayout(mPositionFrame);
layout->setMargin(0);
layout->setSpacing(1);
for (int row = 0; row < 3; ++row) {
for (int col = 0; col < 3; ++col) {
QToolButton* button = new QToolButton(mPositionFrame);
button->setFixedSize(40, 40);
button->setCheckable(TRUE);
layout->addWidget(button, row, col);
Qt::Alignment alignment;
if (row == 0) {
alignment = Qt::AlignTop;
} else if (row == 1) {
alignment = Qt::AlignVCenter;
} else {
alignment = Qt::AlignBottom;
}
if (col == 0) {
alignment |= Qt::AlignLeft;
} else if (col == 1) {
alignment |= Qt::AlignHCenter;
} else {
alignment |= Qt::AlignRight;
}
mPositionGroup.addButton(button, int(alignment));
if (alignment & Qt::AlignVCenter && alignment & Qt::AlignHCenter)
{
button->setChecked(TRUE);
}
}
}
}
Qt::Alignment printScalingOptionsWidget::alignment() const {
int id = mPositionGroup.checkedId();
return Qt::Alignment(id);
}
printScalingOptionsWidget::ScaleMode printScalingOptionsWidget::scaleMode() const {
return printScalingOptionsWidget::ScaleMode(mScaleGroup.checkedId());
}
bool printScalingOptionsWidget::enlargeSmallerImages() const {
return kcfg_PrintEnlargeSmallerImages->isChecked();
}
double printScalingOptionsWidget::scaleFactor() const {
return kcfg_PrintScalePercent->value() / 100.0f;
}
QSize printScalingOptionsWidget::adjustPainterSize(const QImage& img, const QSize & viewportSize, const QSizeF& pageSize, const QSizeF& paperSize) {
QSize size = img.size();
printScalingOptionsWidget::ScaleMode scaleMode = this->scaleMode();
if (scaleMode == printScalingOptionsWidget::ScaleToPage) {
bool imageBiggerThanPaper =
size.width() > viewportSize.width()
|| size.height() > viewportSize.height();
if (imageBiggerThanPaper || enlargeSmallerImages()) {
size.scale(viewportSize, Qt::KeepAspectRatio);
}
} else if (scaleMode == printScalingOptionsWidget::ScaleToCustomSize) {
qreal scalePixelX = pageSize.width() / paperSize.width();
qreal scalePixelY = pageSize.height() / paperSize.height();
size.scale(viewportSize.width() * scalePixelX * scaleFactor(),
viewportSize.height() * scalePixelY * scaleFactor(),
Qt::KeepAspectRatio);
}
return size;
}
QPoint printScalingOptionsWidget::adjustPainterPosition(const QSize& imageSize, const QSize & viewportSize) {
Qt::Alignment alignment = this->alignment();
int posX, posY;
if (alignment & Qt::AlignLeft) {
posX = 0;
} else if (alignment & Qt::AlignHCenter) {
posX = (viewportSize.width() - imageSize.width()) / 2;
} else {
posX = viewportSize.width() - imageSize.width();
}
if (alignment & Qt::AlignTop) {
posY = 0;
} else if (alignment & Qt::AlignVCenter) {
posY = (viewportSize.height() - imageSize.height()) / 2;
} else {
posY = viewportSize.height() - imageSize.height();
}
return QPoint(posX, posY);
}
void printScalingOptionsWidget::emitScalingEnabled(bool noScale) {
emit scalingEnabled(!noScale);
}
kprinter4-12/widgets/posterpreview.cpp 0000644 0001750 0001750 00000020743 12354274517 016410 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* Copyright (c) 2001-2002 Michael Goffioul */
#include "posterpreview.h"
PosterPreview::PosterPreview( QWidget *parent )
: QFrame( parent )
{
m_postersize = m_mediasize = "A4";
m_cutmargin = 5;
init();
}
PosterPreview::PosterPreview( const QString& postersize, const QString& mediasize, QWidget *parent )
: QFrame( parent )
{
m_postersize = postersize;
m_mediasize = mediasize;
m_cutmargin = 5;
init();
}
PosterPreview::~PosterPreview()
{
delete m_process;
}
void PosterPreview::init()
{
m_process = new KProcess;
m_process->setOutputChannelMode(KProcess::SeparateChannels);
connect( m_process, SIGNAL( readyReadStandardError( ) ), SLOT( slotProcessStderr( ) ) );
connect( m_process, SIGNAL( finished( int, QProcess::ExitStatus ) ), SLOT( slotProcessExited( int, QProcess::ExitStatus ) ) );
m_cols = m_rows = m_pw = m_ph = m_mw = m_mh = 0;
m_dirty = false;
setDirty();
setMouseTracking( true );
}
QSize PosterPreview::minimumSizeHint() const
{
return QSize(10 + m_cols * 25, 10 + m_rows * 25);
}
void PosterPreview::parseBuffer()
{
int rotate;
float pw, ph, mw, mh;
float x1, x2, y1, y2;
QTextStream posterIn(m_buffer.toLocal8Bit());
// poster always uses "." as decimal seperator
posterIn.setLocale(QLocale::c());
posterIn >> m_rows >> m_cols >> rotate >> pw >> ph >> mw >> mh >> x1 >> y1 >> x2 >> y2;
m_pw = ( int )( rotate ? ph : pw );
m_ph = ( int )( rotate ? pw : ph );
m_mw = ( int )( rotate ? mh : mw );
m_mh = ( int )( rotate ? mw : mh );
m_posterbb.setCoords( ( int )x1, ( int )y1, ( int )x2, ( int )y2 );
}
void PosterPreview::setDirty()
{
if ( !m_dirty )
{
m_dirty = true;
QTimer::singleShot( 1, this, SLOT( updatePoster() ) );
}
}
void PosterPreview::updatePoster()
{
m_buffer = "";
m_process->clearProgram();
*m_process << "poster" << "-F" << "-m" + m_mediasize << "-p" + m_postersize
<< "-c" + QString::number( m_cutmargin ) + "%";
m_process->start();
if ( !m_process->waitForStarted() )
{
m_rows = m_cols = 0;
m_dirty = false;
update();
}
}
void PosterPreview::paintEvent( QPaintEvent *ev )
{
QFrame::paintEvent(ev);
//QRect rect = contentsRect();
QPainter p( this );
//p.fillRect( rect, palette().color(QPalette::Window) );
if ( isEnabled() )
{
if ( m_rows <= 0 || m_cols <= 0 || m_pw <= 0 || m_ph <= 0 )
{
QString txt = i18n( "Poster preview not available. Either the poster "
"executable is not properly installed, or you don't have "
"the required version; available at http://printing.kde.org/downloads/." );
QTextDocument richtext;
richtext.setDefaultFont(p.font());
richtext.setHtml(( m_buffer.isEmpty() ? txt : m_buffer.prepend( "" ).append( " " ) ));
richtext.adjustSize();
int x = ( width()-richtext.idealWidth() )/2, y = ( height()-richtext.size().height() )/2;
x = qMax( x, 0 );
y = qMax( y, 0 );
//richtext.draw( p, x, y, QRect( x, y, richtext.idealWidth(), richtext.size().height() ), colorGroup() );
QAbstractTextDocumentLayout::PaintContext context;
context.palette = palette();
p.translate(x, y);
richtext.documentLayout()->draw(&p, context);
m_boundingrect = QRect();
}
else
{
int totalx = m_cols*m_pw, totaly = m_rows*m_ph;
float scale = qMin( float( width()-1 )/totalx, float( height()-1 )/totaly );
p.translate( 0, height()-1 );
p.scale( scale, -scale );
int x = ( int )( width()/scale-totalx )/2, y = ( int )( height()/scale-totaly )/2;
p.translate( x, y );
m_boundingrect = p.combinedTransform().mapRect( QRect( 0, 0, totalx, totaly ) );
x = y = 0;
int px = m_posterbb.x();
int py = m_posterbb.y();
int pw = m_posterbb.width();
int ph = m_posterbb.height();
for ( int i=0; i 0 && ph > 0 )
p.fillRect( x+m_mw+px, y+m_mh+py, qMin( pw, m_pw-2*m_mw-px ), qMin( ph, m_ph-2*m_mh-py ),
( selected ? palette().highlight().color().dark( 160 ) : QColor(Qt::lightGray) ) );
p.setPen( Qt::DotLine );
p.drawRect( x+m_mw, y+m_mh, m_pw-2*m_mw, m_ph-2*m_mh );
p.setPen( Qt::SolidLine );
pw -= m_pw-2*m_mw-px;
px = 0;
}
px = m_posterbb.x();
ph -= m_ph-2*m_mh-py;
py = 0;
pw = m_posterbb.width();
}
}
}
}
void PosterPreview::mouseMoveEvent( QMouseEvent *e )
{
if ( m_boundingrect.isValid() )
{
if ( m_boundingrect.contains( e->pos() ) )
setCursor( QCursor(Qt::PointingHandCursor) );
else
setCursor( QCursor(Qt::ArrowCursor) );
}
}
void PosterPreview::mousePressEvent( QMouseEvent *e )
{
if ( e->button() == Qt::LeftButton && m_boundingrect.isValid() )
{
if ( m_boundingrect.contains( e->pos() ) )
{
int c, r;
c = ( e->pos().x()-m_boundingrect.x() )/( m_boundingrect.width()/m_cols ) + 1;
r = m_rows - ( e->pos().y()-m_boundingrect.y() )/( m_boundingrect.height()/m_rows );
int pagenum = ( r-1 )*m_cols+c;
if ( !m_selectedpages.contains( pagenum ) ||
!( e->modifiers() & Qt::ShiftModifier ) )
{
if ( !( e->modifiers() & Qt::ShiftModifier ) )
m_selectedpages.clear();
m_selectedpages.append( pagenum );
update();
emitSelectedPages();
}
}
else if ( m_selectedpages.count() > 0 )
{
m_selectedpages.clear();
update();
emitSelectedPages();
}
}
}
void PosterPreview::slotProcessStderr()
{
m_buffer.append(QString::fromLocal8Bit(m_process->readAllStandardError()));
}
void PosterPreview::slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus )
{
if ( exitStatus == QProcess::NormalExit && exitCode == 0 )
parseBuffer();
else
m_rows = m_cols = 0;
m_dirty = false;
update();
updateGeometry();
}
void PosterPreview::setPosterSize( int s )
{
setPosterSize( PaperSizeUtils::paperSizeToString( static_cast(s) ) );
}
void PosterPreview::setPosterSize( const QString& s )
{
if ( m_postersize != s )
{
m_selectedpages.clear();
m_postersize = s;
setDirty();
emitSelectedPages();
}
}
void PosterPreview::setMediaSize( int s )
{
setMediaSize( PaperSizeUtils::paperSizeToString( static_cast(s) ) );
}
void PosterPreview::setMediaSize( const QString& s )
{
if ( m_mediasize != s )
{
m_selectedpages.clear();
m_mediasize = s;
setDirty();
emitSelectedPages();
}
}
void PosterPreview::setCutMargin( int value )
{
m_cutmargin = value;
setDirty();
}
void PosterPreview::setSelectedPages( const QString& s )
{
QStringList l = s.split(",", QString::SkipEmptyParts);
m_selectedpages.clear();
Q_FOREACH (const QString& page, l)
{
int p = page.indexOf( '-' );
if ( p == -1 )
{
m_selectedpages.append( page.toInt() );
}
else
{
int p1 = page.left( p ).toInt(), p2 = page.mid( p+1 ).toInt();
for ( int i=p1; i<=p2; i++ ) {
m_selectedpages.append( i );
}
}
}
update();
}
void PosterPreview::emitSelectedPages()
{
QString s;
if ( m_selectedpages.count() > 0 )
{
Q_FOREACH (int page, m_selectedpages)
s.append( QString::number( page ) + "," );
s.truncate( s.length()-1 );
}
emit selectionChanged( s );
}
kprinter4-12/widgets/posterwidget.cpp 0000644 0001750 0001750 00000044674 12354274517 016223 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* Copyright (c) 2001-2002 Michael Goffioul */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "posterwidget.h"
#include "posterpreview.h"
PosterWidget::PosterWidget( QWidget *parent )
: QWidget( parent )
{
//WhatsThis strings.... (added by pfeifle@kde.org)
QString whatsThis5_PosterPage = i18n( " "
" 5. "
" " );
QString whatsThisEnablePosterPage = i18n( " "
" Print Poster (enabled or disabled). "
" If you enable this option, you can print posters of different sizes "
" The printout will happen in the form 'tiles' printed on smaller "
" paper sizes, which you can stitch together later. If you enable this "
" option here, the 'Poster Printing' filter will be auto-loaded in "
" the 'Filters' tab of this dialog.
"
" This tab is only visible if the external 'poster' utility is "
" discovered by KDEPrint on your system. ['poster' is a commandline "
" utility that enables you to convert PostScript files into tiled printouts "
" which allow for oversized appearance of the stitched-together tiles.]
"
" Note: The standard version of 'poster' will not work. Your system "
" must use a patched version of 'poster'. Ask your operating system vendor to "
" provide a patched version of 'poster' if he does not already.
"
" " );
QString whatsThisTileSelectionPosterPage = i18n( " "
" Tile Selection widget "
" This GUI element is not only for viewing your selections: it also "
" lets you interactively select the tile(s) you want to print. "
"
"
" Hints "
"
"
" Click any tile to select it for printing. "
" To select multiple tiles to be printed "
" at once, 'shift-click' on the tiles ('shift-click' means: hold down the "
" [SHIFT]-key on your keyboard and click with the mouse while [SHIFT]-key is held.) "
" Be aware that the order "
" of your clicking is also significant to the order of printing the different tiles. "
" "
" Note 1: The order of your selection (and the order for printout of the tiles) "
" is indicated by the contents of the text field below, "
" labelled as 'Tile pages (to be printed):' "
" Note 2: By default no tile is selected. Before you can print (a part "
" of) your poster, you must select at least one tile.
"
" " );
QString whatsThisPostersizePosterPage = i18n( " "
" Poster Size "
" Select the poster size you want from the dropdown list.
"
" Available sizes are all standard paper sizes up to "
" 'A0'. [A0 is the same size as 16 sheets of A4, or '84cm x 118.2cm'.] "
" Notice , how the little preview window below changes with your change of poster "
" size. It indicates to you how many tiles need to be printed to make the poster, "
" given the selected paper size.
"
" Hint: The little preview window below is not just a passive icon. You can click "
" on its individual tiles to select them for printing. To select multiple tiles to be printed "
" at once, you need to 'shift-click' on the tiles ('shift-click' means: hold down the "
" [SHIFT]-key on your keyboard and click with the mouse while [SHIFT]-key is held.) The order "
" of your clicking is significant to the order of printing the different tiles. The order of "
" your selection (and for the printed tiles) is indicated by the contents of the text field "
" labelled as 'Tile pages (to be printed):'
"
" Note: By default no tile is selected. Before you can print (a part "
" of) your poster, you must select at least one tile.
"
" " );
QString whatsThisPrintsizePosterPage = i18n( " "
" Paper Size "
" This field indicates the paper size the poster tiles will be printed on. "
" To select a different paper size for your poster tiles, go to the 'General' tab "
" of this dialog and select one from the dropdown list.
"
" Available sizes are most standard paper sizes supported by your printer. Your printer's "
" supported paper sizes are read from the printer driver info (as laid down in the 'PPD' , "
" the printer description file). Be aware that the 'Paper Size' selected may not be supported "
" by 'poster' (example: 'HalfLetter') while it may well be supported by your printer. If "
" you hit that obstacle, simply use another, supported Paper Size, like 'A4' or 'Letter'. "
" Notice , how the little preview window below changes with your change of paper "
" size. It indicates how many tiles need to be printed to make up the poster, "
" given the selected paper and poster size.
"
" Hint: The little preview window below is not just a passive icon. You can click "
" on its individual tiles to select them for printing. To select multiple tiles to be printed "
" at once, you need to 'shift-click' on the tiles ('shift-click' means: hold down the "
" [SHIFT]-key on your keyboard and click with the mouse while [SHIFT]-key is held.) The order "
" of your clicking is significant to the order of printing the different tiles. The order of "
" your selection (and for the printed tiles) is indicated by the contents of the text field "
" labelled as 'Tile pages (to be printed):'
"
" Note: By default no tile is selected. Before you can print (a part "
" of) your poster, you must select at least one tile.
"
" " );
QString whatsThisCutmarginPosterPage = i18n( " "
" Cut Margin selection "
" Slider and spinbox let you determine a 'cut margin' which will be printed onto "
" each tile of your poster to help you cut the pieces as needed.
"
" Notice , how the little preview window above changes with your change of cut "
" margins. It indicates to you how much space the cut margins will take away from each tile. "
"
Be aware , that your cut margins need to be equal to or greater than the margins your "
" printer uses. The printer's capabilities are described in the 'ImageableArea' "
" keywords of its driver PPD file.
"
" " );
QString whatsThisTileOrderSelectionPosterPage = i18n( " "
" Order and number of tile pages to be printed "
" This field displays and sets the individual tiles to be printed, as well as the order "
" for their printout.
"
" You can file the field with 2 different methods: "
" "
" Either use the interactive thumbnail preview above and '[SHIFT]-click' on the tiles. "
" Or edit this text field accordingly. "
" "
" When editing the field, you can use a '3-7' syntax instead of a '3,4,5,6,7' one.
"
" Examples:
"
" "
" \"2,3,7,9,3\" "
" "
" \"1-3,6,8-11\" "
" " );
setWindowTitle( i18n( "Poster" ) );
m_postercheck = new QCheckBox( i18n( "&Print poster" ), this );
m_postercheck->setWhatsThis(whatsThisEnablePosterPage);
QWidget *dummy = new QWidget( this );
m_preview = new PosterPreview( dummy );
m_preview->setMediaSize(QPrinter::A4);
m_preview->setWhatsThis(whatsThisTileSelectionPosterPage);
m_postersize = new QComboBox( dummy );
m_postersize->setWhatsThis(whatsThisPostersizePosterPage);
m_printsize = new QComboBox( dummy );
m_printsize->setWhatsThis(whatsThisPrintsizePosterPage);
m_lockbtn = new KPushButton( dummy );
//QWhatsThis::add(m_lockbtn, whatsThis5_PosterPage); //FIXME ASK_MICHAEL: which pushbutton would that be?
m_mediasize = new QLabel( dummy );
m_mediasize->setWhatsThis(whatsThisPrintsizePosterPage);
m_mediasize->setFrameStyle( QFrame::Panel|QFrame::Sunken );
QLabel *posterlab = new QLabel( i18n( "Poste&r size:" ), dummy );
posterlab->setWhatsThis(whatsThisPostersizePosterPage);
QLabel *medialab = new QLabel( i18n( "Media size:" ), dummy );
medialab->setWhatsThis(whatsThisPrintsizePosterPage);
QLabel *printlab = new QLabel( i18n( "Pri&nt size:" ), dummy );
printlab->setWhatsThis(whatsThisPrintsizePosterPage);
posterlab->setBuddy( m_postersize );
printlab->setBuddy( m_printsize );
m_cutmargin = new KIntNumInput( 5, dummy );
m_cutmargin->setWhatsThis(whatsThisCutmarginPosterPage);
// xgettext:no-c-format
m_cutmargin->setLabel( i18n( "C&ut margin (% of media):" ) );
m_cutmargin->setRange( 0, 100, 2 ); // step width was too big, changed from 10 to 2 (-kp-)
m_cutmargin->setSliderEnabled(true);
m_selection = new QLineEdit( dummy );
m_selection->setWhatsThis(whatsThisTileOrderSelectionPosterPage);
QLabel *selectionlab = new QLabel( i18n( "&Tile pages (to be printed):" ), dummy );
selectionlab->setWhatsThis(whatsThisTileOrderSelectionPosterPage);
selectionlab->setBuddy( m_selection );
m_lockbtn->setCheckable( true );
m_lockbtn->setIcon(QIcon::fromTheme("document-encrypt"));
m_lockbtn->setChecked( true );
m_lockbtn->setFixedSize( m_lockbtn->sizeHint() );
m_lockbtn->setToolTip(i18n( "Link/unlink poster and print size" ));
QList paperSizeList = PaperSizeUtils::allPaperSizes();
Q_FOREACH (QPrinter::PaperSize paperSize, paperSizeList)
{
m_postersize->addItem( PaperSizeUtils::paperSizeToString(paperSize), paperSize );
m_printsize->addItem( PaperSizeUtils::paperSizeToString(paperSize), paperSize );
}
m_postersize->setCurrentIndex( m_postersize->findData(QPrinter::A3) );
slotPosterSizeChanged( m_postersize->currentIndex() );
m_multipage_note_label = new QLabel(i18n("Note: Only first page will be taken for poster print. "));
m_multipage_note_label->setVisible( false );
connect( m_postercheck, SIGNAL( toggled( bool ) ), dummy, SLOT( setEnabled( bool ) ) );
dummy->setEnabled( false );
connect( m_postercheck, SIGNAL( toggled(bool) ), SIGNAL( posterEnabled(bool) ) );
connect( m_postersize, SIGNAL( activated( int ) ), SLOT( slotPosterSizeChanged( int ) ) );
connect( m_printsize, SIGNAL( activated(int)), SLOT(slotPrintSizeChanged(int)));
connect( m_cutmargin, SIGNAL( valueChanged( int ) ), SLOT( slotMarginChanged( int ) ) );
connect( m_lockbtn, SIGNAL( toggled( bool ) ), m_printsize, SLOT( setDisabled( bool ) ) );
m_printsize->setEnabled( false );
connect( m_lockbtn, SIGNAL( toggled( bool ) ), SLOT( slotLockToggled( bool ) ) );
connect( m_selection, SIGNAL( textEdited( const QString& ) ), m_preview, SLOT( setSelectedPages( const QString& ) ) );
connect( m_preview, SIGNAL( selectionChanged( const QString& ) ), m_selection, SLOT( setText( const QString& ) ) );
// TODO ???
/*if ( KMFactory::self()->settings()->application != KPrinter::Dialog
&& KMFactory::self()->settings()->application >= 0 )
{
m_printsize->hide();
m_lockbtn->hide();
printlab->hide();
}*/
m_lockbtn->setChecked(false);
m_lockbtn->hide();
//m_printsize->setCurrentIndex( m_printsize->findData(QPrinter::A4) );
QVBoxLayout *l0 = new QVBoxLayout( this );
l0->setMargin(0);
l0->setSpacing(10);
l0->addWidget( m_postercheck );
l0->addWidget( dummy, 1 );
QGridLayout *l1 = new QGridLayout( dummy );
l1->setMargin(0);
l1->setSpacing(5);
l1->addWidget( posterlab, 0, 0 );
l1->addWidget( m_postersize, 0, 1 );
l1->addWidget( printlab, 1, 0 );
l1->addWidget( m_printsize, 1, 1 );
l1->addWidget( medialab, 2, 0 );
l1->addWidget( m_mediasize, 2, 1 );
l1->addWidget( m_preview, 4, 0, 1, 3 );
l1->addWidget( m_cutmargin, 6, 0, 1, 3 );
l1->addWidget( m_lockbtn, 0, 2, 2, 1 );
QHBoxLayout *l2 = new QHBoxLayout( 0 );
l2->setMargin(0);
l2->setSpacing(5);
l1->addLayout( l2, 7, 0, 1, 3 );
l2->addWidget( selectionlab );
l2->addWidget( m_selection );
l1->setColumnStretch( 1, 1 );
l1->setRowStretch( 4, 1 );
l1->addItem(new QSpacerItem(0, 10), 3, 0);
l1->addItem(new QSpacerItem(0, 10), 5, 0);
l1->addWidget( m_multipage_note_label, 8, 0, 1, 3 );
}
PosterWidget::~PosterWidget()
{
}
void PosterWidget::getOptions( QMap& opts, bool )
{
QStringList o = opts[ "_kde-filters" ].split(",", QString::SkipEmptyParts);
if ( !m_postercheck->isChecked() )
{
o.removeAll( "poster" );
opts[ "_kde-filters" ] = o.join( "," );
opts.remove( "_kde-poster-media" );
opts.remove( "_kde-poster-size" );
opts.remove( "_kde-poster-cut" );
opts.remove( "kde-printsize" );
opts.remove( "_kde-poster-select" );
}
else
{
if ( !o.contains( "poster" ) )
o.append( "poster" );
opts[ "_kde-filters" ] = o.join( "," );
opts[ "_kde-poster-media" ] = m_mediasize->text();
opts[ "_kde-poster-size" ] = m_postersize->currentText(); //TODO: pageSizeToPageName( ( KPrinter::PageSize )page_sizes[ m_postersize->currentItem() ].ID );
opts[ "kde-printsize" ] = m_printsize->currentText(); //QString::number( m_printsize->itemData(m_printsize->currentIndex()).toInt() );
opts[ "_kde-poster-cut" ] = QString::number( m_cutmargin->value() );
opts[ "_kde-poster-select" ] = m_selection->text().trimmed();
}
}
bool PosterWidget::isEnabled()
{
return m_postercheck->isChecked();
}
QSizeF PosterWidget::mediaSize() const
{
// dummy function, needed for Q_PROPERTY
return QSizeF();
}
void PosterWidget::setMediaSize(const QSizeF& mediaSizeFloat)
{
QSize mediaSize = mediaSizeFloat.toSize();
QPrinter::PageSize paperSize;
if (mediaSize == QSize( 2384, 3370 )) {
paperSize = QPrinter::A0;
}
else if (mediaSize == QSize( 1684, 2384 )) {
paperSize = QPrinter::A1;
}
else if (mediaSize == QSize( 1191, 1684 )) {
paperSize = QPrinter::A2;
}
else if (mediaSize == QSize( 842, 1191 )) {
paperSize = QPrinter::A3;
}
else if (mediaSize == QSize( 595, 842 )) {
paperSize = QPrinter::A4;
}
else if (mediaSize == QSize( 420, 595 )) {
paperSize = QPrinter::A5;
}
else if (mediaSize == QSize( 298, 420 )) {
paperSize = QPrinter::A6;
}
else if (mediaSize == QSize( 210, 298 )) {
paperSize = QPrinter::A7;
}
else if (mediaSize == QSize( 147, 210 )) {
paperSize = QPrinter::A8;
}
else if (mediaSize == QSize( 105, 147 )) {
paperSize = QPrinter::A9;
}
else if (mediaSize == QSize( 2835, 4008 )) {
paperSize = QPrinter::B0;
}
else if (mediaSize == QSize( 2004, 2835 )) {
paperSize = QPrinter::B1;
}
else if (mediaSize == QSize( 1417, 2004 )) {
paperSize = QPrinter::B2;
}
else if (mediaSize == QSize( 1001, 1417 )) {
paperSize = QPrinter::B3;
}
else if (mediaSize == QSize( 709, 1001 )) {
paperSize = QPrinter::B4;
}
else if (mediaSize == QSize( 499, 709 )) {
paperSize = QPrinter::B5;
}
else if (mediaSize == QSize( 354, 499 )) {
paperSize = QPrinter::B6;
}
else if (mediaSize == QSize( 249, 354 )) {
paperSize = QPrinter::B7;
}
else if (mediaSize == QSize( 176, 249 )) {
paperSize = QPrinter::B8;
}
else if (mediaSize == QSize( 125, 176 )) {
paperSize = QPrinter::B9;
}
else if (mediaSize == QSize( 88, 125 )) {
paperSize = QPrinter::B10;
}
else if (mediaSize == QSize( 459, 649 )) {
paperSize = QPrinter::C5E;
}
else if (mediaSize == QSize( 297, 684 )) {
paperSize = QPrinter::Comm10E;
}
else if (mediaSize == QSize( 312, 624 )) {
paperSize = QPrinter::DLE;
}
else if (mediaSize == QSize( 522, 756 )) {
paperSize = QPrinter::Executive;
}
else if (mediaSize == QSize( 595, 935 )) {
paperSize = QPrinter::Folio;
}
else if (mediaSize == QSize( 1224, 792 )) {
paperSize = QPrinter::Ledger;
}
else if (mediaSize == QSize( 612, 1008 )) {
paperSize = QPrinter::Legal;
}
else if (mediaSize == QSize( 612, 792 )) {
paperSize = QPrinter::Letter;
}
else if (mediaSize == QSize( 792, 1224 )) {
paperSize = QPrinter::Tabloid;
}
else {
paperSize = QPrinter::A4;
}
m_printsize->setCurrentIndex(m_printsize->findData(paperSize));
// TODO proper
int ID = m_printsize->itemData(m_printsize->currentIndex()).toInt();
m_preview->setMediaSize( ID );
}
QString PosterWidget::mediaSizeDescription() const
{
return m_mediasize->text();
}
void PosterWidget::setMediaSizeDescription(const QString& mediaSize)
{
m_mediasize->setText(mediaSize.isEmpty() ? i18n("Unknown") : mediaSize);
}
void PosterWidget::showMultiPageNote(const bool show) {
m_multipage_note_label->setVisible(show);
}
void PosterWidget::slotPosterSizeChanged( int value )
{
int ID = m_postersize->itemData(m_postersize->currentIndex()).toInt();
m_preview->setPosterSize( ID );
if ( m_lockbtn->isChecked() )
m_printsize->setCurrentIndex( value );
}
void PosterWidget::slotPrintSizeChanged( int )
{
int ID = m_printsize->itemData(m_printsize->currentIndex()).toInt();
m_preview->setMediaSize( ID );
}
void PosterWidget::slotMarginChanged( int value )
{
m_preview->setCutMargin( value );
}
void PosterWidget::slotLockToggled( bool on )
{
m_lockbtn->setIcon( QIcon::fromTheme( on ? "document-encrypt" : "document-decrypt" ) );
if ( on )
m_printsize->setCurrentIndex( m_postersize->currentIndex() );
}
kprinter4-12/fileprinter.cpp 0000644 0001750 0001750 00000045355 12354274517 014355 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* This class is derived from fileprinter class from:
* Copyright (C) 2007, 2010 by John Layt
*/
#include "fileprinter.h"
int FilePrinter::printFiles(QPrinter& printer, const QStringList fileList,
QPrinter::Orientation documentOrientation, FileDeletePolicy fileDeletePolicy,
PageSelectPolicy pageSelectPolicy, const QString& pageRange,
const QStringList& printerOptions,
const QString& system) {
FilePrinter fp;
return fp.doPrintFiles(printer, fileList, fileDeletePolicy, pageSelectPolicy, pageRange, documentOrientation, printerOptions, system);
}
int FilePrinter::doPrintFiles(QPrinter& printer, QStringList fileList, FileDeletePolicy fileDeletePolicy,
PageSelectPolicy pageSelectPolicy, const QString& pageRange,
QPrinter::Orientation documentOrientation,
const QStringList& printerOptions,
const QString& system) {
if (fileList.size() < 1) return -8;
for (QStringList::ConstIterator it = fileList.constBegin(); it != fileList.constEnd(); ++it) {
if (!QFile::exists(*it)) return -7;
}
if (printer.printerState() == QPrinter::Aborted || printer.printerState() == QPrinter::Error) return -6;
QString exe;
QStringList argList;
int ret = 0;
// Print to File if a filename set, assumes only one file
if (!printer.outputFileName().isEmpty()) {
if (QFile::exists(printer.outputFileName())) {
QFile::remove(printer.outputFileName());
}
bool doDeleteFile = (fileDeletePolicy == FilePrinter::SystemDeletesFiles);
if (printer.outputFormat() == QPrinter::PostScriptFormat) {
if (!pageRange.isEmpty() && psselectAvailable()) {
exe = "psselect";
argList << QString("-p%1").arg(pageRange);
argList << fileList[0];
argList << printer.outputFileName();
kDebug() << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute(exe, argList);
} else {
if (doDeleteFile) {
bool res = QFile::rename(fileList[0], printer.outputFileName());
if (res) {
doDeleteFile = FALSE;
ret = 0;
} else {
ret = -5;
}
} else {
bool res = QFile::copy(fileList[0], printer.outputFileName());
if (res)
ret = 0;
else
ret = -5;
}
}
} else if ((printer.outputFormat() == QPrinter::PdfFormat) && ps2pdfAvailable()) {
QString inputfilename = fileList[0];
KTemporaryFile tf;
if (!pageRange.isEmpty() && psselectAvailable()) {
tf.setSuffix(".ps");
if (!tf.open()) return -10;
exe = "psselect";
argList << QString("-p%1").arg(pageRange);
argList << inputfilename;
argList << tf.fileName();
kDebug() << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute(exe, argList);
if (ret) return ret;
inputfilename = tf.fileName();
}
exe = "ps2pdf"; argList.clear();
argList << inputfilename << printer.outputFileName();
kDebug() << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute(exe, argList);
} else {
ret = -5;
}
if (doDeleteFile) QFile::remove(fileList[0]);
} else { /* Print to a printer via lpr command */
bool useCupsOptions = cupsAvailable();
if ((system == "autodetect") || (system == "cups")) {
if (!KStandardDirs::findExe("lpr-cups").isEmpty()) {
exe = "lpr-cups";
} else if (!KStandardDirs::findExe("lpr.cups").isEmpty()) {
exe = "lpr.cups";
} else if (!KStandardDirs::findExe("lpr").isEmpty()) {
exe = "lpr";
} else if (!KStandardDirs::findExe("lp").isEmpty()) {
exe = "lp";
} else {
return -9;
}
if ((system == "cups") && (!useCupsOptions)) return -11;
} else if (system == "lpd") {
if (!KStandardDirs::findExe("lpr").isEmpty()) {
exe = "lpr";
} else if (!KStandardDirs::findExe("lp").isEmpty()) {
exe = "lp";
} else {
return -9;
}
useCupsOptions = FALSE;
}
argList = printArguments(printer, fileDeletePolicy, pageSelectPolicy,
useCupsOptions, pageRange, exe, printerOptions, documentOrientation) << fileList;
kDebug() << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute(exe, argList);
}
return ret;
}
QList FilePrinter::pageList(QPrinter& printer, int lastPage, const QList& selectedPageList) {
return pageList(printer, lastPage, 0, selectedPageList);
}
QList FilePrinter::pageList(QPrinter& printer, int lastPage,
int currentPage, const QList& selectedPageList) {
if (printer.printRange() == QPrinter::Selection) return selectedPageList;
int startPage, endPage;
QList list;
if (printer.printRange() == QPrinter::PageRange) {
startPage = printer.fromPage();
endPage = printer.toPage();
} else if (printer.printRange() == QPrinter::CurrentPage) {
startPage = currentPage;
endPage = currentPage;
} else { // All pages
startPage = 1;
endPage = lastPage;
}
for (int i = startPage; i <= endPage; i++) list << i;
return list;
}
QString FilePrinter::pageRange(QPrinter& printer, int lastPage, const QList& selectedPageList) {
if (printer.printRange() == QPrinter::Selection) return pageListToPageRange(selectedPageList);
if (printer.printRange() == QPrinter::PageRange)
return QString("%1-%2").arg(printer.fromPage()).arg(printer.toPage());
return QString("1-%2").arg(lastPage);
}
QString FilePrinter::pageListToPageRange(const QList& pageList) {
QString pageRange;
int count = pageList.count();
int i = 0;
int seqStart = i;
int seqEnd;
while (i != count) {
if ((i+1 == count) || (pageList[i]+1 != pageList[i+1])) {
seqEnd = i;
if (!pageRange.isEmpty()) pageRange.append(",");
if (seqStart == seqEnd) {
pageRange.append(pageList[i]);
} else {
pageRange.append(QString("%1-%2").arg(seqStart).arg(seqEnd));
}
seqStart = i + 1;
}
++i;
}
return pageRange;
}
bool FilePrinter::ps2pdfAvailable() {
return (!KStandardDirs::findExe("ps2pdf").isEmpty());
}
bool FilePrinter::psselectAvailable() {
return (!KStandardDirs::findExe("psselect").isEmpty());
}
bool FilePrinter::cupsAvailable() {
/* Ideally we would have access to the private Qt method
* QCUPSSupport::cupsAvailable() to do this as it is very complex routine.
* However, if CUPS is available then QPrinter::numCopies() will always return 1
* whereas if CUPS is not available it will return the real number of copies.
* This behaviour is guaranteed never to change, so we can use it as a reliable substitute.
*/
QPrinter testPrinter;
testPrinter.setNumCopies(2);
return (testPrinter.numCopies() == 1);
}
bool FilePrinter::detectCupsService() {
QTcpSocket qsock;
qsock.connectToHost("localhost", 631);
bool rtn = qsock.waitForConnected() && qsock.isValid();
qsock.abort();
return rtn;
}
bool FilePrinter::detectCupsConfig() {
if (QFile::exists("/etc/cups/cupsd.conf")) return TRUE;
if (QFile::exists("/usr/etc/cups/cupsd.conf")) return TRUE;
if (QFile::exists("/usr/local/etc/cups/cupsd.conf")) return TRUE;
if (QFile::exists("/opt/etc/cups/cupsd.conf")) return TRUE;
if (QFile::exists("/opt/local/etc/cups/cupsd.conf")) return TRUE;
return FALSE;
}
QStringList FilePrinter::printArguments(QPrinter& printer, FileDeletePolicy fileDeletePolicy,
PageSelectPolicy pageSelectPolicy, bool useCupsOptions,
const QString& pageRange, const QString& version,
const QStringList& printerOptions,
QPrinter::Orientation documentOrientation) {
QStringList argList;
if (!destination(printer, version).isEmpty()) argList << destination(printer, version);
if (!copies(printer, version).isEmpty()) argList << copies(printer, version);
if (!jobname(printer, version).isEmpty()) argList << jobname(printer, version);
if (!pages(printer, pageSelectPolicy, pageRange, useCupsOptions, version).isEmpty())
argList << pages(printer, pageSelectPolicy, pageRange, useCupsOptions, version);
if (!printerOptions.isEmpty())
argList << customPrinterOptions(printerOptions);
if (useCupsOptions && !cupsOptions(printer, documentOrientation).isEmpty())
argList << cupsOptions(printer, documentOrientation);
if (!deleteFile(printer, fileDeletePolicy, version).isEmpty())
argList << deleteFile(printer, fileDeletePolicy, version);
if (version == "lp") argList << "--";
return argList;
}
QStringList FilePrinter::destination(QPrinter& printer, const QString& version) {
if (version == "lp") return QStringList("-d") << printer.printerName();
if (version.startsWith("lpr")) return QStringList("-P") << printer.printerName();
return QStringList();
}
QStringList FilePrinter::copies(QPrinter& printer, const QString& version) {
int cp = printer.actualNumCopies();
if (version == "lp") return QStringList("-n") << QString("%1").arg(cp);
if (version.startsWith("lpr")) return QStringList() << QString("-#%1").arg(cp);
return QStringList();
}
QStringList FilePrinter::jobname(QPrinter& printer, const QString& version) {
if (!printer.docName().isEmpty()) {
if (version == "lp") return QStringList("-t") << printer.docName();
if (version.startsWith("lpr")) {
const QString shortenedDocName = QString::fromUtf8(printer.docName().toUtf8().left(255));
return QStringList("-J") << shortenedDocName;
}
}
return QStringList();
}
QStringList FilePrinter::deleteFile(QPrinter& printer, FileDeletePolicy fileDeletePolicy, const QString& version) {
Q_UNUSED(printer);
if ((fileDeletePolicy == FilePrinter::SystemDeletesFiles) && version.startsWith("lpr")) return QStringList("-r");
return QStringList();
}
QStringList FilePrinter::pages(QPrinter& printer, PageSelectPolicy pageSelectPolicy, const QString& pageRange,
bool useCupsOptions, const QString& version) {
if (pageSelectPolicy == FilePrinter::SystemSelectsPages) {
if ((printer.printRange() == QPrinter::Selection) && ! pageRange.isEmpty()) {
if (version == "lp") return QStringList("-P") << pageRange ;
if (version.startsWith("lpr") && useCupsOptions)
return QStringList("-o") << QString("page-ranges=%1").arg(pageRange);
}
if (printer.printRange() == QPrinter::PageRange) {
if (version == "lp")
return QStringList("-P") << QString("%1-%2").arg(printer.fromPage()).arg(printer.toPage());
if (version.startsWith("lpr") && useCupsOptions)
return QStringList("-o") << QString("page-ranges=%1-%2").arg(printer.fromPage()).arg(printer.toPage());
}
}
return QStringList(); /* all pages */
}
QStringList FilePrinter::customPrinterOptions(const QStringList& options) {
QStringList result;
for (int i = 0; i < options.count(); ++i)
result << QStringList("-o ") << options[i];
return result;
}
QStringList FilePrinter::cupsOptions(QPrinter& printer, QPrinter::Orientation documentOrientation) {
QStringList optionList;
if (!optionMedia(printer).isEmpty() ) optionList << optionMedia(printer);
if (!optionOrientation(printer, documentOrientation ).isEmpty()) optionList << optionOrientation(printer, documentOrientation);
if (!optionDoubleSidedPrinting(printer).isEmpty()) optionList << optionDoubleSidedPrinting(printer);
if (!optionPageOrder(printer).isEmpty()) optionList << optionPageOrder(printer);
if (!optionCollateCopies(printer).isEmpty()) optionList << optionCollateCopies(printer);
if (!optionPageMargins(printer).isEmpty()) optionList << optionPageMargins(printer);
optionList << optionCupsProperties(printer);
return optionList;
}
QStringList FilePrinter::optionMedia(QPrinter& printer) {
if (!mediaPageSize(printer).isEmpty() && !mediaPaperSource(printer).isEmpty()) {
return QStringList("-o") << QString("media=%1,%2").arg(mediaPageSize(printer))
.arg(mediaPaperSource(printer));
}
if (!mediaPageSize(printer).isEmpty())
return QStringList("-o") << QString("media=%1").arg(mediaPageSize(printer));
if (!mediaPaperSource(printer).isEmpty())
return QStringList("-o") << QString("media=%1").arg(mediaPaperSource(printer));
return QStringList();
}
QString FilePrinter::mediaPageSize(QPrinter& printer) {
switch (printer.pageSize()) {
case QPrinter::A0: return "A0";
case QPrinter::A1: return "A1";
case QPrinter::A2: return "A2";
case QPrinter::A3: return "A3";
case QPrinter::A4: return "A4";
case QPrinter::A5: return "A5";
case QPrinter::A6: return "A6";
case QPrinter::A7: return "A7";
case QPrinter::A8: return "A8";
case QPrinter::A9: return "A9";
case QPrinter::B0: return "B0";
case QPrinter::B1: return "B1";
case QPrinter::B10: return "B10";
case QPrinter::B2: return "B2";
case QPrinter::B3: return "B3";
case QPrinter::B4: return "B4";
case QPrinter::B5: return "B5";
case QPrinter::B6: return "B6";
case QPrinter::B7: return "B7";
case QPrinter::B8: return "B8";
case QPrinter::B9: return "B9";
case QPrinter::C5E: return "C5"; //Correct Translation?
case QPrinter::Comm10E: return "Comm10"; //Correct Translation?
case QPrinter::DLE: return "DL"; //Correct Translation?
case QPrinter::Executive: return "Executive";
case QPrinter::Folio: return "Folio";
case QPrinter::Ledger: return "Ledger";
case QPrinter::Legal: return "Legal";
case QPrinter::Letter: return "Letter";
case QPrinter::Tabloid: return "Tabloid";
case QPrinter::Custom: return QString("Custom.%1x%2mm").arg(printer.heightMM()).arg(printer.widthMM());
default: return QString();
}
}
QString FilePrinter::mediaPaperSource(QPrinter& printer) {
switch (printer.paperSource()) {
case QPrinter::Auto: return QString();
case QPrinter::Cassette: return "Cassette";
case QPrinter::Envelope: return "Envelope";
case QPrinter::EnvelopeManual: return "EnvelopeManual";
case QPrinter::FormSource: return "FormSource";
case QPrinter::LargeCapacity: return "LargeCapacity";
case QPrinter::LargeFormat: return "LargeFormat";
case QPrinter::Lower: return "Lower";
case QPrinter::MaxPageSource: return "MaxPageSource";
case QPrinter::Middle: return "Middle";
case QPrinter::Manual: return "Manual";
case QPrinter::OnlyOne: return "OnlyOne";
case QPrinter::Tractor: return "Tractor";
case QPrinter::SmallFormat: return "SmallFormat";
default: return QString();
}
}
QStringList FilePrinter::optionOrientation(QPrinter& printer, QPrinter::Orientation documentOrientation) {
// 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 additionally
if (printer.orientation() == documentOrientation) {
// the user wants the document printed as is
return QStringList("-o") << "portrait";
}
// the user expects the document being rotated by 90 degrees
return QStringList("-o") << "landscape";
}
QStringList FilePrinter::optionDoubleSidedPrinting(QPrinter& printer) {
switch (printer.duplex()) {
case QPrinter::DuplexNone: return QStringList("-o") << "sides=one-sided";
case QPrinter::DuplexAuto: if (printer.orientation() == QPrinter::Landscape)
return QStringList("-o") << "sides=two-sided-short-edge";
else
return QStringList("-o") << "sides=two-sided-long-edge";
case QPrinter::DuplexLongSide: return QStringList("-o") << "sides=two-sided-long-edge";
case QPrinter::DuplexShortSide: return QStringList("-o") << "sides=two-sided-short-edge";
default: return QStringList(); // Use printer default
}
}
QStringList FilePrinter::optionPageOrder(QPrinter& printer) {
if (printer.pageOrder() == QPrinter::LastPageFirst) return QStringList("-o") << "outputorder=reverse";
return QStringList("-o") << "outputorder=normal";
}
QStringList FilePrinter::optionCollateCopies(QPrinter& printer) {
if (printer.collateCopies()) return QStringList("-o") << "Collate=True";
return QStringList("-o") << "Collate=False";
}
QStringList FilePrinter::optionPageMargins(QPrinter& printer) {
if (printer.printEngine()->property(QPrintEngine::PPK_PageMargins).isNull()) {
return QStringList();
} else {
qreal l, t, r, b;
printer.getPageMargins(&l,& t,& r,& b, QPrinter::Point);
return QStringList("-o") << QString("page-left=%1").arg(l)
<< "-o" << QString("page-top=%1").arg(t)
<< "-o" << QString("page-right=%1").arg(r)
<< "-o" << QString("page-bottom=%1").arg(b) << "-o" << "fit-to-page";
}
}
QStringList FilePrinter::optionCupsProperties(QPrinter& printer) {
QStringList dialogOptions = printer.printEngine()->property(QPrintEngine::PrintEnginePropertyKey(0xfe00)).toStringList();
QStringList cupsOptions;
for (int i = 0; i < dialogOptions.count(); i += 2) {
if (dialogOptions[i+1].isEmpty())
cupsOptions << "-o" << dialogOptions[i];
else
cupsOptions << "-o" << dialogOptions[i] + '=' + dialogOptions[i+1];
}
return cupsOptions;
}
kprinter4-12/LICENCE 0000644 0001750 0001750 00000104513 12354274517 012303 0 ustar mba mba GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
kprinter4-12/utils/ 0000755 0001750 0001750 00000000000 12354274517 012452 5 ustar mba mba kprinter4-12/utils/tmpdir.cpp 0000644 0001750 0001750 00000006054 12354274517 014462 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "tmpdir.h"
TmpDir::TmpDir(const QString& appName, const QString& sub) : QObject() {
QStringList dirs = KGlobal::dirs()->resourceDirs("tmp");
p_tmp_path_base = dirs.size()?dirs[0]:"/var/tmp/";
kDebug() << "Found temporary path" << p_tmp_path_base;
p_error = FALSE;
PID pid;
p_tmp_path = p_tmp_path_base;
if (p_tmp_path.right(1) != "/") p_tmp_path += "/";
p_tmp_path += appName+"."+QString("%1").arg(pid.getPID())+"/";
p_tmp_path_app = p_tmp_path;
if (!sub.isEmpty()) {
p_tmp_path += sub+"/";
}
kDebug() << "Temporary folder in use:" << p_tmp_path;
p_error = !p_create_dir(p_tmp_path);
}
TmpDir::~TmpDir() {
//do we have a sub component in the path?
if (p_tmp_path_app != p_tmp_path) {
if (p_remove_dir(p_tmp_path)) {
kDebug() << QString("Deleting temporary folder \"%1\"").arg(p_tmp_path);
} else {
kDebug() << QString("Deleting temporary folder \"%1\" failed").arg(p_tmp_path);
}
}
QDir dir(p_tmp_path_app);
dir.setNameFilters(QStringList() << "*.*");
dir.setFilter(QDir::Files);
foreach(QString dirFile, dir.entryList()) {
dir.remove(dirFile);
}
if ((dir.exists()) && (!dir.rmdir(p_tmp_path_app))) {
kDebug() << QString("Temporary folder \"%1\" not removed yet.").arg(p_tmp_path_app);
}
}
const QString TmpDir::tmpPath() {
p_error = !p_create_dir(p_tmp_path);
return p_tmp_path;
}
quint64 TmpDir::freeSpace() const {
KDiskFreeSpaceInfo diskfreespace = KDiskFreeSpaceInfo::freeSpaceInfo(p_tmp_path);
return diskfreespace.available();
}
bool TmpDir::p_create_dir(const QString &dirName) {
QDir *dir = new QDir(dirName);
if (!dir->exists()) {
if (!dir->mkpath(dirName)) {
return FALSE;
}
}
return TRUE;
}
bool TmpDir::p_remove_dir(const QString &dirName) {
bool result = TRUE;
QDir dir(dirName);
if (dir.exists(dirName)) {
Q_FOREACH(QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
if (info.isDir()) {
result = p_remove_dir(info.absoluteFilePath());
} else {
result = QFile::remove(info.absoluteFilePath());
}
if (!result) {
return result;
}
}
result = dir.rmdir(dirName);
}
return result;
}
kprinter4-12/utils/papersizeutils.cpp 0000644 0001750 0001750 00000020602 12354274517 016241 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* Copyright (c) 2013 Felix Geyer */
#include "papersizeutils.h"
QList PaperSizeUtils::allPaperSizes() {
QList result;
result.append(QPrinter::A4);
result.append(QPrinter::B5);
result.append(QPrinter::Letter);
result.append(QPrinter::Legal);
result.append(QPrinter::Executive);
result.append(QPrinter::A0);
result.append(QPrinter::A1);
result.append(QPrinter::A2);
result.append(QPrinter::A3);
result.append(QPrinter::A5);
result.append(QPrinter::A6);
result.append(QPrinter::A7);
result.append(QPrinter::A8);
result.append(QPrinter::A9);
result.append(QPrinter::B0);
result.append(QPrinter::B1);
result.append(QPrinter::B10);
result.append(QPrinter::B2);
result.append(QPrinter::B3);
result.append(QPrinter::B4);
result.append(QPrinter::B6);
result.append(QPrinter::B7);
result.append(QPrinter::B8);
result.append(QPrinter::B9);
result.append(QPrinter::C5E);
result.append(QPrinter::Comm10E);
result.append(QPrinter::DLE);
result.append(QPrinter::Folio);
result.append(QPrinter::Ledger);
result.append(QPrinter::Tabloid);
return result;
}
QPrinter::PaperSize PaperSizeUtils::sizeToPaperSize(const QSize size, const bool transpose) {
QPrinter::PaperSize result;
QSize tmp = size;
if (transpose) tmp.transpose();
if ((tmp.width() == 2384) && (tmp.height() == 3370)) result = QPrinter::A0;
else if ((tmp.width() == 1684) && (tmp.height() == 2384)) result = QPrinter::A1;
else if ((tmp.width() == 1191) && (tmp.height() == 1684)) result = QPrinter::A2;
else if ((tmp.width() == 842) && (tmp.height() == 1191)) result = QPrinter::A3;
else if ((tmp.width() == 595) && (tmp.height() == 842)) result = QPrinter::A4;
else if ((tmp.width() == 596) && (tmp.height() == 843)) result = QPrinter::A4;
else if ((tmp.width() == 420) && (tmp.height() == 595)) result = QPrinter::A5;
else if ((tmp.width() == 298) && (tmp.height() == 420)) result = QPrinter::A6;
else if ((tmp.width() == 210) && (tmp.height() == 298)) result = QPrinter::A7;
else if ((tmp.width() == 147) && (tmp.height() == 210)) result = QPrinter::A8;
else if ((tmp.width() == 105) && (tmp.height() == 147)) result = QPrinter::A9;
else if ((tmp.width() == 283) && (tmp.height() == 4008)) result = QPrinter::B0;
else if ((tmp.width() == 2004) && (tmp.height() == 2835)) result = QPrinter::B1;
else if ((tmp.width() == 1417) && (tmp.height() == 2004)) result = QPrinter::B2;
else if ((tmp.width() == 1001) && (tmp.height() == 1417)) result = QPrinter::B3;
else if ((tmp.width() == 709) && (tmp.height() == 1001)) result = QPrinter::B4;
else if ((tmp.width() == 499) && (tmp.height() == 709)) result = QPrinter::B5;
else if ((tmp.width() == 354) && (tmp.height() == 499)) result = QPrinter::B6;
else if ((tmp.width() == 249) && (tmp.height() == 254)) result = QPrinter::B7;
else if ((tmp.width() == 176) && (tmp.height() == 249)) result = QPrinter::B8;
else if ((tmp.width() == 125) && (tmp.height() == 176)) result = QPrinter::B9;
else if ((tmp.width() == 88) && (tmp.height() == 125)) result = QPrinter::B10;
else if ((tmp.width() == 459) && (tmp.height() == 649)) result = QPrinter::C5E;
else if ((tmp.width() == 297) && (tmp.height() == 684)) result = QPrinter::Comm10E;
else if ((tmp.width() == 312) && (tmp.height() == 624)) result = QPrinter::DLE;
else if ((tmp.width() == 522) && (tmp.height() == 756)) result = QPrinter::Executive;
else if ((tmp.width() == 595) && (tmp.height() == 935)) result = QPrinter::Folio;
else if ((tmp.width() == 1224) && (tmp.height() == 792)) result = QPrinter::Ledger;
else if ((tmp.width() == 612) && (tmp.height() == 1008)) result = QPrinter::Legal;
else if ((tmp.width() == 612) && (tmp.height() == 792)) result = QPrinter::Letter;
else if ((tmp.width() == 792) && (tmp.height() == 1224)) result = QPrinter::Tabloid;
else if (!transpose) result = sizeToPaperSize(tmp, TRUE); else result = QPrinter::Custom;
return result;
}
QString PaperSizeUtils::paperSizeToString(const QPrinter::PaperSize size) {
switch (size) {
case QPrinter::A0 : return "A0";
case QPrinter::A1 : return "A1";
case QPrinter::A2 : return "A2";
case QPrinter::A3 : return "A3";
case QPrinter::A4 : return "A4";
case QPrinter::A5 : return "A5";
case QPrinter::A6 : return "A6";
case QPrinter::A7 : return "A7";
case QPrinter::A8 : return "A8";
case QPrinter::A9 : return "A9";
case QPrinter::B0 : return "B0";
case QPrinter::B1 : return "B1";
case QPrinter::B10 : return "B10";
case QPrinter::B2 : return "B2";
case QPrinter::B3 : return "B3";
case QPrinter::B4 : return "B4";
case QPrinter::B5 : return "B5";
case QPrinter::B6 : return "B6";
case QPrinter::B7 : return "B7";
case QPrinter::B8 : return "B8";
case QPrinter::B9 : return "B9";
case QPrinter::C5E : return "C5";
case QPrinter::Comm10E : return "Comm10";
case QPrinter::DLE : return "DL";
case QPrinter::Executive : return "Executive";
case QPrinter::Folio : return "Folio";
case QPrinter::Ledger : return "Ledger";
case QPrinter::Legal : return "Legal";
case QPrinter::Letter : return "Letter";
case QPrinter::Tabloid : return "Tabloid";
case QPrinter::Custom : return QString("Custom");
default : return QString();
}
}
QString PaperSizeUtils::paperSizeToFancyString(const QPrinter::PaperSize size) {
switch (size) {
case QPrinter::A0 : return "DIN A0";
case QPrinter::A1 : return "DIN A1";
case QPrinter::A2 : return "DIN A2";
case QPrinter::A3 : return "DIN A3";
case QPrinter::A4 : return "DIN A4";
case QPrinter::A5 : return "DIN A5";
case QPrinter::A6 : return "DIN A6";
case QPrinter::A7 : return "DIN A7";
case QPrinter::A8 : return "DIN A8";
case QPrinter::A9 : return "DIN A9";
case QPrinter::B0 : return "B0";
case QPrinter::B1 : return "B1";
case QPrinter::B10 : return "B10";
case QPrinter::B2 : return "B2";
case QPrinter::B3 : return "B3";
case QPrinter::B4 : return "B4";
case QPrinter::B5 : return "B5";
case QPrinter::B6 : return "B6";
case QPrinter::B7 : return "B7";
case QPrinter::B8 : return "B8";
case QPrinter::B9 : return "B9";
case QPrinter::C5E : return "C5";
case QPrinter::Comm10E : return "Commercial#10";
case QPrinter::DLE : return "DL";
case QPrinter::Executive : return "Executive";
case QPrinter::Folio : return "Folio";
case QPrinter::Ledger : return "Ledger";
case QPrinter::Legal : return "Legal";
case QPrinter::Letter : return "Letter";
case QPrinter::Tabloid : return "Tabloid";
case QPrinter::Custom : return QString("Custom");
default : return QString();
}
}
QString PaperSizeUtils::orientationToString(const QPrinter::Orientation orientation) {
switch (orientation) {
case QPrinter::Portrait : return i18n("Portrait");
case QPrinter::Landscape : return i18n("Landscape");
}
return QString();
}
kprinter4-12/utils/tmpdir.h 0000644 0001750 0001750 00000003136 12354274517 014125 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef TMPDIR_H
#define TMPDIR_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "utils/pid.h"
class TmpDir : public QObject {
public:
TmpDir(const QString& appName, const QString& sub = "");
~TmpDir();
const QString tmpPath();
inline const QString tmpPathBase() const { return p_tmp_path_base; }
inline bool error() const { return p_error; }
quint64 freeSpace() const;
private:
QString p_tmp_path_base; //e.g. /var/tmp
QString p_tmp_path_app; //e.g. /var/tmp/audex.1234
QString p_tmp_path; //e.g. /car/tmp/audex.1234/sub
bool p_error;
bool p_create_dir(const QString &dirName);
bool p_remove_dir(const QString &dirName);
};
#endif
kprinter4-12/utils/pid.h 0000644 0001750 0001750 00000001724 12354274517 013403 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef PID_H
#define PID_H
#include
#include
#include
class PID : public QObject {
public:
PID();
int getPID();
};
#endif
kprinter4-12/utils/papersizeutils.h 0000644 0001750 0001750 00000002563 12354274517 015714 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* Copyright (c) 2013 Felix Geyer */
#ifndef PAPERSIZEUTILS_H
#define PAPERSIZEUTILS_H
#include
#include
#include
class PaperSizeUtils {
public:
static QList allPaperSizes();
static QPrinter::PaperSize sizeToPaperSize(const QSize size, const bool transpose = FALSE);
static QString paperSizeToString(const QPrinter::PaperSize size);
static QString paperSizeToFancyString(const QPrinter::PaperSize size);
static QString orientationToString(const QPrinter::Orientation orientation);
};
#endif
kprinter4-12/utils/pid.cpp 0000644 0001750 0001750 00000001603 12354274517 013732 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "pid.h"
PID::PID() : QObject() {
}
int PID::getPID() {
return getpid();
}
kprinter4-12/kprinter4.desktop 0000644 0001750 0001750 00000001006 12354274517 014624 0 ustar mba mba [Desktop Entry]
Name=KPrinter4
Name[de]=KPrinter4
Name[x-test]=xxKPrinter4xx
GenericName=PostScript printing
GenericName[de]=PostScript-Dokumente drucken
GenericName[x-test]=xxPostScript printingxx
Exec=kprinter4
Icon=kprinter4
Type=Application
MimeType=application/postscript;
Categories=Qt;KDE;System;
Terminal=false
Comment=Print PostScript documents with KDE print dialog
Comment[de]=PostScript-Dokumente mit Hilfe des KDE Druck-Dialogs drucken
Comment[x-test]=xxPrint PostScript documents with KDE print dialogxx
kprinter4-12/cmake/ 0000755 0001750 0001750 00000000000 12354274517 012372 5 ustar mba mba kprinter4-12/cmake/modules/ 0000755 0001750 0001750 00000000000 12354274517 014042 5 ustar mba mba kprinter4-12/cmake/modules/FindLibSpectre.cmake 0000644 0001750 0001750 00000005050 12354274517 017701 0 ustar mba mba # - Try to find the libspectre PS library
# Once done this will define
#
# LIBSPECTRE_FOUND - system has libspectre
# LIBSPECTRE_INCLUDE_DIR - the libspectre include directory
# LIBSPECTRE_LIBRARY - Link this to use libspectre
#
# Copyright (c) 2006-2007, Pino Toscano,
# Copyright (c) 2008, Albert Astals Cid,
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
# in cache already
set(LIBSPECTRE_INTERNAL_FOUND TRUE)
else(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
if(NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(UsePkgConfig)
PKGCONFIG(libspectre _SpectreIncDir _SpectreLinkDir _SpectreLinkFlags _SpectreCflags)
if(_SpectreLinkFlags)
# find again pkg-config, to query it about libspectre version
FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config PATHS /usr/bin/ /usr/local/bin )
# query pkg-config asking for a libspectre >= LIBSPECTRE_MINIMUM_VERSION
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${LIBSPECTRE_MINIMUM_VERSION} libspectre RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
if(_return_VALUE STREQUAL "0")
set(LIBSPECTRE_INTERNAL_FOUND TRUE)
endif(_return_VALUE STREQUAL "0")
endif(_SpectreLinkFlags)
else(NOT WIN32)
# do not use pkg-config on windows
find_library(_SpectreLinkFlags NAMES libspectre spectre PATHS ${CMAKE_LIBRARY_PATH})
find_path(LIBSPECTRE_INCLUDE_DIR spectre.h PATH_SUFFIXES libspectre )
set(LIBSPECTRE_INTERNAL_FOUND TRUE)
endif(NOT WIN32)
if (LIBSPECTRE_INTERNAL_FOUND)
set(LIBSPECTRE_LIBRARY ${_SpectreLinkFlags})
# the cflags for libspectre can contain more than one include path
separate_arguments(_SpectreCflags)
foreach(_includedir ${_SpectreCflags})
string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}")
set(LIBSPECTRE_INCLUDE_DIR ${LIBSPECTRE_INCLUDE_DIR} ${_includedir})
endforeach(_includedir)
endif (LIBSPECTRE_INTERNAL_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibSpectre DEFAULT_MSG LIBSPECTRE_LIBRARY LIBSPECTRE_INTERNAL_FOUND)
# ensure that they are cached
set(LIBSPECTRE_INCLUDE_DIR ${LIBSPECTRE_INCLUDE_DIR} CACHE INTERNAL "The libspectre include path")
set(LIBSPECTRE_LIBRARY ${LIBSPECTRE_LIBRARY} CACHE INTERNAL "The libspectre library")
endif(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
kprinter4-12/cmake/modules/COPYING-CMAKE-SCRIPTS 0000644 0001750 0001750 00000002457 12354274517 017050 0 ustar mba mba Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
kprinter4-12/config.h.cmake 0000644 0001750 0001750 00000000143 12354274517 014005 0 ustar mba mba #ifndef __CONFIG_H__
#define __CONFIG_H__
#define KPRINTER4_VERSION "@KPRINTER4_VERSION@"
#endif
kprinter4-12/AUTHORS 0000644 0001750 0001750 00000000050 12354274517 012355 0 ustar mba mba Marco Nelles
kprinter4-12/postscriptdocument.h 0000644 0001750 0001750 00000006616 12354274517 015445 0 ustar mba mba /* KRPINTER4 - Simple PostScript document printer
* Copyright (C) 2014 Marco Nelles, credativ GmbH (marco.nelles@credativ.de)
*
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/* This class handles a PostScript-Document with libspectre */
#ifndef PSDOCUMENT_HEADER
#define PSDOCUMENT_HEADER
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "utils/papersizeutils.h"
#include "utils/tmpdir.h"
#define DEFAULT_PAPER_SIZE QPrinter::A4
#define DEFAULT_ORIENTATION QPrinter::Portrait
class PostScriptDocument; // forward declaration for static members
class PostScriptDocumentPage {
public:
PostScriptDocumentPage();
PostScriptDocumentPage(const QSize& size, const QPrinter::Orientation orientation, const bool reversePage);
PostScriptDocumentPage(const PostScriptDocumentPage& other);
PostScriptDocumentPage& operator=(const PostScriptDocumentPage& other);
~PostScriptDocumentPage();
inline QSize size() { return p_size; }
inline QPrinter::Orientation orientation() { return p_orientation; }
inline bool reversePage() { return p_reverse_page; }
void clear();
inline bool isValid() { return p_is_valid; }
private:
QSize p_size;
QPrinter::Orientation p_orientation;
bool p_reverse_page;
bool p_is_valid;
};
class PostScriptDocument {
public:
PostScriptDocument();
PostScriptDocument(const QString& fileName);
~PostScriptDocument();
bool load(const QString& fileName);
bool close();
void clear();
/* Requested size depends on physical parameters of the hardware */
QImage* renderPage(const int pageNum, const int dpiX, const int dpiY);
/* Alternative implementation with GhostScript */
void renderPagesGS(const int dpiX, const int dpiY);
QImage* fetchRenderedPageGS(const int pageNum);
void clearRenderedPagesGS();
inline int numPages() { return p_pages.count(); }
inline QSize pageSize() { return p_page_size; }
inline QPrinter::PaperSize paperSize() { return PaperSizeUtils::sizeToPaperSize(p_page_size); }
inline QPrinter::Orientation orientation() { return p_orientation; }
inline PostScriptDocumentPage& page(const int num) { if ((num >= 0) || (num < p_pages.count())) return p_pages[num]; }
inline bool isValid() { return p_is_valid; }
static QPrinter::Orientation spectreOrientationToOrientation(SpectreOrientation orientation, bool *reversePage);
private:
QString p_filename;
SpectreDocument *p_internal_document;
QList p_pages;
bool p_is_valid;
QSize p_page_size;
QPrinter::Orientation p_orientation;
TmpDir *p_tmp_dir;
QString p_tmp_path;
};
#endif
kprinter4-12/icons/ 0000755 0001750 0001750 00000000000 12354274517 012425 5 ustar mba mba kprinter4-12/icons/CMakeLists.txt 0000644 0001750 0001750 00000000050 12354274517 015160 0 ustar mba mba kde4_install_icons(${ICON_INSTALL_DIR})
kprinter4-12/icons/hi16-app-kprinter4.png 0000644 0001750 0001750 00000001245 12354274517 016402 0 ustar mba mba PNG
IHDR a sBIT|d pHYs + GIDAT8}KQ?o&&64F ԂBNY)
zCE 1&쮻oz:0773o;x,
c(^,rAYO(FDp=nloom4|ȪEnRM0qIE^㘝b\nU*LMy9lIggY\\:}h4
և?4M1`eYX֚9S*Rq(JkҼ뺓 8L岮VzHx4oGQ*#nn0y A032dZ|>RU,$IZi<ϣ1qOڗnV#MS i6L]ess...\X
0D fgkـ6VDPB)mquu8(Z%bF?Oߗ