Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > d0c58635c3fcc548e9b6ce88c8980028 > files > 1798

lib64kdebase4-devel-3.4.2-55.5.20060mdk.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  <title>kwin Library: main.cpp Source File (kwin Library)</title>
  <link href="../../common/doxygen.css" rel="stylesheet" type="text/css">
</head>
<div class="header">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" width="92">
<a href="../../index.html" title="The API documentation main page"><img src="../../common/docheadergears.png" style="border:0px;" alt=""></a>
</td>
<td width="95%">
<h1>kwin Library API Documentation</h1>
</td>
</tr>
<tr>
<td valign="bottom">
<table class="links" border=0 cellspacing=0>
<tr>
<td><a href="index.html">Overview</a></td>
<td><a href="hierarchy.html" title="Inheritance list, sorted roughly  alphabetically">Class&nbsp;Hierarchy</a></td>
<td><a href="classes.html" title="Alphabetical list of classes">Classes</a></td>
<td><a href="annotated.html" title="Classes, structs, unions and interfaces with brief descriptions">Classes&nbsp;(annotated)</a></td>
<td><a href="functions.html" title="Documented class members with links to the classes they belong to">Members</a></td>
<td><a href="namespaces.html" title="All documented namespaces with brief descriptions">Namespaces</a></td>
<td><a href="files.html" title="A list of all documented files with brief descriptions">Source&nbsp;Files</a></td>
</tr>
</table>
</td></tr></table>
</div>
<div id="hgrad"></div>
<div class="text">
<!-- Generated by Doxygen 1.4.4 -->
<div class="nav">
<a class="el" href="dir_000003.html">kcmkwin</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000016.html">kwinrules</a></div>
<h1>kcmkwin/kwinrules/main.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (c) 2004 Lubos Lunak &lt;l.lunak@kde.org&gt;</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> *  This program is free software; you can redistribute it and/or modify</span>
<a name="l00005"></a>00005 <span class="comment"> *  it under the terms of the GNU General Public License as published by</span>
<a name="l00006"></a>00006 <span class="comment"> *  the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00007"></a>00007 <span class="comment"> *  (at your option) any later version.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> *  This program is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment"> *  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment"> *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00012"></a>00012 <span class="comment"> *  GNU General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> *  You should have received a copy of the GNU General Public License</span>
<a name="l00015"></a>00015 <span class="comment"> *  along with this program; if not, write to the Free Software</span>
<a name="l00016"></a>00016 <span class="comment"> *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span>
<a name="l00017"></a>00017 <span class="comment"> */</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;kcmdlineargs.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;kapplication.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;dcopclient.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;kconfig.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;klocale.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;kwin.h&gt;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;X11/Xlib.h&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;fixx11h.h&gt;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#include "ruleswidget.h"</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include "../../rules.h"</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keyword">namespace </span>KWinInternal
<a name="l00033"></a>00033 {
<a name="l00034"></a>00034 
<a name="l00035"></a><a class="code" href="namespaceKWinInternal.html#a75">00035</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="namespaceKWinInternal.html#a75">loadRules</a>( QValueList&lt; Rules* &gt;&amp; rules )
<a name="l00036"></a>00036     {
<a name="l00037"></a>00037     KConfig cfg( <span class="stringliteral">"kwinrulesrc"</span>, <span class="keyword">true</span> );
<a name="l00038"></a>00038     cfg.setGroup( <span class="stringliteral">"General"</span> );
<a name="l00039"></a>00039     <span class="keywordtype">int</span> count = cfg.readNumEntry( <span class="stringliteral">"count"</span> );
<a name="l00040"></a>00040     <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 1;
<a name="l00041"></a>00041          i &lt;= count;
<a name="l00042"></a>00042          ++i )
<a name="l00043"></a>00043         {
<a name="l00044"></a>00044         cfg.setGroup( QString::number( i ));
<a name="l00045"></a>00045         <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* rule = <span class="keyword">new</span> <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>( cfg );
<a name="l00046"></a>00046         rules.append( rule );
<a name="l00047"></a>00047         }
<a name="l00048"></a>00048     }
<a name="l00049"></a>00049 
<a name="l00050"></a><a class="code" href="namespaceKWinInternal.html#a76">00050</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="namespaceKWinInternal.html#a76">saveRules</a>( <span class="keyword">const</span> QValueList&lt; Rules* &gt;&amp; rules )
<a name="l00051"></a>00051     {
<a name="l00052"></a>00052     KConfig cfg( <span class="stringliteral">"kwinrulesrc"</span> );
<a name="l00053"></a>00053     cfg.setGroup( <span class="stringliteral">"General"</span> );
<a name="l00054"></a>00054     cfg.writeEntry( <span class="stringliteral">"count"</span>, rules.count());
<a name="l00055"></a>00055     <span class="keywordtype">int</span> i = 1;
<a name="l00056"></a>00056     <span class="keywordflow">for</span>( QValueList&lt; Rules* &gt;::ConstIterator it = rules.begin();
<a name="l00057"></a>00057          it != rules.end();
<a name="l00058"></a>00058          ++it )
<a name="l00059"></a>00059         {
<a name="l00060"></a>00060         cfg.setGroup( QString::number( i ));
<a name="l00061"></a>00061         (*it)-&gt;write( cfg );
<a name="l00062"></a>00062         ++i;
<a name="l00063"></a>00063         }
<a name="l00064"></a>00064     }
<a name="l00065"></a>00065 
<a name="l00066"></a><a class="code" href="namespaceKWinInternal.html#a77">00066</a> <span class="keyword">static</span> <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* <a class="code" href="namespaceKWinInternal.html#a77">findRule</a>( <span class="keyword">const</span> QValueList&lt; Rules* &gt;&amp; rules, Window wid )
<a name="l00067"></a>00067     {
<a name="l00068"></a>00068     KWin::WindowInfo info = KWin::windowInfo( wid,
<a name="l00069"></a>00069         NET::WMName | NET::WMWindowType,
<a name="l00070"></a>00070         NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2ClientMachine );
<a name="l00071"></a>00071     <span class="keywordflow">if</span>( !info.valid()) <span class="comment">// shouldn't really happen</span>
<a name="l00072"></a>00072         <span class="keywordflow">return</span> NULL;
<a name="l00073"></a>00073     QCString wmclass_class = info.windowClassClass().lower();
<a name="l00074"></a>00074     QCString wmclass_name = info.windowClassName().lower();
<a name="l00075"></a>00075     QCString role = info.windowRole().lower();
<a name="l00076"></a>00076     NET::WindowType type = info.windowType( NET::NormalMask | NET::DesktopMask | NET::DockMask
<a name="l00077"></a>00077         | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask
<a name="l00078"></a>00078         | NET::UtilityMask | NET::SplashMask );
<a name="l00079"></a>00079     QString title = info.name();
<a name="l00080"></a>00080 <span class="comment">//    QCString extrarole = ""; // TODO</span>
<a name="l00081"></a>00081     QCString machine = info.clientMachine().lower();
<a name="l00082"></a>00082     <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* best_match = NULL;
<a name="l00083"></a>00083     <span class="keywordtype">int</span> match_quality = 0;
<a name="l00084"></a>00084     <span class="keywordflow">for</span>( QValueList&lt; Rules* &gt;::ConstIterator it = rules.begin();
<a name="l00085"></a>00085          it != rules.end();
<a name="l00086"></a>00086          ++it )
<a name="l00087"></a>00087         {
<a name="l00088"></a>00088         <span class="comment">// try to find an exact match, i.e. not a generic rule</span>
<a name="l00089"></a>00089         <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* rule = *it;
<a name="l00090"></a>00090         <span class="keywordtype">int</span> quality = 0;
<a name="l00091"></a>00091         <span class="keywordtype">bool</span> generic = <span class="keyword">true</span>;
<a name="l00092"></a>00092         <span class="keywordflow">if</span>( rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r3">wmclassmatch</a> != Rules::ExactMatch )
<a name="l00093"></a>00093             <span class="keywordflow">continue</span>; <span class="comment">// too generic</span>
<a name="l00094"></a>00094         <span class="keywordflow">if</span>( !rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#d1">matchWMClass</a>( wmclass_class, wmclass_name ))
<a name="l00095"></a>00095             <span class="keywordflow">continue</span>;
<a name="l00096"></a>00096         <span class="comment">// from now on, it matches the app - now try to match for a specific window</span>
<a name="l00097"></a>00097         <span class="keywordflow">if</span>( rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r4">wmclasscomplete</a> )
<a name="l00098"></a>00098             {
<a name="l00099"></a>00099             quality += 1;
<a name="l00100"></a>00100             generic = <span class="keyword">false</span>;  <span class="comment">// this can be considered specific enough (old X apps)</span>
<a name="l00101"></a>00101             }
<a name="l00102"></a>00102         <span class="keywordflow">if</span>( rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r6">windowrolematch</a> != Rules::UnimportantMatch )
<a name="l00103"></a>00103             {
<a name="l00104"></a>00104             quality += rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r6">windowrolematch</a> == Rules::ExactMatch ? 5 : 1;
<a name="l00105"></a>00105             generic = <span class="keyword">false</span>;
<a name="l00106"></a>00106             }
<a name="l00107"></a>00107         <span class="keywordflow">if</span>( rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r8">titlematch</a> != Rules::UnimportantMatch )
<a name="l00108"></a>00108             {
<a name="l00109"></a>00109             quality += rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r8">titlematch</a> == Rules::ExactMatch ? 3 : 1;
<a name="l00110"></a>00110             generic = <span class="keyword">false</span>;
<a name="l00111"></a>00111             }
<a name="l00112"></a>00112         <span class="keywordflow">if</span>( rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> != NET::AllTypesMask )
<a name="l00113"></a>00113             {
<a name="l00114"></a>00114             <span class="keywordtype">int</span> bits = 0;
<a name="l00115"></a>00115             <span class="keywordflow">for</span>( <span class="keywordtype">int</span> bit = 1;
<a name="l00116"></a>00116                  bit &lt; 1 &lt;&lt; 31;
<a name="l00117"></a>00117                  bit &lt;&lt;= 1 )
<a name="l00118"></a>00118                 <span class="keywordflow">if</span>( rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> &amp; bit )
<a name="l00119"></a>00119                     ++bits;
<a name="l00120"></a>00120             <span class="keywordflow">if</span>( bits == 1 )
<a name="l00121"></a>00121                 quality += 2;
<a name="l00122"></a>00122             }
<a name="l00123"></a>00123         <span class="keywordflow">if</span>( generic ) <span class="comment">// ignore generic rules, use only the ones that are for this window</span>
<a name="l00124"></a>00124             <span class="keywordflow">continue</span>;
<a name="l00125"></a>00125         <span class="keywordflow">if</span>( !rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#d0">matchType</a>( type )
<a name="l00126"></a>00126             || !rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#d2">matchRole</a>( role )
<a name="l00127"></a>00127             || !rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#d3">matchTitle</a>( title )
<a name="l00128"></a>00128             || !rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#d4">matchClientMachine</a>( machine ))
<a name="l00129"></a>00129             <span class="keywordflow">continue</span>;
<a name="l00130"></a>00130         <span class="keywordflow">if</span>( quality &gt; match_quality )
<a name="l00131"></a>00131             {
<a name="l00132"></a>00132             best_match = rule;
<a name="l00133"></a>00133             match_quality = quality;
<a name="l00134"></a>00134             }
<a name="l00135"></a>00135         }
<a name="l00136"></a>00136     <span class="keywordflow">if</span>( best_match != NULL )
<a name="l00137"></a>00137         <span class="keywordflow">return</span> best_match;
<a name="l00138"></a>00138     <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* ret = <span class="keyword">new</span> <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>;
<a name="l00139"></a>00139     ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r1">description</a> = i18n( <span class="stringliteral">"Settings for %1"</span> ).arg( wmclass_class );
<a name="l00140"></a>00140     <span class="keywordflow">if</span>( type == NET::Unknown )
<a name="l00141"></a>00141         ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> = NET::NormalMask;
<a name="l00142"></a>00142     <span class="keywordflow">else</span>
<a name="l00143"></a>00143         ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r13">types</a> = 1 &lt;&lt; type; <span class="comment">// convert type to its mask</span>
<a name="l00144"></a>00144     ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r7">title</a> = title; <span class="comment">// set, but make unimportant</span>
<a name="l00145"></a>00145     ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r8">titlematch</a> = Rules::UnimportantMatch;
<a name="l00146"></a>00146     ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r11">clientmachine</a> = machine; <span class="comment">// set, but make unimportant</span>
<a name="l00147"></a>00147     ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r12">clientmachinematch</a> = Rules::UnimportantMatch;
<a name="l00148"></a>00148 <span class="comment">//    ret-&gt;extrarole = extra; TODO</span>
<a name="l00149"></a>00149     ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r10">extrarolematch</a> = Rules::UnimportantMatch;
<a name="l00150"></a>00150     <span class="keywordflow">if</span>( !role.isEmpty()
<a name="l00151"></a>00151         &amp;&amp; role != <span class="stringliteral">"unknown"</span> &amp;&amp; role != <span class="stringliteral">"unnamed"</span> ) <span class="comment">// Qt sets this if not specified</span>
<a name="l00152"></a>00152         {
<a name="l00153"></a>00153         ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r5">windowrole</a> = role;
<a name="l00154"></a>00154         ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r6">windowrolematch</a> = Rules::ExactMatch;
<a name="l00155"></a>00155         <span class="keywordflow">if</span>( wmclass_name == wmclass_class )
<a name="l00156"></a>00156             {
<a name="l00157"></a>00157             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r4">wmclasscomplete</a> = <span class="keyword">false</span>;
<a name="l00158"></a>00158             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r2">wmclass</a> = wmclass_class;
<a name="l00159"></a>00159             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r3">wmclassmatch</a> = Rules::ExactMatch;
<a name="l00160"></a>00160             }
<a name="l00161"></a>00161         <span class="keywordflow">else</span>
<a name="l00162"></a>00162             {
<a name="l00163"></a>00163             <span class="comment">// WM_CLASS components differ - perhaps the app got -name argument</span>
<a name="l00164"></a>00164             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r4">wmclasscomplete</a> = <span class="keyword">true</span>;
<a name="l00165"></a>00165             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r2">wmclass</a> = wmclass_name + <span class="charliteral">' '</span> + wmclass_class;
<a name="l00166"></a>00166             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r3">wmclassmatch</a> = Rules::ExactMatch;
<a name="l00167"></a>00167             }
<a name="l00168"></a>00168         }
<a name="l00169"></a>00169     <span class="keywordflow">else</span> <span class="comment">// no role set</span>
<a name="l00170"></a>00170         {
<a name="l00171"></a>00171         <span class="keywordflow">if</span>( wmclass_name != wmclass_class )
<a name="l00172"></a>00172             {
<a name="l00173"></a>00173             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r4">wmclasscomplete</a> = <span class="keyword">true</span>;
<a name="l00174"></a>00174             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r2">wmclass</a> = wmclass_name + <span class="charliteral">' '</span> + wmclass_class;
<a name="l00175"></a>00175             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r3">wmclassmatch</a> = Rules::ExactMatch;
<a name="l00176"></a>00176             }
<a name="l00177"></a>00177         <span class="keywordflow">else</span>
<a name="l00178"></a>00178             {
<a name="l00179"></a>00179             <span class="comment">// This is a window that has no role set, and both components of WM_CLASS</span>
<a name="l00180"></a>00180             <span class="comment">// match (possibly only differing in case), which most likely means either</span>
<a name="l00181"></a>00181             <span class="comment">// the application doesn't give a damn about distinguishing its various</span>
<a name="l00182"></a>00182             <span class="comment">// windows, or it's an app that uses role for that, but this window</span>
<a name="l00183"></a>00183             <span class="comment">// lacks it for some reason. Use non-complete WM_CLASS matching, also</span>
<a name="l00184"></a>00184             <span class="comment">// include window title in the matching, and pray it causes many more positive</span>
<a name="l00185"></a>00185             <span class="comment">// matches than negative matches.</span>
<a name="l00186"></a>00186             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r8">titlematch</a> = Rules::ExactMatch;
<a name="l00187"></a>00187             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r4">wmclasscomplete</a> = <span class="keyword">false</span>;
<a name="l00188"></a>00188             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r2">wmclass</a> = wmclass_class;
<a name="l00189"></a>00189             ret-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#r3">wmclassmatch</a> = Rules::ExactMatch;
<a name="l00190"></a>00190             }
<a name="l00191"></a>00191         }
<a name="l00192"></a>00192     <span class="keywordflow">return</span> ret;
<a name="l00193"></a>00193     }
<a name="l00194"></a>00194 
<a name="l00195"></a><a class="code" href="namespaceKWinInternal.html#a78">00195</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="namespaceKWinInternal.html#a78">edit</a>( Window wid )
<a name="l00196"></a>00196     {
<a name="l00197"></a>00197     QValueList&lt; Rules* &gt; rules;
<a name="l00198"></a>00198     <a class="code" href="namespaceKWinInternal.html#a75">loadRules</a>( rules );
<a name="l00199"></a>00199     <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* orig_rule = <a class="code" href="namespaceKWinInternal.html#a77">findRule</a>( rules, wid );
<a name="l00200"></a>00200     <a class="code" href="classKWinInternal_1_1RulesDialog.html">RulesDialog</a> dlg;
<a name="l00201"></a>00201     <span class="comment">// dlg.edit() creates new Rules instance if edited</span>
<a name="l00202"></a>00202     <a class="code" href="classKWinInternal_1_1Rules.html">Rules</a>* edited_rule = dlg.<a class="code" href="classKWinInternal_1_1RulesDialog.html#a1">edit</a>( orig_rule, wid );
<a name="l00203"></a>00203     <span class="keywordflow">if</span>( edited_rule == NULL || edited_rule-&gt;<a class="code" href="classKWinInternal_1_1Rules.html#a4">isEmpty</a>())
<a name="l00204"></a>00204         {
<a name="l00205"></a>00205         rules.remove( orig_rule );
<a name="l00206"></a>00206         <span class="keyword">delete</span> orig_rule;
<a name="l00207"></a>00207         <span class="keywordflow">if</span>( orig_rule != edited_rule )
<a name="l00208"></a>00208             <span class="keyword">delete</span> edited_rule;
<a name="l00209"></a>00209         }
<a name="l00210"></a>00210     <span class="keywordflow">else</span> <span class="keywordflow">if</span>( edited_rule != orig_rule )
<a name="l00211"></a>00211         {
<a name="l00212"></a>00212         QValueList&lt; Rules* &gt;::Iterator pos = rules.find( orig_rule );
<a name="l00213"></a>00213         <span class="keywordflow">if</span>( pos != rules.end())
<a name="l00214"></a>00214             *pos = edited_rule;
<a name="l00215"></a>00215         <span class="keywordflow">else</span>
<a name="l00216"></a>00216             rules.prepend( edited_rule );
<a name="l00217"></a>00217         <span class="keyword">delete</span> orig_rule;
<a name="l00218"></a>00218         }
<a name="l00219"></a>00219     <a class="code" href="namespaceKWinInternal.html#a76">saveRules</a>( rules );
<a name="l00220"></a>00220     <span class="keywordflow">if</span>( !kapp-&gt;dcopClient()-&gt;isAttached())
<a name="l00221"></a>00221         kapp-&gt;dcopClient()-&gt;attach();
<a name="l00222"></a>00222     kapp-&gt;dcopClient()-&gt;send(<span class="stringliteral">"kwin*"</span>, <span class="stringliteral">""</span>, <span class="stringliteral">"reconfigure()"</span>, <span class="stringliteral">""</span>);
<a name="l00223"></a>00223     <span class="keywordflow">return</span> 0;
<a name="l00224"></a>00224     }
<a name="l00225"></a>00225     
<a name="l00226"></a>00226 } <span class="comment">// namespace</span>
<a name="l00227"></a>00227 
<a name="l00228"></a>00228 <span class="keyword">static</span> <span class="keyword">const</span> KCmdLineOptions options[] =
<a name="l00229"></a>00229     {
<a name="l00230"></a>00230     <span class="comment">// no need for I18N_NOOP(), this is not supposed to be used directly</span>
<a name="l00231"></a>00231         { <span class="stringliteral">"wid &lt;wid&gt;"</span>, <span class="stringliteral">"WId of the window for special window settings."</span>, 0 },
<a name="l00232"></a>00232         KCmdLineLastOption
<a name="l00233"></a>00233     };
<a name="l00234"></a>00234 
<a name="l00235"></a>00235 <span class="keyword">extern</span> <span class="stringliteral">"C"</span>
<a name="l00236"></a>00236 KDE_EXPORT <span class="keywordtype">int</span> kdemain( <span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[] )
<a name="l00237"></a>00237     {
<a name="l00238"></a>00238     KLocale::setMainCatalogue( <span class="stringliteral">"kcmkwinrules"</span> );
<a name="l00239"></a>00239     KCmdLineArgs::init( argc, argv, <span class="stringliteral">"kwin_rules_dialog"</span>, I18N_NOOP( <span class="stringliteral">"KWin"</span> ),
<a name="l00240"></a>00240     I18N_NOOP( <span class="stringliteral">"KWin helper utility"</span> ), <span class="stringliteral">"1.0"</span> );
<a name="l00241"></a>00241     KCmdLineArgs::addCmdLineOptions( options );
<a name="l00242"></a>00242     KApplication app;
<a name="l00243"></a>00243     KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
<a name="l00244"></a>00244     <span class="keywordtype">bool</span> id_ok = <span class="keyword">false</span>;
<a name="l00245"></a>00245     Window <span class="keywordtype">id</span> = args-&gt;getOption( <span class="stringliteral">"wid"</span> ).toULong( &amp;id_ok );
<a name="l00246"></a>00246     args-&gt;clear();
<a name="l00247"></a>00247     <span class="keywordflow">if</span>( !id_ok || <span class="keywordtype">id</span> == None )
<a name="l00248"></a>00248         {
<a name="l00249"></a>00249     KCmdLineArgs::usage( i18n( <span class="stringliteral">"This helper utility is not supposed to be called directly."</span> ));
<a name="l00250"></a>00250     <span class="keywordflow">return</span> 1;
<a name="l00251"></a>00251         }
<a name="l00252"></a>00252     <span class="keywordflow">return</span> <a class="code" href="namespaceKWinInternal.html#a78">KWinInternal::edit</a>( <span class="keywordtype">id</span> );
<a name="l00253"></a>00253     }
</pre></div></div>
<div id="bottom-nav">
<img src="../../common/bottom2.png" align="right" height="59" width="227" alt="KDE Logo">
</div>
<div class="bottom">
This file is part of the documentation for kwin Library Version 3.4.2.
</div>
<div class="bottom" style="color:#cccccc">
Documentation copyright &copy; 1996-2004 the KDE developers.<br>
Generated on Wed Jun 14 19:06:09 2006 by
<a href="http://www.doxygen.org/index.html">doxygen</a> 1.4.4 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, &copy;&nbsp;1997-2003
</div>
</body>
</html>