示例#1
0
void PrintMenu::initialize()
{
    if (initialized()) clear();
    setInitialized(true);

    int ID = PRINTER_LIST_ID;
    // just to be sure the plugin is loaded -> icons are available
    KMManager::self();

    if ((KMManager::self()->printerOperationMask() & KMManager::PrinterCreation) && KMManager::self()->hasManagement())
        insertItem(KIcon("wizard"), i18n("Add Printer..."), ADD_PRINTER_ID);
    insertItem(KIcon("kdeprint-configmgr"), i18n("KDE Print Settings"), KDEPRINT_SETTINGS_ID);
    if (KMManager::self()->serverOperationMask() & KMManager::ServerConfigure)
        insertItem(KIcon("kdeprint-configsrv"), i18n("Configure Server"), CONFIG_SERVER_ID);
    addSeparator();
    insertItem(KIcon("kcontrol"), i18n("Print Manager"), PRINT_MANAGER_ID);
    insertItem(KIcon("konqueror"), i18n("Print Browser (Konqueror)"), PRINT_BROWSER_ID);
    addSeparator();
    insertItem(KIcon("document-print"), i18n("Print File..."), KPRINTER_ID);

    // printer list
    QList<KMPrinter*>    l = KMManager::self()->printerList();
    if (!l.isEmpty())
    {
        bool separatorInserted = false;
		QListIterator<KMPrinter*>       it(l);
		while (it.hasNext())
        {
			KMPrinter *itprt = it.next();
            // no special, implicit or pure instances
            if (itprt->isSpecial() || itprt->isVirtual())
                continue;
            if (!separatorInserted)
            {
                // we insert a separator only when we find the first
                // printer
                addSeparator();
                separatorInserted = true;
            }
            insertItem(KIcon(itprt->pixmap()),
                       itprt->printerName(), ID++);
        }
    }
}
示例#2
0
void KMJobViewer::updateCaption()
{
    if (!m_standalone)
        return;

    QString	pixname("fileprint");
    if (!m_prname.isEmpty())
    {
        setCaption(i18n("Print Jobs for %1").arg(m_prname));
        KMPrinter	*prt = KMManager::self()->findPrinter(m_prname);
        if (prt)
            pixname = prt->pixmap();
    }
    else
    {
        setCaption(i18n("No Printer"));
    }
    KWin::setIcons(winId(), DesktopIcon(pixname), SmallIcon(pixname));
}