1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 19:12:11 +01:00

SpeedDial: Ignore changed() signal from the current page

This commit is contained in:
David Rosca 2016-01-24 16:17:57 +01:00
parent 34475fcfc9
commit 48210c5aa6

View File

@ -62,6 +62,7 @@ var DIAL_WIDTH = %SD-SIZE%;
var SD_CENTER = %SD-CENTER%; var SD_CENTER = %SD-CENTER%;
var editingId = -1; var editingId = -1;
var ignoreNextChanged = false;
$(document).keyup(function(e) { $(document).keyup(function(e) {
if (editingId == -1) if (editingId == -1)
@ -72,6 +73,12 @@ $(document).keyup(function(e) {
$('#fadeOverlay').click(); $('#fadeOverlay').click();
}); });
function emitChanged(pages)
{
ignoreNextChanged = true;
external.speedDial.changed(pages);
}
function addSpeedDial() function addSpeedDial()
{ {
onEditClick(addBox('', NEW_PAGE, '')); onEditClick(addBox('', NEW_PAGE, ''));
@ -194,7 +201,7 @@ function boxEdited() {
} else { } else {
hideEditBox(); hideEditBox();
} }
external.speedDial.changed(pages); emitChanged(pages);
}); });
} }
@ -291,7 +298,7 @@ function setTitleToUrl(url, title) {
} }
if (changed) if (changed)
external.speedDial.changed(allPages()); emitChanged(allPages());
} }
function setImageToUrl(url, img_source) { function setImageToUrl(url, img_source) {
@ -335,7 +342,7 @@ function removeBox(id) {
alignPage(); alignPage();
external.speedDial.removeImageForUrl(url); external.speedDial.removeImageForUrl(url);
external.speedDial.changed(allPages()); emitChanged(allPages());
} }
function alignPage() { function alignPage() {
@ -458,6 +465,10 @@ function init()
%INITIAL-SCRIPT% %INITIAL-SCRIPT%
external.speedDial.pagesChanged.connect(function() { external.speedDial.pagesChanged.connect(function() {
if (ignoreNextChanged) {
ignoreNextChanged = false;
return;
}
window.location.reload(); window.location.reload();
}); });
@ -480,7 +491,7 @@ function init()
enableCentering(); enableCentering();
}, },
update: function(event, ui) { update: function(event, ui) {
external.speedDial.changed(allPages()); emitChanged(allPages());
} }
}); });