MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / bookmark_DefaultKey

Method bookmark_DefaultKey

Goldleaf/source/ui/ui_WebBrowserLayout.cpp:101–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 }
100
101 void WebBrowserLayout::bookmark_DefaultKey(cfg::json::WebBookmark &bmk) {
102 const auto option_1 = g_MainApplication->DisplayDialog(cfg::Strings.GetString(383), cfg::Strings.GetString(384), { cfg::Strings.GetString(385), cfg::Strings.GetString(386), cfg::Strings.GetString(245), cfg::Strings.GetString(18) }, true);
103 switch(option_1) {
104 case 0: {
105 const auto rc = LaunchWebAppletImpl(bmk.url);
106 if(R_FAILED(rc)) {
107 HandleResult(rc, cfg::Strings.GetString(40));
108 }
109 break;
110 }
111 case 1: {
112 const auto option_2 = g_MainApplication->DisplayDialog(cfg::Strings.GetString(387), cfg::Strings.GetString(388), { cfg::Strings.GetString(389), cfg::Strings.GetString(390), cfg::Strings.GetString(18) }, true);
113 switch(option_2) {
114 case 0: {
115 const auto name = ShowKeyboard(cfg::Strings.GetString(391));
116 if(!name.empty()) {
117 for(auto &saved_bmk: g_Settings.json_settings.web.value().bookmarks.value()) {
118 if(saved_bmk.name == bmk.name) {
119 saved_bmk.name = name;
120 g_Settings.Save();
121 this->Refresh();
122 g_MainApplication->ShowNotification(cfg::Strings.GetString(393));
123 }
124 }
125 }
126 break;
127 }
128 case 1: {
129 const auto url = ShowKeyboard(cfg::Strings.GetString(392), "https://");
130 if(!url.empty()) {
131 for(auto &saved_bmk: g_Settings.json_settings.web.value().bookmarks.value()) {
132 if(saved_bmk.name == bmk.name) {
133 saved_bmk.url = url;
134 g_Settings.Save();
135 this->Refresh();
136 g_MainApplication->ShowNotification(cfg::Strings.GetString(394));
137 }
138 }
139
140 }
141 break;
142 }
143 }
144 break;
145 }
146 case 2: {
147 const auto option_2 = g_MainApplication->DisplayDialog(cfg::Strings.GetString(395), cfg::Strings.GetString(396), { cfg::Strings.GetString(111), cfg::Strings.GetString(18) }, true);
148 switch(option_2) {
149 case 0: {
150 for(u32 i = 0; i < g_Settings.json_settings.web.value().bookmarks.value().size(); i++) {
151 const auto &saved_bmk = g_Settings.json_settings.web.value().bookmarks.value().at(i);
152 if(bmk.name == saved_bmk.name) {
153 g_Settings.json_settings.web.value().bookmarks.value().erase(g_Settings.json_settings.web.value().bookmarks.value().begin() + i);
154 g_Settings.Save();
155 this->opts_menu->SetSelectedIndex(this->opts_menu->GetSelectedIndex() - 1);
156 this->Refresh();
157 g_MainApplication->ShowNotification(cfg::Strings.GetString(397));
158 break;

Callers

nothing calls this directly

Calls 7

RefreshMethod · 0.95
LaunchWebAppletImplFunction · 0.85
HandleResultFunction · 0.85
ShowKeyboardFunction · 0.85
DisplayDialogMethod · 0.80
SaveMethod · 0.80
ShowNotificationMethod · 0.80

Tested by

no test coverage detected