Example #1
0
void KMJobViewer::slotMove(int prID)
{
    if (prID >= 0 && prID < (int)(m_printers.count()))
    {
        KMPrinter	*p = m_printers.at(prID);
        send(KMJob::Move,i18n("Move to %1").arg(p->printerName()),p->printerName());
    }
}
Example #2
0
void KMInstancePage::slotTest()
{
    KMTimer::self()->hold();

    QString src = m_view->currentText();
    if(!src.isEmpty())
    {
        if(src == i18n("(Default)"))
            src = QString::null;
        KMPrinter *mpr = KMFactory::self()->virtualManager()->findInstance(m_printer, src);
        if(!mpr)
            KMessageBox::error(this, i18n("Internal error: printer not found."));
        else if(KMessageBox::warningContinueCancel(this,
                                                   i18n("You are about to print a test page on %1. Do you want to continue?").arg(mpr->printerName()),
                                                   QString::null, i18n("Print Test Page"), "printTestPage")
                == KMessageBox::Continue)
        {
            if(!KMFactory::self()->virtualManager()->testInstance(mpr))
                KMessageBox::error(this, i18n("Unable to send test page to %1.").arg(mpr->printerName()));
            else
                KMessageBox::information(this, i18n("Test page successfully sent to printer %1.").arg(mpr->printerName()));
        }
    }

    KMTimer::self()->release(false);
}
Example #3
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++);
        }
    }
}