void ActionManagerImpl::initTabWidget(TabWidget* tabWidget)
{
    if (d->tabWidget)
        return;
    else
        d->tabWidget = tabWidget;

    KActionCollection *coll = actionCollection();

    KAction *action = coll->addAction("select_next_tab");
    action->setText(i18n("Select Next Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotNextTab()));
    action->setShortcuts(KShortcut( "Ctrl+Period" ));

    action = coll->addAction("select_previous_tab");
    action->setText(i18n("Select Previous Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotPreviousTab()));
    action->setShortcuts(KShortcut( "Ctrl+Comma" ));

    action = coll->addAction("tab_detach");
    action->setIcon(KIcon("tab-detach"));
    action->setText(i18n("Detach Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotDetachTab()));
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_B));

    action = coll->addAction("tab_copylinkaddress");
    action->setText(i18n("Copy Link Address"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCopyLinkAddress()));

    action = coll->addAction("tab_remove");
    action->setIcon(KIcon("tab-close"));
    action->setText(i18n("Close Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCloseTab()));
    action->setShortcuts(KStandardShortcut::close());

    action = coll->addAction("inc_font_sizes");
    action->setIcon(KIcon("format-font-size-more"));
    action->setText(i18n("Enlarge Font"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomIn()));
    action->setShortcut( QKeySequence::ZoomIn );

    action = coll->addAction("dec_font_sizes");
    action->setIcon(KIcon("format-font-size-less"));
    action->setText(i18n("Shrink Font"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomOut()));
    action->setShortcut( QKeySequence::ZoomOut );

    QString actionname;
    for (int i=1;i<10;i++) {
      actionname.sprintf("activate_tab_%02d", i);
      action = new KAction( i18n("Activate Tab %1", i),this );
      action->setShortcut( QKeySequence( QString::fromLatin1( "Alt+%1" ).arg( i ) ) );
      coll->addAction( actionname, action );
      connect( action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotActivateTab()) );
    }


}
LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVariantList& args) :
    KCModule(EffectFactory::componentData(), parent, args)
{
    m_ui = new LookingGlassEffectConfigForm(this);

    QVBoxLayout* layout = new QVBoxLayout(this);

    layout->addWidget(m_ui);

    connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
    connect(m_ui->radiusSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));

    // Shortcut config. The shortcut belongs to the component "kwin"!
    m_actionCollection = new KActionCollection(this, KComponentData("kwin"));

    m_actionCollection->setConfigGroup("LookingGlass");
    m_actionCollection->setConfigGlobal(true);

    KAction* a;
    a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn));
    a->setProperty("isConfigurationAction", true);
    a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));

    a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomOut));
    a->setProperty("isConfigurationAction", true);
    a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));

    a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ActualSize));
    a->setProperty("isConfigurationAction", true);
    a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));

    m_ui->editor->addCollection(m_actionCollection);
}
Ejemplo n.º 3
0
MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList& args) :
    KCModule(EffectFactory::componentData(), parent, args)
{
    m_ui = new MouseMarkEffectConfigForm(this);

    m_ui->kcfg_LineWidth->setSuffix(ki18np(" pixel", " pixels"));

    QVBoxLayout* layout = new QVBoxLayout(this);

    layout->addWidget(m_ui);

    addConfig(MouseMarkConfig::self(), m_ui);

    // Shortcut config. The shortcut belongs to the component "kwin"!
    m_actionCollection = new KActionCollection(this, KComponentData("kwin"));

    KAction* a = static_cast< KAction* >(m_actionCollection->addAction("ClearMouseMarks"));
    a->setText(i18n("Clear Mouse Marks"));
    a->setProperty("isConfigurationAction", true);
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));

    a = static_cast< KAction* >(m_actionCollection->addAction("ClearLastMouseMark"));
    a->setText(i18n("Clear Last Mouse Mark"));
    a->setProperty("isConfigurationAction", true);
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));

    m_ui->editor->addCollection(m_actionCollection);

    load();
}
Ejemplo n.º 4
0
void WicdApplet::setupActions()
{
    KAction* preferencesAction = new KAction(KIcon("preferences-system-network"), i18n("Wicd Configuration"), this);
    preferencesAction->setShortcuts(KShortcut("Ctrl+P"));
    addAction("configure_wicd", preferencesAction);
    connect(preferencesAction, SIGNAL(triggered()), this, SLOT(showPreferences()));
    
    KAction* connectInfoAction = new KAction(KIcon("help-about"), i18n("Connection information"), this);
    addAction("connection_info", connectInfoAction);
    connect(connectInfoAction, SIGNAL(triggered()), this, SLOT(connectionInfoRequested()));

    KAction* createadhocAction = new KAction(KIcon("list-add"), i18n("Create an ad-hoc network"), this);
    createadhocAction->setShortcuts(KShortcut("Ctrl+A"));
    addAction("createadhoc", createadhocAction);
    connect(createadhocAction, SIGNAL(triggered()), this, SLOT(createAdhocDialog()));
    KAction* findnetworkAction = new KAction(KIcon("edit-find"), i18n("Find a hidden network"), this);
    findnetworkAction->setShortcuts(KShortcut("Ctrl+F"));
    addAction("findnetwork", findnetworkAction);
    connect(findnetworkAction, SIGNAL(triggered()), this, SLOT(findHiddenDialog()));
    KAction* rfkillAction = new KAction(i18n("RfKill"), this);
    rfkillAction->setShortcuts(KShortcut("Ctrl+K"));
    addAction("rfkill", rfkillAction);
    connect(rfkillAction, SIGNAL(triggered()), this, SLOT(rfkill()));
    
    KAction* reloadAction = new KAction(KIcon("view-refresh"), i18n("Reload"), this);
    reloadAction->setShortcuts(KShortcut("Ctrl+R"));
    addAction("reload", reloadAction);
    connect(reloadAction, SIGNAL(triggered()), this, SLOT(scan()));

}
Ejemplo n.º 5
0
void KGlobalShortcutTest::setupTest(QString id)
{
    if (m_actionA) {
        m_actionA->forgetGlobalShortcut();
        delete m_actionA;
    }

    if (m_actionB) {
        m_actionB->forgetGlobalShortcut();
        delete m_actionB;
    }

    // Ensure that the previous test did cleanup correctly
    KGlobalAccel *kga = KGlobalAccel::self();
    Q_UNUSED(kga);

    m_actionA = new KAction("Text For Action A", this);
    m_actionA->setObjectName("Action A:" + id);
    m_actionA->setGlobalShortcut(
            KShortcut(sequenceA, sequenceB),
            KAction::ActiveShortcut|KAction::DefaultShortcut,
            KAction::NoAutoloading);

    m_actionB = new KAction("Text For Action B", this);
    m_actionB->setObjectName("Action B:" + id);
    m_actionB->setGlobalShortcut(
            KShortcut(),
            KAction::ActiveShortcut|KAction::DefaultShortcut,
            KAction::NoAutoloading);

}
Ejemplo n.º 6
0
void KGlobalShortcutTest::testSaveRestore()
{
    setupTest("testSaveRestore");

    //It /would be nice/ to test persistent storage. That is not so easy...
    KShortcut cutA = m_actionA->globalShortcut();
    // Delete the action
    delete m_actionA;

    // Recreate it
    m_actionA = new KAction("Text For Action A", this);
    m_actionA->setObjectName("Action A:testSaveRestore");

    // Now it's empty
    QVERIFY(m_actionA->globalShortcut().isEmpty());

    m_actionA->setGlobalShortcut(KShortcut());
    // Now it's restored
    QCOMPARE(m_actionA->globalShortcut(), cutA);

    // And again
    delete m_actionA;
    m_actionA = new KAction("Text For Action A", this);
    m_actionA->setObjectName("Action A:testSaveRestore");
    m_actionA->setGlobalShortcut(KShortcut(QKeySequence(), cutA.primary()));
    QCOMPARE(m_actionA->globalShortcut(), cutA);

}
Ejemplo n.º 7
0
KGet_plug_in::KGet_plug_in( QObject* parent, const char* name )
    : Plugin( parent, name )
{
    QPixmap pix = KGlobal::iconLoader()->loadIcon("kget",
                                                  KIcon::MainToolbar);
    KActionMenu *menu = new KActionMenu( i18n("Download Manager"), pix,
                                         actionCollection(), "kget_menu" );
    menu->setDelayed( false );
    connect( menu->popupMenu(), SIGNAL( aboutToShow() ), SLOT( showPopup() ));

    m_paToggleDropTarget=new KToggleAction(i18n("Show Drop Target"),
                                           KShortcut(),
                                           this, SLOT(slotShowDrop()),
                                           actionCollection(), "show_drop" );

    menu->insert( m_paToggleDropTarget );

    KAction *action = new KAction(i18n("List All Links"), KShortcut(),
                                  this, SLOT( slotShowLinks() ),
                                  actionCollection(), "show_links");
    menu->insert( action );

    p_dcopServer= new DCOPClient();
    p_dcopServer->attach ();
}
Ejemplo n.º 8
0
MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList& args) :
        KCModule(EffectFactory::componentData(), parent, args)
    {
    m_ui = new MouseMarkEffectConfigForm(this);

    QVBoxLayout* layout = new QVBoxLayout(this);

    layout->addWidget(m_ui);

    connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
    connect(m_ui->spinWidth, SIGNAL(valueChanged(int)), this, SLOT(changed()));
    connect(m_ui->comboColors, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));

    // Shortcut config. The shortcut belongs to the component "kwin"!
    m_actionCollection = new KActionCollection( this, KComponentData("kwin") );

    KAction* a = static_cast< KAction* >( m_actionCollection->addAction( "ClearMouseMarks" ));
    a->setText( i18n( "Clear Mouse Marks" ));
    a->setProperty("isConfigurationAction", true);
    a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 ));

    a = static_cast< KAction* >( m_actionCollection->addAction( "ClearLastMouseMark" ));
    a->setText( i18n( "Clear Last Mouse Mark" ));
    a->setProperty("isConfigurationAction", true);
    a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F12 ));

    m_ui->editor->addCollection(m_actionCollection);

    load();
    }
Ejemplo n.º 9
0
/** Initialize the accelerator @p id by checking if it is overridden
    in the configuration file (and if it isn't, use the default).
    On X11, if QApplication was initialized with GUI disabled,
    the default will always be used.
*/
static void initialize(StandardShortcut id)
{
    KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);

    // All three are needed.
    if (info->id!=AccelNone) {
        Q_ASSERT(info->description);
        Q_ASSERT(info->translation_context);
        Q_ASSERT(info->name);
    }

    KConfigGroup cg(KGlobal::config(), "Shortcuts");

#ifdef Q_WS_X11
    // Code within this block breaks if we aren't running in GUI mode.
    if(QX11Info::display() && cg.hasKey(info->name))
#else
    if(cg.hasKey(info->name))
#endif
    {
        QString s = cg.readEntry(info->name);
        if (s != "none")
            info->cut = KShortcut(s);
        else
            info->cut = KShortcut();
    } else {
        info->cut = hardcodedDefaultShortcut(id);
    }

    info->isInitialized = true;
}
void ActionManagerImpl::initFrameManager(FrameManager* frameManager)
{
    if (d->frameManager)
        return;

    d->frameManager = frameManager;

    bool isRTL = QApplication::isRightToLeft();

    KToolBarPopupAction* forward = new KToolBarPopupAction(KIcon(isRTL ? "go-previous" : "go-next"), i18nc("Go forward in browser history", "Forward"), this);
    d->actionCollection->addAction("browser_forward", forward);
    forward->setShortcuts(KShortcut(isRTL ? "Alt+Left" : "Alt+Right"));
    connect(forward, SIGNAL(triggered()), frameManager, SLOT(slotBrowserForward()));

    connect(forward->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserForwardAboutToShow()));

    KToolBarPopupAction* back = new KToolBarPopupAction(KIcon(isRTL ? "go-next" : "go-previous"), i18nc("Go back in browser history", "Back"), this);
    d->actionCollection->addAction("browser_back", back);
    back->setShortcuts(KShortcut(isRTL ?  "Alt+Right" : "Alt+Left"));
    connect(back, SIGNAL(triggered()), frameManager, SLOT(slotBrowserBack()));

    connect(back->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserBackAboutToShow()));

    KAction *action = d->actionCollection->addAction("browser_reload");
    action->setIcon(KIcon("view-refresh"));
    action->setText(i18nc("Reload current page", "Reload"));
    connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserReload()));

    action = d->actionCollection->addAction("browser_stop");
    action->setIcon(KIcon("process-stop"));
    action->setText(i18n("Stop"));
    connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserStop()));
}
Ejemplo n.º 11
0
void KSlovar::registerButtons()
{
  m_newDictionary = new KAction(i18n("&New dictionary"), "filenew", KShortcut(KKey("CTRL+n")), this, SLOT(slotNewDictionary()), actionCollection(), "newDictionary");
  m_openDictionary = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
  m_quit = KStdAction::quit(kapp, SLOT(quit()), actionCollection());

  m_back=KStdAction::back(this, SLOT(slotPrevPhrase()), actionCollection());
  m_forward=KStdAction::forward(this, SLOT(slotNextPhrase()), actionCollection());
  m_home=KStdAction::home(this, SLOT(slotHome()), actionCollection());

  m_editDictionary = new KAction(i18n("&Edit dictionary"), "edit", KShortcut(KKey("CTRL+e")), this, SLOT(slotEditDictionary()), actionCollection(), "editDictionary");
  m_close=KStdAction::close(this, SLOT(slotClose()), actionCollection());

  m_find = KStdAction::find(this, SLOT(slotFind()), actionCollection());
  m_findNext = KStdAction::findNext(this, SLOT(slotFindNext()), actionCollection());
  m_literalSearch = new KToggleAction(i18n("&Literal search"), "filter", KShortcut(KKey("CTRL+l")), this, SLOT(slotToggleLiteral()), actionCollection(), "literalSearch");
  m_backSearch = new KToggleAction(i18n("Ba&ck search"), "previous", KShortcut(KKey("CTRL+b")), this, SLOT(slotToggleBack()), actionCollection(), "backSearch");

  m_print=KStdAction::print(this, SLOT(slotPrint()), actionCollection());
  m_selectAll=KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection());

  m_addPhrase=new KAction(i18n("&Add phrase"), "filenew", KShortcut(KKey("CTRL+a")), this, SLOT(slotAddPhrase()), actionCollection(), "addPhrase");
  m_editPhrase=new KAction(i18n("Edi&t phrase"), "edit", KShortcut(KKey("CTRL+t")), this, SLOT(slotEditPhrase()), actionCollection(), "editPhrase");
  m_removePhrase=new KAction(i18n("&Remove phrase"), "editdelete", KShortcut(KKey("Delete")), this, SLOT(slotRemovePhrase()), actionCollection(), "removePhrase");

  m_listPopup=new QPopupMenu;
  m_addPhrase->plug(m_listPopup);
  m_editPhrase->plug(m_listPopup);
  m_removePhrase->plug(m_listPopup);

  m_config = KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());
  m_conversion = new KAction(i18n("Edit &conversion table"), "conversion", this, SLOT(slotConversionTable()), actionCollection(), "editConversion");
  m_update = new KAction(i18n("Update &languages"), "ktalkd", KShortcut(KKey("")), this, SLOT(slotDownloadLanguage()), actionCollection(), "updateLanguages");
  m_wizard = new KAction(i18n("Run &First-time wizard"), "wizard", KShortcut(KKey("")), this, SLOT(slotFirstRunWizard()), actionCollection(), "firstRunWizard");
}
Ejemplo n.º 12
0
void DesktopCorona::init()
{
    setPreferredToolBoxPlugin(Plasma::Containment::DesktopContainment, "org.kde.desktoptoolbox");
    setPreferredToolBoxPlugin(Plasma::Containment::CustomContainment, "org.kde.desktoptoolbox");
    setPreferredToolBoxPlugin(Plasma::Containment::PanelContainment, "org.kde.paneltoolbox");
    setPreferredToolBoxPlugin(Plasma::Containment::CustomPanelContainment, "org.kde.paneltoolbox");

    kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "DesktopCorona init start" << "(line:" << __LINE__ << ")";
    Kephal::Screens *screens = Kephal::Screens::self();
    connect(screens, SIGNAL(screenAdded(Kephal::Screen*)), SLOT(screenAdded(Kephal::Screen*)));
    connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SIGNAL(availableScreenRegionChanged()));

    Plasma::ContainmentActionsPluginsConfig desktopPlugins;
    desktopPlugins.addPlugin(Qt::NoModifier, Qt::Vertical, "switchdesktop");
    desktopPlugins.addPlugin(Qt::NoModifier, Qt::MidButton, "paste");
    desktopPlugins.addPlugin(Qt::NoModifier, Qt::RightButton, "contextmenu");
    Plasma::ContainmentActionsPluginsConfig panelPlugins;
    panelPlugins.addPlugin(Qt::NoModifier, Qt::RightButton, "contextmenu");

    setContainmentActionsDefaults(Plasma::Containment::DesktopContainment, desktopPlugins);
    setContainmentActionsDefaults(Plasma::Containment::CustomContainment, desktopPlugins);
    setContainmentActionsDefaults(Plasma::Containment::PanelContainment, panelPlugins);
    setContainmentActionsDefaults(Plasma::Containment::CustomPanelContainment, panelPlugins);

    checkAddPanelAction();

    //why do these actions belong to plasmaapp?
    //because it makes the keyboard shortcuts work.
    KAction *action = new KAction(PlasmaApp::self());
    action->setText(i18n("Next Activity"));
    action->setObjectName( QLatin1String("Next Activity" )); // NO I18N
    action->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Tab));
    connect(action, SIGNAL(triggered()), this, SLOT(activateNextActivity()));

    action = new KAction(PlasmaApp::self());
    action->setText(i18n("Previous Activity"));
    action->setObjectName( QLatin1String("Previous Activity" )); // NO I18N
    action->setGlobalShortcut(KShortcut(Qt::META + Qt::SHIFT + Qt::Key_Tab));
    connect(action, SIGNAL(triggered()), this, SLOT(activatePreviousActivity()));

    connect(this, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)),
            this, SLOT(updateImmutability(Plasma::ImmutabilityType)));
    connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, SLOT(checkAddPanelAction(QStringList)));

    connect(m_activityController, SIGNAL(currentActivityChanged(QString)), this, SLOT(currentActivityChanged(QString)));
    connect(m_activityController, SIGNAL(activityAdded(QString)), this, SLOT(activityAdded(QString)));
    connect(m_activityController, SIGNAL(activityRemoved(QString)), this, SLOT(activityRemoved(QString)));

    mapAnimation(Plasma::Animator::AppearAnimation, Plasma::Animator::ZoomAnimation);
    mapAnimation(Plasma::Animator::DisappearAnimation, Plasma::Animator::ZoomAnimation);
    kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "DesktopCorona init end" << "(line:" << __LINE__ << ")";
}
Ejemplo n.º 13
0
KShortcut KAction::shortcut(ShortcutTypes type) const
{
    Q_ASSERT(type);

    if (type == DefaultShortcut) {
        QList<QKeySequence> shortcuts = property("defaultShortcuts").value<QList<QKeySequence> >();
        return KShortcut(shortcuts);
    }

    QKeySequence primary = shortcuts().value(0);
    QKeySequence secondary = shortcuts().value(1);
    return KShortcut(primary, secondary);
}
Ejemplo n.º 14
0
void KCompletionBase::useGlobalKeyBindings()
{
    if ( d->m_delegate ) {
        d->m_delegate->useGlobalKeyBindings();
        return;
    }
    
    d->m_keyMap.clear();
    d->m_keyMap.insert( TextCompletion, KShortcut() );
    d->m_keyMap.insert( PrevCompletionMatch, KShortcut() );
    d->m_keyMap.insert( NextCompletionMatch, KShortcut() );
    d->m_keyMap.insert( SubstringCompletion, KShortcut() );
}
Ejemplo n.º 15
0
    void GUI::setupActions()
    {
        KActionCollection* ac = actionCollection();
        KAction* new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac);
        new_action->setToolTip(i18n("Create a new torrent"));
        KAction* open_action = KStandardAction::open(this, SLOT(openTorrent()), ac);
        open_action->setToolTip(i18n("Open a torrent"));
        paste_action = KStandardAction::paste(this, SLOT(paste()), ac);

        open_silently_action = new KAction(KIcon(open_action->icon()), i18n("Open Silently"), this);
        open_silently_action->setToolTip(i18n("Open a torrent without asking any questions"));
        connect(open_silently_action, SIGNAL(triggered()), this, SLOT(openTorrentSilently()));
        ac->addAction("file_open_silently", open_silently_action);

        KStandardAction::quit(this, SLOT(quit()), ac);

        show_status_bar_action = KStandardAction::showStatusbar(this, SLOT(showStatusBar()), ac);
        show_status_bar_action->setIcon(KIcon("kt-show-statusbar"));

        show_menu_bar_action = KStandardAction::showMenubar(this, SLOT(showMenuBar()), ac);
        KStandardAction::preferences(this, SLOT(showPrefDialog()), ac);
        KStandardAction::keyBindings(this, SLOT(configureKeys()), ac);
        KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac);
        KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac);

        paste_url_action = new KAction(KIcon("document-open-remote"), i18n("Open URL"), this);
        paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported"));
        paste_url_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_P));
        connect(paste_url_action, SIGNAL(triggered()), this, SLOT(pasteURL()));
        ac->addAction("paste_url", paste_url_action);

        ipfilter_action = new KAction(KIcon("view-filter"), i18n("IP Filter"), this);
        ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses"));
        ipfilter_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_I));
        connect(ipfilter_action, SIGNAL(triggered()), this, SLOT(showIPFilter()));
        ac->addAction("ipfilter_action", ipfilter_action);

        import_action = new KAction(KIcon("document-import"), i18n("Import Torrent"), this);
        import_action->setToolTip(i18n("Import a torrent"));
        import_action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_I));
        connect(import_action, SIGNAL(triggered()), this, SLOT(import()));
        ac->addAction("import", import_action);

        show_kt_action = new KAction(KIcon("kt-show-hide"), i18n("Show/Hide KTorrent"), this);
        connect(show_kt_action, SIGNAL(triggered()), this, SLOT(showOrHide()));
        ac->addAction("show_kt", show_kt_action);
        show_kt_action->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_T));

        setStandardToolBarMenuEnabled(true);
    }
Ejemplo n.º 16
0
// backward compatibility
void Settings::read_settings_v1(KConfig &cfg_P)
{
    int sections = cfg_P.readNumEntry("Num_Sections", 0);
    Action_data_group *menuentries = NULL;
    for(Action_data_group::Iterator it(actions->first_child()); *it; ++it)
    {
        Action_data_group *tmp = dynamic_cast< Action_data_group * >(*it);
        if(tmp == NULL)
            continue;
        if(tmp->system_group() == Action_data_group::SYSTEM_MENUENTRIES)
        {
            menuentries = tmp;
            break;
        }
    }
    for(int sect = 1; sect <= sections; ++sect)
    {
        QString group = QString("Section%1").arg(sect);
        if(!cfg_P.hasGroup(group))
            continue;
        cfg_P.setGroup(group);
        QString name = cfg_P.readEntry("Name");
        if(name.isNull())
            continue;
        QString shortcut = cfg_P.readEntry("Shortcut");
        if(shortcut.isNull())
            continue;
        QString run = cfg_P.readEntry("Run");
        if(run.isNull())
            continue;
        bool menuentry = cfg_P.readBoolEntry("MenuEntry", false);
        // CHECKME tohle pridavani az pak je trosku HACK
        if(menuentry)
        {
            if(menuentries == NULL)
            {
                menuentries =
                    new Action_data_group(actions, i18n(MENU_EDITOR_ENTRIES_GROUP_NAME), i18n("These entries were created using Menu Editor."), NULL,
                                          Action_data_group::SYSTEM_MENUENTRIES, true);
                menuentries->set_conditions(new Condition_list("", menuentries));
            }
            (void)new Menuentry_shortcut_action_data(menuentries, name, "", KShortcut(shortcut), run);
        }
        else
        {
            (void)new Command_url_shortcut_action_data(actions, name, "", KShortcut(shortcut), run);
        }
    }
}
KisHSVAdjustmentFilter::KisHSVAdjustmentFilter()
        : KisColorTransformationFilter(id(), categoryAdjust(), i18n("&HSV Adjustment..."))
{
    setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)));
    setSupportsPainting(true);
    setSupportsIncrementalPainting(false);
}
Ejemplo n.º 18
0
void KKeyChooser::readGlobalKeys(QMap< QString, KShortcut > &map)
{
    QMap< QString, QString > mapEntry = KGlobal::config()->entryMap("Global Shortcuts");
    QMap< QString, QString >::Iterator it(mapEntry.begin());
    for(uint i = 0; it != mapEntry.end(); ++it, i++)
        map[it.key()] = KShortcut(*it);
}
Ejemplo n.º 19
0
void K3bDataFileView::setupActions()
{
  m_actionCollection = new KActionCollection( this );

  m_actionProperties = new KAction( i18n("Properties"), "misc", 0, this, SLOT(slotProperties()),
				    actionCollection(), "properties" );
  m_actionNewDir = new KAction( i18n("New Directory..."), "folder_new", CTRL+Key_N, this, SLOT(slotNewDir()),
				actionCollection(), "new_dir" );
  m_actionRemove = new KAction( i18n("Remove"), "editdelete", Key_Delete, this, SLOT(slotRemoveItem()),
				actionCollection(), "remove" );
  KShortcut renameShortCut( Key_F2 );
  renameShortCut.append( KShortcut(CTRL+Key_R) ); // backwards compatibility
  m_actionRename = new KAction( i18n("Rename"), "edit", renameShortCut, this, SLOT(slotRenameItem()),
				actionCollection(), "rename" );
  m_actionParentDir = new KAction( i18n("Parent Directory"), "up", 0, this, SLOT(slotParentDir()),
				   actionCollection(), "parent_dir" );
  m_actionOpen = new KAction( i18n("Open"), "fileopen", 0, this, SLOT(slotOpen()),
				   actionCollection(), "open" );

  m_popupMenu = new KActionMenu( m_actionCollection, "contextMenu" );
  m_popupMenu->insert( m_actionParentDir );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionRename );
  m_popupMenu->insert( m_actionRemove );
  m_popupMenu->insert( m_actionNewDir );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionOpen );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionProperties );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_view->actionCollection()->action("project_burn") );
}
void ActionManagerImpl::initArticleListView(ArticleListView* articleList)
{
    if (d->articleList)
        return;
    else
        d->articleList = articleList;

    KAction *action = actionCollection()->addAction("go_previous_article");
    action->setText(i18n("&Previous Article"));
    connect(action, SIGNAL(triggered(bool)), articleList, SLOT(slotPreviousArticle()));
    action->setShortcuts(KShortcut( "Left" ));
    action = actionCollection()->addAction("go_next_article");
    action->setText(i18n("&Next Article"));
    connect(action, SIGNAL(triggered(bool)), articleList, SLOT(slotNextArticle()));
    action->setShortcuts(KShortcut( "Right" ));
}
Ejemplo n.º 21
0
QuickButton::QuickButton(const QString &u, KAction *configAction, QWidget *parent, const char *name)
    : SimpleButton(parent, name), m_flashCounter(0), m_sticky(false)
{
    installEventFilter(KickerTip::the());
    setMouseTracking(true);
    _highlight = false;
    _oldCursor = cursor();
    _qurl = new QuickURL(u);

    QToolTip::add(this, _qurl->name());
    resize(int(DEFAULT_ICON_DIM), int(DEFAULT_ICON_DIM));
    QBrush bgbrush(colorGroup().brush(QColorGroup::Background));

    QuickAddAppsMenu *addAppsMenu = new QuickAddAppsMenu(parent, this, _qurl->url());
    _popup = new QPopupMenu(this);
    _popup->insertItem(i18n("Add Application"), addAppsMenu);
    configAction->plug(_popup);
    _popup->insertSeparator();
    _popup->insertItem(SmallIcon("remove"), i18n("Remove"), this, SLOT(removeApp()));

    m_stickyAction = new KToggleAction(i18n("Never Remove Automatically"), KShortcut(), this);
    connect(m_stickyAction, SIGNAL(toggled(bool)), this, SLOT(slotStickyToggled(bool)));
    m_stickyAction->plug(_popup, 2);
    m_stickyId = _popup->idAt(2);

    connect(this, SIGNAL(clicked()), SLOT(launch()));
    connect(this, SIGNAL(removeApp(QuickButton *)), parent, SLOT(removeAppManually(QuickButton *)));
}
Ejemplo n.º 22
0
void ShortcutDialog::accept()
{
    for(int i = 0;; ++i)
    {
        KKeySequence seq = shortcut().seq(i);
        if(seq.isNull())
            break;
        if(seq.key(0) == Key_Escape)
        {
            reject();
            return;
        }
        if(seq.key(0) == Key_Space)
        { // clear
            setShortcut(KShortcut());
            KShortcutDialog::accept();
            return;
        }
        if(seq.key(0).modFlags() == 0)
        { // no shortcuts without modifiers
            KShortcut cut = shortcut();
            cut.setSeq(i, KKeySequence());
            setShortcut(cut);
            return;
        }
    }
    KShortcutDialog::accept();
}
Ejemplo n.º 23
0
KScriptAction::KScriptAction( const QString &scriptDesktopFile, QObject *interface, KActionCollection *ac )
    : QObject(interface), KScriptClientInterface( )
{
    m_interface = 0L;
    m_action = 0L;
    m_isValid = false;
    m_refs = 0;
    // Read the desktop file
    if(KDesktopFile::isDesktopFile(scriptDesktopFile))
    {
        KDesktopFile desktop(scriptDesktopFile, true);
        QFileInfo scriptPath(scriptDesktopFile);
        
        m_scriptFile = scriptPath.dirPath(true) + "/" + desktop.readEntry("X-KDE-ScriptName", "");
        m_scriptName = desktop.readName();
        m_scriptType = desktop.readType();
        QString scriptTypeQuery = "([X-KDE-Script-Runner] == '" + m_scriptType + "')";
	KTrader::OfferList offers = KTrader::self()->query( "KScriptRunner/KScriptRunner", scriptTypeQuery );
        if ( !offers.isEmpty() )
        {
            m_action = new KAction(m_scriptName, KShortcut(), this, SLOT(activate()), ac, "script");
            m_isValid = true;
            m_timeout = new QTimer(this);
            QString icon = desktop.readIcon();
            m_action->setStatusText(desktop.readComment());
                if( !icon.isEmpty() ) 
                    m_action->setIcon(icon);
            m_action->setShortcutConfigurable(true);
            connect( m_timeout, SIGNAL(timeout()), SLOT(cleanup()) );
        }
    }
}
Ejemplo n.º 24
0
KShortcut hardcodedDefaultShortcut(StandardShortcut id)
{
    KShortcut cut;
    KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);

    return KShortcut(info->cutDefault, info->cutDefault2);
}
Ejemplo n.º 25
0
void WelcomePageView::disablePredefinedActions()
{
    KAction* const findAction = qobject_cast<KAction*>(actionCollection()->action("find"));

    if (findAction)
    {
        findAction->setShortcut(KShortcut());
    }
    else
    {
        kDebug() << "failed to remove the shortcut of khtml's find action";
    }

    KAction* const findNextAction = qobject_cast<KAction*>(actionCollection()->action("findNext"));

    if (findNextAction)
    {
        findNextAction->setShortcut(KShortcut());
    }
    else
    {
        kDebug() << "failed to remove the shortcut of khtml's findNext action";
    }

    KAction* const findPreviousAction = qobject_cast<KAction*>(actionCollection()->action("findPrevious"));

    if (findPreviousAction)
    {
        findPreviousAction->setShortcut(KShortcut());
    }
    else
    {
        kDebug() << "failed to remove the shortcut of khtml's findPrevious action";
    }

    KAction* const selectAllAction = qobject_cast<KAction*>(actionCollection()->action("selectAll"));

    if (selectAllAction)
    {
        selectAllAction->setShortcut(KShortcut());
    }
    else
    {
        kDebug() << "failed to remove the shortcut of khtml's selectAll action";
    }
}
Ejemplo n.º 26
0
MouseMarkEffect::MouseMarkEffect()
{
    KActionCollection* actionCollection = new KActionCollection(this);
    KAction* a = static_cast< KAction* >(actionCollection->addAction("ClearMouseMarks"));
    a->setText(i18n("Clear All Mouse Marks"));
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
    a = static_cast< KAction* >(actionCollection->addAction("ClearLastMouseMark"));
    a->setText(i18n("Clear Last Mouse Mark"));
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));
    connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
            this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
    reconfigure(ReconfigureAll);
    arrow_start = NULL_POINT;
    effects->startMousePolling(); // We require it to detect activation as well
}
void RKCommandEditorWindowPart::initializeActions () {
	RK_TRACE (COMMANDEDITOR);

	runAll = new KAction (i18n ("Run all"), QIconSet (RKCommonFunctions::getRKWardDataDir () + "icons/run_all.png"), KShortcut ("F9"), command_editor, SLOT (runAll()), actionCollection (), "run_all");
	runSelection = new KAction (i18n ("Run selection"), QIconSet (RKCommonFunctions::getRKWardDataDir () + "icons/run_selection.png"), KShortcut ("F8"), command_editor, SLOT (runSelection()), actionCollection (), "run_selection");
	runLine = new KAction (i18n ("Run current line"), QIconSet (RKCommonFunctions::getRKWardDataDir () + "icons/run_line.png"), KShortcut ("Ctrl+L"), command_editor, SLOT (runLine()), actionCollection (), "run_line");

	helpFunction = new KAction (i18n ("&Function reference"), KShortcut ("F2"), command_editor, SLOT (showHelp()), actionCollection (), "function_reference");
}
Ejemplo n.º 28
0
void BoxContainerItem::fillKPopupMenu(KPopupMenu *popupMenu, KActionCollection *actions) const
{
    /*popupMenu->insertItem( i18n( "&Configure" ), this, SLOT( slotConfigure() ) );
    popupMenu->insertItem( i18n( "&Recheck" ), this, SLOT( slotRecheck() ) );
    popupMenu->insertItem( i18n( "R&eset Counter" ), this, SLOT( slotReset() ) );
    popupMenu->insertItem( i18n( "&View Emails" ), this, SLOT( slotView() ) );
    popupMenu->insertItem( i18n( "R&un Command" ), this, SLOT( slotRunCommand() ) );*/

    (new KAction(i18n("&Configure"),     KShortcut(), this, SLOT(slotConfigure()), actions))->plug(popupMenu);
    (new KAction(i18n("&Recheck"),       KShortcut(), this, SLOT(slotRecheck()), actions))->plug(popupMenu);
    (new KAction(i18n("R&eset Counter"), KShortcut(), this, SLOT(slotReset()), actions))->plug(popupMenu);
    (new KAction(i18n("&View Emails"),   KShortcut(), this, SLOT(slotView()), actions))->plug(popupMenu);
    (new KAction(i18n("R&un Command"),   KShortcut(), this, SLOT(slotRunCommand()), actions))->plug(popupMenu);
    popupMenu->insertSeparator();
    KStdAction::help(this, SLOT(help()), actions)->plug(popupMenu);
    KStdAction::reportBug(this, SLOT(reportBug()), actions)->plug(popupMenu);
    KStdAction::aboutApp(this, SLOT(about()), actions)->plug(popupMenu);
}
Ejemplo n.º 29
0
void MainWindow::addGlobalShortcut(QKeySequence shortcut,
                                   QObject *object,
                                   const char *slot,
                                   QString name) {
    KAction *action = new KAction(name, this);
    action->setObjectName(name);
    action->setGlobalShortcut(KShortcut(shortcut), KAction::ActiveShortcut, KAction::Autoloading);
    QObject::connect(action, SIGNAL(triggered()), object, slot);
}
Ejemplo n.º 30
0
ThumbnailAsideEffect::ThumbnailAsideEffect()
    {
    KActionCollection* actionCollection = new KActionCollection( this );
    KAction* a = (KAction*)actionCollection->addAction( "ToggleCurrentThumbnail" );
    a->setText( i18n("Toggle Thumbnail for Current Window" ));
    a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail()));
    reconfigure( ReconfigureAll );
    }