当前位置: 首页>>代码示例>>C++>>正文


C++ KMPrinter::name方法代码示例

本文整理汇总了C++中KMPrinter::name方法的典型用法代码示例。如果您正苦于以下问题:C++ KMPrinter::name方法的具体用法?C++ KMPrinter::name怎么用?C++ KMPrinter::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KMPrinter的用法示例。


在下文中一共展示了KMPrinter::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: slotConfigure

void KMMainView::slotConfigure()
{
    if(m_current)
    {
        KMTimer::self()->hold();
        bool needRefresh(false);
        if(m_current->isSpecial())
        {
            KMSpecialPrinterDlg dlg(this);
            dlg.setPrinter(m_current);
            if(dlg.exec())
            {
                KMPrinter *prt = dlg.printer();
                if(prt->name() != m_current->name())
                    m_manager->removeSpecialPrinter(m_current);
                m_manager->createSpecialPrinter(prt);
                needRefresh = true;
            }
        }
        else
        {
            DrMain *driver = m_manager->loadPrinterDriver(m_current, true);
            if(driver)
            {
                KMDriverDialog dlg(this);
                dlg.setCaption(i18n("Configure %1").arg(m_current->printerName()));
                dlg.setDriver(driver);
                // disable OK button for remote printer (read-only dialog)
                if(m_current->isRemote())
                    dlg.enableButtonOK(false);
                if(dlg.exec())
                    if(!m_manager->savePrinterDriver(m_current, driver))
                        showErrorMsg(i18n("Unable to modify settings of printer %1.").arg(m_current->printerName()));
                delete driver;
            }
            else
                showErrorMsg(i18n("Unable to load a valid driver for printer %1.").arg(m_current->printerName()));
        }
        KMTimer::self()->release(needRefresh);
    }
}
开发者ID:,项目名称:,代码行数:41,代码来源:


注:本文中的KMPrinter::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。