<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://techbase.kde.org/skins/common/feed.css?0.2"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;feed=atom&amp;action=history</id>
		<title>Development/Architecture/KDE4/Starting Other Programs (zh TW) - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;action=history"/>
		<updated>2013-05-21T10:28:59Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=48028&amp;oldid=prev</id>
		<title>Alisha at 07:05, 3 January 2010</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=48028&amp;oldid=prev"/>
				<updated>2010-01-03T07:05:13Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 07:05, 3 January 2010&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{Template:I18n/Language Navigation &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Bar&lt;/del&gt;|Development/Architecture/KDE4/Starting Other Programs}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{Template:I18n/Language Navigation &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Bar_(zh_TW)&lt;/ins&gt;|Development/Architecture/KDE4/Starting Other Programs}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''KDE 架構 - 啟動程式'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''KDE 架構 - 啟動程式'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alisha</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47212&amp;oldid=prev</id>
		<title>Alisha at 03:31, 3 December 2009</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47212&amp;oldid=prev"/>
				<updated>2009-12-03T03:31:16Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 03:31, 3 December 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== system ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== system ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Other than the reasons about why you should not use &lt;/del&gt;fork + exec&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, system is also synchronous, thus it will block the application that run it.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;除了不該使用 &lt;/ins&gt;fork + exec &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;的原因外，system 還有同步的問題，因此它會阻礙應用程式執行。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KProcess ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KProcess ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== klauncher ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== klauncher ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;klauncher will wait until the application registers to DBUS if the &lt;/del&gt;desktop &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;file specifies the &lt;/del&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html#_details X-DBUS-StartupType] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;key. This allows to make &lt;/del&gt;DBUS &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;calls to the application once &lt;/del&gt;startServiceByDesktopPath &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;returns, without the risk of race conditions. Note that klauncher needs to know under which name the application will register to &lt;/del&gt;DBUS&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;: by default that is assumed to be &lt;/del&gt;org.kde.&amp;lt;i&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;binaryname&lt;/del&gt;&amp;lt;/i&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, but you can configure this by setting &lt;/del&gt;X-DBUS-ServiceName &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;in the .desktop file. If you don't, you will get an error from klauncher which will think the application failed to start, since the expected &lt;/del&gt;dbus &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;name never showed up.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;如果 &lt;/ins&gt;desktop &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;檔指定了&lt;/ins&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html#_details X-DBUS-StartupType]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;鍵，那 KLauncher 將一直等到應用程式註冊到 &lt;/ins&gt;DBUS &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;上。一旦 &lt;/ins&gt;startServiceByDesktopPath &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;返回，DBUS才會呼叫用程式，而避免了競爭的風險。注意 KLauncher 需要知道應用程式註冊 &lt;/ins&gt;DBUS &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;的名稱；預設是 &lt;/ins&gt;org.kde.&amp;lt;i&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;二進位檔名&lt;/ins&gt;&amp;lt;/i&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;，但你也可以透過 .desktop 檔裡的 &lt;/ins&gt;X-DBUS-ServiceName &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;配置他。如果你不這麼做，KLauncher 會拋出一個錯誤，說這個應用程式無法啟動，因為期望的 &lt;/ins&gt;dbus &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;名稱沒有出現。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== kdeinit === &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== kdeinit === &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;klauncher &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;makes use of &lt;/del&gt;KDEinit &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;for increased startup performance and lower memory usage. These benefits only apply to applications available as &lt;/del&gt;KDEinit loadable &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;module (KLM).&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;klauncher &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;利用 &lt;/ins&gt;KDEinit &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;來提高啟動性能和降低記憶體使用量。這只適合應用程式可用於 &lt;/ins&gt;KDEinit loadable &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;module（KLM）時。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KRun ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KRun ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;打開文件、應用程式、Shell指令的一般方法。適當的使用 startServiceByDesktopPath，可以提供額外的啟動通知好處。&amp;lt;br/&amp;gt; [http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKRun.html KRun] 可以從二進位檔或 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;desktop檔啟動任何應用程式。他會判斷檔案的 &lt;/del&gt;MIME 類型，再執行最佳的處理方式，這同樣可以啟動 Shell &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;指令。This makes &lt;/del&gt;KRun &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the recommended way to run another program in KDE.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;打開文件、應用程式、Shell指令的一般方法。適當的使用 startServiceByDesktopPath，可以提供額外的啟動通知好處。&amp;lt;br/&amp;gt; [http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKRun.html KRun] 可以從二進位檔或 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;desktop 檔啟動任何應用程式。他會判斷檔案的 &lt;/ins&gt;MIME 類型，再執行最佳的處理方式，這同樣可以啟動 Shell &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;指令。這就是我們推薦使用 &lt;/ins&gt;KRun &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;執行其他程式的原因。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::invokeBrowser ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::invokeBrowser ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html KToolInvocation::invokeBrowser] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;launches a web browser. The difference with using the more generic KRun on the webpage &lt;/del&gt;URL &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is that &lt;/del&gt;KRun &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;has to determine the mimetype of the &lt;/del&gt;URL &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;first (which, for HTTP, involves starting a download to read the headers), so if you know that the &lt;/del&gt;URL &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is an &lt;/del&gt;HTML &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;webpage, use &lt;/del&gt;invokeBrowser&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, it will be faster.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html KToolInvocation::invokeBrowser] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;將啟動網頁瀏覽器。相較於通用性的 KRun，網頁 &lt;/ins&gt;URL &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;在 &lt;/ins&gt;KRun &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;會先測定 &lt;/ins&gt;URL &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;的 MIME類型（如果是HTTP，那麼他會開始下載，並讀取標頭）。如果你已經知道 &lt;/ins&gt;URL &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;是一個 &lt;/ins&gt;HTML &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;網頁，直接用 &lt;/ins&gt;invokeBrowser &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;會快很多。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;More details: the &lt;/del&gt;problem with KRun for webpages is that it delays the appearance of the&amp;#160; browser window, and if the user's preferred browser is a non-kde application like firefox then it has to start a second download while konqueror which can reuse the kioslave started by KRun. On the other hand if the URL might be an image or anything else than html, then KRun is the right solution, so that the right application is started.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;更多細節：the &lt;/ins&gt;problem with KRun for webpages is that it delays the appearance of the&amp;#160; browser window, and if the user's preferred browser is a non-kde application like firefox then it has to start a second download while konqueror which can reuse the kioslave started by KRun. On the other hand if the URL might be an image or anything else than html, then KRun is the right solution, so that the right application is started.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:KDE4]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:KDE4]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Architecture]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Architecture]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alisha</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47108&amp;oldid=prev</id>
		<title>Alisha at 15:49, 1 December 2009</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47108&amp;oldid=prev"/>
				<updated>2009-12-01T15:49:36Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:49, 1 December 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KRun ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KRun ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;打開文件、應用程式、Shell指令的一般方法。適當的使用 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;startServiceByDesktopPath，提供額外的啟動通知好處。&lt;/del&gt;&amp;lt;br/&amp;gt; [http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKRun.html KRun] 可以從二進位檔或 desktop檔啟動任何應用程式。他會判斷檔案的 MIME 類型，再執行最佳的處理方式，這同樣可以啟動 Shell 指令。This makes KRun the recommended way to run another program in KDE.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;打開文件、應用程式、Shell指令的一般方法。適當的使用 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;startServiceByDesktopPath，可以提供額外的啟動通知好處。&lt;/ins&gt;&amp;lt;br/&amp;gt; [http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKRun.html KRun] 可以從二進位檔或 desktop檔啟動任何應用程式。他會判斷檔案的 MIME 類型，再執行最佳的處理方式，這同樣可以啟動 Shell 指令。This makes KRun the recommended way to run another program in KDE.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::invokeBrowser ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::invokeBrowser ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alisha</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47107&amp;oldid=prev</id>
		<title>Alisha at 15:48, 1 December 2009</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47107&amp;oldid=prev"/>
				<updated>2009-12-01T15:48:34Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:48, 1 December 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== fork + exec ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== fork + exec ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;You never want to use this unless you have a very good reason why it is impossible to use &lt;/del&gt;KProcess&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;不要使用他們。除非你有很好的理由，是不能使用 &lt;/ins&gt;KProcess &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;的。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== system ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== system ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KProcess ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KProcess ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;You want to use &lt;/del&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKProcess.html KProcess] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;class if you need to start a new process which needs to be a child of your process, e.g. because you want to catch &lt;/del&gt;stdout/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;stderr or need to send it data via &lt;/del&gt;stdin&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. You should never use this to start other &lt;/del&gt;KDE &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;applications (unless your application is a debugger &lt;/del&gt;:-)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;只有在你要啟動子行程（process）的時候，才使用&lt;/ins&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKProcess.html KProcess]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;。例如，你要取得 &lt;/ins&gt;stdout/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;stderr或需要透過 &lt;/ins&gt;stdin &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;發送資料。您不應該用它來啟動其他 &lt;/ins&gt;KDE &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;應用程式（除非您的應用程式是除錯器 &lt;/ins&gt;:-)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::startServiceByDesktopPath ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::startServiceByDesktopPath ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html KToolInvocation::startServiceByDesktopPath] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is the preferred way to launch desktop (KDE&lt;/del&gt;/Gnome/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;X) applications or &lt;/del&gt;KDE &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;services. The application/service must have a &lt;/del&gt;.desktop &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;file, and you must know the name of that file. KToolInvocation asks the klauncher process, via &lt;/del&gt;DBUS&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, to start the program. &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html KToolInvocation::startServiceByDesktopPath] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;是啟動桌面（KDE&lt;/ins&gt;/Gnome/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;X）應用程式或 &lt;/ins&gt;KDE &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;服務的最佳方式。應用程式或服務必須有 &lt;/ins&gt;.desktop &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;檔，而且你必須知道檔名。KToolInvocation 會經由 &lt;/ins&gt;DBUS &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;告訴 KLauncher 行程要啟動應用程式。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== klauncher ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== klauncher ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;klauncher will wait until the application registers to DBUS if the desktop file specifies the [http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html#_details X-DBUS-StartupType] key. This allows to make DBUS calls to the application once startServiceByDesktopPath returns, without the risk of race conditions. Note that klauncher needs to know under which name the application will register to DBUS: by default that is assumed to be org.kde.&amp;lt;i&amp;gt;binaryname&amp;lt;/i&amp;gt;, but you can configure this by setting X-DBUS-ServiceName in the .desktop file. If you don't, you will get an error from klauncher which will think the application failed to start, since the expected dbus name never showed up.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;klauncher will wait until the application registers to DBUS if the desktop file specifies the [http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html#_details X-DBUS-StartupType] key. This allows to make DBUS calls to the application once startServiceByDesktopPath returns, without the risk of race conditions. Note that klauncher needs to know under which name the application will register to DBUS: by default that is assumed to be org.kde.&amp;lt;i&amp;gt;binaryname&amp;lt;/i&amp;gt;, but you can configure this by setting X-DBUS-ServiceName in the .desktop file. If you don't, you will get an error from klauncher which will think the application failed to start, since the expected dbus name never showed up.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== kdeinit === &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== kdeinit === &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;klauncher makes use of KDEinit for increased startup performance and lower memory usage. These benefits only apply to applications available as KDEinit loadable module (KLM).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;klauncher makes use of KDEinit for increased startup performance and lower memory usage. These benefits only apply to applications available as KDEinit loadable module (KLM).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KRun ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KRun ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Generic way to open documents/applications/shell commands. Uses startServiceByDesktopPath where applicable. Offers the additional benefit of startup-notification.&lt;/del&gt;&amp;lt;br/&amp;gt; [http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKRun.html KRun] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;can start any application, from the binary or the desktop file, it will determine the mimetype of a file before running the preferred handler for it, and it can also start shell commands. This &lt;/del&gt;makes KRun the recommended way to run another program in KDE.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;打開文件、應用程式、Shell指令的一般方法。適當的使用 startServiceByDesktopPath，提供額外的啟動通知好處。&lt;/ins&gt;&amp;lt;br/&amp;gt; [http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKRun.html KRun] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;可以從二進位檔或 desktop檔啟動任何應用程式。他會判斷檔案的 MIME 類型，再執行最佳的處理方式，這同樣可以啟動 Shell 指令。This &lt;/ins&gt;makes KRun the recommended way to run another program in KDE.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::invokeBrowser ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== KToolInvocation::invokeBrowser ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wwwdeveloper:diff:version:1.11a:oldid:47101:newid:47107 --&gt;
&lt;/table&gt;</summary>
		<author><name>Alisha</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47101&amp;oldid=prev</id>
		<title>Alisha: Created page with '{{Template:I18n/Language Navigation Bar|Development/Architecture/KDE4/Starting Other Programs}}  '''KDE 架構 - 啟動程式'''  在 KDE 中，有許多方法可以讓您的應...'</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Architecture/KDE4/Starting_Other_Programs_(zh_TW)&amp;diff=47101&amp;oldid=prev"/>
				<updated>2009-12-01T15:09:03Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{{Template:I18n/Language Navigation Bar|Development/Architecture/KDE4/Starting Other Programs}}  &amp;#039;&amp;#039;&amp;#039;KDE 架構 - 啟動程式&amp;#039;&amp;#039;&amp;#039;  在 KDE 中，有許多方法可以讓您的應...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Template:I18n/Language Navigation Bar|Development/Architecture/KDE4/Starting Other Programs}}&lt;br /&gt;
&lt;br /&gt;
'''KDE 架構 - 啟動程式'''&lt;br /&gt;
&lt;br /&gt;
在 KDE 中，有許多方法可以讓您的應用程式啟動其他程式。這裡總結了一些你應該和不應該使用的方法和理由。&lt;br /&gt;
&lt;br /&gt;
== fork + exec ==&lt;br /&gt;
You never want to use this unless you have a very good reason why it is impossible to use KProcess.&lt;br /&gt;
&lt;br /&gt;
== system ==&lt;br /&gt;
Other than the reasons about why you should not use fork + exec, system is also synchronous, thus it will block the application that run it.&lt;br /&gt;
&lt;br /&gt;
== KProcess ==&lt;br /&gt;
You want to use [http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKProcess.html KProcess] class if you need to start a new process which needs to be a child of your process, e.g. because you want to catch stdout/stderr or need to send it data via stdin. You should never use this to start other KDE applications (unless your application is a debugger :-)&lt;br /&gt;
&lt;br /&gt;
== KToolInvocation::startServiceByDesktopPath ==&lt;br /&gt;
[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html KToolInvocation::startServiceByDesktopPath] is the preferred way to launch desktop (KDE/Gnome/X) applications or KDE services. The application/service must have a .desktop file, and you must know the name of that file. KToolInvocation asks the klauncher process, via DBUS, to start the program. &lt;br /&gt;
=== klauncher ===&lt;br /&gt;
klauncher will wait until the application registers to DBUS if the desktop file specifies the [http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html#_details X-DBUS-StartupType] key. This allows to make DBUS calls to the application once startServiceByDesktopPath returns, without the risk of race conditions. Note that klauncher needs to know under which name the application will register to DBUS: by default that is assumed to be org.kde.&amp;lt;i&amp;gt;binaryname&amp;lt;/i&amp;gt;, but you can configure this by setting X-DBUS-ServiceName in the .desktop file. If you don't, you will get an error from klauncher which will think the application failed to start, since the expected dbus name never showed up.&lt;br /&gt;
=== kdeinit === &lt;br /&gt;
klauncher makes use of KDEinit for increased startup performance and lower memory usage. These benefits only apply to applications available as KDEinit loadable module (KLM).&lt;br /&gt;
&lt;br /&gt;
== KRun ==&lt;br /&gt;
Generic way to open documents/applications/shell commands. Uses startServiceByDesktopPath where applicable. Offers the additional benefit of startup-notification.&amp;lt;br/&amp;gt; [http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKRun.html KRun] can start any application, from the binary or the desktop file, it will determine the mimetype of a file before running the preferred handler for it, and it can also start shell commands. This makes KRun the recommended way to run another program in KDE.&lt;br /&gt;
&lt;br /&gt;
== KToolInvocation::invokeBrowser ==&lt;br /&gt;
[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKToolInvocation.html KToolInvocation::invokeBrowser] launches a web browser. The difference with using the more generic KRun on the webpage URL is that KRun has to determine the mimetype of the URL first (which, for HTTP, involves starting a download to read the headers), so if you know that the URL is an HTML webpage, use invokeBrowser, it will be faster.&lt;br /&gt;
&lt;br /&gt;
More details: the problem with KRun for webpages is that it delays the appearance of the  browser window, and if the user's preferred browser is a non-kde application like firefox then it has to start a second download while konqueror which can reuse the kioslave started by KRun. On the other hand if the URL might be an image or anything else than html, then KRun is the right solution, so that the right application is started.&lt;br /&gt;
&lt;br /&gt;
[[Category:KDE4]]&lt;br /&gt;
[[Category:Architecture]]&lt;/div&gt;</summary>
		<author><name>Alisha</name></author>	</entry>

	</feed>