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

History menu submenus and List of closed tabs in tab bar

- merged pejakm-master
- also using const variables in foreach loops everywhere it is possible
- updated translations
This commit is contained in:
nowrep 2012-01-23 17:30:34 +01:00
parent 08dae0e4ce
commit c31ee75928
55 changed files with 3951 additions and 3370 deletions

Binary file not shown.

View File

@ -322,8 +322,8 @@ IShellLink* QtWin::CreateShellLink(const QString &title, const QString &descript
void QtWin::populateFrequentSites(IObjectCollection* collection, const QString &appPath)
{
HistoryModel* historyModel = mApp->history();
QList<HistoryModel::HistoryEntry> mostList = historyModel->mostVisited(6);
foreach(HistoryModel::HistoryEntry entry, mostList)
QList<HistoryEntry> mostList = historyModel->mostVisited(6);
foreach(const HistoryEntry &entry, mostList)
collection->AddObject(CreateShellLink(entry.title, entry.url.toString(), appPath, " " + entry.url.toEncoded(), appPath, 1));
collection->AddObject(CreateShellLink("", "", "", "", "", 0)); //Spacer

View File

@ -46,7 +46,7 @@ void AdBlockIcon::showMenu(const QPoint &pos)
}
else {
menu.addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false);
foreach(WebPage::AdBlockedEntry entry, entries) {
foreach(const WebPage::AdBlockedEntry &entry, entries) {
QString address = entry.url.toString().right(55);
menu.addAction(tr("%1 with (%2)").arg(address, entry.rule), manager, SLOT(showRule()))->setData(entry.rule);
}

View File

@ -120,7 +120,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
QString startProfile;
if (argc > 1) {
foreach(CommandLineOptions::ActionPair pair, cmdActions) {
foreach(const CommandLineOptions::ActionPair &pair, cmdActions) {
switch (pair.action) {
case Qz::CL_StartWithoutAddons:
noAddons = true;
@ -158,7 +158,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
}
if (isRunning()) {
foreach(QString message, messages) {
foreach(const QString &message, messages) {
sendMessage(message);
}
m_isExited = true;

View File

@ -458,10 +458,10 @@ void QupZilla::setupMenu()
m_menuClosedTabs = new QMenu(tr("Closed Tabs"));
connect(m_menuClosedTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabsMenu()));
m_menuHistoryRecent = new QMenu(tr("Recently Visited"));
m_menuHistoryRecent = new Menu(tr("Recently Visited"), m_menuHistory);
connect(m_menuHistoryRecent, SIGNAL(aboutToShow()), this, SLOT(aboutToShowHistoryRecentMenu()));
m_menuHistoryMost = new QMenu(tr("Most Visited"));
m_menuHistoryMost = new Menu(tr("Most Visited"), m_menuHistory);
connect(m_menuHistoryMost, SIGNAL(aboutToShow()), this, SLOT(aboutToShowHistoryMostMenu()));
aboutToShowToolsMenu();
@ -700,7 +700,7 @@ void QupZilla::aboutToShowBookmarksMenu()
menuBookmarks->addAction(act);
}
if (menuBookmarks->isEmpty()) {
menuBookmarks->addAction(tr("Empty"));
menuBookmarks->addAction(tr("Empty"))->setEnabled(false);
}
m_menuBookmarksAction = m_menuBookmarks->addMenu(menuBookmarks);
@ -728,7 +728,7 @@ void QupZilla::aboutToShowBookmarksMenu()
tempFolder->addAction(act);
}
if (tempFolder->isEmpty()) {
tempFolder->addAction(tr("Empty"));
tempFolder->addAction(tr("Empty"))->setEnabled(false);
}
m_menuBookmarks->addMenu(tempFolder);
}
@ -786,7 +786,7 @@ void QupZilla::aboutToShowClosedTabsMenu()
{
m_menuClosedTabs->clear();
int i = 0;
foreach(ClosedTabsManager::Tab tab, m_tabWidget->closedTabsManager()->allClosedTabs()) {
foreach(const ClosedTabsManager::Tab &tab, m_tabWidget->closedTabsManager()->allClosedTabs()) {
QString title = tab.title;
if (title.length() > 40) {
title.truncate(40);
@ -809,24 +809,23 @@ void QupZilla::aboutToShowHistoryRecentMenu()
{
m_menuHistoryRecent->clear();
QSqlQuery query;
if (query.isNull(false)) {
query.exec("SELECT title, url FROM history ORDER BY date DESC LIMIT 15");
while (query.next()) {
QUrl url = query.value(1).toUrl();
QString title = query.value(0).toString();
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(_iconForUrl(url), title);
act->setData(url);
connect(act, SIGNAL(triggered()), this, SLOT(loadActionUrl()));
connect(act, SIGNAL(middleClicked()), this, SLOT(loadActionUrlInNewNotSelectedTab()));
m_menuHistoryRecent->addAction(act);
query.exec("SELECT title, url FROM history ORDER BY date DESC LIMIT 15");
while (query.next()) {
QUrl url = query.value(1).toUrl();
QString title = query.value(0).toString();
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(_iconForUrl(url), title);
act->setData(url);
connect(act, SIGNAL(triggered()), this, SLOT(loadActionUrl()));
connect(act, SIGNAL(middleClicked()), this, SLOT(loadActionUrlInNewNotSelectedTab()));
m_menuHistoryRecent->addAction(act);
}
else {
if (m_menuHistoryRecent->isEmpty()) {
m_menuHistoryRecent->addAction(tr("Empty"))->setEnabled(false);
}
}
@ -834,25 +833,24 @@ void QupZilla::aboutToShowHistoryRecentMenu()
void QupZilla::aboutToShowHistoryMostMenu()
{
m_menuHistoryMost->clear();
QSqlQuery query;
if (query.isNull(false)) {
query.exec("SELECT title, url FROM history ORDER BY count DESC LIMIT 15");
while (query.next()) {
QUrl url = query.value(1).toUrl();
QString title = query.value(0).toString();
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(_iconForUrl(url), title);
act->setData(url);
connect(act, SIGNAL(triggered()), this, SLOT(loadActionUrl()));
connect(act, SIGNAL(middleClicked()), this, SLOT(loadActionUrlInNewNotSelectedTab()));
m_menuHistoryMost->addAction(act);
QList<HistoryEntry> mostList = mApp->history()->mostVisited(10);
foreach(const HistoryEntry &entry, mostList) {
QString title = entry.title;
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(_iconForUrl(entry.url), title);
act->setData(entry.url);
connect(act, SIGNAL(triggered()), this, SLOT(loadActionUrl()));
connect(act, SIGNAL(middleClicked()), this, SLOT(loadActionUrlInNewNotSelectedTab()));
m_menuHistoryMost->addAction(act);
}
else {
if (m_menuHistoryMost->isEmpty()){
m_menuHistoryMost->addAction(tr("Empty"))->setEnabled(false);
}
}
@ -966,7 +964,7 @@ void QupZilla::aboutToShowEncodingMenu()
qSort(available);
QString activeCodec = mApp->webSettings()->defaultTextEncoding();
foreach(QByteArray name, available) {
foreach(const QByteArray &name, available) {
if (QTextCodec::codecForName(name)->aliases().contains(name)) {
continue;
}
@ -1124,7 +1122,7 @@ void QupZilla::loadFolderBookmarks(Menu* menu)
return;
}
foreach(Bookmark b, mApp->bookmarksModel()->folderBookmarks(folder)) {
foreach(const Bookmark &b, mApp->bookmarksModel()->folderBookmarks(folder)) {
tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab);
}
}

View File

@ -235,8 +235,8 @@ private:
Menu* m_menuBookmarks;
Menu* m_menuHistory;
QMenu* m_menuClosedTabs;
QMenu* m_menuHistoryRecent;
QMenu* m_menuHistoryMost;
Menu* m_menuHistoryRecent;
Menu* m_menuHistoryMost;
QMenu* m_menuEncoding;
QAction* m_menuBookmarksAction;
#ifdef Q_WS_MAC

View File

@ -265,8 +265,8 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
frames += frame->childFrames();
}
foreach(QWebElement formElement, allForms) {
foreach(QWebElement inputElement, formElement.findAll("input[type=\"password\"]")) {
foreach(const QWebElement &formElement, allForms) {
foreach(const QWebElement &inputElement, formElement.findAll("input[type=\"password\"]")) {
passwordName = inputElement.attribute("name");
passwordValue = getValueFromData(outgoingData, inputElement);
@ -289,7 +289,7 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
// We need to find username, we suppose that username is first not empty input[type=text] in form
// Tell me better solution. Maybe first try to find name="user", name="username" ?
foreach(QWebElement element, foundForm.findAll("input[type=\"text\"]")) {
foreach(const QWebElement &element, foundForm.findAll("input[type=\"text\"]")) {
usernameName = element.attribute("name");
usernameValue = getValueFromData(outgoingData, element);
if (!usernameName.isEmpty() && !usernameValue.isEmpty()) {

View File

@ -282,7 +282,7 @@ void BookmarksToolbar::loadFolderBookmarksInTabs()
return;
}
foreach(Bookmark b, m_bookmarksModel->folderBookmarks(folder)) {
foreach(const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
p_QupZilla->tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab);
}
}
@ -534,13 +534,14 @@ void BookmarksToolbar::aboutToShowFolderMenu()
menu->clear();
QString folder = menu->title();
foreach(Bookmark b, m_bookmarksModel->folderBookmarks(folder)) {
if (b.title.length() > 40) {
b.title.truncate(40);
b.title += "..";
foreach(const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
QString title = b.title;
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(IconProvider::iconFromImage(b.image), b.title);
Action* act = new Action(IconProvider::iconFromImage(b.image), title);
act->setData(b.url);
connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab()));
@ -548,7 +549,7 @@ void BookmarksToolbar::aboutToShowFolderMenu()
}
if (menu->isEmpty()) {
menu->addAction(tr("Empty"));
menu->addAction(tr("Empty"))->setEnabled(false);
}
}
@ -584,14 +585,15 @@ void BookmarksToolbar::refreshMostVisited()
{
m_menuMostVisited->clear();
QList<HistoryModel::HistoryEntry> mostList = m_historyModel->mostVisited(10);
foreach(HistoryModel::HistoryEntry entry, mostList) {
if (entry.title.length() > 40) {
entry.title.truncate(40);
entry.title += "..";
QList<HistoryEntry> mostList = m_historyModel->mostVisited(10);
foreach(const HistoryEntry &entry, mostList) {
QString title = entry.title;
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(_iconForUrl(entry.url), entry.title);
Action* act = new Action(_iconForUrl(entry.url), title);
act->setData(entry.url);
connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab()));
@ -599,6 +601,6 @@ void BookmarksToolbar::refreshMostVisited()
}
if (m_menuMostVisited->isEmpty()) {
m_menuMostVisited->addAction(tr("Empty"));
m_menuMostVisited->addAction(tr("Empty"))->setEnabled(false);
}
}

View File

@ -93,7 +93,7 @@ void BookmarksImportDialog::startFetchingIcons()
ui->progressBar->setMaximum(m_exportedBookmarks.count());
int i = 0;
foreach(BookmarksModel::Bookmark b, m_exportedBookmarks) {
foreach(const Bookmark &b, m_exportedBookmarks) {
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setText(0, b.title);
item->setIcon(0, QWebSettings::globalSettings()->webGraphic(QWebSettings::DefaultFrameIconGraphic));
@ -163,7 +163,7 @@ void BookmarksImportDialog::iconFetched(const QIcon &icon)
foreach(QTreeWidgetItem * item, items) {
item->setIcon(0, icon);
foreach(BookmarksModel::Bookmark b, m_exportedBookmarks) {
foreach(Bookmark b, m_exportedBookmarks) {
if (b.url == url) {
m_exportedBookmarks.removeOne(b);
b.image = icon.pixmap(16, 16).toImage();
@ -263,7 +263,7 @@ void BookmarksImportDialog::addExportedBookmarks()
model->createFolder(m_exportedBookmarks.at(0).folder);
}
foreach(BookmarksModel::Bookmark b, m_exportedBookmarks) {
foreach(const Bookmark &b, m_exportedBookmarks) {
model->saveBookmark(b.url, b.title, IconProvider::iconFromImage(b.image), b.folder);
}

View File

@ -53,7 +53,7 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const
QList<QNetworkCookie> newList = cookieList;
foreach(QNetworkCookie cok, newList) {
foreach(const QNetworkCookie &cok, newList) {
if (m_allowCookiesFromDomain && !QString("." + url.host()).contains(cok.domain().remove("www."))) {
#ifdef COOKIE_DEBUG
qDebug() << "purged for domain mismatch" << cok;

View File

@ -73,7 +73,7 @@ void CookieManager::removeCookie()
if (current->text(1).isEmpty()) { //Remove whole cookie group
QString domain = current->whatsThis(0);
foreach(QNetworkCookie cok, m_cookies) {
foreach(const QNetworkCookie &cok, m_cookies) {
if (cok.domain() == domain || cok.domain() == domain.mid(1)) {
m_cookies.removeOne(cok);
}

View File

@ -121,7 +121,7 @@ void DownloadManager::timerEvent(QTimerEvent* event)
}
QTime remaining;
foreach(QTime time, remTimes) {
foreach(const QTime &time, remTimes) {
if (time > remaining) {
remaining = time;
}

View File

@ -43,9 +43,9 @@ HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent)
connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearHistory()));
connect(ui->historyTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &)));
connect(m_historyModel, SIGNAL(historyEntryAdded(HistoryModel::HistoryEntry)), this, SLOT(historyEntryAdded(HistoryModel::HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryDeleted(HistoryModel::HistoryEntry)), this, SLOT(historyEntryDeleted(HistoryModel::HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryEdited(HistoryModel::HistoryEntry, HistoryModel::HistoryEntry)), this, SLOT(historyEntryEdited(HistoryModel::HistoryEntry, HistoryModel::HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryAdded(HistoryEntry)), this, SLOT(historyEntryAdded(HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryDeleted(HistoryEntry)), this, SLOT(historyEntryDeleted(HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryEdited(HistoryEntry, HistoryEntry)), this, SLOT(historyEntryEdited(HistoryEntry, HistoryEntry)));
connect(m_historyModel, SIGNAL(historyClear()), ui->historyTree, SLOT(clear()));
connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb()));
@ -144,7 +144,7 @@ void HistoryManager::deleteItem()
}
}
void HistoryManager::historyEntryAdded(const HistoryModel::HistoryEntry &entry)
void HistoryManager::historyEntryAdded(const HistoryEntry &entry)
{
QDate todayDate = QDate::currentDate();
QDate startOfWeekDate = todayDate.addDays(1 - todayDate.dayOfWeek());
@ -188,7 +188,7 @@ void HistoryManager::historyEntryAdded(const HistoryModel::HistoryEntry &entry)
ui->historyTree->prependToParentItem(parentItem, item);
}
void HistoryManager::historyEntryDeleted(const HistoryModel::HistoryEntry &entry)
void HistoryManager::historyEntryDeleted(const HistoryEntry &entry)
{
if (m_ignoredIds.contains(entry.id)) {
m_ignoredIds.removeOne(entry.id);
@ -208,7 +208,7 @@ void HistoryManager::historyEntryDeleted(const HistoryModel::HistoryEntry &entry
}
}
void HistoryManager::historyEntryEdited(const HistoryModel::HistoryEntry &before, const HistoryModel::HistoryEntry &after)
void HistoryManager::historyEntryEdited(const HistoryEntry &before, const HistoryEntry &after)
{
historyEntryDeleted(before);
historyEntryAdded(after);

View File

@ -55,9 +55,9 @@ private slots:
void loadInNewTab();
void copyUrl();
void historyEntryAdded(const HistoryModel::HistoryEntry &entry);
void historyEntryDeleted(const HistoryModel::HistoryEntry &entry);
void historyEntryEdited(const HistoryModel::HistoryEntry &before, const HistoryModel::HistoryEntry &after);
void historyEntryAdded(const HistoryEntry &entry);
void historyEntryDeleted(const HistoryEntry &entry);
void historyEntryEdited(const HistoryEntry &before, const HistoryEntry &after);
private:
QupZilla* getQupZilla();

View File

@ -29,7 +29,7 @@ HistoryModel::HistoryModel(QupZilla* mainClass)
{
loadSettings();
qRegisterMetaType<HistoryModel::HistoryEntry>("HistoryModel::HistoryEntry");
qRegisterMetaType<HistoryEntry>("HistoryEntry");
QThread* t = new QThread(this);
t->start();
@ -173,7 +173,7 @@ bool HistoryModel::urlIsStored(const QString &url)
return query.next();
}
QList<HistoryModel::HistoryEntry> HistoryModel::mostVisited(int count)
QList<HistoryEntry> HistoryModel::mostVisited(int count)
{
QList<HistoryEntry> list;
QSqlQuery query;

View File

@ -53,7 +53,7 @@ public:
bool urlIsStored(const QString &url);
QList<HistoryModel::HistoryEntry> mostVisited(int count);
QList<HistoryEntry> mostVisited(int count);
bool clearHistory();
bool optimizeHistory();
@ -67,9 +67,9 @@ private slots:
void slotDeleteHistoryEntry(int index);
signals:
void historyEntryAdded(HistoryModel::HistoryEntry entry);
void historyEntryDeleted(HistoryModel::HistoryEntry entry);
void historyEntryEdited(HistoryModel::HistoryEntry before, HistoryModel::HistoryEntry after);
void historyEntryAdded(HistoryEntry entry);
void historyEntryDeleted(HistoryEntry entry);
void historyEntryEdited(HistoryEntry before, HistoryEntry after);
//WARNING: Incomplete HistoryEntry structs are passed to historyEntryEdited!
void historyClear();
@ -81,4 +81,6 @@ private:
QupZilla* p_QupZilla;
};
typedef HistoryModel::HistoryEntry HistoryEntry;
#endif // HISTORYMODEL_H

View File

@ -39,7 +39,7 @@ int main(int argc, char* argv[])
if (argc > 1) {
CommandLineOptions cmd(argc, argv);
cmdActions = cmd.getActions();
foreach(CommandLineOptions::ActionPair pair, cmdActions) {
foreach(const CommandLineOptions::ActionPair &pair, cmdActions) {
switch (pair.action) {
case Qz::CL_ExitAction:
return 0;

View File

@ -58,7 +58,7 @@ QStringList LocationCompleter::splitPath(const QString &path) const
titleSearching = true;
}
QString prefix = url.mid(0, url.indexOf(path));
foreach(QString string, returned) {
foreach(const QString &string, returned) {
if (titleSearching) {
returned2.append(url);
}
@ -69,7 +69,7 @@ QStringList LocationCompleter::splitPath(const QString &path) const
return returned2;
}
else {
foreach(QString string, returned)
foreach(const QString &string, returned)
returned2.append("http://www.google.com/search?client=qupzilla&q=" + string);
return returned2;
}

View File

@ -107,7 +107,7 @@ void WebSearchBar::setupEngines()
m_boxSearchType->clearItems();
foreach(SearchEngine en, m_searchManager->allEngines()) {
foreach(const SearchEngine &en, m_searchManager->allEngines()) {
ButtonWithMenu::Item item;
item.icon = en.icon;
item.text = en.name;
@ -156,7 +156,7 @@ void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu)
QWebFrame* frame = view->page()->mainFrame();
QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]"));
foreach(QWebElement element, elements) {
foreach(const QWebElement &element, elements) {
if (element.attribute("type") != "application/opensearchdescription+xml") {
continue;
}

View File

@ -138,7 +138,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
}
int errorsIgnored = 0;
foreach(QSslError error, errors) {
foreach(const QSslError &error, errors) {
if (m_ignoredCerts.contains(error.certificate())) {
++errorsIgnored;
}
@ -160,7 +160,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
QString certs;
foreach(QSslError error, errors) {
foreach(const QSslError &error, errors) {
if (m_localCerts.contains(error.certificate())) {
continue;
}
@ -189,7 +189,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
return;
}
foreach(QSslError error, errors) {
foreach(const QSslError &error, errors) {
if (!m_localCerts.contains(error.certificate())) {
addLocalCertificate(error.certificate());
}
@ -414,7 +414,7 @@ void NetworkManager::loadCertificates()
//CA Certificates
m_caCerts = QSslSocket::defaultCaCertificates();
foreach(QString path, m_certPaths) {
foreach(const QString &path, m_certPaths) {
#ifdef Q_WS_WIN
// Used from Qt 4.7.4 qsslcertificate.cpp and modified because QSslCertificate::fromPath
// is kind of a bugged on Windows, it does work only with full path to cert file

View File

@ -159,7 +159,7 @@ void SearchEnginesDialog::reloadEngines()
{
ui->treeWidget->clear();
foreach(SearchEngine en, m_manager->allEngines()) {
foreach(const SearchEngine &en, m_manager->allEngines()) {
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setIcon(0, en.icon);
item->setText(0, en.name);

View File

@ -78,7 +78,7 @@ SearchEngine SearchEnginesManager::engineForShortcut(const QString &shortcut)
return returnEngine;
}
foreach(Engine en, m_allEngines) {
foreach(const Engine &en, m_allEngines) {
if (en.shortcut == shortcut) {
returnEngine = en;
break;
@ -326,7 +326,7 @@ void SearchEnginesManager::saveSettings()
QSqlQuery query;
query.exec("DELETE FROM search_engines");
foreach(Engine en, m_allEngines) {
foreach(const Engine &en, m_allEngines) {
query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters) VALUES (?, ?, ?, ?, ?, ?)");
query.bindValue(0, en.name);
query.bindValue(1, IconProvider::iconToBase64(en.icon));

View File

@ -142,7 +142,7 @@ void ClickToFlash::hideAdBlocked()
{
findElement();
if (!m_element.isNull()) {
m_element.setAttribute("style", "display:none;");
m_element.setStyleProperty("visibility", "hidden");
}
else {
hide();
@ -205,8 +205,7 @@ void ClickToFlash::findElement()
elements.append(docElement.findAll(QLatin1String("embed")));
elements.append(docElement.findAll(QLatin1String("object")));
QWebElement element;
foreach(element, elements) {
foreach(const QWebElement &element, elements) {
if (!checkElement(element) && !checkUrlOnElement(element)) {
continue;
}
@ -252,7 +251,7 @@ bool ClickToFlash::checkUrlOnElement(QWebElement el)
bool ClickToFlash::checkElement(QWebElement el)
{
if (m_argumentNames == el.attributeNames()) {
foreach(QString name, m_argumentNames) {
foreach(const QString &name, m_argumentNames) {
if (m_argumentValues.indexOf(el.attribute(name)) == -1) {
return false;
}
@ -272,7 +271,7 @@ void ClickToFlash::showInfo()
lay->addRow(new QLabel(tr("<b>Attribute Name</b>")), new QLabel(tr("<b>Value</b>")));
int i = 0;
foreach(QString name, m_argumentNames) {
foreach(const QString &name, m_argumentNames) {
QString value = m_argumentValues.at(i);
SqueezeLabelV2* valueLabel = new SqueezeLabelV2(value);
valueLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);

View File

@ -54,7 +54,7 @@ void Plugins::loadPlugins()
QDir pluginsDir = QDir(mApp->PLUGINSDIR);
foreach(QString fileName, pluginsDir.entryList(QDir::Files)) {
foreach(const QString &fileName, pluginsDir.entryList(QDir::Files)) {
m_availablePluginFileNames.append(fileName);
if (!m_allowedPluginFileNames.contains(fileName)) {

View File

@ -154,7 +154,7 @@ QString SpeedDial::initialScript()
QStringList entries = m_allPages.split("\";");
foreach(QString entry, entries) {
foreach(const QString &entry, entries) {
if (entry.isEmpty()) {
continue;
}

View File

@ -78,7 +78,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
settings.beginGroup("Language");
QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
foreach(QString code, langs) {
foreach(const QString &code, langs) {
QString code_ = code;
QLocale loc = QLocale(code_.replace("-", "_"));
QString label;

View File

@ -56,7 +56,7 @@ PluginsList::PluginsList(QWidget* parent)
QStringList whitelist = mApp->plugins()->c2f_getWhiteList();
ui->allowClick2Flash->setChecked(settings.value("Enable", true).toBool());
settings.endGroup();
foreach(QString site, whitelist) {
foreach(const QString &site, whitelist) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->whitelist);
item->setText(0, site);
}
@ -126,7 +126,7 @@ void PluginsList::refresh()
QStringList availablePlugins = mApp->plugins()->getAvailablePlugins();
QStringList allowedPlugins = mApp->plugins()->getAllowedPlugins();
foreach(QString fileName, availablePlugins) {
foreach(const QString &fileName, availablePlugins) {
PluginInterface* plugin = mApp->plugins()->getPlugin(fileName);
if (!plugin) {
continue;

View File

@ -160,7 +160,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->startProfile->addItem(actProfileName);
QDir profilesDir(mApp->PROFILEDIR + "profiles/");
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach(QString name, list_) {
foreach(const QString &name, list_) {
if (actProfileName == name) {
continue;
}
@ -343,7 +343,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
QDir lanDir(mApp->TRANSLATIONSDIR);
QStringList list = lanDir.entryList(QStringList("*.qm"));
foreach(QString name, list) {
foreach(const QString &name, list) {
if (name.startsWith("qt_") || name == activeLanguage) {
continue;
}

View File

@ -75,12 +75,14 @@ void SSLManager::refreshCAList()
ui->caList->setUpdatesEnabled(false);
ui->caList->clear();
m_caCerts = QSslSocket::defaultCaCertificates();
foreach(QSslCertificate cert, m_caCerts) {
foreach(const QSslCertificate &cert, m_caCerts) {
QListWidgetItem* item = new QListWidgetItem(ui->caList);
item->setText(CertificateInfoWidget::certificateItemText(cert));
item->setWhatsThis(QString::number(m_caCerts.indexOf(cert)));
ui->caList->addItem(item);
}
ui->caList->setCurrentRow(0);
ui->caList->setUpdatesEnabled(true);
}
@ -90,20 +92,23 @@ void SSLManager::refreshLocalList()
ui->localList->setUpdatesEnabled(false);
ui->localList->clear();
m_localCerts = mApp->networkManager()->getLocalCertificates();
foreach(QSslCertificate cert, m_localCerts) {
foreach(const QSslCertificate &cert, m_localCerts) {
QListWidgetItem* item = new QListWidgetItem(ui->localList);
item->setText(CertificateInfoWidget::certificateItemText(cert));
item->setWhatsThis(QString::number(m_localCerts.indexOf(cert)));
ui->localList->addItem(item);
}
ui->localList->setCurrentRow(0);
ui->localList->setUpdatesEnabled(true);
}
void SSLManager::refreshPaths()
{
foreach(QString path, mApp->networkManager()->certificatePaths())
ui->pathList->addItem(path);
foreach(const QString &path, mApp->networkManager()->certificatePaths()) {
ui->pathList->addItem(path);
}
}
void SSLManager::showCaCertInfo()

View File

@ -41,7 +41,8 @@ ThemeManager::ThemeManager(QWidget* parent)
QDir themeDir(mApp->THEMESDIR);
QStringList list = themeDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
foreach(QString name, list) {
foreach(const QString &name, list) {
Theme themeInfo = parseTheme(name);
if (!themeInfo.isValid) {
continue;

View File

@ -38,9 +38,9 @@ HistorySideBar::HistorySideBar(QupZilla* mainClass, QWidget* parent)
connect(ui->search, SIGNAL(textEdited(QString)), ui->historyTree, SLOT(filterString(QString)));
// connect(ui->search, SIGNAL(textEdited(QString)), this, SLOT(search()));
connect(m_historyModel, SIGNAL(historyEntryAdded(HistoryModel::HistoryEntry)), this, SLOT(historyEntryAdded(HistoryModel::HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryDeleted(HistoryModel::HistoryEntry)), this, SLOT(historyEntryDeleted(HistoryModel::HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryEdited(HistoryModel::HistoryEntry, HistoryModel::HistoryEntry)), this, SLOT(historyEntryEdited(HistoryModel::HistoryEntry, HistoryModel::HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryAdded(HistoryEntry)), this, SLOT(historyEntryAdded(HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryDeleted(HistoryEntry)), this, SLOT(historyEntryDeleted(HistoryEntry)));
connect(m_historyModel, SIGNAL(historyEntryEdited(HistoryEntry, HistoryEntry)), this, SLOT(historyEntryEdited(HistoryEntry, HistoryEntry)));
connect(m_historyModel, SIGNAL(historyClear()), ui->historyTree, SLOT(clear()));
QTimer::singleShot(0, this, SLOT(refreshTable()));
@ -103,7 +103,7 @@ void HistorySideBar::contextMenuRequested(const QPoint &position)
menu.exec(p);
}
void HistorySideBar::historyEntryAdded(const HistoryModel::HistoryEntry &entry)
void HistorySideBar::historyEntryAdded(const HistoryEntry &entry)
{
QDate todayDate = QDate::currentDate();
QDate startOfWeekDate = todayDate.addDays(1 - todayDate.dayOfWeek());
@ -146,7 +146,7 @@ void HistorySideBar::historyEntryAdded(const HistoryModel::HistoryEntry &entry)
ui->historyTree->prependToParentItem(parentItem, item);
}
void HistorySideBar::historyEntryDeleted(const HistoryModel::HistoryEntry &entry)
void HistorySideBar::historyEntryDeleted(const HistoryEntry &entry)
{
QList<QTreeWidgetItem*> list = ui->historyTree->allItems();
foreach(QTreeWidgetItem * item, list) {
@ -161,7 +161,7 @@ void HistorySideBar::historyEntryDeleted(const HistoryModel::HistoryEntry &entry
}
}
void HistorySideBar::historyEntryEdited(const HistoryModel::HistoryEntry &before, const HistoryModel::HistoryEntry &after)
void HistorySideBar::historyEntryEdited(const HistoryEntry &before, const HistoryEntry &after)
{
historyEntryDeleted(before);
historyEntryAdded(after);

View File

@ -51,9 +51,9 @@ private slots:
void copyAddress();
void historyEntryAdded(const HistoryModel::HistoryEntry &entry);
void historyEntryDeleted(const HistoryModel::HistoryEntry &entry);
void historyEntryEdited(const HistoryModel::HistoryEntry &before, const HistoryModel::HistoryEntry &after);
void historyEntryAdded(const HistoryEntry &entry);
void historyEntryDeleted(const HistoryEntry &entry);
void historyEntryEdited(const HistoryEntry &before, const HistoryEntry &after);
private:
Ui::HistorySideBar* ui;

View File

@ -134,7 +134,7 @@ void ButtonWithMenu::generateMenu()
{
m_menu->clear();
foreach(Item item, m_items) {
foreach(const Item &item, m_items) {
QVariant variant;
variant.setValue<Item>(item);
m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant);

View File

@ -40,7 +40,7 @@ void IconProvider::saveIcon(WebView* view)
return;
}
foreach(Icon ic, m_iconBuffer) {
foreach(const Icon &ic, m_iconBuffer) {
if (ic.url == item.url && ic.image == item.image) {
return;
}
@ -51,7 +51,7 @@ void IconProvider::saveIcon(WebView* view)
QImage IconProvider::iconForUrl(const QUrl &url)
{
foreach(Icon ic, m_iconBuffer) {
foreach(const Icon &ic, m_iconBuffer) {
if (ic.url == url) {
return ic.image;
}
@ -70,7 +70,7 @@ QImage IconProvider::iconForUrl(const QUrl &url)
QImage IconProvider::iconForDomain(const QUrl &url)
{
foreach(Icon ic, m_iconBuffer) {
foreach(const Icon &ic, m_iconBuffer) {
if (ic.url.host() == url.host()) {
return ic.image;
}
@ -87,7 +87,7 @@ QImage IconProvider::iconForDomain(const QUrl &url)
void IconProvider::saveIconsToDatabase()
{
foreach(Icon ic, m_iconBuffer) {
foreach(const Icon &ic, m_iconBuffer) {
QSqlQuery query;
query.prepare("SELECT id FROM icons WHERE url = ?");
query.bindValue(0, ic.url.toEncoded(QUrl::RemoveFragment));

View File

@ -323,6 +323,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p);
return;
}

View File

@ -516,13 +516,15 @@ void TabWidget::restoreAllClosedTabs()
}
QList<ClosedTabsManager::Tab> closedTabs = m_closedTabsManager->allClosedTabs();
foreach(ClosedTabsManager::Tab tab, closedTabs) {
foreach(const ClosedTabsManager::Tab &tab, closedTabs) {
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab);
QDataStream historyStream(tab.history);
historyStream >> *weView(index)->history();
weView(index)->load(tab.url);
}
m_closedTabsManager->clearList();
}
@ -544,7 +546,7 @@ void TabWidget::aboutToShowClosedTabsMenu()
else {
m_menuTabs->clear();
int i = 0;
foreach(ClosedTabsManager::Tab tab, this->closedTabsManager()->allClosedTabs()) {
foreach(const ClosedTabsManager::Tab &tab, this->closedTabsManager()->allClosedTabs()) {
QString title = tab.title;
if (title.length() > 40) {
title.truncate(40);

View File

@ -27,7 +27,7 @@ QList<QWebHistoryItem> WebHistoryWrapper::forwardItems(int maxItems, QWebHistory
QUrl lastUrl = history->currentItem().url();
int count = 0;
foreach(QWebHistoryItem item, history->forwardItems(maxItems + 5)) {
foreach(const QWebHistoryItem &item, history->forwardItems(maxItems + 5)) {
if (item.url() == lastUrl || count == maxItems) {
continue;
}

View File

@ -289,7 +289,7 @@ void WebPage::cleanBlockedObjects()
{
QStringList findingStrings;
foreach(AdBlockedEntry entry, m_adBlockedEntries) {
foreach(const AdBlockedEntry &entry, m_adBlockedEntries) {
if (entry.url.toString().endsWith(".js")) {
continue;
}
@ -308,10 +308,14 @@ void WebPage::cleanBlockedObjects()
QWebElement docElement = mainFrame()->documentElement();
QWebElementCollection elements;
foreach(QString s, findingStrings)
elements.append(docElement.findAll("*[src=\"" + s + "\"]"));
foreach(QWebElement element, elements)
element.setAttribute("style", "display:none;");
foreach(const QString &s, findingStrings) {
elements.append(docElement.findAll("*[src=\"" + s + "\"]"));
}
foreach(QWebElement element, elements) {
element.setStyleProperty("visibility", "hidden");
}
}
QString WebPage::userAgentForUrl(const QUrl &url) const
@ -410,12 +414,14 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
QWebElementCollection elements;
elements.append(docElement.findAll("iframe"));
foreach(QWebElement element, elements) {
QString src = element.attribute("src");
if (exOption->url.toString().contains(src)) {
element.setAttribute("style", "display:none;");
element.setStyleProperty("visibility", "hidden");
}
}
return false;
}
else { //The whole page is blocked

View File

@ -538,12 +538,10 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
createSelectedTextContextMenu(menu, hitTest);
}
if (menu->isEmpty() && selectedText().isEmpty()) {
if (menu->isEmpty()) {
createPageContextMenu(menu, pos);
}
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
// still bugged? in 4.8 RC (it shows selection of webkit's internal source, not html from page)
// it may or may not be bug, but this implementation is useless for us
@ -859,8 +857,11 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
event->type() == QEvent::MouseMove) {
QMouseEvent* ev = static_cast<QMouseEvent*>(event);
if (ev->type() == QEvent::MouseMove
&& !(ev->buttons() & Qt::LeftButton)) {
if (ev->type() == QEvent::MouseMove && !(ev->buttons() & Qt::LeftButton)) {
return false;
}
if (ev->type() == QEvent::MouseButtonPress && ev->buttons() & Qt::RightButton) {
return false;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2239,6 +2239,10 @@
<source>Don&apos;t quit upon closing last tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closed tabs list instead of opened in tab bar</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -2632,6 +2636,14 @@
<source>You have successfully added RSS feed &quot;%1&quot;.</source>
<translation type="unfinished">Úspešne ste pridali RSS odberl &quot;%1&quot;.</translation>
</message>
<message>
<source>Recently Visited</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Most Visited</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QupZillaSchemeReply</name>
@ -3543,7 +3555,7 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad
</message>
<message>
<source>Show list of opened tabs</source>
<translation>Zobraziť zoznam otvorených kariet</translation>
<translation type="obsolete">Zobraziť zoznam otvorených kariet</translation>
</message>
<message>
<source>Loading...</source>
@ -3553,6 +3565,22 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad
<source>No Named Page</source>
<translation>Nepomenovaná tránka</translation>
</message>
<message>
<source>List of tabs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Restore All Closed Tabs</source>
<translation type="unfinished">Obnoviť všetky zatvorené karty</translation>
</message>
<message>
<source>Clear list</source>
<translation type="unfinished">Vyčistiť zoznam</translation>
</message>
</context>
<context>
<name>TabbedWebView</name>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff