Fix window title for SettingsDlg as well, make translatable, add window icon
[quassel.git] / src / qtui / settingspagedlg.cpp
index 7d36cf5..7516ff8 100644 (file)
 
 #include "settingspagedlg.h"
 
-SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent) : QDialog(parent) {
+#include "iconloader.h"
+
+SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent)
+  : QDialog(parent)
+{
   ui.setupUi(this);
   _currentPage = page;
   page->setParent(this);
+
+  // make it look more native under Mac OS X:
+  setWindowFlags(Qt::Sheet);
+
   ui.pageTitle->setText(page->title());
+  setWindowTitle(tr("Configure %1").arg(page->title()));
+  setWindowIcon(SmallIcon("configure"));
 
   // make the scrollarea behave sanely
   ui.settingsFrame->setWidgetResizable(true);
@@ -44,7 +54,6 @@ SettingsPage *SettingsPageDlg::currentPage() const {
 
 void SettingsPageDlg::setButtonStates() {
   SettingsPage *sp = currentPage();
-  ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(sp && sp->hasChanged());
   ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(sp && sp->hasChanged());
   ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(sp && sp->hasChanged());
   ui.buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(sp && sp->hasDefaults());
@@ -53,7 +62,9 @@ void SettingsPageDlg::setButtonStates() {
 void SettingsPageDlg::buttonClicked(QAbstractButton *button) {
   switch(ui.buttonBox->standardButton(button)) {
     case QDialogButtonBox::Ok:
-      if(applyChanges()) accept();
+      if(currentPage() && currentPage()->hasChanged()) {
+        if(applyChanges()) accept();
+      } else accept();
       break;
     case QDialogButtonBox::Apply:
       applyChanges();