[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Patch review - option to stop KFind showing a message box when no
From:       Paul Giannaros <ceruleanblaze () gmail ! com>
Date:       2005-06-25 16:12:34
Message-ID: 200506251712.34531.ceruleanblaze () gmail ! com
[Download RAW message or body]

Hello

Currently you cannot use KHTMLPart::findTextNext (and methods elsewhere that 
make use of KFind) without invoking a KMessageBox with notication if no 
matches are found. This behaviour is not wanted in many cases, especially 
with automation tasks via DCOP and the like.
Included is a patch that adds a "Silent" option to KFindDialog::Options which, 
when specified, stops KFind from displaying a message box ("x matches found." 
or "No matches found for 'foo'").

Please CC me, as I am not subscribed to the list.

Thanks,
Paul (aka Cerulean)

["kfindpatch.diff" (text/x-diff)]

Index: kfinddialog.h
===================================================================
--- kfinddialog.h	(revision 428345)
+++ kfinddialog.h	(working copy)
@@ -88,6 +88,9 @@
         FindBackwards = 16,     // Go backwards.
         RegularExpression = 32, // Interpret the pattern as a regular expression.
         FindIncremental = 64,   // Find incremental.
+        Silent = 128,           // Silent operation - no visual feedback, e.g
+                                // message boxes informing the user that no
+                                // text was found.
         // Note that KReplaceDialog uses 256 and 512
         // User extensions can use boolean options above this value.
         MinimumUserOption = 65536
Index: kfind.cpp
===================================================================
--- kfind.cpp	(revision 428345)
+++ kfind.cpp	(working copy)
@@ -624,7 +624,9 @@
         message = i18n( "1 match found.", "%n matches found.", numMatches() );
     else
         message = i18n("<qt>No matches found for \
                '<b>%1</b>'.</qt>").arg(QStyleSheet::escape(m_pattern));
-    KMessageBox::information(dialogsParent(), message);
+    // Disable the message box if the Silent flag is set
+    if(!(m_options & KFindDialog::Silent))
+        KMessageBox::information(dialogsParent(), message);
 }
 
 bool KFind::shouldRestart( bool forceAsking, bool showNumMatches ) const



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic