Fix #917000 (Duplicated shortcut key on "Schedule news download" dialog box)

This commit is contained in:
Kovid Goyal 2012-01-16 09:13:39 +05:30
parent 66930d2e8a
commit 4a2dca4584
2 changed files with 44 additions and 4 deletions

View File

@ -72,7 +72,7 @@ get_current_time = (target) -> # {{{
fstr(ans) fstr(ans)
# }}} # }}}
window_scroll_pos = (win) -> # {{{ window_scroll_pos = (win=window) -> # {{{
if typeof(win.pageXOffset) == 'number' if typeof(win.pageXOffset) == 'number'
x = win.pageXOffset x = win.pageXOffset
y = win.pageYOffset y = win.pageYOffset
@ -157,7 +157,8 @@ class CanonicalFragmentIdentifier
is_compatible(): Throws an error if the browser is not compatible with is_compatible(): Throws an error if the browser is not compatible with
this script this script
at(x, y): which maps a point to a CFI, if possible at(x, y): Maps a point to a CFI, if possible
at_current(): Returns the CFI corresponding to the current viewport scroll location
scroll_to(cfi): which scrolls the browser to a point corresponding to the scroll_to(cfi): which scrolls the browser to a point corresponding to the
given cfi, and returns the x and y co-ordinates of the point. given cfi, and returns the x and y co-ordinates of the point.
@ -559,11 +560,50 @@ class CanonicalFragmentIdentifier
null null
# }}} # }}}
current_cfi: () -> # {{{ at_current: () -> # {{{
[winx, winy] = window_scroll_pos() [winx, winy] = window_scroll_pos()
[winw, winh] = [window.innerWidth, window.innerHeight] [winw, winh] = [window.innerWidth, window.innerHeight]
max = Math.max
winw = max(winw, 400) winw = max(winw, 400)
winh = max(winh, 600) winh = max(winh, 600)
deltay = Math.floor(winh/50)
deltax = Math.floor(winw/25)
miny = max(-winy, -winh)
maxy = winh
minx = max(-winx, -winw)
maxx = winw
get_cfi = (x, y) ->
try
cfi = this.at(x, y)
catch err
cfi = null
# TODO: calculate point and check that it is close to current pos
cfi
x_loop = (cury) ->
for direction in [-1, 1]
delta = deltax * direction
curx = 0
until (direction < 0 and curx < minx) or (direction > 0 and curx > maxx)
cfi = get_cfi(curx, cury)
if cfi
return cfi
curx += delta
null
for direction in [-1, 1]
delta = deltay * direction
cury = 0
until (direction < 0 and cury < miny) or (direction > 0 and cury > maxy)
cfi = x_loop(cury, -1)
if cfi
return cfi
cury += delta
# TODO: Return the CFI corresponding to the <body> tag
null
# }}} # }}}
if window? if window?

View File

@ -362,7 +362,7 @@
<item> <item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>&amp;Delete downloaded news older than:</string> <string>Delete downloaded news &amp;older than:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>old_news</cstring> <cstring>old_news</cstring>