示例#1
0
void KMMainView::reload()
{
    removePluginActions();
    loadPluginActions();

    // redo the connection as the old manager object has been removed
    connect(m_manager, SIGNAL(updatePossible(bool)), SLOT(slotUpdatePossible(bool)));

    // We must delay the refresh such that all objects has been
    // correctly reloaded (otherwise, crash in KMJobViewer).
    reset(i18n("Initializing manager..."), true, true);
}
示例#2
0
void KMJobViewer::reload()
{
    removePluginActions();
    loadPluginActions();
    // re-add the current printer to the job manager: the job
    // manager has been destroyed, so the new one doesn't know
    // which printer it has to list
    addToManager();
    // no refresh needed: view has been cleared before reloading
    // and the actual refresh will be triggered either by the KControl
    // module, or by KJobViewerApp using timer.

    // reload the columns needed: remove the old one
    for (int c=m_view->columns()-1; c>5; c--)
        m_view->removeColumn(c);
    KMFactory::self()->uiManager()->setupJobViewer(m_view);

    // update the "History" action state
    actionCollection()->action("view_completed")->setEnabled(m_manager->actions() & KMJob::ShowCompleted);
    static_cast<KToggleAction*>(actionCollection()->action("view_completed"))->setChecked(false);
}
示例#3
0
void KMMainView::initActions()
{
    KIconSelectAction *vact = new KIconSelectAction(i18n("&View"), 0, m_actions, "view_change");
    QStringList iconlst;
    iconlst << "view_icon"
            << "view_detailed"
            << "view_tree";
    vact->setItems(QStringList::split(',', i18n("&Icons,&List,&Tree"), false), iconlst);
    vact->setCurrentItem(0);
    connect(vact, SIGNAL(activated(int)), SLOT(slotChangeView(int)));

    KActionMenu *stateAct = new KActionMenu(i18n("Start/Stop Printer"), "kdeprint_printstate", m_actions, "printer_state_change");
    stateAct->setDelayed(false);
    stateAct->insert(
        new KAction(i18n("&Start Printer"), "kdeprint_enableprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_start"));
    stateAct->insert(new KAction(i18n("Sto&p Printer"), "kdeprint_stopprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_stop"));

    stateAct = new KActionMenu(i18n("Enable/Disable Job Spooling"), "kdeprint_queuestate", m_actions, "printer_spool_change");
    stateAct->setDelayed(false);
    stateAct->insert(
        new KAction(i18n("&Enable Job Spooling"), "kdeprint_enableprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_enable"));
    stateAct->insert(
        new KAction(i18n("&Disable Job Spooling"), "kdeprint_stopprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_disable"));

    new KAction(i18n("&Remove"), "edittrash", 0, this, SLOT(slotRemove()), m_actions, "printer_remove");
    new KAction(i18n("&Configure..."), "configure", 0, this, SLOT(slotConfigure()), m_actions, "printer_configure");
    new KAction(i18n("Add &Printer/Class..."), "kdeprint_addprinter", 0, this, SLOT(slotAdd()), m_actions, "printer_add");
    new KAction(i18n("Add &Special (pseudo) Printer..."), "kdeprint_addpseudo", 0, this, SLOT(slotAddSpecial()), m_actions, "printer_add_special");
    new KAction(i18n("Set as &Local Default"), "kdeprint_defaulthard", 0, this, SLOT(slotHardDefault()), m_actions, "printer_hard_default");
    new KAction(i18n("Set as &User Default"), "kdeprint_defaultsoft", 0, this, SLOT(slotSoftDefault()), m_actions, "printer_soft_default");
    new KAction(i18n("&Test Printer..."), "kdeprint_testprinter", 0, this, SLOT(slotTest()), m_actions, "printer_test");
    new KAction(i18n("Configure &Manager..."), "kdeprint_configmgr", 0, this, SLOT(slotManagerConfigure()), m_actions, "manager_configure");
    new KAction(i18n("Initialize Manager/&View"), "reload", 0, this, SLOT(slotInit()), m_actions, "view_refresh");

    KIconSelectAction *dact = new KIconSelectAction(i18n("&Orientation"), 0, m_actions, "orientation_change");
    iconlst.clear();
    iconlst << "view_top_bottom"
            << "view_left_right";
    dact->setItems(QStringList::split(',', i18n("&Vertical,&Horizontal"), false), iconlst);
    dact->setCurrentItem(0);
    connect(dact, SIGNAL(activated(int)), SLOT(slotChangeDirection(int)));

    new KAction(i18n("R&estart Server"), "kdeprint_restartsrv", 0, this, SLOT(slotServerRestart()), m_actions, "server_restart");
    new KAction(i18n("Configure &Server..."), "kdeprint_configsrv", 0, this, SLOT(slotServerConfigure()), m_actions, "server_configure");

    KToggleAction *tact = new KToggleAction(i18n("Show &Toolbar"), 0, m_actions, "view_toolbar");
    tact->setCheckedState(i18n("Hide &Toolbar"));
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleToolBar(bool)));
    tact = new KToggleAction(i18n("Show Me&nu Toolbar"), 0, m_actions, "view_menubar");
    tact->setCheckedState(i18n("Hide Me&nu Toolbar"));
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleMenuBar(bool)));
    tact = new KToggleAction(i18n("Show Pr&inter Details"), "kdeprint_printer_infos", 0, m_actions, "view_printerinfos");
    tact->setCheckedState(KGuiItem(i18n("Hide Pr&inter Details"), "kdeprint_printer_infos"));
    tact->setChecked(true);
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotShowPrinterInfos(bool)));

    tact = new KToggleAction(i18n("Toggle Printer &Filtering"), "filter", 0, m_actions, "view_pfilter");
    tact->setChecked(KMManager::self()->isFilterEnabled());
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleFilter(bool)));

    new KAction(i18n("%1 &Handbook").arg("KDEPrint"), "contents", 0, this, SLOT(slotHelp()), m_actions, "invoke_help");
    new KAction(i18n("%1 &Web Site").arg("KDEPrint"), "network", 0, this, SLOT(slotHelp()), m_actions, "invoke_web");

    KActionMenu *mact = new KActionMenu(i18n("Pri&nter Tools"), "package_utilities", m_actions, "printer_tool");
    mact->setDelayed(false);
    connect(mact->popupMenu(), SIGNAL(activated(int)), SLOT(slotToolSelected(int)));
    QStringList files = KGlobal::dirs()->findAllResources("data", "kdeprint/tools/*.desktop");
    for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
    {
        KSimpleConfig conf(*it);
        conf.setGroup("Desktop Entry");
        mact->popupMenu()->insertItem(conf.readEntry("Name", "Unnamed"), mact->popupMenu()->count());
        m_toollist << conf.readEntry("X-KDE-Library");
    }

    // add actions to the toolbar
    m_actions->action("printer_add")->plug(m_toolbar);
    m_actions->action("printer_add_special")->plug(m_toolbar);
    m_toolbar->insertLineSeparator();
    m_actions->action("printer_state_change")->plug(m_toolbar);
    m_actions->action("printer_spool_change")->plug(m_toolbar);
    m_toolbar->insertSeparator();
    m_actions->action("printer_hard_default")->plug(m_toolbar);
    m_actions->action("printer_soft_default")->plug(m_toolbar);
    m_actions->action("printer_remove")->plug(m_toolbar);
    m_toolbar->insertSeparator();
    m_actions->action("printer_configure")->plug(m_toolbar);
    m_actions->action("printer_test")->plug(m_toolbar);
    m_actions->action("printer_tool")->plug(m_toolbar);
    m_pactionsindex = m_toolbar->insertSeparator();
    m_toolbar->insertLineSeparator();
    m_actions->action("server_restart")->plug(m_toolbar);
    m_actions->action("server_configure")->plug(m_toolbar);
    m_toolbar->insertLineSeparator();
    m_actions->action("manager_configure")->plug(m_toolbar);
    m_actions->action("view_refresh")->plug(m_toolbar);
    m_toolbar->insertLineSeparator();
    m_actions->action("view_printerinfos")->plug(m_toolbar);
    m_actions->action("view_change")->plug(m_toolbar);
    m_actions->action("orientation_change")->plug(m_toolbar);
    m_actions->action("view_pfilter")->plug(m_toolbar);

    // add actions to the menu bar
    QPopupMenu *menu = new QPopupMenu(this);
    m_actions->action("printer_add")->plug(menu);
    m_actions->action("printer_add_special")->plug(menu);
    // m_menubar->insertItem( i18n( "Add" ), menu );
    m_menubar->insertButton("wizard", 0, true, i18n("Add"));
    m_menubar->getButton(0)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("printer_state_change")->plug(menu);
    m_actions->action("printer_spool_change")->plug(menu);
    menu->insertSeparator();
    m_actions->action("printer_hard_default")->plug(menu);
    m_actions->action("printer_soft_default")->plug(menu);
    m_actions->action("printer_remove")->plug(menu);
    menu->insertSeparator();
    m_actions->action("printer_configure")->plug(menu);
    m_actions->action("printer_test")->plug(menu);
    m_actions->action("printer_tool")->plug(menu);
    menu->insertSeparator();
    // m_menubar->insertItem( i18n( "Printer" ), menu );
    m_menubar->insertButton("printer1", 1, true, i18n("Printer"));
    m_menubar->getButton(1)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("server_restart")->plug(menu);
    m_actions->action("server_configure")->plug(menu);
    // m_menubar->insertItem( i18n( "Server" ), menu );
    m_menubar->insertButton("misc", 2, true, i18n("Print Server"));
    m_menubar->getButton(2)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("manager_configure")->plug(menu);
    m_actions->action("view_refresh")->plug(menu);
    // m_menubar->insertItem( i18n( "Manager" ), menu );
    m_menubar->insertButton("kdeprint_configmgr", 3, true, i18n("Print Manager"));
    m_menubar->getButton(3)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("view_printerinfos")->plug(menu);
    m_actions->action("view_change")->plug(menu);
    m_actions->action("orientation_change")->plug(menu);
    m_actions->action("view_toolbar")->plug(menu);
    m_actions->action("view_menubar")->plug(menu);
    menu->insertSeparator();
    m_actions->action("view_pfilter")->plug(menu);
    // m_menubar->insertItem( i18n( "View" ), menu );
    m_menubar->insertButton("view_remove", 4, true, i18n("View"));
    m_menubar->getButton(4)->setPopup(menu, true);
    // m_menubar->setMinimumHeight( m_menubar->heightForWidth( 1000 ) );
    menu = new QPopupMenu(this);
    m_actions->action("invoke_help")->plug(menu);
    m_actions->action("invoke_web")->plug(menu);
    m_menubar->insertButton("help", 5, true, i18n("Documentation"));
    m_menubar->getButton(5)->setPopup(menu, true);

    loadPluginActions();
    slotPrinterSelected(QString::null);
}
示例#4
0
void KMJobViewer::initActions()
{
    // job actions
    KAction	*hact = new KAction(i18n("&Hold"),"stop",0,this,SLOT(slotHold()),actionCollection(),"job_hold");
    KAction	*ract = new KAction(i18n("&Resume"),"run",0,this,SLOT(slotResume()),actionCollection(),"job_resume");
    KAction	*dact = new KAction(i18n("Remo&ve"),"edittrash",Qt::Key_Delete,this,SLOT(slotRemove()),actionCollection(),"job_remove");
    KAction *sact = new KAction(i18n("Res&tart"),"redo",0,this,SLOT(slotRestart()),actionCollection(),"job_restart");
    KActionMenu *mact = new KActionMenu(i18n("&Move to Printer"),"fileprint",actionCollection(),"job_move");
    mact->setDelayed(false);
    connect(mact->popupMenu(),SIGNAL(activated(int)),SLOT(slotMove(int)));
    connect(mact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
    connect(mact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
    connect(mact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowMoveMenu()));
    KToggleAction	*tact = new KToggleAction(i18n("&Toggle Completed Jobs"),"history",0,actionCollection(),"view_completed");
    tact->setEnabled(m_manager->actions() & KMJob::ShowCompleted);
    connect(tact,SIGNAL(toggled(bool)),SLOT(slotShowCompleted(bool)));
    KToggleAction	*uact = new KToggleAction(i18n("Show Only User Jobs"), "personal", 0, actionCollection(), "view_user_jobs");
    uact->setCheckedState(KGuiItem(i18n("Hide Only User Jobs"),"personal"));
    connect(uact, SIGNAL(toggled(bool)), SLOT(slotUserOnly(bool)));
    m_userfield = new QLineEdit(0);
    m_userfield->setText(getenv("USER"));
    connect(m_userfield, SIGNAL(returnPressed()), SLOT(slotUserChanged()));
    connect(uact, SIGNAL(toggled(bool)), m_userfield, SLOT(setEnabled(bool)));
    m_userfield->setEnabled(false);
    m_userfield->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    KWidgetAction	*ufact = new KWidgetAction(m_userfield, i18n("User Name"), 0, 0, 0, actionCollection(), "view_username");

    if (!m_pop)
    {
        m_pop = new QPopupMenu(this);
        connect(m_pop,SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
        connect(m_pop,SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
        hact->plug(m_pop);
        ract->plug(m_pop);
        m_pop->insertSeparator();
        dact->plug(m_pop);
        mact->plug(m_pop);
        m_pop->insertSeparator();
        sact->plug(m_pop);
    }

    // Filter actions
    KActionMenu	*fact = new KActionMenu(i18n("&Select Printer"), "kdeprint_printer", actionCollection(), "filter_modify");
    fact->setDelayed(false);
    connect(fact->popupMenu(),SIGNAL(activated(int)),SLOT(slotPrinterSelected(int)));
    connect(fact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
    connect(fact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
    connect(fact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowPrinterMenu()));

    if (!m_standalone)
    {
        KToolBar	*toolbar = toolBar();
        hact->plug(toolbar);
        ract->plug(toolbar);
        toolbar->insertSeparator();
        dact->plug(toolbar);
        mact->plug(toolbar);
        toolbar->insertSeparator();
        sact->plug(toolbar);
        toolbar->insertSeparator();
        tact->plug(toolbar);
        uact->plug(toolbar);
        ufact->plug(toolbar);
    }
    else
    {   // stand-alone application
        KStdAction::quit(kapp,SLOT(quit()),actionCollection());
        KStdAction::close(this,SLOT(slotClose()),actionCollection());
        KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());

        // refresh action
        new KAction(i18n("Refresh"),"reload",0,this,SLOT(slotRefresh()),actionCollection(),"refresh");

        // create status bar
        KStatusBar	*statusbar = statusBar();
        m_stickybox = new QCheckBox( i18n( "Keep window permanent" ), statusbar );
        statusbar->addWidget( m_stickybox, 1, false );
        statusbar->insertItem(" " + i18n("Max.: %1").arg(i18n("Unlimited"))+ " ", 0, 0, true);
        statusbar->setItemFixed(0);
        updateStatusBar();

        createGUI();
    }

    loadPluginActions();
    slotSelectionChanged();
}