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

List:       kde-core-devel
Subject:    kfinddialog patch
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2004-09-03 20:45:16
Message-ID: 200409032245.16204.tsdgeos () terra ! es
[Download RAW message or body]

These patch adds methods to enable/disable all the checkboxes present in the 
kfinddialog in case any application wants to use the default kde search 
dialog but it can not support some kind of "fancy" search.

Can you please review it and tellme if i can commit?

Albert

["kfindialog.patch" (text/x-diff)]

? kfindialog.patch
Index: kfinddialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/kutils/kfinddialog.cpp,v
retrieving revision 1.22
diff -u -r1.22 kfinddialog.cpp
--- kfinddialog.cpp	27 Apr 2004 14:52:29 -0000	1.22
+++ kfinddialog.cpp	3 Sep 2004 20:36:37 -0000
@@ -40,11 +40,16 @@
 {
 public:
     KFindDialogPrivate() : m_regexpDialog(0),
-        m_regexpDialogQueryDone(false), m_hasCursor(true), m_hasSelection(false),
-        m_initialShowDone(false) {}
+        m_regexpDialogQueryDone(false), m_hasCursor(true), m_backwards(true),
+        m_caseSensitive(true), m_wholeWords(true), m_regularExpression(true),
+        m_hasSelection(false), m_initialShowDone(false) {}
     QDialog* m_regexpDialog;
     bool m_regexpDialogQueryDone;
     bool m_hasCursor;
+    bool m_backwards;
+    bool m_caseSensitive;
+    bool m_wholeWords;
+    bool m_regularExpression;
     bool m_hasSelection;
     bool m_initialShowDone;
     QStringList findStrings;
@@ -336,14 +341,42 @@
     m_fromCursor->setChecked( hasCursor && (options() & FromCursor) );
 }
 
+void KFindDialog::setSupportsBackwardsFind( bool supports )
+{
+    d->m_backwards = supports;
+    m_findBackwards->setEnabled( supports );
+    m_findBackwards->setChecked( supports && (options() & FindBackwards) );
+}
+
+void KFindDialog::setSupportsCaseSensitiveFind( bool supports )
+{
+    d->m_caseSensitive = supports;
+    m_caseSensitive->setEnabled( supports );
+    m_caseSensitive->setChecked( supports && (options() & CaseSensitive) );
+}
+
+void KFindDialog::setSupportsWholeWordsFind( bool supports )
+{
+    d->m_wholeWords = supports;
+    m_wholeWordsOnly->setEnabled( supports );
+    m_wholeWordsOnly->setChecked( supports && (options() & WholeWordsOnly) );
+}
+
+void KFindDialog::setSupportsRegularExpressionFind( bool supports )
+{
+    d->m_regularExpression = supports;
+    m_regExp->setEnabled( supports );
+    m_regExp->setChecked( supports && (options() & RegularExpression) );
+}
+
 void KFindDialog::setOptions(long options)
 {
-    m_caseSensitive->setChecked(options & CaseSensitive);
-    m_wholeWordsOnly->setChecked(options & WholeWordsOnly);
+    m_caseSensitive->setChecked(d->m_caseSensitive && (options & CaseSensitive));
+    m_wholeWordsOnly->setChecked(d->m_wholeWords && (options & WholeWordsOnly));
     m_fromCursor->setChecked(d->m_hasCursor && (options & FromCursor));
-    m_findBackwards->setChecked(options & FindBackwards);
+    m_findBackwards->setChecked(d->m_backwards && (options & FindBackwards));
     m_selectedText->setChecked(d->m_hasSelection && (options & SelectedText));
-    m_regExp->setChecked(options & RegularExpression);
+    m_regExp->setChecked(d->m_regularExpression && (options & RegularExpression));
 }
 
 // Create a popup menu with a list of regular expression terms, to help the user
Index: kfinddialog.h
===================================================================
RCS file: /home/kde/kdelibs/kutils/kfinddialog.h,v
retrieving revision 1.16
diff -u -r1.16 kfinddialog.h
--- kfinddialog.h	28 Aug 2004 17:42:07 -0000	1.16
+++ kfinddialog.h	3 Sep 2004 20:36:37 -0000
@@ -157,6 +157,42 @@
      */
     void setHasCursor( bool hasCursor );
 
+     /**
+     * Enable/disable the 'Find backwards' option, depending
+     * on whether the application supports it.
+     *
+     * @param supports true if the application supports backwards find
+     * This is assumed to be the case by default.
+     */
+    void setSupportsBackwardsFind( bool supports );
+
+     /**
+     * Enable/disable the 'Case sensitive' option, depending
+     * on whether the application supports it.
+     *
+     * @param supports true if the application supports case sensitive find
+     * This is assumed to be the case by default.
+     */
+    void setSupportsCaseSensitiveFind( bool supports );
+
+     /**
+     * Enable/disable the 'Whole words only' option, depending
+     * on whether the application supports it.
+     *
+     * @param supports true if the application supports whole words only find
+     * This is assumed to be the case by default.
+     */
+    void setSupportsWholeWordsFind( bool supports );
+
+     /**
+     * Enable/disable the 'Regular expression' option, depending
+     * on whether the application supports it.
+     *
+     * @param supports true if the application supports regular expression find
+     * This is assumed to be the case by default.
+     */
+    void setSupportsRegularExpressionFind( bool supports );
+
     /**
      * Set the options which are checked.
      *


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

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