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

Added Restore All Closed Tabs option to ClosedTabsManager

This commit is contained in:
nowrep 2011-05-16 21:36:39 +02:00
parent bac1f5d78d
commit 8ab4dc75df
8 changed files with 88 additions and 52 deletions

Binary file not shown.

View File

@ -701,8 +701,11 @@ void QupZilla::aboutToShowHistoryMenu()
menuClosedTabs->addAction(_iconForUrl(tab.url), title, m_tabWidget, SLOT(restoreClosedTab()))->setData(i); menuClosedTabs->addAction(_iconForUrl(tab.url), title, m_tabWidget, SLOT(restoreClosedTab()))->setData(i);
i++; i++;
} }
menuClosedTabs->addSeparator();
if (i == 0) if (i == 0)
menuClosedTabs->addAction(tr("Empty"))->setEnabled(false); menuClosedTabs->addAction(tr("Empty"))->setEnabled(false);
else
menuClosedTabs->addAction(tr("Restore All Closed Tabs"), m_tabWidget, SLOT(restoreAllClosedTabs()));
m_menuHistory->addMenu(menuClosedTabs); m_menuHistory->addMenu(menuClosedTabs);
} }

View File

@ -47,3 +47,8 @@ bool ClosedTabsManager::isClosedTabAvailable()
{ {
return (m_closedTabs.count() != 0); return (m_closedTabs.count() != 0);
} }
void ClosedTabsManager::clearList()
{
m_closedTabs.clear();
}

View File

@ -26,6 +26,7 @@ public:
ClosedTabsManager::Tab getTabAt(int index); ClosedTabsManager::Tab getTabAt(int index);
bool isClosedTabAvailable(); bool isClosedTabAvailable();
void clearList();
QList<ClosedTabsManager::Tab> allClosedTabs() { return m_closedTabs; } QList<ClosedTabsManager::Tab> allClosedTabs() { return m_closedTabs; }

View File

@ -350,6 +350,22 @@ void TabWidget::restoreClosedTab()
weView(index)->load(tab.url); weView(index)->load(tab.url);
} }
void TabWidget::restoreAllClosedTabs()
{
if (!m_closedTabsManager->isClosedTabAvailable())
return;
QList<ClosedTabsManager::Tab> closedTabs = m_closedTabsManager->allClosedTabs();
foreach (ClosedTabsManager::Tab tab, closedTabs) {
int index = addView(QUrl(), tab.title);
QDataStream historyStream(tab.history);
historyStream >> *weView(index)->history();
weView(index)->load(tab.url);
}
m_closedTabsManager->clearList();
}
bool TabWidget::canRestoreTab() bool TabWidget::canRestoreTab()
{ {
return m_closedTabsManager->isClosedTabAvailable(); return m_closedTabsManager->isClosedTabAvailable();

View File

@ -67,6 +67,7 @@ public slots:
void duplicateTab(int index); void duplicateTab(int index);
void closeAllButCurrent(int index); void closeAllButCurrent(int index);
void restoreClosedTab(); void restoreClosedTab();
void restoreAllClosedTabs();
private slots: private slots:
void aboutToShowTabsMenu(); void aboutToShowTabsMenu();

View File

@ -2285,17 +2285,17 @@ nebyl nalezen!</translation>
<translation>Poslat odkaz...</translation> <translation>Poslat odkaz...</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="759"/> <location filename="../src/app/qupzilla.cpp" line="762"/>
<source>Other</source> <source>Other</source>
<translation>Ostatní</translation> <translation>Ostatní</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="768"/> <location filename="../src/app/qupzilla.cpp" line="771"/>
<source>Default</source> <source>Default</source>
<translation>Defaultní</translation> <translation>Defaultní</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1122"/> <location filename="../src/app/qupzilla.cpp" line="1125"/>
<source>Start Private Browsing</source> <source>Start Private Browsing</source>
<translation>Spustit anonymní prohlížení</translation> <translation>Spustit anonymní prohlížení</translation>
</message> </message>
@ -2333,7 +2333,7 @@ nebyl nalezen!</translation>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="620"/> <location filename="../src/app/qupzilla.cpp" line="620"/>
<location filename="../src/app/qupzilla.cpp" line="640"/> <location filename="../src/app/qupzilla.cpp" line="640"/>
<location filename="../src/app/qupzilla.cpp" line="705"/> <location filename="../src/app/qupzilla.cpp" line="706"/>
<source>Empty</source> <source>Empty</source>
<translation>Prázdný</translation> <translation>Prázdný</translation>
</message> </message>
@ -2383,108 +2383,113 @@ nebyl nalezen!</translation>
<translation>Zavřené panely</translation> <translation>Zavřené panely</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="713"/> <location filename="../src/app/qupzilla.cpp" line="708"/>
<source>Restore All Closed Tabs</source>
<translation>Obnovit všechny zavřené panely</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="716"/>
<source>Report &amp;Bug</source> <source>Report &amp;Bug</source>
<translation>Nahlásit &amp;bug</translation> <translation>Nahlásit &amp;bug</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="716"/> <location filename="../src/app/qupzilla.cpp" line="719"/>
<source>About &amp;Qt</source> <source>About &amp;Qt</source>
<translation>O &amp;Qt</translation> <translation>O &amp;Qt</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="717"/> <location filename="../src/app/qupzilla.cpp" line="720"/>
<source>&amp;About QupZilla</source> <source>&amp;About QupZilla</source>
<translation>&amp;O QupZille</translation> <translation>&amp;O QupZille</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="723"/> <location filename="../src/app/qupzilla.cpp" line="726"/>
<source>&amp;Web Search</source> <source>&amp;Web Search</source>
<translation>Hledání na &amp;webu</translation> <translation>Hledání na &amp;webu</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="724"/> <location filename="../src/app/qupzilla.cpp" line="727"/>
<source>Page &amp;Info</source> <source>Page &amp;Info</source>
<translation>Informace o &amp;stránce</translation> <translation>Informace o &amp;stránce</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="726"/> <location filename="../src/app/qupzilla.cpp" line="729"/>
<source>&amp;Download Manager</source> <source>&amp;Download Manager</source>
<translation>Správce s&amp;tahování</translation> <translation>Správce s&amp;tahování</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="727"/> <location filename="../src/app/qupzilla.cpp" line="730"/>
<source>&amp;Cookies Manager</source> <source>&amp;Cookies Manager</source>
<translation>Správce coo&amp;kies</translation> <translation>Správce coo&amp;kies</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="728"/> <location filename="../src/app/qupzilla.cpp" line="731"/>
<source>&amp;AdBlock</source> <source>&amp;AdBlock</source>
<translation>&amp;AdBlock</translation> <translation>&amp;AdBlock</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="729"/> <location filename="../src/app/qupzilla.cpp" line="732"/>
<source>RSS &amp;Reader</source> <source>RSS &amp;Reader</source>
<translation>&amp;RSS čtečka</translation> <translation>&amp;RSS čtečka</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="730"/> <location filename="../src/app/qupzilla.cpp" line="733"/>
<source>Clear Recent &amp;History</source> <source>Clear Recent &amp;History</source>
<translation>Vymazat nedá&amp;vnou historii</translation> <translation>Vymazat nedá&amp;vnou historii</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="731"/> <location filename="../src/app/qupzilla.cpp" line="734"/>
<source>&amp;Private Browsing</source> <source>&amp;Private Browsing</source>
<translation>Soukromé prohlíž&amp;ení</translation> <translation>Soukromé prohlíž&amp;ení</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="738"/> <location filename="../src/app/qupzilla.cpp" line="741"/>
<source>Pr&amp;eferences</source> <source>Pr&amp;eferences</source>
<translation>Předvo&amp;lby</translation> <translation>Předvo&amp;lby</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1003"/> <location filename="../src/app/qupzilla.cpp" line="1006"/>
<location filename="../src/app/qupzilla.cpp" line="1004"/> <location filename="../src/app/qupzilla.cpp" line="1007"/>
<source>Web Inspector</source> <source>Web Inspector</source>
<translation>Web Inspektor</translation> <translation>Web Inspektor</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1046"/> <location filename="../src/app/qupzilla.cpp" line="1049"/>
<source>Open file...</source> <source>Open file...</source>
<translation>Otevřít soubor...</translation> <translation>Otevřít soubor...</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1109"/> <location filename="../src/app/qupzilla.cpp" line="1112"/>
<source>Are you sure you want to turn on private browsing?</source> <source>Are you sure you want to turn on private browsing?</source>
<translation>Jste si jistý že chcete zapnout soukromé prohlížení?</translation> <translation>Jste si jistý že chcete zapnout soukromé prohlížení?</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1110"/> <location filename="../src/app/qupzilla.cpp" line="1113"/>
<source>When private browsing is turned on, some actions concerning your privacy will be disabled:</source> <source>When private browsing is turned on, some actions concerning your privacy will be disabled:</source>
<translation>Se zapnutým soukromým prohlížením jsou některé akce týkající se soukromí vypnuty:</translation> <translation>Se zapnutým soukromým prohlížením jsou některé akce týkající se soukromí vypnuty:</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1113"/> <location filename="../src/app/qupzilla.cpp" line="1116"/>
<source>Webpages are not added to the history.</source> <source>Webpages are not added to the history.</source>
<translation>Stránky nejsou přidávány do historie.</translation> <translation>Stránky nejsou přidávány do historie.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1114"/> <location filename="../src/app/qupzilla.cpp" line="1117"/>
<source>New cookies are not stored, but current cookies can be accessed.</source> <source>New cookies are not stored, but current cookies can be accessed.</source>
<translation>Nové cookies nejsou přijímány, ale současné cookies jsou zasílány.</translation> <translation>Nové cookies nejsou přijímány, ale současné cookies jsou zasílány.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1115"/> <location filename="../src/app/qupzilla.cpp" line="1118"/>
<source>Your session won&apos;t be stored.</source> <source>Your session won&apos;t be stored.</source>
<translation>Vaše relace nebude uložena.</translation> <translation>Vaše relace nebude uložena.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1117"/> <location filename="../src/app/qupzilla.cpp" line="1120"/>
<source>Until you close the window, you can still click the Back and Forward buttons to return to the webpages you have opened.</source> <source>Until you close the window, you can still click the Back and Forward buttons to return to the webpages you have opened.</source>
<translation>Než zavřete prohlížeč, stále můžete použít tlačítka Zpět a Vpřed k vrácení se na stránky které jste otevřeli.</translation> <translation>Než zavřete prohlížeč, stále můžete použít tlačítka Zpět a Vpřed k vrácení se na stránky které jste otevřeli.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1161"/> <location filename="../src/app/qupzilla.cpp" line="1164"/>
<source>There are still %1 open tabs and your session won&apos;t be stored. Are you sure to quit?</source> <source>There are still %1 open tabs and your session won&apos;t be stored. Are you sure to quit?</source>
<translation>Ještě je otevřeno %1 panelů a Vaše relace nebude uložena. Opravdu chcete skončit?</translation> <translation>Ještě je otevřeno %1 panelů a Vaše relace nebude uložena. Opravdu chcete skončit?</translation>
</message> </message>

View File

@ -2287,17 +2287,17 @@ p, li { white-space: pre-wrap; }
<translation>Poslať odkaz...</translation> <translation>Poslať odkaz...</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="759"/> <location filename="../src/app/qupzilla.cpp" line="762"/>
<source>Other</source> <source>Other</source>
<translation>Ostatné</translation> <translation>Ostatné</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="768"/> <location filename="../src/app/qupzilla.cpp" line="771"/>
<source>Default</source> <source>Default</source>
<translation>Základné</translation> <translation>Základné</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1122"/> <location filename="../src/app/qupzilla.cpp" line="1125"/>
<source>Start Private Browsing</source> <source>Start Private Browsing</source>
<translation>Spustiť anonymné prehliadanie</translation> <translation>Spustiť anonymné prehliadanie</translation>
</message> </message>
@ -2334,7 +2334,7 @@ p, li { white-space: pre-wrap; }
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="620"/> <location filename="../src/app/qupzilla.cpp" line="620"/>
<location filename="../src/app/qupzilla.cpp" line="640"/> <location filename="../src/app/qupzilla.cpp" line="640"/>
<location filename="../src/app/qupzilla.cpp" line="705"/> <location filename="../src/app/qupzilla.cpp" line="706"/>
<source>Empty</source> <source>Empty</source>
<translation>Prázdny</translation> <translation>Prázdny</translation>
</message> </message>
@ -2384,108 +2384,113 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="713"/> <location filename="../src/app/qupzilla.cpp" line="708"/>
<source>Restore All Closed Tabs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="716"/>
<source>Report &amp;Bug</source> <source>Report &amp;Bug</source>
<translation>Nahlásiť &amp;chybu</translation> <translation>Nahlásiť &amp;chybu</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="716"/> <location filename="../src/app/qupzilla.cpp" line="719"/>
<source>About &amp;Qt</source> <source>About &amp;Qt</source>
<translation>O &amp;Qt</translation> <translation>O &amp;Qt</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="717"/> <location filename="../src/app/qupzilla.cpp" line="720"/>
<source>&amp;About QupZilla</source> <source>&amp;About QupZilla</source>
<translation>&amp;O QupZille</translation> <translation>&amp;O QupZille</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="723"/> <location filename="../src/app/qupzilla.cpp" line="726"/>
<source>&amp;Web Search</source> <source>&amp;Web Search</source>
<translation>Hladať na &amp;webu</translation> <translation>Hladať na &amp;webu</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="724"/> <location filename="../src/app/qupzilla.cpp" line="727"/>
<source>Page &amp;Info</source> <source>Page &amp;Info</source>
<translation>&amp;Informácie o stránke</translation> <translation>&amp;Informácie o stránke</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="726"/> <location filename="../src/app/qupzilla.cpp" line="729"/>
<source>&amp;Download Manager</source> <source>&amp;Download Manager</source>
<translation>Správca &amp;sťahovania</translation> <translation>Správca &amp;sťahovania</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="727"/> <location filename="../src/app/qupzilla.cpp" line="730"/>
<source>&amp;Cookies Manager</source> <source>&amp;Cookies Manager</source>
<translation>Správca &amp;cookies</translation> <translation>Správca &amp;cookies</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="728"/> <location filename="../src/app/qupzilla.cpp" line="731"/>
<source>&amp;AdBlock</source> <source>&amp;AdBlock</source>
<translation>&amp;AdBlock</translation> <translation>&amp;AdBlock</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="729"/> <location filename="../src/app/qupzilla.cpp" line="732"/>
<source>RSS &amp;Reader</source> <source>RSS &amp;Reader</source>
<translation>&amp;RSS čítač</translation> <translation>&amp;RSS čítač</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="730"/> <location filename="../src/app/qupzilla.cpp" line="733"/>
<source>Clear Recent &amp;History</source> <source>Clear Recent &amp;History</source>
<translation>Vymazať nedávnu &amp;históriu</translation> <translation>Vymazať nedávnu &amp;históriu</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="731"/> <location filename="../src/app/qupzilla.cpp" line="734"/>
<source>&amp;Private Browsing</source> <source>&amp;Private Browsing</source>
<translation>Súkromné prehlia&amp;danie</translation> <translation>Súkromné prehlia&amp;danie</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="738"/> <location filename="../src/app/qupzilla.cpp" line="741"/>
<source>Pr&amp;eferences</source> <source>Pr&amp;eferences</source>
<translation>Pr&amp;edvoľby</translation> <translation>Pr&amp;edvoľby</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1003"/> <location filename="../src/app/qupzilla.cpp" line="1006"/>
<location filename="../src/app/qupzilla.cpp" line="1004"/> <location filename="../src/app/qupzilla.cpp" line="1007"/>
<source>Web Inspector</source> <source>Web Inspector</source>
<translation>Web inšpektor</translation> <translation>Web inšpektor</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1046"/> <location filename="../src/app/qupzilla.cpp" line="1049"/>
<source>Open file...</source> <source>Open file...</source>
<translation>Otvoriť súbor...</translation> <translation>Otvoriť súbor...</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1109"/> <location filename="../src/app/qupzilla.cpp" line="1112"/>
<source>Are you sure you want to turn on private browsing?</source> <source>Are you sure you want to turn on private browsing?</source>
<translation>Ste si istý, že chcete zapnúť súkromné prehliadanie?</translation> <translation>Ste si istý, že chcete zapnúť súkromné prehliadanie?</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1110"/> <location filename="../src/app/qupzilla.cpp" line="1113"/>
<source>When private browsing is turned on, some actions concerning your privacy will be disabled:</source> <source>When private browsing is turned on, some actions concerning your privacy will be disabled:</source>
<translation>So zapnutým súkromným prehliadaním niektoré akcie týkajúce sa súkromia vypnuté:</translation> <translation>So zapnutým súkromným prehliadaním niektoré akcie týkajúce sa súkromia vypnuté:</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1113"/> <location filename="../src/app/qupzilla.cpp" line="1116"/>
<source>Webpages are not added to the history.</source> <source>Webpages are not added to the history.</source>
<translation>Stránky nie pridávané do histórie.</translation> <translation>Stránky nie pridávané do histórie.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1114"/> <location filename="../src/app/qupzilla.cpp" line="1117"/>
<source>New cookies are not stored, but current cookies can be accessed.</source> <source>New cookies are not stored, but current cookies can be accessed.</source>
<translation>Nové cookies nie prijímané, ale súčasné cookies zasielané.</translation> <translation>Nové cookies nie prijímané, ale súčasné cookies zasielané.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1115"/> <location filename="../src/app/qupzilla.cpp" line="1118"/>
<source>Your session won&apos;t be stored.</source> <source>Your session won&apos;t be stored.</source>
<translation>Vaša relácia nebude uložená.</translation> <translation>Vaša relácia nebude uložená.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1117"/> <location filename="../src/app/qupzilla.cpp" line="1120"/>
<source>Until you close the window, you can still click the Back and Forward buttons to return to the webpages you have opened.</source> <source>Until you close the window, you can still click the Back and Forward buttons to return to the webpages you have opened.</source>
<translation>Dokiaľ nezavriete prehliadač, tak stále môžete používať tlačidla Späť a Dopredu k vráteniu sa na stránky, ktoré ste mali otvorené.</translation> <translation>Dokiaľ nezavriete prehliadač, tak stále môžete používať tlačidla Späť a Dopredu k vráteniu sa na stránky, ktoré ste mali otvorené.</translation>
</message> </message>
<message> <message>
<location filename="../src/app/qupzilla.cpp" line="1161"/> <location filename="../src/app/qupzilla.cpp" line="1164"/>
<source>There are still %1 open tabs and your session won&apos;t be stored. Are you sure to quit?</source> <source>There are still %1 open tabs and your session won&apos;t be stored. Are you sure to quit?</source>
<translation>Stále otvorené %1 panely a Vaša relácia nebude uložená. Skutočne chcete skončiť?</translation> <translation>Stále otvorené %1 panely a Vaša relácia nebude uložená. Skutočne chcete skončiť?</translation>
</message> </message>