Bug 109078 - F3 (find next) is quickly disabled when the "search as you type" feature is used
Summary: F3 (find next) is quickly disabled when the "search as you type" feature is used
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR wishlist with 20 votes (vote)
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-14 15:12 UTC by Vivien Mallet
Modified: 2006-07-11 20:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed patch (against KPDF 0.5 / KDE 3.4.92) (2.89 KB, patch)
2005-11-09 19:05 UTC, Mary Ellen Foster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vivien Mallet 2005-07-14 15:12:11 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

The "search as you type" feature is very convenient but it barely allows for F3 (Find Next):
- find a word in a PDF file using "/" ("search as you type");
- press F3: you should move to the next occurrence;
- now wait for a few seconds (maybe 5) and press F3 again: KPDF has cleared all and opens the "Find Text" dialog box (empty).

It does not work this way in Konqueror: one may press F3 at any time later.


Anyway, thanks for KPDF!
Comment 1 David Laban 2005-11-08 16:16:52 UTC
Okay, just to confirm this is still a bug in 3.5 beta2 (installed from Gentoo sources)

In konqueror, displaying HTML, F3 is always "Find next"

In KPDF and the KPDF KPart, F3 forgets the contents of a slash (/) search as soon as the "Find stopped" message is displayed, (and uses the last Ctrl+F search instead).

Would it be possible to merge Ctrl-F (yellow highlighting) and / (green highlighting) so that it behaves more like konq?

Also, so that we can be consistant with konq, is it possible to make this search blue(#628DB4), and then make the "enter at least 3 letters to filter pages" search use a different colour (I suggest green)?
Comment 2 Mary Ellen Foster 2005-11-09 19:05:36 UTC
Created attachment 13369 [details]
Proposed patch (against KPDF 0.5 / KDE 3.4.92)

This proposed patch (against the KPDF distributed as part of Konstruct
3.5-beta2) makes the following changes:
- Makes F3 work for find-as-you-type searches
- Eliminates the case where you could have both green and yellow highlighting
active at the same time (I always found that confusing ...)
- Adds search history to the Ctrl-F "Find..." dialog box

I couldn't see an easy way to integrate both forms of searching; indeed,
Konqueror actually doesn't do that either (its find-as-you-type searches don't
go into the search history, as far as I could tell).
Comment 3 Mary Ellen Foster 2005-11-13 14:05:56 UTC
I guess I was too late for KDE 3.5RC1 (I just checked); any chance of this patch making it into the final release?
Comment 4 Albert Astals Cid 2005-11-13 15:42:05 UTC
Sorry but no, i'll try to add it for 3.5.1

Thanks for the patch.
Comment 5 Mary Ellen Foster 2006-01-11 15:04:22 UTC
Just pinging this bug report after the holidays ... Any hope of this patch making it in any time soon? :)
Comment 6 Tal Levy 2006-04-16 17:10:55 UTC
This patch doesn't seem to have made it into kde 3.5.2 kpdf 0.5.2
I hope it will be available in the next release.
Comment 7 Albert Astals Cid 2006-05-22 23:40:32 UTC
that will not go into kpdf 3.5.3 either because i was too late in merging it, sorry, i'm not happy with the little time i'm giving to kpdf lately. I promise it'll go into 3.5.4
Comment 8 Albert Astals Cid 2006-07-11 20:43:42 UTC
SVN commit 561026 by aacid:

finally commit patch by Mary Ellen Foster to implement wish 109078
Incidentally also implements wish 127382
Sorry for having taken so long.
FEATURE: 109078
FEATURE: 127382


 M  +11 -0     core/document.cpp  
 M  +1 -0      core/document.h  
 M  +4 -3      part.cpp  
 M  +3 -0      part.h  


--- branches/KDE/3.5/kdegraphics/kpdf/core/document.cpp #561025:561026
@@ -44,6 +44,7 @@
     public:
         // find descriptors, mapped by ID (we handle multiple searches)
         QMap< int, RunningSearch * > searches;
+        int m_lastSearchID;
 
         // needed because for remote documents docFileName is a local file and
         // we want the remote url when the document refers to relativeNames
@@ -111,6 +112,7 @@
     d->allocatedPixmapsTotalMemory = 0;
     d->memCheckTimer = 0;
     d->saveBookmarksTimer = 0;
+    d->m_lastSearchID = -1;
     KImageIO::registerFormats();
     QStringList list = QImage::inputFormatList();
     QStringList::Iterator it = list.begin();
@@ -627,6 +629,11 @@
         search->continueOnPage = -1;
         d->searches[ searchID ] = search;
     }
+    if (d->m_lastSearchID != searchID)
+    {
+        resetSearch(d->m_lastSearchID);
+    }
+    d->m_lastSearchID = searchID;
     RunningSearch * s = d->searches[ searchID ];
 
     // update search stucture
@@ -903,6 +910,10 @@
     delete s;
 }
 
+bool KPDFDocument::continueLastSearch()
+{
+    return continueSearch( d->m_lastSearchID );
+}
 
 
 void KPDFDocument::toggleBookmark( int n )
--- branches/KDE/3.5/kdegraphics/kpdf/core/document.h #561025:561026
@@ -96,6 +96,7 @@
                          SearchType type, bool moveViewport, const QColor & color, bool noDialogs = false );
         bool continueSearch( int searchID );
         void resetSearch( int searchID );
+        bool continueLastSearch();
         void toggleBookmark( int page );
         void processLink( const KPDFLink * link );
         bool print( KPrinter &printer );
--- branches/KDE/3.5/kdegraphics/kpdf/part.cpp #561025:561026
@@ -681,6 +681,8 @@
 {
     KFindDialog dlg( widget() );
     dlg.setHasCursor( false );
+    if ( !m_searchHistory.empty() )
+        dlg.setFindHistory( m_searchHistory );
 #if KDE_IS_VERSION(3,3,90)
     dlg.setSupportsBackwardsFind( false );
     dlg.setSupportsWholeWordsFind( false );
@@ -688,6 +690,7 @@
 #endif
     if ( dlg.exec() == QDialog::Accepted )
     {
+        m_searchHistory = dlg.findHistory();
         m_searchStarted = true;
         m_document->resetSearch( PART_SEARCH_ID );
         m_document->searchText( PART_SEARCH_ID, dlg.pattern(), false, dlg.options() & KFindDialog::CaseSensitive,
@@ -697,9 +700,7 @@
 
 void Part::slotFindNext()
 {
-    if ( m_searchStarted )
-        m_document->continueSearch( PART_SEARCH_ID );
-    else
+    if (!m_document->continueLastSearch())
         slotFind();
 }
 
--- branches/KDE/3.5/kdegraphics/kpdf/part.h #561025:561026
@@ -158,6 +158,9 @@
 	KDirWatch *m_watcher;
 	QTimer *m_dirtyHandler;
 	DocumentViewport m_viewportDirty;
+	
+	// Remember the search history
+	QStringList m_searchHistory;
 
 	// actions
 	KAction *m_gotoPage;