webtv: use last dir as default

This commit is contained in:
Jacek Jendrzej
2015-05-12 18:16:36 +02:00
parent 8ea4196d50
commit 2cc4120672
3 changed files with 8 additions and 2 deletions

View File

@@ -70,8 +70,10 @@ int CWebTVSetup::exec(CMenuTarget* parent, const std::string & actionKey)
CMenuItem* item = m->getItem(selected);
CMenuForwarder *f = static_cast<CMenuForwarder*>(item);
std::string dirname(f->getName());
if (fileBrowser.exec(dirname.substr(0, dirname.rfind('/')).c_str())) {
dirname = dirname.substr(0, dirname.rfind('/'));
if (fileBrowser.exec(dirname.c_str())) {
f->setName(fileBrowser.getSelectedFile()->Name);
g_settings.last_webtv_dir = dirname;
changed = true;
}
return res;
@@ -81,9 +83,10 @@ int CWebTVSetup::exec(CMenuTarget* parent, const std::string & actionKey)
CFileFilter fileFilter;
fileFilter.addFilter("xml");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec("/") == true) {
if (fileBrowser.exec(g_settings.last_webtv_dir.c_str()) == true) {
std::string s = fileBrowser.getSelectedFile()->Name;
m->addItem(new CMenuForwarder(s, true, NULL, this, "c"));
g_settings.last_webtv_dir = s.substr(0, s.rfind('/')).c_str();
changed = true;
}
return res;

View File

@@ -576,6 +576,7 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.network_nfs_recordingdir = configfile.getString( "network_nfs_recordingdir", "/media/sda1/movies" );
g_settings.timeshiftdir = configfile.getString( "timeshiftdir", "" );
g_settings.downloadcache_dir = configfile.getString( "downloadcache_dir", g_settings.network_nfs_recordingdir.c_str());
g_settings.last_webtv_dir = configfile.getString( "last_webtv_dir", "/var/tuxbox/config");
g_settings.temp_timeshift = configfile.getInt32( "temp_timeshift", 0 );
g_settings.auto_timeshift = configfile.getInt32( "auto_timeshift", 0 );
@@ -1104,6 +1105,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setString( "network_nfs_recordingdir", g_settings.network_nfs_recordingdir);
configfile.setString( "timeshiftdir", g_settings.timeshiftdir);
configfile.setString( "downloadcache_dir", g_settings.downloadcache_dir);
configfile.setString( "last_webtv_dir", g_settings.last_webtv_dir);
configfile.setBool ("filesystem_is_utf8" , g_settings.filesystem_is_utf8 );
//recording (server + vcr)

View File

@@ -396,6 +396,7 @@ struct SNeutrinoSettings
std::string network_nfs_recordingdir;
std::string timeshiftdir;
std::string downloadcache_dir;
std::string last_webtv_dir;
//recording
int recording_type;