本文整理汇总了C++中CFileBrowser::getSelectedFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileBrowser::getSelectedFile方法的具体用法?C++ CFileBrowser::getSelectedFile怎么用?C++ CFileBrowser::getSelectedFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileBrowser
的用法示例。
在下文中一共展示了CFileBrowser::getSelectedFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec
int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init extended settings menue\n");
if(parent != NULL)
parent->hide();
if(actionKey == "epgdir")
{
CFileBrowser b;
b.Dir_Mode=true;
if (b.exec(g_settings.epg_dir.c_str()))
{
if((b.getSelectedFile()->Name) == "/")
{
// if selected dir is root -> clear epg_dir
g_settings.epg_dir = "";
} else {
g_settings.epg_dir = b.getSelectedFile()->Name + "/";
}
CNeutrinoApp::getInstance()->SendSectionsdConfig(); // update notifier
}
return menu_return::RETURN_REPAINT;
}
int res = showMenue();
return res;
}
示例2: exec
int CWebTVSetup::exec(CMenuTarget* parent, const std::string & actionKey)
{
int res = menu_return::RETURN_REPAINT;
if(actionKey == "d" /* delete */) {
selected = m->getSelected();
if (selected >= item_offset) {
m->removeItem(selected);
m->hide();
selected = m->getSelected();
changed = true;
}
return res;
}
if(actionKey == "c" /* change */) {
CFileBrowser fileBrowser;
CFileFilter fileFilter;
fileFilter.addFilter("xml");
fileBrowser.Filter = &fileFilter;
selected = m->getSelected();
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())) {
f->setName(fileBrowser.getSelectedFile()->Name);
changed = true;
}
return res;
}
if(actionKey == "a" /* add */) {
CFileBrowser fileBrowser;
CFileFilter fileFilter;
fileFilter.addFilter("xml");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec("/") == true) {
std::string s = fileBrowser.getSelectedFile()->Name;
m->addItem(new CMenuForwarder(s, true, NULL, this, "c"));
changed = true;
}
return res;
}
if(parent)
parent->hide();
Show();
return res;
}
示例3: exec
int GLCD_Menu::exec(CMenuTarget* parent, const std::string & actionKey)
{
int res = menu_return::RETURN_REPAINT;
nGLCD *nglcd = nGLCD::getInstance();
if(actionKey == "rescan") {
nglcd->Rescan();
return res;
}
if(actionKey == "select_font") {
if(parent)
parent->hide();
CFileBrowser fileBrowser;
CFileFilter fileFilter;
fileFilter.addFilter("ttf");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec(FONTDIR) == true) {
g_settings.glcd_font = fileBrowser.getSelectedFile()->Name;
nglcd->Rescan();
}
return res;
}
if (parent)
parent->hide();
GLCD_Menu_Settings();
return res;
}
示例4: testShowPictureURL
void CTestMenu::testShowPictureURL()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
fileBrowser = new CFileBrowser();
CFileFilter fileFilter;
fileFilter.addFilter("png");
fileFilter.addFilter("bmp");
fileFilter.addFilter("jpg");
fileFilter.addFilter("jpeg");
fileBrowser->Multi_Select = false;
fileBrowser->Dirs_Selectable = false;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_audioplayerdir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CFile * file;
if ((file = fileBrowser->getSelectedFile()) != NULL)
{
CPictureViewerGui tmpPictureViewerGui;
CPicture pic;
struct stat statbuf;
pic.Filename = file->Name;
std::string tmp = file->Name.substr(file->Name.rfind('/') + 1);
pic.Name = tmp.substr(0, tmp.rfind('.'));
pic.Type = tmp.substr(tmp.rfind('.') + 1);
if(stat(pic.Filename.c_str(), &statbuf) != 0)
printf("stat error");
pic.Date = statbuf.st_mtime;
tmpPictureViewerGui.addToPlaylist(pic);
tmpPictureViewerGui.exec(NULL, "urlplayback");
}
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}
示例5: testPlayAudioURL
void CTestMenu::testPlayAudioURL()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
fileBrowser = new CFileBrowser();
CFileFilter fileFilter;
fileFilter.addFilter("cdr");
fileFilter.addFilter("mp3");
fileFilter.addFilter("mpa");
fileFilter.addFilter("mp2");
fileFilter.addFilter("ogg");
fileFilter.addFilter("wav");
fileFilter.addFilter("flac");
fileFilter.addFilter("aac");
fileFilter.addFilter("dts");
fileFilter.addFilter("m4a");
fileBrowser->Multi_Select = false;
fileBrowser->Dirs_Selectable = false;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_audioplayerdir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CFile * file;
if ((file = fileBrowser->getSelectedFile()) != NULL)
{
CAudioPlayerGui tmpAudioPlayerGui;
if (file->getType() == CFile::FILE_AUDIO)
{
CAudiofileExt audiofile(file->Name, file->getExtension());
tmpAudioPlayerGui.addToPlaylist(audiofile);
tmpAudioPlayerGui.exec(NULL, "urlplayback");
}
}
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}
示例6: exec
int CEPGSettings::exec(CMenuTarget* parent, const std::string& actionKey)
{
dprintf(DEBUG_NORMAL, "CEPGSettings::exec: actionKey: %s\n", actionKey.c_str());
int ret = menu_return::RETURN_REPAINT;
if(parent)
parent->hide();
if(actionKey == "savesettings")
{
CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
return ret;
}
else if(actionKey == "epgdir")
{
if(parent)
parent->hide();
CFileBrowser b;
b.Dir_Mode = true;
if ( b.exec(g_settings.epg_dir.c_str()))
{
const char * newdir = b.getSelectedFile()->Name.c_str();
if(check_dir(newdir))
printf("CNeutrinoApp::exec: Wrong/unsupported epg dir %s\n", newdir);
else
{
g_settings.epg_dir = b.getSelectedFile()->Name;
CNeutrinoApp::getInstance()->SendSectionsdConfig();
}
}
return ret;
}
showMenu();
return ret;
}
示例7: exec
int CKeybindSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init keybindings setup\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
if(actionKey == "loadkeys") {
CFileBrowser fileBrowser;
CFileFilter fileFilter;
fileFilter.addFilter("conf");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec(CONFIGDIR) == true) {
CNeutrinoApp::getInstance()->loadKeys(fileBrowser.getSelectedFile()->Name.c_str());
printf("[neutrino keybind_setup] new keys: %s\n", fileBrowser.getSelectedFile()->Name.c_str());
}
return menu_return::RETURN_REPAINT;
}
else if(actionKey == "savekeys") {
CFileBrowser fileBrowser;
fileBrowser.Dir_Mode = true;
if (fileBrowser.exec("/var/tuxbox") == true) {
std::string fname = "keys.conf";
CStringInputSMS * sms = new CStringInputSMS(LOCALE_EXTRA_SAVEKEYS, &fname, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789. ");
sms->exec(NULL, "");
std::string sname = fileBrowser.getSelectedFile()->Name + "/" + fname;
printf("[neutrino keybind_setup] save keys: %s\n", sname.c_str());
CNeutrinoApp::getInstance()->saveKeys(sname.c_str());
delete sms;
}
return menu_return::RETURN_REPAINT;
}
res = showKeySetup();
return res;
}
示例8: exec
int CDirChooser::exec(CMenuTarget* parent, const std::string &)
/* start dir chooser */
/**********************************************************************/
{
int result = menu_return::RETURN_REPAINT;
new_path_selected = false;
if(parent != NULL)
{
parent->hide();
}
CFileBrowser browser;
browser.Dir_Mode = true;
bool allowed = false;
bool test_allowed = false;
if (browser.exec(dirPath->c_str()))
{
*dirPath = browser.getSelectedFile()->Name;
for(int i = 0;i < MAX_ALLOWED_PATHS; i++)
{
if(allowedPath[i] != NULL)
{
test_allowed = true; // there is at least one allowed path, so check it
if(dirPath->compare(0,strlen(allowedPath[i]),allowedPath[i]) == 0)
{
allowed = true;
break;
}
}
}
if( (test_allowed == true && allowed == false) ||
*dirPath == "/")
{
*dirPath = ""; // We clear the string if the selected folder is not at allowed
}
new_path_selected = true;
}
return result;
}
示例9: exec
int CPictureViewerSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init pctureviwer setup\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
parent->hide();
if(actionKey == "picturedir")
{
CFileBrowser b;
b.Dir_Mode=true;
if (b.exec(g_settings.network_nfs_picturedir.c_str()))
g_settings.network_nfs_picturedir = b.getSelectedFile()->Name;
return res;
}
res = showPictureViewerSetup();
return res;
}
示例10: addUserBouquet
void CWebTV::addUserBouquet(void)
{
CFileBrowser filebrowser;
CFileFilter fileFilter;
fileFilter.addFilter("xml");
fileFilter.addFilter("tv");
fileFilter.addFilter("m3u");
filebrowser.Filter = &fileFilter;
if (filebrowser.exec(CONFIGDIR "/webtv"))
{
g_settings.userBouquet.clear();
g_settings.userBouquet = filebrowser.getSelectedFile()->Name.c_str();
printf("[webtv] webtv settings file %s\n", g_settings.userBouquet.c_str());
// load channels
loadChannels();
selected = 0;
}
}
示例11: testPlayMovieURL
void CTestMenu::testPlayMovieURL()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
fileBrowser = new CFileBrowser();
CFileFilter fileFilter;
fileFilter.addFilter("ts");
fileFilter.addFilter("mpg");
fileFilter.addFilter("mpeg");
fileFilter.addFilter("divx");
fileFilter.addFilter("avi");
fileFilter.addFilter("mkv");
fileFilter.addFilter("asf");
fileFilter.addFilter("aiff");
fileFilter.addFilter("m2p");
fileFilter.addFilter("mpv");
fileFilter.addFilter("m2ts");
fileFilter.addFilter("vob");
fileFilter.addFilter("mp4");
fileFilter.addFilter("mov");
fileFilter.addFilter("flv");
fileFilter.addFilter("dat");
fileFilter.addFilter("trp");
fileFilter.addFilter("vdr");
fileFilter.addFilter("mts");
fileFilter.addFilter("wmv");
fileFilter.addFilter("wav");
fileFilter.addFilter("flac");
fileFilter.addFilter("mp3");
fileFilter.addFilter("wma");
fileFilter.addFilter("ogg");
fileBrowser->Multi_Select = false;
fileBrowser->Dirs_Selectable = false;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_moviedir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CFile * file;
if ((file = fileBrowser->getSelectedFile()) != NULL)
{
moviePlayerGui->filename = file->Name.c_str();
// movieinfos
moviePlayerGui->Title = file->Title;
moviePlayerGui->Info1 = file->Info1;
moviePlayerGui->Info2 = file->Info2;
moviePlayerGui->thumbnail = file->thumbnail;
// play
moviePlayerGui->exec(NULL, "urlplayback");
}
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}
示例12: exec
int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
{
printf("[neutrino] CSettingsManager %s: init...\n",__FUNCTION__);
int res = menu_return::RETURN_REPAINT;
if (parent)
parent->hide();
CFileBrowser fileBrowser;
CFileFilter fileFilter;
if(actionKey == "loadconfig")
{
fileFilter.addFilter("conf");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec(CONFIGDIR) == true)
{
CNeutrinoApp::getInstance()->loadSetup(fileBrowser.getSelectedFile()->Name.c_str());
CColorSetupNotifier *colorSetupNotifier = new CColorSetupNotifier;
colorSetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
CVFD::getInstance()->setlcdparameter();
printf("[neutrino] new settings: %s\n", fileBrowser.getSelectedFile()->Name.c_str());
delete colorSetupNotifier;
}
return res;
}
else if(actionKey == "saveconfig")
{
fileBrowser.Dir_Mode = true;
if (fileBrowser.exec("/var/tuxbox") == true)
{
std::string fname = "neutrino.conf";
CStringInputSMS * sms = new CStringInputSMS(LOCALE_EXTRA_SAVECONFIG, &fname, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789. ");
sms->exec(NULL, "");
std::string sname = fileBrowser.getSelectedFile()->Name + "/" + fname;
printf("[neutrino] save settings: %s\n", sname.c_str());
CNeutrinoApp::getInstance()->saveSetup(sname.c_str());
delete sms;
}
return res;
}
else if(actionKey == "backup")
{
fileBrowser.Dir_Mode = true;
if (fileBrowser.exec("/media") == true)
{
struct statfs s;
int ret = ::statfs(fileBrowser.getSelectedFile()->Name.c_str(), &s);
if(ret == 0 && s.f_type != 0x72b6L) /*jffs2*/
{
const char backup_sh[] = "/bin/backup.sh";
printf("backup: executing [%s %s]\n",backup_sh, fileBrowser.getSelectedFile()->Name.c_str());
my_system(2, backup_sh, fileBrowser.getSelectedFile()->Name.c_str());
}
else
ShowMsg(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_SETTINGS_BACKUP_FAILED),CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_ERROR);
}
return res;
}
else if(actionKey == "restore")
{
fileFilter.addFilter("tar");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec("/media") == true)
{
int result = ShowMsg(LOCALE_SETTINGS_RESTORE, g_Locale->getText(LOCALE_SETTINGS_RESTORE_WARN), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo);
if(result == CMessageBox::mbrYes)
{
const char restore_sh[] = "/bin/restore.sh";
printf("restore: executing [%s %s]\n", restore_sh, fileBrowser.getSelectedFile()->Name.c_str());
my_system(2, restore_sh, fileBrowser.getSelectedFile()->Name.c_str());
}
}
return res;
}
res = showMenu();
return res;
}
示例13: exec
int CRecordSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init record setup\n");
int res = menu_return::RETURN_REPAINT;
std::string timeshiftDir;
if (parent)
{
parent->hide();
}
if(actionKey=="recording")
{
CNeutrinoApp::getInstance()->setupRecordingDevice();
return res;
}
else if(actionKey == "help_recording")
{
ShowMsg(LOCALE_SETTINGS_HELP, LOCALE_RECORDINGMENU_HELP, CMessageBox::mbrBack, CMessageBox::mbBack);
return res;
}
else if(actionKey == "recordingdir")
{
//parent->hide();
const char *action_str = "recordingdir";
if(chooserDir(g_settings.network_nfs_recordingdir, true, action_str)){
printf("New recordingdir: %s (timeshift %s)\n", g_settings.network_nfs_recordingdir.c_str(), g_settings.timeshiftdir.c_str());
if(g_settings.timeshiftdir.empty())
{
timeshiftDir = g_settings.network_nfs_recordingdir + "/.timeshift";
safe_mkdir(timeshiftDir.c_str());
printf("New timeshift dir: %s\n", timeshiftDir.c_str());
CRecordManager::getInstance()->SetTimeshiftDirectory(timeshiftDir);
}
cHddStat::getInstance()->setDir(g_settings.network_nfs_recordingdir);
}
return res;
}
else if(actionKey == "timeshiftdir")
{
//parent->hide();
CFileBrowser b;
b.Dir_Mode=true;
if (b.exec(g_settings.timeshiftdir.c_str()))
{
const char * newdir = b.getSelectedFile()->Name.c_str();
printf("New timeshift: selected %s\n", newdir);
if(check_dir(newdir))
printf("Wrong/unsupported recording dir %s\n", newdir);
else
{
printf("New timeshift dir: old %s (record %s)\n", g_settings.timeshiftdir.c_str(), g_settings.network_nfs_recordingdir.c_str());
if(newdir != g_settings.network_nfs_recordingdir)
{
printf("New timeshift != rec dir\n");
g_settings.timeshiftdir = b.getSelectedFile()->Name;
timeshiftDir = g_settings.timeshiftdir;
}
else
{
timeshiftDir = g_settings.network_nfs_recordingdir + "/.timeshift";
g_settings.timeshiftdir = newdir;
safe_mkdir(timeshiftDir.c_str());
printf("New timeshift == rec dir\n");
}
printf("New timeshift dir: %s\n", timeshiftDir.c_str());
CRecordManager::getInstance()->SetTimeshiftDirectory(timeshiftDir);
}
}
return res;
}
#if 0
if (CNeutrinoApp::getInstance()->recordingstatus)
DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDINGMENU_RECORD_IS_RUNNING));
else
#endif
res = showRecordSetup();
return res;
}
示例14: plugin_exec
void plugin_exec(void)
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser filebrowser;
std::string Path_local = "/media/hdd";
BROWSER:
if (filebrowser.exec(Path_local.c_str()))
{
Path_local = filebrowser.getCurrentDir(); // remark path
// get the current file name
CFile * file;
if ((file = filebrowser.getSelectedFile()) != NULL)
{
// parse file extension
if(file->getType() == CFile::FILE_PICTURE)
{
CPictureViewerGui tmpPictureViewerGui;
CPicture pic;
struct stat statbuf;
pic.Filename = file->Name;
std::string tmp = file->Name.substr(file->Name.rfind('/') + 1);
pic.Name = tmp.substr(0, tmp.rfind('.'));
pic.Type = tmp.substr(tmp.rfind('.') + 1);
if(stat(pic.Filename.c_str(), &statbuf) != 0)
printf("stat error");
pic.Date = statbuf.st_mtime;
tmpPictureViewerGui.addToPlaylist(pic);
tmpPictureViewerGui.exec(NULL, "urlplayback");
}
else if(file->getType() == CFile::FILE_TEXT || file->getType() == CFile::FILE_XML)
{
std::string buffer;
buffer.clear();
char buf[256];
FILE* pFile;
pFile = fopen(file->Name.c_str(), "r");
if(pFile != NULL)
{
fgets(buf, sizeof(buf), pFile);
}
fclose(pFile);
buffer = buf;
int mode = CInfoBox::SCROLL | CInfoBox::TITLE | CInfoBox::FOOT | CInfoBox::BORDER;// | //CInfoBox::NO_AUTO_LINEBREAK | //CInfoBox::CENTER | //CInfoBox::AUTO_WIDTH | //CInfoBox::AUTO_HIGH;
CBox position(g_settings.screen_StartX + 50, g_settings.screen_StartY + 50, g_settings.screen_EndX - g_settings.screen_StartX - 100, g_settings.screen_EndY - g_settings.screen_StartY - 100);
CInfoBox * infoBox = new CInfoBox(file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU], mode, &position, file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], NULL);
infoBox->setText(&buffer);
infoBox->exec();
delete infoBox;
}
else if(file->getType() == CFile::FILE_VIDEO)
{
moviePlayerGui->filename = file->Name.c_str();
moviePlayerGui->Title = file->Title;
moviePlayerGui->Info1 = file->Info1;
moviePlayerGui->Info2 = file->Info2;
// play
moviePlayerGui->exec(NULL, "urlplayback");
}
else if(file->getType() == CFile::FILE_AUDIO)
{
CAudioPlayerGui tmpAudioPlayerGui;
CAudiofileExt audiofile(file->Name, file->getExtension());
tmpAudioPlayerGui.addToPlaylist(audiofile);
tmpAudioPlayerGui.exec(NULL, "urlplayback");
}
}
g_RCInput->getMsg_ms(&msg, &data, 10);
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
}
示例15: exec
int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
{
int res = menu_return::RETURN_REPAINT;
if (actionKey.empty()) {
if (parent)
parent->hide();
int ret = showMenu();
saveConfig();
CFileHelpers::removeDir(OPKG_TMP_DIR);
return ret;
}
int selected = menu->getSelected() - menu_offset;
if (expert_mode && actionKey == "rc_blue") {
if (selected < 0 || selected >= (int) pkg_vec.size() || !pkg_vec[selected]->installed)
return menu_return::RETURN_NONE;
char loc[200];
snprintf(loc, sizeof(loc), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REMOVE), pkg_vec[selected]->name.c_str());
if (ShowMsg(LOCALE_OPKG_TITLE, loc, CMessageBox::mbrCancel, CMessageBox::mbYes | CMessageBox::mbCancel) != CMessageBox::mbrCancel) {
if (parent)
parent->hide();
execCmd(pkg_types[OM_REMOVE] + pkg_vec[selected]->name, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE_EVENT);
refreshMenu();
}
return res;
}
if (actionKey == "rc_info") {
if (selected < 0 || selected >= (int) pkg_vec.size()){
DisplayInfoMessage("No information available! Please first select a package!");
return menu_return::RETURN_NONE;
}
//show package info...
bool is_installed = pkg_vec[selected]->installed;
string infostr = getPkgInfo(pkg_vec[selected]->name, "", is_installed /*status or info*/);
//if available, generate a readable string for installation time
if (is_installed){
string tstr = getPkgInfo(pkg_vec[selected]->name, "Installed-Time", is_installed);
stringstream sstr(tstr);
time_t tval; sstr >> tval;
string newstr = asctime(localtime(&tval));
infostr = str_replace(tstr, newstr, infostr);
}
DisplayInfoMessage(infostr.c_str());
return res;
}
if (actionKey == "rc_yellow") {
expert_mode = !expert_mode;
updateMenu();
return res;
}
if (actionKey == "local_package") {
if (parent)
parent->hide();
CFileFilter fileFilter;
string filters[] = {"opk", "ipk"};
for(size_t i=0; i<sizeof(filters)/sizeof(filters[0]) ;i++)
fileFilter.addFilter(filters[i]);
CFileBrowser fileBrowser;
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec((*local_dir).c_str()))
{
string pkg_name = fileBrowser.getSelectedFile()->Name;
if (!installPackage(pkg_name))
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);
*local_dir = fileBrowser.getCurrentDir();
refreshMenu();
}
return res;
}
if(actionKey == pkg_types[OM_UPGRADE]) {
if (parent)
parent->hide();
int r = execCmd(actionKey, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE_EVENT);
if (r) {
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), strerror(errno), actionKey);
} else
installed = true;
refreshMenu();
/* I don't think ending up at the last package in the list is a good idea...
g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_up, 0);
*/
return res;
}
map<string, struct pkg>::iterator it = pkg_map.find(actionKey);
if (it != pkg_map.end()) {
if (parent)
parent->hide();
string force = "";
if (it->second.installed && !it->second.upgradable) {
char l[200];
snprintf(l, sizeof(l), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REINSTALL), actionKey.c_str());
//.........这里部分代码省略.........