[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/khtml
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2005-04-06 15:31:39
Message-ID: 20050406153139.0AA8F63E () office ! kde ! org
[Download RAW message or body]
CVS commit by lunakl:
Add Find Previous action.
M +1 -0 ChangeLog 1.419
M +2 -1 khtml.rc 1.22
M +2 -1 khtml_browser.rc 1.33
M +29 -1 khtml_part.cpp 1.1099
M +10 -0 khtml_part.h 1.283
M +1 -0 khtmlpart_p.h 1.62
--- kdelibs/khtml/ChangeLog #1.418:1.419
@@ -3,4 +3,5 @@
* khtmlview.{h,cpp}: Use KActions for type ahead find.
* khtml_part.{h,cpp}: ditto.
+ * khtml_part.{h,cpp}: Add Find Previous action.
2005-04-05 Lubos Lunak <l.lunak@kde.org>
--- kdelibs/khtml/khtml.rc #1.21:1.22
@@ -1,4 +1,4 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="khtmlpart" version="4">
+<kpartgui name="khtmlpart" version="5">
<MenuBar>
<Menu name="edit"><text>&Edit</text>
@@ -7,4 +7,5 @@
<Action name="find" />
<Action name="findNext" />
+ <Action name="findPrevious" />
<Action name="findAheadText" />
<Action name="findAheadLink" />
--- kdelibs/khtml/khtml_browser.rc #1.32:1.33
@@ -1,4 +1,4 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="khtmlpart" version="17">
+<kpartgui name="khtmlpart" version="18">
<MenuBar>
<Menu name="file"><text>&File</text>
@@ -14,4 +14,5 @@
<Action name="find" />
<Action name="findNext" />
+ <Action name="findPrevious" />
<Action name="findAheadText" />
<Action name="findAheadLink" />
--- kdelibs/khtml/khtml_part.cpp #1.1098:1.1099
@@ -377,4 +377,9 @@ void KHTMLPart::init( KHTMLView *view, G
"have found using the <b>Find Text</b> \
function" ) );
+ d->m_paFindPrev = KStdAction::findPrev( this, SLOT( slotFindPrev() ), \
actionCollection(), "findPrevious" ); + d->m_paFindPrev->setWhatsThis( i18n( "Find \
previous<p>" + "Find the previous occurrence of \
the text that you " + "have found using the \
<b>Find Text</b> function" ) ); +
KAction* ft = new KAction( "Find Text As You Type", KShortcut( '/' ), this, SLOT( \
slotFindAheadText()), actionCollection(), "findAheadText");
@@ -386,4 +391,5 @@ void KHTMLPart::init( KHTMLView *view, G
d->m_paFind->setShortcut( KShortcut() ); // avoid clashes
d->m_paFindNext->setShortcut( KShortcut() ); // avoid clashes
+ d->m_paFindPrev->setShortcut( KShortcut() ); // avoid clashes
ft->setShortcut( KShortcut());
fl->setShortcut( KShortcut());
@@ -2847,4 +2853,17 @@ void KHTMLPart::slotFindNext()
}
+void KHTMLPart::slotFindPrev()
+{
+ KParts::ReadOnlyPart *part = currentFrame();
+ if (!part)
+ return;
+ if (!part->inherits("KHTMLPart") )
+ {
+ kdError(6000) << "slotFindNext: part is a " << part->className() << ", can't \
do a search into it" << endl; + return;
+ }
+ static_cast<KHTMLPart *>( part )->findTextNext( true ); // reverse
+}
+
void KHTMLPart::slotFindDone()
{
@@ -2952,7 +2971,12 @@ void KHTMLPart::findText( const QString
}
-// New method
bool KHTMLPart::findTextNext()
{
+ return findTextNext( false );
+}
+
+// New method
+bool KHTMLPart::findTextNext( bool reverse )
+{
if (!d->m_find)
{
@@ -2990,4 +3014,8 @@ bool KHTMLPart::findTextNext()
} else
options = d->m_lastFindState.options;
+ if( reverse )
+ options = options ^ KFindDialog::FindBackwards;
+ if( d->m_find->options() != options )
+ d->m_find->setOptions( options );
KFind::Result res = KFind::NoMatch;
--- kdelibs/khtml/khtml_part.h #1.282:1.283
@@ -736,4 +736,13 @@ public:
/**
+ * Finds the next occurence of a string set by @ref findText()
+ * @param reverse if true, revert seach direction (only if no find dialog is used)
+ * @return true if a new match was found.
+ * @since 3.5
+ */
+ // KDE4 merge with default = false
+ bool findTextNext( bool reverse );
+
+ /**
* Sets the Zoom factor. The value is given in percent, larger values mean a
* generally larger font and larger page contents. It is not guaranteed that
@@ -1340,4 +1349,5 @@ private slots:
virtual void slotFindDialogDestroyed();
void slotFindNext();
+ void slotFindPrev();
void slotFindAheadText();
void slotFindAheadLink();
--- kdelibs/khtml/khtmlpart_p.h #1.61:1.62
@@ -393,4 +393,5 @@ public:
KAction *m_paFind;
KAction *m_paFindNext;
+ KAction *m_paFindPrev;
KAction *m_paPrintFrame;
KAction *m_paSelectAll;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic