From 046081fcabafb1f5c647d7ab3eed2242ab5c4124 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 2 Feb 2023 16:38:56 +0600 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=88=D0=B5=D0=BD=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D0=B0=20=D1=81=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BF=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ublexec.cc | 45 +++++++++++++++++++++++++++++++++++++-------- source/ublexec.h | 15 ++++++++++++++- style.css | 3 ++- ublexec.glade | 4 +--- 4 files changed, 54 insertions(+), 13 deletions(-) diff --git a/source/ublexec.cc b/source/ublexec.cc index 5204ecc..121f5f3 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -259,8 +259,10 @@ void MainWindow::select_System(){ } void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr >k_list){ auto selected = (*icon).get_selected_items(); + if(!selected.empty()) { + this->unselect_icon(icon); const Gtk::TreeModel::Path& path = *selected.begin(); Gtk::TreeModel::iterator iter = gtk_list->get_iter(path); Gtk::TreeModel::Row row = *iter; @@ -272,7 +274,6 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtrset_text(name_app); @@ -285,7 +286,18 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtrunselect_all(); + } + else{ + cout << "11111" << endl; + } + } +} void MainWindow::settings(){ this->pars_apps(); @@ -309,6 +321,7 @@ void MainWindow::settings(){ rbPkexec->set_sensitive(false); rbSu->set_sensitive(false); rbSudo->set_sensitive(false); + } void MainWindow::close_entry_app(){ @@ -420,7 +433,9 @@ void MainWindow::start_cmd(){ string str_variants_root = ""; string str_nice_cmd = ""; string user_cmd = ""; - user_cmd = txtCmd->get_text(); + if (name_app.length()==0 && path_file.length()==0){ + user_cmd = txtCmd->get_text(); + } //========================================= if (chbAnotherUser->get_active()){ if (geteuid()!=0){ @@ -473,8 +488,9 @@ void MainWindow::start_cmd(){ //========================================= //========================================= - if (user_cmd.length()==0){ + if (user_cmd.length()==0 && name_app.length()==0 && path_file.length()==0){ messageError->show(); + return; } if (chbTerminal->get_active()){ @@ -485,19 +501,32 @@ void MainWindow::start_cmd(){ } string cmd = ""; if (path_file!=""){ - - cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + user_cmd + "' &"; + cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + path_file + "' "; + //cmd = format_cmd(str_cmd_terminal,str_variants_root,str_nice_cmd,path_file, cmd); + } + else if (name_app!=""){ + cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + name_app; + //cmd = format_cmd(str_cmd_terminal,str_variants_root,str_nice_cmd,path_file, cmd); } else{ - - cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd + " &"; + user_cmd = this->str_remove(user_cmd,str_cmd_terminal); + user_cmd = this->str_remove(user_cmd,str_variants_root); + user_cmd = this->str_remove(user_cmd,str_nice_cmd); + string amp = " &"; + user_cmd = this->str_remove(user_cmd, amp); + cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd; + //cmd = format_cmd(str_cmd_terminal,str_variants_root,str_nice_cmd,path_file, cmd); } txtCmd->set_text(cmd); + cmd=cmd+ " &"; system(cmd.c_str()); path_file_name=""; path_file=""; + name_app=""; } + + void MainWindow::changed_user(){ Glib::ustring entry_user = cmbUser->get_active_text(); if (geteuid()==0 || entry_user == "root"){ diff --git a/source/ublexec.h b/source/ublexec.h index a7f5ca3..59261e6 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -102,6 +102,7 @@ public: void select_Development(); void select_System(); void icon_clear(); + void unselect_icon(Gtk::IconView *icon_entry); string str_remove(std::string& source, const std::string& to_remove); vector split(const std::string &s, char delim); @@ -223,7 +224,19 @@ public: }; list list_app; set set_categories; - int index_exec_gui_apps = 0; + int index_exec_gui_apps = 0; + Gtk::IconView* array_icon[10] = { + iconGraphics, + iconTools, + iconInternet, + iconMultimedia, + iconSettings, + iconEducation, + iconOffice, + iconOther, + iconDevelopment, + iconSystem + }; }; diff --git a/style.css b/style.css index d237a01..41a96a0 100644 --- a/style.css +++ b/style.css @@ -3,4 +3,5 @@ } .textHead{ text-shadow: 1px 1px #ffffff; -} \ No newline at end of file +} + diff --git a/ublexec.glade b/ublexec.glade index a04c7f9..e666d14 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -597,8 +597,6 @@ 330 True True - Дата -Формат: ДД.ММ.ГГГГ 5 5 5 @@ -607,7 +605,7 @@ 6 - False + True True 1