Translation of \\foo\bar links into smb://foo/bar links
Jason Keirstead
jason at keirstead.org
Mon Jan 17 19:47:33 GMT 2005
Where would I look for the code that handles default consatruction of URLs in
kurl.cpp?
Namely, I am looking for the code that would turn a URL like this:
\\Server\Share
into this:
file://Server\Share
I know that it doesn't know what it is so it is defaulting to file, but I
hoped I could change the default for URLs that start with \\ to be smb://.
This would make KDE much more compatible in a Windows-centric office, where
people often send emails with links to SMB shares in them.
I tried finding the right code, and ended up with the patch below, but it does
not seem to suffice. I think I need to do something else in the paseURL
function, but I really got lost in there. Any pointers?
Index: kurl.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kurl.cpp,v
retrieving revision 1.285
diff -u -p -b -w -B -r1.285 kurl.cpp
--- kurl.cpp 3 Dec 2004 13:18:56 -0000 1.285
+++ kurl.cpp 17 Jan 2005 19:42:42 -0000
@@ -654,6 +654,14 @@ void KURL::parse( const QString& _url, i
parseURL( _url, encoding_hint );
return;
}
+ else if( _url.startsWith("\\\\") )
+ {
+ m_iUriMode = URL;
+ m_strProtocol = "smb";
+ parseURL( _url, encoding_hint );
+ return;
+ }
+
if ( !isalpha( (int)x ) )
goto NodeErr;
--
If you wait by the river long enough, eventually
you will see the bodies of all your enemies float by.
- Sun Tzu
More information about the kde-core-devel
mailing list