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.
This commit is contained in:
2014-11-28 09:19:38 +01:00
parent 5eff6a4fb9
commit 1606cf8a30
4 changed files with 12 additions and 5 deletions

View File

@@ -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

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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
{