diff --git a/.github/workflows/call-update-changelog.yml b/.github/workflows/call-update-changelog.yml new file mode 100644 index 00000000..b76b9b3f --- /dev/null +++ b/.github/workflows/call-update-changelog.yml @@ -0,0 +1,53 @@ +name: Call update changelog + +on: + workflow_dispatch: + inputs: + version: + description: "Target version; leave empty to auto bump" + required: false + type: string + name: + description: "Maintainer name used in debian/changelog" + required: true + type: string + email: + description: "Maintainer email used in debian/changelog" + required: true + type: string + base_branch: + description: "Base branch to read and target" + required: false + default: master + type: string + distribution: + description: "Changelog distribution" + required: false + default: unstable + type: string + create_pr: + description: "Create a pull request after generating changelog" + required: false + default: true + type: boolean + +jobs: + update_changelog: + uses: linuxdeepin/.github/.github/workflows/update-changelog.yml@master + with: + version: ${{ inputs.version }} + name: ${{ inputs.name }} + email: ${{ inputs.email }} + base_branch: ${{ inputs.base_branch }} + distribution: ${{ inputs.distribution }} + create_pr: ${{ inputs.create_pr }} + secrets: inherit + + show_result: + runs-on: ubuntu-latest + needs: update_changelog + steps: + - name: Show update changelog result + run: | + echo "Version: ${{ needs.update_changelog.outputs.version }}" + echo "Pull Request URL: ${{ needs.update_changelog.outputs.pr_url }}" diff --git a/.gitignore b/.gitignore index b6c4791d..d986ba81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ *.user .build +build .qmake.stash *.qm +.cache/* +.claude/* +.cursor/* \ No newline at end of file diff --git a/.reuse/dep5 b/.reuse/dep5 index 6730005f..dd534da8 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -45,7 +45,7 @@ Copyright: Curtis Gedak License: GPL-2.0-or-later #config -Files: service/assets/data/* application/assets/deepin-diskmanager.desktop application/assets/environments.h.in service/policy/com.deepin.diskmanager.policy service/udev/99-diskmanager.rules +Files: service/assets/data/* service/assets/dconfig/* application/assets/deepin-diskmanager.desktop application/assets/environments.h.in service/policy/com.deepin.diskmanager.policy service/udev/99-diskmanager.rules Copyright: UnionTech Software Technology Co., Ltd. License: CC0-1.0 diff --git a/LICENSES/GPL-3.0-or-later.txt b/LICENSES/GPL-3.0-or-later.txt new file mode 100644 index 00000000..d41c0bd9 --- /dev/null +++ b/LICENSES/GPL-3.0-or-later.txt @@ -0,0 +1,232 @@ +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. + +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 90ed05f0..ef0d3a78 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -47,23 +47,15 @@ configure_file(${APP_RES_DIR}/environments.h.in environments.h @ONLY) #set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1 "${CMAKE_CURRENT_SOURCE_DIR}/translations") #set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/translations PROPERTY CLEAN_NO_CUSTOM 1) set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1 ) -#lupdate start -set(TS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/translations") -set(TS_FILES - "${TS_DIR}/${PROJECT_NAME}_en_US.ts" -) -find_program(LUPDATE_EXECUTABLE lupdate) -foreach(_ts_file ${TS_FILES}) - execute_process( - COMMAND ${LUPDATE_EXECUTABLE} -recursive ${CMAKE_SOURCE_DIR} -ts ${_ts_file}) -endforeach() -#lupdate end - -file (GLOB DTNG_TS_FILES translations/*.ts) -qt5_create_translation(DTNG_QM_FILES - ${DTNG_TS_FILES} - ${DTNG_QM_FILES} - ) + +# 国际化 +if (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug")) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") + + #generate qm + execute_process(COMMAND bash "translate_generation.sh" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() file(GLOB ALL_SOURCES "*.cpp" "./partedproxy/*.cpp" "./widgets/*.cpp" "./widgets/customcontrol/*.cpp" "./widgets/accessible/*.cpp") file(GLOB ALL_HEADERS "*.h" "./partedproxy/*.h" "./widgets/*.h" "./widgets/customcontrol/*.h" "./widgets/accessible/*.h") @@ -73,7 +65,7 @@ include_directories(../basestruct) set(ALL_SRCS ${ALL_SOURCES} ${ALL_HEADERS}) # 生成执行文件 -add_executable(${PROJECT_NAME} ${ALL_SRCS} ${APP_QRC} ${DTNG_QM_FILES}) +add_executable(${PROJECT_NAME} ${ALL_SRCS} ${APP_QRC}) target_include_directories(${PROJECT_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} @@ -87,9 +79,11 @@ set(CMAKE_INSTALL_PREFIX /usr) # Install files install(TARGETS ${PROJECT_NAME} DESTINATION bin) -#file(GLOB APP_QM_FILES "translations/*.qm") -#install(FILES ${APP_QM_FILES} DESTINATION share/${PROJECT_NAME}/translations) -install(FILES ${DTNG_QM_FILES} DESTINATION share/${PROJECT_NAME}/translations) + +# install qm files +file(GLOB APP_QM_FILES "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.qm") +install(FILES ${APP_QM_FILES} DESTINATION share/${PROJECT_NAME}/translations) + install(FILES ${APP_ICONPATH} DESTINATION share/icons/hicolor/scalable/apps) install(FILES ${APP_DESKTOP} DESTINATION share/applications) install(DIRECTORY ${APP_RES_DIR}/deepin-diskmanager DESTINATION /usr/share/deepin-manual/manual-assets/application) diff --git a/application/lupdate.sh b/application/lupdate.sh new file mode 100755 index 00000000..f11b97ac --- /dev/null +++ b/application/lupdate.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +lupdate ./ -ts -no-obsolete translations/deepin-diskmanager.ts +lupdate ./ -ts -no-obsolete translations/deepin-diskmanager_zh_CN.ts +lupdate ./ -ts -no-obsolete translations/deepin-diskmanager_zh_HK.ts +lupdate ./ -ts -no-obsolete translations/deepin-diskmanager_zh_TW.ts +lupdate ./ -ts -no-obsolete translations/deepin-diskmanager_bo.ts +lupdate ./ -ts -no-obsolete translations/deepin-diskmanager_ug.ts diff --git a/application/main.cpp b/application/main.cpp index be9c1672..8f152ce7 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -54,27 +54,6 @@ QAccessibleInterface *accessibleFactory(const QString &classname, QObject *objec return interface; } -/** - * @brief 执行外部命令 - * @param strCmd:外部命令字符串 - * @param outPut:命令控制台输出 - * @param error:错误信息 - * @return exitcode:退出码 - */ -int executCmd(const QString &strCmd, QString &outPut, QString &error) -{ - QProcess proc; - proc.start(strCmd); - proc.waitForFinished(-1); - outPut = proc.readAllStandardOutput(); - error = proc.readAllStandardError(); - error = proc.errorString(); - int exitcode = proc.exitCode(); - proc.close(); - return exitcode; - -} - int main(int argc, char *argv[]) { // signal(SIGINT, SIG_IGN); @@ -119,31 +98,31 @@ int main(int argc, char *argv[]) // exit(0); // } if (a.setSingleInstance(appName)) { - QProcess proc; - QString cmd, oldPid, newPid, error; - //先判断后台服务进程是否存在,如果存在可能是强制退出导致,应先退出后台程序再重新启动磁盘管理器 - cmd = QString("pidof deepin-diskmanager-service"); + // 使用 QDBusInterface 调用 org.freedesktop.DBus.GetNameOwner 获取服务 owner + QDBusInterface dbusInterface("org.freedesktop.DBus", + "/org/freedesktop/DBus", + "org.freedesktop.DBus", + QDBusConnection::systemBus()); + const QString serviceName = "com.deepin.diskmanager"; - if (!executCmd(cmd, oldPid, error)) { - proc.startDetached("/usr/bin/dbus-send --system --type=method_call --dest=com.deepin.diskmanager /com/deepin/diskmanager com.deepin.diskmanager.Quit"); - } + // 启动服务前,获取后台服务的旧 dbus owner + QDBusReply oldReply = dbusInterface.call("GetNameOwner", serviceName); + const QString oldDbusOwner = oldReply.isValid() ? oldReply.value() : QString(); - QStringList argList; - argList << QString::number(QCoreApplication::applicationPid()) << QDBusConnection::systemBus().baseService(); - proc.startDetached("/usr/bin/deepin-diskmanager-authenticateProxy", argList); + QProcess::startDetached("deepin-diskmanager-authenticateProxy", { QDBusConnection::systemBus().baseService() }); - //正常启动程序后,循环查询后台服务是否已经启动,如果后台服务启动说明鉴权成功,启动前端界面 + // 启动服务后,循环查询后台服务是否已经启动 + // 当获取新 dbus owner 成功且不等于旧 dbus owner, 则认为新服务启动完成 while (1) { - cmd = QString("pidof deepin-diskmanager-service"); - - if (!executCmd(cmd, newPid, error) && oldPid != newPid) { - break; + QDBusReply newReply = dbusInterface.call("GetNameOwner", serviceName); + if (newReply.isValid()) { + const QString newDbusOwner = newReply.value(); + if (!newDbusOwner.isEmpty() && newDbusOwner != oldDbusOwner) { + break; + } } QThread::msleep(300); } - - proc.close(); - } else { exit(0); } diff --git a/application/translate_generation.sh b/application/translate_generation.sh new file mode 100755 index 00000000..676bf43e --- /dev/null +++ b/application/translate_generation.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +ts_list=(`ls translations/*.ts`) + +# 优先使用Qt6 lrelease工具 +if [ -f "/usr/lib/qt6/bin/lrelease" ]; then + lrelease="/usr/lib/qt6/bin/lrelease" +elif [ -f "/usr/lib/qt5/bin/lrelease" ]; then + lrelease="/usr/lib/qt5/bin/lrelease" +else + lrelease="lrelease" +fi + +# 遍历所有ts文件并生成qm文件 +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + ${lrelease} "${ts}" +done diff --git a/application/translations/deepin-diskmanager.ts b/application/translations/deepin-diskmanager.ts new file mode 100644 index 00000000..668747f3 --- /dev/null +++ b/application/translations/deepin-diskmanager.ts @@ -0,0 +1,2463 @@ + + + + + CreateLVWidget + + + Creating logical volumes on %1 + + + + + Click %1 to create a logical volume. + + + + + VG Information + + + + + Capacity: + + + + + + LV name: + + + + + + + VG name: + + + + + + + + LV file system: + + + + + Confirm + button + + + + + Cancel + button + + + + + Revert + button + + + + + LV Information + + + + + Create LV: + + + + + Delete last logical volume + + + + + LV capacity: + + + + + + Unallocated + + + + + Name + + + + + Size + + + + + Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. + + + + + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. + + + + + To encrypt a volume, it should be larger than 100 MiB + + + + + To avoid losing the password, please back up your password and keep it properly! + + + + + OK + button + + + + + CreatePartitionTableDialog + + + Cancel + + + + + No partition table in this disk. Create a new one? + + + + + Create + + + + + The disk has a partition table already. Replace it? + + + + + Replace + + + + + CreateVGWidget + + + Create volume group + + + + + Resize + + + + + Select disks or partitions to create a volume group and set its capacity + + + + + + + + + + + + + + + + Capacity selected: %1 + + + + + The selected disks will be converted to dynamic disks, and you will not be able to start installed operating systems from the disks. + + + + + No partitions available + + + + + No disks or partitions available + + + + + + Cancel + button + + + + + Next + + + + + Selected disks/partitions + + + + + Set VG capacity + + + + + Auto adjusted to integral multiples of 4 MiB + + + + + Choose one disk or partition at least + + + + + Previous + + + + + Done + button + + + + + Resizing space... + + + + + Creating... + + + + + Selected disks and partitions: + + + + + + VG capacity: %1 + + + + + VG name: %1 + + + + + No less than the used capacity please + + + + + No more than the maximum capacity please + + + + + A lot of data exists on %1, + + + + + which may take a long time to back it up. + + + + + Do you want to continue? + + + + + Continue + + + + + Cancel + + + + + + Adding the disk/partition to a logical volume group +will format it and remove its password. + + + + + + + OK + + + + + Not enough space to back up data on %1, please clear disk space + + + + + Existing volume group, creation failed. Please retry after reboot. + + + + + Failed to create a physical volume. Please refresh Disk Utility and try again. + + + + + Device input/output error. Please try again after reboot. + + + + + + Refreshing the page to reload disks + + + + + CylinderInfoWidget + + + LBA: %1 + + + + + Cyl.: %1 + + + + + Error: %1 + + + + + Cyl. elapsed time: %1 + + + + + ms + + + + + Status: Repaired + + + + + DMDbusHandler + + + Refreshing data... + + + + + Initializing data... + + + + + + + Mounting %1 ... + + + + + + + Unmounting %1 ... + + + + + Resizing %1 ... + + + + + Creating a new partition... + + + + + Deleting %1 ... + + + + + Creating a partition table of %1 ... + + + + + Replacing the partition table of %1 ... + + + + + Creating... + + + + + + Deleting... + + + + + Resizing space... + + + + + + AES Encryption + + + + + + SM4 Encryption + + + + + Failed to encrypt %1, please try again! + + + + + Failed to decrypt %1, please try again! + + + + + %1 failed to close the crypto map + + + + + Failed to create partitions, please try again! + + + + + + Failed to create %1 file system, please try again! + + + + + Failed to submit the request to the kernel + + + + + + DBUS parameter error + + + + + Failed to mount %1 + + + + + %1 failed to create mounting folders + + + + + %1 failed to change the owner of mounting folders + + + + + Creating partition table failed + + + + + Failed to create a logical volume, please try again! + + + + + DecryptDialog + + + Enter the password to decrypt the disk + + + + + Enter the password to decrypt the volume group + + + + + Enter a password + + + + + Password hint + + + + + Cancel + button + + + + + Decrypt + button + + + + + Please try again %1 minutes later + + + + + The password cannot be empty + + + + + Decrypting... + + + + + Decryption failed + + + + + Password locked, please try again %1 minutes later + + + + + Wrong password, %1 chances left + + + + + Wrong password, only one chance left + + + + + DeviceListWidget + + + Disk info + + + + + Health management + + + + + Check health + + + + + Check partition table error + + + + + Verify or repair bad sectors + + + + + Create partition table + + + + + Delete partition + + + + + Delete volume group + + + + + + Create logical volume + + + + + Delete logical volume + + + + + Health checking does not support this type of device. + + + + + Close + + + + + Please unmount all partitions in the disk first + + + + + + + OK + + + + + All partitions in this disk will be merged and all data + will be lost if creating a new partition table, + please take it carefully + + + + + Proceed + + + + + + + + + + Cancel + + + + + No errors found in the partition table + + + + + Do you want to hide this partition? + + + + + Hide + + + + + Failed to hide the partition: unable to lock it + + + + + You can only hide the unmounted partition + + + + + Do you want to unhide this partition? + + + + + Unhide + + + + + Are you sure you want to delete this partition? + + + + + You will lose all data in it + + + + + + + Delete + + + + + Failed to delete the partition: unable to lock it + + + + + Hide the partition successfully + + + + + Failed to hide the partition + + + + + Unhide the partition successfully + + + + + Failed to unhide the partition + + + + + Delete the partition successfully + + + + + Failed to find the disk + + + + + Failed to get the partition info + + + + + Failed to delete the partition + + + + + Failed to submit the request to the kernel + + + + + Failed to delete the partition: %1 + + + + + Unmounting successful + + + + + Unmounting failed + + + + + Creating partition table successful + + + + + Replacing partition table successful + + + + + Creating partition table failed + + + + + Replacing partition table failed + + + + + Unmount all logical volumes in %1 first + + + + + + Data cannot be recovered if deleted, please confirm before proceeding + + + + + The disks will be formatted if you create a logical volume + + + + + Unmount %1 first + + + + + The logical volume group is busy and cannot be deleted. Please retry after reboot. + + + + + + The logical volume is busy and cannot be deleted. Please retry after reboot. + + + + + Failed to delete the logical volume group + + + + + Failed to delete the logical volume + + + + + Volume Groups + + + + + Disks + + + + + DiskBadSectorsDialog + + + Verify or repair bad sectors + + + + + + + Verify: + + + + + Cylinders + + + + + Sectors + + + + + MB + + + + + + + Method: + + + + + Rounds + + + + + Timeout + + + + + ms + + + + + Result: + + + + + Excellent + + + + + Damaged + + + + + Unknown + + + + + Exit + button + + + + + Reset + button + + + + + Repair + + + + + Start Verify + + + + + Stop + button + + + + + Continue + button + + + + + Verify Again + + + + + Done + button + + + + + + + + + + + Time elapsed: + + + + + + + + + + + + + + Time left: + + + + + Verifying cylinder: %1 + + + + + Verify completed + + + + + Disk verify completed. %1 bad blocks found. + + + + + + OK + + + + + The verifying disk contains mounted partitions, so you cannot repair it. + + + + + Please unmount partitions and then repair the disk. + + + + + Warning + + + + + Bad sector repairing cannot recover files, + + + + + but destroys data on and near bad sectors instead. + + + + + Please back up all data before repair. + + + + + + + Cancel + + + + + Start Repair + + + + + Repairing cylinder: %1 + + + + + Repair completed. Cylinder: %1 repaired. + + + + + Disk repair completed. %1 bad blocks repaired. + + + + + Verifying for bad sectors, exit now? + + + + + The verified information will not be reserved + + + + + + Exit + + + + + Repairing bad sectors, exit now? + + + + + The repairing information will not be reserved + + + + + DiskHealthDetectionDialog + + + Check Health + + + + + Serial number + + + + + Storage + + + + + Health Status + + + + + Good + + + + + Damaged + + + + + Unknown + + + + + Temperature + + + + + + ID + + + + + + Status + + + + + + Current + + + + + + Worst + + + + + + Threshold + + + + + + Raw Value + + + + + + Attribute name + + + + + Status: (G: Good | W: Warning | D: Damaged | U: Unknown) + + + + + + + Export + button + + + + + Save File + + + + + Text files (*.txt) + + + + + Wrong path + + + + + You do not have permission to access this path + + + + + Export successful + + + + + Export failed + + + + + DiskInfoDisplayDialog + + + Disk Info + + + + + SSD + + + + + HDD + + + + + Model: + + + + + Vendor: + + + + + Media Type: + + + + + Size: + + + + + Rotation Rate: + + + + + Interface: + + + + + Serial Number: + + + + + Version: + + + + + Capabilities: + + + + + Description: + + + + + Power On Hours: + + + + + Power Cycle Count: + + + + + Firmware Version: + + + + + Speed: + + + + + + + + + + + %1 + + + + + + + Export + button + + + + + Save File + + + + + Text files (*.txt) + + + + + Wrong path + + + + + You do not have permission to access this path + + + + + Export successful + + + + + Export failed + + + + + FormateDialog + + + Wipe %1 + + + + + It will erase all data on this disk, which will not be recovered + + + + + Name: + + + + + Name + + + + + File system: + + + + + AES Encryption + + + + + SM4 Encryption + + + + + Security: + + + + + + Fast + + + + + + Secure + + + + + Advanced + + + + + + It only deletes the partition info without erasing the files on the disk. Disk recovery tools may recover the files at a certain probability. + + + + + Wiping method: + + + + + DoD 5220.22-M, 7 passes + + + + + Gutmann, 35 passes + + + + + Cancel + button + + + + + Wipe + button + + + + + Failed to find the disk + + + + + The action cannot be undone, please proceed with caution + + + + + LV name: + + + + + LV name + + + + + LV file system: + + + + + + You may be able to recover files after the wipe. + + + + + Failed to submit the request to the kernel + + + + + + + + The length exceeds the limit + + + + + Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. + + + + + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. + + + + + It is a one-time secure wipe that complies with NIST 800-88 and writes 0, 1, and random data to the entire disk once. You will not be able to recover files, and the process will be slow. + + + + + It writes 0, 1, and random data to the entire disk several times. You can set the number of times to erase disks and overwrite data, but the process will be very slow. + + + + + You will not be able to recover files after the wipe, and the process will be slow. + + + + + To avoid losing the password, please back up your password and keep it properly! + + + + + OK + button + + + + + Wiping %1 + + + + + "%1" wiped + + + + + Failed to wipe %1 + + + + + InfoShowWidget + + + + + + Mount point: + + + + + Free: + + + + + Used: + + + + + + + + + Type: + + + + + Capacity: + + + + + + + Volume label: + + + + + Path: + + + + + Disk type: + + + + + Interface: + + + + + SSD + + + + + HDD + + + + + LV count: + + + + + VG name: + + + + + + Volume group + + + + + Volume name: + + + + + + Logical volume + + + + + InfoTopFrame + + + Capacity + + + + + + + + File system + + + + + %1 partition table + + + + + Volume group + + + + + MainWindow + + + Refresh + + + + + MountDialog + + + + + Mount %1 + + + + + Choose a mount point please + + + + + Mount point: + + + + + + Please select /mnt or /media, or its subdirectories. + + + + + + The mount point is illegal. Please select /mnt or /media, or its subdirectories. + + + + + + Cancel + + + + + Mount + + + + + The data under this mount point would be lost, please mount the directory to another location + + + + + Continue + button + + + + + Mounting failed: The selected mount point is not empty. Please select another one! + + + + + OK + button + + + + + PartChartShowing + + + Unallocated + + + + + PartitionDialog + + + Partition %1 + + + + + It will increase the number of partitions on the disk + + + + + Cancel + + + + + Confirm + + + + + PartitionInfoWidget + + + Unallocated + + + + + PartitionTableErrorsInfoDialog + + + Errors in Partition Table + + + + + The partition table of disk %1 has below errors: + + + + + Error + + + + + Partition table entries are not in disk order + + + + + OK + button + + + + + PartitionWidget + + + Partitioning %1 + + + + + Click %1 to increase the number of partitions. Click on each partition to change its name and file system. + + + + + Disk Information + + + + + Capacity: + + + + + Partition selected: + + + + + + + Disk: + + + + + + + + File system: + + + + + Confirm + button + + + + + Cancel + button + + + + + Revert + button + + + + + Partition Information + + + + + Number of partitions: + + + + + Delete last partition + + + + + Name: + + + + + Size: + + + + + + Unallocated + + + + + Name + + + + + Size + + + + + + + + The length exceeds the limit + + + + + Use the aes-xts-plain64 standard algorithm to encrypt the disk. If it is encrypted, you should decrypt it before mounting. + + + + + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. If it is encrypted, you should decrypt it before mounting. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. + + + + + The number of new partitions exceeds the limit + + + + + To encrypt a partition, it should be larger than 100 MiB + + + + + Set a password to encrypt the new partition + + + + + To avoid losing the password, please back up your password and keep it properly! + + + + + OK + button + + + + + To create a partition, you need at least 52 MB + + + + + PasswordInputDialog + + + + Set a password to encrypt %1 + + + + + The password cannot be reset or retrieved online + + + + + Password + + + + + Repeat password + + + + + Password hint + + + + + (Recommended) + + + + + Enter a password + + + + + Enter the password again + + + + + Enter a password hint + + + + + Cancel + button + + + + + Confirm + button + + + + + + + The password exceeds the maximum length + + + + + The password cannot be empty + + + + + Passwords do not match + + + + + The password hint should differ from the password + + + + + QObject + + + Disk Utility + + + + + Disk Utility is a disk management tool for creating, reorganizing and formatting partitions. + + + + + RemovePVWidget + + + Are you sure you want to delete the physical volume? + + + + + To prevent data loss, back up data in the physical volume before deleting it + + + + + Cancel + button + + + + + Delete + button + + + + + Deleting... + + + + + A lot of data exists on %1, + + + + + which may take a long time to back it up. + + + + + Do you want to continue? + + + + + Continue + + + + + Cancel + + + + + Not enough space to back up data on %1, please delete the logical volume first + + + + + OK + + + + + Failed to delete the physical volume + + + + + ResizeDialog + + + It will resize the partitions on the disk + + + + + New capacity: + + + + + Auto adjusted to integral multiples of 4 MiB + + + + + + Resize %1 + + + + + It will resize the logical volume space + + + + + + + + Cancel + + + + + Confirm + + + + + + + + No more than the maximum capacity please + + + + + The file system does not support shrinking space + + + + + + + + + OK + + + + + + No less than the used capacity please + + + + + To prevent data loss, back up data before shrinking it + + + + + Unmount it before shrinking its space + + + + + The current device has been mounted and will be unmounted automatically. Please back up data in it to prevent data loss + + + + + To prevent data loss, back up data in the logical volume before shrinking it + + + + + The file system does not support space adjustment + + + + + SizeInfoWidget + + + + Available: + + + + + + + + Used: + + + + + TitleWidget + + + Partition + + + + + Wipe + + + + + Mount + + + + + Unmount + + + + + + + Resize + + + + + + Create volume group + + + + + Delete volume group + + + + + Delete logical volume + + + + + Delete physical volume + + + + + + Create logical volume + + + + + Cannot recognize its partition table + + + + + Unable to mount the device: no file system is found, or the file system is not supported + + + + + + + + + + + + OK + + + + + + The file system does not support space adjustment + + + + + The disks will be formatted if you create a logical volume + + + + + + + Unmount %1 first + + + + + + Data cannot be recovered if deleted, please confirm before proceeding + + + + + + Delete + + + + + + Cancel + + + + + To ensure the normal use of system backup and restore, +rootA and rootB should be resized to the same value + + + + + The disks will be formatted if you create a volume group + + + + + Unmount all logical volumes in %1 first + + + + + UnmountDialog + + + Make sure there are no programs running on the disk + + + + + + + Unmount %1 + + + + + Make sure there are no programs running on the logical volume + + + + + Cancel + + + + + Unmount + + + + + UnmountWarningDialog + + + Unmounting system disk may result in system crash + + + + + I will take the risks that may arise + + + + + Cancel + + + + + Unmount + + + + + VGSizeInfoWidget + + + + Unallocated + + + + diff --git a/application/translations/deepin-diskmanager_bo.ts b/application/translations/deepin-diskmanager_bo.ts index 2d6b5967..ba76838f 100644 --- a/application/translations/deepin-diskmanager_bo.ts +++ b/application/translations/deepin-diskmanager_bo.ts @@ -1,20 +1,22 @@ - + + + CreateLVWidget Creating logical volumes on %1 - + Click %1 to create a logical volume. - + VG Information - + @@ -25,14 +27,14 @@ LV name: - + VG name: - + @@ -40,7 +42,7 @@ LV file system: - + @@ -63,22 +65,22 @@ LV Information - + Create LV: - + Delete last logical volume - + LV capacity: - + @@ -99,22 +101,22 @@ Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. - + To encrypt a volume, it should be larger than 100 MiB - + To avoid losing the password, please back up your password and keep it properly! - + @@ -156,7 +158,7 @@ Create volume group - + @@ -166,7 +168,7 @@ Select disks or partitions to create a volume group and set its capacity - + @@ -182,22 +184,22 @@ Capacity selected: %1 - + The selected disks will be converted to dynamic disks, and you will not be able to start installed operating systems from the disks. - + No partitions available - + No disks or partitions available - + @@ -209,32 +211,32 @@ Next - + Selected disks/partitions - + Set VG capacity - + Auto adjusted to integral multiples of 4 MiB - + Choose one disk or partition at least - + Previous - + @@ -245,53 +247,53 @@ Resizing space... - + Creating... - + Selected disks and partitions: - + VG capacity: %1 - + VG name: %1 - + No less than the used capacity please - + No more than the maximum capacity please - + A lot of data exists on %1, - + which may take a long time to back it up. - + Do you want to continue? - + @@ -308,7 +310,7 @@ Adding the disk/partition to a logical volume group will format it and remove its password. - + @@ -320,28 +322,28 @@ will format it and remove its password. Not enough space to back up data on %1, please clear disk space - + Existing volume group, creation failed. Please retry after reboot. - + Failed to create a physical volume. Please refresh Disk Utility and try again. - + Device input/output error. Please try again after reboot. - + Refreshing the page to reload disks - + @@ -390,133 +392,133 @@ will format it and remove its password. གཞི་གྲངས་འགོ་འཛུགས་ཅན་དུ་སྒྱུར་བཞིན་པ། - - - + + + Mounting %1 ... %1སྣོན་འཇུག་བྱེད་བཞིན་པ། - - - + + + Unmounting %1 ... %1བཤིག་ནས་འདོན་བཞིན་པ། - + Resizing %1 ... %1ཡི་བར་སྟོང་ལེགས་སྒྲིག་བྱེད་བཞིན་པ། - + Creating a new partition... དབྱེ་ཁུལ་གསར་བཟོ་བྱེད་བཞིན་པ། - + Deleting %1 ... %1སུབ་བཞིན་པ། - + Creating a partition table of %1 ... %1ལ་དབྱེ་ཁུལ་རེའུ་མིག་བཟོ་བཞིན་པ། - + Replacing the partition table of %1 ... %1ལ་དབྱེ་ཁུལ་རེའུ་མིག་བརྗེ་བཞིན་པ། - + Creating... - + - - + + Deleting... - + - + Resizing space... - + - - + + AES Encryption - + - - + + SM4 Encryption - + - + Failed to encrypt %1, please try again! - + - + Failed to decrypt %1, please try again! - + - + %1 failed to close the crypto map - + - + Failed to create partitions, please try again! - + - - + + Failed to create %1 file system, please try again! - + - + Failed to submit the request to the kernel ནང་ཉིང་སྤྲོད་མ་ཐུབ། - - + + DBUS parameter error - + - + Failed to mount %1 - + - + %1 failed to create mounting folders - + - + %1 failed to change the owner of mounting folders - + - + Creating partition table failed ཁག་བགོའི་རེའུ་མིག་གསར་བཟོ་མི་ཐུབ་པ། - + Failed to create a logical volume, please try again! - + @@ -524,22 +526,22 @@ will format it and remove its password. Enter the password to decrypt the disk - + Enter the password to decrypt the volume group - + Enter a password - + Password hint - + @@ -551,42 +553,42 @@ will format it and remove its password. Decrypt button - + Decrypting... - + Please try again %1 minutes later - + The password cannot be empty - + Decryption failed - + Password locked, please try again %1 minutes later - + Wrong password, %1 chances left - + Wrong password, only one chance left - + @@ -622,54 +624,50 @@ will format it and remove its password. ཁག་བགོའི་རེའུ་མིག་གསར་བཟོ། - + Delete partition ཁུལ་ཚན་སུབ་པ། - + Delete volume group - + - - + + Create logical volume - + - + Delete logical volume - + - Failed to get hardware information - - - - + Close ཁ་བརྒྱབ། - + Health checking does not support this type of device. - + - + Please unmount all partitions in the disk first སྡུད་སྡེར་ནང་གི་ཁུལ་བགོ་ཚང་མ་མེད་པ་བཟོ་རོགས། - - - + + + OK ཆོག - + All partitions in this disk will be merged and all data will be lost if creating a new partition table, please take it carefully @@ -677,452 +675,452 @@ will format it and remove its password. གཞི་གྲངས་ཚང་མ་སུབ་སྲིད་པས། ཡིད་གཟབ་བྱ་དགོས། - + Proceed མུ་མཐུད། - - - - - - + + + + + + Cancel འདོར་བ། - + No errors found in the partition table ཁུལ་ཚན་རེའུ་མིག་གི་བཤེར་འཇལ་བྱས་འབྲས་རྒྱུན་གཏན་ཡིན་པ། - + Do you want to hide this partition? ཁྱེད་ཀྱིས་ཁུལ་ཚན་འདི་ཡིབ་དགོས་སམ། - + Hide ཡིབ་པ། - + Failed to hide the partition: unable to lock it ཁུལ་ཚན་ཡིབ་མི་ཐུབ། ཁུལ་ཚན་འདི་སྒྲོག་འཆིང་བྱེད་ཐབས་མེད། - + You can only hide the unmounted partition བཤིག་འདོན་རྣམ་པའི་སྐབས་ཀྱི་ཁུལ་ཚན་གཞི་ནས་ཡིབ་ཐུབ། - + Do you want to unhide this partition? ཁྱེད་ཀྱིས་ཁུལ་ཚན་འདི་འཆར་དགོས་སམ། - + Unhide འཆར་བ། - + Are you sure you want to delete this partition? ཁྱེད་ཀྱིས་ཁུལ་ཚན་འདི་སུབ་རྒྱུ་གཏན་འཁེལ་ལམ། - + You will lose all data in it ཁུལ་ཚན་འདིའི་ནང་གི་ཡིག་ཆ་ཚང་མ་བོར་སྲིད། - - - + + + Delete སུབ་པ། - + Failed to delete the partition: unable to lock it ཁུལ་ཚན་སུབ་མི་ཐུབ། ཁུན་ཚན་འདི་སྒྲོག་འཆིང་བྱེད་ཐབས་མེད། - + Hide the partition successfully ཁུལ་ཚན་ཡིབ་ཐུབ་པ། - + Failed to hide the partition ཁུལ་ཚན་ཡིབ་མི་ཐུབ། - + Unhide the partition successfully ཁུལ་ཚན་འཆར་ཐུབ་པ། - + Failed to unhide the partition ཁུལ་ཚན་འཆར་མི་ཐུབ། - + Delete the partition successfully ཁུལ་ཚན་སུབ་ཐུབ་པ། - + Failed to find the disk སྡུད་སྡེར་སྒྲིག་ཆས་རག་ཐབས་བྲལ། - + Failed to get the partition info དབྱེ་ཁུལ་གྱི་ཆ་འཕྲིན་རག་ཐབས་བྲལ། - + Failed to delete the partition བསུབས་མ་ཐུབ། - + Failed to submit the request to the kernel ནང་ཉིང་སྤྲོད་མ་ཐུབ། - + Failed to delete the partition: %1 ཁུལ་ཚན་སུབ་མི་ཐུབ། %1 - + Unmounting successful བཤིག་འདོན་ཐུབ་པ། - + Unmounting failed བཤིག་འདོན་མི་ཐུབ། - + Creating partition table successful ཁག་བགོའི་རེའུ་མིག་གསར་བཟོ་ཐུབ་པ། - + Replacing partition table successful ཁག་བགོའི་རེའུ་མིག་བརྗེ་ཐུབ་པ། - + Creating partition table failed ཁག་བགོའི་རེའུ་མིག་གསར་བཟོ་མི་ཐུབ་པ། - + Replacing partition table failed ཁག་བགོའི་རེའུ་མིག་བརྗེ་མི་ཐུབ། - + Unmount all logical volumes in %1 first - + - - + + Data cannot be recovered if deleted, please confirm before proceeding - + - + The disks will be formatted if you create a logical volume - + - + Unmount %1 first - + - + The logical volume group is busy and cannot be deleted. Please retry after reboot. - + - - + + The logical volume is busy and cannot be deleted. Please retry after reboot. - + - + Failed to delete the logical volume group - + - + Failed to delete the logical volume - + - + Volume Groups - + - + Disks - + DiskBadSectorsDialog - + Verify or repair bad sectors ལམ་དཔྱདའཇལ་དང་སླར་གསོ། - - - + + + Verify: དཔྱད་འཇལ་ཁྱབ་ཁོངས། - + Cylinders ཀ་ངོས་ཁྱབ་ཁོངས། - + Sectors གཡབ་ཁུལ་ཁྱབ་ཁོངས། - + MB ཤོང་ཚད་ཁྱབ་ཁོངས། - - - + + + Method: དཔྱད་འཇལ་བྱེད་སྟངས། - + Rounds - + - + Timeout དུས་ཚོད་ལས་བརྒལ་བའི་དུས་ཚོད། - + ms སྟོང་ཟུར་སྐར་ཆ། - + Result: དཔྱད་འཇལ་བྱས་འབྲས། - + Excellent ཕུལ་བྱུང་། - + Damaged སྐྱོན་ཤོར། - + Unknown མི་ཤེས། - + Exit button ཕྱིར་འཐོན། - + Reset button སླར་གསོ། - + Repair སླར་གསོ་ཚོད་ལྟ་བྱེད་པ། - + Start Verify དཔྱད་འཇལ་བྱེད་འགོ་ཚུགས་པ། - + Stop button མཚམས་བཞག - + Continue button མུ་མཐུད། - + Verify Again ཡང་བསྐྱར་དཔྱད་འཇལ་བྱེད་པ། - + Done button ལེགས་གྲུབ། - - - - - - - + + + + + + + Time elapsed: བེད་སྤྱོད་བྱས་པའི་དུས་ཚོད། - - - - - - - - - - + + + + + + + + + + Time left: དུས་ཚོད་ལྷག་མ། - + Verifying cylinder: %1 ཀ་ངོས་%1དཔྱད་འཇལ་བྱེད་བཞིན་པ། - + Verify completed དཔྱད་འཇལ་བྱས་ཟིན། - + Disk verify completed. %1 bad blocks found. སྡུད་སྡེར་དཔྱད་འཇལ་བྱས་ཟིན། ཁྱོན་འཕྲོ་བརླག་ཐེབས་ཁུལ་%1རྙེད་པ། - - + + OK ཆོག - + The verifying disk contains mounted partitions, so you cannot repair it. མིག་སྔར་སྡུད་སྡེར་ལ་དཔྱད་འཇལ་བྱེད་པ་འགེལ་ཁུལ་དུ་ཡོད་པས། འཕྲོ་བརླག་ཐེབས་ས་སླར་གསོ་བྱ་ཐབས་བྲལ། - + Please unmount partitions and then repair the disk. སླར་གསོ་བྱ་དགོས་ཚེ་སྔོན་ལ་དབྱེ་ཁུལ་བཤིག་འདོན་བྱོས། - + Warning ཐ་ཚིག - + Bad sector repairing cannot recover files, འཕྲོ་བརླག་ཤོར་བའི་སྡེར་ལམ་སླར་གསོ་བྱེད་པ་དེ་གཞི་གྲངས་སོར་ཆུད་ཀྱི་བྱ་ཐབས་མིན། - + but destroys data on and near bad sectors instead. འཕྲོ་བརླག་ཤོར་བའི་སྡེར་ལམ་སླར་གསོ་བྱེད་པ་འདིས་འཕྲོ་བརླག་ཤོར་བའི་སྡེར་ལམ་དང་དེའི་ཉེ་འཁོར་གྱི་སྡེར་ལམ་ཐོག་གི་ཡིག་ཆའི་གཞི་གྲངས་འཕྲོ་བརླག་གཏོང་སྲིད། - + Please back up all data before repair. སྔོན་ལ་གཞི་གྲངས་གྲབས་ཉར་ཡག་པོ་བྱོས། - - - + + + Cancel འདོར་བ། - + Start Repair སླར་གསོ་བྱེད་འགོ་ཚུགས། - + Repairing cylinder: %1 ཀ་ངོས་%1སླར་གསོ་བྱེད་བཞིན་པ། - + Repair completed. Cylinder: %1 repaired. སླར་གསོ་བྱས་ཟིན། ཀ་ངོས་%1སླར་གསོ་བྱས་ཟིན། - + Disk repair completed. %1 bad blocks repaired. སྡུད་སྡེར་སླར་གསོ་བྱས་ཟིན། ཁྱོན་འཕྲོ་བརླག་ཐེབས་ཁུལ་%1སླར་གསོ་བྱས་པ། - + Verifying for bad sectors, exit now? དཔྱད་འཇལ་བྱེད་བཞིན་ཡོད་པས། སྒེའུ་ཁུང་ལས་ཕྱིར་འཐོན་ནམ། - + The verified information will not be reserved མིག་སྔའི་དཔྱད་འཇལ་ཆ་འཕྲིན་ཉར་མི་སྲིད། - - + + Exit ཕྱིར་འཐོན། - + Repairing bad sectors, exit now? སླར་གསོ་བྱེད་བཞིན་ཡོད་པས། སྒེའུ་ཁུང་ལས་ཕྱིར་འཐོན་ནམ། - + The repairing information will not be reserved མིག་སྔའི་སླར་གསོའི་ཆ་འཕྲིན་ཉར་མི་སྲིད། @@ -1135,122 +1133,122 @@ will format it and remove its password. མཁྲེགས་སྡེར་བདེ་ཐང་དཔྱད་འཇལ། - + Serial number གོ་རིམ་ཨང་གྲངས། - + Storage སྤྱོད་མཁན་གྱི་ཤོང་ཚད། - + Health Status བདེ་ཐང་རྣམ་པ། - + Good ལེགས། - + Damaged སྐྱོན་ཤོར། - + Unknown མི་ཤེས། - + Temperature དྲོད་ཚད། - - + + ID ID - - + + Status རྣམ་པ། - - + + Current མིག་སྔའི་གྲངས་ཐང་། - - + + Worst ལོ་རྒྱུས་ཀྱི་གྲངས་ཐང་དམའ་ཤོས། - - + + Threshold འགྱུར་མཚམས་གྲངས་ཐང་། - - + + Raw Value ཐོག་མའི་གཞི་གྲངས། - - + + Attribute name ངོ་བོའི་མིང་། - + Status: (G: Good | W: Warning | D: Damaged | U: Unknown) རྣམ་པ།(Gལེགས། | Wཉེན་བརྡ། | Dསྐྱོན་ཤོར། | Uམི་ཤེས།) - - - + + + Export button ཕྱིར་འདྲེན། - + Save File ཡིག་ཆ་ཉར་བ། - + Text files (*.txt) ཡིག་རྐྱང་ཡིག་ཆ། (*.txt) - + Wrong path ལམ་བུ་ནོར་བ། - + You do not have permission to access this path ཁྱེད་ཀྱིས་ལམ་བུ་འདི་འདྲི་གཏུག་བྱེད་དབང་མེད། - + Export successful ཕྱིར་འདྲེན་ཐུབ་པ། - + Export failed ཕྱིར་འདྲེན་མི་ཐུབ། @@ -1263,121 +1261,131 @@ will format it and remove its password. སྡུད་སྡེར་ཆ་འཕྲིན། - + + SSD + + + + + HDD + + + + Model: བཟོ་རྟགས། - + Vendor: བཟོ་མཁན། - + Media Type: བར་རྫས་ཀྱི་རིགས། - + Size: ཆེ་ཆུང་། - + Rotation Rate: འཁོར་བའི་མགྱོགས་ཚད། - + Interface: མཐུད་ཁ། - + Serial Number: གོ་རིམ་ཨང་གྲངས། - + Version: པར་གཞི། - + Capabilities: རྩོལ་ནུས། - + Description: ཞིབ་བརྗོད། - + Power On Hours: གློག་ཁྲིད་པའི་དུས་ཚོད། - + Power Cycle Count: གློག་གཏོང་བའི་ཐེངས་གྲངས། - + Firmware Version: བརྟན་ཆས་པར་གཞི། - + Speed: མྱུར་ཚད། - - - - - + + + + + %1 %1 - - - + + + Export button ཕྱིར་འདྲེན། - + Save File ཡིག་ཆ་ཉར་བ། - + Text files (*.txt) ཡིག་རྐྱང་ཡིག་ཆ། (*.txt) - + Wrong path ལམ་བུ་ནོར་བ། - + You do not have permission to access this path ཁྱེད་ཀྱིས་ལམ་བུ་འདི་འདྲི་གཏུག་བྱེད་དབང་མེད། - + Export successful ཕྱིར་འདྲེན་ཐུབ་པ། - + Export failed ཕྱིར་འདྲེན་མི་ཐུབ། @@ -1385,187 +1393,187 @@ will format it and remove its password. FormateDialog - + Wipe %1 %1སུབ་བཞིན་པ། - + It will erase all data on this disk, which will not be recovered དབྱེ་ཁུལ་བསུབ་ཚེ་སྡུད་སྡེར་འདིར་ཉར་བའི་གཞི་གྲངས་ཚང་མ་བསུབ་སྲིད་པ་དང་། བཀོལ་སྤྱོད་འདི་ཉིད་ཕྱིར་འཐེན་བྱེད་ཐབས་མེད་པས་གཟབ་ནན་བྱོས། - + Name: ཁུལ་ཚན་གྱི་མིང་། - + Name ཁུལ་ཚན་གྱི་མིང་། - + File system: ཁུལ་ཚན་གྱི་རྣམ་གཞག - + AES Encryption - + - + SM4 Encryption - + - + Security: བདེ་འཇགས་གདམ་ག - - + + Fast མགྱོགས་མྱུར། - - + + Secure བདེ་འཇགས། - + Advanced མཐོ་རིམ། - - + + It only deletes the partition info without erasing the files on the disk. Disk recovery tools may recover the files at a certain probability. གདམ་ག་འདིས་སྡུད་སྡེར་དབྱེ་ཁུལ་གྱི་ཆ་འཕྲིན་སུབ་པ་ལས་སྡུད་སྡེར་ནང་གི་ཡིག་ཆ་བསུབ་མི་སྲིད། སྡུད་སྡེར་སླར་གསོའི་བྱ་རིམ་ལས་ཡིག་ཆ་འདི་དག་སླར་གསོ་བྱ་ཐུབ་སྲིད། - + Wiping method: བསྐྱར་དུ་འབྲི་ཐེངས། - + DoD 5220.22-M, 7 passes DoD 5220.22-Mཚད་གཞི་དང་མཐུན་པ། བསྐྱར་དུ་ཐེངས་7འབྲི་བ། - + Gutmann, 35 passes Gutmannཚད་གཞི་དང་མཐུན་པ་། བསྐྱར་དུ་ཐེངས་35འབྲི་བ། - + Cancel button འདོར་བ། - + Wipe button སུབ་པ། - + Failed to find the disk སྡུད་སྡེར་སྒྲིག་ཆས་རག་ཐབས་བྲལ། - + The action cannot be undone, please proceed with caution - + - + LV name: - + - + LV name - + - + LV file system: - + - - + + You may be able to recover files after the wipe. - + - + Failed to submit the request to the kernel ནང་ཉིང་སྤྲོད་མ་ཐུབ། - - - - + + + + The length exceeds the limit ཡིག་རྟགས་ཀྱི་རིང་ཐུང་ཚད་ལས་བརྒལ་འདུག - + Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. - + - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. - + - + It is a one-time secure wipe that complies with NIST 800-88 and writes 0, 1, and random data to the entire disk once. You will not be able to recover files, and the process will be slow. གདམ་ག་འདི་ NIST 800-88 ཡི་བདེ་འཇགས་སུབ་ཐེངས་1དང་མཐུན་པས། དེས་སྡུད་སྡེར་ཧྲིལ་པོའི་ནང་0དང་1། ཡང་ན་གཞི་གྲངས་གང་རུང་ཞིག་འབྲི་སྲིད། བསུབས་རྗེས་སྡུད་སྡེར་ཐོག་གི་ཡིག་ཆ་སླར་གསོ་བྱེད་ཡི་ཐུབ་པ་མ་ཟད། ཐག་གཅོད་བྱེད་སྐབས་ཧ་ཅང་དལ་པོ་ཡོད། - + It writes 0, 1, and random data to the entire disk several times. You can set the number of times to erase disks and overwrite data, but the process will be very slow. གདམ་ག་འདིས་0དང་1། ཡང་ན་གཞི་གྲངས་གང་རུང་ཞིག་སྡུད་སྡེར་ཧྲིལ་པོའི་ནང་འབྲི་སྲིད། ཁྱེད་ཀྱིས་སྡུད་སྡེར་ལ་མཚན་ཉིད་བཞག་པ་མ་ཟད་གཞི་གྲངས་ཀྱི་ཐེངས་གྲངས་བཟོ་བཅོས་བྱེད་ཀྱང་ཆོག ཐག་གཅོད་བྱེད་པའི་བརྒྱུད་རིམ་ཧ་ཅང་དལ་པོ་ཡོད། - + You will not be able to recover files after the wipe, and the process will be slow. - + - + To avoid losing the password, please back up your password and keep it properly! - + - + OK button ཆོག - + Wiping %1 %1སུབ་བཞིན་པ། - + "%1" wiped %1བསུབས་པ། - + Failed to wipe %1 %1བསུབ་མ་ཐུབ། @@ -1575,8 +1583,8 @@ will format it and remove its password. - - + + Mount point: ཐེག་འཇུག་གནས། @@ -1593,9 +1601,9 @@ will format it and remove its password. - - - + + + Type: རིགས་གྲས། @@ -1607,7 +1615,7 @@ will format it and remove its password. - + Volume label: བམ་པོའི་མཚོན་རྟགས། @@ -1627,31 +1635,41 @@ will format it and remove its password. མཐུད་ཁ། - + + SSD + + + + + HDD + + + + LV count: - + - + VG name: - + - - + + Volume group - + - + Volume name: - + - - + + Logical volume - + @@ -1677,13 +1695,13 @@ will format it and remove its password. Volume group - + MainWindow - + Refresh གསར་འདོན། @@ -1711,13 +1729,13 @@ will format it and remove its password. Please select /mnt or /media, or its subdirectories. - + The mount point is illegal. Please select /mnt or /media, or its subdirectories. - + @@ -1744,7 +1762,7 @@ will format it and remove its password. Mounting failed: The selected mount point is not empty. Please select another one! - + @@ -1831,7 +1849,7 @@ will format it and remove its password. Click %1 to increase the number of partitions. Click on each partition to change its name and file system. - + @@ -1851,7 +1869,7 @@ will format it and remove its password. - + Disk: སྡུད་སྡེར། @@ -1859,7 +1877,7 @@ will format it and remove its password. - + File system: ཁུལ་ཚན་གྱི་རྣམ་གཞག @@ -1933,12 +1951,12 @@ will format it and remove its password. Use the aes-xts-plain64 standard algorithm to encrypt the disk. If it is encrypted, you should decrypt it before mounting. - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. If it is encrypted, you should decrypt it before mounting. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. - + @@ -1948,17 +1966,17 @@ will format it and remove its password. To encrypt a partition, it should be larger than 100 MiB - + Set a password to encrypt the new partition - + To avoid losing the password, please back up your password and keep it properly! - + @@ -1978,47 +1996,47 @@ will format it and remove its password. Set a password to encrypt %1 - + The password cannot be reset or retrieved online - + Password - + Repeat password - + Password hint - + (Recommended) - + Enter a password - + Enter the password again - + Enter a password hint - + @@ -2037,33 +2055,33 @@ will format it and remove its password. The password exceeds the maximum length - + The password cannot be empty - + Passwords do not match - + The password hint should differ from the password - + QObject - + Disk Utility སྡུད་སྡེར་དོ་དམ་ཆས། - + Disk Utility is a disk management tool for creating, reorganizing and formatting partitions. སྡུད་སྡེར་དོ་དམ་ཆས་ཀྱིས་སྤྱོད་མཁན་གྱིས་སྡུད་སྡེར་ཁུལ་དབྱེ་དང་། བར་སྣང་སྙོམས་སྒྲིག རྣམ་གཞག་ཏུ་སྒྱུར་བ་སོགས་བཀོལ་སྤྱོད་བྱེད་སྐབས་རོགས་རམ་བྱེད་ཆོག @@ -2073,12 +2091,12 @@ will format it and remove its password. Are you sure you want to delete the physical volume? - + To prevent data loss, back up data in the physical volume before deleting it - + @@ -2095,22 +2113,22 @@ will format it and remove its password. Deleting... - + A lot of data exists on %1, - + which may take a long time to back it up. - + Do you want to continue? - + @@ -2125,7 +2143,7 @@ will format it and remove its password. Not enough space to back up data on %1, please delete the logical volume first - + @@ -2135,7 +2153,7 @@ will format it and remove its password. Failed to delete the physical volume - + @@ -2148,12 +2166,12 @@ will format it and remove its password. New capacity: - + Auto adjusted to integral multiples of 4 MiB - + @@ -2164,7 +2182,7 @@ will format it and remove its password. It will resize the logical volume space - + @@ -2185,12 +2203,12 @@ will format it and remove its password. No more than the maximum capacity please - + The file system does not support shrinking space - + @@ -2205,47 +2223,47 @@ will format it and remove its password. No less than the used capacity please - + To prevent data loss, back up data before shrinking it - + Unmount it before shrinking its space - + The current device has been mounted and will be unmounted automatically. Please back up data in it to prevent data loss - + To prevent data loss, back up data in the logical volume before shrinking it - + The file system does not support space adjustment - + SizeInfoWidget - - - Capacity: - སྤྱིའི་ཤོང་ཚད། + + + Available: + སྤྱོད་ཆོག་པའི་བར་སྟོང་། - - - - + + + + Used: སྤྱོད་ཟིན་པ། @@ -2281,104 +2299,104 @@ will format it and remove its password. - + Create volume group - + Delete volume group - + Delete logical volume - + Delete physical volume - + - + Create logical volume - + - + Cannot recognize its partition table མིག་སྔའི་སྒྲིག་ཆས་ཀྱི་ཁུལ་ཚན་རེའུ་མིག་དབྱེ་བ་འབྱེད་ཐབས་བྲལ། - + Unable to mount the device: no file system is found, or the file system is not supported - + - - - - - - - - + + + + + + + + OK ཆོག - - + + The file system does not support space adjustment - + - + The disks will be formatted if you create a logical volume - + - - - + + + Unmount %1 first - + - - + + Data cannot be recovered if deleted, please confirm before proceeding - + - - + + Delete སུབ་པ། - - + + Cancel འདོར་བ། - + To ensure the normal use of system backup and restore, rootA and rootB should be resized to the same value - + - + The disks will be formatted if you create a volume group - + - + Unmount all logical volumes in %1 first - + @@ -2398,7 +2416,7 @@ rootA and rootB should be resized to the same value Make sure there are no programs running on the logical volume - + @@ -2416,12 +2434,12 @@ rootA and rootB should be resized to the same value Unmounting system disk may result in system crash - + I will take the risks that may arise - + @@ -2443,4 +2461,4 @@ rootA and rootB should be resized to the same value ལས་མེད་བར་སྣང་། - \ No newline at end of file + diff --git a/application/translations/deepin-diskmanager_ug.ts b/application/translations/deepin-diskmanager_ug.ts index 40cf7d77..626f2380 100644 --- a/application/translations/deepin-diskmanager_ug.ts +++ b/application/translations/deepin-diskmanager_ug.ts @@ -1,20 +1,22 @@ - + + + CreateLVWidget Creating logical volumes on %1 - + Click %1 to create a logical volume. - + VG Information - + @@ -25,14 +27,14 @@ LV name: - + VG name: - + @@ -40,7 +42,7 @@ LV file system: - + @@ -63,22 +65,22 @@ LV Information - + Create LV: - + Delete last logical volume - + LV capacity: - + @@ -99,22 +101,22 @@ Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. - + To encrypt a volume, it should be larger than 100 MiB - + To avoid losing the password, please back up your password and keep it properly! - + @@ -156,7 +158,7 @@ Create volume group - + @@ -166,7 +168,7 @@ Select disks or partitions to create a volume group and set its capacity - + @@ -182,22 +184,22 @@ Capacity selected: %1 - + The selected disks will be converted to dynamic disks, and you will not be able to start installed operating systems from the disks. - + No partitions available - + No disks or partitions available - + @@ -209,32 +211,32 @@ Next - + Selected disks/partitions - + Set VG capacity - + Auto adjusted to integral multiples of 4 MiB - + Choose one disk or partition at least - + Previous - + @@ -245,53 +247,53 @@ Resizing space... - + Creating... - + Selected disks and partitions: - + VG capacity: %1 - + VG name: %1 - + No less than the used capacity please - + No more than the maximum capacity please - + A lot of data exists on %1, - + which may take a long time to back it up. - + Do you want to continue? - + @@ -308,7 +310,7 @@ Adding the disk/partition to a logical volume group will format it and remove its password. - + @@ -320,28 +322,28 @@ will format it and remove its password. Not enough space to back up data on %1, please clear disk space - + Existing volume group, creation failed. Please retry after reboot. - + Failed to create a physical volume. Please refresh Disk Utility and try again. - + Device input/output error. Please try again after reboot. - + Refreshing the page to reload disks - + @@ -390,133 +392,133 @@ will format it and remove its password. سانلىق مەلۇمات يۈكلىنىۋاتىدۇ... - - - + + + Mounting %1 ... %1 يۈكلىنىۋاتىدۇ... - - - + + + Unmounting %1 ... %1 ئۆچۈرۈلۈۋاتىدۇ... - + Resizing %1 ... %1 نىڭ بوشلۇقى تەڭشىلىۋاتىدۇ... - + Creating a new partition... يېڭى رايون قۇرۇلۇۋاتىدۇ... - + Deleting %1 ... %1 ئۆچۈرۈلۈۋاتىدۇ... - + Creating a partition table of %1 ... %1 نىڭ رايون جەدۋىلى قۇرۇلۇۋاتىدۇ... - + Replacing the partition table of %1 ... %1 نىڭ رايون جەدۋىلى ئالمىشىۋاتىدۇ... - + Creating... - + - - + + Deleting... - + - + Resizing space... - + - - + + AES Encryption - + - - + + SM4 Encryption - + - + Failed to encrypt %1, please try again! - + - + Failed to decrypt %1, please try again! - + - + %1 failed to close the crypto map - + - + Failed to create partitions, please try again! - + - - + + Failed to create %1 file system, please try again! - + - + Failed to submit the request to the kernel ئىچكى يادرۇ يوللانمىدى - - + + DBUS parameter error - + - + Failed to mount %1 - + - + %1 failed to create mounting folders - + - + %1 failed to change the owner of mounting folders - + - + Creating partition table failed رايون جەدۋىلى قۇرالمىدى - + Failed to create a logical volume, please try again! - + @@ -524,22 +526,22 @@ will format it and remove its password. Enter the password to decrypt the disk - + Enter the password to decrypt the volume group - + Enter a password - + Password hint - + @@ -551,42 +553,42 @@ will format it and remove its password. Decrypt button - + Decrypting... - + Please try again %1 minutes later - + The password cannot be empty - + Decryption failed - + Password locked, please try again %1 minutes later - + Wrong password, %1 chances left - + Wrong password, only one chance left - + @@ -622,54 +624,50 @@ will format it and remove its password. رايون جەدۋىلى قۇرۇش - + Delete partition رايون ئۆچۈرۈش - + Delete volume group - + - - + + Create logical volume - + - + Delete logical volume - + - Failed to get hardware information - - - - + Close تاقاش - + Health checking does not support this type of device. - + - + Please unmount all partitions in the disk first ئالدى بىلەن نۆۋەتتىكى دىسكىدىكى بارلىق رايونلارنى ئۆچۈرۈۋېتىڭ - - - + + + OK تامام - + All partitions in this disk will be merged and all data will be lost if creating a new partition table, please take it carefully @@ -677,452 +675,452 @@ will format it and remove its password. بارلىق سانلىق مەلۇماتلاريوقىلىدۇ ، ئېھتىيات بىلەن ئىشلىتىڭ - + Proceed داۋاملاشتۇرۇش - - - - - - + + + + + + Cancel بىكار قىلىش - + No errors found in the partition table رايونغا ئايرىش جەدۋىلى نورمال - + Do you want to hide this partition? بۇ رايوننى يوشۇرامسىز؟ - + Hide يوشۇرۇش - + Failed to hide the partition: unable to lock it رايوننى يوشۇرۇش مەغلۇپ بولدى! بۇ رايوننى قۇلۇپلاشقا بولمىدى - + You can only hide the unmounted partition پەقەت ئۆچۈرۈلگەن ھالەتتىكى رايوننىلا يوشۇرغىلى بولىدۇ - + Do you want to unhide this partition? بۇ يوشۇرۇن رايوننى كۆرسەتمەكچىمۇ؟ - + Unhide كۆرسەت - + Are you sure you want to delete this partition? بۇ رايوننى ئۆچۈرمەكچىمۇ؟ - + You will lose all data in it بۇ رايوندىكى بارلىق ھۆججەتلەر يوقاپ كېتىدۇ - - - + + + Delete ئۆچۈرۈش - + Failed to delete the partition: unable to lock it رايوننى ئۆچۈرگىلى بولمىدى! بۇ رايوننى قۇلۇپلاشقا بولمايدۇ - + Hide the partition successfully رايون يوشۇرۇلدى - + Failed to hide the partition رايون يوشۇرۇلمىدى - + Unhide the partition successfully رايون كۆرسىتىلدى - + Failed to unhide the partition رايوننى كۆرسىتەلمىدى - + Delete the partition successfully رايون ئۆچۈرۈلدى - + Failed to find the disk دىسكا ئۈسكۈنىسىنى ئوقۇيالمىدى - + Failed to get the partition info رايون ئۇچۇرىنى ئوقۇيالمىدى - + Failed to delete the partition ئۆچۈرۈلمىدى - + Failed to submit the request to the kernel ئىچكى يادرۇ يوللانمىدى - + Failed to delete the partition: %1 رايون ئۆچۈرۈلمىدى، %1 - + Unmounting successful ئۆچۈرۈلدى - + Unmounting failed ئۆچۈرەلمىدى - + Creating partition table successful رايون جەدۋىلى قۇرۇلدى - + Replacing partition table successful رايونغا ئايرىش جەدۋىلى ئالماشتۇرۇلدى - + Creating partition table failed رايون جەدۋىلى قۇرالمىدى - + Replacing partition table failed رايونغا ئايرىش جەدۋىلى ئالماشتۇرالمىدى - + Unmount all logical volumes in %1 first - + - - + + Data cannot be recovered if deleted, please confirm before proceeding - + - + The disks will be formatted if you create a logical volume - + - + Unmount %1 first - + - + The logical volume group is busy and cannot be deleted. Please retry after reboot. - + - - + + The logical volume is busy and cannot be deleted. Please retry after reboot. - + - + Failed to delete the logical volume group - + - + Failed to delete the logical volume - + - + Volume Groups - + - + Disks - + DiskBadSectorsDialog - + Verify or repair bad sectors تەكشۈرۈش ۋە رېمونتلاش - - - + + + Verify: تەكشۈرۈش دائىرىسى - + Cylinders سىلىندىر دائىرىسى - + Sectors سېكتور - + MB مىگابايىت - - - + + + Method: تەكشۈرۈش ئۇسۇلى: - + Rounds - + - + Timeout ۋاقىتلىق توختىتىش - + ms مىللىسېكۇنت - + Result: تەكشۈرۈش نەتىجىسى: - + Excellent ئەلا - + Damaged بۇزۇلغان - + Unknown نامەلۇم - + Exit button چېكىنىش - + Reset button قايتا تەڭشەش - + Repair ئوڭشاش - + Start Verify تەكشۈرۈپ دەلىللەش باشلاندى - + Stop button توختىتىش - + Continue button داۋاملاشتۇرۇش - + Verify Again قايتا تەكشۈرۈش - + Done button تاماملاندى - - - - - - - + + + + + + + Time elapsed: كەتكەن ۋاقىت: - - - - - - - - - - + + + + + + + + + + Time left: قالغان ۋاقىت: - + Verifying cylinder: %1 %1 سىلىندىر تەكشۈرۈلۈۋاتىدۇ - + Verify completed تەكشۈرۈش تامام - + Disk verify completed. %1 bad blocks found. دىسكا تەكشۈرۈش تاماملاندى، جەمئىي %1 مەسىلە بايقالدى - - + + OK تامام - + The verifying disk contains mounted partitions, so you cannot repair it. تەكشۈرۈلگەن دىسكىدا ئايرىلغان رايون بار، رېمونتلاشقا ئامالسىز - + Please unmount partitions and then repair the disk. رېمونتلىماقچى بولسىڭىز ئاۋۋال رايوننى ئۆچۈرۈۋېتىڭ - + Warning خەتەرلىك - + Bad sector repairing cannot recover files, دىسكا رېمونتلاش سانلىق مەلۇماتلىرىڭىزنى ئەسلىگە كەلتۈرۈشتىكى ۋاسىتە بولالمايدۇ، - + but destroys data on and near bad sectors instead. بۇزۇلغان دىسكا يوللىرىنى رېمونتلاش دىسكا يوللىرىنى ۋە ئەتراپىدىكى دىسكا يوللىرىدىكى سانلىق مەلۇماتلارنى زىيانغا ئۇچرىتىدۇ. - + Please back up all data before repair. سانلىق مەلۇماتلىرىڭىزنى ئالدىن زاپاسلاڭ. - - - + + + Cancel بىكار قىلىش - + Start Repair ياماش باشلاندى - + Repairing cylinder: %1 %1 سىلىندىر تەكشۈرۈلۈۋاتىدۇ - + Repair completed. Cylinder: %1 repaired. رېمونتلاش تاماملاندى، %1 سىلىندىر تەكشۈرۈلدى - + Disk repair completed. %1 bad blocks repaired. دىسكا تەكشۈرۈش تاماملاندى، جەمئىي %1 مەسىلە بايقالدى - + Verifying for bad sectors, exit now? تەكشۈرۈلۈۋاتىدۇ، كۆزنەكتىن چېكىنەمسىز؟ - + The verified information will not be reserved تەكشۈرۈش ئۇچۇرى ساقلاپ قېلىنمايدۇ - - + + Exit چېكىنىش - + Repairing bad sectors, exit now? رېمونتلاۋاتىدۇ، كۆزنەكتىن چېكىنەمسىز؟ - + The repairing information will not be reserved تەكشۈرۈش ئۇچۇرى ساقلاپ قېلىنمايدۇ @@ -1135,122 +1133,122 @@ will format it and remove its password. دىسكا ھالىتىنى تەكشۈرۈش - + Serial number تەرتىپ نومۇر - + Storage ئىشلەتكۈچى سىغىمى - + Health Status ھالىتى - + Good ياخشى - + Damaged بۇزۇلغان - + Unknown نامەلۇم - + Temperature تېمپېراتۇرا - - + + ID ID - - + + Status ھالەت - - + + Current نۆۋەتتىكى قىممىتى - - + + Worst بۇرۇنقى ئەڭ ناچار قىممىتى - - + + Threshold چەك قىممىتى - - + + Raw Value دەسلەپكى سانلىق مەلۇمات - - + + Attribute name خاسلىق نامى - + Status: (G: Good | W: Warning | D: Damaged | U: Unknown) - ھالىتى: (G:  ياخشى | W: ئاگاھلاندۇرۇش | D: بۇزۇلغان | U: نامەلۇم) + ھالىتى: (G:  ياخشى | W: ئاگاھلاندۇرۇش | D: بۇزۇلغان | U: نامەلۇم) - - - + + + Export button چىقىرىش - + Save File ساقلاش - + Text files (*.txt) - تېكىست ھۆججەت  (*.txt) + تېكىست ھۆججەت  (*.txt) - + Wrong path ئورۇن خاتالىقى - + You do not have permission to access this path بۇ ئورۇننى زىيارەت قىلىش ھوقۇقىڭىز يوق - + Export successful ئۆچۈرۈلدى - + Export failed چىقىرالمىدى @@ -1263,121 +1261,131 @@ will format it and remove its password. دىسكا ئۇچۇرى - + + SSD + + + + + HDD + + + + Model: تىپى: - + Vendor: ياسىغۇچى: - + Media Type: مېدىيا تىپى: - + Size: رايون سىغىمى: - + Rotation Rate: ئايلىنىش سۈرئىتى: - + Interface: ئۇلاش ئېغىزى: - + Serial Number: تەرتىپ نومۇر: - + Version: نەشرى: - + Capabilities: ئىقتىدارى: - + Description: تەسۋىر: - + Power On Hours: توكقا ئۇلانغان ۋاقتى: - + Power Cycle Count: توكقا ئۇلانغان قېتىم سانى: - + Firmware Version: يۇمشاق دېتال نۇسخىسى: - + Speed: سۈرئىتى: - - - - - + + + + + %1 %1 - - - + + + Export button چىقىرىش - + Save File ساقلاش - + Text files (*.txt) - تېكىست ھۆججەت  (*.txt) + تېكىست ھۆججەت  (*.txt) - + Wrong path ئورۇن خاتالىقى - + You do not have permission to access this path بۇ ئورۇننى زىيارەت قىلىش ھوقۇقىڭىز يوق - + Export successful چىقىرىلدى - + Export failed چىقىرالمىدى @@ -1385,187 +1393,187 @@ will format it and remove its password. FormateDialog - + Wipe %1 %1 تازىلىنىۋاتىدۇ - + It will erase all data on this disk, which will not be recovered رايوننى تازىلىسىڭىز بۇ دىسكىغا ساقلانغان بارلىق سانلىق مەلۇمات ئۆچۈرۈلىدۇ، بۇ مەشغۇلاتنى كەينىگە ياندۇرغىلى بولمايدۇ، ئېھتىيات بىلەن مەشغۇلات قىلىڭ - + Name: رايون نامى: - + Name رايون نامى - + File system: رايون فورماتى: - + AES Encryption - + - + SM4 Encryption - + - + Security: بىخەتەرلىك تاللىشى: - - + + Fast تېز - - + + Secure بىخەتەر - + Advanced ئالىي - - + + It only deletes the partition info without erasing the files on the disk. Disk recovery tools may recover the files at a certain probability. بۇ تاللانما پەقەت دىسكىنى رايۇنغا ئايرىش ئۇچۇرىنىلا ئۆچۈرىدۇ، دىسكىدىكى ھۆججەتلەرنى ئۆچۈرمەيدۇ. دىسكا ئەسلىگە كەلتۈرۈش پىروگراممىسىنىڭ بۇ ھۆججەتلەرنى ئەسلىگە كەلتۈرۈش ئېھتىماللىقى بار. - + Wiping method: باستۇرۇش قېتىم سانى: - + DoD 5220.22-M, 7 passes DoD 5220.22-M ئۆلچىمىگە ئۇيغۇن، 7 قېتىم باستۇرۇش - + Gutmann, 35 passes Gutmann ئۆلچىمىگە ئۇيغۇن، 35 قېتىم باستۇرۇش - + Cancel button بىكار قىلىش - + Wipe button ئۆچۈرۈش - + Failed to find the disk دىسكا ئۈسكۈنىسىنى ئوقۇيالمىدى - + The action cannot be undone, please proceed with caution - + - + LV name: - + - + LV name - + - + LV file system: - + - - + + You may be able to recover files after the wipe. - + - + Failed to submit the request to the kernel ئىچكى يادرۇ يوللانمىدى - - - - + + + + The length exceeds the limit ھەرپنىڭ ئۇزۇنلۇقى چەكتىن ئېشىپ كېتىدۇ - + Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. - + - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. - + - + It is a one-time secure wipe that complies with NIST 800-88 and writes 0, 1, and random data to the entire disk once. You will not be able to recover files, and the process will be slow. - بۇ تۈر NIST 800-88  نىڭ 1 قېتىم باستۇرۇپ ئۆچۈرۈش ئۆلچىمىگە ئۇيغۇن. ئۇ پۈتۈن دىسكىغا 0، 1 ۋە خالىغانچە سانلىق مەلۇماتلارنى بىر قېتىم يازىدۇ. ئۆچۈرگەندىن كېيىن دىسكىدىكى ھۆججەتلەرنى ئەسلىگە كەلتۈرگىلى بولمايدۇ ھەمدە بىر تەرەپ قىلىش جەريانى بىر قەدەر ئاستا بولىدۇ. + بۇ تۈر NIST 800-88  نىڭ 1 قېتىم باستۇرۇپ ئۆچۈرۈش ئۆلچىمىگە ئۇيغۇن. ئۇ پۈتۈن دىسكىغا 0، 1 ۋە خالىغانچە سانلىق مەلۇماتلارنى بىر قېتىم يازىدۇ. ئۆچۈرگەندىن كېيىن دىسكىدىكى ھۆججەتلەرنى ئەسلىگە كەلتۈرگىلى بولمايدۇ ھەمدە بىر تەرەپ قىلىش جەريانى بىر قەدەر ئاستا بولىدۇ. - + It writes 0, 1, and random data to the entire disk several times. You can set the number of times to erase disks and overwrite data, but the process will be very slow. بۇ تاللاش تۈرى كۆپ قېتىم 0، 1 ۋە خالىغانچە سانلىق مەلۇماتلارنى پۈتۈن دىسكىغا يازىدۇ. سىز دىسكىنى ئۆچۈرۈش ۋە سانلىق مەلۇماتلارنى ئۆزگەرتىش قېتىم سانىغا ئېنىقلىما بەرسىڭىز بولىدۇ، بىر تەرەپ قىلىش جەريانى ئىنتايىن ئاستا بولىدۇ. - + You will not be able to recover files after the wipe, and the process will be slow. - + - + To avoid losing the password, please back up your password and keep it properly! - + - + OK button تامام - + Wiping %1 %1 تازىلىنىۋاتىدۇ - + "%1" wiped %1 تازىلاندى - + Failed to wipe %1 %1 تازىلانمىدى @@ -1575,8 +1583,8 @@ will format it and remove its password. - - + + Mount point: ئېسىش نۇقتىسى: @@ -1593,9 +1601,9 @@ will format it and remove its password. - - - + + + Type: تۈرى: @@ -1607,7 +1615,7 @@ will format it and remove its password. - + Volume label: دىسكىغا ئايرىش بەلگىسى: @@ -1627,31 +1635,41 @@ will format it and remove its password. ئۇلاش ئېغىزى: - + + SSD + + + + + HDD + + + + LV count: - + - + VG name: - + - - + + Volume group - + - + Volume name: - + - - + + Logical volume - + @@ -1677,13 +1695,13 @@ will format it and remove its password. Volume group - + MainWindow - + Refresh يېڭىلاش @@ -1711,13 +1729,13 @@ will format it and remove its password. Please select /mnt or /media, or its subdirectories. - + The mount point is illegal. Please select /mnt or /media, or its subdirectories. - + @@ -1744,7 +1762,7 @@ will format it and remove its password. Mounting failed: The selected mount point is not empty. Please select another one! - + @@ -1831,7 +1849,7 @@ will format it and remove its password. Click %1 to increase the number of partitions. Click on each partition to change its name and file system. - + @@ -1851,7 +1869,7 @@ will format it and remove its password. - + Disk: دىسكا: @@ -1859,7 +1877,7 @@ will format it and remove its password. - + File system: رايون فورماتى: @@ -1933,12 +1951,12 @@ will format it and remove its password. Use the aes-xts-plain64 standard algorithm to encrypt the disk. If it is encrypted, you should decrypt it before mounting. - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. If it is encrypted, you should decrypt it before mounting. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. - + @@ -1948,17 +1966,17 @@ will format it and remove its password. To encrypt a partition, it should be larger than 100 MiB - + Set a password to encrypt the new partition - + To avoid losing the password, please back up your password and keep it properly! - + @@ -1978,47 +1996,47 @@ will format it and remove its password. Set a password to encrypt %1 - + The password cannot be reset or retrieved online - + Password - + Repeat password - + Password hint - + (Recommended) - + Enter a password - + Enter the password again - + Enter a password hint - + @@ -2037,33 +2055,33 @@ will format it and remove its password. The password exceeds the maximum length - + The password cannot be empty - + Passwords do not match - + The password hint should differ from the password - + QObject - + Disk Utility دىسكا باشقۇرغۇچىسى - + Disk Utility is a disk management tool for creating, reorganizing and formatting partitions. دىسكا باشقۇرغۇچى ئىشلەتكۈچىلەرنىڭ دىسكا بۆلۈش، بوشلۇق تەڭشەش ۋە فورماتلاش قاتارلىق مەشغۇلاتلارنى قىلىشىغا ياردەم بېرەلەيدۇ. @@ -2073,12 +2091,12 @@ will format it and remove its password. Are you sure you want to delete the physical volume? - + To prevent data loss, back up data in the physical volume before deleting it - + @@ -2095,22 +2113,22 @@ will format it and remove its password. Deleting... - + A lot of data exists on %1, - + which may take a long time to back it up. - + Do you want to continue? - + @@ -2125,7 +2143,7 @@ will format it and remove its password. Not enough space to back up data on %1, please delete the logical volume first - + @@ -2135,7 +2153,7 @@ will format it and remove its password. Failed to delete the physical volume - + @@ -2148,12 +2166,12 @@ will format it and remove its password. New capacity: - + Auto adjusted to integral multiples of 4 MiB - + @@ -2164,7 +2182,7 @@ will format it and remove its password. It will resize the logical volume space - + @@ -2185,12 +2203,12 @@ will format it and remove its password. No more than the maximum capacity please - + The file system does not support shrinking space - + @@ -2205,47 +2223,47 @@ will format it and remove its password. No less than the used capacity please - + To prevent data loss, back up data before shrinking it - + Unmount it before shrinking its space - + The current device has been mounted and will be unmounted automatically. Please back up data in it to prevent data loss - + To prevent data loss, back up data in the logical volume before shrinking it - + The file system does not support space adjustment - + SizeInfoWidget - - - Capacity: - ئومۇمىي سىغىمى: + + + Available: + ئىشلەتكىلى بولىدىغان بوشلۇق: - - - - + + + + Used: ئىشلىتىلگەن بوشلۇق: @@ -2281,104 +2299,104 @@ will format it and remove its password. - + Create volume group - + Delete volume group - + Delete logical volume - + Delete physical volume - + - + Create logical volume - + - + Cannot recognize its partition table رايونغا ئايرىش جەدۋىلى تېپىلمىدى - + Unable to mount the device: no file system is found, or the file system is not supported - + - - - - - - - - + + + + + + + + OK تامام - - + + The file system does not support space adjustment - + - + The disks will be formatted if you create a logical volume - + - - - + + + Unmount %1 first - + - - + + Data cannot be recovered if deleted, please confirm before proceeding - + - - + + Delete ئۆچۈرۈش - - + + Cancel بىكار قىلىش - + To ensure the normal use of system backup and restore, rootA and rootB should be resized to the same value - + - + The disks will be formatted if you create a volume group - + - + Unmount all logical volumes in %1 first - + @@ -2398,7 +2416,7 @@ rootA and rootB should be resized to the same value Make sure there are no programs running on the logical volume - + @@ -2416,12 +2434,12 @@ rootA and rootB should be resized to the same value Unmounting system disk may result in system crash - + I will take the risks that may arise - + @@ -2443,4 +2461,4 @@ rootA and rootB should be resized to the same value بىكار بوشلۇق - \ No newline at end of file + diff --git a/application/translations/deepin-diskmanager_zh_CN.ts b/application/translations/deepin-diskmanager_zh_CN.ts index 814558fa..095c4527 100644 --- a/application/translations/deepin-diskmanager_zh_CN.ts +++ b/application/translations/deepin-diskmanager_zh_CN.ts @@ -1,4 +1,6 @@ - + + + CreateLVWidget @@ -391,131 +393,131 @@ will format it and remove its password. 正在初始化数据... - - - + + + Mounting %1 ... 正在对%1进行挂载... - - - + + + Unmounting %1 ... 正在对%1进行卸载... - + Resizing %1 ... 正在对%1进行空间调整... - + Creating a new partition... 正在新建分区... - + Deleting %1 ... 正在对%1进行删除... - + Creating a partition table of %1 ... 正在对%1进行分区表创建... - + Replacing the partition table of %1 ... 正在对%1进行分区表替换... - + Creating... 正在创建,请稍候... - - + + Deleting... 正在删除,请稍候... - + Resizing space... 正在调整空间,请稍候... - - + + AES Encryption AES加密 - - + + SM4 Encryption SM4加密 - + Failed to encrypt %1, please try again! %1加密失败,请重试! - + Failed to decrypt %1, please try again! %1解锁失败,请重试! - + %1 failed to close the crypto map %1关闭加密映射失败 - + Failed to create partitions, please try again! 创建分区失败,请重试! - - + + Failed to create %1 file system, please try again! %1文件系统创建失败,请重试! - + Failed to submit the request to the kernel 提交内核失败 - - + + DBUS parameter error DBUS参数错误 - + Failed to mount %1 %1挂载失败 - + %1 failed to create mounting folders %1创建挂载文件夹失败 - + %1 failed to change the owner of mounting folders %1更改挂载文件夹属主失败 - + Creating partition table failed 新建分区表失败 - + Failed to create a logical volume, please try again! 逻辑卷创建失败,请重试! @@ -623,50 +625,50 @@ will format it and remove its password. 新建分区表 - + Delete partition 删除分区 - + Delete volume group 删除逻辑卷组 - - + + Create logical volume 创建逻辑卷 - + Delete logical volume 删除逻辑卷 - + Close 关闭 - + Health checking does not support this type of device. 该类型设备暂不支持健康检测 - + Please unmount all partitions in the disk first 请先卸载当前磁盘中的所有分区 - - - + + + OK 确定 - + All partitions in this disk will be merged and all data will be lost if creating a new partition table, please take it carefully @@ -674,206 +676,206 @@ will format it and remove its password. 丢失所有数据,请谨慎使用 - + Proceed 继续 - - - - - - + + + + + + Cancel 取消 - + No errors found in the partition table 分区表检测正常 - + Do you want to hide this partition? 您是否要隐藏该分区? - + Hide 隐藏 - + Failed to hide the partition: unable to lock it 隐藏分区失败!无法锁定该分区 - + You can only hide the unmounted partition 只有处于卸载状态的分区才能被隐藏 - + Do you want to unhide this partition? 您是否要显示该隐藏分区? - + Unhide 显示 - + Are you sure you want to delete this partition? 您确定要删除该分区吗? - + You will lose all data in it 该分区内所有文件将会丢失 - - - + + + Delete 删除 - + Failed to delete the partition: unable to lock it 删除分区失败!无法锁定该分区 - + Hide the partition successfully 隐藏分区成功 - + Failed to hide the partition 隐藏分区失败 - + Unhide the partition successfully 显示分区成功 - + Failed to unhide the partition 显示分区失败 - + Delete the partition successfully 删除分区成功 - + Failed to find the disk 获取磁盘设备失败 - + Failed to get the partition info 获取分区信息失败 - + Failed to delete the partition 删除操作失败 - + Failed to submit the request to the kernel 提交内核失败 - + Failed to delete the partition: %1 删除分区失败,%1 - + Unmounting successful 卸载成功 - + Unmounting failed 卸载失败 - + Creating partition table successful 新建分区表成功 - + Replacing partition table successful 替换分区表成功 - + Creating partition table failed 新建分区表失败 - + Replacing partition table failed 替换分区表失败 - + Unmount all logical volumes in %1 first 请先手动卸载%1下所有的逻辑卷 - - + + Data cannot be recovered if deleted, please confirm before proceeding 删除后数据将无法恢复,请确认 - + The disks will be formatted if you create a logical volume 创建逻辑卷将格式化磁盘 - + Unmount %1 first 请先手动卸载%1 - + The logical volume group is busy and cannot be deleted. Please retry after reboot. 逻辑卷组被占用,无法删除。请重启电脑后重试。 - - + + The logical volume is busy and cannot be deleted. Please retry after reboot. 逻辑卷被占用,无法删除。请重启电脑后重试。 - + Failed to delete the logical volume group 删除逻辑卷组失败 - + Failed to delete the logical volume 删除逻辑卷失败 - + Volume Groups 逻辑卷组 - + Disks 所有设备 @@ -881,245 +883,245 @@ will format it and remove its password. DiskBadSectorsDialog - + Verify or repair bad sectors 坏道检测与修复 - - - + + + Verify: 检测范围: - + Cylinders 柱面范围 - + Sectors 扇区范围 - + MB 容量范围 - - - + + + Method: 检测方式: - + Rounds 检测次数 - + Timeout 超时时间 - + ms 毫秒 - + Result: 检测结果: - + Excellent 优秀 - + Damaged 损坏 - + Unknown 未知 - + Exit button 退 出 - + Reset button 复 位 - + Repair 尝试修复 - + Start Verify 开始检测 - + Stop button 停 止 - + Continue button 继 续 - + Verify Again 重新检测 - + Done button 完 成 - - - - - - - + + + + + + + Time elapsed: 已用时间: - - - - - - - - - - + + + + + + + + + + Time left: 剩余时间: - + Verifying cylinder: %1 正在检测%1柱面 - + Verify completed 检测完成 - + Disk verify completed. %1 bad blocks found. 磁盘检测完毕,共检查到%1个坏道区域 - - + + OK 确定 - + The verifying disk contains mounted partitions, so you cannot repair it. 当前检测磁盘存在已挂载分区,无法修复坏道 - + Please unmount partitions and then repair the disk. 若要修复请先卸载分区 - + Warning 警告 - + Bad sector repairing cannot recover files, 修复坏磁道不是数据恢复的手段, - + but destroys data on and near bad sectors instead. 修复坏磁道会破坏坏磁道及其附近磁道上的文件数据。 - + Please back up all data before repair. 请先做好数据备份。 - - - + + + Cancel 取消 - + Start Repair 开始修复 - + Repairing cylinder: %1 正在修复%1柱面 - + Repair completed. Cylinder: %1 repaired. 修复完成,已修复%1柱面 - + Disk repair completed. %1 bad blocks repaired. 磁盘修复完毕,共修复%1个坏道区域 - + Verifying for bad sectors, exit now? 正在检测中,是否退出窗口? - + The verified information will not be reserved 当前检测信息不会保留 - - + + Exit 退出 - + Repairing bad sectors, exit now? 正在修复中,是否退出窗口? - + The repairing information will not be reserved 当前修复信息不会保留 @@ -1132,122 +1134,122 @@ will format it and remove its password. 硬盘健康检测 - + Serial number 序列号 - + Storage 用户容量 - + Health Status 健康状态 - + Good 良好 - + Damaged 损坏 - + Unknown 未知 - + Temperature 温度 - - + + ID ID - - + + Status 状态 - - + + Current 当前值 - - + + Worst 历史最差值 - - + + Threshold 临界值 - - + + Raw Value 原始数据 - - + + Attribute name 属性名称 - + Status: (G: Good | W: Warning | D: Damaged | U: Unknown) 状态:(G: 良好 | W: 警告 | D: 损坏 | U: 未知) - - - + + + Export button 导 出 - + Save File 保存文件 - + Text files (*.txt) 文本文件 (*.txt) - + Wrong path 路径错误 - + You do not have permission to access this path 您无权访问该路径 - + Export successful 导出成功 - + Export failed 导出失败 @@ -1392,187 +1394,187 @@ will format it and remove its password. FormateDialog - + Wipe %1 将对%1进行擦除 - + It will erase all data on this disk, which will not be recovered 擦除分区将会删除存储在此磁盘上的所有数据,该操作无法撤销,请谨慎操作 - + Name: 分区名称: - + Name 分区名称 - + File system: 分区格式: - + AES Encryption AES加密 - + SM4 Encryption SM4加密 - + Security: 安全选择: - - + + Fast 快速 - - + + Secure 安全 - + Advanced 高级 - - + + It only deletes the partition info without erasing the files on the disk. Disk recovery tools may recover the files at a certain probability. 此选项仅删除磁盘分区信息,不会抹除磁盘上的文件。磁盘恢复程序有一定概率能够恢复这些文件。 - + Wiping method: 覆写次数: - + DoD 5220.22-M, 7 passes 符合DoD 5220.22-M标准,覆写7次 - + Gutmann, 35 passes 符合Gutmann标准,覆写35次 - + Cancel button 取 消 - + Wipe button 擦 除 - + Failed to find the disk 获取磁盘设备失败 - + The action cannot be undone, please proceed with caution 该操作无法撤销,请谨慎操作 - + LV name: 逻辑卷名称: - + LV name 逻辑卷名称 - + LV file system: 逻辑卷格式: - - + + You may be able to recover files after the wipe. 若选择此选项,文件有一定概率会被恢复。 - + Failed to submit the request to the kernel 提交内核失败 - - - - + + + + The length exceeds the limit 字符长度超过范围 - + Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. 使用aes-xts-plain64标准算法加密,卸载后需要解锁才能挂载。 - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. 使用sm4-xts-plain国密算法加密,卸载后需要解锁才能挂载。不支持国密算法的系统将无法解锁。 - + It is a one-time secure wipe that complies with NIST 800-88 and writes 0, 1, and random data to the entire disk once. You will not be able to recover files, and the process will be slow. 此选项是符合 NIST 800-88 的1次安全擦除。它会在整个磁盘中写入0、1和随机数据一次。擦除后将无法恢复磁盘上的文件,且处理过程较慢。 - + It writes 0, 1, and random data to the entire disk several times. You can set the number of times to erase disks and overwrite data, but the process will be very slow. 此选项会多次将0、1和随机数据写到整个磁盘。您可以定义擦除磁盘并改写数据的次数,处理过程会非常缓慢。 - + You will not be able to recover files after the wipe, and the process will be slow. 若选择此选项,文件将无法被恢复,且处理过程较慢。 - + To avoid losing the password, please back up your password and keep it properly! 为防止遗忘密码,请您自行备份密码,并妥善保存! - + OK button 确 定 - + Wiping %1 正在对%1进行擦除 - + "%1" wiped 擦除%1成功 - + Failed to wipe %1 对%1进行擦除失败 @@ -1700,7 +1702,7 @@ will format it and remove its password. MainWindow - + Refresh 刷新 @@ -1868,7 +1870,7 @@ will format it and remove its password. - + Disk: 磁盘: @@ -1876,7 +1878,7 @@ will format it and remove its password. - + File system: 分区格式: @@ -2075,12 +2077,12 @@ will format it and remove its password. QObject - + Disk Utility 磁盘管理器 - + Disk Utility is a disk management tool for creating, reorganizing and formatting partitions. 磁盘管理器可帮助用户进行磁盘分区、空间调整、格式化等操作。 @@ -2253,16 +2255,16 @@ will format it and remove its password. SizeInfoWidget - - - Capacity: - 总容量: + + + Available: + 可用空间: - - - - + + + + Used: 已用空间: @@ -2298,7 +2300,7 @@ will format it and remove its password. - + Create volume group 创建逻辑卷组 @@ -2319,82 +2321,82 @@ will format it and remove its password. - + Create logical volume 创建逻辑卷 - + Cannot recognize its partition table 无法识别当前设备分区表 - + Unable to mount the device: no file system is found, or the file system is not supported 该设备没有文件系统,或文件系统不被支持,无法挂载 - - - - - - - - + + + + + + + + OK 确 定 - - + + The file system does not support space adjustment 该文件系统不支持调整空间 - + The disks will be formatted if you create a logical volume 创建逻辑卷将格式化磁盘 - - - + + + Unmount %1 first 请先手动卸载%1 - - + + Data cannot be recovered if deleted, please confirm before proceeding 删除后数据将无法恢复,请确认 - - + + Delete 删除 - - + + Cancel 取 消 - + To ensure the normal use of system backup and restore, rootA and rootB should be resized to the same value 为保证正常使用备份还原功能, rootA跟rootB需同步扩容,确保空间一样大 - + The disks will be formatted if you create a volume group 创建逻辑卷组将格式化磁盘 - + Unmount all logical volumes in %1 first 请先手动卸载%1下所有的逻辑卷 @@ -2461,4 +2463,4 @@ rootA跟rootB需同步扩容,确保空间一样大 未分配 - \ No newline at end of file + diff --git a/application/translations/deepin-diskmanager_zh_HK.ts b/application/translations/deepin-diskmanager_zh_HK.ts index 4a9a0339..3dfe4c7a 100644 --- a/application/translations/deepin-diskmanager_zh_HK.ts +++ b/application/translations/deepin-diskmanager_zh_HK.ts @@ -1,4 +1,6 @@ - + + + CreateLVWidget @@ -391,131 +393,131 @@ will format it and remove its password. 正在初始化數據... - - - + + + Mounting %1 ... 正在對%1進行掛載... - - - + + + Unmounting %1 ... 正在對%1進行卸載... - + Resizing %1 ... 正在對%1進行空間調整... - + Creating a new partition... 正在新建分區... - + Deleting %1 ... 正在對%1進行刪除... - + Creating a partition table of %1 ... 正在對%1進行分區表創建... - + Replacing the partition table of %1 ... 正在對%1進行分區表替換... - + Creating... 正在創建,請稍候... - - + + Deleting... 正在刪除,請稍候... - + Resizing space... 正在調整空間,請稍候... - - + + AES Encryption AES加密 - - + + SM4 Encryption SM4加密 - + Failed to encrypt %1, please try again! %1加密失敗,請重試! - + Failed to decrypt %1, please try again! %1解鎖失敗,請重試! - + %1 failed to close the crypto map %1關閉加密映射失敗 - + Failed to create partitions, please try again! 創建分區失敗,請重試! - - + + Failed to create %1 file system, please try again! %1文件系統創建失敗,請重試! - + Failed to submit the request to the kernel 提交內核失敗 - - + + DBUS parameter error DBUS參數錯誤 - + Failed to mount %1 %1掛載失敗 - + %1 failed to create mounting folders %1創建掛載文件夾失敗 - + %1 failed to change the owner of mounting folders %1更改掛載文件夾屬主失敗 - + Creating partition table failed 新建分區表失敗 - + Failed to create a logical volume, please try again! 邏輯卷創建失敗,請重試! @@ -623,50 +625,50 @@ will format it and remove its password. 新建分區表 - + Delete partition 刪除分區 - + Delete volume group 刪除邏輯卷組 - - + + Create logical volume 創建邏輯卷 - + Delete logical volume 刪除邏輯卷 - + Close 關閉 - + Health checking does not support this type of device. 該類型設備暫不支持健康檢測 - + Please unmount all partitions in the disk first 請先卸載當前磁盤中的所有分區 - - - + + + OK 確定 - + All partitions in this disk will be merged and all data will be lost if creating a new partition table, please take it carefully @@ -674,206 +676,206 @@ will format it and remove its password. 丟失所有數據,請謹慎使用 - + Proceed 繼續 - - - - - - + + + + + + Cancel 取消 - + No errors found in the partition table 分區表檢測正常 - + Do you want to hide this partition? 您是否要隱藏該分區? - + Hide 隱藏 - + Failed to hide the partition: unable to lock it 隱藏分區失敗!無法鎖定該分區 - + You can only hide the unmounted partition 只有處於卸載狀態的分區才能被隱藏 - + Do you want to unhide this partition? 只有處於卸載狀態的分區才能被隱藏 - + Unhide 顯示 - + Are you sure you want to delete this partition? 您確定要刪除該分區嗎? - + You will lose all data in it 該分區內所有文件將會丟失 - - - + + + Delete 刪除 - + Failed to delete the partition: unable to lock it 刪除分區失敗!無法鎖定該分區 - + Hide the partition successfully 隱藏分區成功 - + Failed to hide the partition 隱藏分區失敗 - + Unhide the partition successfully 顯示分區成功 - + Failed to unhide the partition 刪除分區成功 - + Delete the partition successfully 刪除分區成功 - + Failed to find the disk 獲取磁盤設備失敗 - + Failed to get the partition info 獲取分區訊息失敗 - + Failed to delete the partition 刪除操作失敗 - + Failed to submit the request to the kernel 提交內核失敗 - + Failed to delete the partition: %1 刪除分區失敗,%1 - + Unmounting successful 卸載成功 - + Unmounting failed 卸載失敗 - + Creating partition table successful 新建分區表成功 - + Replacing partition table successful 替換分區表成功 - + Creating partition table failed 新建分區表失敗 - + Replacing partition table failed 替換分區表失敗 - + Unmount all logical volumes in %1 first 請先手動卸載%1下所有的邏輯卷 - - + + Data cannot be recovered if deleted, please confirm before proceeding 刪除後數據將無法恢復,請確認 - + The disks will be formatted if you create a logical volume 創建邏輯卷將格式化磁盤 - + Unmount %1 first 請先手動卸載%1 - + The logical volume group is busy and cannot be deleted. Please retry after reboot. 邏輯卷組被佔用,無法刪除。請重啟電腦後重試。 - - + + The logical volume is busy and cannot be deleted. Please retry after reboot. 邏輯卷被佔用,無法刪除。請重啟電腦後重試。 - + Failed to delete the logical volume group 刪除邏輯卷組失敗 - + Failed to delete the logical volume 刪除邏輯卷失敗 - + Volume Groups 邏輯卷組 - + Disks 所有設備 @@ -881,245 +883,245 @@ will format it and remove its password. DiskBadSectorsDialog - + Verify or repair bad sectors 壞道檢測與修復 - - - + + + Verify: 檢測範圍: - + Cylinders 柱面範圍 - + Sectors 扇區範圍 - + MB 容量範圍 - - - + + + Method: 檢測方式: - + Rounds 檢測次數 - + Timeout 超時時間 - + ms 毫秒 - + Result: 檢測結果: - + Excellent 優秀 - + Damaged 損壞 - + Unknown 未知 - + Exit button 退 出 - + Reset button 復 位 - + Repair 嘗試修復 - + Start Verify 開始檢測 - + Stop button 停 止 - + Continue button 繼 續 - + Verify Again 重新檢測 - + Done button 完 成 - - - - - - - + + + + + + + Time elapsed: 已用時間: - - - - - - - - - - + + + + + + + + + + Time left: 剩餘時間: - + Verifying cylinder: %1 正在檢測%1柱面 - + Verify completed 檢測完成 - + Disk verify completed. %1 bad blocks found. 磁盤檢測完畢,共檢查到%1個壞道區域 - - + + OK 確定 - + The verifying disk contains mounted partitions, so you cannot repair it. 當前檢測磁盤存在已掛載分區,無法修復壞道 - + Please unmount partitions and then repair the disk. 若要修復請先卸載分區 - + Warning 警告 - + Bad sector repairing cannot recover files, 修復壞磁道不是數據恢復的手段, - + but destroys data on and near bad sectors instead. 修復壞磁道會破壞壞磁道及其附近磁道上的文件數據。 - + Please back up all data before repair. 請先做好數據備份。 - - - + + + Cancel 取消 - + Start Repair 開始修復 - + Repairing cylinder: %1 正在修復%1柱面 - + Repair completed. Cylinder: %1 repaired. 修復完成,已修復%1柱面 - + Disk repair completed. %1 bad blocks repaired. 磁盤修復完畢,共修復%1個壞道區域 - + Verifying for bad sectors, exit now? 正在檢測中,是否退出窗口? - + The verified information will not be reserved 當前檢測訊息不會保留 - - + + Exit 退出 - + Repairing bad sectors, exit now? 正在修復中,是否退出窗口? - + The repairing information will not be reserved 當前修覆訊息不會保留 @@ -1132,122 +1134,122 @@ will format it and remove its password. 硬盤健康檢測 - + Serial number 序列號 - + Storage 用戶容量 - + Health Status 健康狀態 - + Good 良好 - + Damaged 損壞 - + Unknown 未知 - + Temperature 溫度 - - + + ID ID - - + + Status 狀態 - - + + Current 當前值 - - + + Worst 歷史最差值 - - + + Threshold 臨界值 - - + + Raw Value 原始數據 - - + + Attribute name 屬性名稱 - + Status: (G: Good | W: Warning | D: Damaged | U: Unknown) 狀態:(G: 良好 | W: 警告 | D: 損壞 | U: 未知) - - - + + + Export button 導 出 - + Save File 保存文件 - + Text files (*.txt) 文本文件 (*.txt) - + Wrong path 路徑錯誤 - + You do not have permission to access this path 您無權訪問該路徑 - + Export successful 導出成功 - + Export failed 導出失敗 @@ -1392,187 +1394,187 @@ will format it and remove its password. FormateDialog - + Wipe %1 將對%1進行擦除 - + It will erase all data on this disk, which will not be recovered 擦除分區將會刪除存儲在此磁盤上的所有數據,該操作無法撤銷,請謹慎操作 - + Name: 分區名稱: - + Name 分區名稱 - + File system: 分區格式: - + AES Encryption AES加密 - + SM4 Encryption SM4加密 - + Security: 安全選擇: - - + + Fast 快速 - - + + Secure 安全 - + Advanced 高級 - - + + It only deletes the partition info without erasing the files on the disk. Disk recovery tools may recover the files at a certain probability. 此選項僅刪除磁盤分區訊息,不會抹除磁盤上的文件。磁盤恢復程序有一定概率能夠恢復這些文件。 - + Wiping method: 覆寫次數: - + DoD 5220.22-M, 7 passes 符合DoD 5220.22-M標準,覆寫7次 - + Gutmann, 35 passes 符合Gutmann標準,覆寫35次 - + Cancel button 取 消 - + Wipe button 擦 除 - + Failed to find the disk 獲取磁盤設備失敗 - + The action cannot be undone, please proceed with caution 該操作無法撤銷,請謹慎操作 - + LV name: 邏輯卷名稱: - + LV name 邏輯卷名稱 - + LV file system: 邏輯卷格式: - - + + You may be able to recover files after the wipe. 若選擇此選項,文件有一定概率會被恢復。 - + Failed to submit the request to the kernel 提交內核失敗 - - - - + + + + The length exceeds the limit 字符長度超過範圍 - + Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. 使用aes-xts-plain64標準算法加密,卸載後需要解鎖才能掛載。 - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. 使用sm4-xts-plain國密算法加密,卸載後需要解鎖才能掛載。不支持國密算法的系統將無法解鎖。 - + It is a one-time secure wipe that complies with NIST 800-88 and writes 0, 1, and random data to the entire disk once. You will not be able to recover files, and the process will be slow. 此選項是符合 NIST 800-88 的1次安全擦除。它會在整個磁盤中寫入0、1和隨機數據一次。擦除後將無法恢復磁盤上的文件,且處理過程較慢。 - + It writes 0, 1, and random data to the entire disk several times. You can set the number of times to erase disks and overwrite data, but the process will be very slow. 此選項會多次將0、1和隨機數據寫到整個磁盤。您可以定義擦除磁盤並改寫數據的次數,處理過程會非常緩慢。 - + You will not be able to recover files after the wipe, and the process will be slow. 若選擇此選項,文件將無法被恢復,且處理過程較慢。 - + To avoid losing the password, please back up your password and keep it properly! 為防止遺忘密碼,請您自行備份密碼,並妥善保存! - + OK button 確 定 - + Wiping %1 正在對%1進行擦除 - + "%1" wiped 擦除%1成功 - + Failed to wipe %1 對%1進行擦除失敗 @@ -1700,7 +1702,7 @@ will format it and remove its password. MainWindow - + Refresh 刷新 @@ -1868,7 +1870,7 @@ will format it and remove its password. - + Disk: 磁盤: @@ -1876,7 +1878,7 @@ will format it and remove its password. - + File system: 分區格式: @@ -2075,12 +2077,12 @@ will format it and remove its password. QObject - + Disk Utility 磁盤管理器 - + Disk Utility is a disk management tool for creating, reorganizing and formatting partitions. 磁盤管理器可幫助用戶進行磁盤分區、空間調整、格式化等操作。 @@ -2253,16 +2255,16 @@ will format it and remove its password. SizeInfoWidget - - - Capacity: - 總容量: + + + Available: + 可用空間: - - - - + + + + Used: 已用空間: @@ -2298,7 +2300,7 @@ will format it and remove its password. - + Create volume group 創建邏輯卷組 @@ -2319,82 +2321,82 @@ will format it and remove its password. - + Create logical volume 創建邏輯卷 - + Cannot recognize its partition table 無法識別當前設備分區表 - + Unable to mount the device: no file system is found, or the file system is not supported 該設備沒有文件系統,或文件系統不被支持,無法掛載 - - - - - - - - + + + + + + + + OK 確 定 - - + + The file system does not support space adjustment 該文件系統不支持調整空間 - + The disks will be formatted if you create a logical volume 創建邏輯卷將格式化磁盤 - - - + + + Unmount %1 first 請先手動卸載%1 - - + + Data cannot be recovered if deleted, please confirm before proceeding 刪除後數據將無法恢復,請確認 - - + + Delete 刪除 - - + + Cancel 取 消 - + To ensure the normal use of system backup and restore, rootA and rootB should be resized to the same value 為保證正常使用備份還原功能, rootA跟rootB需同步擴容,確保空間一樣大 - + The disks will be formatted if you create a volume group 創建邏輯卷組將格式化磁盤 - + Unmount all logical volumes in %1 first 請先手動卸載%1下所有的邏輯卷 @@ -2461,4 +2463,4 @@ rootA跟rootB需同步擴容,確保空間一樣大 未分配 - \ No newline at end of file + diff --git a/application/translations/deepin-diskmanager_zh_TW.ts b/application/translations/deepin-diskmanager_zh_TW.ts index ef0d0f7f..f68a1b87 100644 --- a/application/translations/deepin-diskmanager_zh_TW.ts +++ b/application/translations/deepin-diskmanager_zh_TW.ts @@ -1,4 +1,6 @@ - + + + CreateLVWidget @@ -391,131 +393,131 @@ will format it and remove its password. 正在初始化資料... - - - + + + Mounting %1 ... 正在對%1進行掛載... - - - + + + Unmounting %1 ... 正在對%1進行移除... - + Resizing %1 ... 正在對%1進行空間調整... - + Creating a new partition... 正在建立分區... - + Deleting %1 ... 正在對%1進行刪除... - + Creating a partition table of %1 ... 正在對%1進行分區表建立... - + Replacing the partition table of %1 ... 正在對%1進行分區表取代... - + Creating... 正在建立,請稍候... - - + + Deleting... 正在刪除,請稍候... - + Resizing space... 正在調整空間,請稍候... - - + + AES Encryption AES加密 - - + + SM4 Encryption SM4加密 - + Failed to encrypt %1, please try again! %1加密失敗,請重試! - + Failed to decrypt %1, please try again! %1解鎖失敗,請重試! - + %1 failed to close the crypto map %1關閉加密映射失敗 - + Failed to create partitions, please try again! 建立分區失敗,請重試! - - + + Failed to create %1 file system, please try again! %1文件系統建立失敗,請重試! - + Failed to submit the request to the kernel 提交核心失敗 - - + + DBUS parameter error DBUS參數錯誤 - + Failed to mount %1 %1掛載失敗 - + %1 failed to create mounting folders %1建立掛載資料夾失敗 - + %1 failed to change the owner of mounting folders %1更改掛載資料夾所有者失敗 - + Creating partition table failed 建立分區表失敗 - + Failed to create a logical volume, please try again! 邏輯卷建立失敗,請重試! @@ -623,50 +625,50 @@ will format it and remove its password. 建立分區表 - + Delete partition 刪除分區 - + Delete volume group 刪除邏輯卷組 - - + + Create logical volume 建立邏輯卷 - + Delete logical volume 刪除邏輯卷 - + Close 關閉 - + Health checking does not support this type of device. 該類型裝置暫不支援健康檢測 - + Please unmount all partitions in the disk first 請先移除目前磁碟中的所有分區 - - - + + + OK 確定 - + All partitions in this disk will be merged and all data will be lost if creating a new partition table, please take it carefully @@ -674,206 +676,206 @@ will format it and remove its password. 遺失所有資料,請謹慎使用 - + Proceed 繼續 - - - - - - + + + + + + Cancel 取消 - + No errors found in the partition table 分區表檢測正常 - + Do you want to hide this partition? 您是否要隱藏該分區? - + Hide 隱藏 - + Failed to hide the partition: unable to lock it 隱藏分區失敗,無法鎖定該分區 - + You can only hide the unmounted partition 只有處於移除狀態的分區才能被隱藏 - + Do you want to unhide this partition? 您是否要顯示該隱藏分區? - + Unhide 顯示 - + Are you sure you want to delete this partition? 您確定要刪除該分區嗎? - + You will lose all data in it 該分區內所有文件將會遺失 - - - + + + Delete 刪除 - + Failed to delete the partition: unable to lock it 刪除分區失敗!無法鎖定該分區 - + Hide the partition successfully 隱藏分區成功 - + Failed to hide the partition 隱藏分區失敗 - + Unhide the partition successfully 顯示分區成功 - + Failed to unhide the partition 顯示分區失敗 - + Delete the partition successfully 刪除分區成功 - + Failed to find the disk 獲取磁碟裝置失敗 - + Failed to get the partition info 獲取分區訊息失敗 - + Failed to delete the partition 刪除操作失敗 - + Failed to submit the request to the kernel 提交核心失敗 - + Failed to delete the partition: %1 刪除分區失敗,%1 - + Unmounting successful 移除成功 - + Unmounting failed 移除失敗 - + Creating partition table successful 建立分區表成功 - + Replacing partition table successful 取代分區表成功 - + Creating partition table failed 建立分區表失敗 - + Replacing partition table failed 取代分區表失敗 - + Unmount all logical volumes in %1 first 請先手動卸載%1下所有的邏輯卷 - - + + Data cannot be recovered if deleted, please confirm before proceeding 刪除後資料將無法復原,請確認 - + The disks will be formatted if you create a logical volume 建立邏輯卷將格式化磁碟 - + Unmount %1 first 請先手動移除%1 - + The logical volume group is busy and cannot be deleted. Please retry after reboot. 邏輯卷組被占用,無法刪除。請重啟電腦後重試。 - - + + The logical volume is busy and cannot be deleted. Please retry after reboot. 邏輯卷被占用,無法刪除。請重啟電腦後重試。 - + Failed to delete the logical volume group 刪除邏輯卷組失敗 - + Failed to delete the logical volume 刪除邏輯卷失敗 - + Volume Groups 邏輯卷組 - + Disks 所有裝置 @@ -881,245 +883,245 @@ will format it and remove its password. DiskBadSectorsDialog - + Verify or repair bad sectors 壞道檢測與修復 - - - + + + Verify: 檢測範圍: - + Cylinders 柱面範圍 - + Sectors 扇區範圍 - + MB 容量範圍 - - - + + + Method: 檢測方式: - + Rounds 檢測次數 - + Timeout 超時時間 - + ms 毫秒 - + Result: 檢測結果: - + Excellent 優秀 - + Damaged 損壞 - + Unknown 未知 - + Exit button 退 出 - + Reset button 復 位 - + Repair 嘗試修復 - + Start Verify 開始檢測 - + Stop button 停 止 - + Continue button 繼 續 - + Verify Again 重新檢測 - + Done button 完 成 - - - - - - - + + + + + + + Time elapsed: 已用時間: - - - - - - - - - - + + + + + + + + + + Time left: 剩餘時間: - + Verifying cylinder: %1 正在檢測%1柱面 - + Verify completed 檢測完成 - + Disk verify completed. %1 bad blocks found. 磁碟檢測完畢,共檢查到%1個壞道區域 - - + + OK 確定 - + The verifying disk contains mounted partitions, so you cannot repair it. 目前檢測磁碟存在已掛載分區,無法修復壞軌 - + Please unmount partitions and then repair the disk. 若要修復請先移除分區 - + Warning 警告 - + Bad sector repairing cannot recover files, 修復壞磁軌不是數據恢復的手段, - + but destroys data on and near bad sectors instead. 修復壞磁軌會破壞壞磁軌及其附近磁軌上的文件數據。 - + Please back up all data before repair. 請先做好數據備份。 - - - + + + Cancel 取消 - + Start Repair 開始修復 - + Repairing cylinder: %1 正在修復%1柱面 - + Repair completed. Cylinder: %1 repaired. 修復完成,已修復%1柱面 - + Disk repair completed. %1 bad blocks repaired. 磁碟修復完畢,共修復%1個壞道區域 - + Verifying for bad sectors, exit now? 正在檢測中,是否退出窗口? - + The verified information will not be reserved 當前檢測信息不會保留 - - + + Exit 退出 - + Repairing bad sectors, exit now? 正在修復中,是否退出窗口? - + The repairing information will not be reserved 當前修覆信息不會保留 @@ -1132,122 +1134,122 @@ will format it and remove its password. 硬碟健康檢測 - + Serial number 序號 - + Storage 使用者容量 - + Health Status 健康狀態 - + Good 良好 - + Damaged 損壞 - + Unknown 未知 - + Temperature 溫度 - - + + ID ID - - + + Status 狀態 - - + + Current 目前值 - - + + Worst 歷史最差值 - - + + Threshold 臨界值 - - + + Raw Value 原始資料 - - + + Attribute name 屬性名稱 - + Status: (G: Good | W: Warning | D: Damaged | U: Unknown) 狀態:(G: 良好 | W: 警告 | D: 損壞 | U: 未知) - - - + + + Export button 匯 出 - + Save File 儲存文件 - + Text files (*.txt) 文字文件 (*.txt) - + Wrong path 路徑錯誤 - + You do not have permission to access this path 您無權訪問該路徑 - + Export successful 匯出成功 - + Export failed 匯出失敗 @@ -1392,187 +1394,187 @@ will format it and remove its password. FormateDialog - + Wipe %1 將對%1進行擦除 - + It will erase all data on this disk, which will not be recovered 擦除分區將會刪除儲存在此磁碟上的所有資料,該操作無法復原,請謹慎操作 - + Name: 分區名稱: - + Name 分區名稱 - + File system: 分區格式: - + AES Encryption AES加密 - + SM4 Encryption SM4加密 - + Security: 安全選擇: - - + + Fast 快速 - - + + Secure 安全 - + Advanced 進階 - - + + It only deletes the partition info without erasing the files on the disk. Disk recovery tools may recover the files at a certain probability. 此選項僅刪除磁碟分區訊息,不會抹除磁碟上的文件。磁碟復原程式有一定機率能夠復原這些文件。 - + Wiping method: 覆寫次數: - + DoD 5220.22-M, 7 passes 符合DoD 5220.22-M標準,覆寫7次 - + Gutmann, 35 passes 符合Gutmann標準,覆寫35次 - + Cancel button 取 消 - + Wipe button 擦 除 - + Failed to find the disk 獲取磁碟裝置失敗 - + The action cannot be undone, please proceed with caution 該操作無法復原,請謹慎操作 - + LV name: 邏輯卷名稱: - + LV name 邏輯卷名稱 - + LV file system: 邏輯卷格式: - - + + You may be able to recover files after the wipe. 若選擇此選項,文件有一定機率會被復原。 - + Failed to submit the request to the kernel 提交核心失敗 - - - - + + + + The length exceeds the limit 字元長度超過範圍 - + Use the aes-xts-plain64 standard algorithm to encrypt the disk. You should decrypt it before mounting it again. 使用aes-xts-plain64標準演算法加密,移除後需要解鎖才能掛載。 - + Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. You should decrypt it before mounting it again. Operating Systems that do not support the state cryptographic algorithm will not be able to decrypt the disk. 使用sm4-xts-plain國密演算法加密,移除後需要解鎖才能掛載。不支援國密演算法的系統將無法解鎖。 - + It is a one-time secure wipe that complies with NIST 800-88 and writes 0, 1, and random data to the entire disk once. You will not be able to recover files, and the process will be slow. 此選項是符合 NIST 800-88 的1次安全擦除。它會在整個磁碟中寫入0、1和隨機資料一次。擦除後將無法復原磁碟上的文件,且處理過程較慢。 - + It writes 0, 1, and random data to the entire disk several times. You can set the number of times to erase disks and overwrite data, but the process will be very slow. 此選項會多次將0、1和隨機資料寫到整個磁碟。您可以定義擦除磁碟並改寫資料的次數,處理過程會非常緩慢。 - + You will not be able to recover files after the wipe, and the process will be slow. 若選擇此選項,文件將無法被復原,且處理過程較慢。 - + To avoid losing the password, please back up your password and keep it properly! 為防止遺忘密碼,請您自行備份密碼,並妥善儲存! - + OK button 確 定 - + Wiping %1 正在對%1進行擦除 - + "%1" wiped 擦除%1成功 - + Failed to wipe %1 對%1進行擦除失敗 @@ -1700,7 +1702,7 @@ will format it and remove its password. MainWindow - + Refresh 刷新 @@ -1868,7 +1870,7 @@ will format it and remove its password. - + Disk: 磁碟: @@ -1876,7 +1878,7 @@ will format it and remove its password. - + File system: 分區格式: @@ -2075,12 +2077,12 @@ will format it and remove its password. QObject - + Disk Utility 磁碟管理器 - + Disk Utility is a disk management tool for creating, reorganizing and formatting partitions. 磁碟管理器可幫助使用者進行磁碟分區、空間調整、格式化等操作。 @@ -2253,16 +2255,16 @@ will format it and remove its password. SizeInfoWidget - - - Capacity: - 總容量: + + + Available: + 可用空間: - - - - + + + + Used: 已用空間: @@ -2298,7 +2300,7 @@ will format it and remove its password. - + Create volume group 建立邏輯卷組 @@ -2319,82 +2321,82 @@ will format it and remove its password. - + Create logical volume 建立邏輯卷 - + Cannot recognize its partition table 無法識別當前設備分區表 - + Unable to mount the device: no file system is found, or the file system is not supported 該裝置沒有文件系統,或文件系統不被支援,無法掛載 - - - - - - - - + + + + + + + + OK 確 定 - - + + The file system does not support space adjustment 該文件系統不支持調整空間 - + The disks will be formatted if you create a logical volume 建立邏輯卷將格式化磁碟 - - - + + + Unmount %1 first 請先手動移除%1 - - + + Data cannot be recovered if deleted, please confirm before proceeding 刪除後資料將無法復原,請確認 - - + + Delete 刪除 - - + + Cancel 取 消 - + To ensure the normal use of system backup and restore, rootA and rootB should be resized to the same value 為保證正常使用備份還原功能, rootA跟rootB需同步擴容,確保空間一樣大 - + The disks will be formatted if you create a volume group 建立邏輯卷組將格式化磁碟 - + Unmount all logical volumes in %1 first 請先手動卸載%1下所有的邏輯卷 @@ -2461,4 +2463,4 @@ rootA跟rootB需同步擴容,確保空間一樣大 未分配 - \ No newline at end of file + diff --git a/application/widgets/customcontrol/partchartshowing.cpp b/application/widgets/customcontrol/partchartshowing.cpp index cde7a6e8..8e0700b2 100644 --- a/application/widgets/customcontrol/partchartshowing.cpp +++ b/application/widgets/customcontrol/partchartshowing.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -237,7 +237,7 @@ void PartChartShowing::addPaint(QPainter *painter) } m_flag = 0; } - } else if (m_sumValue >= 100) { //绘制最后一个分区当超过整个分区容量的时候以及选中状态 + } else { //绘制最后一个分区当超过整个分区容量的时候以及选中状态 // qDebug() << "sumvalue" << sumvalue; double width = ((m_partSize.at(m_partSize.size() - 2) / m_total)) * (paintRect.width() - RADIUS) - RIGHTSPACE; if (m_partSize.at(m_partSize.size() - 2) / m_total < 0.01) { diff --git a/application/widgets/customcontrol/partitionwidget.cpp b/application/widgets/customcontrol/partitionwidget.cpp index 8e5eee04..4f24de9f 100644 --- a/application/widgets/customcontrol/partitionwidget.cpp +++ b/application/widgets/customcontrol/partitionwidget.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -778,7 +778,7 @@ void PartitionWidget::onSetSliderValue() m_block = 1; m_slider->setValue(static_cast((value / (m_total - (sumValue() / 1024))) * 100)); m_currentEditSize = QString::number(value * 1024, 'f', 4); - if (value == 0.00 || value > (m_total - sumValue() / 1024)) { + if (value == 0.00 || value > (m_total - sumValue() / 1024) + 0.01) { m_addButton->setEnabled(false); } else { m_addButton->setEnabled(true); diff --git a/application/widgets/customcontrol/sizeinfowidget.cpp b/application/widgets/customcontrol/sizeinfowidget.cpp index 1c1e22af..6bcceeac 100644 --- a/application/widgets/customcontrol/sizeinfowidget.cpp +++ b/application/widgets/customcontrol/sizeinfowidget.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -38,11 +38,13 @@ void SizeInfoWidget::setData(PartitionInfo info, QVector color, QVector< m_used = Utils::sectorToUnit(info.m_sectorsUsed, info.m_sectorSize, SIZE_UNIT::UNIT_GIB); m_totalSpaceSize = Utils::formatSize(info.m_sectorEnd - info.m_sectorStart + 1, info.m_sectorSize); m_usedSize = Utils::formatSize(info.m_sectorsUsed, info.m_sectorSize); + m_availableSize = Utils::formatSize(info.m_sectorsUnused, info.m_sectorSize); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); if (luksInfo.isDecrypt) { m_usedSize = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUsed); + m_availableSize = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUnused); m_noused = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUnused, SIZE_UNIT::UNIT_GIB); m_used = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUsed, SIZE_UNIT::UNIT_GIB); } @@ -75,15 +77,18 @@ void SizeInfoWidget::setData(LVInfo info, QVector color, QVector m_used = Utils::LVMSizeToUnit(info.m_fsUsed, SIZE_UNIT::UNIT_GIB); m_noused = Utils::LVMSizeToUnit(info.m_fsUnused, SIZE_UNIT::UNIT_GIB); m_usedSize = Utils::LVMFormatSize(info.m_fsUsed); + m_availableSize = Utils::LVMFormatSize(info.m_fsUnused); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_lvPath); if (luksInfo.isDecrypt) { m_usedSize = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUsed); + m_availableSize = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUnused); m_noused = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUnused, SIZE_UNIT::UNIT_GIB); m_used = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUsed, SIZE_UNIT::UNIT_GIB); } else { m_usedSize = "-"; + m_availableSize = "-"; } } @@ -116,11 +121,13 @@ void SizeInfoWidget::setData(DeviceInfo info, QVector color, QVectorprobLUKSInfo().m_luksMap.value(info.m_path); if (luksInfo.isDecrypt) { m_usedSize = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUsed); + m_availableSize = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUnused); m_noused = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUnused, SIZE_UNIT::UNIT_GIB); m_used = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUsed, SIZE_UNIT::UNIT_GIB); } @@ -230,6 +237,8 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) //绘制首页下方标注 if (m_flag) { DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType(); + if (m_availableSize.contains("-")) + m_availableSize = "-"; if (themeType == DGuiApplicationHelper::LightType) { int height = 90 - static_cast((QApplication::font().pointSizeF() / 0.75 - 14) * 1); QRect roundRect = QRect(rect.bottomLeft().x() + 2, rect.bottomLeft().y() - height, 15, 15); @@ -254,7 +263,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) option.setAlignment(Qt::AlignTop); QFontMetrics fmCapacity = painter.fontMetrics(); - QString textCapacity = QString(m_partitionPath + tr(" Capacity:") + " "); + QString textCapacity = tr("Available:"); int capacityWidth = fmCapacity.width(textCapacity); if (capacityWidth > rect.width() / 2) { capacityWidth = rect.width() / 2; @@ -263,7 +272,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) } QRect rectText = QRect(paintRect.bottomLeft().x() + 28, paintRect.bottomLeft().y() + 17, capacityWidth, 70); painter.drawText(rectText, textCapacity, option); - // 获取总容量字符串显示的宽度 + // 获取可用空间字符串显示的宽度 int capacityNum = rectText.x() + capacityWidth; font = DFontSizeManager::instance()->get(DFontSizeManager::T8); @@ -272,7 +281,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) painter.setPen(text1Color); QTextOption option1; option.setAlignment(Qt::AlignLeft); - QRect rectSizeNum = QRect(paintRect.bottomLeft().x() + capacityNum, paintRect.bottomLeft().y() + 20, painter.fontMetrics().width(m_totalSpaceSize) + 20, 30); + QRect rectSizeNum = QRect(paintRect.bottomLeft().x() + capacityNum, paintRect.bottomLeft().y() + 20, painter.fontMetrics().width(m_availableSize) + 20, 30); int height2 = 21 + static_cast((QApplication::font().pointSizeF() / 0.75 - 14) * 1); int width = roundRect.x() + capacityNum + rectSizeNum.width() + 30; @@ -307,7 +316,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) painter.setFont(font); painter.setPen(text1Color); option.setAlignment(Qt::AlignLeft); - painter.drawText(rectSizeNum, m_totalSpaceSize, option1); + painter.drawText(rectSizeNum, m_availableSize, option1); rectSizeNum.moveTo(paintRect.bottomLeft().x() + usedNum, paintRect.bottomLeft().y() + 20); if (m_usedSize.contains("-")) { @@ -338,7 +347,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) option.setAlignment(Qt::AlignTop); QFontMetrics fmCapacity = painter.fontMetrics(); - QString textCapacity = QString(m_partitionPath + tr(" Capacity:") + " "); + QString textCapacity = tr("Available:"); int capacityWidth = fmCapacity.width(textCapacity); if (capacityWidth > rect.width() / 2) { capacityWidth = rect.width() / 2; @@ -347,7 +356,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) } QRect rectText = QRect(paintRect.bottomLeft().x() + 28, paintRect.bottomLeft().y() + 17, capacityWidth, 70); painter.drawText(rectText, textCapacity, option); - // 获取总容量字符串显示的宽度 + // 获取可用空间字符串显示的宽度 int capacityNum = rectText.x() + capacityWidth; font = DFontSizeManager::instance()->get(DFontSizeManager::T8); @@ -356,7 +365,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) painter.setPen(text1Color); QTextOption option1; option.setAlignment(Qt::AlignLeft); - QRect rectSizeNum = QRect(paintRect.bottomLeft().x() + capacityNum, paintRect.bottomLeft().y() + 20, painter.fontMetrics().width(m_totalSpaceSize) + 20, 30); + QRect rectSizeNum = QRect(paintRect.bottomLeft().x() + capacityNum, paintRect.bottomLeft().y() + 20, painter.fontMetrics().width(m_availableSize) + 20, 30); int height2 = 21 + static_cast((QApplication::font().pointSizeF() / 0.75 - 14) * 1); int width = roundRect.x() + capacityNum + rectSizeNum.width() + 30; @@ -390,7 +399,7 @@ void SizeInfoWidget::paintEvent(QPaintEvent *event) painter.setFont(font); painter.setPen(text1Color); option.setAlignment(Qt::AlignLeft); - painter.drawText(rectSizeNum, m_totalSpaceSize, option1); + painter.drawText(rectSizeNum, m_availableSize, option1); rectSizeNum.moveTo(paintRect.bottomLeft().x() + usedNum, paintRect.bottomLeft().y() + 20); if (m_usedSize.contains("-")) { diff --git a/application/widgets/customcontrol/sizeinfowidget.h b/application/widgets/customcontrol/sizeinfowidget.h index c4546807..144f45c2 100644 --- a/application/widgets/customcontrol/sizeinfowidget.h +++ b/application/widgets/customcontrol/sizeinfowidget.h @@ -93,6 +93,7 @@ private slots: DPalette m_parentPb; QString m_totalSpaceSize; QString m_usedSize; + QString m_availableSize; QString m_partitionPath; }; diff --git a/application/widgets/devicelistwidget.cpp b/application/widgets/devicelistwidget.cpp index f0f145a2..cdff622c 100644 --- a/application/widgets/devicelistwidget.cpp +++ b/application/widgets/devicelistwidget.cpp @@ -127,6 +127,11 @@ void DeviceListWidget::treeMenu(const QPoint &pos) createPartitionTable->setDisabled(true); } + // 如果是SSD设备,禁用坏道检测功能 + if (info.m_mediaType == "SSD") { + actionVerifyRepair->setDisabled(true); + } + menu->exec(QCursor::pos()); //显示菜单 delete menu; } else if (m_curDiskInfoData.m_level == DMDbusHandler::PARTITION) { diff --git a/application/widgets/diskbadsectorsdialog.cpp b/application/widgets/diskbadsectorsdialog.cpp index 68273fe6..efc41841 100644 --- a/application/widgets/diskbadsectorsdialog.cpp +++ b/application/widgets/diskbadsectorsdialog.cpp @@ -22,6 +22,7 @@ #include #include #include +#include DiskBadSectorsDialog::DiskBadSectorsDialog(QWidget *parent) : DDialog(parent) { @@ -583,6 +584,11 @@ void DiskBadSectorsDialog::onStartVerifyButtonClicked() m_usedTimeLabel->setText(tr("Time elapsed:") + "00:00:00"); m_unusedTimeLabel->setText(tr("Time left:") + "00:00:00"); + // 初始化实际时间跟踪 + m_realStartTime = QDateTime::currentMSecsSinceEpoch(); + m_totalPausedTime = 0; + m_isPaused = false; + QFile file("/tmp/CheckData.conf"); if (file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { QTextStream out(&file); @@ -726,18 +732,45 @@ void DiskBadSectorsDialog::onCheckTimeOut() m_settings->setValue("CurCylinder",lst.at(1)); m_settings->endGroup(); - qint64 totalTime = m_curCheckTime / m_curCheckNumber * m_totalCheckNumber; - int value = QString::number((float)m_curCheckTime / totalTime,'f', 2).toFloat() * 100; - value > 99 ? value = 99 : value; - - m_progressBar->setValue(value); - qint64 remainingTime = totalTime - m_curCheckTime; - remainingTime < 1000 ? remainingTime = 1000 : remainingTime; + // 使用实际经过时间计算已用时间 + qint64 currentTime = QDateTime::currentMSecsSinceEpoch(); + qint64 realElapsedTime = currentTime - m_realStartTime - m_totalPausedTime; + + // 如果当前是暂停状态,不包括当前暂停期间的时间 + if (m_isPaused && m_pauseStartTime > 0) { + qint64 currentPauseDuration = currentTime - m_pauseStartTime; + realElapsedTime -= currentPauseDuration; + } + + // 确保已用时间不为负数 + if (realElapsedTime < 0) realElapsedTime = 0; + + // 基于柱面检测时间估算总时间(用于剩余时间计算) + qint64 estimatedTotalTime = m_curCheckTime / m_curCheckNumber * m_totalCheckNumber; + + // 计算进度百分比(基于检测数量) + int progressValue = (m_curCheckNumber * 100) / m_totalCheckNumber; + if (progressValue > 99) progressValue = 99; + m_progressBar->setValue(progressValue); + + // 基于实际时间和进度估算剩余时间 + qint64 remainingTime = 0; + if (m_curCheckNumber > 0 && realElapsedTime > 0) { + // 使用实际已用时间来估算剩余时间 + qint64 avgTimePerCylinder = realElapsedTime / m_curCheckNumber; + remainingTime = avgTimePerCylinder * (m_totalCheckNumber - m_curCheckNumber); + } else { + // 回退到基于柱面时间的估算 + remainingTime = estimatedTotalTime - m_curCheckTime; + } + + if (remainingTime < 1000) remainingTime = 1000; + // 显示实际已用时间 qint64 usedHour = 0; qint64 usedMinute = 0; qint64 usedSecond = 0; - mSecsToTime(m_curCheckTime, usedHour, usedMinute, usedSecond); + mSecsToTime(realElapsedTime, usedHour, usedMinute, usedSecond); m_usedTimeLabel->setText(tr("Time elapsed:") + QString("%1:%2:%3").arg(usedHour, 2, 10, QLatin1Char('0')).arg(usedMinute, 2, 10, QLatin1Char('0')).arg(usedSecond, 2, 10, QLatin1Char('0'))); // 时、分、秒为一位数时,十位自动补0 qint64 remainingHour = 0; @@ -793,6 +826,10 @@ void DiskBadSectorsDialog::onStopButtonClicked() m_curType = StatusType::StopCheck; m_cylinderInfoWidget->setChecked(false); + // 记录暂停开始时间 + m_pauseStartTime = QDateTime::currentMSecsSinceEpoch(); + m_isPaused = true; + int checkSize = m_settings->value("SettingData/CheckSize").toInt(); int blockStart = m_settings->value("SettingData/BlockStart").toInt(); int blockEnd = m_settings->value("SettingData/BlockEnd").toInt(); @@ -828,6 +865,14 @@ void DiskBadSectorsDialog::onContinueButtonClicked() m_curType = StatusType::Check; m_cylinderInfoWidget->setChecked(true); + // 累加暂停时间 + if (m_isPaused && m_pauseStartTime > 0) { + qint64 pauseDuration = QDateTime::currentMSecsSinceEpoch() - m_pauseStartTime; + m_totalPausedTime += pauseDuration; + m_isPaused = false; + m_pauseStartTime = 0; + } + int checkSize = m_settings->value("SettingData/CheckSize").toInt(); int blockEnd = m_settings->value("SettingData/BlockEnd").toInt(); int checkNumber = m_settings->value("SettingData/CheckNumber").toInt(); @@ -873,6 +918,12 @@ void DiskBadSectorsDialog::onAgainVerifyButtonClicked() m_curCheckNumber = 0; m_curCheckTime = 0; + // 重置实际时间跟踪 + m_realStartTime = QDateTime::currentMSecsSinceEpoch(); + m_totalPausedTime = 0; + m_isPaused = false; + m_pauseStartTime = 0; + int checkSize = m_settings->value("SettingData/CheckSize").toInt(); m_blockStart = m_settings->value("SettingData/BlockStart").toInt(); m_blockEnd = m_settings->value("SettingData/BlockEnd").toInt(); @@ -926,6 +977,12 @@ void DiskBadSectorsDialog::onResetButtonClicked() m_curRepairTime = 0; m_cylinderInfoWidget->setChecked(false); + // 重置实际时间跟踪 + m_realStartTime = 0; + m_totalPausedTime = 0; + m_isPaused = false; + m_pauseStartTime = 0; + m_verifyComboBox->setCurrentIndex(0); m_startLineEdit->setText("0"); m_startLineEdit->lineEdit()->setPlaceholderText("0"); diff --git a/application/widgets/diskbadsectorsdialog.h b/application/widgets/diskbadsectorsdialog.h index 1f87601c..18e91703 100644 --- a/application/widgets/diskbadsectorsdialog.h +++ b/application/widgets/diskbadsectorsdialog.h @@ -239,6 +239,12 @@ private slots: int m_blockStart = 0; int m_blockEnd = 0; DeviceInfo m_deviceInfo; + + // 实际时间跟踪 + qint64 m_realStartTime = 0; // 检测开始的实际时间戳 + qint64 m_pauseStartTime = 0; // 暂停开始时间戳 + qint64 m_totalPausedTime = 0; // 总的暂停时间 + bool m_isPaused = false; // 是否处于暂停状态 }; #endif // DISKBADSECTORSDIALOG_H diff --git a/application/widgets/diskhealthdetectiondelegate.cpp b/application/widgets/diskhealthdetectiondelegate.cpp index 3acdb47e..59c32c84 100644 --- a/application/widgets/diskhealthdetectiondelegate.cpp +++ b/application/widgets/diskhealthdetectiondelegate.cpp @@ -117,7 +117,7 @@ void DiskHealthDetectionDelegate::paint(QPainter *painter, const QStyleOptionVie } else if (text == "U") { painter->setPen(QColor("#777777")); } else { - painter->setPen(m_color); + painter->setPen(option.palette.color(QPalette::Text)); } painter->drawText(paintRect.x() + 15, paintRect.y() + 20, text); diff --git a/application/widgets/diskhealthdetectiondialog.cpp b/application/widgets/diskhealthdetectiondialog.cpp index 965dab55..a49e820a 100644 --- a/application/widgets/diskhealthdetectiondialog.cpp +++ b/application/widgets/diskhealthdetectiondialog.cpp @@ -49,45 +49,23 @@ void DiskHealthDetectionDialog::initUI() DLabel *diskLabel = new DLabel; diskLabel->setPixmap(iconDisk.pixmap(85, 85)); - DPalette palette1; - palette1.setColor(DPalette::Text, "#666666"); - - DPalette palette2; - palette2.setColor(DPalette::Text, "#000000"); - - // 状态提示字体颜色 - DPalette palette4; - palette4.setColor(DPalette::WindowText, QColor("#526A7F")); - - // 表格内容颜色 - DPalette palette5; - palette5.setColor(DPalette::Text, QColor("#001A2E")); - - // 表头字体颜色 - DPalette palette6; - palette6.setColor(DPalette::Text, QColor("#414D68")); - // 硬盘信息 HardDiskInfo hardDiskInfo = DMDbusHandler::instance()->getHardDiskInfo(m_devicePath); DLabel *serialNumberNameLabel = new DLabel(tr("Serial number")); // 序列号 DFontSizeManager::instance()->bind(serialNumberNameLabel, DFontSizeManager::T8, QFont::Medium); - serialNumberNameLabel->setPalette(palette1); m_serialNumberValue = new DLabel; m_serialNumberValue->setText(hardDiskInfo.m_serialNumber); DFontSizeManager::instance()->bind(m_serialNumberValue, DFontSizeManager::T6, QFont::Medium); - m_serialNumberValue->setPalette(palette2); m_serialNumberValue->setAccessibleName("Serial number"); DLabel *userCapacityNameLabel = new DLabel(tr("Storage")); // 用户容量 DFontSizeManager::instance()->bind(userCapacityNameLabel, DFontSizeManager::T10, QFont::Medium); - userCapacityNameLabel->setPalette(palette1); m_userCapacityValue = new DLabel; m_userCapacityValue->setText(hardDiskInfo.m_size); DFontSizeManager::instance()->bind(m_userCapacityValue, DFontSizeManager::T10, QFont::Normal); - m_userCapacityValue->setPalette(palette2); m_userCapacityValue->setAccessibleName("Storage"); QVBoxLayout *diskInfoLayout = new QVBoxLayout; @@ -104,7 +82,6 @@ void DiskHealthDetectionDialog::initUI() DLabel *healthStateLabel = new DLabel(tr("Health Status")); // 健康状态 DFontSizeManager::instance()->bind(healthStateLabel, DFontSizeManager::T6, QFont::Medium); - healthStateLabel->setPalette(palette2); QIcon iconHealth = Common::getIcon("good"); DLabel *iconHealthLabel = new DLabel; @@ -112,7 +89,6 @@ void DiskHealthDetectionDialog::initUI() DFontSizeManager::instance()->bind(m_healthStateValue, DFontSizeManager::T2, QFont::Medium); m_healthStateValue->setAccessibleName("healthState"); - // 状态颜色 DPalette paletteStateColor; if (0 == healthStateValue.compare("PASSED", Qt::CaseInsensitive) || 0 == healthStateValue.compare("OK", Qt::CaseInsensitive)) { @@ -151,11 +127,9 @@ void DiskHealthDetectionDialog::initUI() // 温度 DLabel *temperatureLabel = new DLabel(tr("Temperature")); // 温度 DFontSizeManager::instance()->bind(temperatureLabel, DFontSizeManager::T6, QFont::Medium); - temperatureLabel->setPalette(palette2); m_temperatureValue = new DLabel("-°C"); DFontSizeManager::instance()->bind(m_temperatureValue, DFontSizeManager::T2, QFont::Medium); - m_temperatureValue->setPalette(palette2); m_temperatureValue->setAccessibleName("temperature"); QVBoxLayout *temperatureLayout = new QVBoxLayout; @@ -190,23 +164,16 @@ void DiskHealthDetectionDialog::initUI() m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows); m_tableView->setSelectionMode(QAbstractItemView::NoSelection); m_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); - m_tableView->setPalette(palette5); m_diskHealthHeaderView = new DiskHealthHeaderView(Qt::Horizontal, this); m_tableView->setHorizontalHeader(m_diskHealthHeaderView); DFontSizeManager::instance()->bind(m_tableView->horizontalHeader(), DFontSizeManager::T6, QFont::Medium); m_tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignCenter); - m_tableView->horizontalHeader()->setPalette(palette6); m_diskHealthDetectionDelegate = new DiskHealthDetectionDelegate(this); m_tableView->setItemDelegate(m_diskHealthDetectionDelegate); - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) { - m_diskHealthDetectionDelegate->setTextColor(QColor("#C0C6D4")); - } else if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) { - m_diskHealthDetectionDelegate->setTextColor(QColor("#001A2E")); - } m_standardItemModel->setColumnCount(7); m_standardItemModel->setHeaderData(0, Qt::Horizontal, QString(" %1").arg(tr("ID"))); // 第一个需要向右对齐内容,15px @@ -314,7 +281,6 @@ void DiskHealthDetectionDialog::initUI() DLabel *stateTipsLabel = new DLabel; stateTipsLabel->setText(tr("Status: (G: Good | W: Warning | D: Damaged | U: Unknown)")); // 状态:(G: 良好 | W: 警告 | D: 损坏 | U: 未知) DFontSizeManager::instance()->bind(stateTipsLabel, DFontSizeManager::T8, QFont::Normal); - stateTipsLabel->setPalette(palette4); m_linkButton = new DCommandLinkButton(tr("Export", "button")); // 导出 DFontSizeManager::instance()->bind(m_linkButton, DFontSizeManager::T8, QFont::Medium); diff --git a/application/widgets/mainwindow.cpp b/application/widgets/mainwindow.cpp index 0277cc32..d4fa1eee 100644 --- a/application/widgets/mainwindow.cpp +++ b/application/widgets/mainwindow.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -176,10 +176,14 @@ void MainWindow::onShowSpinerWindow(bool isShow, const QString &title) m_dialog->setShowSpinner(isShow, title); m_dialog->show(); } else { + bool dialogWasVisible = m_dialog->isVisible(); m_dialog->setShowSpinner(isShow, title); m_dialog->hide(); - raise(); - activateWindow(); + qDebug() << __FUNCTION__ << "dialogWasVisible:" << dialogWasVisible; + if (dialogWasVisible) { + raise(); + activateWindow(); + } } } diff --git a/basestruct/utils.cpp b/basestruct/utils.cpp index 0ecd9b3d..c7b3cff1 100644 --- a/basestruct/utils.cpp +++ b/basestruct/utils.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -17,6 +17,10 @@ #include #include +#include +#include +#include + Utils::Utils() { } @@ -86,25 +90,36 @@ int Utils::executCmd(const QString &strCmd, QString &outPut, QString &error) return exitcode; } -int Utils::executWithInputOutputCmd(const QString &strCmdArg, const QString *inPut, QString &outPut, QString &error) +int Utils::executWithInputOutputCmd(const QString &strCmd, const QStringList &strArg, const QString *inPut, QString &outPut, QString &error) { + qDebug() << "Entering Utils::executWithInputOutputCmd with command:" << strCmd << strArg; QProcess proc; int exitCode; - proc.start(strCmdArg, QIODevice::ReadWrite); + proc.start(strCmd, strArg); + + // 统一等待启动完成:无论是否需要写入 stdin,都检测 FailedToStart + // (程序不存在等场景),避免后续 readAll 取到空输出且 exitCode 为 0 的"假成功" + if (!proc.waitForStarted(-1)) { + error = proc.errorString(); + return -1; + } if (inPut) { - proc.waitForStarted(-1); proc.write(inPut->toLocal8Bit()); proc.closeWriteChannel(); } proc.waitForFinished(-1); outPut = proc.readAllStandardOutput().data(); - error = proc.errorString(); + // 优先取子进程 stderr(含 cryptsetup/xfs_db 等的真实失败原因); + // 为空时回退到 QProcess 自身错误(如启动失败 execvp: ...) + QString stdErr = proc.readAllStandardError(); + error = stdErr.isEmpty() ? proc.errorString() : stdErr; exitCode = proc.exitCode(); proc.close(); + qDebug() << "Utils::executWithInputOutputCmd exitCode: " << exitCode; return exitCode; } @@ -394,8 +409,8 @@ int Utils::getMountedFileSystemUsage(const QString &mountpoint, Byte_Value &file int ret; ret = statvfs(mountpoint.toStdString().c_str(), &sfs); if (ret == 0) { - fileSystemSize = static_cast(sfs.f_blocks) * sfs.f_frsize; - fileSystemFree = static_cast(sfs.f_bfree) * sfs.f_bsize; + fileSystemSize = static_cast(sfs.f_blocks) * sfs.f_bsize; + fileSystemFree = static_cast(sfs.f_bavail) * sfs.f_bsize; } else { QString errorMessage("statvfs(\"%1\"):%2 "); // = "statvfs(\"" + mountpoint + "\"): " + Glib::strerror(errno) ; errorMessage = errorMessage.arg(mountpoint).arg(errno); @@ -675,18 +690,30 @@ bool Utils::kernelSupportFS(const QString &fsType) QString Utils::mkTempDir(const QString &infix) { - // Construct template like "/var/tmp/diskmanager-XXXXXX" or "/var/tmp/diskmanager-INFIX-XXXXXX" - QString dirTemplate = "/var/tmp/"; + qDebug() << "Utils::mkTempDir - Creating temp dir with infix:" << infix; + + // 路径遍历检查:拒绝包含 ".." 的 infix + if (infix.contains("..")) { + qWarning() << "Utils::mkTempDir - Invalid infix contains path traversal:" << infix; + return QString(); + } + // 使用 mkdtemp(3) 原子创建随机命名临时目录,消除可预测路径(CWE-377)、 + // TOCTOU 竞态(CWE-367)和符号链接跟随(CWE-59) + QString dirTemplate = "/var/tmp/"; if (!infix.isEmpty()) { - dirTemplate += infix + "-" ; + dirTemplate += infix + "-"; } - dirTemplate += "XXXXXX" ; - QDir dir(dirTemplate); - if (!dir.exists() && dir.mkpath(dirTemplate)) { - return dirTemplate; + dirTemplate += "XXXXXX"; + + QByteArray templateBytes = dirTemplate.toLocal8Bit(); + char *result = mkdtemp(templateBytes.data()); + if (result == nullptr) { + qWarning() << "Utils::mkTempDir - mkdtemp failed:" << strerror(errno); + return QString(); } - return dirTemplate; + + return QString::fromLocal8Bit(result); } void Utils::rmTempDir(QString &dirName) diff --git a/basestruct/utils.h b/basestruct/utils.h index f1d4491a..28f3c85b 100644 --- a/basestruct/utils.h +++ b/basestruct/utils.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -63,7 +63,7 @@ class Utils * @param error:错误信息 * @return 非0失败 */ - static int executWithInputOutputCmd(const QString &strCmdArg, const QString *inPut, QString &outPut, QString &error); + static int executWithInputOutputCmd(const QString &strCmd, const QStringList &strArg, const QString *inPut, QString &outPut, QString &error); /** * @brief 执行外部命令 diff --git a/debian/changelog b/debian/changelog index 144702f2..29945496 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,15 +1,8 @@ -deepin-diskmanager (1.3.39) unstable; urgency=medium +deepin-diskmanager (1.3.40) unstable; urgency=medium - * adapt disk interface. + * new tag v1.3.40 - -- wangrong Thu, 17 Oct 2024 19:47:11 +0800 - -deepin-diskmanager (1.3.38) unstable; urgency=medium - - * add polkit support. - * fix command injection. - - -- wangrong Tue, 10 Sep 2024 09:17:08 +0800 + -- wangrong Fri, 08 Nov 2024 14:45:36 +0800 deepin-diskmanager (1.3.37) unstable; urgency=medium diff --git a/debian/control b/debian/control index e175c90b..07df937a 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 4.1.3 Package: deepin-diskmanager Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, smartmontools, exfat-fuse +Depends: ${shlibs:Depends}, ${misc:Depends}, smartmontools Description: Disk Utility is a disk management tool for creating, reorganizing and formatting partitions. Disk Utility is a disk management tool for disk. diff --git a/service/CMakeLists.txt b/service/CMakeLists.txt index dcd2195e..638f2002 100644 --- a/service/CMakeLists.txt +++ b/service/CMakeLists.txt @@ -20,9 +20,12 @@ set(APP_USBREMOVE_FILES "${APP_EDEV_DIR}/USBremove.sh") set(APP_DEEPIN_DISKMANAGER_SERVICE_BIN "${APP_EDEV_DIR}/deepin-diskmanager-authenticateProxy") set(APP_POLICY_DIR "policy") set(APP_POLICY_FILES "${APP_POLICY_DIR}/com.deepin.diskmanager.policy") +set(APP_DCONFIG_DIR "${APP_RES_DIR}/dconfig") +set(APP_DCONFIG_SCHEMA "${APP_DCONFIG_DIR}/com.deepin.diskmanager.storage.json") # Find the library find_package(PkgConfig REQUIRED) +find_package(DtkCore REQUIRED) find_package(DtkGui REQUIRED) find_package(Qt5 COMPONENTS Core @@ -79,4 +82,7 @@ install(PROGRAMS ${APP_USBADD_FILES} DESTINATION libexec/openconnect/) install(PROGRAMS ${APP_USBREMOVE_FILES} DESTINATION libexec/openconnect/) install(FILES ${APP_UDEV_FILES} DESTINATION /lib/udev/rules.d/) install(FILES ${APP_POLICY_FILES} DESTINATION share/polkit-1/actions) +if(DEFINED DSG_DATA_DIR) + install(FILES ${APP_DCONFIG_SCHEMA} DESTINATION share/dsg/configs/com.deepin.diskmanager/) +endif() install(PROGRAMS ${APP_DEEPIN_DISKMANAGER_SERVICE_BIN} DESTINATION bin/) diff --git a/service/PolicyKitHelper.cpp b/service/PolicyKitHelper.cpp index 34fe3309..43ba0482 100755 --- a/service/PolicyKitHelper.cpp +++ b/service/PolicyKitHelper.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only diff --git a/service/PolicyKitHelper.h b/service/PolicyKitHelper.h index dae8ec4a..c618d1b0 100755 --- a/service/PolicyKitHelper.h +++ b/service/PolicyKitHelper.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only diff --git a/service/assets/data/com.deepin.diskmanager.conf b/service/assets/data/com.deepin.diskmanager.conf index 487be7e2..52379ba2 100755 --- a/service/assets/data/com.deepin.diskmanager.conf +++ b/service/assets/data/com.deepin.diskmanager.conf @@ -12,15 +12,7 @@ - - - - - diff --git a/service/assets/dconfig/com.deepin.diskmanager.storage.json b/service/assets/dconfig/com.deepin.diskmanager.storage.json new file mode 100644 index 00000000..36c0c8d0 --- /dev/null +++ b/service/assets/dconfig/com.deepin.diskmanager.storage.json @@ -0,0 +1,17 @@ +{ + "magic": "dsg.config.meta", + "version": "1.0", + "contents": { + "ufsSpecVersions": { + "value": ["300", "310", "400", "410"], + "serial": 0, + "flags": ["global"], + "name": "UFS Spec Versions", + "name[zh_CN]": "UFS规范版本", + "description": "Substrings of the UFS spec version read from /sys/block//device/spec_version that should be recognized as the UFS interface. Append new version strings here instead of modifying source code.", + "description[zh_CN]": "从 /sys/block//device/spec_version 读取的UFS规范版本子串列表,匹配任一项即识别为UFS接口。新增UFS版本时只需在此配置中追加,无需修改源码。", + "permissions": "readonly", + "visibility": "private" + } + } +} diff --git a/service/diskmanagerservice.cpp b/service/diskmanagerservice.cpp index 50368ccb..2a5c06e4 100644 --- a/service/diskmanagerservice.cpp +++ b/service/diskmanagerservice.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -387,15 +387,27 @@ int DiskManagerService::test() bool DiskManagerService::checkAuthorization(void) { QString actionId("com.deepin.diskmanager"); + QString serviceName = message().service(); - if (message().service() == m_frontEndDBusName || - connection().interface()->serviceUid(message().service()).value() == 0 || - PolicyKitHelper::instance()->checkAuthorization(actionId, message().service())) { + if (serviceName == m_frontEndDBusName) { + qDebug() << "Authorization granted for frontend:" << serviceName; + return true; + } + + QDBusReply uidReply = connection().interface()->serviceUid(serviceName); + if (uidReply.isValid() && uidReply.value() == 0) { + qDebug() << "Authorization granted for root user"; return true; - } else { - sendErrorReply(QDBusError::AccessDenied); - return false; } + + if (PolicyKitHelper::instance()->checkAuthorization(actionId, serviceName)) { + qDebug() << "Authorization granted via Polkit for service:" << serviceName; + return true; + } + + qWarning() << "Authorization denied for service:" << serviceName; + sendErrorReply(QDBusError::AccessDenied); + return false; } } // namespace DiskManager diff --git a/service/diskmanagerservice.h b/service/diskmanagerservice.h index 7ac562c0..e903a774 100644 --- a/service/diskmanagerservice.h +++ b/service/diskmanagerservice.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only diff --git a/service/diskoperation/DeviceStorage.cpp b/service/diskoperation/DeviceStorage.cpp index 3bf48b33..691c8a45 100755 --- a/service/diskoperation/DeviceStorage.cpp +++ b/service/diskoperation/DeviceStorage.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -6,6 +6,12 @@ #include #include #include +#include +#include +#include +#ifdef DTKCORE_CLASS_DConfigFile +#include +#endif #include "utils.h" namespace DiskManager { @@ -265,13 +271,16 @@ void DeviceStorage::setAttribute(const QMap &mapInfo, const QS } } -bool DeviceStorage::getDiskInfoFromHwinfo(const QString &devicePath) +bool DeviceStorage::getDiskInfoFromHwinfo(const QString &devicePath, const QString &cachedHwinfo) { - QString cmd = QString("hwinfo --disk --only %1").arg(devicePath); - QProcess proc; - proc.start(cmd); - proc.waitForFinished(-1); - QString outPut = proc.readAllStandardOutput(); + QString outPut = cachedHwinfo; + if (outPut.isEmpty()) { + QString cmd = QString("hwinfo --disk --only %1").arg(devicePath); + QProcess proc; + proc.start(cmd); + proc.waitForFinished(-1); + outPut = proc.readAllStandardOutput(); + } QMap mapInfo; @@ -332,12 +341,15 @@ void DeviceStorage::getMapInfoFromInput(const QString &info, QMap &m } } -bool DeviceStorage::getDiskInfoFromSmartCtl(const QString &devicePath) +bool DeviceStorage::getDiskInfoFromSmartCtl(const QString &devicePath, const QString &cachedSmartctlAll) { - QString cmd = QString("smartctl --all %1").arg(devicePath); - QProcess proc; - proc.start(cmd); - proc.waitForFinished(-1); - QString outPut = proc.readAllStandardOutput(); - - if (outPut.contains("Please specify device type with the -d option")) { - QString cmd = QString("smartctl --all -d sat %1").arg(devicePath); + QString outPut = cachedSmartctlAll; + if (outPut.isEmpty()) { + QString cmd = QString("smartctl --all %1").arg(devicePath); QProcess proc; proc.start(cmd); proc.waitForFinished(-1); outPut = proc.readAllStandardOutput(); + + if (outPut.contains("Please specify device type with the -d option")) { + QString cmd = QString("smartctl --all -d sat %1").arg(devicePath); + QProcess proc; + proc.start(cmd); + proc.waitForFinished(-1); + outPut = proc.readAllStandardOutput(); + } } QMap mapInfo; @@ -461,19 +476,23 @@ bool DeviceStorage::getDiskInfoFromSmartCtl(const QString &devicePath) return true; } -void DeviceStorage::getDiskInfoModel(const QString &devicePath, QString &model) +void DeviceStorage::getDiskInfoModel(const QString &devicePath, QString &model, const QString &cachedSmartctlAll, const QString &cachedLshw) { QProcess proc; - QString cmd = QString("smartctl --all %1").arg(devicePath); - proc.start(cmd); - proc.waitForFinished(-1); - QString outPut = proc.readAllStandardOutput(); - - if (outPut.contains("Please specify device type with the -d option")) { - cmd = QString("smartctl --all -d sat %1").arg(devicePath); + QString cmd; + QString outPut = cachedSmartctlAll; + if (outPut.isEmpty()) { + cmd = QString("smartctl --all %1").arg(devicePath); proc.start(cmd); proc.waitForFinished(-1); outPut = proc.readAllStandardOutput(); + + if (outPut.contains("Please specify device type with the -d option")) { + cmd = QString("smartctl --all -d sat %1").arg(devicePath); + proc.start(cmd); + proc.waitForFinished(-1); + outPut = proc.readAllStandardOutput(); + } } QStringList infoList = outPut.split("\n"); @@ -485,10 +504,13 @@ void DeviceStorage::getDiskInfoModel(const QString &devicePath, QString &model) } } - cmd = "lshw -C disk"; - proc.start(cmd); - proc.waitForFinished(-1); - outPut = proc.readAllStandardOutput(); + outPut = cachedLshw; + if (outPut.isEmpty()) { + cmd = "sudo lshw -C disk"; + proc.start(cmd); + proc.waitForFinished(-1); + outPut = proc.readAllStandardOutput(); + } infoList = outPut.split("*-disk\n"); for (int i =0; i < infoList.size(); i++) { @@ -504,6 +526,24 @@ void DeviceStorage::getDiskInfoModel(const QString &devicePath, QString &model) } } + proc.start("udevadm", QStringList() << "info" << devicePath); + proc.waitForFinished(-1); + outPut = proc.readAllStandardOutput(); + QString key = "ID_MODEL="; + int start = outPut.indexOf(key); + if (start != -1) { + start += key.length(); // 移动到等号后面 + int end = outPut.indexOf('\n', start); // 找到行尾 + if (end == -1) + end = outPut.length(); // 如果是最后一行 + + model = outPut.mid(start, end - start).trimmed(); + if (!model.isEmpty()) + return; + } + + qWarning() << "tried a lot but got nothing about model for" << devicePath; + // 若未获取到型号名,返回未知 model = "UnKnow"; return; @@ -565,36 +605,38 @@ static bool isPGUX() return 1 == isPGUX; } -void DeviceStorage::getDiskInfoInterface(const QString &devicePath, QString &interface, QString &model) +// 从 DConfig 读取需要识别为 UFS 接口的 spec_version 子串列表,新增 UFS 版本时 +// 只需在 com.deepin.diskmanager.storage 配置中追加,无需修改源码。 +// 当构建环境不支持 DConfig(如 102X 等低版本)时,回退到硬编码列表。 +static QStringList ufsSpecVersions() +{ + const QStringList fallback{"300", "310", "400", "410"}; +#ifdef DTKCORE_CLASS_DConfigFile + QScopedPointer cfg( + Dtk::Core::DConfig::create("com.deepin.diskmanager", "com.deepin.diskmanager.storage")); + if (cfg && cfg->isValid()) { + QStringList versions = cfg->value("ufsSpecVersions", QVariant::fromValue(fallback)).toStringList(); + if (!versions.isEmpty()) + return versions; + } +#endif + return fallback; +} + +void DeviceStorage::getDiskInfoInterface(const QString &devicePath, QString &interface, QString &model, const QString &cachedHwinfo) { QString bootDevicePath("/proc/bootdevice/product_name"); QFile file(bootDevicePath); if (file.open(QIODevice::ReadOnly)) { if (model == file.readLine().simplified()) { - QString output, err; - Utils::executeCmdWithArtList("dmidecode", QStringList() << "-s" << "system-product-name", output, err); - if (output.contains("KLVU")) { - QString output1 = Utils::readContent("/sys/devices/platform/f8200000.ufs/host0/scsi_host/host0/wb_en").trimmed(); - QString output2 = Utils::readContent("/sys/block/sdd/device/spec_version").trimmed(); - if (output1 == "true" && output2 == "310") { - interface = "UFS 3.1"; - } else { - interface = "UFS 3.0"; - } - } else if (output.contains("KLVV")) { - interface = "UFS 3.1"; - } else if (output.contains("L540")) { - interface = "UFS 3.1"; - } else if (output.contains("W585")) { - interface = "UFS 3.0"; - } else { - interface = ""; - if (output.contains("PGUV") || - isPGUX()) - { - QString spec_version = Utils::readContent("/sys/block/sdd/device/spec_version").trimmed(); - interface = (spec_version == "300") ? "UFS 3.0" : "UFS 3.1"; + QString spec_version = Utils::readContent("/sys/block/sdd/device/spec_version").trimmed(); + if (!spec_version.isEmpty()) { + foreach (const QString &version, ufsSpecVersions()) { + if (spec_version.contains(version)) { + interface = "UFS"; + break; + } } } } @@ -602,27 +644,73 @@ void DeviceStorage::getDiskInfoInterface(const QString &devicePath, QString &int } if (interface.isEmpty()) { - QString cmd = QString("hwinfo --disk --only %1").arg(devicePath); - QProcess proc; - proc.start(cmd); - proc.waitForFinished(-1); - QString outPut = proc.readAllStandardOutput().trimmed(); - QStringList outPutList = outPut.split("("); + QString outPut = cachedHwinfo.trimmed(); + if (outPut.isEmpty()) { + QString cmd = QString("hwinfo --disk --only %1").arg(devicePath); + QProcess proc; + proc.start(cmd); + proc.waitForFinished(-1); + outPut = proc.readAllStandardOutput().trimmed(); + } + QMap mapInfo; + getMapInfoFromInput(outPut, mapInfo); + QStringList outPutList = mapInfo.value("Attached to").split("("); interface = outPutList[outPutList.size() - 1].split(" ")[0]; } return; } -void DeviceStorage::getDiskInfoFirmwareVersion(const QString &devicePath) +void DeviceStorage::updateForHWDevice(const QString &/*devicePath*/) { - if (!m_firmwareVersion.isEmpty()) + if (Utils::readContent("/proc/bootdevice/product_name").trimmed().isEmpty()) return; - if (m_model != Utils::readContent("/proc/bootdevice/product_name").trimmed()) - return; + // m_firmwareVersion + if (m_firmwareVersion.isEmpty()) { + if (isPGUX()) + m_firmwareVersion = Utils::readContent("/proc/bootdevice/rev").trimmed(); + } - if (isPGUX()) - m_firmwareVersion = Utils::readContent("/proc/bootdevice/rev").trimmed(); + // hide mode and vendor + m_model = ""; + m_vendor = ""; + + // Normalize disk size + if (!m_size.isEmpty()) { + // Convert size string to bytes + qint64 bytes = 0; + QString sizeStr = m_size.toLower(); + + if (sizeStr.contains("bytes")) { + sizeStr = sizeStr.split("bytes").first().trimmed(); + bytes = sizeStr.toLongLong(); + } else { + // Handle GB/TB directly + double value = sizeStr.split(" ").first().toDouble(); + if (sizeStr.contains("gb")) { + bytes = value * 1000 * 1000 * 1000; + } else if (sizeStr.contains("tb")) { + bytes = value * 1000 * 1000 * 1000 * 1000; + } + } + + // Convert to standardized format + if (bytes > 0) { + // Convert to GB and round to standard sizes + int gb = qRound(bytes / (1000.0 * 1000 * 1000)); + if (gb < 200) { + return; + } else if (gb <= 300) { + m_size = "256 GB"; + } else if (gb <= 600) { + m_size = "512 GB"; + } else if (gb <= 1200){ + m_size = "1 TB"; + } else if (gb <= 2200) { + m_size = "2 TB"; + } + } + } } void DeviceStorage::getMapInfoFromSmartctl(QMap &mapInfo, const QString &info, const QString &ch) diff --git a/service/diskoperation/DeviceStorage.h b/service/diskoperation/DeviceStorage.h index 0b01e20b..5bddca27 100755 --- a/service/diskoperation/DeviceStorage.h +++ b/service/diskoperation/DeviceStorage.h @@ -14,28 +14,28 @@ class DeviceStorage DeviceStorage(); /**@brief:添加从hwinfo中获取的信息*/ - bool getDiskInfoFromHwinfo(const QString &devicePath); + bool getDiskInfoFromHwinfo(const QString &devicePath, const QString &cachedHwinfo = QString()); /**@brief:添加从lshw中获取的信息*/ - bool getDiskInfoFromLshw(const QString &devicePath); + bool getDiskInfoFromLshw(const QString &devicePath, const QString &cachedLshw = QString()); /**@brief:添加lsblk获取到的介质信息*/ bool getDiskInfoFromLsblk(const QString &devicePath); /**@brief:添加smartctl中获取到的信息*/ - bool getDiskInfoFromSmartCtl(const QString &devicePath); + bool getDiskInfoFromSmartCtl(const QString &devicePath, const QString &cachedSmartctlAll = QString()); /**@brief:获取当前磁盘model信息*/ - void getDiskInfoModel(const QString &devicePath, QString &model); + void getDiskInfoModel(const QString &devicePath, QString &model, const QString &cachedSmartctlAll = QString(), const QString &cachedLshw = QString()); /**@brief:获取当前磁盘介质信息*/ QString getDiskInfoMediaType(const QString &devicePath); /**@brief:获取当前磁盘接口信息*/ - void getDiskInfoInterface(const QString &devicePath, QString &interface, QString &model); + void getDiskInfoInterface(const QString &devicePath, QString &interface, QString &model, const QString &cachedHwinfo = QString()); - /**@brief:获取当前磁盘固件版本信息*/ - void getDiskInfoFirmwareVersion(const QString &devicePath); + /**@brief:为HW设备更新信息*/ + void updateForHWDevice(const QString &devicePath); private: diff --git a/service/diskoperation/filesystems/ext2.cpp b/service/diskoperation/filesystems/ext2.cpp index 7a77c68d..44ee3fa4 100644 --- a/service/diskoperation/filesystems/ext2.cpp +++ b/service/diskoperation/filesystems/ext2.cpp @@ -115,59 +115,76 @@ FS EXT2::getFilesystemSupport() void EXT2::setUsedSectors(Partition &partition) { - QString output, error, strmatch, strcmd; - m_blocksSize = m_numOfFreeOrUsedBlocks = m_totalNumOfBlock = -1; + QString output, error, strcmd; strcmd = QString("dumpe2fs -h %1").arg(partition.getPath()); + if (!Utils::executCmd(strcmd, output, error)) { - strmatch = ("Block count:"); + long long blockCount = -1; + long long blockSize = -1; + long long freeBlocks = -1; + long long reservedBlocks = 0; + + // 获取总块数 + QString strmatch = "Block count:"; int index = output.indexOf(strmatch); if (index >= 0 && index < output.length()) { - m_totalNumOfBlock = Utils::regexpLabel(output, QString("(?<=Block count:).*(?=\n)")).trimmed().toLong(); + blockCount = Utils::regexpLabel(output, QString("(?<=Block count:).*(?=\n)")).trimmed().toLong(); } -// qDebug() << output; -// qDebug() << output.mid(index, strmatch.length()).toLatin1() << m_totalNumOfBlock; - strmatch = ("Block size:"); + + // 获取块大小 + strmatch = "Block size:"; index = output.indexOf(strmatch); if (index >= 0 && index < output.length()) { - m_blocksSize = Utils::regexpLabel(output, QString("(?<=Block size:).*(?=\n)")).trimmed().toLong(); + blockSize = Utils::regexpLabel(output, QString("(?<=Block size:).*(?=\n)")).trimmed().toLong(); } -// qDebug() << output << output.mid(index, strmatch.length()).toLatin1() << m_blocksSize; - - if (partition.m_busy) { - Byte_Value fs_all; - Byte_Value fs_free; - if (Utils::getMountedFileSystemUsage(partition.getMountPoint(), fs_all, fs_free) == 0) { - partition.setSectorUsage(qRound64(fs_all / double(partition.m_sectorSize)), qRound64(fs_free / double(partition.m_sectorSize))); - partition.m_fsBlockSize = m_blocksSize; - } - } else { - // Resize2fs won't shrink a file system smaller than it's own - // estimated minimum size, so use that to derive the free space. - m_numOfFreeOrUsedBlocks = -1; - if (!Utils::executCmd(QString("resize2fs -P %1").arg(partition.getPath()), output, error)) { - if (sscanf(output.toLatin1(), "Estimated minimum size of the filesystem: %lld", &m_numOfFreeOrUsedBlocks) == 1 - || sscanf(output.toStdString().c_str(), "预计文件系统的最小尺寸:%lld", &m_numOfFreeOrUsedBlocks) == 1) - m_numOfFreeOrUsedBlocks = m_totalNumOfBlock - m_numOfFreeOrUsedBlocks; - } - // Resize2fs can fail reporting please run fsck first. Fall back - // to reading dumpe2fs output for free space. - if (m_numOfFreeOrUsedBlocks == -1) { - strmatch = "Free blocks:"; - index = output.indexOf(strmatch); - if (index < output.length()) - sscanf(output.mid(index, strmatch.length()).toLatin1(), "Free blocks: %lld", &m_numOfFreeOrUsedBlocks); - } - - if (m_totalNumOfBlock > -1 && m_numOfFreeOrUsedBlocks > -1 && m_blocksSize > -1) { - m_totalNumOfBlock = qRound64(m_totalNumOfBlock * (m_blocksSize / double(partition.m_sectorSize))); - m_numOfFreeOrUsedBlocks = qRound64(m_numOfFreeOrUsedBlocks * (m_blocksSize / double(partition.m_sectorSize))); - qDebug() << "111111111111111111111111" << m_totalNumOfBlock << m_numOfFreeOrUsedBlocks << m_blocksSize; - partition.setSectorUsage(m_totalNumOfBlock, m_numOfFreeOrUsedBlocks); - partition.m_fsBlockSize = m_blocksSize; + + // 获取空闲块数 + strmatch = "Free blocks:"; + index = output.indexOf(strmatch); + if (index >= 0 && index < output.length()) { + freeBlocks = Utils::regexpLabel(output, QString("(?<=Free blocks:).*(?=\n)")).trimmed().toLong(); + } + + // 获取保留块数 + strmatch = "Reserved block count:"; + index = output.indexOf(strmatch); + if (index >= 0 && index < output.length()) { + reservedBlocks = Utils::regexpLabel(output, QString("(?<=Reserved block count:).*(?=\n)")).trimmed().toLong(); + } + + // 验证数据有效性并计算扇区使用情况 + if (blockCount > 0 && blockSize > 0 && freeBlocks >= 0 && reservedBlocks >= 0) { + // 计算用户实际可用的空闲块数:可用 = (freeBlocks - reservedBlocks) + long long userAvailableBlocks = (freeBlocks > reservedBlocks) ? (freeBlocks - reservedBlocks) : 0; + + // 转换为扇区数 + Sector totalSectors = qRound64(blockCount * (blockSize / double(partition.m_sectorSize))); + Sector availableSectors = qRound64(userAvailableBlocks * (blockSize / double(partition.m_sectorSize))); + + qDebug() << "EXT* usage calculation: blockCount=" << blockCount + << "blockSize=" << blockSize + << "freeBlocks=" << freeBlocks + << "reservedBlocks=" << reservedBlocks + << "userAvailableBlocks=" << userAvailableBlocks + << "totalSectors=" << totalSectors + << "availableSectors=" << availableSectors; + + // 如果分区已挂载,使用 stat 获取更准确的可用块数 + if (partition.m_busy && !partition.getMountPoints().empty()) { + Byte_Value statTotalSize, statAvailableSize; + if (Utils::getMountedFileSystemUsage(partition.getMountPoint(), statTotalSize, statAvailableSize) == 0) { + // 使用 stat 获取的可用空间(已经排除了保留空间) + Sector statAvailableSectors = qRound64(statAvailableSize / double(partition.m_sectorSize)); + qDebug() << "Using stat data for mounted partition: statAvailableSectors=" << statAvailableSectors; + partition.setSectorUsage(totalSectors, statAvailableSectors); + } else { + partition.setSectorUsage(totalSectors, availableSectors); + } + } else { + partition.setSectorUsage(totalSectors, availableSectors); } + partition.m_fsBlockSize = blockSize; } - - } else { qDebug() << __FUNCTION__ << "dumpe2fs -h failed :" << output << error; } diff --git a/service/diskoperation/filesystems/xfs.cpp b/service/diskoperation/filesystems/xfs.cpp index 194fdb37..a368815b 100644 --- a/service/diskoperation/filesystems/xfs.cpp +++ b/service/diskoperation/filesystems/xfs.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -47,12 +47,13 @@ FS XFS::getFilesystemSupport() void XFS::setUsedSectors(Partition &partition) { - QString output, error, strmatch, strcmd; + QString output, error; m_blocksSize = m_numOfFreeOrUsedBlocks = m_totalNumOfBlock = -1; - strcmd = QString("xfs_db -r -c \"sb 0\" -c \"print blocksize\" -c \"print dblocks\"" - " -c \"print fdblocks\" %1") - .arg(partition.getPath()); - if (Utils::executWithInputOutputCmd(strcmd, NULL, output, error) == 0) { + QStringList args; + args << "-r" << "-c" << "sb 0" << "-c" << "print blocksize" + << "-c" << "print dblocks" << "-c" << "print fdblocks" + << partition.getPath(); + if (Utils::executWithInputOutputCmd("xfs_db", args, nullptr, output, error) == 0) { auto strList = output.split("\n"); foreach (auto &item, strList) { auto value = item.split("=", QString::SkipEmptyParts); diff --git a/service/diskoperation/luksoperator/luksoperator.cpp b/service/diskoperation/luksoperator/luksoperator.cpp index b2c29fdd..03cb382f 100644 --- a/service/diskoperation/luksoperator/luksoperator.cpp +++ b/service/diskoperation/luksoperator/luksoperator.cpp @@ -1,5 +1,4 @@ -// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd. -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -477,11 +476,12 @@ bool LUKSOperator::isLUKS(QString devPath) bool LUKSOperator::format(const LUKS_INFO &luks) { QString outPut, error; - QString cmd = QString("cryptsetup --cipher %1 --key-size 256 --hash sha256 luksFormat --label=%2 %3 -q") - .arg(Utils::getCipherStr(luks.m_crypt)) - .arg(luks.m_fileSystemLabel) - .arg(luks.m_devicePath); - bool success = (Utils::executWithInputOutputCmd(cmd, &luks.m_decryptStr, outPut, error) == 0); + QStringList args; + args << "--cipher" << Utils::getCipherStr(luks.m_crypt) + << "--key-size" << "256" << "--hash" << "sha256" + << "luksFormat" << QString("--label=%1").arg(luks.m_fileSystemLabel) + << luks.m_devicePath << "-q"; + bool success = (Utils::executWithInputOutputCmd("cryptsetup", args, &luks.m_decryptStr, outPut, error) == 0); if (!success) { qCritical() << Q_FUNC_INFO << "output:" << outPut << "\terror:" << error; } @@ -491,19 +491,17 @@ bool LUKSOperator::format(const LUKS_INFO &luks) bool LUKSOperator::open(const LUKS_INFO &luks) { QString outPut, error; - QString cmd = QString("cryptsetup open %1 %2 -q") - .arg(luks.m_devicePath) - .arg(luks.m_mapper.m_dmName); - return (Utils::executWithInputOutputCmd(cmd, &luks.m_decryptStr, outPut, error) == 0); + QStringList args; + args << "open" << luks.m_devicePath << luks.m_mapper.m_dmName << "-q"; + return (Utils::executWithInputOutputCmd("cryptsetup", args, &luks.m_decryptStr, outPut, error) == 0); } bool LUKSOperator::testKey(const LUKS_INFO &luks) { QString outPut, error; - QString cmd = QString("cryptsetup open --test-passphrase %1 %2 -q") - .arg(luks.m_devicePath) - .arg(luks.m_mapper.m_dmName); - return (Utils::executWithInputOutputCmd(cmd, &luks.m_decryptStr, outPut, error) == 0); + QStringList args; + args << "open" << "--test-passphrase" << luks.m_devicePath << luks.m_mapper.m_dmName << "-q"; + return (Utils::executWithInputOutputCmd("cryptsetup", args, &luks.m_decryptStr, outPut, error) == 0); } bool LUKSOperator::close(const LUKS_INFO &luks) @@ -578,10 +576,9 @@ bool LUKSOperator::addKeyFile(const LUKS_INFO &luks) //添加key QString outPut, error; - cmd = QString("cryptsetup luksAddKey %1 %2 -q") - .arg(luks.m_devicePath) - .arg(filePath); - return (Utils::executWithInputOutputCmd(cmd, &luks.m_decryptStr, outPut, error) == 0); + QStringList args; + args << "luksAddKey" << luks.m_devicePath << filePath << "-q"; + return (Utils::executWithInputOutputCmd("cryptsetup", args, &luks.m_decryptStr, outPut, error) == 0); } bool LUKSOperator::deleteKeyFile(const LUKS_INFO &luks) diff --git a/service/diskoperation/partedcore.cpp b/service/diskoperation/partedcore.cpp index 89c72309..36838058 100644 --- a/service/diskoperation/partedcore.cpp +++ b/service/diskoperation/partedcore.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -131,21 +131,53 @@ HardDiskInfo PartedCore::getDeviceHardInfo(const QString &devicepath) } DeviceStorage device; - device.getDiskInfoFromHwinfo(devicepath); - device.getDiskInfoFromLshw(devicepath); + // Pre-execute commands that are redundantly called by multiple sub-functions, + // pass cached output via optional parameters to avoid duplicate execution. + QString smartctlAll; + { + QProcess proc; + proc.start(QString("smartctl --all %1").arg(devicepath)); + proc.waitForFinished(-1); + smartctlAll = proc.readAllStandardOutput(); + if (smartctlAll.contains("Please specify device type with the -d option")) { + proc.start(QString("smartctl --all -d sat %1").arg(devicepath)); + proc.waitForFinished(-1); + smartctlAll = proc.readAllStandardOutput(); + } + } + + QString hwinfoOutput; + { + QProcess proc; + proc.start(QString("hwinfo --disk --only %1").arg(devicepath)); + proc.waitForFinished(-1); + hwinfoOutput = proc.readAllStandardOutput(); + } + + QString lshwOutput; + { + QProcess proc; + proc.start("sudo lshw -C disk"); + proc.waitForFinished(-1); + lshwOutput = proc.readAllStandardOutput(); + } + + device.getDiskInfoFromHwinfo(devicepath, hwinfoOutput); + + device.getDiskInfoFromLshw(devicepath, lshwOutput); device.getDiskInfoFromLsblk(devicepath); - device.getDiskInfoFromSmartCtl(devicepath); + device.getDiskInfoFromSmartCtl(devicepath, smartctlAll); device.m_mediaType = device.getDiskInfoMediaType(devicepath); - device.getDiskInfoModel(devicepath, device.m_model); + device.getDiskInfoModel(devicepath, device.m_model, smartctlAll, lshwOutput); - device.getDiskInfoInterface(devicepath, device.m_interface, device.m_model); + device.getDiskInfoInterface(devicepath, device.m_interface, device.m_model, hwinfoOutput); - device.getDiskInfoFirmwareVersion(devicepath); + device.updateForHWDevice(devicepath); hdinfo.m_model = device.m_model; hdinfo.m_vendor = device.m_vendor; @@ -432,9 +464,10 @@ bool PartedCore::detectionPartitionTableError(const QString &devicePath) bool needRewrite = gptIsExpanded(devicePath); if (needRewrite) { QString outPutFix, errorFix; - QString cmdFix = QString("fdisk %1").arg(devicePath); - QString intPut("w"); - Utils::executWithInputOutputCmd(cmdFix, &intPut, outPutFix, errorFix); + QStringList args; + args << devicePath; + QString inPut("w\n"); + Utils::executWithInputOutputCmd("fdisk", args, &inPut, outPutFix, errorFix); qDebug() << __FUNCTION__ << "createPartition Partition Table Rewrite Done"; return false; } @@ -3336,9 +3369,10 @@ void PartedCore::reWritePartition(const QString &devicePath) bool needRewrite = gptIsExpanded(devicePath); if (needRewrite) { QString outPutFix, errorFix; - QString cmdFix = QString("fdisk %1").arg(devicePath); - QString intPut("w"); - Utils::executWithInputOutputCmd(cmdFix, &intPut, outPutFix, errorFix); + QStringList args; + args << devicePath; + QString inPut("w\n"); + Utils::executWithInputOutputCmd("fdisk", args, &inPut, outPutFix, errorFix); qDebug() << __FUNCTION__ << "createPartition Partition Table Rewrite Done"; return; } @@ -3795,65 +3829,7 @@ bool PartedCore::umontDevice(QVector mountPoints, QString devPath) bool PartedCore::writeFstab(const QString &uuid, const QString &mountpath, const QString &type, bool isMount) { - //写入fstab 永久挂载 - qDebug() << __FUNCTION__ << "Write fstab start"; - if (uuid.isEmpty() || (mountpath.isEmpty() && isMount) || type.isEmpty()) { //非挂载 不需要挂载点 可以传空值 - qDebug() << __FUNCTION__ << "Write fstabt argument error"; - return false; - } - - QFile file("/etc/fstab"); - QStringList list; - - // open fstab - if (!file.open(QIODevice::ReadOnly)) { //打开指定文件 - qDebug() << __FUNCTION__ << "Write fstabt: open file error"; - return false; - } - - //此处修改:因为mount读取/etc/fstab配置文件 开机自动挂载 而fat32或fat16 mount不识别,所以要改成vfat - QString type2 = (type.contains("fat32") || type.contains("fat16")) ? QString("vfat") : type; - - // read fstab - bool findflag = false; //目前默认只改第一个发现的uuid findflag 标志位:是否已经查找到uuid - while (!file.atEnd()) { - QByteArray line = file.readLine();//获取数据 - QString str = line; - if (isMount) { - //vfat 1051系统上vfat格式不指定utf8挂载 通过文件管理器右键菜单新建文件夹会乱码 导致创建错误 为了规避该问题加上utf8属性 - QString mountStr = (type2 == "vfat") ? QString("UUID=%1 %2 %3 defaults,nofail,utf8,dmask=000,fmask=111 0 0\n").arg(uuid).arg(mountpath).arg(type2) - : QString("UUID=%1 %2 %3 defaults,nofail 0 0\n").arg(uuid).arg(mountpath).arg(type2); - - if (str.contains(uuid) && !findflag) { //首次查找到uuid - findflag = true; - list << mountStr; - continue; - } else if (file.atEnd() && !findflag) { //查找到结尾且没有查找到uuid - list << str << mountStr; - break; - } - list << str; - } else { - if (!str.contains(uuid)) { - list << str; - } - } - } - file.close(); - - //write fstab - if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { - qDebug() << __FUNCTION__ << "Write fstabt: open file error"; - return false; - } - - QTextStream out(&file); - for (int i = 0; i < list.count(); i++) { - out << list.at(i); - } - out.flush(); - file.close(); - qDebug() << __FUNCTION__ << "Write fstabt end"; + /* 禁止修改 fstab 以避免干扰 udisks 运行 */ return true; } diff --git a/service/main.cpp b/service/main.cpp index 36e809f6..48705e0d 100644 --- a/service/main.cpp +++ b/service/main.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -10,19 +10,56 @@ #include #include #include +#include +#include #include +#include const QString DiskManagerServiceName = "com.deepin.diskmanager"; const QString DiskManagerPath = "/com/deepin/diskmanager"; -void checkFrontEndQuit(uint frontEndPid) +/** + * @brief 尝试停止已存在的 D-Bus 服务 + * @param systemBus D-Bus 连接 + * @return true 表示成功停止并可重新注册,false 表示失败 + * + * 通过 D-Bus 调用 Quit() 方法优雅退出,未使用 PID kill, + * 以避免 TOCTOU 竞态条件和 PID 复用带来的安全风险。 + * Quit() 调用后轮询等待 D-Bus 服务名称释放,确认服务已退出。 + */ +static bool stopExistingService(QDBusConnection &systemBus) { - QString frontEndExe = QString("/proc/%1/exe").arg(frontEndPid); - QFileInfo info(frontEndExe); + QDBusInterface existingService(DiskManagerServiceName, DiskManagerPath, "", systemBus); + if (!existingService.isValid()) { + qWarning() << "Cannot access existing service via D-Bus interface," + << "service may have already exited, retry registration"; + return true; + } + + qDebug() << "Calling Quit() on existing service..."; + QDBusPendingCall pendingCall = existingService.asyncCall("Quit"); + pendingCall.waitForFinished(); + if (pendingCall.isError()) { + qWarning() << "Quit() call failed:" << pendingCall.error().message(); + return false; + } - if (info.symLinkTarget() != "/usr/bin/deepin-diskmanager") { - QCoreApplication::exit(0); + // 轮询等待 D-Bus 服务名称释放,最多等待 3 秒 + qDebug() << "Quit() called successfully, waiting for service to exit..."; + const int maxWaitMs = 3000; + const int pollIntervalMs = 200; + for (int elapsed = 0; elapsed < maxWaitMs; elapsed += pollIntervalMs) { + usleep(pollIntervalMs * 1000); + // 通过尝试注册来判断名称是否已释放(注册后立即释放) + if (systemBus.registerService(DiskManagerServiceName)) { + systemBus.unregisterService(DiskManagerServiceName); + qDebug() << "Service name released after" << (elapsed + pollIntervalMs) << "ms"; + return true; + } } + + qWarning() << "Timed out waiting for existing service to exit"; + return false; } int main(int argc, char *argv[]) @@ -38,16 +75,10 @@ int main(int argc, char *argv[]) PATH += ":/sbin"; qputenv("PATH", PATH.toLatin1()); - uint frontEndPid; QString frontEndDBusName; - if (argc < 3) - return 1; - else { - QString frontEndPidString(argv[1]); - frontEndPid = frontEndPidString.toUInt(); - if (frontEndPid == 0) - return 1; - frontEndDBusName = QString(argv[2]); + if (argc >= 2) { + frontEndDBusName = QString(argv[1]); + qDebug() << "Received frontend DBus name:" << frontEndDBusName; } QCoreApplication a(argc, argv); @@ -78,7 +109,18 @@ int main(int argc, char *argv[]) QDBusConnection systemBus = QDBusConnection::systemBus(); if (!systemBus.registerService(DiskManagerServiceName)) { qCritical() << "registerService failed:" << systemBus.lastError(); - exit(0x0001); + // 服务名注册失败,通常是因为已有实例持有该名称,尝试停止它 + if (stopExistingService(systemBus)) { + qDebug() << "Retrying registerService after stopping existing service..."; + // 停止旧服务后重试注册 + if (!systemBus.registerService(DiskManagerServiceName)) { + qCritical() << "registerService failed even after stopping existing service"; + exit(0x0001); + } + } else { + qCritical() << "Failed to stop existing service"; + exit(0x0001); + } } DiskManager::DiskManagerService service(frontEndDBusName); qDebug() << "systemBus.registerService success" /*<< Dtk::Core::DLogManager::getlogFilePath()*/; @@ -86,23 +128,17 @@ int main(int argc, char *argv[]) &service, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals)) { qCritical() << "registerObject failed:" << systemBus.lastError(); - exit(0x0002); + exit(0x0002); } - QTimer timer; - QObject::connect(&timer, &QTimer::timeout, [frontEndPid] { - checkFrontEndQuit(frontEndPid); - }); - timer.start(1000); - /* * 启动一个线程监测前端是否运行: * 1 如果前端没有启动过,则后台保持运行 * 2 如果前端启动过,又退出了,则后台退出。这可能是因为用户从dock栏强杀了磁盘管理器。 */ - // DiskManager::Watcher m_watcher; - // QObject::connect(qApp, &QCoreApplication::aboutToQuit, &m_watcher, &DiskManager::Watcher::exit); - // m_watcher.start(); + DiskManager::Watcher m_watcher; + QObject::connect(qApp, &QCoreApplication::aboutToQuit, &m_watcher, &DiskManager::Watcher::exit); + m_watcher.start(); return a.exec(); } diff --git a/service/policy/com.deepin.diskmanager.policy b/service/policy/com.deepin.diskmanager.policy index e4a04732..93d67884 100755 --- a/service/policy/com.deepin.diskmanager.policy +++ b/service/policy/com.deepin.diskmanager.policy @@ -7,8 +7,8 @@ Run Disk Manager Need Authentication Authentication is required to read disk information - no - no + auth_admin + auth_admin auth_admin_keep /usr/bin/deepin-diskmanager-authenticateProxy diff --git a/service/watcher.cpp b/service/watcher.cpp index e937413e..969decb5 100644 --- a/service/watcher.cpp +++ b/service/watcher.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -11,24 +11,36 @@ #include #include #include +#include #include namespace DiskManager { /** - * @brief 执行外部命令 - * @param strCmd:外部命令字符串 - * @param outPut:命令控制台输出 - * @param error:错误信息 - * @return exitcode:退出码 + * @brief 检测前端进程 deepin-diskmanager 是否在运行 + * + * 仅启动 ps 一个子进程并在代码内完成过滤,避免使用 shell 解释器,也不再串联 awk/grep 子进程。 + * 等价于管道 `ps -eo cmd | grep -w deepin-diskmanager$`。 + * */ -void Watcher::executCmd(const QString &strCmd, QString &outPut, QString &error) +bool Watcher::isFrontEndRunning(QString &error) { - // QProcess proc; - // proc.start("b-a-s-h", QStringList() << "-c" << strCmd); - // proc.waitForFinished(-1); - // outPut = proc.readAllStandardOutput(); + QProcess proc; + proc.start("ps", QStringList() << "-eo" << "cmd"); + proc.waitForFinished(-1); + error = proc.readAllStandardError(); + + static const QRegularExpression rxMatch("(?:^|[^\\w])deepin-diskmanager$"); + const QStringList lines = QString::fromLocal8Bit(proc.readAllStandardOutput()).split('\n'); + for (const QString &line : lines) { + const QString exe = line.trimmed().section(' ', 0, 0, QString::SectionSkipEmpty); + if (rxMatch.match(exe).hasMatch()) { + return true; + } + } + + return false; } void Watcher::exit() @@ -41,18 +53,12 @@ void Watcher::exit() void Watcher::run() { bool isrun = false; - QString cmd, outPut, error; - //先判断后台服务进程是否存在,如果存在可能是强制退出导致,应先退出后台程序再重新启动磁盘管理器 - cmd = QString("ps -eo pid,cmd |awk '{print $2}' |grep -w deepin-diskmanager$"); + QString error; while (!stoped) { QThread::msleep(500); //0.5 second - executCmd(cmd, outPut, error); - int ret = 0; - ret = outPut.length(); - if (ret) { + if (isFrontEndRunning(error)) { //这里表示前端在运行当中 - // qDebug() << "Set to true!!!!!"; isrun = true; } else { //这里表示,前端启动过,但是现在已经关闭了 @@ -61,7 +67,6 @@ void Watcher::run() _exit(0); } } - // qDebug() << "Sleep !!! == " << ret << " " << outPut << " " << outPut.length() << " "<< error; } } diff --git a/service/watcher.h b/service/watcher.h index ca9bbd2c..26c65bcb 100644 --- a/service/watcher.h +++ b/service/watcher.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -24,7 +24,7 @@ class Watcher :public QThread */ void run(); - void executCmd(const QString &strCmd, QString &outPut, QString &error); + bool isFrontEndRunning(QString &error); public Q_SLOTS: void exit(); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1536473e..d9803cb7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,9 +25,11 @@ LIST(APPEND SRC_LIST ${UT_DISKOPERATION}) file(GLOB ALL_HEADERS "../service/diskoperation/*.h" "../service/diskoperation/filesystems/*.h") file(GLOB ALL_SOURCES "../service/diskoperation/*.cpp" "../service/diskoperation/filesystems/*.cpp") +find_package(DtkCore REQUIRED) + add_executable(${PROJECT_NAME_TEST} ${SRC_LIST} ${ALL_HEADERS} ${ALL_SOURCES}) -target_link_libraries(${PROJECT_NAME_TEST} gmock gmock_main gtest gtest_main pthread Qt5::Core basestruct parted parted-fs-resize) +target_link_libraries(${PROJECT_NAME_TEST} gmock gmock_main gtest gtest_main pthread Qt5::Core ${DtkCore_LIBRARIES} basestruct parted parted-fs-resize) # 添加 QTest 测试 add_test(${PROJECT_NAME_TEST} that-test-I-made COMMAND ${PROJECT_NAME_TEST}) diff --git a/test/ut_diskoperation/ut_devicestorage.cpp b/test/ut_diskoperation/ut_devicestorage.cpp new file mode 100644 index 00000000..df126a60 --- /dev/null +++ b/test/ut_diskoperation/ut_devicestorage.cpp @@ -0,0 +1,85 @@ +// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-only + +#include "gtest/gtest.h" + +#include "../../service/diskoperation/DeviceStorage.h" + +#include +#include + +using namespace DiskManager; + +namespace { + +class PathGuard +{ +public: + explicit PathGuard(const QString &path) + : m_oldPath(qgetenv("PATH")) + { + qputenv("PATH", QString("%1:%2").arg(path, QString::fromLocal8Bit(m_oldPath)).toLocal8Bit()); + } + + ~PathGuard() + { + qputenv("PATH", m_oldPath); + } + +private: + QByteArray m_oldPath; +}; + +void writeExecutable(const QString &filePath, const QByteArray &content) +{ + QFile file(filePath); + ASSERT_TRUE(file.open(QIODevice::WriteOnly | QIODevice::Truncate)); + ASSERT_EQ(file.write(content), content.size()); + file.close(); + ASSERT_TRUE(file.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner)); +} + +} // namespace + +class ut_devicestorage : public ::testing::Test +{ +}; + +TEST_F(ut_devicestorage, getDiskInfoInterface_usesAttachedToWhenCapacityFollows) +{ + QTemporaryDir dir; + ASSERT_TRUE(dir.isValid()); + writeExecutable(dir.filePath("hwinfo"), + "#!/bin/sh\n" + "printf '%s\\n' '10: None 00.0: 10600 Disk' " + "' Attached to: #1 (UFS 3.1 Controller)' " + "' Capacity: 1 TB (1024626524160 bytes)'\n"); + PathGuard guard(dir.path()); + + DeviceStorage storage; + QString interface; + QString model("__ut_nonexistent_model__"); + + storage.getDiskInfoInterface("/dev/__ut_nonexistent_pms372777_ufs__", interface, model); + + EXPECT_EQ(interface, "UFS"); +} + +TEST_F(ut_devicestorage, getDiskInfoInterface_ignoresCapacityBytesWhenInterfaceMissing) +{ + QTemporaryDir dir; + ASSERT_TRUE(dir.isValid()); + writeExecutable(dir.filePath("hwinfo"), + "#!/bin/sh\n" + "printf '%s\\n' ' Capacity: 1 TB (1024626524160 bytes)'\n"); + PathGuard guard(dir.path()); + + DeviceStorage storage; + QString interface; + QString model("__ut_nonexistent_model__"); + + storage.getDiskInfoInterface("/dev/__ut_nonexistent_pms372777_capacity__", interface, model); + + EXPECT_TRUE(interface.isEmpty()); +}