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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/widgets
From:       Laurent Montel <montel () kde ! org>
Date:       2008-01-28 13:01:39
Message-ID: 1201525299.843779.23450.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 767578 by mlaurent:

Add function for enabled or not find/replace function


 M  +16 -11    ktextedit.cpp  
 M  +6 -0      ktextedit.h  


--- trunk/KDE/kdelibs/kdeui/widgets/ktextedit.cpp #767577:767578
@@ -51,6 +51,7 @@
       : parent( _parent ),
         customPalette( false ),
         checkSpellingEnabled( false ),
+        findReplaceEnabled(true),
         highlighter( 0 ), findDlg(0),find(0),repDlg(0),replace(0), findIndex(0), repIndex(0)
     {
     }
@@ -86,6 +87,7 @@
     bool customPalette : 1;
 
     bool checkSpellingEnabled : 1;
+    bool findReplaceEnabled: 1;
     QString originalBuffer;
     QString spellChechingConfigFileName;
     QString spellCheckingLanguage;
@@ -380,19 +382,22 @@
       d->allowTab->setCheckable( true );
       d->allowTab->setChecked( !tabChangesFocus() );
 
-      KAction *findAction = KStandardAction::find( this, SLOT( slotFind() ), this );
-      KAction *findNextAction = KStandardAction::findNext( this, SLOT( slotFindNext() ), this );
-      KAction *replaceAction = KStandardAction::replace( this, SLOT( slotReplace() ), this );
-      if (emptyDocument)
+      if (d->findReplaceEnabled)
       {
-          findAction->setEnabled(false);
-          findNextAction->setEnabled(d->find != 0 );
-          replaceAction->setEnabled(false);
+          KAction *findAction = KStandardAction::find( this, SLOT( slotFind() ), this );
+          KAction *findNextAction = KStandardAction::findNext( this, SLOT( slotFindNext() ), this );
+          KAction *replaceAction = KStandardAction::replace( this, SLOT( slotReplace() ), this );
+          if (emptyDocument)
+          {
+              findAction->setEnabled(false);
+              findNextAction->setEnabled(d->find != 0 );
+              replaceAction->setEnabled(false);
+          }
+          popup->addSeparator();
+          popup->addAction(findAction);
+          popup->addAction(findNextAction);
+          popup->addAction(replaceAction);
       }
-      popup->addSeparator();
-      popup->addAction(findAction);
-      popup->addAction(findNextAction);
-      popup->addAction(replaceAction);
   }
   return popup;
 }
--- trunk/KDE/kdelibs/kdeui/widgets/ktextedit.h #767577:767578
@@ -169,7 +169,13 @@
      */
     QMenu *mousePopupMenu();
 
+    /**
+     * Enable find replace action.
+     * @since 4.1
+     */
+    void enableFindReplace( bool enabled);
 
+
   Q_SIGNALS:
     /**
      * emit signal when we activate or not autospellchecking
[prev in list] [next in list] [prev in thread] [next in thread] 

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