#ifndef Q_WS_MAEMO_5
setMinimumWidth(250);
setMaximumWidth(250);
+ footerLayout = new QHBoxLayout(this);
+ closeButton = new QPushButton(tr("Ok"));
+ footerLayout->addStretch(0);
+ footerLayout->addWidget(closeButton);
+ verticalLayout->addLayout(footerLayout);
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
void SettingsWidget::showEvent(QShowEvent *e) {
+ #ifndef Q_WS_MAEMO_5
+ _save = false;
+ #endif
settings = guiInterface->settings();
historySizeSpinBox->setValue(
void SettingsWidget::hideEvent(QHideEvent *e) {
QDialog::hideEvent(e);
- if(settings) {
+ #ifndef Q_WS_MAEMO_5
+ if(settings && _save) {
+ #else
+ if(settings &&
+ QMessageBox::question(this, "Save", "Do you want to save changes?",
+ QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+
+ #endif
Settings* newSettings = new Settings;
newSettings->setValue("history_size",
QString::number(historySizeSpinBox->value()));
}
}
+ }
+ if(settings) {
delete settings;
settings = 0;
}
}
+
+
+#ifndef Q_WS_MAEMO_5
+ void SettingsWidget::save() {
+ _save = true;
+ hide();
+ }
+#endif
#include <QWidget>
#include <QtGui>
+#include <QPushButton>
#include "../../includes/GUIInterface.h"
#include "../../includes/settings.h"
GUIInterface* guiInterface;
Settings* settings;
+ #ifndef Q_WS_MAEMO_5
+ QPushButton* closeButton;
+ QHBoxLayout* footerLayout;
+ bool _save;
+
+ public Q_SLOTS:
+ void save();
+ #endif
+
};
#endif // SETTINGSWIDGET_H