ProgrammerDlg::ProgrammerDlg( const QString & picID, QWidget *parent, const char *name ) : KDialogBase( parent, name, true, i18n("PIC Programmer"), Ok|Cancel ) { // Change the "Ok" button to a "Burn" button KGuiItem burnItem = KStdGuiItem::ok(); burnItem.setText( i18n("Burn") ); setButtonOK( burnItem ); m_bAccepted = false; m_pProgrammerWidget = new ProgrammerWidget( this ); m_pProgrammerSettings = new PicProgrammerSettings; // Setup the list of programmers KComboBox * programmerCombo = m_pProgrammerWidget->m_pProgrammerProgram; QStringList programmerNames = m_pProgrammerSettings->configNames( false ); programmerCombo->insertStringList( programmerNames ); programmerCombo->setSizeLimit( programmerNames.size() ); programmerCombo->setCurrentText( KTLConfig::picProgrammerProgram() ); // Sets up the list of ports m_pProgrammerWidget->m_pPicProgrammerPort->insertStringList( Port::ports( Port::ExistsAndRW ) ); m_pProgrammerWidget->m_pPicProgrammerPort->setCurrentText( KTLConfig::picProgrammerPort() ); // Set the pic type to the one requested if ( !picID.isEmpty() ) m_pProgrammerWidget->m_pMicroSelect->setMicro( picID ); setMainWidget( m_pProgrammerWidget ); }
QWidget *KFileMetaInfoWidget::makeStringWidget() { if(m_validator && m_validator->inherits("KStringListValidator")) { KComboBox *b = new KComboBox(true, this, "metainfo combobox"); KStringListValidator *val = static_cast< KStringListValidator * >(m_validator); b->insertStringList(val->stringList()); b->setCurrentText(m_item.value().toString()); connect(b, SIGNAL(activated(const QString &)), this, SLOT(slotComboChanged(const QString &))); b->setValidator(val); reparentValidator(b, val); return b; }
//// A dialog to load a KDE icon by its name LoadIconDialog::LoadIconDialog(QWidget *parent) : KDialog(parent, "loadicon_dialog", true, i18n("Load KDE Icon by Name"), Ok | Cancel, Ok, false) { QFrame *frame = makeMainWidget(); QGridLayout *l = new QGridLayout(frame); // Name input QLabel *name = new QLabel(i18n("&Name:"), frame); l->addWidget(name, 0, 0); name->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_nameInput = new KLineEdit("kexi", frame); l->addWidget(m_nameInput, 0, 1); name->setBuddy(m_nameInput); // Choose size QLabel *size = new QLabel(i18n("&Size:"), frame); l->addWidget(size, 1, 0); size->setAlignment(Qt::AlignRight | Qt::AlignVCenter); KComboBox *combo = new KComboBox(frame); l->addWidget(combo, 1, 1); size->setBuddy(combo); QStringList list; list << i18n("Small") << i18n("Medium") << i18n("Large") << i18n("Huge"); combo->insertStringList(list); combo->setCurrentItem(2); connect(combo, SIGNAL(activated(int)), this, SLOT(changeIconSize(int))); // Icon chooser button m_button = new KIconButton(frame); m_button->setIcon(koIconName("calligrakexi")); m_button->setIconSize(KIconLoader::SizeMedium); l->addWidget(m_button, 0, 2, 2, 1); connect(m_button, SIGNAL(iconChanged(QString)), this, SLOT(updateIconName(QString))); connect(m_nameInput, SIGNAL(textChanged(QString)), this, SLOT(setIcon(QString))); }