Пример #1
0
bool KLineEdit::copySqueezedText(bool clipboard) const
{
   if (!d->squeezedText.isEmpty() && d->squeezedStart)
   {
      int start, end;
      KLineEdit *that = const_cast<KLineEdit *>(this);
      if (!that->getSelection(&start, &end))
         return false;
      if (start >= d->squeezedStart+3)
         start = start - 3 - d->squeezedStart + d->squeezedEnd;
      else if (start > d->squeezedStart)
         start = d->squeezedStart;
      if (end >= d->squeezedStart+3)
         end = end - 3 - d->squeezedStart + d->squeezedEnd;
      else if (end > d->squeezedStart)
         end = d->squeezedEnd;
      if (start == end)
         return false;
      QString t = d->squeezedText;
      t = t.mid(start, end - start);
      disconnect( QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0);
      QApplication::clipboard()->setText( t, clipboard ? QClipboard::Clipboard : QClipboard::Selection );
      connect( QApplication::clipboard(), SIGNAL(selectionChanged()), this,
               SLOT(clipboardChanged()) );
      return true;
   }
   return false;
}
QWidget* RuleDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    Q_UNUSED(option)

    QWidget *editor = new QWidget(parent);
    KLineEdit *ruleLineEdit = new KLineEdit(editor);
    ruleLineEdit->setToolTip(i18n("Expression"));

    KComboBox *matchComboBox = new KComboBox(editor);
    matchComboBox->setToolTip(i18n("Match Mode"));
    matchComboBox->addItem(i18n("Ignore"));
    matchComboBox->addItem(i18n("Regular expression"));
    matchComboBox->addItem(i18n("Partial match"));
    matchComboBox->addItem(i18n("Exact match"));

    QCheckBox *requiredCheckBox = new QCheckBox(editor);
    requiredCheckBox->setToolTip(i18n("Required"));

    QHBoxLayout *layout = new QHBoxLayout(editor);
    layout->addWidget(ruleLineEdit);
    layout->addWidget(matchComboBox);
    layout->addWidget(requiredCheckBox);
    layout->setMargin(0);

    setEditorData(editor, index);

    return editor;
}
Пример #3
0
    void setupUI() {
        p->setObjectName(QStringLiteral("FieldLineEdit"));

        hLayout = new QHBoxLayout(p);
        hLayout->setMargin(0);
        hLayout->setSpacing(2);

        m_pushButtonType = new QPushButton(p);
        appendWidget(m_pushButtonType);
        hLayout->setStretchFactor(m_pushButtonType, 0);
        m_pushButtonType->setObjectName(QStringLiteral("FieldLineEditButton"));

        if (isMultiLine) {
            m_multiLineEditText = new KTextEdit(p);
            appendWidget(m_multiLineEditText);
            connect(m_multiLineEditText, &KTextEdit::textChanged, p, &MenuLineEdit::slotTextChanged);
            m_multiLineEditText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
            p->setFocusProxy(m_multiLineEditText);
            m_multiLineEditText->setAcceptRichText(false);
        } else {
            m_singleLineEditText = new KLineEdit(p);
            appendWidget(m_singleLineEditText);
            hLayout->setStretchFactor(m_singleLineEditText, 100);
            m_singleLineEditText->setClearButtonEnabled(true);
            m_singleLineEditText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
            m_singleLineEditText->setCompletionMode(KCompletion::CompletionPopup);
            m_singleLineEditText->completionObject()->setIgnoreCase(true);
            p->setFocusProxy(m_singleLineEditText);
            connect(m_singleLineEditText, &KLineEdit::textEdited, p, &MenuLineEdit::textChanged);
        }

        p->setFocusPolicy(Qt::StrongFocus); // FIXME improve focus handling
        p->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    }
Пример #4
0
QWidget *MoneyDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
{
    KLineEdit *editor = new KLineEdit(parent);
    //TODO: validator
    editor->installEventFilter(const_cast<MoneyDelegate*>(this));
    return editor;
}
Пример #5
0
void Delegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    QString value = index.model()->data(index, Qt::EditRole).toString();

    KLineEdit *le = static_cast<KLineEdit*>(editor);
    le->setText(value);
}
Пример #6
0
void Delegate::setModelData(QWidget *editor, QAbstractItemModel *model,
        const QModelIndex &index) const
{
    KLineEdit *le = static_cast<KLineEdit*>(editor);

    model->setData(index, le->text(), Qt::EditRole);
}
void kiptablesgenerator::setupNewHostDialog()
{
  newHostDialog = new KDialogBase(this, 0, true, i18n("Add Host"), KDialogBase::Ok | KDialogBase::Cancel);
  
  QFrame *dialogArea = new QFrame(newHostDialog);
  QGridLayout *layout = new QGridLayout(dialogArea, 5, 2);
  
  QLabel *intro = new QLabel(i18n(
    "<p>Here you can tell netfilter to allow all connections from a given host regardless of other rules, "
    "or block all connections from a given host regardless of other rules.</p>"
    "<p>You can specify a host either by IP address or MAC address.</p>"), dialogArea);
  intro->show();
  layout->addMultiCellWidget(intro, 0, 0, 0, 1);

  QButtonGroup *whitelistOrBlacklist = new QButtonGroup(dialogArea);
  whitelistOrBlacklist->hide();
  
  QRadioButton *whitelist = new QRadioButton(i18n("&Allow"), dialogArea);
  whitelist->setChecked(true);
  whitelist->show();
  layout->addWidget(whitelist, 1, 0);
  namedWidgets["newHost_allow"] = whitelist;
  whitelistOrBlacklist->insert(whitelist);
  
  QRadioButton *blacklist = new QRadioButton(i18n("&Block"), dialogArea);
  blacklist->setChecked(false);
  blacklist->show();
  layout->addWidget(blacklist, 1, 1);
  whitelistOrBlacklist->insert(blacklist);
  
  QButtonGroup *ipOrMAC = new QButtonGroup(dialogArea);
  ipOrMAC->hide();
  
  QRadioButton *useIP = new QRadioButton(i18n("&Use IP"), dialogArea);
  useIP->setChecked(true);
  useIP->show();
  layout->addWidget(useIP, 2, 0);
  namedWidgets["newHost_useIP"] = useIP;
  ipOrMAC->insert(useIP);
  
  QRadioButton *useMAC = new QRadioButton(i18n("U&se MAC"), dialogArea);
  useMAC->show();
  layout->addWidget(useMAC, 2, 1);
  ipOrMAC->insert(useMAC);
  
  QLabel *hostLabel = new QLabel(i18n("Host:"), dialogArea);
  hostLabel->show();
  layout->addMultiCellWidget(hostLabel, 3, 3, 0, 1);
  
  KLineEdit *host = new KLineEdit(dialogArea);
  host->show();
  namedWidgets["newHost_address"] = host;
  layout->addMultiCellWidget(host, 4, 4, 0, 1);
  
  connect(newHostDialog, SIGNAL(okClicked()), this, SLOT(slotAddHost()));
  
  dialogArea->show();
  newHostDialog->setMainWidget(dialogArea);
}
Пример #8
0
void Pane::focusQuickSearch()
{
  Widget *widget = currentMessageListViewWidget();
  if ( widget ) {
    KLineEdit *quickSearch = widget->quickSearch();
    if ( quickSearch )
      quickSearch->setFocus();
  }
}
Пример #9
0
QWidget *FormBase::setupLineEdit(QWidget *parent, QString text, int lineEditWidth)
{
	QWidget *widget = new QWidget(parent);
	(new QHBoxLayout(widget ) )->setAutoAdd(true);
	QLabel *label = new QLabel(text, widget);
	KLineEdit *lineEdit = new KLineEdit(widget);
	lineEdit->setMaximumWidth(lineEditWidth);
	return widget;
}
Пример #10
0
QWidget * KWQTableDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
  Q_UNUSED(option);
  KLineEdit *editor = new KLineEdit(parent);
  editor->setFrame(false);
  editor->setFont(index.data(Qt::FontRole).value<QFont>());

  //connect(editor, SIGNAL(returnPressed()), this, SLOT(commitAndCloseEditor()));
  return editor;
}
void kiptablesgenerator::setupNewForwardDialog()
{
  newForwardDialog = new KDialogBase(this, 0, true, i18n("Add Forward"), KDialogBase::Ok | KDialogBase::Cancel);
  
  QFrame *dialogArea = new QFrame(newForwardDialog);
  QGridLayout *layout = new QGridLayout(dialogArea, 4, 2);
  
  QLabel *intro = new QLabel(i18n(
      "<p><i>Advanced users only</i></p>"
      "<p>Here you can tell netfilter to forward connections to given ports to another address/port.</p>"
      "<p>This is using netfilter's DNAT functionality - incoming redirects go in the prerouting chain,"
      "outgoing redirects go in the output chain.</p>"
      "<p>The destination should be of the from destination.computer.ip.address:destinationPort</p>"), dialogArea);
  intro->show();
  layout->addMultiCellWidget(intro, 0, 0, 0, 1);
  
  QButtonGroup *direction = new QButtonGroup(dialogArea);
  direction->hide();
  
  QRadioButton *incoming = new QRadioButton(i18n("&Incoming"), dialogArea);
  incoming->setChecked(true);
  incoming->show();
  layout->addWidget(incoming, 1, 0);
  namedWidgets["forward_incoming"] = incoming;
  direction->insert(incoming);
  
  QRadioButton *outgoing = new QRadioButton(i18n("&Outgoing"), dialogArea);
  outgoing->show();
  layout->addWidget(outgoing, 1, 1);
  direction->insert(outgoing);
  
  QLabel *label = new QLabel(i18n("Port:"), dialogArea);
  label->show();
  layout->addWidget(label, 2, 0);
  
  KLineEdit *port = new KLineEdit(dialogArea);
  port->show();
  layout->addWidget(port, 2, 1);
  namedWidgets["forward_port"] = port;
  
  label = new QLabel(i18n("Destination:"), dialogArea);
  label->show();
  layout->addWidget(label, 3, 0);
  
  KLineEdit *destination = new KLineEdit(dialogArea);
  destination->show();
  layout->addWidget(destination, 3, 1);
  namedWidgets["forward_destination"] = destination;
 

  connect(newForwardDialog, SIGNAL(okClicked()), this, SLOT(slotAddForward()));
	
  dialogArea->show();
  newForwardDialog->setMainWidget(dialogArea);
}
Пример #12
0
void Security8021xAuthWidget::showPasswordsToggled(bool toggled)
{
    Q_D(Security8021xAuthWidget);
    for (int i = 0; i < d->layout->rowCount() - 1; i++)
    {
        KLineEdit *le = qobject_cast<KLineEdit*>(d->layout->itemAt(i, QFormLayout::FieldRole)->widget());
        if (le) {
            le->setPasswordMode(!toggled);
        }
    }
}
void AkonadiSearchDebugDialogTest::shouldHaveDefaultValue()
{
    Akonadi::Search::AkonadiSearchDebugDialog dlg;
    Akonadi::Search::AkonadiSearchDebugWidget *debugWidget = dlg.findChild<Akonadi::Search::AkonadiSearchDebugWidget *>(QStringLiteral("akonadisearchdebugwidget"));
    QVERIFY(debugWidget);
    QPlainTextEdit *editorWidget = debugWidget->findChild<QPlainTextEdit *>(QStringLiteral("plaintexteditor"));
    QVERIFY(editorWidget);
    KLineEdit *lineEdit = debugWidget->findChild<KLineEdit *>(QStringLiteral("lineedit"));
    QVERIFY(lineEdit);
    QVERIFY(lineEdit->text().isEmpty());
}
Пример #14
0
void CharDataInformation::staticSetWidgetData(quint8 value, QWidget* w)
{
    KLineEdit* edit = dynamic_cast<KLineEdit*> (w);
    if (edit)
    {
        QChar qchar(value, 0);
        if (! qchar.isPrint())
            qchar = QChar(QChar::ReplacementCharacter);
        edit->setText( qchar );
    }
}
Пример #15
0
ScriptSelector::ScriptSelector( QWidget * parent )
 : KPluginSelector( parent )
{
    KLineEdit* lineEdit;
    lineEdit = this->findChild<KLineEdit*>();

    if( lineEdit )
        lineEdit->setClickMessage( i18n( "Search Scripts" ) );

    m_listView = this->findChild<KCategorizedView*>();
    scriptCount = 0;
}
void BlackListBalooEmailCompletionWidgetTest::shouldHaveDefaultValue()
{
    KPIM::BlackListBalooEmailCompletionWidget widget;
    widget.show();
    QTest::qWaitForWindowExposed(&widget);
    QLabel *searchLabel = widget.findChild<QLabel *>(QStringLiteral("search_label"));
    QVERIFY(searchLabel);

    KLineEdit *searchLineEdit = widget.findChild<KLineEdit *>(QStringLiteral("search_lineedit"));
    QVERIFY(searchLineEdit);
    QVERIFY(searchLineEdit->isClearButtonShown());
    QVERIFY(searchLineEdit->trapReturnKey());
    QVERIFY(searchLineEdit->text().isEmpty());

    QPushButton *seachButton = widget.findChild<QPushButton *>(QStringLiteral("search_button"));
    QVERIFY(seachButton);
    QVERIFY(!seachButton->isEnabled());

    QLabel *moreResult = widget.findChild<QLabel *>(QStringLiteral("moreresultlabel"));
    QVERIFY(moreResult);
    QVERIFY(!moreResult->isVisible());

    QLabel *mNumberOfEmailsFound = widget.findChild<QLabel *>(QStringLiteral("numberofemailsfound"));
    QVERIFY(mNumberOfEmailsFound);
    QVERIFY(mNumberOfEmailsFound->text().isEmpty());

    QPushButton *showAllBlackListedEmails = widget.findChild<QPushButton *>(QStringLiteral("show_blacklisted_email_button"));
    QVERIFY(showAllBlackListedEmails);

    KPIM::BlackListBalooEmailList *emailList = widget.findChild<KPIM::BlackListBalooEmailList *>(QStringLiteral("email_list"));
    QVERIFY(emailList);

    QPushButton *selectButton = widget.findChild<QPushButton *>(QStringLiteral("select_email"));
    QVERIFY(selectButton);
    QVERIFY(!selectButton->isEnabled());
    QPushButton *unselectButton = widget.findChild<QPushButton *>(QStringLiteral("unselect_email"));
    QVERIFY(unselectButton);
    QVERIFY(!unselectButton->isEnabled());

    QLabel *excludeDomainLabel = widget.findChild<QLabel *>(QStringLiteral("domain_label"));
    QVERIFY(excludeDomainLabel);

    KLineEdit *excludeDomainLineEdit = widget.findChild<KLineEdit *>(QStringLiteral("domain_lineedit"));
    QVERIFY(excludeDomainLineEdit);
    QVERIFY(excludeDomainLineEdit->trapReturnKey());
    QVERIFY(excludeDomainLineEdit->text().isEmpty());
    QVERIFY(excludeDomainLineEdit->isClearButtonShown());
    QVERIFY(!excludeDomainLineEdit->placeholderText().isEmpty());

    KListWidgetSearchLine *searchInResult = widget.findChild<KListWidgetSearchLine *>(QStringLiteral("searchinresultlineedit"));
    QVERIFY(searchInResult);
    QVERIFY(!searchInResult->placeholderText().isEmpty());
    QVERIFY(searchInResult->text().isEmpty());
    QVERIFY(searchInResult->isClearButtonEnabled());

    KPIM::BlackListBalooEmailWarning *blackListWarning = widget.findChild<KPIM::BlackListBalooEmailWarning *>(QStringLiteral("backlistwarning"));
    QVERIFY(blackListWarning);
}
void AkonadiSearchDebugDialogTest::shouldFillLineEditWhenWeWantToSearchItem()
{
    Akonadi::Search::AkonadiSearchDebugDialog dlg;
    Akonadi::Search::AkonadiSearchDebugWidget *debugWidget = dlg.findChild<Akonadi::Search::AkonadiSearchDebugWidget *>(QStringLiteral("akonadisearchdebugwidget"));
    QVERIFY(debugWidget);
    KLineEdit *lineEdit = debugWidget->findChild<KLineEdit *>(QStringLiteral("lineedit"));
    QVERIFY(lineEdit);
    const int value = 42;
    const QString akonadiItem = QString::number(value);
    dlg.setAkonadiId(value);
    QCOMPARE(lineEdit->text(), akonadiItem);
}
Пример #18
0
void KonqBookmarkDelegate::setEditorData(QWidget *editor,
                                    const QModelIndex &index) const
{
    QString text = index.model()->data(index, Qt::EditRole).toString();
    
    if(index.column() == KonqBookmarkModel::Url) {
        LocationBar *LocationBarEditor = qobject_cast<LocationBar*>(editor);
        LocationBarEditor->setText(text);
    } else {
        KLineEdit *kLineEditEditor = static_cast<KLineEdit*>(editor);
        kLineEditEditor->setText(text);
    }
}
Пример #19
0
void KonqBookmarkDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
                                const QModelIndex &index) const
{
    QString text;
    if(index.column() == KonqBookmarkModel::Url) {
        LocationBar *LocationBarEditor = qobject_cast<LocationBar*>(editor);
        text = LocationBarEditor->text();
    } else {
        KLineEdit *kLineEditEditor = static_cast<KLineEdit*>(editor);
        text = kLineEditEditor->text();
    }

    model->setData(index, text, Qt::EditRole);
}
Пример #20
0
void *FormBase::setupGridLineEdit(QWidget *parent, QStringList texts, int lineEditWidth)
{
	QGridLayout *layout = new QGridLayout(parent, texts.count(), 2, 5, 5);
	
	for (uint i = 0; i < texts.count(); i++)
	{
		QLabel *labTmp = new QLabel(texts[i], parent);
		KLineEdit *lineEditTmp = new KLineEdit(parent);
		lineEditTmp->setMaximumWidth(lineEditWidth);
		lineEditTmp->resize( lineEditTmp->height(), lineEditWidth);
		labTmp->setBuddy(lineEditTmp);
		layout->addWidget(labTmp, i, 0);
		layout->addWidget(lineEditTmp, i, 1);
	}
}
Пример #21
0
QWidget *KonqBookmarkDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */,
    const QModelIndex &index) const
{
    if(index.column() == KonqBookmarkModel::Url) {
        // Edit the address with a locationbar
        LocationBar *editor = new LocationBar(parent);
        return editor;
    } else {
        KLineEdit *editor = new KLineEdit(parent);
        // Show some space at the left for the bookmarks' icon
        if (index.column() == KonqBookmarkModel::Title) {
            editor->setContentsMargins(24, 0, 0, 0);
        }
        return editor;
    }
}
void BlackListBalooEmailCompletionWidgetTest::shouldEnablePushButtonWhenTestSizeSupperiorToTwo()
{
    KPIM::BlackListBalooEmailCompletionWidget widget;
    KLineEdit *searchLineEdit = widget.findChild<KLineEdit *>(QStringLiteral("search_lineedit"));
    QPushButton *seachButton = widget.findChild<QPushButton *>(QStringLiteral("search_button"));
    QVERIFY(!seachButton->isEnabled());
    searchLineEdit->setText(QStringLiteral("fo"));
    QVERIFY(!seachButton->isEnabled());
    searchLineEdit->setText(QStringLiteral("foo"));
    QVERIFY(seachButton->isEnabled());

    searchLineEdit->setText(QStringLiteral("o  "));
    QVERIFY(!seachButton->isEnabled());
    searchLineEdit->setText(QStringLiteral(" o "));
    QVERIFY(!seachButton->isEnabled());
}
Пример #23
0
 void setWidgetReadOnly(QWidget *w, bool isReadOnly) {
     if (m_singleLineEditText == w)
         m_singleLineEditText->setReadOnly(isReadOnly);
     else if (m_multiLineEditText == w)
         m_multiLineEditText->setReadOnly(isReadOnly);
     else if (!w->property("isConst").isValid() && !w->property("isConst").toBool())
         w->setEnabled(!isReadOnly);
 }
void RuleDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
    KLineEdit *ruleLineEdit = static_cast<KLineEdit*>(editor->layout()->itemAt(0)->widget());
    KComboBox *matchComboBox = static_cast<KComboBox*>(editor->layout()->itemAt(1)->widget());
    QCheckBox *requiredCheckBox = static_cast<QCheckBox*>(editor->layout()->itemAt(2)->widget());

    model->setData(index, ((matchComboBox->currentIndex() > 0)?(QString("%1+%2+%3").arg(requiredCheckBox->isChecked()?'1':'0').arg(matchComboBox->currentIndex()).arg(ruleLineEdit->text())):QString()), Qt::EditRole);
}
void RuleDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    const QString rule = index.data(Qt::EditRole).toString();

    if (rule.isEmpty())
    {
        return;
    }

    KLineEdit *ruleLineEdit = static_cast<KLineEdit*>(editor->layout()->itemAt(0)->widget());
    ruleLineEdit->setText(rule.mid(rule.indexOf('+', 3) + 1));

    KComboBox *matchComboBox = static_cast<KComboBox*>(editor->layout()->itemAt(1)->widget());
    matchComboBox->setCurrentIndex(rule.mid(2, (rule.indexOf('+', 3) - 2)).toInt());

    QCheckBox *requiredCheckBox = static_cast<QCheckBox*>(editor->layout()->itemAt(2)->widget());
    requiredCheckBox->setChecked(rule.at(0) == '1');
}
Пример #26
0
void KNewFileMenuPrivate::executeRealFileOrDir(const KNewFileMenuSingleton::Entry& entry)
{
    // The template is not a desktop file
    // Show the small dialog for getting the destination filename
    QString text = entry.text;
    text.remove("..."); // the ... is fine for the menu item but not for the default filename
    text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
    m_strategy.m_src = entry.templatePath;

    KUrl defaultFile(m_popupFiles.first());
    defaultFile.addPath(KIO::encodeFileName(text));
    if (defaultFile.isLocalFile() && QFile::exists(defaultFile.toLocalFile()))
        text = KIO::RenameDialog::suggestName(m_popupFiles.first(), text);
    
    KDialog* fileDialog = new KDialog(m_parentWidget);
    fileDialog->setAttribute(Qt::WA_DeleteOnClose);
    fileDialog->setModal(q->isModal());
    fileDialog->setButtons(KDialog::Ok | KDialog::Cancel);
    
    QWidget* mainWidget = new QWidget(fileDialog);
    QVBoxLayout *layout = new QVBoxLayout(mainWidget);
    QLabel *label = new QLabel(entry.comment);

    // We don't set the text of lineEdit in its constructor because the clear button would not be shown then.
    // It seems that setClearButtonShown(true) must be called *before* the text is set to make it work.
    // TODO: should probably be investigated and fixed in KLineEdit.
    KLineEdit *lineEdit = new KLineEdit;
    lineEdit->setClearButtonShown(true);
    lineEdit->setText(text);

    _k_slotTextChanged(text);
    QObject::connect(lineEdit, SIGNAL(textChanged(const QString &)), q, SLOT(_k_slotTextChanged(const QString &)));
    
    layout->addWidget(label);
    layout->addWidget(lineEdit);
    
    fileDialog->setMainWidget(mainWidget);
    QObject::connect(fileDialog, SIGNAL(accepted()), q, SLOT(_k_slotRealFileOrDir()));
    QObject::connect(fileDialog, SIGNAL(rejected()), q, SLOT(_k_slotAbortDialog()));
 
    fileDialog->show();
    lineEdit->selectAll();
    lineEdit->setFocus();
}
Пример #27
0
void FormBase::addLineEdits(QWidget *parent, QStringList texts, HashLineEdit &hle, int lineEditWidth, QStringList names)
{
	QGridLayout *layout = static_cast<QGridLayout *>(parent->layout());
	
	for (uint i = 0; i < texts.count(); i++)
	{
		QLabel *labTmp = new QLabel(texts[i], parent);
		KLineEdit *lineEditTmp = new KLineEdit(parent, names[i]);
		lineEditTmp->setMaximumWidth(lineEditWidth);
		lineEditTmp->resize( lineEditTmp->height(), lineEditWidth);
		labTmp->setBuddy(lineEditTmp);

		int row = i + layout->numRows();
		layout->addWidget(labTmp, row, 0);
		layout->addWidget(lineEditTmp, row, 1);
		
		hle.insert(names[i], lineEditTmp);
	}
}
Пример #28
0
void Security8021xAuthWidget::writeConfig()
{
    Q_D(Security8021xAuthWidget);

    for (int i = 0; i < d->layout->rowCount() - 1; i++)
    {
        KLineEdit *le = qobject_cast<KLineEdit*>(d->layout->itemAt(i, QFormLayout::FieldRole)->widget());
        if (le) {
            QString setting = le->property("setting").toString();
            if (setting == QLatin1String("password")) {
                d->setting->setPassword(le->text());
            } else if (setting == QLatin1String("private-key-password")) {
                d->setting->setPrivatekeypassword(le->text());
            } else if (setting == QLatin1String("phase2-private-key-password")) {
                d->setting->setPhase2privatekeypassword(le->text());
            }
        }
    }
}
Пример #29
0
void CharactersViewDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
    switch (index.column())
    {
    case 0:
    case 1:
    {
        KLineEdit* lineEdit = static_cast<KLineEdit*>(editor);
        lineEdit->setText(index.data(Qt::EditRole).toString());
        break;
    }
    case 2:
    {
        KComboBox* comboBox = static_cast<KComboBox*>(editor);
        comboBox->setCurrentIndex(index.data(Qt::EditRole).toInt());
        break;
    }
    default:
        QStyledItemDelegate::setEditorData(editor, index);
    }
}
Пример #30
0
void CharactersViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
    switch (index.column())
    {
    case 0:
    case 1:
    {
        KLineEdit* lineEdit = static_cast<KLineEdit*>(editor);
        model->setData(index, lineEdit->text());
        break;
    }
    case 2:
    {
        KComboBox* comboBox = static_cast<KComboBox*>(editor);
        model->setData(index, comboBox->currentIndex());
        break;
    }
    default:
        QStyledItemDelegate::setModelData(editor, model, index);
    }
}