# HG changeset patch
# User Torsten <ttl@justmail.de>
# Date 1346609142 -7200
# Node ID 4ef1df83f971335fc7eec49511ec6f8360c20d47
# Parent  535bb601e7db880c79edfb7bc8650538fd8edf37
buttons for the settings dialog

diff -r 535bb601e7db -r 4ef1df83f971 libgui/src/main-window.cc
--- a/libgui/src/main-window.cc	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/main-window.cc	Sun Sep 02 20:05:42 2012 +0200
@@ -164,9 +164,13 @@
 main_window::process_settings_dialog_request ()
 {
   settings_dialog *settingsDialog = new settings_dialog (this);
-  settingsDialog->exec ();
+  int change_settings = settingsDialog->exec ();
+  if (change_settings == QDialog::Accepted)
+    {
+      settingsDialog->apply_settings ();
+      emit settings_changed ();
+    }
   delete settingsDialog;
-  emit settings_changed ();
 }
 
 void
diff -r 535bb601e7db -r 4ef1df83f971 libgui/src/settings-dialog.cc
--- a/libgui/src/settings-dialog.cc	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/settings-dialog.cc	Sun Sep 02 20:05:42 2012 +0200
@@ -85,6 +85,12 @@
 
 settings_dialog::~settings_dialog ()
 {
+  delete ui;
+}
+
+void
+settings_dialog::apply_settings ()
+{
   QSettings *settings = resource_manager::get_settings ();
 
   // FIXME -- what should happen if settings is 0?
@@ -122,5 +128,4 @@
     }
   settings->setValue ("terminal/cursorType", cursorType);
   settings->sync ();
-  delete ui;
 }
diff -r 535bb601e7db -r 4ef1df83f971 libgui/src/settings-dialog.h
--- a/libgui/src/settings-dialog.h	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/settings-dialog.h	Sun Sep 02 20:05:42 2012 +0200
@@ -35,6 +35,7 @@
 Q_OBJECT public:
   explicit settings_dialog (QWidget * parent);
   ~settings_dialog ();
+  void apply_settings ();
 
 private:
   Ui::settings_dialog * ui;
diff -r 535bb601e7db -r 4ef1df83f971 libgui/src/settings-dialog.ui
--- a/libgui/src/settings-dialog.ui	Sat Sep 01 11:50:12 2012 -0400
+++ b/libgui/src/settings-dialog.ui	Sun Sep 02 20:05:42 2012 +0200
@@ -487,6 +487,13 @@
      </widget>
     </widget>
    </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>
@@ -620,38 +627,6 @@
    </hints>
   </connection>
   <connection>
-   <sender>editor_showLineNumbers</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_showLineNumbers</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>87</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>87</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_highlightCurrentLine</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_highlightCurrentLine</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>112</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>112</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>useProxyServer</sender>
    <signal>toggled(bool)</signal>
    <receiver>proxyUserName</receiver>
@@ -700,18 +675,34 @@
    </hints>
   </connection>
   <connection>
-   <sender>editor_codeCompletion</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_codeCompletion</receiver>
-   <slot>setEnabled(bool)</slot>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>settings_dialog</receiver>
+   <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>249</x>
-     <y>137</y>
+     <x>299</x>
+     <y>377</y>
     </hint>
     <hint type="destinationlabel">
-     <x>249</x>
-     <y>137</y>
+     <x>299</x>
+     <y>199</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>settings_dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>299</x>
+     <y>377</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>299</x>
+     <y>199</y>
     </hint>
    </hints>
   </connection>
