Ticket #4246: 0001-Avoid-close-the-PDFTab-when-Esc-is-pressed-SL-4246.patch

File 0001-Avoid-close-the-PDFTab-when-Esc-is-pressed-SL-4246.patch, 1.1 KB (added by humitos, 11 years ago)

This was introduce in: 41968d61. stop_loading for PDFTabPage does close the tab.

  • webactivity.py

    From 9b88d7a36fb3556bc99268358357c62237cd0e23 Mon Sep 17 00:00:00 2001
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Wed, 21 Nov 2012 13:23:27 -0300
    Subject: [PATCH Browse] Avoid close the PDFTab when Esc is pressed SL #4246
    
    Do not call "stop_loading" if the WebKit is not in 'loading' state
    when 'Esc' is pressed.
    
    Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
    ---
     webactivity.py | 8 ++++++--
     1 file changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/webactivity.py b/webactivity.py
    index 780b87f..0e3b61b 100644
    a b class WebActivity(activity.Activity): 
    526526            return True
    527527
    528528        elif key_name == 'Escape':
    529             _logger.debug('keyboard: Stop loading')
    530             browser.stop_loading()
     529            status = browser.get_load_status()
     530            loading = WebKit.LoadStatus.PROVISIONAL <= status \
     531                < WebKit.LoadStatus.FINISHED
     532            if loading:
     533                _logger.debug('keyboard: Stop loading')
     534                browser.stop_loading()
    531535
    532536        return False
    533537