Ejemplo n.º 1
0
KGpgKeySelectionDlg::KGpgKeySelectionDlg(QWidget *parent) :
    KDialog(parent),
    m_needCheckList(true),
    m_listOk(false),
    m_checkCount(0)
{
  setCaption(i18n("Select additional keys"));
  setButtons(KDialog::Ok | KDialog::Cancel);
  setDefaultButton(KDialog::Ok);
  setModal(true);
  QWidget* page = new QWidget(this);
  setMainWidget(page);
  QVBoxLayout* topLayout = new QVBoxLayout(page);
  topLayout->setSpacing(spacingHint());

  m_listBox = new KEditListBox(page);
  m_listBox->setTitle(i18n("User identification"));
  m_listBox->setButtons((KEditListBox::Remove | KEditListBox::Add));
  m_listBox->setWhatsThis(i18n("Enter the id of the key you want to use for data encryption. This can either be an e-mail address or the hexadecimal key id. In case of the key id, do not forget the leading 0x."));

  topLayout->addWidget(m_listBox);

  // add a LED for the availability of all keys
  QHBoxLayout* ledBox = new QHBoxLayout();
  ledBox->setContentsMargins(0, 0, 0, 0);
  ledBox->setSpacing(6);
  ledBox->setObjectName("ledBoxLayout");

  m_keyLed = new KLed(page);
  m_keyLed->setShape(KLed::Circular);
  m_keyLed->setLook(KLed::Sunken);

  ledBox->addWidget(m_keyLed);
  ledBox->addWidget(new QLabel(i18n("Keys for all of the above user ids found"), page));
  ledBox->addItem(new QSpacerItem(50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));

  topLayout->addLayout(ledBox);

  connect(m_listBox, SIGNAL(changed()), this, SLOT(slotIdChanged()));
  connect(m_listBox, SIGNAL(added(QString)), this, SLOT(slotKeyListChanged()));
  connect(m_listBox, SIGNAL(removed(QString)), this, SLOT(slotKeyListChanged()));
}
Ejemplo n.º 2
0
void KGpgKeySelectionDlg::setKeys(const QStringList& list)
{
    m_listBox->clear();
    m_listBox->insertStringList(list);
    slotKeyListChanged();
}