summaryrefslogtreecommitdiffstats
path: root/tdeprint/lpdunix
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
commite16866e072f94410321d70daedbcb855ea878cac (patch)
treeee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /tdeprint/lpdunix
parenta58c20c1a7593631a1b50213c805507ebc16adaf (diff)
downloadtdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz
tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'tdeprint/lpdunix')
-rw-r--r--tdeprint/lpdunix/CMakeLists.txt52
-rw-r--r--tdeprint/lpdunix/Makefile.am15
-rw-r--r--tdeprint/lpdunix/klpdunixprinterimpl.cpp83
-rw-r--r--tdeprint/lpdunix/klpdunixprinterimpl.h41
-rw-r--r--tdeprint/lpdunix/kmlpdunixfactory.cpp29
-rw-r--r--tdeprint/lpdunix/kmlpdunixmanager.cpp410
-rw-r--r--tdeprint/lpdunix/kmlpdunixmanager.h42
-rw-r--r--tdeprint/lpdunix/kmlpdunixuimanager.cpp45
-rw-r--r--tdeprint/lpdunix/kmlpdunixuimanager.h35
-rw-r--r--tdeprint/lpdunix/lpdunix.print83
10 files changed, 835 insertions, 0 deletions
diff --git a/tdeprint/lpdunix/CMakeLists.txt b/tdeprint/lpdunix/CMakeLists.txt
new file mode 100644
index 000000000..5b30cf46c
--- /dev/null
+++ b/tdeprint/lpdunix/CMakeLists.txt
@@ -0,0 +1,52 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -D_KDEPRINT_COMPILE
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/dcop
+ ${CMAKE_SOURCE_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdeui
+ ${CMAKE_SOURCE_DIR}/tdeprint
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES lpdunix.print DESTINATION ${DATA_INSTALL_DIR}/tdeprint/plugins )
+
+
+#### tdeprint_lpdunix ###########################
+
+set( target tdeprint_lpdunix )
+
+set( ${target}_SRCS
+ kmlpdunixfactory.cpp kmlpdunixmanager.cpp
+ klpdunixprinterimpl.cpp kmlpdunixuimanager.cpp
+)
+
+tde_add_kpart( ${target}
+ SOURCES ${${target}_SRCS}
+ LINK tdeprint-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/tdeprint/lpdunix/Makefile.am b/tdeprint/lpdunix/Makefile.am
new file mode 100644
index 000000000..019ead755
--- /dev/null
+++ b/tdeprint/lpdunix/Makefile.am
@@ -0,0 +1,15 @@
+AM_CPPFLAGS = -D_KDEPRINT_COMPILE
+
+INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/tdeprint $(all_includes)
+
+kde_module_LTLIBRARIES = tdeprint_lpdunix.la
+
+tdeprint_lpdunix_la_SOURCES = kmlpdunixfactory.cpp kmlpdunixmanager.cpp klpdunixprinterimpl.cpp kmlpdunixuimanager.cpp
+tdeprint_lpdunix_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+tdeprint_lpdunix_la_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEPRINT)
+tdeprint_lpdunix_la_METASOURCES = AUTO
+
+noinst_HEADERS = kmlpdunixmanager.h klpdunixprinterimpl.h kmlpdunixuimanager.h
+
+entry_DATA = lpdunix.print
+entrydir = $(kde_datadir)/tdeprint/plugins
diff --git a/tdeprint/lpdunix/klpdunixprinterimpl.cpp b/tdeprint/lpdunix/klpdunixprinterimpl.cpp
new file mode 100644
index 000000000..9ba97efae
--- /dev/null
+++ b/tdeprint/lpdunix/klpdunixprinterimpl.cpp
@@ -0,0 +1,83 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#include "klpdunixprinterimpl.h"
+#include "kprinter.h"
+
+#include <tqfile.h>
+#include <kstandarddirs.h>
+#include <klocale.h>
+#include <kmacroexpander.h>
+
+KLpdUnixPrinterImpl::KLpdUnixPrinterImpl(TQObject *parent, const char *name, const TQStringList & /*args*/)
+: KPrinterImpl(parent,name)
+{
+}
+
+KLpdUnixPrinterImpl::~KLpdUnixPrinterImpl()
+{
+}
+
+void KLpdUnixPrinterImpl::initLpPrint(TQString& cmd, KPrinter *printer)
+{
+ cmd += TQString::tqfromLatin1(" -d %1 -n%2").arg(quote(printer->printerName())).arg(printer->numCopies());
+}
+
+void KLpdUnixPrinterImpl::initLprPrint(TQString& cmd, KPrinter *printer)
+{
+ cmd += TQString::tqfromLatin1(" -P %1 '-#%2'").arg(quote(printer->printerName())).arg(printer->numCopies());
+}
+
+// look for executable, starting with "lpr"
+TQString KLpdUnixPrinterImpl::executable()
+{
+ QString exe = KStandardDirs::findExe("lpr");
+ if (exe.isEmpty())
+ exe = KStandardDirs::findExe("lp");
+ return exe;
+}
+
+bool KLpdUnixPrinterImpl::setupCommand(TQString& cmd, KPrinter *printer)
+{
+ TQString exe = printer->option( "kde-printcommand" );
+ if ( exe.isEmpty() || exe == "<automatic>" )
+ {
+ exe = executable();
+ if (!exe.isEmpty())
+ {
+ cmd = exe;
+ if (exe.right(3) == "lpr")
+ initLprPrint(cmd,printer);
+ else
+ initLpPrint(cmd,printer);
+ return true;
+ }
+ else
+ printer->setErrorMessage(i18n("No valid print executable was found in your path. Check your installation."));
+ return false;
+ }
+ else
+ {
+ TQMap<TQString,TQString> map;
+ map.insert( "printer", printer->printerName() );
+ map.insert( "copies", TQString::number( printer->numCopies() ) );
+ cmd = KMacroExpander::expandMacrosShellQuote( exe, map );
+ return true;
+ }
+}
diff --git a/tdeprint/lpdunix/klpdunixprinterimpl.h b/tdeprint/lpdunix/klpdunixprinterimpl.h
new file mode 100644
index 000000000..bbbda4104
--- /dev/null
+++ b/tdeprint/lpdunix/klpdunixprinterimpl.h
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#ifndef KLPDUNIXPRINTERIMPL_H
+#define KLPDUNIXPRINTERIMPL_H
+
+#include "kprinterimpl.h"
+
+class KProcess;
+
+class KLpdUnixPrinterImpl : public KPrinterImpl
+{
+public:
+ KLpdUnixPrinterImpl(TQObject *parent, const char *name, const TQStringList & /*args*/);
+ ~KLpdUnixPrinterImpl();
+
+ bool setupCommand(TQString&, KPrinter*);
+
+protected:
+ void initLpPrint(TQString&, KPrinter*);
+ void initLprPrint(TQString&, KPrinter*);
+ TQString executable();
+};
+
+#endif
diff --git a/tdeprint/lpdunix/kmlpdunixfactory.cpp b/tdeprint/lpdunix/kmlpdunixfactory.cpp
new file mode 100644
index 000000000..70925a65c
--- /dev/null
+++ b/tdeprint/lpdunix/kmlpdunixfactory.cpp
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#include "kmlpdunixmanager.h"
+#include "kmlpdunixuimanager.h"
+#include "klpdunixprinterimpl.h"
+
+#include <kgenericfactory.h>
+
+typedef K_TYPELIST_3( KMLpdUnixManager, KLpdUnixPrinterImpl, KMLpdUnixUiManager ) Products;
+K_EXPORT_COMPONENT_FACTORY( tdeprint_lpdunix, KGenericFactory< Products > )
+
+
diff --git a/tdeprint/lpdunix/kmlpdunixmanager.cpp b/tdeprint/lpdunix/kmlpdunixmanager.cpp
new file mode 100644
index 000000000..afcd83b2a
--- /dev/null
+++ b/tdeprint/lpdunix/kmlpdunixmanager.cpp
@@ -0,0 +1,410 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#include "kmlpdunixmanager.h"
+#include "kmfactory.h"
+#include "kmprinter.h"
+
+#include <tqfile.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+
+#include <stdlib.h>
+
+/*****************
+ * Utility class *
+ *****************/
+class KTextBuffer
+{
+public:
+ KTextBuffer(TQIODevice *dev) : m_stream(dev) {}
+ bool eof() const { return (m_stream.eof() && m_linebuf.isEmpty()); }
+ TQString readLine();
+ void unreadLine(const TQString& l) { m_linebuf = l; }
+private:
+ TQTextStream m_stream;
+ TQString m_linebuf;
+};
+
+TQString KTextBuffer::readLine()
+{
+ TQString line;
+ if (!m_linebuf.isEmpty())
+ {
+ line = m_linebuf;
+ m_linebuf = TQString::null;
+ }
+ else
+ line = m_stream.readLine();
+ return line;
+}
+
+/*****************************
+ * Various parsing functions *
+ *****************************/
+
+// Extract a line from a KTextBuffer:
+// '#' -> comments
+// '\' -> line continue
+// ':' or '|' -> line continue (LPRng)
+//
+// New entry is detected by a line which have first character different from
+// '#', '|', ':'. The line is then put back in the IODevice.
+TQString readLine(KTextBuffer& t)
+{
+ TQString line, buffer;
+ bool lineContinue(false);
+
+ while (!t.eof())
+ {
+ buffer = t.readLine().stripWhiteSpace();
+ if (buffer.isEmpty() || buffer[0] == '#')
+ continue;
+ if (buffer[0] == '|' || buffer[0] == ':' || lineContinue || line.isEmpty())
+ {
+ line.append(buffer);
+ if (line.right(1) == "\\")
+ {
+ line.truncate(line.length()-1);
+ line = line.stripWhiteSpace();
+ lineContinue = true;
+ }
+ else
+ lineContinue = false;
+ }
+ else
+ {
+ t.unreadLine(buffer);
+ break;
+ }
+ }
+ return line;
+}
+
+// extact an entry (printcap-like)
+TQMap<TQString,TQString> readEntry(KTextBuffer& t)
+{
+ TQString line = readLine(t);
+ TQMap<TQString,TQString> entry;
+
+ if (!line.isEmpty())
+ {
+ TQStringList l = TQStringList::split(':',line,false);
+ if (l.count() > 0)
+ {
+ int p(-1);
+ if ((p=l[0].find('|')) != -1)
+ entry["printer-name"] = l[0].left(p); // only keep first name (discard aliases
+ else
+ entry["printer-name"] = l[0];
+ for (uint i=1; i<l.count(); i++)
+ if ((p=l[i].find('=')) != -1)
+ entry[l[i].left(p).stripWhiteSpace()] = l[i].right(l[i].length()-p-1).stripWhiteSpace();
+ else
+ entry[l[i].stripWhiteSpace()] = TQString::null;
+ }
+ }
+ return entry;
+}
+
+// create basic printer from entry
+KMPrinter* createPrinter(const TQMap<TQString,TQString>& entry)
+{
+ KMPrinter *printer = new KMPrinter();
+ printer->setName(entry["printer-name"]);
+ printer->setPrinterName(entry["printer-name"]);
+ printer->setType(KMPrinter::Printer);
+ printer->setState(KMPrinter::Idle);
+ return printer;
+}
+KMPrinter* createPrinter(const TQString& prname)
+{
+ TQMap<TQString,TQString> map;
+ map["printer-name"] = prname;
+ return createPrinter(map);
+}
+
+// this function support LPRng piping feature, it defaults to
+// /etc/printcap in any other cases (basic support)
+TQString getPrintcapFileName()
+{
+ // check if LPRng system
+ TQString printcap("/etc/printcap");
+ TQFile f("/etc/lpd.conf");
+ if (f.exists() && f.open(IO_ReadOnly))
+ {
+ kdDebug() << "/etc/lpd.conf found: probably LPRng system" << endl;
+ TQTextStream t(&f);
+ TQString line;
+ while (!t.eof())
+ {
+ line = t.readLine().stripWhiteSpace();
+ if (line.startsWith("printcap_path="))
+ {
+ kdDebug() << "printcap_path entry found: " << line << endl;
+ TQString pcentry = line.mid(14).stripWhiteSpace();
+ kdDebug() << "printcap_path value: " << pcentry << endl;
+ if (pcentry[0] == '|')
+ { // printcap through pipe
+ printcap = locateLocal("tmp","printcap");
+ TQString cmd = TQString::tqfromLatin1("echo \"all\" | %1 > %2").arg(pcentry.mid(1)).arg(printcap);
+ kdDebug() << "printcap obtained through pipe" << endl << "executing: " << cmd << endl;
+ ::system(cmd.local8Bit());
+ }
+ break;
+ }
+ }
+ }
+ kdDebug() << "printcap file returned: " << printcap << endl;
+ return printcap;
+}
+
+// "/etc/printcap" file parsing (Linux/LPR)
+void KMLpdUnixManager::parseEtcPrintcap()
+{
+ TQFile f(getPrintcapFileName());
+ if (f.exists() && f.open(IO_ReadOnly))
+ {
+ KTextBuffer t(TQT_TQIODEVICE(&f));
+ TQMap<TQString,TQString> entry;
+
+ while (!t.eof())
+ {
+ entry = readEntry(t);
+ if (entry.isEmpty() || !entry.contains("printer-name") || entry.contains("server"))
+ continue;
+ if (entry["printer-name"] == "all")
+ {
+ if (entry.contains("all"))
+ {
+ // find separator
+ int p = entry["all"].find(TQRegExp("[^a-zA-Z0-9_\\s-]"));
+ if (p != -1)
+ {
+ TQChar c = entry["all"][p];
+ TQStringList prs = TQStringList::split(c,entry["all"],false);
+ for (TQStringList::ConstIterator it=prs.begin(); it!=prs.end(); ++it)
+ {
+ KMPrinter *printer = ::createPrinter(*it);
+ printer->setDescription(i18n("Description unavailable"));
+ addPrinter(printer);
+ }
+ }
+ }
+ }
+ else
+ {
+ KMPrinter *printer = ::createPrinter(entry);
+ if (entry.contains("rm"))
+ printer->setDescription(i18n("Remote printer queue on %1").arg(entry["rm"]));
+ else
+ printer->setDescription(i18n("Local printer"));
+ addPrinter(printer);
+ }
+ }
+ }
+}
+
+// helper function for NIS support in Solaris-2.6 (use "ypcat printers.conf.byname")
+TQString getEtcPrintersConfName()
+{
+ TQString printersconf("/etc/printers.conf");
+ if (!TQFile::exists(printersconf) && !KStandardDirs::findExe( "ypcat" ).isEmpty())
+ {
+ // standard file not found, try NIS
+ printersconf = locateLocal("tmp","printers.conf");
+ TQString cmd = TQString::tqfromLatin1("ypcat printers.conf.byname > %1").arg(printersconf);
+ kdDebug() << "printers.conf obtained from NIS server: " << cmd << endl;
+ ::system(TQFile::encodeName(cmd));
+ }
+ return printersconf;
+}
+
+// "/etc/printers.conf" file parsing (Solaris 2.6)
+void KMLpdUnixManager::parseEtcPrintersConf()
+{
+ TQFile f(getEtcPrintersConfName());
+ if (f.exists() && f.open(IO_ReadOnly))
+ {
+ KTextBuffer t(TQT_TQIODEVICE(&f));
+ TQMap<TQString,TQString> entry;
+ TQString default_printer;
+
+ while (!t.eof())
+ {
+ entry = readEntry(t);
+ if (entry.isEmpty() || !entry.contains("printer-name"))
+ continue;
+ TQString prname = entry["printer-name"];
+ if (prname == "_default")
+ {
+ if (entry.contains("use"))
+ default_printer = entry["use"];
+ }
+ else if (prname != "_all")
+ {
+ KMPrinter *printer = ::createPrinter(entry);
+ if (entry.contains("bsdaddr"))
+ {
+ TQStringList l = TQStringList::split(',',entry["bsdaddr"],false);
+ printer->setDescription(i18n("Remote printer queue on %1").arg(l[0]));
+ }
+ else
+ printer->setDescription(i18n("Local printer"));
+ addPrinter(printer);
+ }
+ }
+
+ if (!default_printer.isEmpty())
+ setSoftDefault(findPrinter(default_printer));
+ }
+}
+
+// "/etc/lp/printers/" directory parsing (Solaris non-2.6)
+void KMLpdUnixManager::parseEtcLpPrinters()
+{
+ TQDir d("/etc/lp/printers");
+ const TQFileInfoList *prlist = d.entryInfoList(TQDir::Dirs);
+ if (!prlist)
+ return;
+
+ TQFileInfoListIterator it(*prlist);
+ for (;it.current();++it)
+ {
+ if (it.current()->fileName() == "." || it.current()->fileName() == "..")
+ continue;
+ TQFile f(it.current()->absFilePath() + "/configuration");
+ if (f.exists() && f.open(IO_ReadOnly))
+ {
+ KTextBuffer t(TQT_TQIODEVICE(&f));
+ TQString line, remote;
+ while (!t.eof())
+ {
+ line = readLine(t);
+ if (line.isEmpty()) continue;
+ if (line.startsWith("Remote:"))
+ {
+ TQStringList l = TQStringList::split(':',line,false);
+ if (l.count() > 1) remote = l[1];
+ }
+ }
+ KMPrinter *printer = new KMPrinter;
+ printer->setName(it.current()->fileName());
+ printer->setPrinterName(it.current()->fileName());
+ printer->setType(KMPrinter::Printer);
+ printer->setState(KMPrinter::Idle);
+ if (!remote.isEmpty())
+ printer->setDescription(i18n("Remote printer queue on %1").arg(remote));
+ else
+ printer->setDescription(i18n("Local printer"));
+ addPrinter(printer);
+ }
+ }
+}
+
+// "/etc/lp/member/" directory parsing (HP-UX)
+void KMLpdUnixManager::parseEtcLpMember()
+{
+ TQDir d("/etc/lp/member");
+ const TQFileInfoList *prlist = d.entryInfoList(TQDir::Files);
+ if (!prlist)
+ return;
+
+ TQFileInfoListIterator it(*prlist);
+ for (;it.current();++it)
+ {
+ KMPrinter *printer = new KMPrinter;
+ printer->setName(it.current()->fileName());
+ printer->setPrinterName(it.current()->fileName());
+ printer->setType(KMPrinter::Printer);
+ printer->setState(KMPrinter::Idle);
+ printer->setDescription(i18n("Local printer"));
+ addPrinter(printer);
+ }
+}
+
+// "/usr/spool/lp/interfaces/" directory parsing (IRIX 6.x)
+void KMLpdUnixManager::parseSpoolInterface()
+{
+ TQDir d("/usr/spool/interfaces/lp");
+ const TQFileInfoList *prlist = d.entryInfoList(TQDir::Files);
+ if (!prlist)
+ return;
+
+ TQFileInfoListIterator it(*prlist);
+ for (;it.current();++it)
+ {
+ TQFile f(it.current()->absFilePath());
+ if (f.exists() && f.open(IO_ReadOnly))
+ {
+ KTextBuffer t(TQT_TQIODEVICE(&f));
+ TQString line, remote;
+
+ while (!t.eof())
+ {
+ line = t.readLine().stripWhiteSpace();
+ if (line.startsWith("HOSTNAME"))
+ {
+ TQStringList l = TQStringList::split('=',line,false);
+ if (l.count() > 1) remote = l[1];
+ }
+ }
+
+ KMPrinter *printer = new KMPrinter;
+ printer->setName(it.current()->fileName());
+ printer->setPrinterName(it.current()->fileName());
+ printer->setType(KMPrinter::Printer);
+ printer->setState(KMPrinter::Idle);
+ if (!remote.isEmpty())
+ printer->setDescription(i18n("Remote printer queue on %1").arg(remote));
+ else
+ printer->setDescription(i18n("Local printer"));
+ addPrinter(printer);
+ }
+ }
+}
+
+//*********************************************************************************************************
+
+KMLpdUnixManager::KMLpdUnixManager(TQObject *parent, const char *name, const TQStringList & /*args*/)
+: KMManager(parent,name)
+{
+ m_loaded = false;
+}
+
+void KMLpdUnixManager::listPrinters()
+{
+ // load only once, if already loaded, just keep them (remove discard flag)
+ if (!m_loaded)
+ {
+ parseEtcPrintcap();
+ parseEtcPrintersConf();
+ parseEtcLpPrinters();
+ parseEtcLpMember();
+ parseSpoolInterface();
+ m_loaded = true;
+ }
+ else
+ discardAllPrinters(false);
+}
diff --git a/tdeprint/lpdunix/kmlpdunixmanager.h b/tdeprint/lpdunix/kmlpdunixmanager.h
new file mode 100644
index 000000000..8716f8351
--- /dev/null
+++ b/tdeprint/lpdunix/kmlpdunixmanager.h
@@ -0,0 +1,42 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#ifndef KMLPDUNIXMANAGER_H
+#define KMLPDUNIXMANAGER_H
+
+#include "kmmanager.h"
+
+class KMLpdUnixManager : public KMManager
+{
+public:
+ KMLpdUnixManager(TQObject *parent, const char *name, const TQStringList & /*args*/);
+
+protected:
+ void listPrinters();
+ void parseEtcPrintcap();
+ void parseEtcPrintersConf();
+ void parseEtcLpPrinters();
+ void parseEtcLpMember();
+ void parseSpoolInterface();
+
+private:
+ bool m_loaded;
+};
+
+#endif
diff --git a/tdeprint/lpdunix/kmlpdunixuimanager.cpp b/tdeprint/lpdunix/kmlpdunixuimanager.cpp
new file mode 100644
index 000000000..686dfecbb
--- /dev/null
+++ b/tdeprint/lpdunix/kmlpdunixuimanager.cpp
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#include "kmlpdunixuimanager.h"
+#include "kpqtpage.h"
+#include "kprinterpropertydialog.h"
+
+#include <klocale.h>
+
+KMLpdUnixUiManager::KMLpdUnixUiManager(TQObject *parent, const char *name, const TQStringList & /*args*/)
+: KMUiManager(parent,name)
+{
+ m_printdialogflags |= KMUiManager::PrintCommand;
+}
+
+KMLpdUnixUiManager::~KMLpdUnixUiManager()
+{
+}
+
+int KMLpdUnixUiManager::pluginPageCap()
+{
+ return KMUiManager::pluginPageCap();
+ //return KMUiManager::NoAutoCollate;
+}
+
+void KMLpdUnixUiManager::setupPrinterPropertyDialog( KPrinterPropertyDialog *dlg )
+{
+ dlg->addPage( new KPQtPage( dlg, "QtPage" ) );
+}
diff --git a/tdeprint/lpdunix/kmlpdunixuimanager.h b/tdeprint/lpdunix/kmlpdunixuimanager.h
new file mode 100644
index 000000000..6e9e0d2ef
--- /dev/null
+++ b/tdeprint/lpdunix/kmlpdunixuimanager.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#ifndef KMLPDUNIXUIMANAGER_H
+#define KMLPDUNIXUIMANAGER_H
+
+#include "kmuimanager.h"
+
+class KMLpdUnixUiManager : public KMUiManager
+{
+public:
+ KMLpdUnixUiManager(TQObject *parent, const char *name, const TQStringList & /*args*/);
+ ~KMLpdUnixUiManager();
+
+ int pluginPageCap();
+ void setupPrinterPropertyDialog( KPrinterPropertyDialog* );
+};
+
+#endif
diff --git a/tdeprint/lpdunix/lpdunix.print b/tdeprint/lpdunix/lpdunix.print
new file mode 100644
index 000000000..8ef71a28d
--- /dev/null
+++ b/tdeprint/lpdunix/lpdunix.print
@@ -0,0 +1,83 @@
+[KDE Print Entry]
+PrintSystem=lpdunix
+Comment=Generic UNIX LPD Print System (default)
+Comment[af]=Generies Unix Lpd Druk Stelsel (verstek)
+Comment[ar]=نظام طباعة LPD العام ليونيكس (افتراضي)
+Comment[az]=Ümumi UNIX LPD Sistemi (ön qurğulu)
+Comment[be]=Звычайная сістэма друку UNIX LPD (прадвызначана)
+Comment[bn]= সাধারণ ইউনিক্স এল-পি-ডি মুদ্রণ ব্যবস্থা (ডিফল্ট)
+Comment[bs]=Generički UNIX LPD sistem štampe (default)
+Comment[ca]=Sistema d'impressió genèric LPD de Unix (predeterminat)
+Comment[cs]=Obecný UNIXový tiskový systém LPD (implicitní)
+Comment[csb]=Pierwòsznô uniksowô systema drëkù LPD (domëslny)
+Comment[cy]=Cysawd Argraffu LPD Unix Cyffredinol (rhagosodiad)
+Comment[da]=Generisk UNIX LPD-udskriftssystem (standard)
+Comment[de]=UNIX-LPD-Drucksystem (Voreinstellung)
+Comment[el]=Γενικό σύστημα εκτύπωσης UNIX LPD (προκαθορισμένο)
+Comment[eo]=Ĝenerala Uniksa LPD-pressistemo (apriora)
+Comment[es]=Sistema de impresión genérico LPD de Unix (predeterminado)
+Comment[et]=Tavaline UNIX-i LPD trükkimise süsteem (vaikimisi)
+Comment[eu]=UNIX LPD inprimatze-sistema generikoa (lehenetsia)
+Comment[fa]=سیستم چاپUNIX LPD عمومی )پیش‌فرض(
+Comment[fi]=Yleinen UNIX LPD-tulostusjärjestelmä (oletus)
+Comment[fr]=Système d'impression LPD Unix générique (par défaut)
+Comment[fy]=Algemiene UNIX LPD-ôfdruksysteem (standert)
+Comment[ga]=Córas priontála cineálach LPD UNIX (réamhshocrú)
+Comment[gl]=Sistema UNIX Xenérico de Impresión LPD (por omisión)
+Comment[he]=מערכת ההדפסה הכללית של יוניקס LPD (ברירת מחדל)
+Comment[hi]=जेनरिक UNIX LPD छपाई पद्धत्ति (ङिफाल्ट)
+Comment[hr]=Generički UNIX LPD sustav za ispis (zadani)
+Comment[hu]=LPD (standard UNIX nyomtatási rendszer)
+Comment[id]=Sistem Pencetakan UNIX Generik LPD (bawaan)
+Comment[is]=Almennt UNIX LPD prentkerfi (sjálfgefið)
+Comment[it]=Sistema di stampa UNIX LPD generico (predefinito)
+Comment[ja]=一般的な UNIX LPD 印刷システム (標準)
+Comment[ka]=UNIX LPD ბეჭდვის სისტემა (ნაგულისხმები)
+Comment[kk]=UNIX жүйесіндегі әдетті LPD басып шғаруы
+Comment[km]=ប្រព័ន្ធ​បោះពុម្ព Generic UNIX LPD (លំនាំដើម)
+Comment[ko]=보통 유닉스 LPD 인쇄 시스템 (기본)
+Comment[lb]=Allgemengt UNIX-LPD-Drécksystem (Virastellung)
+Comment[lt]=Bendra UNIX LPD spausdinimo sistema (numatyta)
+Comment[lv]=Vispārēja UNIX LPD drukas sistēma (noklusēta)
+Comment[mk]=Општ UNIX LPD систем за печатење (стандардно)
+Comment[mn]=UNIX-LPD-Хэвлэх систем (Стандарт)
+Comment[ms]=Sistem Cetak UNIX LPD Generik (default)
+Comment[mt]=Sistema ġenerika tal-ipprintjar Unix LPD (standard)
+Comment[nb]=Vanlig UNIX LPD skriversystem (standard)
+Comment[nds]=Dat normale LPD-Drucksysteem vun UNIX (Standard)
+Comment[ne]=जेनेरिक UNIX LPD मुद्रण प्रणाली (पूर्वनिर्धारित)
+Comment[nl]=Generiek UNIX LPD-afdruksysteem (standaard)
+Comment[nn]=Generelt UNIX LPD-utskriftssystem (standard)
+Comment[nso]=System ya Kgatiso ya LPD ya UNIX ya Kakaretso (thuso ya tshoganetso)
+Comment[pa]=ਆਮ UNIX LPD ਪ੍ਰਿੰਟ ਸਿਸਟਮ(ਮੂਲ)
+Comment[pl]=Pierwotny uniksowy system druku LPD (domyślny)
+Comment[pt]=O sistema de impressão genérico do UNIX LPD (por omissão)
+Comment[pt_BR]= LPD - Sistema Genérico do UNIX de Impressão (padrão)
+Comment[ro]=Sistem generic de tipărire UNIX LPD (implicit)
+Comment[ru]=Система печати UNIX LPD (по умолчанию)
+Comment[rw]=Sisitemu yo Gucapa ya UNIX LPD Rusange (Mburabuzi)
+Comment[se]=Oppalaš UNIX LPD čálihanvuogádat (standárda)
+Comment[sk]=Generický tlačový systém UNIX LPD (štandardné)
+Comment[sl]=Splošni tiskalniški sistem LDP za Unix (privzeto)
+Comment[sq]=Sitemi Gjenrik Shtypi nga UNI LPD (e parazgjedhur)
+Comment[sr]=Генерички UNIX LPD систем за штампање (предефинисано)
+Comment[sr@Latn]=Generički UNIX LPD sistem za štampanje (predefinisano)
+Comment[ss]=Umshini wekushicelela lobanti weLPD ku KDE (kwehluleka)
+Comment[sv]=Generellt Unix LPD-skrivarsystem (standard)
+Comment[ta]=பொது யுனிக்ஸ் LPD அச்சுத் தொகுதி (முன் இருந்த)
+Comment[te]=సాధారణ యునిక్స్ ఎల్ పి డి ప్రచురణ వ్యవస్థ (అప్రమేయం)
+Comment[tg]=Системаи чопи UNIX LPD (пешфарзӣ)
+Comment[th]=ระบบการพิมพ์ LPD ของยูนิกซ์ (ค่าปริยาย)
+Comment[tr]=Genel UNIX LPD Yazdırma Sistemi (öntanımlı)
+Comment[tt]=UNIX LPD Bastıru Sisteme (töp)
+Comment[uk]=Загальна система друку UNIX - LPD (типова)
+Comment[uz]=Oddiy UNIX LPD bosib chiqarish tizimi (andoza)
+Comment[uz@cyrillic]=Оддий UNIX LPD босиб чиқариш тизими (андоза)
+Comment[ven]=Maitele au phirintha a UNIX (default)
+Comment[vi]=Hệ thống in LPD UNIX giống loài (mặc định)
+Comment[wa]=Sistinme d' imprimaedje djenerike LPD po UNIX (prémetou)
+Comment[xh]=Indlela Yoshicilelo Ngokubanzi ye UNIX LPD (edaliweyo)
+Comment[zh_CN]=通用 UNIX LPD 打印系统(默认)
+Comment[zh_HK]=通用 UNIX LPD 列印系統 (預設)
+Comment[zh_TW]=通用 UNIX LPD 列印系統(預設)
+Comment[zu]=Isistimu Yokushicilela ye-UNIX LPD Kawonke wonke (yokwendalo)