42 |
42 |
43 XQAiwUtilsPrivate(); |
43 XQAiwUtilsPrivate(); |
44 virtual ~XQAiwUtilsPrivate(); |
44 virtual ~XQAiwUtilsPrivate(); |
45 |
45 |
46 void launchApplicationL(int applicationId, const QString &cmdArguments); |
46 void launchApplicationL(int applicationId, const QString &cmdArguments); |
|
47 int launchFile(const QVariant &file); |
47 int findApplicationFromApa(const QString &file, int &applicationId, QString &mimeType); |
48 int findApplicationFromApa(const QString &file, int &applicationId, QString &mimeType); |
48 int findApplicationFromApa(const XQSharableFile &file, int &applicationId, QString &mimeType); |
49 int findApplicationFromApa(const XQSharableFile &file, int &applicationId, QString &mimeType); |
49 bool applicationExists(int applicationId); |
50 bool applicationExists(int applicationId); |
50 int toIntFromHex(const QString &str, bool *ok); |
51 int toIntFromHex(const QString &str, bool *ok); |
51 void GetDrmAttributesL(ContentAccess::CContent *c, const QList<int> & attributes, QVariantList &result); |
52 void GetDrmAttributesL(ContentAccess::CContent *c, const QList<int> & attributes, QVariantList &result); |
67 { |
68 { |
68 XQSERVICE_DEBUG_PRINT("XQAiwUtils::~XQAiwUtils"); |
69 XQSERVICE_DEBUG_PRINT("XQAiwUtils::~XQAiwUtils"); |
69 delete d; |
70 delete d; |
70 }; |
71 }; |
71 |
72 |
72 int XQAiwUtils::launchApplication(int applicationId, const QString &cmdArguments) |
73 int XQAiwUtils::launchApplication(int applicationId, const QList<QVariant> &arguments) |
73 { |
74 { |
74 TInt error = KErrNone; |
75 TInt error = KErrNone; |
75 TRAP(error, d->launchApplicationL(applicationId, cmdArguments)); |
76 |
|
77 // Create space separated command line args |
|
78 QString args = createCmdlineArgs(arguments); |
|
79 XQSERVICE_DEBUG_PRINT("args %s", qPrintable(args)); |
|
80 |
|
81 TRAP(error, d->launchApplicationL(applicationId, args)); |
76 return mapError(error); |
82 return mapError(error); |
77 } |
83 } |
|
84 |
|
85 int XQAiwUtils::launchFile(int applicationId, const QVariant &file) |
|
86 { |
|
87 Q_UNUSED(applicationId); |
|
88 TInt error = KErrNone; |
|
89 error=d->launchFile(file); |
|
90 return mapError(error); |
|
91 } |
|
92 |
78 |
93 |
79 int XQAiwUtils::mapError(int symbianError) |
94 int XQAiwUtils::mapError(int symbianError) |
80 { |
95 { |
81 XQSERVICE_DEBUG_PRINT("XQAiwUtils::doMapErrors"); |
96 XQSERVICE_DEBUG_PRINT("XQAiwUtils::doMapErrors"); |
82 XQSERVICE_DEBUG_PRINT("error: %d", symbianError); |
97 XQSERVICE_DEBUG_PRINT("error: %d", symbianError); |
388 } |
403 } |
389 |
404 |
390 XQSERVICE_DEBUG_PRINT("application started"); |
405 XQSERVICE_DEBUG_PRINT("application started"); |
391 |
406 |
392 } |
407 } |
|
408 |
|
409 |
|
410 int XQAiwUtilsPrivate::launchFile(const QVariant &file) |
|
411 { |
|
412 XQSERVICE_DEBUG_PRINT("XQAiwUtils::launchFile"); |
|
413 |
|
414 TThreadId startedApp; |
|
415 TInt err=KErrNone; |
|
416 if (file.typeName() == QString("XQSharableFile")) |
|
417 { |
|
418 XQSharableFile sharableFile = file.value<XQSharableFile>(); |
|
419 RFile fileHandle; |
|
420 XQSERVICE_DEBUG_PRINT("\tStarting file by handle %s", qPrintable(sharableFile.fileName())); |
|
421 if (!sharableFile.getHandle(fileHandle)) |
|
422 { |
|
423 err=KErrArgument; |
|
424 } |
|
425 else |
|
426 { |
|
427 err = apaSession.StartDocument(fileHandle, startedApp); |
|
428 } |
|
429 } |
|
430 else |
|
431 { |
|
432 QString fileName = file.toString(); |
|
433 fileName.replace("/", "\\"); // Normalize just-in case |
|
434 XQSERVICE_DEBUG_PRINT("\tStarting file %s", qPrintable(fileName)); |
|
435 TPtrC fname( reinterpret_cast<const TUint16*>(fileName.utf16()) ); |
|
436 err=apaSession.StartDocument(fname, startedApp); |
|
437 } |
|
438 |
|
439 XQSERVICE_DEBUG_PRINT("XQAiwUtils::launchFile status=%d", err); |
|
440 return err; |
|
441 |
|
442 } |
|
443 |
|
444 |
393 |
445 |
394 |
446 |
395 int XQAiwUtilsPrivate::findApplicationFromApa(const QString &file, int &applicationId, QString &mimeType) |
447 int XQAiwUtilsPrivate::findApplicationFromApa(const QString &file, int &applicationId, QString &mimeType) |
396 { |
448 { |
397 QString fileName = file; |
449 QString fileName = file; |