I know I was supposed to commit this a long time back, but I just can&#39;t get it to work! After some amount of debugging I realized my code was fine, and the problem is that KDirWatch is buggy (I don&#39;t have the bandwidth to fix it! Do I report it at bugs.kde?). There are 2 problems with KDirWatch -<br>
<br>1. It&#39;s slow - I block all the signals, and write to the config file, and then unblock the signals. A little while after that the dirty() signal is emitted! I decided to hack through this issue by ... look at strigi2.diff -&gt; StrigiService::slotConfigChanged(). And that&#39;s when I discovered the second bug.<br>
<br>2. It doesn&#39;t always fire the dirty signal - Yes. I know. Weird! (If you feel inclined to test it, apply the KDirWatchPatch to kdelibs/kdecore)<br><br>Possible fixes (in order of preference) - <br>1. Somebody fixes KDirWatch<br>
2. We use a separate config file to store the &quot;config changed&quot; variable<br>3. We a use a QTimer::singleShot(...) to unblock the signals after a certain interval. (Not fool proof. I&#39;ve tried it)<br><br>- Vishesh Handa<br>
<br><br><div class="gmail_quote">On Tue, May 11, 2010 at 11:15 AM, Sebastian Trüg <span dir="ltr">&lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Vishesh,<br>
<br>
very nice. Please commit. Except if the blockSignals does not work. Does<br>
it work now?<br>
<br>
Only a minor hint: in general I would recommend to use<br>
<br>
Q_FOREACH( const QString&amp; s, strings )<br>
<br>
since that avoids a copy of the string. Now in case of strings this is<br>
no big deal (shared) but it makes sense to remember it for other types.<br>
<br>
Cheers,<br>
<font color="#888888">Sebastian<br>
</font><div><div></div><div class="h5"><br>
On 05/11/2010 01:08 AM, Vishesh Handa wrote:<br>
&gt; Hi Sebastian<br>
&gt;<br>
&gt;     How to block signals:<br>
&gt;     1. Use QObject::blockSignals()<br>
&gt;<br>
&gt;<br>
&gt; Didn&#39;t work! :-( I&#39;ve seen the disconnect/reconnect approach being used<br>
&gt; successfully as well. There must be something special about this case.<br>
&gt; I&#39;ll check it out tom.<br>
&gt;<br>
&gt;     * There is no real need to optimize the folder list in the filewatch<br>
&gt;     service. StrigiServiceConfig already does that before giving the list to<br>
&gt;     the IndexScheduler<br>
&gt;<br>
&gt;<br>
&gt; I thought it&#39;s better to optimize it once before saving it rather than<br>
&gt; optimize it every time while loading. Anyway, I&#39;ve removed the<br>
&gt; optimization code. It&#39;s now redundant.<br>
&gt;<br>
&gt;<br>
&gt;     * I think we need a better name than &quot;restart&quot;. Maybe &quot;ignore last<br>
&gt;     config change&quot; or something like that.<br>
&gt;<br>
&gt;<br>
&gt; I&#39;ve changed it to &quot;ignore changes&quot;. Is that okay?<br>
&gt;<br>
&gt;<br>
&gt;     * Any chance the config handling in IndexScheduler could be moved to<br>
&gt;     StrigiServiceConfig? Just so config handling is restricted to the<br>
&gt;     one class.<br>
&gt;<br>
&gt;<br>
&gt; Done.<br>
&gt;<br>
&gt;<br>
&gt;     * Now for the only critical use case: imagine filewatch changes the<br>
&gt;     config, then the kcm changes the folders, and only then strigi gets to<br>
&gt;     the config. I am not sure if that can even happen but if so strigi would<br>
&gt;     ignore the new config. But I suppose this is very unlikely to happen or<br>
&gt;     even impossible.<br>
&gt;<br>
&gt;<br>
&gt; The probability of this happening is very low. However I&#39;ve edited KCM<br>
&gt; to make sure it doesn&#39;t occur.<br>
&gt;<br>
&gt; I&#39;ve modified the patch to remove auto adding of sub folders to indexed<br>
&gt; list as that is what everyone wanted. (I don&#39;t!)<br>
&gt;<br>
&gt; - Vishesh Handa<br>
&gt;<br>
</div></div></blockquote></div><br>