void ListWidgetButtonContainer::setButtons(const RecordItNow::CollectionListWidget::ButtonCodes &buttons) { m_buttons.clear(); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setContentsMargins(-1, -1, -1, 0); mainLayout->setSizeConstraint(QVBoxLayout::SetMinimumSize); KSeparator *mainSeparator = new KSeparator(this); mainSeparator->setFrameShape(KSeparator::HLine); QHBoxLayout *layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSizeConstraint(QLayout::SetMinimumSize); mainLayout->addLayout(layout); mainLayout->addWidget(mainSeparator); QToolButton *button = 0; if (buttons & CollectionListWidget::PlayButton) { button = newButton(this); button->setIcon(KIcon("media-playback-start")); button->setToolTip(i18n("Play")); connect(button, SIGNAL(clicked()), this, SIGNAL(playClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::PlayButton, button); } /* if (button) { KSeparator *separator = new KSeparator(this); separator->setFrameShape(QFrame::VLine); layout->addWidget(separator); } */ if (buttons & CollectionListWidget::UploadButton) { button = newButton(this); button->setIcon(KIcon("recorditnow-upload-media")); button->setToolTip(i18n("Upload")); connect(button, SIGNAL(clicked()), this, SIGNAL(uploadClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::UploadButton, button); } if (buttons & CollectionListWidget::AddButton) { button = newButton(this); button->setIcon(KIcon("list-add")); button->setToolTip(i18n("Add")); connect(button, SIGNAL(clicked()), this, SIGNAL(addClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::AddButton, button); } if (buttons & CollectionListWidget::EditButton) { button = newButton(this); button->setIcon(KIcon("document-edit")); button->setToolTip(i18n("Edit")); connect(button, SIGNAL(clicked()), this, SIGNAL(editClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::EditButton, button); } if (buttons & CollectionListWidget::DeleteButton) { button = newButton(this); button->setIcon(KIcon("edit-delete")); button->setToolTip(i18n("Delete")); connect(button, SIGNAL(clicked()), this, SIGNAL(deleteClicked())); layout->addWidget(button); m_buttons.insert(CollectionListWidget::DeleteButton, button); } QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); layout->addWidget(spacer); setLayout(mainLayout); }
KMSpecialPrinterDlg::KMSpecialPrinterDlg(QWidget *parent, const char *name) : KDialogBase(parent, name, true, QString::null, Ok|Cancel, Ok) { setCaption(i18n("Add Special Printer")); QWidget *dummy = new QWidget(this); setMainWidget(dummy); // widget creation m_name = new QLineEdit(dummy); connect(m_name, SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString & ))); m_description = new QLineEdit(dummy); m_location = new QLineEdit(dummy); QLabel *m_namelabel = new QLabel(i18n("&Name:"), dummy); QLabel *m_desclabel = new QLabel(i18n("&Description:"), dummy); QLabel *m_loclabel = new QLabel(i18n("&Location:"), dummy); m_namelabel->setBuddy(m_name); m_desclabel->setBuddy(m_description); m_loclabel->setBuddy(m_location); KSeparator* sep = new KSeparator( KSeparator::HLine, dummy); sep->setFixedHeight(10); QGroupBox *m_gb = new QGroupBox(1, Qt::Horizontal, i18n("Command &Settings"), dummy); m_command = new KXmlCommandSelector(true, m_gb, "CommandSelector", this); QGroupBox *m_outfile_gb = new QGroupBox( 0, Qt::Horizontal, i18n( "Outp&ut File" ), dummy ); m_usefile = new QCheckBox( i18n("&Enable output file"), m_outfile_gb); m_mimetype = new QComboBox(m_outfile_gb); KMimeType::List list = KMimeType::allMimeTypes(); for (QValueList<KMimeType::Ptr>::ConstIterator it=list.begin(); it!=list.end(); ++it) { QString mimetype = (*it)->name(); m_mimelist << mimetype; } m_mimelist.sort(); m_mimetype->insertStringList(m_mimelist); QLabel *m_mimetypelabel = new QLabel(i18n("&Format:"), m_outfile_gb); m_mimetypelabel->setBuddy (m_mimetype); m_extension = new QLineEdit(m_outfile_gb); QLabel *m_extensionlabel = new QLabel(i18n("Filename e&xtension:"), m_outfile_gb); m_extensionlabel->setBuddy(m_extension); m_icon = new KIconButton(dummy); m_icon->setIcon("fileprint"); m_icon->setFixedSize(QSize(48,48)); connect( m_usefile, SIGNAL( toggled( bool ) ), m_mimetype, SLOT( setEnabled( bool ) ) ); connect( m_usefile, SIGNAL( toggled( bool ) ), m_extension, SLOT( setEnabled( bool ) ) ); connect( m_usefile, SIGNAL( toggled( bool ) ), m_mimetypelabel, SLOT( setEnabled( bool ) ) ); connect( m_usefile, SIGNAL( toggled( bool ) ), m_extensionlabel, SLOT( setEnabled( bool ) ) ); m_mimetypelabel->setEnabled( false ); m_mimetype->setEnabled( false ); m_extensionlabel->setEnabled( false ); m_extension->setEnabled( false ); QWhatsThis::add(m_usefile, i18n("<p>The command will use an output file. If checked, make sure the " "command contains an output tag.</p>")); QWhatsThis::add(m_command, i18n("<p>The command to execute when printing on this special printer. Either enter " "the command to execute directly, or associate/create a command object with/for " "this special printer. The command object is the preferred method as it provides " "support for advanced settings like mime type checking, configurable options and " "requirement list (the plain command is only provided for backward compatibility). " "When using a plain command, the following tags are recognized:</p>" "<ul><li><b>%in</b>: the input file (required).</li>" "<li><b>%out</b>: the output file (required if using an output file).</li>" "<li><b>%psl</b>: the paper size in lower case.</li>" "<li><b>%psu</b>: the paper size with the first letter in upper case.</li></ul>")); QString mimetypeWhatsThis = i18n("<p>The default mimetype for the output file (e.g. application/postscript).</p>"); QWhatsThis::add(m_mimetypelabel, mimetypeWhatsThis); QWhatsThis::add(m_mimetype, mimetypeWhatsThis); QString extensionWhatsThis = i18n("<p>The default extension for the output file (e.g. ps, pdf, ps.gz).</p>"); QWhatsThis::add(m_extensionlabel, extensionWhatsThis); QWhatsThis::add(m_extension, extensionWhatsThis); // layout creation QVBoxLayout *l0 = new QVBoxLayout(dummy, 0, 10); QGridLayout *l1 = new QGridLayout(0, 3, 3, 0, 5); l0->addLayout(l1); l1->setColStretch(2,1); l1->addColSpacing(0,60); l1->addMultiCellWidget(m_icon, 0, 2, 0, 0, Qt::AlignCenter); l1->addWidget(m_namelabel, 0, 1); l1->addWidget(m_desclabel, 1, 1); l1->addWidget(m_loclabel, 2, 1); l1->addWidget(m_name, 0, 2); l1->addWidget(m_description, 1, 2); l1->addWidget(m_location, 2, 2); l0->addWidget(sep); l0->addWidget(m_gb); l0->addWidget(m_outfile_gb); QGridLayout *l6 = new QGridLayout(m_outfile_gb->layout(), 3, 2, 10); l6->addMultiCellWidget( m_usefile, 0, 0, 0, 1 ); l6->addWidget(m_mimetypelabel, 1, 0); l6->addWidget(m_mimetype, 1, 1); l6->addWidget(m_extensionlabel, 2, 0); l6->addWidget(m_extension, 2, 1); enableButton(Ok, !m_name->text().isEmpty()); // resize dialog resize(400,100); }
KPCopiesPage::KPCopiesPage(KPrinter *prt, QWidget *parent, const char *name) : KPrintDialogPage(parent,name) { //WhatsThis strings.... (added by [email protected]) QString whatsThisPageSelectionLabel = i18n( " <qt><p><b>Page Selection</b></p> " " <p>Here you can control if you print a certain selection only out of all" " the pages from the complete document." " </p>" " </qt>" ); QString whatsThisAllPagesLabel = i18n( " <qt><b>All Pages:</b> Select \"All\" to print the complete document." " Since this is the default, it is pre-selected." " </p>" " </qt>" ); QString whatsThisCurrentPagesLabel = i18n( " <qt><b>Current Page:</b> Select <em>\"Current\"</em> if you want " " to print the page currently visible in your KDE application.</p>" " <p><b>Note:</b> this field is disabled if you print from" " non-KDE applications like Mozilla or OpenOffice.org, since here KDEPrint has no" " means to determine which document page you are currently viewing.</p></qt>" ); QString whatsThisPageRangeLabel = i18n( " <qt><b>Page Range:</b> Choose a \"Page Range\" to select a subset of the" " complete document pages" " to be printed. The format is <em>\"n,m,o-p,q,r,s-t, u\"</em>.</p>" " <p><b>Example:</b> <em>\"4,6,10-13,17,20,23-25\"</em> will print" " the pages 4, 6, 10, 11, 12, 13, 17, 20, 23, 24, 25 of your document.</p>" " <br> " " <hr> " " <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches " " with the CUPS commandline job option parameter:</em> " " <pre>" " -o page-ranges=... # example: \"4,6,10-13,17,20,23-25\" " " </pre>" " </p> " "</qt>" ); QString whatsThisPageSetLabel = i18n( " <qt><b>Page Set:</b>" " <p>Choose <em>\"All Pages\"</em>, <em>\"Even Pages\"</em> or" " <em>\"Odd Pages\"</em>" " if you want to print a page selection matching one of these terms. The default" " is <em>\"All Pages\"</em>.</p>" " <p><b>Note:</b> If you combine a selection of a <em>\"Page Range\"</em> with a" " <em>\"Page Set\"</em> of <em>\"Odd\"</em> or <em>\"Even\"</em>, you will only get the" " odd or even pages from the originally selected page range. This is useful if you" " odd or even pages from the originally selected page range. This is useful if you" " want to print a page range in duplex on a simplex-only printer. In this case you" " can feed the paper to the printer twice; in the first pass, select \"Odd\" or" " \"Even\" (depending on your printer model), in second pass select the other" " option. You may need to <em>\"Reverse\"</em> the output in one of the passes (depending" " on your printer model).</p> " " <br> " " <hr> " " <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches " " with the CUPS commandline job option parameter:</em> " " <pre>" " -o page-set=... # example: \"odd\" or \"even\" " " </pre>" " </p> " " </qt>" ); QString whatsThisCopiesLabel = i18n( " <qt><b>Output Settings:</b>" " Here you can determine the number of copies, the output order and the collate" " mode for the pages of your printjob. (Note, that the maximum number of copies " " allowed to print may be restricted by your print subsystem.)</p>" " <p>The 'Copies' setting defaults to 1. </p> " " <br> " " <hr> " " <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches " " with the CUPS commandline job option parameter:</em> " " <pre>" " -o copies=... # examples: \"5\" or \"42\" " " <br> " " -o outputorder=... # example: \"reverse\"" " <br> " " -o Collate=... # example: \"true\" or \"false\" " " </pre>" " </p> " ".</qt>" ); QString whatsThisNumberOfCopiesLabel = i18n( " <qt><b>Number of Copies:</b> Determine the number of requested copies here." " You can increase or decrease" " the number of printed copies by clicking on the up and down arrows. You can also type the figure" " directly into the box. </p>" " <br> " " <hr> " " <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches " " with the CUPS commandline job option parameter:</em> " " <pre>" " -o copies=... # examples: \"5\" or \"42\" " " </pre>" " </p> " " </qt>" ); QString whatsThisCollateLabel = i18n( " <qt><b>Collate Copies</b>" " <p>If the <em>\"Collate\"</em> checkbox is enabled (default), the output order for" " multiple copies of a multi-page document will be \"1-2-3-..., 1-2-3-..., 1-2-3-...\".</p>" " <p>If the <em>\"Collate\"</em> checkbox is disabled, the output order for" " multiple copies of a multi-page document will be \"1-1-1-..., 2-2-2-..., 3-3-3-...\".</p>" " <br> " " <hr> " " <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches " " with the CUPS commandline job option parameter:</em> " " <pre>" " -o Collate=... # example: \"true\" or \"false\" " " </pre>" " </p> " " </qt>" ); QString whatsThisReverseLabel = i18n( " <qt><b>Reverse Order</b>" " <p> If the <em>\"Reverse\"</em> checkbox is enabled, the output order for" " multiple copies of a multi-page document will be \"...-3-2-1, ...-3-2-1, ...-3-2-1\", if you" " also have <em>en</em>abled the <em>\"Collate\"</em> checkbox at the same time" " (the usual usecase).</p>" " <p>If the <em>\"Reverse\"</em> checkbox is enabled, the output order for" " multiple copies of a multi-page document will be \"...-3-3-3, ...-2-2-2, ...-1-1-1\", if you" " have <em>dis</em>abled the <em>\"Collate\"</em> checkbox at the same time. </p>" " <br> " " <hr> " " <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches " " with the CUPS commandline job option parameter:</em> " " <pre>" " -o outputorder=... # example: \"reverse\"" " " " </pre>" " </p> " " </qt>" ); m_printer = prt; m_useplugin = true; setTitle(i18n("C&opies")); setId(KPrinter::CopiesPage); // widget creation QButtonGroup *m_pagebox = new QButtonGroup(0, Qt::Vertical, i18n("Page Selection"), this); QWhatsThis::add(m_pagebox, whatsThisPageSelectionLabel); m_all = new QRadioButton(i18n("&All"), m_pagebox); QWhatsThis::add(m_all, whatsThisAllPagesLabel); m_current = new QRadioButton(i18n("Cu&rrent"), m_pagebox); QWhatsThis::add(m_current, whatsThisCurrentPagesLabel); m_range = new QRadioButton(i18n("Ran&ge"), m_pagebox); QWhatsThis::add(m_range, whatsThisPageRangeLabel); m_rangeedit = new QLineEdit(m_pagebox); QWhatsThis::add(m_rangeedit, whatsThisPageRangeLabel); connect(m_range, SIGNAL(clicked()), m_rangeedit, SLOT(setFocus())); QToolTip::add(m_rangeedit, i18n("<p>Enter pages or group of pages to print separated by commas (1,2-5,8).</p>")); // QWhatsThis::add(m_rangeedit, i18n("<p>Enter pages or group of pages to print separated by commas (1,2-5,8).</p>")); //QLabel *m_rangeexpl = new QLabel(m_pagebox); //m_rangeexpl->setText(i18n("<p>Enter pages or group of pages to print separated by commas (1,2-5,8).</p>")); QGroupBox *m_copybox = new QGroupBox(0, Qt::Vertical, i18n("Output Settings"), this); QWhatsThis::add(m_copybox, whatsThisCopiesLabel); m_collate = new QCheckBox(i18n("Co&llate"), m_copybox); QWhatsThis::add(m_collate, whatsThisCollateLabel); m_order = new QCheckBox(i18n("Re&verse"), m_copybox); QWhatsThis::add(m_order, whatsThisReverseLabel); m_collatepix = new QLabel(m_copybox); m_collatepix->setAlignment(Qt::AlignCenter); m_collatepix->setMinimumHeight(70); QLabel *m_copieslabel = new QLabel(i18n("Cop&ies:"), m_copybox); m_copies = new QSpinBox(m_copybox); m_copies->setRange(1,999); QWhatsThis::add(m_copies, whatsThisNumberOfCopiesLabel); m_copieslabel->setBuddy(m_copies); QWhatsThis::add(m_copieslabel, whatsThisNumberOfCopiesLabel); m_pageset = new QComboBox(m_pagebox); m_pageset->insertItem(i18n("All Pages")); m_pageset->insertItem(i18n("Odd Pages")); m_pageset->insertItem(i18n("Even Pages")); QWhatsThis::add(m_pageset, whatsThisPageSetLabel); QLabel *m_pagesetlabel = new QLabel(i18n("Page &set:"), m_pagebox); m_pagesetlabel->setBuddy(m_pageset); QWhatsThis::add(m_pagesetlabel, whatsThisPageSetLabel); KSeparator *sepline = new KSeparator(Horizontal, m_pagebox); sepline->setMinimumHeight(10); QWidget::setTabOrder( m_all, m_current ); QWidget::setTabOrder( m_current, m_range ); QWidget::setTabOrder( m_range, m_rangeedit ); QWidget::setTabOrder( m_rangeedit, m_pageset ); QWidget::setTabOrder( m_pageset, m_copies ); QWidget::setTabOrder( m_copies, m_collate ); QWidget::setTabOrder( m_collate, m_order ); // layout creation QGridLayout *l1 = new QGridLayout(this, 2, 2, 0, 5); l1->setRowStretch(1,1); l1->setColStretch(0,1); l1->setColStretch(1,1); l1->addWidget(m_pagebox,0,0); l1->addWidget(m_copybox,0,1); QVBoxLayout *l3 = new QVBoxLayout(m_pagebox->layout(), 5); l3->addWidget(m_all); l3->addWidget(m_current); QHBoxLayout *l4 = new QHBoxLayout(0, 0, 5); l3->addLayout(l4); l4->addWidget(m_range,0); l4->addWidget(m_rangeedit,1); //l3->addWidget(m_rangeexpl); l3->addWidget(sepline); QHBoxLayout *l2 = new QHBoxLayout(0, 0, 5); l3->addLayout(l2); l2->addWidget(m_pagesetlabel,0); l2->addWidget(m_pageset,1); QGridLayout *l5 = new QGridLayout(m_copybox->layout(), 4, 2, 10); l5->setRowStretch(4,1); l5->addWidget(m_copieslabel,0,0); l5->addWidget(m_copies,0,1); l5->addMultiCellWidget(m_collatepix,1,2,0,0); l5->addWidget(m_collate,1,1); l5->addWidget(m_order,2,1); // some initialization m_all->setChecked(true); m_copies->setValue(1); initialize(m_useplugin); slotCollateClicked(); // connections connect(m_rangeedit,SIGNAL(textChanged(const QString&)),SLOT(slotRangeEntered())); connect(m_collate,SIGNAL(clicked()),SLOT(slotCollateClicked())); connect(m_order,SIGNAL(clicked()),SLOT(slotCollateClicked())); if (!kapp->authorize("print/copies")) { setTitle(i18n("Pages")); m_copybox->hide(); } }
KMWizard::KMWizard(TQWidget *parent, const char *name) : TQDialog(parent,name,true) { m_start = KMWizard::Start; m_end = KMWizard::End; m_inclusive = true; m_printer = new KMPrinter(); m_pagepool.setAutoDelete(false); m_stack = new TQWidgetStack(this); m_next = new KPushButton(i18n("&Next >"), this); m_next->setDefault(true); m_prev = new KPushButton(i18n("< &Back"), this); TQPushButton *m_cancel = new KPushButton(KStdGuiItem::cancel(), this); m_title = new TQLabel(this); TQFont f(m_title->font()); f.setBold(true); m_title->setFont(f); KSeparator* sep = new KSeparator( KSeparator::HLine, this); sep->setFixedHeight(5); KSeparator* sep2 = new KSeparator( KSeparator::HLine, this); TQPushButton *m_help = new KPushButton(KStdGuiItem::help(), this); connect(m_cancel,TQT_SIGNAL(clicked()),TQT_SLOT(reject())); connect(m_next,TQT_SIGNAL(clicked()),TQT_SLOT(slotNext())); connect(m_prev,TQT_SIGNAL(clicked()),TQT_SLOT(slotPrev())); connect(m_help, TQT_SIGNAL(clicked()), TQT_SLOT(slotHelp())); m_side = new SidePixmap(this); if (!m_side->isValid()) { delete m_side; m_side = 0; } // layout TQVBoxLayout *main0_ = new TQVBoxLayout(this, 10, 10); TQVBoxLayout *main_ = new TQVBoxLayout(0, 0, 0); TQHBoxLayout *main1_ = new TQHBoxLayout(0, 0, 10); TQHBoxLayout *btn_ = new TQHBoxLayout(0, 0, 10); main0_->addLayout(main1_); if (m_side) main1_->addWidget(m_side); main1_->addLayout(main_); main_->addWidget(m_title); main_->addWidget(sep); main_->addSpacing(10); main_->addWidget(m_stack,1); main0_->addWidget(sep2); main0_->addLayout(btn_); btn_->addWidget(m_help); btn_->addStretch(1); btn_->addWidget(m_prev); btn_->addWidget(m_next); btn_->addWidget(m_cancel); // create standard pages addPage(new KMWInfoPage(this)); m_backend = new KMWBackend(this); addPage(m_backend); addPage(new KMWPassword(this)); addPage(new KMWSocket(this)); addPage(new KMWDriver(this)); addPage(new KMWDriverSelect(this)); addPage(new KMWDriverTest(this)); addPage(new KMWName(this)); addPage(new KMWEnd(this)); addPage(new KMWClass(this)); addPage(new KMWLpd(this)); addPage(new KMWFile(this)); addPage(new KMWSmb(this)); addPage(new KMWLocal(this)); // add other pages KMFactory::self()->uiManager()->setupWizard(this); setCurrentPage(m_start,false); setCaption(i18n("Add Printer Wizard")); resize(400,350); }
KrResultTableDialog::KrResultTableDialog(QWidget *parent, DialogType type, const QString& caption, const QString& heading, const QString& headerIcon, const QString& hint) : QDialog(parent, 0) { setWindowTitle(caption); setWindowModality(Qt::WindowModal); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QVBoxLayout *_topLayout = new QVBoxLayout(); _topLayout->setAlignment(Qt::AlignTop); // +++ Heading +++ // prepare the icon QWidget *_iconWidget = new QWidget(this); QHBoxLayout * _iconBox = new QHBoxLayout(_iconWidget); QLabel *_iconLabel = new QLabel(_iconWidget); _iconLabel->setPixmap(krLoader->loadIcon(headerIcon, KIconLoader::Desktop, 32)); _iconLabel->setMinimumWidth(fontMetrics().maxWidth()*20); _iconLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _iconLabel->setFixedSize(_iconLabel->sizeHint()); _iconBox->addWidget(_iconLabel); QLabel *_headingLabel = new QLabel(heading, _iconWidget); QFont defFont = QFontDatabase::systemFont(QFontDatabase::GeneralFont); defFont.setBold(true); _headingLabel->setFont(defFont); _headingLabel->setIndent(10); _iconBox->addWidget(_headingLabel); _topLayout->addWidget(_iconWidget); // +++ Add some space between heading and table +++ QSpacerItem* hSpacer1 = new QSpacerItem(0, 5); _topLayout->addItem(hSpacer1); // +++ Table +++ switch (type) { case Archiver: _resultTable = new KrArchiverResultTable(this); helpAnchor = QStringLiteral("konfig-archives"); // launch handbook at sect1-id via help button break; case Tool: _resultTable = new KrToolResultTable(this); helpAnchor = QStringLiteral("konfig-dependencies"); // TODO find a good anchor break; default: break; } _topLayout->addWidget(_resultTable); // +++ Separator +++ KSeparator* hSep = new KSeparator(Qt::Horizontal, this); hSep->setContentsMargins(5, 5, 5, 5); _topLayout->addWidget(hSep); // +++ Hint +++ if (!hint.isEmpty()) { QLabel *_hintLabel = new QLabel(hint, this); _hintLabel->setIndent(5); _hintLabel->setAlignment(Qt::AlignRight); _topLayout->addWidget(_hintLabel); } mainLayout->addLayout(_topLayout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Help); mainLayout->addWidget(buttonBox); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &KrResultTableDialog::accept); connect(buttonBox, &QDialogButtonBox::helpRequested, this, &KrResultTableDialog::showHelp); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); this->setFixedSize(this->sizeHint()); // make non-resizeable }
void kiptablesgenerator::setupNewServiceDialog() { newServiceDialog = new KDialogBase(this, 0, true, i18n("Add Service"), KDialogBase::Ok | KDialogBase::Cancel); QFrame *dialogArea = new QFrame(newServiceDialog); QGridLayout *layout = new QGridLayout(dialogArea, 7, 2); QLabel *intro = new QLabel(i18n( "<p><i>Advanced users only</i></p>" "<p>Here you can allow or deny access to services through your firewall.<br />" "You can specify a port range in the box using this format: <tt>fromPort:toPort</tt></p>"), dialogArea); intro->show(); layout->addMultiCellWidget(intro, 0, 0, 0, 1); QLabel *protocolLabel = new QLabel(i18n("&Protocol: "), dialogArea); protocolLabel->show(); layout->addWidget(protocolLabel, 1, 0); KComboBox *protocols = new KComboBox(dialogArea); protocols->insertItem(i18n("TCP")); protocols->insertItem(i18n("UDP")); protocols->insertItem(i18n("TCP & UDP")); protocols->insertItem(i18n("ICMP")); protocols->setCurrentItem(2); protocols->show(); layout->addWidget(protocols, 1, 1); protocolLabel->setBuddy(protocols); namedWidgets["newService_protocols"] = protocols; connect(protocols, SIGNAL(activated(int )), this, SLOT(slotChangedProtocol(int ))); QLabel *selectByLabel = new QLabel(i18n("Select service by: "), dialogArea); selectByLabel->show(); layout->addMultiCellWidget(selectByLabel, 2, 2, 0, 1); QButtonGroup *optNamedOrNumbered = new QButtonGroup(dialogArea); optNamedOrNumbered->hide(); namedWidgets["newService_namedOrNumbered"] = optNamedOrNumbered; QRadioButton *optNamed = new QRadioButton(i18n("&Name: "), dialogArea); optNamed->setChecked(true); optNamed->setName("named"); optNamedOrNumbered->insert(optNamed); optNamed->show(); layout->addWidget(optNamed, 3, 0); namedWidgets["newService_named"] = optNamed; KComboBox *names = new KComboBox(dialogArea); names->show(); layout->addWidget(names, 3, 1); namedWidgets["newService_names"] = names; QRadioButton *optNumbered = new QRadioButton(i18n("&Port number(s): "), dialogArea); optNumbered->setName("numbered"); optNamedOrNumbered->insert(optNumbered); optNumbered->show(); layout->addWidget(optNumbered, 4, 0); namedWidgets["newService_numbered"] = optNumbered; KLineEdit *ports = new KLineEdit(dialogArea); ports->show(); layout->addWidget(ports, 4, 1); namedWidgets["newService_ports"] = ports; QButtonGroup *optAllowDeny = new QButtonGroup(dialogArea); optAllowDeny->hide(); namedWidgets["newService_allowDeny"] = optAllowDeny; KSeparator *separator = new KSeparator(dialogArea); separator->show(); layout->addMultiCellWidget(separator, 5, 5, 0, 1); QRadioButton *optAllow = new QRadioButton(i18n("&Accept"), dialogArea); optAllow->setName(i18n("Accept")); optAllow->setChecked(true); optAllow->show(); optAllowDeny->insert(optAllow); layout->addWidget(optAllow, 6, 0); QRadioButton *optDeny = new QRadioButton(i18n("&Drop"), dialogArea); optDeny->setName(i18n("Drop")); optDeny->show(); optAllowDeny->insert(optDeny); layout->addWidget(optDeny, 6, 1); dialogArea->show(); newServiceDialog->setMainWidget(dialogArea); connect(newServiceDialog, SIGNAL(okClicked()), this, SLOT(slotAddService())); slotChangedProtocol(2); // TCP+UDP }