Exemple #1
0
void ShowFoto::setupActions()
{
    Digikam::ThemeManager::instance()->setThemeMenuAction(new QMenu(i18n("&Themes"), this));
    setupStandardActions();

    // Extra 'File' menu actions ---------------------------------------------

    d->fileOpenAction = buildStdAction(StdOpenAction, this, SLOT(slotOpenFile()), this);
    actionCollection()->addAction(QLatin1String("showfoto_open_file"), d->fileOpenAction);

    d->openFilesInFolderAction = new QAction(QIcon::fromTheme(QLatin1String("folder-pictures")), i18n("Open folder"), this);
    actionCollection()->setDefaultShortcut(d->openFilesInFolderAction, Qt::CTRL+Qt::SHIFT+Qt::Key_O);

    connect(d->openFilesInFolderAction, &QAction::triggered,
            this, &ShowFoto::slotOpenFilesInFolder);

    actionCollection()->addAction(QLatin1String("showfoto_open_folder"), d->openFilesInFolderAction);

    QAction* const quit = buildStdAction(StdQuitAction, this, SLOT(close()), this);
    actionCollection()->addAction(QLatin1String("showfoto_quit"), quit);

    // -- Standard 'Help' menu actions ---------------------------------------------

    createHelpActions(false);
}
void QueueMgrWindow::setupActions()
{
    // -- Standard 'File' menu actions ---------------------------------------------

    KActionCollection* const ac = actionCollection();

    d->runAction = new QAction(QIcon::fromTheme(QLatin1String("media-playback-start")), i18n("Run"), this);
    d->runAction->setEnabled(false);
    connect(d->runAction, SIGNAL(triggered()), this, SLOT(slotRun()));
    ac->addAction(QLatin1String("queuemgr_run"), d->runAction);
    ac->setDefaultShortcut(d->runAction, Qt::CTRL + Qt::Key_P);

    d->stopAction = new QAction(QIcon::fromTheme(QLatin1String("media-playback-stop")), i18n("Stop"), this);
    d->stopAction->setEnabled(false);
    connect(d->stopAction, SIGNAL(triggered()), this, SLOT(slotStop()));
    ac->addAction(QLatin1String("queuemgr_stop"), d->stopAction);
    ac->setDefaultShortcut(d->stopAction, Qt::CTRL + Qt::Key_S);

    d->newQueueAction = new QAction(QIcon::fromTheme(QLatin1String("bqm-addqueue")), i18n("New Queue"), this);
    connect(d->newQueueAction, SIGNAL(triggered()), d->queuePool, SLOT(slotAddQueue()));
    ac->addAction(QLatin1String("queuemgr_newqueue"), d->newQueueAction);

    d->removeQueueAction = new QAction(QIcon::fromTheme(QLatin1String("bqm-rmqueue")), i18n("Remove Queue"), this);
    connect(d->removeQueueAction, SIGNAL(triggered()), d->queuePool, SLOT(slotRemoveCurrentQueue()));
    ac->addAction(QLatin1String("queuemgr_removequeue"), d->removeQueueAction);

    // TODO rename action to saveWorkflowAction to avoid confusion?
    d->saveQueueAction = new QAction(QIcon::fromTheme(QLatin1String("document-save")), i18n("Save Workflow"), this);
    connect(d->saveQueueAction, SIGNAL(triggered()), this, SLOT(slotSaveWorkflow()));
    ac->addAction(QLatin1String("queuemgr_savequeue"), d->saveQueueAction);

    d->removeItemsSelAction = new QAction(QIcon::fromTheme(QLatin1String("list-remove")), i18n("Remove items"), this);
    d->removeItemsSelAction->setEnabled(false);
    connect(d->removeItemsSelAction, SIGNAL(triggered()), d->queuePool, SLOT(slotRemoveSelectedItems()));
    ac->addAction(QLatin1String("queuemgr_removeitemssel"), d->removeItemsSelAction);
    ac->setDefaultShortcut(d->removeItemsSelAction, Qt::CTRL + Qt::Key_K);

    d->removeItemsDoneAction = new QAction(i18n("Remove processed items"), this);
    d->removeItemsDoneAction->setEnabled(false);
    connect(d->removeItemsDoneAction, SIGNAL(triggered()), d->queuePool, SLOT(slotRemoveItemsDone()));
    ac->addAction(QLatin1String("queuemgr_removeitemsdone"), d->removeItemsDoneAction);

    d->clearQueueAction = new QAction(QIcon::fromTheme(QLatin1String("edit-clear")), i18n("Clear Queue"), this);
    d->clearQueueAction->setEnabled(false);
    connect(d->clearQueueAction, SIGNAL(triggered()), d->queuePool, SLOT(slotClearList()));
    ac->addAction(QLatin1String("queuemgr_clearlist"), d->clearQueueAction);
    ac->setDefaultShortcut(d->clearQueueAction, Qt::CTRL + Qt::SHIFT + Qt::Key_K);

    QAction* const close = buildStdAction(StdCloseAction, this, SLOT(close()), this);
    ac->addAction(QLatin1String("queuemgr_close"), close);

    // -- 'Tools' menu actions -----------------------------------------------------

    d->moveUpToolAction = new QAction(QIcon::fromTheme(QLatin1String("bqm-commit")), i18n("Move up"), this);
    connect(d->moveUpToolAction, SIGNAL(triggered()), d->assignedList, SLOT(slotMoveCurrentToolUp()));
    ac->addAction(QLatin1String("queuemgr_toolup"), d->moveUpToolAction);

    d->moveDownToolAction = new QAction(QIcon::fromTheme(QLatin1String("bqm-update")), i18n("Move down"), this);
    connect(d->moveDownToolAction, SIGNAL(triggered()), d->assignedList, SLOT(slotMoveCurrentToolDown()));
    ac->addAction(QLatin1String("queuemgr_tooldown"), d->moveDownToolAction);

    d->removeToolAction = new QAction(QIcon::fromTheme(QLatin1String("bqm-remove")), i18n("Remove tool"), this);
    connect(d->removeToolAction, SIGNAL(triggered()), d->assignedList, SLOT(slotRemoveCurrentTool()));
    ac->addAction(QLatin1String("queuemgr_toolremove"), d->removeToolAction);

    d->clearToolsAction = new QAction(QIcon::fromTheme(QLatin1String("edit-clear-list")), i18n("Clear List"), this);
    connect(d->clearToolsAction, SIGNAL(triggered()), d->assignedList, SLOT(slotClearToolsList()));
    ac->addAction(QLatin1String("queuemgr_toolsclear"), d->clearToolsAction);

    // -- Standard 'View' menu actions ---------------------------------------------

    createFullScreenAction(QLatin1String("queuemgr_fullscreen"));

    // -- Standard 'Configure' menu actions ----------------------------------------

    createSettingsActions();

    // ---------------------------------------------------------------------------------

    ThemeManager::instance()->registerThemeActions(this);

    // -- Standard 'Help' menu actions ---------------------------------------------

    createHelpActions();
        
    // Provides a menu entry that allows showing/hiding the toolbar(s)
    setStandardToolBarMenuEnabled(true);

    // Provides a menu entry that allows showing/hiding the statusbar
    createStandardStatusBarAction();

    // ---------------------------------------------------------------------------------

    createGUI(xmlFile());

    showMenuBarAction()->setChecked(!menuBar()->isHidden());  // NOTE: workaround for bug #171080
}