okular
Go to the documentation of this file.
13 #include <kjs/kjsobject.h>
14 #include <kjs/kjsprototype.h>
15 #include <kjs/kjsarguments.h>
19 using namespace Okular;
23 static KJSObject
crackURL( KJSContext *context,
void *,
24 const KJSArguments &arguments )
26 if ( arguments.count() < 1 )
28 return context->throwException(
"Missing URL argument" );
30 QString cURL = arguments.at( 0 ).toString( context );
34 return context->throwException(
"Invalid URL" );
36 if ( url.protocol() != QLatin1String(
"file" )
37 || url.protocol() != QLatin1String(
"http" )
38 || url.protocol() != QLatin1String(
"https" ) )
40 return context->throwException(
"Protocol not valid: '" + url.protocol() +
'\'' );
44 obj.setProperty( context,
"cScheme", url.protocol() );
46 obj.setProperty( context,
"cUser", url.user() );
48 obj.setProperty( context,
"cPassword", url.password() );
49 obj.setProperty( context,
"cHost", url.host() );
50 obj.setProperty( context,
"nPort", url.port( 80 ) );
54 obj.setProperty( context,
"cFragments", url.ref() );
61 static bool initialized =
false;
static KJSPrototype * g_utilProto
static KJSObject object(KJSContext *ctx)
static KJSObject crackURL(KJSContext *context, void *, const KJSArguments &arguments)
static void initType(KJSContext *ctx)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:02 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.