Hello KDE team!
I have been following the KDE4 development since a couple
of months and recently decided to give KDE 4 a try as my default
desktop environment.
Tried Konqueror but couldn't setup it to use a proxy server.
Whatever I type in the manual proxy configuration dialog
it complains "The proxy settings you specified are invalid".
The patch in the attached file fixed it for me. I'm not sure
whether I got it right so I'll comment on my changes.
===================================================================
--- settings/kio/kmanualproxydlg.cpp (revision 713920)
+++ settings/kio/kmanualproxydlg.cpp (working copy)
@@ -78,6 +78,8 @@
connect( mDlg->leHttp, SIGNAL(textChanged(const QString&)), SLOT(textChanged(const QString&)) );
connect( mDlg->sbHttp, SIGNAL(valueChanged(int)), SLOT(valueChanged (int)) );
+
+ connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()));
}
void KManualProxyDlg::setProxyData( const KProxyData &data )
Comment: This one is trivial. Possibly the orphaned slot is a result of porting to KDE/Qt4.
@@ -93,7 +95,7 @@
if ( port <= 0 )
port = DEFAULT_PROXY_PORT;
- url.setPort( 0 );
+ url.setPort( -1 );
mDlg->leHttp->setText( url.url() );
mDlg->sbHttp->setValue( port );
}
@@ -124,7 +126,7 @@
if ( port <= 0 )
port = DEFAULT_PROXY_PORT;
- url.setPort( 0 );
+ url.setPort( -1 );
mDlg->leHttps->setText( url.url
() );
mDlg->sbHttps->setValue( port );
}
@@ -138,7 +140,7 @@
if ( port <= 0 )
port = DEFAULT_PROXY_PORT;
- url.setPort( 0 );
+
url.setPort( -1 );
mDlg->leFtp->setText( url.url() );
mDlg->sbFtp->setValue( port );
}
Comment: The Qt4 docs state it clearly: -1 means the port is unspecified.
One more result of porting?
@@ -412,8 +414,8 @@
// If the typed URL is malformed, and the filters cannot filter it
// then it must be an invalid entry.
- if( !(url.isValid() || KUriFilter::self()->filterUri(url, filters)) &&
- !url.hasHost() )
+ if( !(url.isValid() && KUriFilter::self()->filterUri(url, filters) &&
+ url.hasHost()) )
return false;
QString host (url.host());
Comment: This logic turned out to be broken. Let me explain.
If I type "10.242.100.5" in the http proxy field this function
( isValidURL( const QString& _url, KUrl* result ) ) constructs a KUrl
object from the entered text:
KUrl url(_url);
If you add a few debug lines like
kDebug() << "got url = " << url;
kDebug() << "got url.url = " <<
url.url();
kDebug() << "got url.scheme = " << url.scheme();
kDebug() << "got url.host = " << url.host();
kDebug() << "got url.port = " << url.port
();
kDebug() << "got url.fragment = " << url.fragment();
kDebug() << "got url.path = " << url.path();
you will get:
konqueror(25730) KManualProxyDlg::isValidURL: got
url.url = "10.242.100.5"
konqueror(25730) KManualProxyDlg::isValidURL: got url.scheme = ""
konqueror(25730) KManualProxyDlg::isValidURL: got url.host = ""
konqueror(25730) KManualProxyDlg::isValidURL: got url.port = -1
konqueror(25730) KManualProxyDlg::isValidURL: got url.fragment = ""
konqueror(25730) KManualProxyDlg::isValidURL: got url.path = "
10.242.100.5"
Note that the host part is empty and "10.242.100.5" actually became the path part
of the url. Nonetheless url.isValid
() in the "if" statement returns true
and therefore KUriFilter::self()->filterUri(url, filters) is not executed. We end
up with a broken url.
I guess that KDE/Qt3's KUrl class returns false in this case and then
KUriFilter::self()->filterUri(url, filters) converts the url to canonical form.
So I have changed the logic the way you see above.
With this patch Konqueror accepts proxy settings and works fine via
a proxy server.
Best regards,
Dmitry Ivanov
--
A: Because it destroys the flow of the conversation
Q: Why is top-posting bad?