From ccf40f7725807ea3ed4b1aedbed81221b3ed1162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= Date: Thu, 9 May 2024 11:29:04 +0800 Subject: [PATCH] readd function to set file executable permission MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 侯红勋 --- .../permissions-properties-page.cpp | 107 ++++++++---------- translations/libpeony-qt/libpeony-qt_bo_CN.ts | 40 ++----- translations/libpeony-qt/libpeony-qt_cs.ts | 62 +++++++--- translations/libpeony-qt/libpeony-qt_tr.ts | 54 +++++---- translations/libpeony-qt/libpeony-qt_zh_CN.ts | 60 +++++----- .../peony-qt-desktop/peony-qt-desktop_cs.ts | 12 +- .../peony-qt-desktop/peony-qt-desktop_tr.ts | 12 +- .../peony-qt-desktop_zh_CN.ts | 12 +- translations/peony-qt/peony-qt_cs.ts | 4 +- translations/peony-qt/peony-qt_tr.ts | 4 +- translations/peony-qt/peony-qt_zh_CN.ts | 4 +- 11 files changed, 194 insertions(+), 177 deletions(-) diff --git a/libpeony-qt/controls/property-page/permissions-properties-page.cpp b/libpeony-qt/controls/property-page/permissions-properties-page.cpp index 078c1b4..bfd648f 100644 --- a/libpeony-qt/controls/property-page/permissions-properties-page.cpp +++ b/libpeony-qt/controls/property-page/permissions-properties-page.cpp @@ -37,8 +37,7 @@ #include #include #include -#include -#include +#include #include #include @@ -116,8 +115,7 @@ void PermissionsPropertiesPage::initTableWidget() { m_table = new QTableWidget(this); m_table->setRowCount(4); - //属性窗口重构,可读、可写、可执行 改成 读写、只读 - m_table->setColumnCount(3); + m_table->setColumnCount(5); m_table->verticalHeader()->setVisible(false); m_table->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_table->horizontalHeader()->setFrameShape(QFrame::NoFrame); @@ -133,8 +131,7 @@ void PermissionsPropertiesPage::initTableWidget() m_table->setAlternatingRowColors(true); auto l = QStringList(); - //属性窗口重构,类型、可读、可写、可执行 改成 读写、只读 - l<setHorizontalHeaderLabels(l); m_table->setEditTriggers(QTableWidget::NoEditTriggers); //开启手动设置宽度 - Enable manual width setting @@ -142,8 +139,10 @@ void PermissionsPropertiesPage::initTableWidget() m_table->horizontalHeader()->setMaximumSectionSize(400); m_table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive); - m_table->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); + m_table->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive); m_table->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); + m_table->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch); + m_table->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Stretch); m_table->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft); m_table->setColumnWidth(0, 150); @@ -246,7 +245,7 @@ GAsyncReadyCallback PermissionsPropertiesPage::async_query_permisson_callback(GO bool isSameGroup = false; auto username = pw->pw_name; if (userString == username) { - userNameDisplayString += tr("(Current User)"); + userNameDisplayString += tr("(Me)"); isSelf = true; } /* @@ -318,6 +317,17 @@ GAsyncReadyCallback PermissionsPropertiesPage::async_query_permisson_callback(GO QTableWidgetItem* itemR2C0 = new QTableWidgetItem(QIcon::fromTheme("emblem-people"), tr("Others")); table->setItem(2, 0, itemR2C0); + auto itemR0C1 = new QTableWidgetItem(tr("Owner")); + itemR0C1->setTextAlignment(Qt::AlignCenter); + auto itemR1C1 = new QTableWidgetItem(tr("Group")); + itemR1C1->setTextAlignment(Qt::AlignCenter); + auto itemR2C1 = new QTableWidgetItem(tr("Other")); + itemR2C1->setTextAlignment(Qt::AlignCenter); + + table->setItem(0, 1, itemR0C1); + table->setItem(1, 1, itemR1C1); + table->setItem(2, 1, itemR2C1); + table->showRow(0); table->showRow(1); table->showRow(2); @@ -326,27 +336,35 @@ GAsyncReadyCallback PermissionsPropertiesPage::async_query_permisson_callback(GO p_this->m_message->show(); table->setRowCount(1); - QTableWidgetItem *itemR0C0 = new QTableWidgetItem(QIcon::fromTheme("emblem-personal"), tr("Current User")); + QTableWidgetItem *itemR0C0 = new QTableWidgetItem(QIcon::fromTheme("emblem-personal"), tr("Me")); table->setItem(0, 0, nullptr); table->setItem(0, 0, itemR0C0); - for (int i = 0; i < 2; i++) { - table->setCellWidget(0, i + 1, nullptr); + auto itemR0C1 = new QTableWidgetItem(tr("User")); + itemR0C1->setTextAlignment(Qt::AlignCenter); + + table->setItem(0, 1, itemR0C1); + + for (int i = 0; i < 3; i++) { + table->setCellWidget(0, i + 2, nullptr); QWidget *w = new QWidget(table); QHBoxLayout *l = new QHBoxLayout(w); l->setMargin(0); w->setLayout(l); l->setAlignment(Qt::AlignCenter); - QRadioButton* radioButton = new QRadioButton(w); - l->addWidget(radioButton); - table->setCellWidget(0, i + 1, w); + auto checkbox = new QCheckBox(w); + l->addWidget(checkbox); + table->setCellWidget(0, i + 2, w); switch (i) { case 0: - radioButton->setChecked(current_user_writeable&¤t_user_readable); + checkbox->setChecked(current_user_readable); break; case 1: - radioButton->setChecked((!current_user_writeable)&¤t_user_readable); + checkbox->setChecked(current_user_writeable); + break; + case 2: + checkbox->setChecked(current_user_executable); break; } } @@ -367,21 +385,8 @@ void PermissionsPropertiesPage::changePermission(int row, int column, bool check if(!m_enable) return; - bool havePermission = false; - if(0 == column) - { - havePermission = !(m_permissions[row][1]&&m_permissions[row][0]); - havePermission = checked? havePermission:checked; - m_permissions[row][0] = havePermission; - m_permissions[row][1] = havePermission; - } - else - { - havePermission = !((!m_permissions[row][1])&&m_permissions[row][0]); - havePermission = checked? havePermission:checked; - m_permissions[row][0] = havePermission; - m_permissions[row][1] = false; - } + m_permissions[row][column] = checked; + this->thisPageChanged(); this->updateCheckBox(); @@ -477,32 +482,18 @@ void PermissionsPropertiesPage::thisPageChanged() void PermissionsPropertiesPage::updateCheckBox() { for (int i = 0; i < 3; i++) { - //修改文件管理器属性界面的权限页,设置权限为读写,可读 - QButtonGroup* permissionsBtGroup = new QButtonGroup(this); - for (int j = 0; j < 2; j++) { - m_table->setCellWidget(i, j + 1, nullptr); + for (int j = 0; j < 3; j++) { + m_table->setCellWidget(i, j + 2, nullptr); QWidget *w = new QWidget(m_table); QHBoxLayout *l = new QHBoxLayout(w); l->setMargin(0); w->setLayout(l); l->setAlignment(Qt::AlignCenter); - QRadioButton* radioButton = new QRadioButton(w); - l->addWidget(radioButton); - permissionsBtGroup->addButton(radioButton); - permissionsBtGroup->setId(radioButton,j); - m_table->setCellWidget(i, j + 1, w); - bool checkType = false; - if(0 == j) - { - checkType = this->m_permissions[i][1]&&this->m_permissions[i][0]; - } - else - { - checkType = (!this->m_permissions[i][1])&&this->m_permissions[i][0]; - } - radioButton->setAutoExclusive(false); - radioButton->setChecked(checkType); - radioButton->setAutoExclusive(true); + auto checkbox = new QCheckBox(w); + l->addWidget(checkbox); + m_table->setCellWidget(i, j + 2, w); + + checkbox->setChecked(this->m_permissions[i][j]); //disable home path bool check_enable = true; @@ -517,15 +508,15 @@ void PermissionsPropertiesPage::updateCheckBox() QString homeUri = "file://" + QStandardPaths::writableLocation(QStandardPaths::HomeLocation); if (this->m_uri == homeUri || !check_enable) - radioButton->setDisabled(true); + checkbox->setDisabled(true); else - radioButton->setDisabled(false); + checkbox->setDisabled(false); + connect(checkbox, &QCheckBox::clicked, this, [=]() { + qDebug()<<"clicked"<isChecked(); + this->checkBoxChanged(i, j, checkbox->isChecked()); + }); } - connect(permissionsBtGroup, QOverload::of(&QButtonGroup::buttonClicked), - [=](int id){ - this->checkBoxChanged(i, id, permissionsBtGroup->button(id)->isChecked()); - }); } } diff --git a/translations/libpeony-qt/libpeony-qt_bo_CN.ts b/translations/libpeony-qt/libpeony-qt_bo_CN.ts index 78e61e7..b97ad36 100644 --- a/translations/libpeony-qt/libpeony-qt_bo_CN.ts +++ b/translations/libpeony-qt/libpeony-qt_bo_CN.ts @@ -1914,39 +1914,39 @@ Do you want to delete the link file? Peony::PermissionsPropertiesPage Me - + (Me) - (ང) + (ང) Read - ཚགས་ཚུད། + ཚགས་ཚུད། Type - རིགས་གྲས་ + རིགས་གྲས་ User - སྤྱོད་མཁན། + སྤྱོད་མཁན། Group - ཚོགས་པ། + ཚོགས་པ། Other - གཞན་དག + གཞན་དག Owner - བདག་པོ། + བདག་པོ། Write - འབྲི་བ། + འབྲི་བ། Can not get the permission info. @@ -1962,35 +1962,19 @@ Do you want to delete the link file? User or Group - སྤྱོད་མཁན་ནམ་ཚོ། + སྤྱོད་མཁན་ནམ་ཚོ། Executable - ལག་བསྟར་ཐུབ་པའི་ཡིག་ཆ། + ལག་བསྟར་ཐུབ་པའི་ཡིག་ཆ། Target: %1 དམིགས་འབེན།: - - Group or User - - - - Read and Write - - Readonly - ཀློག་ཙམ། - - - (Current User) - - - - Current User - + ཀློག་ཙམ། diff --git a/translations/libpeony-qt/libpeony-qt_cs.ts b/translations/libpeony-qt/libpeony-qt_cs.ts index a0f8fd6..5e3be4c 100644 --- a/translations/libpeony-qt/libpeony-qt_cs.ts +++ b/translations/libpeony-qt/libpeony-qt_cs.ts @@ -2399,52 +2399,82 @@ Do you want to delete the link file? Peony::PermissionsPropertiesPage - - + + Target: %1 - - Group or User + + User or Group - - Read and Write + + Type - - Readonly + + Read - - (Current User) + + Write - - Current User + + Executable - - + + Can not get the permission info. - + + (Me) + + + + Others - + + Owner + + + + + Group + + + + + Other + + + + You can not change the access of this file. + + + Me + + + + + User + + Peony::PropertiesWindow diff --git a/translations/libpeony-qt/libpeony-qt_tr.ts b/translations/libpeony-qt/libpeony-qt_tr.ts index d1b2f51..5229d08 100644 --- a/translations/libpeony-qt/libpeony-qt_tr.ts +++ b/translations/libpeony-qt/libpeony-qt_tr.ts @@ -2804,12 +2804,14 @@ Bağlantı dosyasını silmek istiyor musunuz? Peony::PermissionsPropertiesPage + User or Group - Kullanıcı veya Grup + Kullanıcı veya Grup + Type - Tür + Tür Readable @@ -2828,79 +2830,83 @@ Bağlantı dosyasını silmek istiyor musunuz? Dosya:%1 - - + + Target: %1 - Read and Write - Okuma ve Yazma + Okuma ve Yazma - Readonly - Salt Okunur + Salt Okunur - - Group or User + + Read - - (Current User) + + Write - - Current User + + Executable - - + + Can not get the permission info. İzin bilgileri alınamıyor. + (Me) - (Ben) + (Ben) - + Others Diğerleri + Owner - Sahibi + Sahibi + Group - Grup + Grup + Other - Diğer + Diğer Other Users Diğer Kullanıcılar - + You can not change the access of this file. Bu dosyanın erişimini değiştiremezsiniz. + Me - Ben + Ben + User - Kullanıcı + Kullanıcı diff --git a/translations/libpeony-qt/libpeony-qt_zh_CN.ts b/translations/libpeony-qt/libpeony-qt_zh_CN.ts index f1ea50a..bedcb31 100644 --- a/translations/libpeony-qt/libpeony-qt_zh_CN.ts +++ b/translations/libpeony-qt/libpeony-qt_zh_CN.ts @@ -2857,12 +2857,14 @@ Do you want to delete the link file? Peony::PermissionsPropertiesPage + User or Group - 用户或组 + 用户或组 + Type - 类型 + 类型 Readable @@ -2881,91 +2883,95 @@ Do you want to delete the link file? 文件:%1 - - + + Target: %1 对象名称: %1 - Read and Write - 读写 + 读写 - Readonly - 只读 + 只读 - Group or User - 组或用户名 + 组或用户名 - (Current User) - (本用户) + (本用户) - Current User - 本用户 + 本用户 + Read - 可读 + 可读 + Write - 可写 + 可写 + Executable - 可执行 + 可执行 - - + + Can not get the permission info. 无法获取文件权限相关信息。 + (Me) - (我) + (我) - + Others 其他 + Owner - 拥有者 + 拥有者 + Group - 用户组 + 用户组 + Other - 其他 + 其他 Other Users 其它用户 - + You can not change the access of this file. 你无法修改该文件的权限。 + Me - + + User - 用户 + 用户 diff --git a/translations/peony-qt-desktop/peony-qt-desktop_cs.ts b/translations/peony-qt-desktop/peony-qt-desktop_cs.ts index 8c67a5d..23e1196 100644 --- a/translations/peony-qt-desktop/peony-qt-desktop_cs.ts +++ b/translations/peony-qt-desktop/peony-qt-desktop_cs.ts @@ -328,7 +328,7 @@ Masaüstünü kapatın ve çıkın - + peony-qt-desktop Masaüstü @@ -341,27 +341,27 @@ Masaüstü - + Close the peony desktop window - + Take over the dbus service. - + Take over the desktop displaying - + Setup backgrounds - + Open learning center. diff --git a/translations/peony-qt-desktop/peony-qt-desktop_tr.ts b/translations/peony-qt-desktop/peony-qt-desktop_tr.ts index 474439c..927940c 100644 --- a/translations/peony-qt-desktop/peony-qt-desktop_tr.ts +++ b/translations/peony-qt-desktop/peony-qt-desktop_tr.ts @@ -420,7 +420,7 @@ Masaüstünü kapatın ve çıkın - + peony-qt-desktop Masaüstü @@ -433,27 +433,27 @@ Masaüstü - + Close the peony desktop window Peony masaüstü penceresini kapat - + Take over the dbus service. Dbus servisini al - + Take over the desktop displaying Masaüstü görüntülemeyi al - + Setup backgrounds - + Open learning center. diff --git a/translations/peony-qt-desktop/peony-qt-desktop_zh_CN.ts b/translations/peony-qt-desktop/peony-qt-desktop_zh_CN.ts index d41388e..57f10dd 100644 --- a/translations/peony-qt-desktop/peony-qt-desktop_zh_CN.ts +++ b/translations/peony-qt-desktop/peony-qt-desktop_zh_CN.ts @@ -432,7 +432,7 @@ 关闭桌面并退出 - + peony-qt-desktop 桌面 @@ -445,27 +445,27 @@ 桌面 - + Close the peony desktop window 关闭桌面程序 - + Take over the dbus service. 接管DBus服务。 - + Take over the desktop displaying 接管桌面 - + Setup backgrounds Setup backgrounds - + Open learning center. diff --git a/translations/peony-qt/peony-qt_cs.ts b/translations/peony-qt/peony-qt_cs.ts index e73be0f..c795434 100644 --- a/translations/peony-qt/peony-qt_cs.ts +++ b/translations/peony-qt/peony-qt_cs.ts @@ -246,12 +246,12 @@ p, li { white-space: pre-wrap; } - + Tips info - + Trash has no file need to be cleaned. diff --git a/translations/peony-qt/peony-qt_tr.ts b/translations/peony-qt/peony-qt_tr.ts index bf7b7b9..320a4bf 100644 --- a/translations/peony-qt/peony-qt_tr.ts +++ b/translations/peony-qt/peony-qt_tr.ts @@ -270,12 +270,12 @@ p, li { white-space: pre-wrap; } Ara - + Tips info - + Trash has no file need to be cleaned. diff --git a/translations/peony-qt/peony-qt_zh_CN.ts b/translations/peony-qt/peony-qt_zh_CN.ts index 58db5dc..2fcef0a 100644 --- a/translations/peony-qt/peony-qt_zh_CN.ts +++ b/translations/peony-qt/peony-qt_zh_CN.ts @@ -290,12 +290,12 @@ p, li { white-space: pre-wrap; } 搜索 - + Tips info 温馨提示 - + Trash has no file need to be cleaned. 回收站没有文件需要被清空! -- 2.43.0