From 1606cf8a306839350047c5214e9dba58ae8258e4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 28 Nov 2014 09:19:38 +0100 Subject: [PATCH] COPKGManager: remember for last selected update directory Use g_settings to handle local package directory. Extra settings handler via gui for this directory is not intended. Default update directory is the same like in flash settings. --- src/gui/opkg_manager.cpp | 6 +++--- src/gui/opkg_manager.h | 2 +- src/neutrino.cpp | 4 ++++ src/system/settings.h | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 15556f180..793e536ce 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -90,7 +90,7 @@ COPKGManager::COPKGManager() list_installed_done = false; list_upgradeable_done = false; expert_mode = false; - local_dir = g_settings.update_dir.c_str(); + local_dir = &g_settings.update_dir_opkg; CFileHelpers::createDir("/tmp/.opkg"); } @@ -148,11 +148,11 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey) CFileBrowser fileBrowser; fileBrowser.Filter = &fileFilter; - if (fileBrowser.exec(local_dir.c_str())) + if (fileBrowser.exec((*local_dir).c_str())) { string pgk_name = fileBrowser.getSelectedFile()->Name; int r = execCmd(pkg_types[OM_INSTALL] + pgk_name, true, true); - local_dir = fileBrowser.getCurrentDir(); + *local_dir = fileBrowser.getCurrentDir(); if (r) { showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pgk_name); } else diff --git a/src/gui/opkg_manager.h b/src/gui/opkg_manager.h index 7fac42452..c93fb5d38 100644 --- a/src/gui/opkg_manager.h +++ b/src/gui/opkg_manager.h @@ -57,7 +57,7 @@ class COPKGManager : public CMenuTarget bool installed; bool expert_mode; int menu_offset; - std::string local_dir; + std::string *local_dir; int execCmd(const char* cmdstr, bool verbose = false, bool acknowledge = false); int execCmd(std::string cmdstr, bool verbose = false, bool acknowledge = false) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 9d68da15e..385a36a70 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -766,7 +766,9 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.font_file = configfile.getString("font_file", FONTDIR"/neutrino.ttf"); g_settings.ttx_font_file = configfile.getString( "ttx_font_file", FONTDIR"/DejaVuLGCSansMono-Bold.ttf"); ttx_font_file = g_settings.ttx_font_file.c_str(); + g_settings.update_dir = configfile.getString("update_dir", "/tmp"); + g_settings.update_dir_opkg = configfile.getString("update_dir_opkg", g_settings.update_dir); // parentallock if (!parentallocked) { @@ -1239,6 +1241,8 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setString("softupdate_proxypassword" , g_settings.softupdate_proxypassword ); configfile.setString("update_dir", g_settings.update_dir); + configfile.setString("update_dir_opkg", g_settings.update_dir_opkg); + configfile.setString("font_file", g_settings.font_file); configfile.setString("ttx_font_file", g_settings.ttx_font_file); diff --git a/src/system/settings.h b/src/system/settings.h index 21a4d336d..c07a7428a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -608,6 +608,9 @@ struct SNeutrinoSettings int flashupdate_createimage_add_spare; int flashupdate_createimage_add_kernel; + std::string update_dir; + std::string update_dir_opkg; + //BouquetHandling int bouquetlist_mode; @@ -725,7 +728,7 @@ struct SNeutrinoSettings int sms_channel; std::string font_file; std::string ttx_font_file; - std::string update_dir; + // USERMENU typedef enum {