Исправлен баг с вызовом браузера

pull/107/head
Igor Belitskiy 3 years ago
parent a231791f3d
commit be48cf2c97

@ -436,21 +436,28 @@ void MainWindow::open_browser() {
webkit_web_view_load_uri(one, link_doc);
wndWeb->show_all();
}
else {
this->template_open_browser();
}
#else
string cmd = cmd_xdg + string(_(link_doc)) + " &";
string buf = "";
if (geteuid() == 0) {
string response_user = getlogin();
int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1;
auto size = static_cast<size_t>(size_s);
std::unique_ptr<char[]> buf(new char[ size ]);
std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() );
cmd = std::string( buf.get(), buf.get() + size - 1 );
}
obj_process_system.call(cmd, "&");
this->template_open_browser();
#endif
}
void MainWindow::template_open_browser() {
string cmd = cmd_xdg + string(_(link_doc)) + " &";
string buf = "";
if (geteuid() == 0) {
string response_user = getlogin();
int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1;
auto size = static_cast<size_t>(size_s);
std::unique_ptr<char[]> buf(new char[ size ]);
std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() );
cmd = std::string( buf.get(), buf.get() + size - 1 );
}
index_error = system(cmd.c_str());
}
void MainWindow::load_local_cfg() {
flag_local_global_load = 0;
flag_load = false;

@ -147,6 +147,7 @@ class MainWindow : public Gtk::ApplicationWindow {
int error_info = 0;
int warning_info = 0;
string cmd_error = "";
int index_error = 0;
int flag_local_global_load = 2;
int hour;
int minute;
@ -188,6 +189,7 @@ class MainWindow : public Gtk::ApplicationWindow {
void fill_in_reg_zone(string cmd);
void load_globl_cfg();
void save_local_cfg();
void template_open_browser();
void event_zone();
bool focus_ntp(GdkEventFocus* event);
bool check_config(string key, int key_save);

Loading…
Cancel
Save