void ampsWidgetAutheticateUser::InitConnect(void)
{
  connect( m_UI.m_pushButtonOK, SIGNAL(clicked()), this, SLOT(OkPressed()) );
  connect( m_UI.m_pushButtonCancel, SIGNAL(clicked()), this, SLOT(CancelPressed()) );
}
Exemplo n.º 2
0
ValidityDialog::ValidityDialog(QWidget* parent, Selection* selection)
        : KPageDialog(parent)

{
    setFaceType(Tabbed);
    setCaption(i18n("Validity"));
    setModal(true);
    setButtons(Ok | Cancel | User1);
    setButtonGuiItem(User1, KGuiItem(i18n("Clear &All")));

    m_selection = selection;

    QFrame *page1 = new QFrame();
    addPage(page1, i18n("&Criteria"));

    QGridLayout* tmpGridLayout = new QGridLayout(page1);
    tmpGridLayout->setMargin(KDialog::marginHint());
    tmpGridLayout->setSpacing(KDialog::spacingHint());

    QLabel *tmpQLabel = new QLabel(page1);
    tmpQLabel->setText(i18n("Allow:"));
    tmpGridLayout->addWidget(tmpQLabel, 0, 0);

    chooseType = new KComboBox(page1);
    tmpGridLayout->addWidget(chooseType, 0, 1);
    chooseType->addItem(i18n("All"), QVariant::fromValue(KCValidity::None));
    chooseType->addItem(i18n("Number"), QVariant::fromValue(KCValidity::KCNumber));
    chooseType->addItem(i18n("Integer"), QVariant::fromValue(KCValidity::Integer));
    chooseType->addItem(i18n("Text"), QVariant::fromValue(KCValidity::Text));
    chooseType->addItem(i18n("Date"), QVariant::fromValue(KCValidity::Date));
    chooseType->addItem(i18n("Time"), QVariant::fromValue(KCValidity::Time));
    chooseType->addItem(i18n("Text Length"), QVariant::fromValue(KCValidity::TextLength));
    chooseType->addItem(i18n("List"), QVariant::fromValue(KCValidity::List));
    chooseType->setCurrentIndex(0);

    allowEmptyCell = new QCheckBox(i18n("Allow blanks"), page1);
    tmpGridLayout->addWidget(allowEmptyCell, 1, 0, 1, 2);

    chooseLabel = new QLabel(page1);
    chooseLabel->setText(i18n("Data:"));
    tmpGridLayout->addWidget(chooseLabel, 2, 0);

    choose = new KComboBox(page1);
    tmpGridLayout->addWidget(choose, 2, 1);
    choose->addItem(i18n("equal to"), QVariant::fromValue(KCConditional::Equal));
    choose->addItem(i18n("greater than"), QVariant::fromValue(KCConditional::Superior));
    choose->addItem(i18n("less than"), QVariant::fromValue(KCConditional::Inferior));
    choose->addItem(i18n("equal to or greater than"), QVariant::fromValue(KCConditional::SuperiorEqual));
    choose->addItem(i18n("equal to or less than"), QVariant::fromValue(KCConditional::InferiorEqual));
    choose->addItem(i18n("between"), QVariant::fromValue(KCConditional::Between));
    choose->addItem(i18n("different from"), QVariant::fromValue(KCConditional::Different));
    choose->addItem(i18n("different to"), QVariant::fromValue(KCConditional::DifferentTo));
    choose->setCurrentIndex(0);

    edit1 = new QLabel(page1);
    edit1->setText(i18n("Minimum:"));
    tmpGridLayout->addWidget(edit1, 3, 0);

    val_min = new KLineEdit(page1);
    tmpGridLayout->addWidget(val_min, 3, 1);
    val_min->setValidator(new KDoubleValidator(val_min));

    edit2 = new QLabel(page1);
    edit2->setText(i18n("Maximum:"));
    tmpGridLayout->addWidget(edit2, 4, 0);

    val_max = new KLineEdit(page1);
    tmpGridLayout->addWidget(val_max, 4, 1);
    val_max->setValidator(new KDoubleValidator(val_max));

    //Apply minimum width of column1 to avoid horizontal move when changing option
    //A bit ugly to apply text always, but I couldn't get a label->QFontMetrix.boundingRect("text").width()
    //to give mew the correct results - Philipp
    edit2->setText(i18n("Date:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Date minimum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Date maximum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Time:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Time minimum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Time maximum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Minimum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Maximum:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);
    edit2->setText(i18n("Number:"));
    tmpGridLayout->addItem(new QSpacerItem(edit2->width(), 0), 0, 0);

    validityList = new KTextEdit(page1);
    tmpGridLayout->addWidget(validityList, 2, 1, 3, 1);

    validityLabelList = new QLabel(page1);
    validityLabelList->setText(i18n("Entries:"));
    tmpGridLayout->addWidget(validityLabelList, 2, 0, Qt::AlignTop);

    tmpGridLayout->setRowStretch(5, 1);

    QFrame *page2 = new QFrame();
    addPage(page2, i18n("&Error Alert"));

    tmpGridLayout = new QGridLayout(page2);
    tmpGridLayout->setMargin(KDialog::marginHint());
    tmpGridLayout->setSpacing(KDialog::spacingHint());

    displayMessage = new QCheckBox(i18n("Show error message when invalid values are entered"), page2);
    displayMessage->setChecked(true);
    tmpGridLayout->addWidget(displayMessage, 0, 0, 1, 2);

    tmpQLabel = new QLabel(page2);
    tmpQLabel->setText(i18n("Action:"));
    tmpGridLayout->addWidget(tmpQLabel, 1, 0);

    chooseAction = new KComboBox(page2);
    tmpGridLayout->addWidget(chooseAction, 1, 1);
    chooseAction->addItem(i18n("Stop"), QVariant::fromValue(KCValidity::Stop));
    chooseAction->addItem(i18n("Warning"), QVariant::fromValue(KCValidity::Warning));
    chooseAction->addItem(i18n("Information"), QVariant::fromValue(KCValidity::Information));
    chooseAction->setCurrentIndex(0);

    tmpQLabel = new QLabel(page2);
    tmpQLabel->setText(i18n("Title:"));
    tmpGridLayout->addWidget(tmpQLabel, 2, 0);

    title = new KLineEdit(page2);
    tmpGridLayout->addWidget(title, 2, 1);

    tmpQLabel = new QLabel(page2);
    tmpQLabel->setText(i18n("Message:"));
    tmpGridLayout->addWidget(tmpQLabel, 3, 0, Qt::AlignTop);

    message = new KTextEdit(page2);
    tmpGridLayout->addWidget(message, 3, 1);

    QFrame *page3 = new QFrame();
    addPage(page3, i18n("Input Help"));

    tmpGridLayout = new QGridLayout(page3);
    tmpGridLayout->setMargin(KDialog::marginHint());
    tmpGridLayout->setSpacing(KDialog::spacingHint());

    displayHelp = new QCheckBox(i18n("Show input help when cell is selected"), page3);
    displayMessage->setChecked(false);
    tmpGridLayout->addWidget(displayHelp, 0, 0, 1, 2);

    tmpQLabel = new QLabel(page3);
    tmpQLabel->setText(i18n("Title:"));
    tmpGridLayout->addWidget(tmpQLabel, 1, 0);

    titleHelp = new KLineEdit(page3);
    tmpGridLayout->addWidget(titleHelp, 1, 1);

    tmpQLabel = new QLabel(page3);
    tmpQLabel->setText(i18n("Message:"));
    tmpGridLayout->addWidget(tmpQLabel, 2, 0, Qt::AlignTop);

    messageHelp = new KTextEdit(page3);
    tmpGridLayout->addWidget(messageHelp, 2, 1);

    connect(choose, SIGNAL(activated(int)), this, SLOT(changeIndexCond(int)));
    connect(chooseType, SIGNAL(activated(int)), this, SLOT(changeIndexType(int)));
    connect(this, SIGNAL(okClicked()), SLOT(OkPressed()));
    connect(this, SIGNAL(user1Clicked()), SLOT(clearAllPressed()));

    init();
}