本文整理汇总了C++中KMPrinter::setDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ KMPrinter::setDescription方法的具体用法?C++ KMPrinter::setDescription怎么用?C++ KMPrinter::setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KMPrinter
的用法示例。
在下文中一共展示了KMPrinter::setDescription方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadDesktopFile
bool KMSpecialManager::loadDesktopFile(const QString& filename)
{
KSimpleConfig conf(filename);
conf.setGroup("General");
int n = conf.readNumEntry("Number",0);
for (int i=0;i<n;i++)
{
QString grpname = QString::fromLatin1("Printer %1").arg(i);
if (!conf.hasGroup(grpname)) continue;
conf.setGroup(grpname);
KMPrinter *printer = new KMPrinter;
printer->setName(conf.readEntry("Name"));
printer->setPrinterName(printer->name());
printer->setDescription(conf.readEntry("Description"));
printer->setLocation(conf.readEntry("Comment"));
printer->setOption("kde-special-command",conf.readPathEntry("Command"));
printer->setOption("kde-special-file",conf.readPathEntry("File"));
printer->setOption("kde-special-extension",conf.readEntry("Extension"));
printer->setOption("kde-special-mimetype",conf.readEntry("Mimetype"));
printer->setOption("kde-special-require",conf.readEntry("Require"));
printer->setPixmap(conf.readEntry("Icon","unknown"));
printer->setType(KMPrinter::Special);
if ( !KdeprintChecker::check( &conf ) ||
!KXmlCommandManager::self()->checkCommand( printer->option( "kde-special-command" ),
KXmlCommandManager::None, KXmlCommandManager::None, 0 ) )
printer->addType(KMPrinter::Invalid);
printer->setState(KMPrinter::Idle);
printer->setAcceptJobs(true);
m_mgr->addPrinter(printer);
}
return true;
}
示例2: parseEtcPrintcap
// "/etc/printcap" file parsing (Linux/LPR)
void KMLpdUnixManager::parseEtcPrintcap()
{
QFile f(getPrintcapFileName());
if (f.exists() && f.open(IO_ReadOnly))
{
KTextBuffer t(&f);
QMap<QString,QString> 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(QRegExp("[^a-zA-Z0-9_\\s-]"));
if (p != -1)
{
QChar c = entry["all"][p];
QStringList prs = QStringList::split(c,entry["all"],false);
for (QStringList::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);
}
}
}
}
示例3: parseEtcLpPrinters
// "/etc/lp/printers/" directory parsing (Solaris non-2.6)
void KMLpdUnixManager::parseEtcLpPrinters()
{
QDir d("/etc/lp/printers");
const QFileInfoList *prlist = d.entryInfoList(QDir::Dirs);
if (!prlist)
return;
QFileInfoListIterator it(*prlist);
for (;it.current();++it)
{
if (it.current()->fileName() == "." || it.current()->fileName() == "..")
continue;
QFile f(it.current()->absFilePath() + "/configuration");
if (f.exists() && f.open(IO_ReadOnly))
{
KTextBuffer t(&f);
QString line, remote;
while (!t.eof())
{
line = readLine(t);
if (line.isEmpty()) continue;
if (line.startsWith("Remote:"))
{
QStringList l = QStringList::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);
}
}
}
示例4: parseSpoolInterface
// "/usr/spool/lp/interfaces/" directory parsing (IRIX 6.x)
void KMLpdUnixManager::parseSpoolInterface()
{
QDir d("/usr/spool/interfaces/lp");
const QFileInfoList *prlist = d.entryInfoList(QDir::Files);
if (!prlist)
return;
QFileInfoListIterator it(*prlist);
for (;it.current();++it)
{
QFile f(it.current()->absFilePath());
if (f.exists() && f.open(IO_ReadOnly))
{
KTextBuffer t(&f);
QString line, remote;
while (!t.eof())
{
line = t.readLine().stripWhiteSpace();
if (line.startsWith("HOSTNAME"))
{
QStringList l = QStringList::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);
}
}
}
示例5: parseEtcPrintersConf
// "/etc/printers.conf" file parsing (Solaris 2.6)
void KMLpdUnixManager::parseEtcPrintersConf()
{
QFile f(getEtcPrintersConfName());
if (f.exists() && f.open(IO_ReadOnly))
{
KTextBuffer t(&f);
QMap<QString,QString> entry;
QString default_printer;
while (!t.eof())
{
entry = readEntry(t);
if (entry.isEmpty() || !entry.contains("printer-name"))
continue;
QString 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"))
{
QStringList l = QStringList::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));
}
}
示例6: parseEtcLpMember
// "/etc/lp/member/" directory parsing (HP-UX)
void KMLpdUnixManager::parseEtcLpMember()
{
QDir d("/etc/lp/member");
const QFileInfoList *prlist = d.entryInfoList(QDir::Files);
if (!prlist)
return;
QFileInfoListIterator 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);
}
}
示例7: printer
KMPrinter* KMSpecialPrinterDlg::printer()
{
KMPrinter *printer = new KMPrinter();
printer->setName(m_name->text());
printer->setPrinterName(m_name->text());
printer->setPixmap(m_icon->icon());
printer->setDescription(m_description->text());
printer->setLocation(m_location->text());
printer->setOption("kde-special-command",m_command->command());
printer->setOption("kde-special-file",(m_usefile->isChecked() ? "1" : "0"));
if (m_usefile->isChecked ())
{
if (m_mimetype->currentText() != "all/all")
printer->setOption("kde-special-mimetype", m_mimetype->currentText());
printer->setOption("kde-special-extension",m_extension->text());
}
printer->setType(KMPrinter::Special);
printer->setState(KMPrinter::Idle);
return printer;
}
示例8:
KMPrinter *KMFoomaticManager::createPrinterFromElement(QDomElement *elem)
{
QDomElement e = elem->namedItem("name").toElement();
if(!e.isNull())
{
KMPrinter *printer = new KMPrinter;
printer->setType(KMPrinter::Printer);
printer->setName(e.text());
printer->setPrinterName(e.text());
printer->setState(KMPrinter::Idle);
/*if (printer->name().find('/') != -1)
{
QString s(printer->name());
int p = s.find('/');
printer->setPrinterName(s.left(p));
printer->setInstanceName(s.mid(p+1));
printer->addType(KMPrinter::Virtual);
}*/
if(!(e = elem->namedItem("description").toElement()).isNull())
printer->setDescription(e.text());
if(!(e = elem->namedItem("location").toElement()).isNull())
printer->setLocation(e.text());
if(!(e = elem->namedItem("connect").toElement()).isNull())
printer->setDevice(e.text());
printer->setOption("foomatic", elem->attribute("foomatic"));
printer->setOption("spooler", elem->attribute("spooler"));
if(elem->attribute("foomatic") == "1")
{
if(!(e = elem->namedItem("printer").toElement()).isNull())
printer->setOption("printer", e.text());
if(!(e = elem->namedItem("driver").toElement()).isNull())
printer->setOption("driver", e.text());
}
return printer;
}
return NULL;
}