Решена проблема с копирование команды в поле команда

pull/3/head
Igor Belitskiy 3 years ago
parent 1fbcb692ce
commit 046081fcab

@ -259,8 +259,10 @@ void MainWindow::select_System(){
} }
void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list){ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list){
auto selected = (*icon).get_selected_items(); auto selected = (*icon).get_selected_items();
if(!selected.empty()) if(!selected.empty())
{ {
this->unselect_icon(icon);
const Gtk::TreeModel::Path& path = *selected.begin(); const Gtk::TreeModel::Path& path = *selected.begin();
Gtk::TreeModel::iterator iter = gtk_list->get_iter(path); Gtk::TreeModel::iterator iter = gtk_list->get_iter(path);
Gtk::TreeModel::Row row = *iter; Gtk::TreeModel::Row row = *iter;
@ -272,7 +274,6 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::List
int len_name_app = name_app.length(); int len_name_app = name_app.length();
string array_del[] = {"%f","%F","%d","%D","%n","%N"}; string array_del[] = {"%f","%F","%d","%D","%n","%N"};
for (auto &del_sim: array_del){ for (auto &del_sim: array_del){
cout << del_sim << endl;
str_remove(name_app, del_sim); str_remove(name_app, del_sim);
if (name_app.length()!=len_name_app){ if (name_app.length()!=len_name_app){
txtCmd->set_text(name_app); txtCmd->set_text(name_app);
@ -285,7 +286,18 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::List
} }
} }
void MainWindow::unselect_icon(Gtk::IconView *icon_entry){
for (Gtk::IconView* &icon : array_icon) {
if (icon_entry!=icon){
cout << "22222" << endl;
//icon->unselect_all();
}
else{
cout << "11111" << endl;
}
}
}
void MainWindow::settings(){ void MainWindow::settings(){
this->pars_apps(); this->pars_apps();
@ -310,6 +322,7 @@ void MainWindow::settings(){
rbSu->set_sensitive(false); rbSu->set_sensitive(false);
rbSudo->set_sensitive(false); rbSudo->set_sensitive(false);
} }
void MainWindow::close_entry_app(){ void MainWindow::close_entry_app(){
this->icon_clear(); this->icon_clear();
@ -420,7 +433,9 @@ void MainWindow::start_cmd(){
string str_variants_root = ""; string str_variants_root = "";
string str_nice_cmd = ""; string str_nice_cmd = "";
string user_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 (chbAnotherUser->get_active()){
if (geteuid()!=0){ 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(); messageError->show();
return;
} }
if (chbTerminal->get_active()){ if (chbTerminal->get_active()){
@ -485,19 +501,32 @@ void MainWindow::start_cmd(){
} }
string cmd = ""; string cmd = "";
if (path_file!=""){ if (path_file!=""){
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + path_file + "' ";
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + user_cmd + "' &"; //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{ else{
user_cmd = this->str_remove(user_cmd,str_cmd_terminal);
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd + " &"; 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); txtCmd->set_text(cmd);
cmd=cmd+ " &";
system(cmd.c_str()); system(cmd.c_str());
path_file_name=""; path_file_name="";
path_file=""; path_file="";
name_app="";
} }
void MainWindow::changed_user(){ void MainWindow::changed_user(){
Glib::ustring entry_user = cmbUser->get_active_text(); Glib::ustring entry_user = cmbUser->get_active_text();
if (geteuid()==0 || entry_user == "root"){ if (geteuid()==0 || entry_user == "root"){

@ -102,6 +102,7 @@ public:
void select_Development(); void select_Development();
void select_System(); void select_System();
void icon_clear(); void icon_clear();
void unselect_icon(Gtk::IconView *icon_entry);
string str_remove(std::string& source, const std::string& to_remove); string str_remove(std::string& source, const std::string& to_remove);
vector<std::string> split(const std::string &s, char delim); vector<std::string> split(const std::string &s, char delim);
@ -224,6 +225,18 @@ public:
list <struct_App> list_app; list <struct_App> list_app;
set <string> set_categories; set <string> 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
};
}; };

@ -4,3 +4,4 @@
.textHead{ .textHead{
text-shadow: 1px 1px #ffffff; text-shadow: 1px 1px #ffffff;
} }

@ -597,8 +597,6 @@
<property name="width-request">330</property> <property name="width-request">330</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes" context="Date of&#10;Format: DD.MM.YYYY" comments="Date of&#10;Format: DD.MM.YYYY">Дата
Формат: ДД.ММ.ГГГГ</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -607,7 +605,7 @@
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>

Loading…
Cancel
Save