KMultiFormListBoxWindowed::KMultiFormListBoxWindowed(KMultiFormListBoxFactory *factory, TQWidget *parent, bool showUpDownButtons, bool showHelpButton, TQString addButtonText,const char *name) : TQWidget( parent, name ) { _layout = new TQVBoxLayout(this); TQHBoxLayout *innerLayout = new TQHBoxLayout(); _layout->addLayout(innerLayout); _listbox = new TDEListBox(this,"listbox"); _listbox->setSelectionMode(TQListBox::Single); innerLayout->addWidget(_listbox); TQVBoxLayout *buttons = new TQVBoxLayout(); innerLayout->addLayout(buttons); TQPushButton *but = new TQPushButton(addButtonText, this,"Add Button"); buttons->addWidget(but,0); connect(but, TQT_SIGNAL(clicked()), this, TQT_SLOT(addNewElement())); but = new TQPushButton(i18n("Edit"), this,"Edit Button"); buttons->addWidget(but,0); connect(but,TQT_SIGNAL(clicked()), this, TQT_SLOT(slotEditSelected())); connect(_listbox, TQT_SIGNAL(doubleClicked(TQListBoxItem *)), this, TQT_SLOT(slotEditSelected(TQListBoxItem *))); _buttonList.append(but); but = new TQPushButton(i18n("Delete"), this, "Delete Button"); buttons->addWidget(but,0); connect(but, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotDeleteEntry())); _buttonList.append(but); but = new TQPushButton(i18n("Copy"), this, "Copy Button"); buttons->addWidget(but,0); connect(but, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotCopySelected())); _buttonList.append(but); if (showUpDownButtons) { but = new TQPushButton(i18n("Up"), this, "Up Button"); buttons->addWidget(but, 0); connect(but, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotMoveItemUp())); _buttonList.append(but); but = new TQPushButton(i18n("Down"), this, "Down Button"); buttons->addWidget(but, 0); connect(but, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotMoveItemDown())); _buttonList.append(but); } if (showHelpButton) { but = new KPushButton(KStdGuiItem::help(), this, "Help Button"); buttons->addWidget(but, 0); connect(but, TQT_SIGNAL(clicked()), this, TQT_SIGNAL(showHelp())); } buttons->addStretch(1); _factory = factory; slotUpdateButtonState(); }
KMultiFormListBoxWindowed::KMultiFormListBoxWindowed(KMultiFormListBoxFactory *factory, QWidget *parent, bool showUpDownButtons, bool showHelpButton, QString addButtonText) : QWidget( parent ) { _layout = new QVBoxLayout(this); QHBoxLayout *innerLayout = new QHBoxLayout(); _layout->addLayout(innerLayout); _listbox = new KListWidget(this/*,"listbox"*/); _listbox->setSelectionMode(QAbstractItemView::SingleSelection); innerLayout->addWidget(_listbox); QVBoxLayout *buttons = new QVBoxLayout(); innerLayout->addLayout(buttons); KPushButton *but = new KPushButton(addButtonText, this); but->setObjectName("Add Button"); buttons->addWidget(but,0); connect(but, SIGNAL(clicked()), this, SLOT(addNewElement())); but = new KPushButton(i18n("Edit"), this); but->setObjectName("Edit Button"); buttons->addWidget(but,0); connect(but,SIGNAL(clicked()), this, SLOT(slotEditSelected())); connect(_listbox, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(slotEditSelected(QListWidgetItem *))); _buttonList.append(but); but = new KPushButton(i18n("Delete"), this); but->setObjectName("Delete Button"); buttons->addWidget(but,0); connect(but, SIGNAL(clicked()), this, SLOT(slotDeleteEntry())); _buttonList.append(but); but = new KPushButton(i18n("Copy"), this); but->setObjectName("Copy Button"); buttons->addWidget(but,0); connect(but, SIGNAL(clicked()), this, SLOT(slotCopySelected())); _buttonList.append(but); if (showUpDownButtons) { but = new KPushButton(i18n("Up"), this); but->setObjectName("Up Button"); buttons->addWidget(but, 0); connect(but, SIGNAL(clicked()), this, SLOT(slotMoveItemUp())); _buttonList.append(but); but = new KPushButton(i18n("Down"), this); but->setObjectName( "Down Button"); buttons->addWidget(but, 0); connect(but, SIGNAL(clicked()), this, SLOT(slotMoveItemDown())); _buttonList.append(but); } if (showHelpButton) { but = new KPushButton(KStandardGuiItem::help(), this); but->setObjectName( "Help Button"); buttons->addWidget(but, 0); connect(but, SIGNAL(clicked()), this, SIGNAL(showHelp())); } buttons->addStretch(1); _factory = factory; slotUpdateButtonState(); }