예제 #1
0
// public static
KShortcut kpTool::shortcutForKey (int key)
{
    KShortcut shortcut;

    if (key)
    {
        shortcut.append (KKeySequence (KKey (key)));
        // (CTRL+<key>, ALT+<key>, CTRL+ALT+<key>, CTRL+SHIFT+<key>
        //  all clash with global KDE shortcuts)
        shortcut.append (KKeySequence (KKey (Qt::ALT + Qt::SHIFT + key)));
    }

    return shortcut;
}
예제 #2
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();
}
예제 #3
0
/**
 * create the action events create the gui.
 */
void KJezzball::initXMLUI()
{
    m_newAction = KStdGameAction::gameNew( this, SLOT(newGame()), actionCollection() );
    // AB: originally KBounce/KJezzball used Space for new game - but Ctrl+N is
    // default. We solve this by providing space as an alternative key
    KShortcut s = m_newAction->shortcut();
    s.append(KKeySequence(QKeySequence(Key_Space)));
    m_newAction->setShortcut(s);

    KStdGameAction::quit(this, SLOT(close()), actionCollection() );
    KStdGameAction::highscores(this, SLOT(showHighscore()), actionCollection() );
    m_pauseButton = KStdGameAction::pause(this, SLOT(pauseGame()), actionCollection());
    KStdGameAction::end(this, SLOT(closeGame()), actionCollection());
    KStdGameAction::configureHighscores(this, SLOT(configureHighscores()),actionCollection());

    new KAction( i18n("&Select Background Folder..."), 0, this, SLOT(selectBackground()),
                       actionCollection(), "background_select" );
    m_backgroundShowAction =
        new KToggleAction( i18n("Show &Backgrounds"), 0, this, SLOT(showBackground()),
                           actionCollection(), "background_show" );
    m_backgroundShowAction->setCheckedState(i18n("Hide &Backgrounds"));
    m_backgroundShowAction->setEnabled( !m_backgroundDir.isEmpty() );
    m_backgroundShowAction->setChecked( m_showBackground );

    m_soundAction = new KToggleAction( i18n("&Play Sounds"), 0, 0, 0, actionCollection(), "toggle_sound");
}