DateSettings::DateSettings(QWidget *parent) :ContentWidget(parent), m_datetimeGroup(new SettingsGroup), m_clock(new ClockItem), m_timeWidget(new TimeWidget), m_yearWidget(new DateWidget(DateWidget::Year, 1970, 9999)), m_monthWidget(new DateWidget(DateWidget::Month, 1, 12)), m_dayWidget(new DateWidget(DateWidget::Day, 1, 31)), m_buttonTuple(new ButtonTuple) { setTitle(tr("Change Time Settings")); QPushButton *cancelButton = m_buttonTuple->leftButton(); QPushButton *confirmButton = m_buttonTuple->rightButton(); cancelButton->setText(tr("Cancel")); confirmButton->setText(tr("Confirm")); cancelButton->setAccessibleName("TimeCancel"); confirmButton->setAccessibleName("TimeConfirm"); QDate date ( QDate::currentDate() ); m_yearWidget->setValue(date.year()); m_monthWidget->setValue(date.month()); m_dayWidget->setValue(date.day()); TranslucentFrame *widget = new TranslucentFrame; QVBoxLayout* layout = new QVBoxLayout(widget); layout->setSpacing(0); layout->setMargin(0); m_datetimeGroup->appendItem(m_clock); m_datetimeGroup->appendItem(m_timeWidget); m_datetimeGroup->appendItem(m_yearWidget); m_datetimeGroup->appendItem(m_monthWidget); m_datetimeGroup->appendItem(m_dayWidget); layout->addSpacing(10); layout->addWidget(m_datetimeGroup); layout->addSpacing(10); layout->addWidget(m_buttonTuple); setContent(widget); connect(cancelButton, &QPushButton::clicked, this, &DateSettings::onCancelButtonClicked); connect(confirmButton, &QPushButton::clicked, this, &DateSettings::onConfirmButtonClicked); connect(m_monthWidget, &DateWidget::editingFinished, this, &DateSettings::updateDayRange); }
StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) : SettingsPageBase(parent), m_url(url), m_homeUrl(0), m_splitView(0), m_editableUrl(0), m_showFullPath(0), m_filterBar(0) { const int spacing = KDialog::spacingHint(); QVBoxLayout* topLayout = new QVBoxLayout(this); KVBox* vBox = new KVBox(this); vBox->setSpacing(spacing); // create 'Home URL' editor QGroupBox* homeBox = new QGroupBox(i18nc("@title:group", "Home Folder"), vBox); KHBox* homeUrlBox = new KHBox(homeBox); homeUrlBox->setSpacing(spacing); new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox); m_homeUrl = new KLineEdit(homeUrlBox); m_homeUrl->setClearButtonShown(true); QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox); #ifndef QT_NO_ACCESSIBILITY selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location")); #endif connect(selectHomeUrlButton, SIGNAL(clicked()), this, SLOT(selectHomeUrl())); KHBox* buttonBox = new KHBox(homeBox); buttonBox->setSpacing(spacing); QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox); connect(useCurrentButton, SIGNAL(clicked()), this, SLOT(useCurrentLocation())); QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox); connect(useDefaultButton, SIGNAL(clicked()), this, SLOT(useDefaultLocation())); QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox); homeBoxLayout->addWidget(homeUrlBox); homeBoxLayout->addWidget(buttonBox); // create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox); m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox); m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"), vBox); m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox); // Add a dummy widget with no restriction regarding // a vertical resizing. This assures that the dialog layout // is not stretched vertically. new QWidget(vBox); topLayout->addWidget(vBox); loadSettings(); connect(m_homeUrl, SIGNAL(textChanged(QString)), this, SLOT(slotSettingsChanged())); connect(m_splitView, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); connect(m_editableUrl, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); connect(m_showFullPath, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); connect(m_filterBar, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); }
StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) : SettingsPageBase(parent), m_url(url), m_homeUrl(0), m_splitView(0), m_editableUrl(0), m_showFullPath(0), m_filterBar(0) { QVBoxLayout* topLayout = new QVBoxLayout(this); QWidget* vBox = new QWidget(this); QVBoxLayout *vBoxLayout = new QVBoxLayout(vBox); vBoxLayout->setMargin(0); vBoxLayout->setAlignment(Qt::AlignTop); // create 'Home URL' editor QGroupBox* homeBox = new QGroupBox(i18nc("@title:group", "Home Folder"), vBox); vBoxLayout->addWidget(homeBox); QWidget* homeUrlBox = new QWidget(homeBox); QHBoxLayout *homeUrlBoxLayout = new QHBoxLayout(homeUrlBox); homeUrlBoxLayout->setMargin(0); QLabel* homeUrlLabel = new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox); homeUrlBoxLayout->addWidget(homeUrlLabel); m_homeUrl = new QLineEdit(homeUrlBox); homeUrlBoxLayout->addWidget(m_homeUrl); m_homeUrl->setClearButtonEnabled(true); QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme("folder-open"), QString(), homeUrlBox); homeUrlBoxLayout->addWidget(selectHomeUrlButton); #ifndef QT_NO_ACCESSIBILITY selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location")); #endif connect(selectHomeUrlButton, &QPushButton::clicked, this, &StartupSettingsPage::selectHomeUrl); QWidget* buttonBox = new QWidget(homeBox); QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox); buttonBoxLayout->setMargin(0); QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox); buttonBoxLayout->addWidget(useCurrentButton); connect(useCurrentButton, &QPushButton::clicked, this, &StartupSettingsPage::useCurrentLocation); QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox); buttonBoxLayout->addWidget(useDefaultButton); connect(useDefaultButton, &QPushButton::clicked, this, &StartupSettingsPage::useDefaultLocation); QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox); homeBoxLayout->addWidget(homeUrlBox); homeBoxLayout->addWidget(buttonBox); // create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox); vBoxLayout->addWidget(m_splitView); m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox); vBoxLayout->addWidget(m_editableUrl); m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"), vBox); vBoxLayout->addWidget(m_showFullPath); m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox); vBoxLayout->addWidget(m_filterBar); // Add a dummy widget with no restriction regarding // a vertical resizing. This assures that the dialog layout // is not stretched vertically. new QWidget(vBox); topLayout->addWidget(vBox); loadSettings(); connect(m_homeUrl, &QLineEdit::textChanged, this, &StartupSettingsPage::slotSettingsChanged); connect(m_splitView, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); connect(m_editableUrl, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); connect(m_showFullPath, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); connect(m_filterBar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); }