From 93514076a6f184aa443ff354319cea1c08b87fff Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sun, 10 Nov 2024 10:27:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9A=E6=A0=BC=E5=BC=8F=EF=BC=9B?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=A3=81=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deviceinfo/udiskdeviceinfo.cpp | 2 +- .../views/dfmsidebardeviceitem.cpp | 6 +++- usb-device-formatter/main.cpp | 9 ++--- ....deepin.pkexec.usb-device-formatter.policy | 36 +++++++++---------- ...pin.pkexec.usb-device-formatter.policy.tmp | 6 ++-- usb-device-formatter/view/mainpage.cpp | 4 +-- usb-device-formatter/view/mainpage.h | 15 +++++++- 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/dde-file-manager-lib/deviceinfo/udiskdeviceinfo.cpp b/dde-file-manager-lib/deviceinfo/udiskdeviceinfo.cpp index 27ce33c..5e6f47f 100644 --- a/dde-file-manager-lib/deviceinfo/udiskdeviceinfo.cpp +++ b/dde-file-manager-lib/deviceinfo/udiskdeviceinfo.cpp @@ -419,7 +419,7 @@ QVector UDiskDeviceInfo::menuActionList(DAbstractFileInfo::MenuType actionKeys << MenuAction::Mount; } - if (getMediaType() == removable) { + if (getMediaType() == removable || getMediaType() == native) { actionKeys << MenuAction::FormatDevice; } diff --git a/dde-file-manager-lib/views/dfmsidebardeviceitem.cpp b/dde-file-manager-lib/views/dfmsidebardeviceitem.cpp index ff9123a..641092e 100644 --- a/dde-file-manager-lib/views/dfmsidebardeviceitem.cpp +++ b/dde-file-manager-lib/views/dfmsidebardeviceitem.cpp @@ -146,7 +146,11 @@ QMenu *DFMSideBarDeviceItem::createStandardContextMenu() const menu->addAction(QObject::tr("Unmount"), this, SLOT(doUnmountOrEject())); } - if (info.value("mediaType", 0).toInt() == UDiskDeviceInfo::MediaType::removable && !info.value("optical", false).toBool()) { + // 只允许分区和可移动设备格式化 + if ((info.value("mediaType", 0).toInt() == UDiskDeviceInfo::MediaType::native + || info.value("mediaType", 0).toInt() == UDiskDeviceInfo::MediaType::removable + ) && + !info.value("optical", false).toBool()) { menu->addAction(QObject::tr("Format"), [this, info, deviceIdUrl]() { AppController::instance()->actionFormatDevice(dMakeEventPointer(this, deviceIdUrl)); }); diff --git a/usb-device-formatter/main.cpp b/usb-device-formatter/main.cpp index 42fbb18..9631e62 100755 --- a/usb-device-formatter/main.cpp +++ b/usb-device-formatter/main.cpp @@ -88,8 +88,8 @@ int main(int argc, char *argv[]) a.installTranslator(translator); a.setTheme("light"); - a.setOrganizationName("deepin"); - a.setApplicationName("Deepin usb device formatter"); + a.setOrganizationName("GXDE"); + a.setApplicationName("GXDE device formatter"); a.setApplicationVersion("1.0"); a.setWindowIcon(QIcon(":/app/usb-device-formatter.png")); a.setQuitOnLastWindowClosed(true); @@ -112,14 +112,15 @@ int main(int argc, char *argv[]) return 0; } + // 解除只允许格式化可移动设备的限制 //Check if is a removable device - PartMan::Partition p = PartMan::Partition::getPartitionByDevicePath(path); + /*PartMan::Partition p = PartMan::Partition::getPartitionByDevicePath(path); if(!p.getIsRemovable()){ QString message = QObject::tr("Cannot format local device"); MessageDialog d(message, 0); d.exec(); return 0; - } + }*/ MainWindow* w = new MainWindow(path); w->show(); diff --git a/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy b/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy index cba4fcc..11a2716 100644 --- a/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy +++ b/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy @@ -3,9 +3,9 @@ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd"> LinuxDeepin - https://www.deepin.com/ + https://www.gxde.org/ - Authentication is required to run the USB Device Formatter + Authentication is required to run the Device Formatter usb-device-formatter no @@ -14,24 +14,24 @@ /usr/bin/usb-device-formatter true - Ríquese l'autenticación pa executar el formatiador de preseos USB - Cal autenticació per executar el Formatador de dispositius USB - Pro běh formátovače zařízení USB je požadováno ověření - Um USB Speicher zu formatieren ist eine Authentifizierung erforderlich. - Authentication-required to run the "USB Device formatter" - L'authentification est obligatoire pour exécuter le formatage du périphérique USB + Ríquese l'autenticación pa executar el formatiador de preseos + Cal autenticació per executar el Formatador de dispositius + Pro běh formátovače zařízení je požadováno ověření + Um Speicher zu formatieren ist eine Authentifizierung erforderlich. + Authentication-required to run the "Device formatter" + L'authentification est obligatoire pour exécuter le formatage du périphérique A művelethez hitelesítés szükséges. Autenticazione richiesta per eseguire la formattazione del dispositivo - USBデバイスフォーマッターを実行するには認証が必要です - Norint paleisti USB įrenginio formatavimo programą, reikalingas tapatybės nustatymas - Authenticatie vereist om USB-apparaatformattering uit te voeren - A autenticação é necessária para executar o Formatador de dispositivo USB - A autenticação é necessária para executar a Formatação do Dispositivo USB - Требуется аутентификация для запуска форматирования устройства USB + デバイスフォーマッターを実行するには認証が必要です + Norint paleisti įrenginio formatavimo programą, reikalingas tapatybės nustatymas + Authenticatie vereist om apparaatformattering uit te voeren + A autenticação é necessária para executar o Formatador de dispositivo + A autenticação é necessária para executar a Formatação do Dispositivo + Требуется аутентификация для запуска форматирования устройства Аутентификација је неопходна за покретање форматирања УСБ уређаја - USB Aygıt Biçimlendirici çalışması için kimlik doğrulaması gerekli - Щоб мати змогу запускати засіб форматування пристроїв USB, слід пройти розпізнавання - 运行USB格式化工具需要认证 - 執行 USB 裝置格式化工具需要身份驗證 + Aygıt Biçimlendirici çalışması için kimlik doğrulaması gerekli + Щоб мати змогу запускати засіб форматування пристроїв, слід пройти розпізнавання + 运行格式化工具需要认证 + 執行裝置格式化工具需要身份驗證 diff --git a/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy.tmp b/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy.tmp index 8f0537d..380ad6d 100644 --- a/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy.tmp +++ b/usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy.tmp @@ -4,10 +4,10 @@ "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> LinuxDeepin - https://www.deepin.com/ + https://www.gxde.org/ - Authentication is required to run the USB Device Formatter - 运行 U 盘格式化工具需要输入密码 + Authentication is required to run the Device Formatter + 运行格式化工具需要输入密码 usb-device-formatter no diff --git a/usb-device-formatter/view/mainpage.cpp b/usb-device-formatter/view/mainpage.cpp index b5b0e55..3cc6bc7 100755 --- a/usb-device-formatter/view/mainpage.cpp +++ b/usb-device-formatter/view/mainpage.cpp @@ -128,7 +128,7 @@ void MainPage::initUI() QLabel* labelText = new QLabel(tr("Label"),this); labelText->setObjectName("TagLabel"); m_labelLineEdit = new QLineEdit(this); - m_labelLineEdit->setText(m_typeCombo->currentText()); + m_labelLineEdit->setText("GXDE-" + m_typeCombo->currentText()); m_labelLineEdit->setFixedSize(160, 22); QCheckBox* fastFormatCheckBox = new QCheckBox(this); @@ -178,7 +178,7 @@ QString MainPage::getLabel() void MainPage::onCurrentSelectedTypeChanged(const QString &type) { - m_labelLineEdit->setText(type); + m_labelLineEdit->setText("GXDE-" + type); m_maxLabelNameLength = PartMan::PartitionManager::getMaxNameLengthByTypeString(type); m_labelLineEdit->setMaxLength(m_maxLabelNameLength); } diff --git a/usb-device-formatter/view/mainpage.h b/usb-device-formatter/view/mainpage.h index a2d09c2..b907334 100755 --- a/usb-device-formatter/view/mainpage.h +++ b/usb-device-formatter/view/mainpage.h @@ -43,8 +43,21 @@ class MainPage : public QWidget Fat32, Ntfs, Exfat, + Btrfs, + Efi, + Ext2, + Ext3, Ext4, - Xfs + F2fs, + Hfs, + Hfsplus, + Jfs, + Linuxswap, + Lvm2pv, + Nilfs2, + Reiser4, + Reiserfs, + Xfs, }; Q_ENUM(FsType)