Fix for Unicode cel URLs from v1.6.1 branch.

Fix for Unicode URLs in KDE bookmarks menu.
pull/110/head
Andrew Tribick 2011-03-13 00:58:23 +00:00
parent d73c47c060
commit 94d590e67f
3 changed files with 10 additions and 10 deletions

View File

@ -307,7 +307,7 @@ void KCelBookmarkMenu::slotAddRelativeBookmark()
KMessageBox::error( 0L, i18n("Can't add bookmark with empty URL"));
return;
}
QString title = QString(Url.getName().c_str());
QString title = QString::fromUtf8(Url::decodeString(Url.getName()).c_str());
if (title.isEmpty())
title = url;
@ -354,7 +354,7 @@ void KCelBookmarkMenu::slotAddSettingsBookmark()
KMessageBox::error( 0L, i18n("Can't add bookmark with empty URL"));
return;
}
QString title = QString(Url.getName().c_str());
QString title = QString::fromUtf8(Url::decodeString(Url.getName()).c_str());
if (title.isEmpty())
title = url;
@ -401,7 +401,7 @@ void KCelBookmarkMenu::slotAddBookmark()
KMessageBox::error( 0L, i18n("Can't add bookmark with empty URL"));
return;
}
QString title = QString(Url.getName().c_str());
QString title = QString::fromUtf8(Url::decodeString(Url.getName()).c_str());
if (title.isEmpty())
title = url;

View File

@ -237,7 +237,7 @@ void KdeApp::setStartURL(KURL url) {
void KdeApp::goToURL(const KURL& url) {
if (url.protocol() == "cel") {
appCore->addToHistory();
appCore->goToUrl(url.prettyURL().latin1());
appCore->goToUrl(url.url().latin1());
}
if (url.protocol() == "file") {
appCore->addToHistory();
@ -248,7 +248,7 @@ void KdeApp::goToURL(const KURL& url) {
void KdeApp::openBookmarkURL(const QString& _url) {
KURL url(_url);
appCore->addToHistory();
appCore->goToUrl(url.prettyURL().latin1());
appCore->goToUrl(url.url().latin1());
}
Url KdeApp::currentUrl(Url::UrlType type) const
@ -1508,11 +1508,11 @@ void KdeApp::slotCopyUrl() {
void KdeApp::slotGoTo() {
bool ok;
QString url = KInputDialog::getText(i18n("Go to URL"), i18n("Enter URL"), "", &ok, this);
QString _url = KInputDialog::getText(i18n("Go to URL"), i18n("Enter URL"), "", &ok, this);
if (ok) {
KURL url(_url);
appCore->addToHistory();
appCore->goToUrl(url.latin1());
appCore->goToUrl(url.url().latin1());
}
}

View File

@ -885,7 +885,7 @@ string Url::encodeString(const string& str)
for (string::const_iterator iter = str.begin(); iter != str.end(); iter++)
{
int ch = *iter;
int ch = (unsigned char) *iter;
bool encode = false;
if (ch <= 32 || ch >= 128)
{
@ -912,7 +912,7 @@ string Url::encodeString(const string& str)
if (encode)
{
enc << '%' << setw(2) << hex << (unsigned int) ch;
enc << '%' << setw(2) << hex << ch;
}
else
{