void CTestMenu::testCStringInputSMS() { std::string value; CStringInputSMS * stringInputSMS = new CStringInputSMS("CStringInputSMS", (char *)value.c_str()); stringInputSMS->exec(NULL, ""); stringInputSMS->hide(); delete stringInputSMS; value.clear(); }
std::string CBEBouquetWidget::inputName(const char * const defaultName, const neutrino_locale_t caption) { char Name[30]; strncpy(Name, defaultName, 30); CStringInputSMS * nameInput = new CStringInputSMS(caption, Name, 29, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-.,:|!?/ "); nameInput->exec(this, ""); delete nameInput; return std::string(Name); }
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; }
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; }