20 #include "lprsettings.h"
21 #include "kmmanager.h"
22 #include "kmfactory.h"
24 #include <tdeconfig.h>
26 #include <tqtextstream.h>
28 #define LPDCONF "/etc/lpd.conf"
29 #define PRINTCAP "/etc/printcap"
31 LprSettings* LprSettings::m_self = 0;
33 LprSettings::LprSettings(TQObject *parent,
const char *name)
34 : TQObject(parent, name), KPReloadObject(true)
39 LprSettings::~LprSettings()
44 LprSettings* LprSettings::self()
48 m_self =
new LprSettings(KMManager::self(),
"LprSettings");
53 void LprSettings::init()
56 TDEConfig *conf = KMFactory::self()->printConfig();
57 conf->setGroup(
"LPR");
58 TQString modestr = conf->readEntry(
"Mode");
59 if (modestr ==
"LPRng")
61 else if (modestr ==
"LPR")
66 if (TQFile::exists(LPDCONF))
73 m_printcapfile = TQString();
77 m_spooldir =
"/var/spool/lpd";
80 TQString LprSettings::printcapFile()
82 if (m_printcapfile.isEmpty())
85 m_printcapfile = PRINTCAP;
90 if (cf.open(IO_ReadOnly))
96 line = t.readLine().stripWhiteSpace();
97 if (line.startsWith(
"printcap_path"))
99 TQString filename = line.mid(14).stripWhiteSpace();
100 if (filename[0] !=
'|')
101 m_printcapfile = filename;
112 return m_printcapfile;
115 TQString LprSettings::defaultRemoteHost()
117 if (m_defaultremotehost.isEmpty())
119 m_defaultremotehost =
"localhost";
121 if (cf.open(IO_ReadOnly))
127 line = t.readLine().stripWhiteSpace();
128 if (line.startsWith(
"default_remote_host"))
130 TQString hostname = line.mid(20).stripWhiteSpace();
131 m_defaultremotehost = hostname;
136 return m_defaultremotehost;
139 void LprSettings::reload()
143 void LprSettings::configChanged()