From kde-commits Fri Mar 12 16:28:42 2004 From: Waldo Bastian Date: Fri, 12 Mar 2004 16:28:42 +0000 To: kde-commits Subject: KDE_3_2_BRANCH: kdelibs/kdecore Message-Id: <20040312162842.9597A99A8 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=107910892920894 CVS commit by waba: Don't encode @ in mailto: URL (url and prettyURL) M +29 -2 kurl.cpp 1.265.2.3 --- kdelibs/kdecore/kurl.cpp #1.265.2.2:1.265.2.3 @@ -1264,6 +1264,19 @@ QString KURL::encodedPathAndQuery( int _ if ( _no_empty_path && tmp.isEmpty() ) tmp = "/"; + if (m_iUriMode == Mailto) + { + int atIndex = tmp.findRev('@'); + if (atIndex == -1) + tmp = encode( tmp, false, encoding_hint ); + else + tmp = encode( tmp.left(atIndex), false, encoding_hint) + + '@' + + encode( tmp.mid(atIndex+1), false, encoding_hint); + } + else + { tmp = encode( tmp, false, encoding_hint ); } + } // TODO apply encoding_hint to the query @@ -1509,5 +1522,19 @@ QString KURL::prettyURL( int _trailing ) } + if (m_iUriMode == Mailto) + { + int atIndex = m_strPath.findRev('@'); + if (atIndex == -1) + u += lazy_encode( m_strPath ); + else + u += lazy_encode( m_strPath.left(atIndex) ) + + '@' + + lazy_encode( m_strPath.mid(atIndex+1) ); + } + else + { u += trailingSlash( _trailing, lazy_encode( m_strPath ) ); + } + if (!m_strQuery_encoded.isNull()) u += '?' + m_strQuery_encoded;