Commit 34644b2c authored by Dirk Wilden's avatar Dirk Wilden

fixed addRecentFiles from config files

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6282 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 35b61676
......@@ -475,6 +475,10 @@ Core::init() {
// Load global ini files. Use only plugin global options from these files as the
// rest has been loaded at the beginning.
readRecentFiles( optionFiles[i] );
if ( OpenFlipper::Options::gui() )
coreWidget_->updateRecent();
openIniFile( optionFiles[i] ,false,true,false);
}
......
......@@ -552,6 +552,9 @@ private:
/// Read Options that needs the GUI to be set up completely
void readGUIOptions(INIFile& _ini);
/// Read recent files from ini-file
void readRecentFiles(QString _filename);
/// Get and set Application options from ini file
void readApplicationOptions(INIFile& _ini);
......
......@@ -66,27 +66,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
// Parse standard options
if ( _ini.section_exists("Options") ) {
// Load maxRecent Setting
int mrecent = 6;
if (_ini.get_entry(mrecent,"Options","MaxRecent"))
OpenFlipper::Options::maxRecent(mrecent);
for ( int j = mrecent-1 ; j >= 0; --j) {
QString file;
QString key = "recent" + QString::number(j);
if ( !_ini.get_entry( file , "Options" , key ) )
continue;
key = "type" + QString::number(j);
QString type;
if ( !_ini.get_entry( type , "Options" , key ) )
continue;
OpenFlipper::Options::addRecentFile(file, typeId(type) );
}
// load ViewModes
int viewModeCount;
if (_ini.get_entry(viewModeCount,"Options","ViewModeCount") )
......@@ -387,6 +366,45 @@ void Core::readApplicationOptions(INIFile& _ini) {
}
}
void Core::readRecentFiles(QString _filename){
INIFile ini;
if ( ! ini.connect(_filename,false) ) {
emit log(LOGERR,"Failed to connect to ini file" + _filename);
return;
}
OpenFlipper::Options::loadingSettings(true);
// Load maxRecent Setting
int mrecent = 6;
if (ini.get_entry(mrecent,"Options","MaxRecent"))
OpenFlipper::Options::maxRecent(mrecent);
for ( int j = mrecent-1 ; j >= 0; --j) {
QString file;
QString key = "recent" + QString::number(j);
if ( !ini.get_entry( file , "Options" , key ) )
continue;
key = "type" + QString::number(j);
QString type;
if ( !ini.get_entry( type , "Options" , key ) )
continue;
OpenFlipper::Options::addRecentFile(file, typeId(type) );
}
ini.disconnect();
OpenFlipper::Options::loadingSettings(false);
}
/** Write the standard options to the given Ini File
* @param _ini Inifile to use
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment