Beispiel #1
0
void BasicTab::slotCapturedShortcut(const KShortcut &cut)
{
    if(signalsBlocked())
        return;

    if(KKeyChooser::checkGlobalShortcutsConflict(cut, true, topLevelWidget())
       || KKeyChooser::checkStandardShortcutsConflict(cut, true, topLevelWidget()))
        return;

    if(KHotKeys::present())
    {
        if(!_menuEntryInfo->isShortcutAvailable(cut))
        {
            KService::Ptr service;
            emit findServiceShortcut(cut, service);
            if(!service)
                service = KHotKeys::findMenuEntry(cut.toString());
            if(service)
            {
                KMessageBox::sorry(this, i18n("<qt>The key <b>%1</b> can not be used here because it is already used to activate <b>%2</b>.")
                                             .arg(cut.toString(), service->name()));
                return;
            }
            else
            {
                KMessageBox::sorry(this, i18n("<qt>The key <b>%1</b> can not be used here because it is already in use.").arg(cut.toString()));
                return;
            }
        }
        _menuEntryInfo->setShortcut(cut);
    }
    _keyEdit->setShortcut(cut, false);
    if(_menuEntryInfo)
        emit changed(_menuEntryInfo);
}
Beispiel #2
0
// public static
bool kpTool::containsSingleKeyTrigger (const KShortcut &shortcut,
    KShortcut *shortcutWithoutSingleKeyTriggers)
{
    if (shortcutWithoutSingleKeyTriggers)
        *shortcutWithoutSingleKeyTriggers = shortcut;


    KShortcut newShortcut;
    bool needNewShortcut = false;

    for (int i = 0; i < (int) shortcut.count (); i++)
    {
        const KKeySequence seq = shortcut.seq (i);

        if (containsSingleKeyTrigger (seq))
        {
            needNewShortcut = true;
        }
        else
        {
            newShortcut.append (seq);
        }
    }


    if (needNewShortcut && shortcutWithoutSingleKeyTriggers)
        *shortcutWithoutSingleKeyTriggers = newShortcut;

    return needNewShortcut;
}
Beispiel #3
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();
}
Beispiel #4
0
void KKeyChooser::setShortcut(const KShortcut &cut)
{
    kdDebug(125) << "KKeyChooser::setShortcut( " << cut.toString() << " )" << endl;
    KKeyChooserItem *pItem = dynamic_cast< KKeyChooserItem * >(d->pList->currentItem());
    if(!pItem)
        return;

    for(uint i = 0; i < cut.count(); i++)
    {
        const KKeySequence &seq = cut.seq(i);
        const KKey &key = seq.key(0);

        if(!d->bAllowLetterShortcuts && key.modFlags() == 0 && key.sym() < 0x3000 && QChar(key.sym()).isLetterOrNumber())
        {
            QString s = i18n(
                            "In order to use the '%1' key as a shortcut, "
                            "it must be combined with the "
                            "Win, Alt, Ctrl, and/or Shift keys.")
                            .arg(QChar(key.sym()));
            KMessageBox::sorry(this, s, i18n("Invalid Shortcut Key"));
            return;
        }
    }

    // If key isn't already in use,
    if(!isKeyPresent(cut))
    {
        // Set new key code
        pItem->setShortcut(cut);
        // Update display
        updateButtons();
        emit keyChange();
    }
}
Beispiel #5
0
bool KKeyChooser::isKeyPresentLocally(const KShortcut &cut, KKeyChooserItem *ignoreItem, bool bWarnUser)
{
    if(cut.toString().isEmpty())
        return false;
    // Search for shortcut conflicts with other actions in the
    //  lists we're configuring.
    for(QListViewItemIterator it(d->pList); it.current(); ++it)
    {
        KKeyChooserItem *pItem2 = dynamic_cast< KKeyChooserItem * >(it.current());
        if(pItem2 && pItem2 != ignoreItem)
        {
            int iSeq = keyConflict(cut, pItem2->shortcut());
            if(iSeq > -1)
            {
                if(bWarnUser)
                {
                    if(!promptForReassign(cut.seq(iSeq), pItem2->text(0), Application, this))
                        return true;
                    // else remove the shortcut from it
                    KShortcut cut2 = pItem2->shortcut();
                    removeFromShortcut(cut2, cut);
                    pItem2->setShortcut(cut2);
                    updateButtons();
                    emit keyChange();
                }
            }
        }
    }
    return false;
}
Beispiel #6
0
void KShortcutsEditorDelegate::stealShortcut(
    const QKeySequence &seq,
    KAction *action)
{
    QTreeWidget *view = static_cast<QTreeWidget *>(parent());

    // Iterate over all items
    QTreeWidgetItemIterator it(view, QTreeWidgetItemIterator::NoChildren);

    for (; (*it); ++it) {
        KShortcutsEditorItem* item = dynamic_cast<KShortcutsEditorItem *>(*it);
        if (item && item->data(0, ObjectRole).value<QObject*>() == action) {

            // We found the action, snapshot the current state. Steal the
            // shortcut. We will save the change later.
            KShortcut cut = action->shortcut();
            if (   cut.primary().matches(seq) != QKeySequence::NoMatch
                || seq.matches(cut.primary()) != QKeySequence::NoMatch) {
                item->setKeySequence(LocalPrimary, QKeySequence());
            }

            if (   cut.alternate().matches(seq) != QKeySequence::NoMatch
                || seq.matches(cut.alternate()) != QKeySequence::NoMatch) {
                item->setKeySequence(LocalAlternate, QKeySequence());
            }
            break;
        }
    }

}
Beispiel #7
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);

}
Beispiel #8
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");
}
Beispiel #9
0
// Returns iSeq index if cut2 has a sequence of equal or higher priority to a sequence in cut.
// else -1
static int keyConflict(const KShortcut &cut, const KShortcut &cut2)
{
    for(uint iSeq = 0; iSeq < cut.count(); iSeq++)
    {
        for(uint iSeq2 = 0; iSeq2 < cut2.count(); iSeq2++)
        {
            if(cut.seq(iSeq) == cut2.seq(iSeq2))
                return iSeq;
        }
    }
    return -1;
}
Beispiel #10
0
void starter::addShortcut(const KShortcut &cut)
{
   // in case of empty shortcut, remove the entry from the list and return
   if (!short(cut.keyCodeQt()))
   {
      ShortcutList::Iterator it;
      for ( it = shortcutList.begin(); it != shortcutList.end(); ++it )
         if (it.data() == configDialog->categoryList->currentText())
         {
            shortcutList.remove(it);
            break;
         }
      configDialog->buttonShortcut->setShortcut(KShortcut::null(), false);
      return;
   }
   // generate MyKey
   short state = 0;
   if (cut.seq(0).key(0).modFlags() & KKey::CTRL)
      state |= Qt::ControlButton;
   if (cut.seq(0).key(0).modFlags() & KKey::ALT)
      state |= Qt::AltButton;
   if (cut.seq(0).key(0).modFlags() & KKey::SHIFT)
      state |= Qt::ShiftButton;
   MyKey key(cut.seq(0).keyCodeQt(), state);
   // Test if this is a valid shotrcut, i.e. contains 'ctrl' or 'alt', returns iff not
   if (!(state & Qt::ControlButton || state & Qt::AltButton))
   {
      KMessageBox::sorry(this, i18n("<qt>To ensure usefull behaviour of the searchline, the shortcut <b>must contain</b> a metabutton, i.e. <b>'ctrl' and/or 'alt'</b></qt>"), i18n("Sorry, invalid Shortcut"));
      return;
   }
   // test if the cut was allready bound to another category and ask the user whta to do (return iff not rebind)
   ShortcutList::Iterator it = shortcutList.find(key);
   if ((it != shortcutList.end() && KMessageBox::questionYesNo(this, i18n("<qt>The selected shortcut is allready bound to the category \"%1\".<br>Do you want to <b>rebind</b> it?</qt>").arg(it.data()), i18n("Rebind Shortcut?")) == KMessageBox::No))
      return;
   // if rebind (it is not end and we did not return ;) remove the old shortcut
   if (it != shortcutList.end())
   {
      shortcutList.remove(it);
   }
   // test if another shortcut is bound to this category and remove it in case
   for ( it = shortcutList.begin(); it != shortcutList.end(); ++it )
      if (it.data() == configDialog->categoryList->currentText())
      {
         shortcutList.remove(it);
         break;
      }
   // add new shortcut/category map entry
   shortcutList[key] = configDialog->categoryList->currentText();
   // update UI
   configDialog->buttonShortcut->setShortcut(cut, false);
}
Beispiel #11
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;
}
Beispiel #12
0
// public static
QString kpTool::toolTipForTextAndShortcut (const QString &text,
                                           const KShortcut &shortcut)
{
    for (int i = 0; i < (int) shortcut.count (); i++)
    {
        const KKeySequence seq = shortcut.seq (i);
        if (seq.count () == 1 && containsSingleKeyTrigger (seq))
        {
            return i18n ("<Tool Name> (<Single Accel Key>)",
                         "%1 (%2)")
                       .arg (text, seq.toString ());
        }
    }

    return text;
}
Beispiel #13
0
void KKeyChooser::capturedShortcut(const KShortcut &cut)
{
    if(cut.isNull())
        slotNoKey();
    else
        setShortcut(cut);
}
Beispiel #14
0
KShortcut shortcutDefault3(StdAccel id)
{
    KShortcut cut;

    KStdAccelInfo *pInfo = infoPtr(id);
    if(pInfo)
    {
        if(pInfo->cutDefault)
            cut.init(pInfo->cutDefault);
        // FIXME: if there is no cutDefault, then this we be made the primary
        //  instead of alternate shortcut.
        if(pInfo->cutDefault3B)
            cut.append(KKey(pInfo->cutDefault3B));
    }

    return cut;
}
Beispiel #15
0
QString KKeyChooserItem::text(int iCol) const
{
    if(iCol == 0)
    {
        // Quick HACK to get rid of '&'s.
        QString s = m_pList->label(m_iAction);
        QString s2;
        for(uint i = 0; i < s.length(); i++)
            if(s[i] != '&' || (i + 1 < s.length() && s[i + 1] == '&'))
                s2 += s[i];
        return s2;
    }
    else if(iCol <= (int)m_cut.count())
        return m_cut.seq(iCol - 1).toString();
    else
        return QString::null;
}
Beispiel #16
0
void KAction::initPrivate( const QString& text, const KShortcut& cut,
                  const QObject* receiver, const char* slot )
{
    d->m_cutDefault = cut;

    m_parentCollection = dynamic_cast<KActionCollection *>( parent() );
    kdDebug(129) << "KAction::initPrivate(): this = " << this << " name = \"" << name() << "\" cut = " << cut.toStringInternal() << " m_parentCollection = " << m_parentCollection << endl;
    if ( m_parentCollection )
        m_parentCollection->insert( this );

    if ( receiver && slot )
        connect( this, SIGNAL( activated() ), receiver, slot );

    if( !cut.isNull() && !qstrcmp( name(), "unnamed" ) )
        kdWarning(129) << "KAction::initPrivate(): trying to assign a shortcut (" << cut.toStringInternal() << ") to an unnamed action." << endl;
    d->setText( text );
    initShortcut( cut );
}
Beispiel #17
0
bool KKeyChooser::checkStandardShortcutsConflict(const KShortcut &cut, bool bWarnUser, QWidget *parent)
{
    // For each key sequence in the shortcut,
    for(uint i = 0; i < cut.count(); i++)
    {
        const KKeySequence &seq = cut.seq(i);
        KStdAccel::StdAccel id = KStdAccel::findStdAccel(seq);
        if(id != KStdAccel::AccelNone && keyConflict(cut, KStdAccel::shortcut(id)) > -1)
        {
            if(bWarnUser)
            {
                if(!promptForReassign(seq, KStdAccel::label(id), Standard, parent))
                    return true;
                removeStandardShortcut(KStdAccel::label(id), dynamic_cast< KKeyChooser * >(parent), KStdAccel::shortcut(id), cut);
            }
        }
    }
    return false;
}
Beispiel #18
0
void KAction::setShortcut(const KShortcut &shortcut, ShortcutTypes type)
{
    Q_ASSERT(type);

    if (type & DefaultShortcut) {
        setProperty("defaultShortcuts", QVariant::fromValue(shortcut.toList()));
    }

    if (type & ActiveShortcut) {
        QAction::setShortcuts(shortcut);
    }
}
Beispiel #19
0
void KMarkNote::setupAction()
{
    KStandardAction::openNew(this, SLOT(newNote()), actionCollection());
    KStandardAction::close(this, SLOT(close()), actionCollection());

    KAction* oneColAction = actionCollection()->addAction("win_onecol", m_view, SLOT(oneColView()));
    KAction* twoColAction = actionCollection()->addAction("win_twocol", m_view, SLOT(twoColView()));
    KAction* threeColAction = actionCollection()->addAction("win_threecol", m_view, SLOT(threeColView()));

    oneColAction->setText(i18n("One Column View"));
    twoColAction->setText(i18n("Two Column View"));
    threeColAction->setText(i18n("Three Column View"));

    oneColAction->setIcon(KIcon("view-split-top-bottom"));
    twoColAction->setIcon(KIcon("view-split-left-right"));
    threeColAction->setIcon(KIcon("view-file-columns"));

    KAction* terminalAction = actionCollection()->addAction("toggle_terminal", m_view, SLOT(toggleTerminal()));
    KShortcut terminalShortcut = terminalAction->shortcut();
    terminalShortcut.setPrimary(QKeySequence("F4"));
    terminalAction->setShortcut(terminalShortcut);
}
Beispiel #20
0
bool KCompletionBase::setKeyBinding( KeyBindingType item, const KShortcut& cut )
{
    if ( d->m_delegate )
        return d->m_delegate->setKeyBinding( item, cut );


    if( !cut.isEmpty() )
    {
        for( KeyBindingMap::Iterator it = d->m_keyMap.begin(); it != d->m_keyMap.end(); ++it )
            if( it.value() == cut )  return false;
    }
    d->m_keyMap.insert( item, cut );
    return true;
}
Beispiel #21
0
bool KCompletionBase::setKeyBinding( KeyBindingType item, const KShortcut& cut )
{
    if ( m_delegate )
        return m_delegate->setKeyBinding( item, cut );


    if( !cut.isNull() )
    {
        for( KeyBindingMap::Iterator it = m_keyMap.begin(); it != m_keyMap.end(); ++it )
            if( it.data() == cut )  return false;
    }
    m_keyMap.replace( item, cut );
    return true;
}
Beispiel #22
0
KShortcut shortcutDefault4(StdAccel id)
{
    KShortcut cut;

    KStdAccelInfo *pInfo = infoPtr(id);
    if(pInfo)
    {
        KStdAccelInfo &info = *pInfo;
        KKeySequence key2;

        cut.init((info.cutDefault4) ? QKeySequence(info.cutDefault) : QKeySequence(info.cutDefault4));

        if(info.cutDefault4B)
            key2.init(QKeySequence(info.cutDefault4B));
        else if(info.cutDefault3B)
            key2.init(QKeySequence(info.cutDefault3B));

        if(key2.count())
            cut.append(key2);
    }

    return cut;
}
Beispiel #23
0
bool KAccelActions::init( KConfigBase& config, const QString& sGroup )
{
	kdDebug(125) << "KAccelActions::init( " << sGroup << " )" << endl;
	QMap<QString, QString> mapEntry = config.entryMap( sGroup );
	resize( mapEntry.count() );

	QMap<QString, QString>::Iterator it( mapEntry.begin() );
	for( uint i = 0; it != mapEntry.end(); ++it, i++ ) {
		QString sShortcuts = *it;
		KShortcut cuts;

		kdDebug(125) << it.key() << " = " << sShortcuts << endl;
		if( !sShortcuts.isEmpty() && sShortcuts != "none" )
			cuts.init( sShortcuts );

		m_prgActions[i] = new KAccelAction( it.key(), it.key(), it.key(),
			cuts, cuts,
			0, 0,          // pObjSlot, psMethodSlot,
			true, false ); // bConfigurable, bEnabled
	}

	return true;
}
Beispiel #24
0
void FolderShortcutDialog::slotCapturedShortcut( const KShortcut& sc )
{
  if ( sc == mKeyButton->shortcut() ) return;
  if ( sc.toString().isNull() ) {
    // null is fine, that's reset, but sc.іsNull() will be false :/
    mKeyButton->setShortcut( KShortcut::null(), false );
  } else {
    if( !mMainWidget->shortcutIsValid( sc ) ) {
      QString msg( i18n( "The selected shortcut is already used, "
            "please select a different one." ) );
      KMessageBox::sorry( mMainWidget, msg );
    } else {
      mKeyButton->setShortcut( sc, false );
    }
  }
}
Beispiel #25
0
bool KKeyChooser::checkGlobalShortcutsConflict(const KShortcut &cut, bool bWarnUser, QWidget *parent, const QMap< QString, KShortcut > &map,
                                               const QString &ignoreAction)
{
    QMap< QString, KShortcut >::ConstIterator it;
    for(it = map.begin(); it != map.end(); ++it)
    {
        int iSeq = keyConflict(cut, (*it));
        if(iSeq > -1)
        {
            if(ignoreAction.isEmpty() || it.key() != ignoreAction)
            {
                if(bWarnUser)
                {
                    if(!promptForReassign(cut.seq(iSeq), it.key(), Global, parent))
                        return true;
                    removeGlobalShortcut(it.key(), dynamic_cast< KKeyChooser * >(parent), (*it), cut);
                }
            }
        }
    }
    return false;
}
Beispiel #26
0
void SnippetDlg::slotCapturedShortcut(const KShortcut &sc)
{

    if(sc == keyButton->shortcut()) return;
    if(sc.toString().isNull())
    {
        // null is fine, that's reset, but sc.іsNull() will be false :/
        keyButton->setShortcut(KShortcut::null(), false);
    }
    else
    {
        if(!shortcutIsValid(actionCollection, sc))
        {
            QString msg(i18n("The selected shortcut is already used, "
                             "please select a different one."));
            KMessageBox::sorry(this, msg);
        }
        else
        {
            keyButton->setShortcut(sc, false);
        }
    }
}
Beispiel #27
0
    void parsing()
    {
        KShortcut cut;
        cut = KShortcut(";, Alt+;; ;, Alt+A, ;");
        QVERIFY(cut.primary() == QKeySequence::fromString(";, Alt+;"));
        QVERIFY(cut.alternate() == QKeySequence::fromString(";, Alt+A, ;"));

        cut = KShortcut("Win+E");
        //QTest::ignoreMessage(QtWarningMsg, "QKeySequence::fromString: Unknown modifier 'win+'");
        QEXPECT_FAIL("", "Qt Bug 205255 - QKeySequence silently discards unknown key modifiers", Continue);
        QVERIFY(cut.isEmpty());

        cut = KShortcut("Meta+E");
        QVERIFY(cut.primary()[0] == (Qt::META | Qt::Key_E));

        //qDebug() << QKeySequence(Qt::ALT | Qt::Key_Plus).toString();
        //qDebug() << QKeySequence(Qt::ALT | Qt::Key_Minus).toString();
        cut = KShortcut("Alt+Plus"); // KDE3 said "Alt+Plus", while Qt4 says "Alt++", so KShortcut has to handle this
        QVERIFY(cut.primary()[0] == (Qt::ALT | Qt::Key_Plus));
        cut = KShortcut("Alt+Minus"); // KDE3 said "Alt+Minus", while Qt4 says "Alt+-", so KShortcut has to handle this
        QVERIFY(cut.primary()[0] == (Qt::ALT | Qt::Key_Minus));
    }
Beispiel #28
0
int KGlobalSettings::contextMenuKey ()
{
    KConfigGroup g(KGlobal::config(), "Shortcuts");
    KShortcut cut (g.readEntry ("PopupMenuContext", "Menu"));
    return cut.keyCodeQt();
}
Beispiel #29
0
static void setActionShortcut(QAction* action, const KShortcut& shortcut)
{
    if (action) {
        action->setShortcuts(shortcut.toList());
    }
}
void ActionConfigDialog::slotShortcutCaptured(const KShortcut &shortcut)
{
  QString shortcutText = shortcut.toString();
  QString shortcutText2;
  int pos = shortcutText.find(';');
  if (pos != -1)
  {
    shortcutText2 = shortcutText.mid(pos + 1);
    shortcutText = shortcutText.left(pos);
  }
  QString s = shortcutText;
  s.replace('+', "\\+");
  QRegExp shortcutRx("\\(" + s + "\\)|" + s + "$|" + s + ";");
  s = shortcutText2;
  s.replace('+', "\\+");
  QRegExp shortcutRx2("\\(" + s + "\\)|" + s + "$|" + s + ";");
  QString global;
//check for conflicting global shortcuts
  QMap<QString, QString>::Iterator it;
  for ( it = globalShortcuts.begin(); it != globalShortcuts.end(); ++it )
  {
    if (it.data().contains(shortcutRx))
    {
      global = it.key();
      break;
    }
    if (!shortcutText2.isEmpty() && it.data().contains(shortcutRx2))
    {
      shortcutText = shortcutText2;
      global = it.key();
      break;
    }
  }

  if (global.isEmpty())
  {
    QPtrList<KXMLGUIClient> clients = m_mainWindow->guiFactory()->clients();
    for( QPtrListIterator<KXMLGUIClient> it( clients ); it.current(); ++it )
    {
        KActionCollection *ac = (*it)->actionCollection();
        for (uint i = 0; i < ac->count(); i++)
        {
          KAction *action = ac->action(i);
          if (action != currentAction && action->shortcut().toString().contains(shortcutRx))
          {
            global = action->text();
            break;
          }
          if (!shortcutText2.isEmpty() && action != currentAction &&  action->shortcut().toString().contains(shortcutRx))
          {
            shortcutText = shortcutText2;
            global = action->text();
            break;
          }
        }
         if (!global.isEmpty())
           break;
      }
  }

  if (global.isEmpty())
  {
    shortcutKeyButton->setText(shortcutText);
    buttonApply->setEnabled(true);
    selectedShortcut = shortcut;
  } else
  {
    global.replace('&',"");
    QString s =  i18n("The '%1' key combination has already been allocated "
                "to the \"%2\" action.\n"
                "Please choose a unique key combination.").
                arg(shortcutText).arg(global);
    KMessageBox::sorry( this, s, i18n("Conflicting Shortcuts"));
  }
}