[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/krdc
From:       Urs Wolfer <uwolfer () kde ! org>
Date:       2013-01-06 10:46:19
Message-ID: 20130106104619.DCC22AC86A () svn ! kde ! org
[Download RAW message or body]

SVN commit 1330946 by uwolfer:

improve url parsing

- KUrl does a way better job than manal string splitting... (e.g. password / username \
handling)

 M  +2 -17     mainwindow.cpp  


--- trunk/KDE/kdenetwork/krdc/mainwindow.cpp #1330945:1330946
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
+** Copyright (C) 2007 - 2013 Urs Wolfer <uwolfer @ kde.org>
 ** Copyright (C) 2009 - 2010 Tony Murray <murraytony @ gmail.com>
 **
 ** This file is part of KDE.
@@ -284,24 +284,9 @@
 
 KUrl MainWindow::getInputUrl()
 {
-    KUrl inputUrl;
-    inputUrl.setProtocol(m_protocolInput->currentText());
-
-    // Work around incorrect KUrl parsing of @
-    QString enteredAddress = m_addressInput->text();
-    int atLocation = enteredAddress.lastIndexOf(QLatin1Char('@'));
-
-    // set the non-username part of the url
-    inputUrl.setAuthority(enteredAddress.mid(atLocation + 1));
-
-    // if the url contains @, set the username part. it needs to be utf8 encoded
-    if(atLocation > 0) {
-        inputUrl.setUserName(enteredAddress.left(atLocation));
+    return KUrl(m_protocolInput->currentText() + "://" + m_addressInput->text());
     }
 
-    return inputUrl;
-}
-
 void MainWindow::newConnection(const KUrl &newUrl, bool \
switchFullscreenWhenConnected, const QString &tabName)  {
     m_switchFullscreenWhenConnected = switchFullscreenWhenConnected;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic