summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-08-09 06:28:18 (GMT)
committerMontel Laurent <montel@kde.org>2016-08-09 06:28:18 (GMT)
commitca261d03559001b785cd92ed5a459bef5b8b46f1 (patch)
tree4d6764aed8b7c37993d8290f5261c21fed81987d
parent15213e928f4bf29c0fe9f1a62cf0c9602f9e87c4 (diff)
Clean up layout
-rw-r--r--src/agenda/timescaleconfigdialog.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/agenda/timescaleconfigdialog.cpp b/src/agenda/timescaleconfigdialog.cpp
index f6f84f1..d661535 100644
--- a/src/agenda/timescaleconfigdialog.cpp
+++ b/src/agenda/timescaleconfigdialog.cpp
@@ -83,20 +83,20 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge
: QDialog(parent), d(new Private(this, preferences))
{
setWindowTitle(i18n("Timezone"));
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
- QVBoxLayout *mainLayout = new QVBoxLayout;
- setLayout(mainLayout);
- QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
- okButton->setDefault(true);
- okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- connect(buttonBox, &QDialogButtonBox::rejected, this, &TimeScaleConfigDialog::reject);
- okButton->setDefault(true);
+ QVBoxLayout *mainLayout = new QVBoxLayout(this);
setModal(true);
QWidget *mainwidget = new QWidget(this);
setupUi(mainwidget);
mainLayout->addWidget(mainwidget);
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
+ QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setDefault(true);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &TimeScaleConfigDialog::reject);
+
mainLayout->addWidget(buttonBox);
QStringList shownTimeZones(QString::fromUtf8(d->mPreferences->timeZone().id()));
@@ -162,7 +162,8 @@ void TimeScaleConfigDialog::add()
{
// Do not add duplicates
if (zoneCombo->currentIndex() >= 0) {
- for (int i = 0; i < listWidget->count(); ++i) {
+ const int numberItem(listWidget->count());
+ for (int i = 0; i < numberItem; ++i) {
if (listWidget->item(i)->data(TimeZoneNameRole).toString() == zoneCombo->itemData(zoneCombo->currentIndex(), TimeZoneNameRole).toString()) {
return;
}