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

List:       kde-commits
Subject:    KDE/kdelibs/khtml
From:       David Faure <faure () kde ! org>
Date:       2010-10-25 23:51:33
Message-ID: 20101025235133.A28BEAC897 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1189825 by dfaure:

Re-route the old actions "Find Text as You Type" and "Find Links as You Type" to the \
findbar. Remove them from the menu, since they are redundant with "Find text", but \
kept two actions just for the shortcuts:

'/' will still activate "find text (not just links)", but the shortcut for "find \
links" is removed by default, advanced users will have to set one again. Otherwise \
newbies would get confused after pressing the shortcut (was single-quote) by mistake: \
Esc and Ctrl+F would still find in links only.

CCMAIL: lueck@hube-lueck.de


 M  +1 -3      khtml.rc  
 M  +1 -3      khtml_browser.rc  
 M  +17 -29    khtml_part.cpp  
 U             khtml_part.h  
 U             khtmlpart_p.h  
 M  +1 -1      ui/findbar/khtmlfindbar.cpp  


--- trunk/KDE/kdelibs/khtml/khtml.rc #1189824:1189825
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="khtmlpart" version="5">
+<kpartgui name="khtmlpart" version="6">
 <MenuBar>
  <Menu name="edit"><text>&amp;Edit</text>
   <Action name="selectAll" />
@@ -7,8 +7,6 @@
   <Action name="find" />
   <Action name="findNext" />
   <Action name="findPrevious" />
-  <Action name="findAheadText" />
-  <Action name="findAheadLink" />
  </Menu>
 </MenuBar>
 <ActionProperties>
--- trunk/KDE/kdelibs/khtml/khtml_browser.rc #1189824:1189825
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="khtmlpart" version="21">
+<kpartgui name="khtmlpart" version="22">
 <MenuBar>
  <Menu name="file"><text>&amp;File</text>
   <Action name="saveBackground" />
@@ -14,8 +14,6 @@
   <Action name="find" />
   <Action name="findNext" />
   <Action name="findPrevious" />
-  <Action name="findAheadText" />
-  <Action name="findAheadLink" />
  </Menu>
  <Menu name="view"><text>&amp;View</text>
   <Action name="incFontSizes" />
--- trunk/KDE/kdelibs/khtml/khtml_part.cpp #1189824:1189825
@@ -400,19 +400,22 @@
                                        "Find the previous occurrence of the text \
                that you "
                                        "have found using the <b>Find Text</b> \
function.</qt>" ) );  
+  // These two actions aren't visible in the menus, but exist for the (configurable) \
shortcut  d->m_paFindAheadText = new KAction( i18n("Find Text as You Type"), this );
   actionCollection()->addAction( "findAheadText", d->m_paFindAheadText );
   d->m_paFindAheadText->setShortcuts( KShortcut( '/' ) );
+  d->m_paFindAheadText->setHelpText(i18n("This shortcut shows the find bar, for \
finding text in the displayed page. It cancels the effect of \"Find Links as You \
Type\", which sets the \"Find links only\" option."));  connect( \
d->m_paFindAheadText, SIGNAL( triggered( bool ) ), this, SLOT( slotFindAheadText()) \
);  
   d->m_paFindAheadLinks = new KAction( i18n("Find Links as You Type"), this );
   actionCollection()->addAction( "findAheadLink", d->m_paFindAheadLinks );
-  d->m_paFindAheadLinks->setShortcuts( KShortcut( '\'' ) );
+  // The issue is that it sets the (sticky) option FindLinksOnly, so
+  // if you trigger this shortcut once by mistake, Esc and Ctrl+F will still have \
the option set. +  // Better let advanced users configure a shortcut for this \
advanced option +  //d->m_paFindAheadLinks->setShortcuts( KShortcut( '\'' ) );
+  d->m_paFindAheadLinks->setHelpText(i18n("This shortcut shows the find bar, and \
sets the option \"Find links only\"."));  connect( d->m_paFindAheadLinks, SIGNAL( \
triggered( bool ) ), this, SLOT( slotFindAheadLink() ) );  
-  d->m_paFindAheadText->setEnabled( false );
-  d->m_paFindAheadLinks->setEnabled( false );
-
   if ( parentPart() )
   {
       d->m_paFind->setShortcuts( KShortcut() ); // avoid clashes
@@ -3000,42 +3003,27 @@
 
 void KHTMLPart::slotFindAheadText()
 {
-#ifndef KHTML_NO_TYPE_AHEAD_FIND
-  KParts::ReadOnlyPart *part = currentFrame();
+  KHTMLPart *part = qobject_cast<KHTMLPart*>(currentFrame());
   if (!part)
     return;
-  if (!part->inherits("KHTMLPart") )
-  {
-      kError(6000) << "part is a" << part->metaObject()->className() << ", can't do \
                a search into it";
-      return;
+  part->findText();
+  KHTMLFindBar* findBar = part->d->m_find.findBar();
+  findBar->setOptions(findBar->options() & ~FindLinksOnly);
   }
-  static_cast<KHTMLPart *>( part )->view()->startFindAhead( false );
-#endif // KHTML_NO_TYPE_AHEAD_FIND
-}
 
 void KHTMLPart::slotFindAheadLink()
 {
-#ifndef KHTML_NO_TYPE_AHEAD_FIND
-  KParts::ReadOnlyPart *part = currentFrame();
+  KHTMLPart *part = qobject_cast<KHTMLPart*>(currentFrame());
   if (!part)
     return;
-  if (!part->inherits("KHTMLPart") )
-  {
-      kError(6000) << "part is a" << part->metaObject()->className() << ", can't do \
                a search into it";
-      return;
+  part->findText();
+  KHTMLFindBar* findBar = part->d->m_find.findBar();
+  findBar->setOptions(findBar->options() | FindLinksOnly);
   }
-  static_cast<KHTMLPart *>( part )->view()->startFindAhead( true );
-#endif // KHTML_NO_TYPE_AHEAD_FIND
-}
 
-void KHTMLPart::enableFindAheadActions( bool enable )
+void KHTMLPart::enableFindAheadActions( bool )
 {
-  // only the topmost one has shortcuts
-  KHTMLPart* p = this;
-  while( p->parentPart())
-    p = p->parentPart();
-  p->d->m_paFindAheadText->setEnabled( enable );
-  p->d->m_paFindAheadLinks->setEnabled( enable );
+  // ### remove me
 }
 
 void KHTMLPart::slotFindDialogDestroyed()
--- trunk/KDE/kdelibs/khtml/ui/findbar/khtmlfindbar.cpp #1189824:1189825
@@ -33,7 +33,7 @@
 
 KHTMLFindBar::KHTMLFindBar( QWidget *parent ) :
     KHTMLViewBarWidget( true, parent ),
-    m_enabled( KFind::WholeWordsOnly | KFind::FromCursor | KFind::SelectedText | \
KFind::CaseSensitive | KFind::FindBackwards | KFind::RegularExpression ) +    \
m_enabled( KFind::WholeWordsOnly | KFind::FromCursor | KFind::SelectedText | \
KFind::CaseSensitive | KFind::FindBackwards | KFind::RegularExpression | \
KHTMLPart::FindLinksOnly )  {
     setupUi( centralWidget() );
 


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

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