Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chattr / chflags dialog + misc #2614

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions far2l/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ add_subdirectory (bootstrap)
set(SOURCES
src/farversion.cpp
src/cache.cpp
src/chattr.cpp
src/clipboard.cpp
src/cmdline.cpp
src/copy.cpp
Expand Down
111 changes: 111 additions & 0 deletions far2l/bootstrap/scripts/farlang.templ.m4
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ upd:"Change"
upd:"Change"
upd:"Change"

Reset
"Сбросить"
"Reset"
upd:"Reset"
upd:"Reset"
upd:"Reset"
upd:"Reset"
"Reiniciar"
"Скинути"
"Зкінуць"

HCancel
l:
"&Отмена"
Expand Down Expand Up @@ -14485,6 +14496,17 @@ MenuAttributes
"А&трибути файлів Ctrl+A"
"А&трыбуты файлаў Ctrl+A"

MenuChattr
"chattr / chflag&s Ctrl+Alt+A"
"chattr / ch&flags Ctrl+Alt+A"
upd:"chattr / ch&flags Ctrl+Alt+A"
upd:"chattr / ch&flags Ctrl+Alt+A"
upd:"c&hattr / chflags Ctrl+Alt+A"
upd:"chattr / ch&flags Ctrl+Alt+A"
upd:"chattr / ch&flags Ctrl+Alt+A"
upd:"chattr / chflag&s Ctrl+Alt+A"
upd:"c&hattr / chflags Ctrl+Alt+A"

MenuApplyCommand
"Применить коман&ду Ctrl+G"
"A&pply command Ctrl+G"
Expand Down Expand Up @@ -16435,6 +16457,17 @@ upd:"selected %d items"
upd:"selected %d items"
upd:"selected %d items"

SetAttrInfoSelDevices
"%lsустройств: %d"
"%lsdevices: %d"
upd:"%lsdevices: %d"
upd:"%lsdevices: %d"
upd:"%lsdevices: %d"
upd:"%lsdevices: %d"
upd:"%lsdevices: %d"
upd:"%lsdevices: %d"
upd:"%lsdevices: %d"

SetAttrInfoSelDirs
"%lsкаталогов: %d"
"%lsdirs: %d"
Expand Down Expand Up @@ -17163,6 +17196,84 @@ upd:" are displayed and will be modified for the original object"
upd:" are displayed and will be modified for the original object"
upd:" are displayed and will be modified for the original object"

ChAttrTitle
"chattr / chflags"
"chattr / chflags"
"chattr / chflags"
"chattr / chflags"
"chattr / chflags"
"chattr / chflags"
"chattr / chflags"
"chattr / chflags"
"chattr / chflags"

ChAttrWarnSystem
"Far2l пока ещё не умеет работать с флагами на Вашей системе"
"Far2l doesn't know how to handle flags on your system yet"
upd:"Far2l doesn't know how to handle flags on your system yet"
upd:"Far2l doesn't know how to handle flags on your system yet"
upd:"Far2l doesn't know how to handle flags on your system yet"
upd:"Far2l doesn't know how to handle flags on your system yet"
upd:"Far2l doesn't know how to handle flags on your system yet"
upd:"Far2l doesn't know how to handle flags on your system yet"
upd:"Far2l doesn't know how to handle flags on your system yet"

ChAttrWarnNoOne
"Применимо только к одному объекту.\nСейчас на панели выбрано несколько объектов."
"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."
upd:"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."
upd:"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."
upd:"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."
upd:"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."
upd:"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."
upd:"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."
upd:"Chattr/chflags only applicable to one object only.\nMultiple objects are currently selected in the panel."

ChAttrWarnNoRealFile
"Применимо только к реальному объекту доступному локально.\nСейчас на панели плагина не объект реальной файловой системы."
"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."

ChAttrWarnNoSymlinks
"Не применимо к символьным ссылкам"
"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"

ChAttrErrorGetFlags
"Не удается получить флаги для \"%ls\":\n"
"Cannot get flags of \"%ls\":\n"
upd:"Cannot get flags of \"%ls\":\n"
upd:"Cannot get flags of \"%ls\":\n"
upd:"Cannot get flags of \"%ls\":\n"
upd:"Cannot get flags of \"%ls\":\n"
upd:"Cannot get flags of \"%ls\":\n"
upd:"Cannot get flags of \"%ls\":\n"
upd:"Cannot get flags of \"%ls\":\n"

ChAttrErrorSetFlags
"Не удается установить флаги для \"%ls\":\n"
"Cannot chattr for \"%ls\":\n"
upd:"Cannot chattr for \"%ls\":\n"
upd:"Cannot chattr for \"%ls\":\n"
upd:"Cannot chattr for \"%ls\":\n"
upd:"Cannot chattr for \"%ls\":\n"
upd:"Cannot chattr for \"%ls\":\n"
upd:"Cannot chattr for \"%ls\":\n"
upd:"Cannot chattr for \"%ls\":\n"


SetColorPanel
l:
"&Панель"
Expand Down
78 changes: 76 additions & 2 deletions far2l/src/about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@
#include "farversion.h"
#include "vtshell.h"

#include <fstream>

bool get_os_release_PrettyName(FARString &fsPrettyName)
{
// see standard https://www.freedesktop.org/software/systemd/man/latest/os-release.html
// and examples https://github.com/chef/os_release
std::ifstream file("/etc/os-release", std::ios::in);
if (!file.is_open())
return false;

std::string::size_type p;
std::string line;
while (std::getline(file, line)) {
p = line.find("PRETTY_NAME=\"");
if (p == std::string::npos)
continue;
// Remove the PRETTY_NAME= part and the surrounding quotes
p += 13; // 13=strlen("PRETTY_NAME=\"")
std::string::size_type p2 = line.rfind('"'); // last quote
if (p2 == std::string::npos || p >= p2)
return false;
fsPrettyName = line.substr(p, p2 - p).c_str();
return true;
}
return false;
}

void FarAbout(PluginManager &Plugins)
{
static bool b_hide_empty = true;
Expand All @@ -28,7 +55,7 @@ void FarAbout(PluginManager &Plugins)

fs.Format(L" FAR2L Version: %s", FAR_BUILD);
ListAbout.AddItem(fs); fs2copy = fs;
fs = L" Compiler: ";
fs = L" Build Compiler: ";
#if defined (__clang__)
fs.AppendFormat(L"Clang, version %d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
#elif defined (__INTEL_COMPILER)
Expand All @@ -40,8 +67,49 @@ void FarAbout(PluginManager &Plugins)
#endif
ListAbout.AddItem(fs); fs2copy += "\n" + fs;

fs.Format(L" Platform: %s", FAR_PLATFORM);
fs.Format(L" Build Platform: %s", FAR_PLATFORM);
// subset of full OS list from https://sourceforge.net/p/predef/wiki/OperatingSystems/
#if defined(__ANDROID__)
fs += " (Android)";
#elif defined(__linux__)
fs += " (Linux)";
#elif defined(__APPLE__) || (__MACH__)
fs += " (macOS)";
#elif defined(__FreeBSD__)
fs += " (FreeBSD)";
#elif defined(__NetBSD__)
fs += " (NetBSD)";
#elif defined(__OpenBSD__)
fs += " (OpenBSD)";
#elif defined(__DragonFly__)
fs += " (DragonFly)";
#elif defined(BSD)
fs += " (unknown BSD)";
#elif defined(__HAIKU__)
fs += " (Haiku)";
#elif defined(_WIN64)
fs += " (Windows 64)";
#elif defined(_WIN32)
fs += " (Windows 32)";
#elif defined(__CYGWIN__)
fs += " (Cygwin)";
#elif defined(_AIX)
fs += " (AIX)";
#elif defined(sun) || defined(__sun)
# if defined(__SVR4) || defined(__svr4__)
fs += " (Solaris)";
# else
fs += " (SunOS)";
# endif
#elif defined(__EMSCRIPTEN__)
fs += " (WEB: Emscripten)";
#elif defined(__QNX__)
fs += " (QNX)";
#else
fs += " (unknown)";
#endif
ListAbout.AddItem(fs); fs2copy += "\n" + fs;

fs.Format(L" Backend: %s", WinPortBackendInfo(-1));
ListAbout.AddItem(fs); fs2copy += "\n" + fs;
fs.Format(L" ConsoleColorPalette: %u", WINPORT(GetConsoleColorPalette)(NULL) );
Expand Down Expand Up @@ -80,6 +148,12 @@ void FarAbout(PluginManager &Plugins)
ListAbout.AddItem(fs); fs2copy += "\n" + fs;

ListAbout.AddItem(L""); fs2copy += "\n";

if (get_os_release_PrettyName(fs2)) {
fs = L" os-release PRETTY_NAME: " + fs2;
ListAbout.AddItem(fs); fs2copy += "\n" + fs;
}

struct utsname un;
fs = L" uname: ";
if (uname(&un)==0) {
Expand Down
Loading