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

RestoreSession: Indicate pinned tabs and current tab in window

This commit is contained in:
David Rosca 2016-12-27 20:02:31 +01:00
parent fe77d7c9ba
commit 47b2bf30ad
2 changed files with 17 additions and 7 deletions

View File

@ -233,23 +233,30 @@ function addWindow(winId)
document.getElementById("recovery-items").appendChild(tr);
}
function addTab(winId, tabId, icon, url, title)
function addTab(winId, tab)
{
var tr = document.createElement("tr");
tr.className = "tab";
tr.title = url;
tr.title = tab.url;
tr.onclick = function() { selectRow(tr); };
var td = document.createElement("td");
var input = document.createElement("input");
input.type = "checkbox";
input.checked = true;
input.setAttribute("data-window", winId);
input.setAttribute("data-tab", tabId);
input.setAttribute("data-tab", tab.tab);
input.onclick = function() { toggleTab(input); };
var img = document.createElement("img");
img.src = icon;
img.src = tab.icon;
var span = document.createElement("span");
span.innerText = title;
span.innerText = tab.title;
if (tab.pinned) {
span.innerText = "🖈 " + span.innerText;
}
if (tab.current) {
span.style.fontStyle = 'italic';
}
tr.appendChild(td);
td.appendChild(input);
@ -267,7 +274,7 @@ function init()
addWindow(win.window);
for (var j = 0; j < win.tabs.length; ++j) {
var tab = win.tabs[j];
addTab(win.window, tab.tab, tab.icon, tab.url, tab.title);
addTab(win.window, tab);
}
}
}

View File

@ -49,11 +49,14 @@ QJsonArray RecoveryJsObject::restoreData() const
QJsonArray tabs;
Q_FOREACH (const WebTab::SavedTab &t, w.tabsState) {
QJsonObject tab;
tab[QSL("tab")] = j++;
tab[QSL("tab")] = j;
tab[QSL("icon")] = QzTools::pixmapToDataUrl(t.icon.pixmap(16)).toString();
tab[QSL("title")] = t.title;
tab[QSL("url")] = t.url.toString();
tab[QSL("pinned")] = t.isPinned;
tab[QSL("current")] = w.currentTab == j;
tabs.append(tab);
j++;
}
QJsonObject window;