Mercurial > octave
diff libgui/src/welcome-wizard.cc @ 17940:b3e4ee8f4d6d
respect option for opting out of web connections for community news
* main-window.h, main-window.cc (main_window::main_window): Check
settings for news/allow_web_connection. Don't load and display
community news at startup if the community news web connection is
disabled.
(news_reader::connect_to_web): New data member.
(news_reader_process): Display different messages for network
unavailable and disabled web connections. Don't connect to web if
connect_to_web is false.
(main_window::load_and_display_community_news): Check settings for
news/allow_web_connection and pass value to news_reader constructor.
* welcome-wizard.h, welcome-wizard.cc
(welcome_wizard::allow_web_connect_state): New data member.
(welcome_wizard::handle_web_connect_option): New slot.
(setup_community_news::setup_community_news): Connect checkbox signal
to welcome_wizard::handle_web_connect_option.
(welcome_wizard::accept): New slot. Initialize resources here.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 16 Nov 2013 12:05:26 -0500 |
parents | f87a7e161710 |
children | 866d3860724c |
line wrap: on
line diff
--- a/libgui/src/welcome-wizard.cc Sat Nov 16 02:52:30 2013 -0500 +++ b/libgui/src/welcome-wizard.cc Sat Nov 16 12:05:26 2013 -0500 @@ -200,6 +200,9 @@ next->setDefault (true); next->setFocus (); + connect (checkbox, SIGNAL (stateChanged (int)), + wizard, SLOT (handle_web_connect_option (int))); + connect (previous, SIGNAL (clicked ()), wizard, SLOT (previous_page ())); connect (next, SIGNAL (clicked ()), wizard, SLOT (next_page ())); connect (cancel, SIGNAL (clicked ()), wizard, SLOT (reject ())); @@ -319,7 +322,8 @@ welcome_wizard::welcome_wizard (QWidget *p) : QDialog (p), page_ctor_list (), page_list_iterator (), - current_page (initial_page::create (this)) + current_page (initial_page::create (this)), + allow_web_connect_state (true) { page_ctor_list.push_back (initial_page::create); page_ctor_list.push_back (setup_community_news::create); @@ -337,6 +341,12 @@ } void +welcome_wizard::handle_web_connect_option (int state) +{ + allow_web_connect_state = state == Qt::Checked; +} + +void welcome_wizard::show_page (void) { delete current_page; @@ -365,3 +375,23 @@ show_page (); } + +void +welcome_wizard::accept (void) +{ + // Create default settings file. + + resource_manager::reload_settings (); + + QSettings *settings = resource_manager::get_settings (); + + if (settings) + { + settings->setValue ("news/allow_web_connection", + allow_web_connect_state); + + settings->sync (); + } + + QDialog::accept (); +}