Konfigurator::Konfigurator(bool f, int startPage) : KPageDialog((QWidget *)0), firstTime(f), internalCall(false), sizeX(-1), sizeY(-1) { setWindowTitle(i18n("Konfigurator - Creating Your Own Krusader")); setWindowModality(Qt::ApplicationModal); setFaceType(KPageDialog::List); setStandardButtons(QDialogButtonBox::Help|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Close| QDialogButtonBox::Apply|QDialogButtonBox::Reset); button(QDialogButtonBox::Apply)->setDefault(true); connect(button(QDialogButtonBox::Close), SIGNAL(clicked()), SLOT(slotClose())); connect(button(QDialogButtonBox::Help), SIGNAL(clicked()), SLOT(slotShowHelp())); connect(button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), SLOT(slotRestoreDefaults())); connect(button(QDialogButtonBox::Reset), SIGNAL(clicked()), SLOT(slotReset())); connect(button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(slotApply())); connect(this, SIGNAL(currentPageChanged(KPageWidgetItem *, KPageWidgetItem *)), this, SLOT(slotPageSwitch(KPageWidgetItem *, KPageWidgetItem *))); connect(&restoreTimer, SIGNAL(timeout()), this, SLOT(slotRestorePage())); createLayout(startPage); KConfigGroup group(krConfig, "Konfigurator"); int sx = group.readEntry("Window Width", -1); int sy = group.readEntry("Window Height", -1); if (sx != -1 && sy != -1) resize(sx, sy); else resize(900, 680); if (group.readEntry("Window Maximized", false)) showMaximized(); else show(); }
KoPAConfigureDialog::KoPAConfigureDialog(KoPAView* parent) : KPageDialog(parent) { setFaceType(List); setWindowTitle(i18n("Configure")); setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults); button(QDialogButtonBox::Ok)->setDefault(true); m_miscPage = new KoConfigMiscPage( parent->koDocument(), parent->kopaCanvas()->shapeController()->resourceManager() ); KPageWidgetItem *item = addPage( m_miscPage, i18n( "Misc" ) ); item->setHeader( i18n( "Misc" ) ); item->setIcon(koIcon("preferences-other")); m_gridPage = new KoConfigGridPage(parent->koDocument()); item = addPage(m_gridPage, i18n("Grid")); item->setHeader(i18n("Grid")); item->setIcon(koIcon("grid")); connect(m_miscPage, SIGNAL(unitChanged(KoUnit)), m_gridPage, SLOT(slotUnitChanged(KoUnit))); m_docPage = new KoConfigDocumentPage( parent->koDocument() ); item = addPage( m_docPage, i18nc( "@title:tab Document settings page", "Document" ) ); item->setHeader( i18n( "Document Settings" ) ); item->setIcon(koIcon("document-properties")); m_authorPage = new KoConfigAuthorPage(); item = addPage(m_authorPage, i18nc("@title:tab Author page", "Author")); item->setHeader(i18n("Author")); item->setIcon(koIcon("user-identity")); connect( this, SIGNAL(accepted()), this, SLOT(slotApply()) ); connect( button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked(bool)), this, SLOT(slotDefault())); connect( button(QDialogButtonBox::Apply), SIGNAL(clicked(bool)), this, SLOT(slotApply()) ); connect(this, SIGNAL(changed()), parent, SLOT(slotUpdateAuthorProfileActions())); }
QIDialogButtonBox::QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation, QWidget *aParent) : QIWithRetranslateUI<QDialogButtonBox> (aParent) { setOrientation (aOrientation); setStandardButtons (aButtons); retranslateUi(); }
void EnterVacationDialog::createEvents() { const EventList events = createEventList( m_ui->startDate->date(), m_ui->endDate->date().addDays( 1 ), m_ui->hoursSpinBox->value() * 60 + m_ui->minutesSpinBox->value(), m_selectedTaskId ); QDialog confirmationDialog( this ); auto layout = new QVBoxLayout( &confirmationDialog ); auto label = new QLabel( tr( "The following vacation events will be created." ) ); label->setWordWrap( true ); layout->addWidget( label ); auto textBrowser = new QTextBrowser; layout->addWidget( textBrowser ); auto box = new QDialogButtonBox; box->setStandardButtons( QDialogButtonBox::Ok|QDialogButtonBox::Cancel ); box->button(QDialogButtonBox::Ok)->setText(tr("Create")); connect( box, SIGNAL(accepted()), &confirmationDialog, SLOT(accept()) ); connect( box, SIGNAL(rejected()), &confirmationDialog, SLOT(reject()) ); layout->addWidget( box ); const QString startDate = m_ui->startDate->date().toString( Qt::TextDate ); const QString endDate = m_ui->endDate->date().toString( Qt::TextDate ); const Task task = DATAMODEL->getTask( m_selectedTaskId ); const QString htmlStartDate = toHtmlEscaped( startDate ); const QString htmlEndDate = toHtmlEscaped( endDate ); const QString htmlTaskName = toHtmlEscaped( task.name() ); QString html = "<html><body>"; html += QString::fromLatin1("<h1>%1</h1>").arg( tr("Vacation")); html += QString::fromLatin1("<h3>%1</h3>").arg( tr("From %1 to %2").arg( htmlStartDate, htmlEndDate ) ); html += QString::fromLatin1("<h4>%1</h4>").arg( tr("Task used: %1").arg( htmlTaskName ) ); html += "<p>"; Q_FOREACH ( const Event& event, events ) { const QDate eventStart = event.startDateTime().date(); const QDate eventEnd = event.endDateTime().date(); Q_ASSERT( eventStart == eventEnd ); Q_UNUSED( eventEnd ) //release mode const QString shortDate = eventStart.toString( Qt::DefaultLocaleShortDate ); const QString duration = formatDuration( event.startDateTime(), event.endDateTime() ); const QString htmlShortDate = toHtmlEscaped( shortDate ); const QString htmlDuration = toHtmlEscaped( duration ); html += QString::fromLatin1("%1").arg( tr( "%1: %3", "short date, duration" ).arg( htmlShortDate, htmlDuration ) ); html += "</p><p>"; } html += "</p>"; html += "</body></html>"; textBrowser->setHtml( html ); confirmationDialog.resize( 400, 600 ); if ( confirmationDialog.exec() == QDialog::Accepted ) m_events = events; }
void QMdMessageBox::exec(const QString &text,const QString &informtext, Icon icon,StandardButton buttons, StandardButton defbutton) { setText(text); setInformativeText(informtext); setIcon(icon); setStandardButtons(buttons); setDefaultButton(defbutton); QMessageBox::exec(); }
KWPageSettingsDialog::KWPageSettingsDialog(QWidget *parent, KWDocument *document, const KWPage &page) : KoPageLayoutDialog(parent, page.pageStyle().pageLayout()), m_document(document), m_page(page), m_pageStyle(page.pageStyle()) { Q_ASSERT(document); setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel); connect(buttonBox(), SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*))); showUnitchooser(true); Q_ASSERT(page.isValid()); m_columns = new KWDocumentColumns(this, m_page.pageStyle().columns()); KPageWidgetItem *columnsPage = addPage(m_columns, i18n("Columns")); QWidget *pageStyleWidget = new QWidget(this); QHBoxLayout *pageStyleLayout = new QHBoxLayout(pageStyleWidget); pageStyleLayout->setMargin(0); KPageWidgetItem *stylePage = addPage(pageStyleWidget, i18n("Style")); m_pageStylesView = new QListWidget(this); pageStyleLayout->addWidget(m_pageStylesView, 1); connect(m_pageStylesView, SIGNAL(currentRowChanged(int)), this, SLOT(pageStyleCurrentRowChanged(int))); QVBoxLayout *pageStyleLayout2 = new QVBoxLayout(); pageStyleLayout->addLayout(pageStyleLayout2); m_clonePageStyleButton = new QPushButton(i18n("Clone"), pageStyleWidget); connect(m_clonePageStyleButton, SIGNAL(clicked()), this, SLOT(pageStyleCloneClicked())); pageStyleLayout2->addWidget(m_clonePageStyleButton); m_deletePageStyleButton = new QPushButton(i18n("Delete"), pageStyleWidget); connect(m_deletePageStyleButton, SIGNAL(clicked()), this, SLOT(pageStyleDeleteClicked())); pageStyleLayout2->addWidget(m_deletePageStyleButton); pageStyleLayout2->addStretch(); foreach(KPageWidgetItem *item, QList<KPageWidgetItem*>() << columnsPage << stylePage) m_pages[item->name()] = item; reloadPageStyles(); showPageSpread(false); //TODO better would be allow n pages to face rather then only 2 showTextDirection(true); // TODO can we hide this in selected usecases? Use the resource manager bidi-check maybe? //showApplyToDocument(true); // TODO uncommand when we can handle it. #if 0 bool simpleSetup = m_document->pageCount() == 1 || (m_document->pageCount() == 2 && page.pageSide() == KWPage::PageSpread); if (!simpleSetup) { // if there is one style, its still a simple doc bool onlyOneStyle = true; foreach (const KWPage &p, m_document->pageManager()->pages()) { if (p.pageStyle() != m_page.pageStyle()) { onlyOneStyle = false; break; } } if (onlyOneStyle) simpleSetup = true; }
int QMessageBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: buttonClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break; case 1: d_func()->_q_buttonClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break; default: ; } _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = text(); break; case 1: *reinterpret_cast< Icon*>(_v) = icon(); break; case 2: *reinterpret_cast< QPixmap*>(_v) = iconPixmap(); break; case 3: *reinterpret_cast< Qt::TextFormat*>(_v) = textFormat(); break; case 4: *reinterpret_cast<int*>(_v) = QFlag(standardButtons()); break; case 5: *reinterpret_cast< QString*>(_v) = detailedText(); break; case 6: *reinterpret_cast< QString*>(_v) = informativeText(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setText(*reinterpret_cast< QString*>(_v)); break; case 1: setIcon(*reinterpret_cast< Icon*>(_v)); break; case 2: setIconPixmap(*reinterpret_cast< QPixmap*>(_v)); break; case 3: setTextFormat(*reinterpret_cast< Qt::TextFormat*>(_v)); break; case 4: setStandardButtons(QFlag(*reinterpret_cast<int*>(_v))); break; case 5: setDetailedText(*reinterpret_cast< QString*>(_v)); break; case 6: setInformativeText(*reinterpret_cast< QString*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
KoDocumentInfoDlg::KoDocumentInfoDlg(QWidget* parent, KoDocumentInfo* docInfo) : KPageDialog(parent) , d(new KoDocumentInfoDlgPrivate) { d->info = docInfo; setWindowTitle(i18n("Document Information")); // setInitialSize(QSize(500, 500)); setFaceType(KPageDialog::List); setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); button(QDialogButtonBox::Ok)->setDefault(true); d->aboutUi = new Ui::KoDocumentInfoAboutWidget(); QWidget *infodlg = new QWidget(); d->aboutUi->setupUi(infodlg); d->aboutUi->cbLanguage->addItems(KoGlobal::listOfLanguages()); d->aboutUi->cbLanguage->setCurrentIndex(-1); KPageWidgetItem *page = new KPageWidgetItem(infodlg, i18n("General")); page->setHeader(i18n("General")); // Ugly hack, the mimetype should be a parameter, instead KoDocumentBase* doc = dynamic_cast< KoDocumentBase* >(d->info->parent()); if (doc) { QMimeDatabase db; QMimeType mime = db.mimeTypeForName(doc->mimeType()); if (mime.isValid()) { page->setIcon(KisIconUtils::loadIcon(mime.iconName())); } } else { // hide all entries not used in pages for KoDocumentInfoPropsPage d->aboutUi->filePathInfoLabel->setVisible(false); d->aboutUi->filePathLabel->setVisible(false); d->aboutUi->filePathSeparatorLine->setVisible(false); d->aboutUi->lblTypeDesc->setVisible(false); d->aboutUi->lblType->setVisible(false); } addPage(page); d->pages.append(page); initAboutTab(); d->authorUi = new Ui::KoDocumentInfoAuthorWidget(); QWidget *authordlg = new QWidget(); d->authorUi->setupUi(authordlg); page = new KPageWidgetItem(authordlg, i18n("Author")); page->setHeader(i18n("Last saved by")); page->setIcon(koIcon("user-identity")); addPage(page); d->pages.append(page); initAuthorTab(); }
WMessageBox::WMessageBox(const WString& caption, const WString& text, Icon icon, WFlags<StandardButton> buttons) : WDialog(caption), icon_(Icon::None), defaultButton_(nullptr), escapeButton_(nullptr) { create(); setText(text); setIcon(icon); setStandardButtons(buttons); }
int QDialogButtonBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: clicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break; case 1: accepted(); break; case 2: helpRequested(); break; case 3: rejected(); break; case 4: d_func()->_q_handleButtonClicked(); break; case 5: d_func()->_q_handleButtonDestroyed(); break; default: ; } _id -= 6; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break; case 1: *reinterpret_cast<int*>(_v) = QFlag(standardButtons()); break; case 2: *reinterpret_cast< bool*>(_v) = centerButtons(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break; case 1: setStandardButtons(QFlag(*reinterpret_cast<int*>(_v))); break; case 2: setCenterButtons(*reinterpret_cast< bool*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
FSSM_WaitMsgBox::FSSM_WaitMsgBox(QWidget *parent, const QString text, const QString title) : QMessageBox(QMessageBox::NoIcon, title, text + " ", QMessageBox::NoButton, parent) { _allow_close = false; _parent = parent; // Set buttons (Constructor parameter seems to be ignored. Qt-bug ???) setStandardButtons( QMessageBox::NoButton ); // Set font QFont newfont = font(); newfont.setPixelSize(13); // 10pts newfont.setBold( true ); setFont( newfont ); // Set icon: setIconPixmap( QPixmap( QString::fromUtf8(":/icons/oxygen/22x22/view-history.png") ) ); }
ConfigDialog::ConfigDialog( KActionCollection *collection , QWidget *parent ) : KConfigDialog( parent, QLatin1String( "PlayBar Settings" ), PlayBarSettings::self() ), m_generalPage( new GeneralWidget( this ) ) { setWindowTitle( i18n( "Configure PlayBar" ) ); m_shortcutsPage = new KShortcutsEditor( collection, this, KShortcutsEditor::GlobalAction ); setStandardButtons( QDialogButtonBox::Apply | QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); addPage( m_generalPage, i18nc( "General config", "General" ), "applications-multimedia", i18nc( "General config", "General" ) ); addPage( m_shortcutsPage, i18nc( "Shortcuts config", "Shortcuts" ), "configure-shortcuts", i18n( "Shortcuts Configuration" ) ); connect( this, SIGNAL( accepted() ), this, SLOT( updateSettings() ) ); QPushButton *apply = this->button( QDialogButtonBox::Apply ); connect( apply, SIGNAL( clicked() ), this, SLOT( updateSettings() ) ); connect( this, SIGNAL( finished( int ) ), this, SLOT( deleteLater() ) ); }
int QDialogButtonBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 6) qt_static_metacall(this, _c, _id, _a); _id -= 6; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break; case 1: *reinterpret_cast<int*>(_v) = QFlag(standardButtons()); break; case 2: *reinterpret_cast< bool*>(_v) = centerButtons(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break; case 1: setStandardButtons(QFlag(*reinterpret_cast<int*>(_v))); break; case 2: setCenterButtons(*reinterpret_cast< bool*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
ManagerSettingsDialog::ManagerSettingsDialog(QWidget* parent, QApt::Config *aptConfig) : KPageDialog(parent), m_aptConfig(aptConfig) { const QSize minSize = minimumSize(); setMinimumSize(QSize(512, minSize.height())); setFaceType(List); setWindowTitle(i18nc("@title:window", "Muon Preferences")); setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults); button(QDialogButtonBox::Apply)->setEnabled(false); // General settings GeneralSettingsPage *generalPage = new GeneralSettingsPage(this, m_aptConfig); KPageWidgetItem *generalSettingsFrame = addPage(generalPage, i18nc("@title:group Title of the general group", "General")); generalSettingsFrame->setIcon(QIcon::fromTheme("system-run")); connect(generalPage, SIGNAL(changed()), this, SLOT(changed())); connect(generalPage, SIGNAL(authChanged()), this, SLOT(authChanged())); m_pages.insert(generalPage); }
void WMessageBox::setButtons(WFlags<StandardButton> buttons) { setStandardButtons(buttons); }
bool AccessCert::download( bool noCard ) { if( noCard ) { QDesktopServices::openUrl( QUrl( tr("http://www.sk.ee/toend/") ) ); return false; } SslCertificate tempel( qApp->signer()->tokensign().cert() ); if( tempel.type() & SslCertificate::TempelType ) { setIcon( Information ); setText( tr("For getting server access certificate to Tempel contact <a href=\"mailto:[email protected]\">[email protected]</a>") ); return false; } setIcon( Information ); setText( tr("Hereby I agree to terms and conditions of validity confirmation service and " "will use the service in extent of 10 signatures per month. If you going to " "exceed the limit of 10 signatures per month or/and will use the service for " "commercial purposes, please refer to IT support of your company. Additional " "information is available from <a href=\"%1\">%1</a> or phone 1777") .arg( tr("http://www.id.ee/kehtivuskinnitus") ) ); setStandardButtons( Help ); QPushButton *agree = addButton( tr("Agree"), AcceptRole ); if( exec() == Help ) { QDesktopServices::openUrl( QUrl( tr("http://www.id.ee/kehtivuskinnitus") ) ); return false; } removeButton( agree ); QSigner *s = qApp->signer(); QPKCS11 *p = qobject_cast<QPKCS11*>(reinterpret_cast<QObject*>(s->handle())); #ifdef Q_OS_WIN QCNG *c = qobject_cast<QCNG*>(reinterpret_cast<QObject*>(s->handle())); if( !p && !c ) return false; #endif s->lock(); Qt::HANDLE key = 0; TokenData token; if( p ) { bool retry = false; do { retry = false; token.setCard( s->tokensign().card() ); Q_FOREACH( const TokenData &t, p->tokens() ) if( token.card() == t.card() && SslCertificate( t.cert() ).enhancedKeyUsage().contains( SslCertificate::ClientAuth ) ) token.setCert( t.cert() ); QPKCS11::PinStatus status = p->login( token ); switch( status ) { case QPKCS11::PinOK: break; case QPKCS11::PinCanceled: s->unlock(); return false; case QPKCS11::PinIncorrect: showWarning( QPKCS11::errorString( status ) ); retry = true; break; default: showWarning( tr("Error downloading server access certificate!") + "\n" + QPKCS11::errorString( status ) ); s->unlock(); return false; } } while( retry ); key = p->key(); } else {
DancingBarsSettings::DancingBarsSettings( QWidget* parent, const char* name ) : KPageDialog( parent ), mModel( new SensorModel( this ) ) { setFaceType( Tabbed ); setWindowTitle( i18n( "Edit BarGraph Preferences" ) ); setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); setObjectName( name ); setModal( false ); mModel->setHasLabel( true ); // Range page QFrame *page = new QFrame( this ); addPage( page, i18n( "Range" ) ); QGridLayout *pageLayout = new QGridLayout( page ); pageLayout->setMargin( 0 ); QGroupBox *groupBox = new QGroupBox( i18n( "Title" ), page ); QGridLayout *boxLayout = new QGridLayout; groupBox->setLayout( boxLayout ); mTitle = new QLineEdit( groupBox ); mTitle->setWhatsThis( i18n( "Enter the title of the display here." ) ); boxLayout->addWidget( mTitle, 0, 0 ); pageLayout->addWidget( groupBox, 0, 0 ); groupBox = new QGroupBox( i18n( "Display Range" ), page ); boxLayout = new QGridLayout; groupBox->setLayout( boxLayout ); boxLayout->setColumnStretch( 2, 1 ); QLabel *label = new QLabel( i18n( "Minimum value:" ), groupBox ); boxLayout->addWidget( label, 0, 0 ); mMinValue = new QDoubleSpinBox(groupBox); mMinValue->setRange(0, 10000); mMinValue->setSingleStep(0.5); mMinValue->setValue(0); mMinValue->setDecimals(2); mMinValue->setWhatsThis( i18n( "Enter the minimum value for the display here. If both values are 0, automatic range detection is enabled." ) ); boxLayout->addWidget( mMinValue, 0, 1 ); label->setBuddy( mMinValue ); label = new QLabel( i18n( "Maximum value:" ), groupBox ); boxLayout->addWidget( label, 0, 3 ); mMaxValue = new QDoubleSpinBox( groupBox); mMaxValue->setRange(0, 100); mMaxValue->setSingleStep(0.5); mMaxValue->setValue(100); mMaxValue->setDecimals(2); mMaxValue->setWhatsThis( i18n( "Enter the maximum value for the display here. If both values are 0, automatic range detection is enabled." ) ); boxLayout->addWidget( mMaxValue, 0, 4 ); label->setBuddy( mMaxValue ); pageLayout->addWidget( groupBox, 1, 0 ); pageLayout->setRowStretch( 2, 1 ); // Alarm page page = new QFrame( this ); addPage( page, i18n( "Alarms" ) ); pageLayout = new QGridLayout( page ); pageLayout->setMargin( 0 ); groupBox = new QGroupBox( i18n( "Alarm for Minimum Value" ), page ); boxLayout = new QGridLayout; groupBox->setLayout( boxLayout ); boxLayout->setColumnStretch( 1, 1 ); mUseLowerLimit = new QCheckBox( i18n( "Enable alarm" ), groupBox ); mUseLowerLimit->setWhatsThis( i18n( "Enable the minimum value alarm." ) ); boxLayout->addWidget( mUseLowerLimit, 0, 0 ); label = new QLabel( i18n( "Lower limit:" ), groupBox ); boxLayout->addWidget( label, 0, 2 ); mLowerLimit = new QDoubleSpinBox(groupBox); mLowerLimit->setRange(0, 100); mLowerLimit->setSingleStep(0.5); mLowerLimit->setValue(0); mLowerLimit->setDecimals(2); mLowerLimit->setEnabled( false ); boxLayout->addWidget( mLowerLimit, 0, 3 ); label->setBuddy( mLowerLimit ); pageLayout->addWidget( groupBox, 0, 0 ); groupBox = new QGroupBox( i18n( "Alarm for Maximum Value" ), page ); boxLayout = new QGridLayout; groupBox->setLayout( boxLayout ); boxLayout->setColumnStretch( 1, 1 ); mUseUpperLimit = new QCheckBox( i18n( "Enable alarm" ), groupBox ); mUseUpperLimit->setWhatsThis( i18n( "Enable the maximum value alarm." ) ); boxLayout->addWidget( mUseUpperLimit, 0, 0 ); label = new QLabel( i18n( "Upper limit:" ), groupBox ); boxLayout->addWidget( label, 0, 2 ); mUpperLimit = new QDoubleSpinBox( groupBox); mUpperLimit->setRange(0, 1000); mUpperLimit->setSingleStep(0.5); mUpperLimit->setDecimals(2); mUpperLimit->setEnabled( false ); boxLayout->addWidget( mUpperLimit, 0, 3 ); label->setBuddy( mUpperLimit ); pageLayout->addWidget( groupBox, 1, 0 ); pageLayout->setRowStretch( 2, 1 ); // Look page page = new QFrame( this ); addPage( page, i18nc( "@title:tab Appearance of the bar graph", "Look" ) ); pageLayout = new QGridLayout( page ); pageLayout->setMargin( 0 ); label = new QLabel( i18n( "Normal bar color:" ), page ); pageLayout->addWidget( label, 0, 0 ); mForegroundColor = new KColorButton( page ); pageLayout->addWidget( mForegroundColor, 0, 1 ); label->setBuddy( mForegroundColor ); label = new QLabel( i18n( "Out-of-range color:" ), page ); pageLayout->addWidget( label, 1, 0 ); mAlarmColor = new KColorButton( page ); pageLayout->addWidget( mAlarmColor, 1, 1 ); label->setBuddy( mAlarmColor ); label = new QLabel( i18n( "Background color:" ), page ); pageLayout->addWidget( label, 2, 0 ); mBackgroundColor = new KColorButton( page ); pageLayout->addWidget( mBackgroundColor, 2, 1 ); label->setBuddy( mBackgroundColor ); label = new QLabel( i18n( "Font size:" ), page ); pageLayout->addWidget( label, 3, 0 ); mFontSize = new QSpinBox( page ); mFontSize->setValue( 9 ); mFontSize->setWhatsThis( i18n( "This determines the size of the font used to print a label underneath the bars. Bars are automatically suppressed if text becomes too large, so it is advisable to use a small font size here." ) ); pageLayout->addWidget( mFontSize, 3, 1 ); label->setBuddy( mFontSize ); pageLayout->setRowStretch( 4, 1 ); // Sensor page page = new QFrame( this ); addPage( page, i18n( "Sensors" ) ); pageLayout = new QGridLayout( page ); pageLayout->setMargin( 0 ); pageLayout->setRowStretch( 2, 1 ); mView = new QTreeView( page ); mView->header()->setStretchLastSection( true ); mView->setRootIsDecorated( false ); mView->setItemsExpandable( false ); mView->setModel( mModel ); pageLayout->addWidget( mView, 0, 0, 3, 1); mEditButton = new QPushButton( i18n( "Edit..." ), page ); mEditButton->setWhatsThis( i18n( "Push this button to configure the label." ) ); pageLayout->addWidget( mEditButton, 0, 1 ); mRemoveButton = new QPushButton( i18n( "Delete" ), page ); mRemoveButton->setWhatsThis( i18n( "Push this button to delete the sensor." ) ); pageLayout->addWidget( mRemoveButton, 1, 1 ); connect(mUseLowerLimit, &QCheckBox::toggled, mLowerLimit, &QDoubleSpinBox::setEnabled); connect(mUseUpperLimit, &QCheckBox::toggled, mUpperLimit, &QDoubleSpinBox::setEnabled); connect(mEditButton, &QPushButton::clicked, this, &DancingBarsSettings::editSensor); connect(mRemoveButton, &QPushButton::clicked, this, &DancingBarsSettings::removeSensor); KAcceleratorManager::manage( this ); mTitle->setFocus(); }
ConfigureDialog::ConfigureDialog(const QString &destName, bool isClass, QWidget *parent) : KPageDialog(parent) { setFaceType(List); setModal(false); setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply); setWindowTitle(destName); setWindowIcon(QIcon::fromTheme("configure")); enableButtonApply(false); // Needed so we have our dialog size saved setAttribute(Qt::WA_DeleteOnClose); QStringList attr; KPageWidgetItem *page; modifyPrinter = new ModifyPrinter(destName, isClass, this); PrinterBehavior *printerBehavior = new PrinterBehavior(destName, isClass, this); attr << modifyPrinter->neededValues(); attr << printerBehavior->neededValues(); attr << KCUPS_PRINTER_TYPE; // needed to know if it's a remote printer attr << KCUPS_PRINTER_MAKE_AND_MODEL; KCupsPrinter printer; QPointer<KCupsRequest> request = new KCupsRequest; request->getPrinterAttributes(destName, isClass, attr); request->waitTillFinished(); if (!request) { return; } if (!request->hasError() && !request->printers().isEmpty()){ printer = request->printers().first(); } // qCDebug(PM_CONFIGURE_PRINTER) << "VALUES" << printer.a rgument(); // qCDebug(PM_CONFIGURE_PRINTER) << "marker" << values["marker-levels"].value<QList<int> >(); request->deleteLater(); // qCDebug(PM_CONFIGURE_PRINTER) << values; if (printer.type() & CUPS_PRINTER_LOCAL) { qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_LOCAL"; } isClass = printer.isClass(); bool isRemote = false; if (printer.type() & CUPS_PRINTER_REMOTE) { qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_REMOTE"; isRemote = true; } if (printer.type() & CUPS_PRINTER_BW) { qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_BW"; } if (printer.type() & CUPS_PRINTER_COLOR) { qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_COLOR"; } if (printer.type() & CUPS_PRINTER_MFP) { qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_MFP"; } modifyPrinter->setRemote(isRemote); modifyPrinter->setValues(printer); page = new KPageWidgetItem(modifyPrinter, i18n("Modify Printer")); page->setHeader(i18n("Configure")); page->setIcon(QIcon::fromTheme("dialog-information")); // CONNECT this signal ONLY to the first Page connect(modifyPrinter, SIGNAL(changed(bool)), this, SLOT(enableButtonApply(bool))); addPage(page); if (!isClass) { // At least on localhost:631 modify printer does not show printer options // for classes printerOptions = new PrinterOptions(destName, isClass, isRemote, this); page = new KPageWidgetItem(printerOptions, i18n("Printer Options")); page->setHeader(i18n("Set the Default Printer Options")); page->setIcon(QIcon::fromTheme("view-pim-tasks")); addPage(page); connect(modifyPrinter, SIGNAL(ppdChanged()), this, SLOT(ppdChanged())); modifyPrinter->setCurrentMake(printerOptions->currentMake()); modifyPrinter->setCurrentMakeAndModel(printerOptions->currentMakeAndModel()); } printerBehavior->setRemote(isRemote); printerBehavior->setValues(printer); page = new KPageWidgetItem(printerBehavior, i18n("Banners, Policies and Allowed Users")); page->setHeader(i18n("Banners, Policies and Allowed Users")); page->setIcon(QIcon::fromTheme("feed-subscribe")); addPage(page); // connect this after ALL pages were added, otherwise the slot will be called connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*))); KConfigGroup group(KSharedConfig::openConfig("print-manager"), "ConfigureDialog"); KWindowConfig::restoreWindowSize(windowHandle(), group); connect(buttonBox(), SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*))); }