From 8893e39a048a68864770403e4b99feda67464d70 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 14 Oct 2011 17:00:35 +0200 Subject: Sanitizing strings... --- src/mainwindow.cpp | 7 +++++-- src/protocolhandler.cpp | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index abd5455a..23ccf25d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -99,6 +99,7 @@ #include #include +#include MainWindow::MainWindow() @@ -1196,6 +1197,8 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) break; } + QString msgToShow = Qt::escape(msg); + // useful values WebTab *tab = m_view->currentWebTab(); @@ -1208,13 +1211,13 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) // Set Popup size QFontMetrics fm = m_popup->fontMetrics(); - QSize labelSize(fm.width(msg) + 2 * margin, fm.height() + 2 * margin); + QSize labelSize(fm.width(msgToShow) + 2 * margin, fm.height() + 2 * margin); if (labelSize.width() > halfWidth) labelSize.setWidth(halfWidth); m_popup->setFixedSize(labelSize); - m_popup->setText(fm.elidedText(msg, Qt::ElideMiddle, labelSize.width() - 2 * margin)); + m_popup->setText(fm.elidedText(msgToShow, Qt::ElideMiddle, labelSize.width() - 2 * margin)); const bool horizontalScrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal); const bool verticalScrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Vertical); diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 2af4214f..9bd029f2 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -55,6 +55,7 @@ // Qt Includes #include #include +#include static bool fileItemListLessThan(const KFileItem &s1, const KFileItem &s2) @@ -298,14 +299,14 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list) Q_FOREACH(const KFileItem & item, orderedList) { msg += ""; - QString fullPath = item.url().prettyUrl(); + QString fullPath = Qt::escape(item.url().prettyUrl()); QString iconName = item.iconName(); QString icon = QString("file://") + KIconLoader::global()->iconPath(iconName, KIconLoader::Small); msg += ""; msg += "\"" "; - msg += "" + item.name() + ""; + msg += "" + Qt::escape(item.name()) + ""; msg += ""; msg += ""; -- cgit v1.2.1 From 1557a5f87b7fbb0bbfe55f154291cb403ebfa2a1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 14 Oct 2011 17:30:21 +0200 Subject: EBN Krazy fixes It seems now we are really ready for the stable release... --- src/application.cpp | 1 - src/mainview.cpp | 2 +- src/newtabpage.cpp | 2 +- src/opensearch/suggestionparser.h | 12 ++++++------ src/urlbar/urlbar.cpp | 16 +++++++++++++--- src/useragent/useragentinfo.cpp | 4 ++-- 6 files changed, 23 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index 6f9df43a..e1802099 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -61,7 +61,6 @@ #include #include #include -#include // Qt Includes #include diff --git a/src/mainview.cpp b/src/mainview.cpp index 0cd61ddd..2b5a8202 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -644,7 +644,7 @@ void MainView::openClosedTab() { WebView *view = rApp->mainWindow()->mainView()->newWebTab()->view(); TabHistory history; - Q_FOREACH(TabHistory item, m_recentlyClosedTabs) + Q_FOREACH(const TabHistory & item, m_recentlyClosedTabs) { if (item.history == action->data().toByteArray()) { diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index ba0c37ce..f797e497 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -632,4 +632,4 @@ void NewTabPage::updateWindowIcon() { int currentIndex = rApp->mainWindow()->mainView()->currentIndex(); rApp->mainWindow()->changeWindowIcon(currentIndex); -} \ No newline at end of file +} diff --git a/src/opensearch/suggestionparser.h b/src/opensearch/suggestionparser.h index 523a4e6f..c8a61b99 100644 --- a/src/opensearch/suggestionparser.h +++ b/src/opensearch/suggestionparser.h @@ -67,12 +67,12 @@ public: {}; - Response(const QString &_title = QString(), - const QString &_description = QString(), - const QString &_url = QString(), - const QString &_image = QString(), - const int &_image_width = 0, - const int &_image_height = 0) : title(_title), + explicit Response(const QString &_title = QString(), + const QString &_description = QString(), + const QString &_url = QString(), + const QString &_image = QString(), + const int &_image_width = 0, + const int &_image_height = 0) : title(_title), description(_description), url(_url), image(_image), diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 0515f58b..7b77f3db 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -294,7 +294,7 @@ void UrlBar::keyPressEvent(QKeyEvent *event) { clearFocus(); if (text() != rApp->mainWindow()->currentTab()->view()->url().toString() - && !rApp->mainWindow()->currentTab()->view()->url().toString().startsWith("about")) + && !rApp->mainWindow()->currentTab()->view()->url().toString().startsWith(QL1S("about"))) setText(rApp->mainWindow()->currentTab()->view()->url().toString()); event->accept(); } @@ -518,10 +518,20 @@ void UrlBar::contextMenuEvent(QContextMenuEvent* event) bool UrlBar::isValidURL(QString url) { bool isValid = false; - if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("ftp://")) + if (url.startsWith(QL1S("http://")) + || url.startsWith(QL1S("https://")) + || url.startsWith(QL1S("ftp://")) + ) url = url.remove(QRegExp("(http|https|ftp)://")); - if (url.contains('.') && url.indexOf('.') > 0 && url.indexOf('.') < url.length() && !url.trimmed().contains(" ") && QUrl::fromUserInput(url).isValid()) + + if (url.contains(QL1C('.')) + && url.indexOf(QL1C('.')) > 0 + && url.indexOf(QL1C('.')) < url.length() + && !url.trimmed().contains(QL1C(' ')) + && QUrl::fromUserInput(url).isValid() + ) isValid = true; + return isValid; } diff --git a/src/useragent/useragentinfo.cpp b/src/useragent/useragentinfo.cpp index d7defd59..0829a7e1 100644 --- a/src/useragent/useragentinfo.cpp +++ b/src/useragent/useragentinfo.cpp @@ -137,10 +137,10 @@ QString UserAgentInfo::userAgentDescription(int i) if (!systemName.isEmpty() && !systemRelease.isEmpty()) { // FIXME: needs a proper translation after stable release - systemSummary = " " % QL1S("on") % " " % systemName % " " % systemRelease; + systemSummary = QL1C(' ') % QL1S("on") % QL1C(' ') % systemName % QL1C(' ') % systemRelease; } - return userAgentName(i) % " " % userAgentVersion(i) % systemSummary; + return userAgentName(i) % QL1C(' ') % userAgentVersion(i) % systemSummary; } -- cgit v1.2.1 From afc4eeceb6f716043543621c7bcd2f1cc4685583 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 16 Oct 2011 10:59:01 +0200 Subject: Fix strings as suggested in i18n-doc ml CCMAIL: aspotashev@gmail.com --- src/application.cpp | 2 +- src/sslinfo.ui | 6 +----- src/urlbar/sslwidget.cpp | 14 +++++++------- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index e1802099..d770b3d1 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -732,7 +732,7 @@ void Application::queryQuit() { int answer = KMessageBox::questionYesNoCancel( mainWindow(), - i18n("Wanna close the window or the whole app?"), + i18n("Do you want to close the window or the whole application?"), i18n("Application/Window closing..."), KGuiItem(i18n("C&lose Current Window"), KIcon("window-close")), diff --git a/src/sslinfo.ui b/src/sslinfo.ui index 41393bb4..3ed117a8 100644 --- a/src/sslinfo.ui +++ b/src/sslinfo.ui @@ -298,11 +298,7 @@ - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:medium; font-weight:600;">Digests:</span></p></body></html> + <h4>Digests:</h4> diff --git a/src/urlbar/sslwidget.cpp b/src/urlbar/sslwidget.cpp index 525df7a1..708c1259 100644 --- a/src/urlbar/sslwidget.cpp +++ b/src/urlbar/sslwidget.cpp @@ -81,7 +81,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) label->setWordWrap(true); if (cert.isNull()) { - label->setText(i18n("Warning: this site is NOT carrying a certificate!")); + label->setText(i18n("Warning: this site is NOT carrying a certificate.")); imageLabel->setPixmap(KIcon("security-low").pixmap(32)); layout->addWidget(label, rows++, 1); } @@ -103,7 +103,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) } c += QL1S(""); - label->setText(i18n("The certificate for this site is NOT valid, for the following reasons:\n%1", c)); + label->setText(i18n("The certificate for this site is NOT valid, for the following reasons:\n%1.", c)); label->setTextFormat(Qt::RichText); imageLabel->setPixmap(KIcon("security-low").pixmap(32)); } @@ -112,7 +112,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) label = new QLabel(this); label->setWordWrap(true); - label->setText("Certificate Information"); + label->setText(QL1S("\"") + i18n("Certificate Information") + QL1S("")); connect(label, SIGNAL(linkActivated(const QString &)), this, SLOT(showMoreSslInfos(const QString &))); layout->addWidget(label, rows++, 1); } @@ -134,7 +134,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) { label = new QLabel(this); label->setWordWrap(true); - label->setText(i18n("Your connection to %1 is NOT encrypted!!\n", m_url.host())); + label->setText(i18n("Your connection to %1 is NOT encrypted.\n", m_url.host())); layout->addWidget(label, rows++ , 1); imageLabel->setPixmap(KIcon("security-low").pixmap(32)); @@ -143,7 +143,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) { label = new QLabel(this); label->setWordWrap(true); - label->setText(i18n("Your connection to \"%1\" is encrypted!\n", m_url.host())); + label->setText(i18n("Your connection to \"%1\" is encrypted.\n", m_url.host())); layout->addWidget(label, rows++, 1); QString vers = m_info.protocol(); @@ -211,12 +211,12 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent) if (firstVisit.visitCount == 1) { - label->setText(i18n("It is your first time visiting this site!")); + label->setText(i18n("It is your first time visiting this site.")); imageLabel->setPixmap(KIcon("security-medium").pixmap(32)); } else { - label->setText(i18n("You just visited this site!\nYour first visit was on %1.\n", firstVisit.firstDateTimeVisit.toString())); + label->setText(i18n("You just visited this site.\nYour first visit was on %1.\n", firstVisit.firstDateTimeVisit.toString())); imageLabel->setPixmap(KIcon("security-high").pixmap(32)); } layout->addWidget(label, rows++, 1); -- cgit v1.2.1