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

Added options to choose default character encoding to view menu

This commit is contained in:
nowrep 2011-03-17 20:46:53 +01:00
parent d9d8506536
commit b60b935b62
7 changed files with 133 additions and 39 deletions

Binary file not shown.

View File

@ -244,6 +244,10 @@ void QupZilla::setupMenu()
, tr("Reload"), this);
connect(m_actionReload, SIGNAL(triggered()), this, SLOT(reload()));
m_actionReload->setShortcut(QKeySequence("Ctrl+R"));
QAction* actionEncoding = new QAction(tr("Character Encoding"), this);
m_menuEncoding = new QMenu(this);
actionEncoding->setMenu(m_menuEncoding);
connect(m_menuEncoding, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEncodingMenu()));
m_menuView->addAction(m_actionShowMenubar);
m_menuView->addAction(m_actionShowToolbar);
@ -257,7 +261,7 @@ void QupZilla::setupMenu()
m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom Out"), this, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-"));
m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), this, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0"));
m_menuView->addSeparator();
m_menuView->addAction(actionEncoding);
m_menuView->addSeparator();
m_menuView->addAction(QIcon::fromTheme("text-html"), tr("Page Source"), this, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U"));
m_menuView->addAction(m_actionShowFullScreen);

View File

@ -179,6 +179,8 @@ void MainApplication::loadSettings()
m_websettings->setFontSize(QWebSettings::DefaultFontSize, settings.value("DefaultFontSize", m_websettings->fontSize(QWebSettings::DefaultFontSize)).toInt() );
m_websettings->setFontSize(QWebSettings::DefaultFixedFontSize, settings.value("FixedFontSize", m_websettings->fontSize(QWebSettings::DefaultFixedFontSize)).toInt() );
m_websettings->setDefaultTextEncoding("System");
if (allowPersistentStorage) m_websettings->enablePersistentStorage(m_activeProfil);
m_websettings->setMaximumPagesInCache(maxCachedPages);

View File

@ -390,6 +390,64 @@ void QupZilla::aboutToShowViewMenu()
m_actionStop->setEnabled(false);
}
void QupZilla::aboutToShowEncodingMenu()
{
m_menuEncoding->clear();
QMenu* menuISO = new QMenu("ISO", this);
QMenu* menuUTF = new QMenu("UTF", this);
QMenu* menuWindows = new QMenu("Windows", this);
QMenu* menuIscii = new QMenu("Iscii", this);
QMenu* menuOther = new QMenu(tr("Other"), this);
QList<QByteArray> available = QTextCodec::availableCodecs();
qSort(available);
QString activeCodec = mApp->webSettings()->defaultTextEncoding();
foreach (QByteArray name, available) {
if (QTextCodec::codecForName(name)->aliases().contains(name))
continue;
QAction* action = new QAction(name=="System" ? tr("Default") : name, this);
action->setData(name);
action->setCheckable(true);
connect(action, SIGNAL(triggered()), this, SLOT(changeEncoding()));
if (activeCodec.contains(name, Qt::CaseInsensitive))
action->setChecked(true);
if (name.startsWith("ISO"))
menuISO->addAction(action);
else if (name.startsWith("UTF"))
menuUTF->addAction(action);
else if (name.startsWith("windows"))
menuWindows->addAction(action);
else if (name.startsWith("Iscii"))
menuIscii->addAction(action);
else if (name == "System")
m_menuEncoding->addAction(action);
else
menuOther->addAction(action);
}
m_menuEncoding->addSeparator();
if (!menuISO->isEmpty())
m_menuEncoding->addMenu(menuISO);
if (!menuUTF->isEmpty())
m_menuEncoding->addMenu(menuUTF);
if (!menuWindows->isEmpty())
m_menuEncoding->addMenu(menuWindows);
if (!menuIscii->isEmpty())
m_menuEncoding->addMenu(menuIscii);
if (!menuOther->isEmpty())
m_menuEncoding->addMenu(menuOther);
}
void QupZilla::changeEncoding()
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
mApp->webSettings()->setDefaultTextEncoding(action->data().toString());
reload();
}
}
void QupZilla::bookmarkPage()
{
mApp->bookmarksManager()->addBookmark(weView());

View File

@ -148,6 +148,7 @@ private slots:
void aboutToShowToolsMenu();
void aboutToShowHelpMenu();
void aboutToShowViewMenu();
void aboutToShowEncodingMenu();
void searchOnPage();
void showCookieManager();
@ -181,6 +182,7 @@ private slots:
void zoomReset() { weView()->zoomReset(); }
void fullScreen(bool make);
void startPrivate(bool state);
void changeEncoding();
bool quitApp();

View File

@ -833,8 +833,7 @@ neexistuje!</translation>
<translation>Chyba při načítání stránky</translation>
</message>
<message>
<location filename="../src/history/historymodel.cpp" line="51"/>
<location filename="../src/history/historymodel.cpp" line="60"/>
<location filename="../src/history/historymodel.cpp" line="44"/>
<source>No Named Page</source>
<translation>Bezejmenná stránka</translation>
</message>
@ -899,12 +898,12 @@ neexistuje!</translation>
<context>
<name>MainApplication</name>
<message>
<location filename="../src/app/mainapplication.cpp" line="462"/>
<location filename="../src/app/mainapplication.cpp" line="464"/>
<source>Last session crashed</source>
<translation>Poslední relace spadla</translation>
</message>
<message>
<location filename="../src/app/mainapplication.cpp" line="463"/>
<location filename="../src/app/mainapplication.cpp" line="465"/>
<source>&lt;b&gt;QupZilla crashed :-(&lt;/b&gt;&lt;br/&gt;Oops, last session of QupZilla ends with its crash. We are very sorry. Would you try to restore saved state?</source>
<translation>&lt;b&gt;QupZilla spadla :-(&lt;/b&gt;&lt;br/&gt;Oops, poslední relace QupZilly skončila jejím pádem. Velice se omlouváme. Přejete si obnovit uložený stav?</translation>
</message>
@ -1716,22 +1715,27 @@ neexistuje!</translation>
<translation>Obnovit</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="256"/>
<location filename="../src/app/appui.cpp" line="247"/>
<source>Character Encoding</source>
<translation>Kódování znaků</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="260"/>
<source>Zoom In</source>
<translation>Zoom +</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="257"/>
<location filename="../src/app/appui.cpp" line="261"/>
<source>Zoom Out</source>
<translation>Zoom -</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="258"/>
<location filename="../src/app/appui.cpp" line="262"/>
<source>Reset</source>
<translation>Původní</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="260"/>
<location filename="../src/app/appui.cpp" line="266"/>
<source>Page Source</source>
<translation>Zdrojový kód stránky</translation>
</message>
@ -1834,7 +1838,17 @@ neexistuje!</translation>
<translation>RSS čtečka</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="641"/>
<location filename="../src/app/qupzilla.cpp" line="400"/>
<source>Other</source>
<translation>Ostatní</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="409"/>
<source>Default</source>
<translation>Defaultní</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="698"/>
<source>Start Private Browsing</source>
<translation>Spustit anonymní prohlížení</translation>
</message>
@ -1896,52 +1910,52 @@ neexistuje!</translation>
<translation>Nový panel</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="543"/>
<location filename="../src/app/qupzilla.cpp" line="600"/>
<source>Web Inspector</source>
<translation>Web Inspektor</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="585"/>
<location filename="../src/app/qupzilla.cpp" line="642"/>
<source>Open file...</source>
<translation>Otevřít soubor...</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="628"/>
<location filename="../src/app/qupzilla.cpp" line="685"/>
<source>Are you sure you want to turn on private browsing?</source>
<translation>Jste si jistý že chcete zapnout soukromé prohlížení?</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="629"/>
<location filename="../src/app/qupzilla.cpp" line="686"/>
<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>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="632"/>
<location filename="../src/app/qupzilla.cpp" line="689"/>
<source>Webpages are not added to the history.</source>
<translation>Stránky nejsou přidávány do historie.</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="633"/>
<location filename="../src/app/qupzilla.cpp" line="690"/>
<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>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="634"/>
<location filename="../src/app/qupzilla.cpp" line="691"/>
<source>Your session won&apos;t be stored.</source>
<translation>Vaše relace nebude uložena.</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="636"/>
<location filename="../src/app/qupzilla.cpp" line="693"/>
<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>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="672"/>
<location filename="../src/app/qupzilla.cpp" line="729"/>
<source>There are still open tabs</source>
<translation>Stále jsou otevřeny panely</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="673"/>
<location filename="../src/app/qupzilla.cpp" line="730"/>
<source>There are still %1 open tabs and your session won&apos;t be stored. Are you sure to quit?</source>
<translation>Ještě jsou otevřeny %1 panely a Vaše relace nebude uložena. Opravdu chcete skončit?</translation>
</message>

View File

@ -836,8 +836,7 @@ neexistuje!</translation>
<translation>Chyba pri načítaní stránky</translation>
</message>
<message>
<location filename="../src/history/historymodel.cpp" line="51"/>
<location filename="../src/history/historymodel.cpp" line="60"/>
<location filename="../src/history/historymodel.cpp" line="44"/>
<source>No Named Page</source>
<translation>Stránka bez mena</translation>
</message>
@ -901,12 +900,12 @@ neexistuje!</translation>
<context>
<name>MainApplication</name>
<message>
<location filename="../src/app/mainapplication.cpp" line="462"/>
<location filename="../src/app/mainapplication.cpp" line="464"/>
<source>Last session crashed</source>
<translation>Posledná relácia spadla</translation>
</message>
<message>
<location filename="../src/app/mainapplication.cpp" line="463"/>
<location filename="../src/app/mainapplication.cpp" line="465"/>
<source>&lt;b&gt;QupZilla crashed :-(&lt;/b&gt;&lt;br/&gt;Oops, last session of QupZilla ends with its crash. We are very sorry. Would you try to restore saved state?</source>
<translation>&lt;b&gt;QupZilla spadla :-(&lt;/b&gt;&lt;br/&gt;Oops, posledná relácia QupZilly skončila chybou. Prepáčte. Chcete obnoviť uložený stav?</translation>
</message>
@ -1718,22 +1717,27 @@ neexistuje!</translation>
<translation>Obnoviť</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="256"/>
<location filename="../src/app/appui.cpp" line="247"/>
<source>Character Encoding</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="260"/>
<source>Zoom In</source>
<translation>Priblížiť</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="257"/>
<location filename="../src/app/appui.cpp" line="261"/>
<source>Zoom Out</source>
<translation>Oddialiť</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="258"/>
<location filename="../src/app/appui.cpp" line="262"/>
<source>Reset</source>
<translation>Resetovať</translation>
</message>
<message>
<location filename="../src/app/appui.cpp" line="260"/>
<location filename="../src/app/appui.cpp" line="266"/>
<source>Page Source</source>
<translation>Zdrojový kód stránky</translation>
</message>
@ -1836,7 +1840,17 @@ neexistuje!</translation>
<translation>RSS čítač</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="641"/>
<location filename="../src/app/qupzilla.cpp" line="400"/>
<source>Other</source>
<translation type="unfinished">Ostatné</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="409"/>
<source>Default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="698"/>
<source>Start Private Browsing</source>
<translation>Spustiť anonymné prehliadanie</translation>
</message>
@ -1897,52 +1911,52 @@ neexistuje!</translation>
<translation>Nový panel</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="543"/>
<location filename="../src/app/qupzilla.cpp" line="600"/>
<source>Web Inspector</source>
<translation>Web inšpektor</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="585"/>
<location filename="../src/app/qupzilla.cpp" line="642"/>
<source>Open file...</source>
<translation>Otvoriť súbor...</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="628"/>
<location filename="../src/app/qupzilla.cpp" line="685"/>
<source>Are you sure you want to turn on private browsing?</source>
<translation>Ste si istý, že chcete zapnúť súkromné prehliadanie?</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="629"/>
<location filename="../src/app/qupzilla.cpp" line="686"/>
<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>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="632"/>
<location filename="../src/app/qupzilla.cpp" line="689"/>
<source>Webpages are not added to the history.</source>
<translation>Stránky nie pridávané do histórie.</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="633"/>
<location filename="../src/app/qupzilla.cpp" line="690"/>
<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>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="634"/>
<location filename="../src/app/qupzilla.cpp" line="691"/>
<source>Your session won&apos;t be stored.</source>
<translation>Vaša relácia nebude uložená.</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="636"/>
<location filename="../src/app/qupzilla.cpp" line="693"/>
<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>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="672"/>
<location filename="../src/app/qupzilla.cpp" line="729"/>
<source>There are still open tabs</source>
<translation>Stále otvorené panely</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="673"/>
<location filename="../src/app/qupzilla.cpp" line="730"/>
<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>
</message>