Logo Search packages:      
Sourcecode: kcm-tablet version File versions  Download package

void PenWidget::selectKeyFunction ( int  selection  )  [slot]

Opens a new dialogue for the buttons to select the button function. Fires the changed() signal afterwards to inform the main widget that unsaved changes are available

Parameters:
selection button index
See also:
WacomInterface::PenButton Enumaration

Definition at line 151 of file penwidget.cpp.

References changed(), m_ui, Wacom::ProfileManagement::Pen_Button, Wacom::ProfileManagement::Pen_Disable, Wacom::ProfileManagement::Pen_DisplayToggle, Wacom::ProfileManagement::Pen_DoubleClick, Wacom::ProfileManagement::Pen_Keystroke, Wacom::ProfileManagement::Pen_LeftClick, Wacom::ProfileManagement::Pen_MiddleClick, Wacom::ProfileManagement::Pen_ModeToggle, Wacom::ProfileManagement::Pen_QuoteDbl, Wacom::ProfileManagement::Pen_RightClick, and Wacom::ProfileManagement::Pen_ScreenToggle.

{
    QObject* sender = const_cast<QObject*>(QObject::sender());
    QString senderName = sender->objectName();
    KComboBox *cb = m_ui->buttonGroupBox->findChild<KComboBox *>(senderName);
    senderName.replace(QRegExp("ComboBox"), "ActionLabel");

    QLabel *buttonActionLabel = m_ui->buttonGroupBox->findChild<QLabel *>(senderName);

    if (!buttonActionLabel) {
        kError() << "No ActionLabel found!";
        return;
    }

    QPointer <SelectKeyButton> skb = new SelectKeyButton(this);
    QPointer <SelectKeyStroke> sks = new SelectKeyStroke(this);
    QPointer <SelectQuoteText> sqt = new SelectQuoteText(this);
    int ret;

    //returns the saved enum data for this index
    ProfileManagement::PenButton selectionEnum = (ProfileManagement::PenButton)((cb->itemData(selection)).toInt());

    switch (selectionEnum) {
    case ProfileManagement::Pen_LeftClick:
        buttonActionLabel->setText("button 1");
        break;

    case ProfileManagement::Pen_RightClick:
        buttonActionLabel->setText("button 3");
        break;

    case ProfileManagement::Pen_MiddleClick:
        buttonActionLabel->setText("button 2");
        break;

    case ProfileManagement::Pen_DoubleClick:
        buttonActionLabel->setText("dblclick 1");
        break;

    case ProfileManagement::Pen_Button:
        ret = skb->exec();

        if (ret == QDialog::Accepted) {
            buttonActionLabel->setText(skb->keyButton());
        }
        break;

    case ProfileManagement::Pen_Keystroke:
        ret = sks->exec();
        if (ret == KDialog::Accepted) {
            buttonActionLabel->setText(sks->keyStroke());
        }
        break;

    case ProfileManagement::Pen_QuoteDbl:
        ret = sqt->exec();

        if (ret == QDialog::Accepted) {
            buttonActionLabel->setText(sqt->quoteText());
        }
        break;

    case ProfileManagement::Pen_ModeToggle:
        buttonActionLabel->setText("modetoggle");
        break;

    case ProfileManagement::Pen_ScreenToggle:
        buttonActionLabel->setText("screentoggle");
        break;

    case ProfileManagement::Pen_DisplayToggle:
        buttonActionLabel->setText("displaytoggle");
        break;

    case ProfileManagement::Pen_Disable:
        buttonActionLabel->setText(QString());
        break;
    }

    emit changed();

    delete skb;
    delete sks;
    delete sqt;
}


Generated by  Doxygen 1.6.0   Back to index