This commit is contained in:
Albert Astals Cid 2014-04-09 23:57:38 +02:00
parent 6112a79765
commit 49dc7dcb59

View file

@ -38,7 +38,7 @@ static bool attachUniqueInstance(KCmdLineArgs* args)
iface.call("openDocument", ShellUtils::urlFromArg(args->arg(0), ShellUtils::qfileExistFunc(), args->getOption("page")).url());
else
iface.call("openDocument", ShellUtils::urlFromArg(args->arg(0), ShellUtils::qfileExistFunc()).url());
if (args->isSet("raise")){
if (args->isSet("raise")) {
iface2.call("tryRaise");
}
@ -48,7 +48,7 @@ static bool attachUniqueInstance(KCmdLineArgs* args)
// Ask an existing non-unique instance to open new tabs
static bool attachExistingInstance( KCmdLineArgs* args )
{
if( args->count() < 1 )
if ( args->count() < 1 )
return false;
const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
@ -60,11 +60,11 @@ static bool attachExistingInstance( KCmdLineArgs* args )
const int desktop = KWindowSystem::currentDesktop();
// Select the first instance that isn't us (metric may change in future)
foreach( const QString& service, services )
foreach ( const QString& service, services )
{
if( service.startsWith(pattern) && !service.endsWith(myPid) )
if ( service.startsWith(pattern) && !service.endsWith( myPid ) )
{
bestService.reset( new QDBusInterface(service,"/okularshell","org.kde.okular") );
bestService.reset( new QDBusInterface(service, "/okularshell", "org.kde.okular") );
// Find a window that can handle our documents
const QDBusReply<bool> reply = bestService->call( "canOpenDocs", args->count(), desktop );
@ -75,7 +75,7 @@ static bool attachExistingInstance( KCmdLineArgs* args )
}
}
if( !bestService )
if ( !bestService )
return false;
for( int i = 0; i < args->count(); ++i )
@ -158,9 +158,9 @@ int main(int argc, char** argv)
{
Shell* shell = new Shell( args );
shell->show();
for( int i = 0; i < args->count(); )
for ( int i = 0; i < args->count(); )
{
if( shell->openDocument(args->arg(i)) )
if ( shell->openDocument( args->arg(i)) )
++i;
else
{
@ -174,4 +174,4 @@ int main(int argc, char** argv)
return app.exec();
}
// vim:ts=2:sw=2:tw=78:et
/* kate: replace-tabs on; indent-width 4; */