Mercurial > octave
comparison libgui/src/resource-manager.cc @ 31617:1f57ea5dfd4a
don't allow settings file name to be changed
* resource-manager.h, resource-manager.cc
(resource_manger::check_settings): Rename from set_settings and
declare as private funtion. Eliminate file name argument.
Change all uses.
(resource_manger::resource_manger): Also check settings here.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 02 Dec 2022 10:36:13 -0500 |
parents | 726d2628752c |
children | ad014fc78bd6 |
comparison
equal
deleted
inserted
replaced
31616:726d2628752c | 31617:1f57ea5dfd4a |
---|---|
70 // Location, name, and format of settings file determined by | 70 // Location, name, and format of settings file determined by |
71 // settings in qt_application class construtor. | 71 // settings in qt_application class construtor. |
72 | 72 |
73 m_settings = new gui_settings (); | 73 m_settings = new gui_settings (); |
74 | 74 |
75 check_settings (); | |
76 | |
75 m_settings_file = m_settings->fileName (); | 77 m_settings_file = m_settings->fileName (); |
76 | 78 |
77 QFileInfo sfile (m_settings_file); | 79 QFileInfo sfile (m_settings_file); |
78 m_settings_directory = sfile.absolutePath (); | 80 m_settings_directory = sfile.absolutePath (); |
79 } | 81 } |
311 | 313 |
312 if (! env_default_editor.empty ()) | 314 if (! env_default_editor.empty ()) |
313 custom_editor = QString::fromStdString (env_default_editor); | 315 custom_editor = QString::fromStdString (env_default_editor); |
314 } | 316 } |
315 | 317 |
316 set_settings (m_settings_file); | 318 check_settings (); |
317 | 319 |
318 // Write some settings that were dynamically determined at first startup | 320 // Write some settings that were dynamically determined at first startup |
319 if (m_settings) | 321 if (m_settings) |
320 { | 322 { |
321 // Custom editor | 323 // Custom editor |
432 lexer->readSettings (*settings, group_str.c_str ()); | 434 lexer->readSettings (*settings, group_str.c_str ()); |
433 } | 435 } |
434 } | 436 } |
435 #endif | 437 #endif |
436 | 438 |
437 void resource_manager::set_settings (const QString& file) | 439 void resource_manager::check_settings (void) |
438 { | 440 { |
439 delete m_settings; | |
440 m_settings = new gui_settings (file, QSettings::IniFormat); | |
441 | |
442 if (m_settings->status () == QSettings::NoError) | 441 if (m_settings->status () == QSettings::NoError) |
443 { | 442 { |
444 // Test usability (force file to be really created) | 443 // Test usability (force file to be really created) |
445 m_settings->setValue ("dummy", 0); | 444 m_settings->setValue ("dummy", 0); |
446 m_settings->sync (); | 445 m_settings->sync (); |