haiku/docs/userguide/zh_CN/attributes.html

178 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<!--
*
* Copyright 2008-2009, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Humdinger <humdingerb@gmail.com>
* Translators:
* Pengphei Han
* Humdinger
*
-->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="robots" content="all" />
<title>Attributes属性</title>
<link rel="stylesheet" type="text/css" href="../Haiku-doc.css" />
</head>
<body>
<div id="banner">
<div><span>用户指南</span></div>
</div>
<div class="nav">
<div class="inner">
<ul class="lang-menu">
<li class="now"><img src="../images/flags/zh_CN.png" alt="" />  中文 [中文]</li>
<li><a href="../fr/attributes.html"><img src="../images/flags/fr.png" alt="" />Français</a></li>
<li><a href="../de/attributes.html"><img src="../images/flags/de.png" alt="" />Deutsch</a></li>
<li><a href="../it/attributes.html"><img src="../images/flags/it.png" alt="" />Italiano</a></li>
<li><a href="../ru/attributes.html"><img src="../images/flags/ru.png" alt="" />Русский</a></li>
<li><a href="../es/attributes.html"><img src="../images/flags/es.png" alt="" />Español</a></li>
<li><a href="../sv_SE/attributes.html"><img src="../images/flags/sv_SE.png" alt="" />Svenska</a></li>
<li><a href="../jp/attributes.html"><img src="../images/flags/jp.png" alt="" />日本語</a></li>
<li><a href="../uk/attributes.html"><img src="../images/flags/uk.png" alt="" />Українська</a></li>
<li><a href="../pt_PT/attributes.html"><img src="../images/flags/pt_PT.png" alt="" />Português</a></li>
<li><a href="../fi/attributes.html"><img src="../images/flags/fi.png" alt="" />Suomi</a></li>
<li><a href="../sk/attributes.html"><img src="../images/flags/sk.png" alt="" />Slovenčina</a></li>
<li><a href="../hu/attributes.html"><img src="../images/flags/hu.png" alt="" />Magyar</a></li>
<li><a href="../pt_BR/attributes.html"><img src="../images/flags/pt_BR.png" alt="" />Português (Brazil)</a></li>
<li><a href="../ca/attributes.html"><img src="../images/flags/ca.png" alt="" />Català</a></li>
<li><a href="../pl/attributes.html"><img src="../images/flags/pl.png" alt="" />Polski</a></li>
<li><a href="../en/attributes.html"><img src="../images/flags/gb.png" alt="" />English</a></li>
</ul>
<span>
« <a href="filetypes.html">文件类型</a>
:: <a href="contents.html" class="uplink">内容</a>
:: <a href="index.html">索引</a> »
</span></div>
</div>
<div id="content">
<div>
<h1>Attributes属性</h1>
<p>属性是一些数据段,它们属于文件,但却不是文件的组成部分,例如:它们不计入文件的大小,而且可以在不改变文件本身的情况下,进行复制和修改。系统利用属性来储存文件信息,例如:文件大小,类型以及最近的修改日期。这与其他的系统和文件系统相类似。</p>
<p>所不同的是,您可以为文件添加任何类型的属性,并可以在 Tracker 窗口中显示和修改该属性。你只需要在文件类型中添加你所希望的属性类型(例如:字符串,整数或者时间),然后进行命名,给出相关的描述。</p>
<p>文件本身设置不需要任何的内容,请看下面 People 文件的例子:</p>
<img src="images/attributes-images/people.png" alt="people.png" />
<br />
<p>您可以看到,所有的零大小文件都有附加属性,而在 Tracker 中“John Nox” 的 E-mail 属性正在进行修改。</p>
<p>如果您对这些属性做出索引,类似于 PeopleEmail 或者音频文件默认的那样,它们在 Haiku 的快速查询系统中也可以查询到。</p>
<h2>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="attributes-tracker" name="attributes-tracker">Tracker中的属性</a></h2>
<p>属性的显示非常类似于数据库或者电子表格。利用Tracker你也可以选择显示哪些属性并依此来对文件进行分类。</p>
<p>为此,打开一个 Tracker 窗口,点击 <span class="menu">Attributes</span> 菜单,选择希望显示的属性。或者,右键点击列标题,然后在快捷菜单中标记该项目。您可以通过简单的拖拽来进行纵列排序;降序排列标题。最快的移除您不需要的列的方式是直接从窗口中移出该列。</p>
<p>双击标题中两个属性之间的竖线,可以自动地对列的宽度进行最佳的调整。</p>
<p>您可以通过点击列标题来进行升序或者降序的排列 您也可以在点击列标题的同时按下 <span class="key">SHIFT</span> 键来进行二次排序。 例如,你可以在联系人姓名排序的基础上,再次通过公司来对你的 People 文件进行排序。以上面的截图为例,在标题中,二次排序以较浅的颜色进行了标记。</p>
<p>属性的编辑和修改文件名一样简单:点击该项或者按 <span class="key">ALT</span> <span class="key">E</span> 键,然后使用 <span class="key">TAB</span><span class="key">SHIFT</span> <span class="key">TAB</span>键在属性之间移动。按下 <span class="key">ESC</span> 键,退出编辑状态,不执行修改。</p>
<h2>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="attributes-terminal" name="attributes-terminal">终端中的属性</a></h2>
<p>如果你喜欢使用命令行,或者计划使用脚本来处理较多的文件,那么在 Terminal 中有一些可用于控制属性的命令。</p>
<h3>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="listattr" name="listattr">listattr</a></h3>
<p><span class="cli">listattr</span> 命令列出了文件的属性,但不显示属性内容。</p>
<pre>usage: listattr 'filename' ['filename' ...]</pre>
<p>上面我们的截图中的例子:</p>
<pre class="terminal"> ~/people -&gt;listattr Clara\ Botters
File: Clara Botters
Type Size Name
----------- --------- -------------------------------
MIME String 21 "BEOS:TYPE"
Text 14 "META:name"
Text 6 "META:nickname"
Text 1 "META:company"
Text 18 "META:address"
Text 8 "META:city"
Text 1 "META:state"
Text 1 "META:zip"
Text 1 "META:country"
Text 1 "META:hphone"
Text 13 "META:wphone"
Text 1 "META:fax"
Text 19 "META:email"
Text 1 "META:url"
Text 5 "META:group"
Raw Data 20 "_trk/pinfo_le"
131 bytes total in attributes.</pre>
<p>除了所有的 "<tt>META:*</tt>" 属性用于显示联系方式,还有两个由系统管理的属性:</p>
<ul>
<li><p><tt>BEOS:TYPE</tt><acronym title="Multipurpose Internet Mail Extensions">MIME</acronym> 字符串的形式保存文件类型,保存于 "<tt>application/x-person</tt>" 。它决定了默认的图标以及当你双击打开该文件时所要运行的程序。</p></li>
<li><p>"<tt>_trk/pinfo_le</tt>" 是一个位置属性Tracker 可以通过它来跟踪文件图标的位置。</p></li></ul>
<div class="box-info">需要注意的是 "Clara" 之后的反斜杠。在 Terminal 中您必须 "避开" 特殊字符,例如 <tt>'"*\$?!</tt> ;同时,处于 "Clara" 和 "Botters" 之间的空格也属于此类字符。所以反斜杠真实的出现在空格字符之前,而不是 "Clara" 之后。</div>
<h3>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="catattr" name="catattr">catattr</a></h3>
<p><span class="cli">catattr</span> 命令显示了文件特有属性的内容。</p>
<pre>usage: catattr [--raw|-r] attr_name file1 [file2...]</pre>
<p>还是上面的例子:</p>
<pre class="terminal"> ~/people -&gt;catattr META:city Clara\ Botters
Clara Botters : string : Whelton</pre>
<h3>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="addattr" name="addattr">addattr</a></h3>
<p><span class="cli">addattr</span> 命令用于为文件添加属性,并进行赋值。</p>
<pre>usage: addattr [-t type] attr value file1 [file2...]
or: addattr [-f value-from-file] [-t type] attr file1 [file2...]
Type is one of:
string, mime, int, llong, float, double, bool, icon, raw
or a numeric value (ie. 0x1234, 42, 'ABCD', ...)
The default is "string"</pre>
<p>所以当亲爱的 Clara 在跨国公司 Barkelbaer Inc.找到了工作,你就可以为原本空白的 "Company" 属性补充该数据 (而此数据也属于 "string" 类型)</p>
<pre class="terminal"> ~/people -&gt;addattr -t string META:company Barkelbaer\ Inc. Clara\ Botters</pre>
<h3>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="rmattr" name="rmattr">rmattr</a></h3>
<p><span class="cli">rmattr</span> 命令用于从文件中完全移除其某一属性。</p>
<pre>usage: rmattr [-p] attr filename1 [filename2...]
'attr' is the name of an attribute of the file
If '-p' is specified, 'attr' is regarded as a pattern.</pre>
<p>即使不填写 "Fax" 属性,在实际应用中也已经足够了;所以你可以通过键入下面的命令来从 Clara 文件中完全删除它:</p>
<pre class="terminal"> ~/people -&gt;rmattr META:fax Clara\ Botters</pre>
<h3>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="copyattr" name="copyattr">copyattr</a></h3>
<p><span class="cli">copyattr</span> 命令用于从一些文件向另一些文件拷贝属性。默认情况下,文件的实际内容并<b>没有</b>进行拷贝。</p>
<pre>Usage: copyattr &lt;options&gt; &lt;source&gt; [ ... ] &lt;destination&gt;</pre>
<p>如果您希望完全拷贝文件的属性及其数据文件,你可以在命令后添加 "<span class="cli">-d</span>" 或者 "<span class="cli">--data</span>" 来完成。</p>
<p><br /></p>
<p> 更多有关这些命令和它们的参数选项的信息,您可以通过键入命令名,然后辅以 "<span class="cli">-h</span>" 或者 "<span class="cli">--help</span>" 选项来获取。</p>
</div>
</div>
<div class="nav">
<div class="inner"><span>
« <a href="filetypes.html">文件类型</a>
:: <a href="contents.html" class="uplink">内容</a>
:: <a href="index.html">索引</a> »
</span></div>
</div>
</body>
</html>