Changeset 846 for trunk/src/gui/util/qdesktopservices_s60.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/util/qdesktopservices_s60.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 40 40 ****************************************************************************/ 41 41 42 // This flag changes the implementation to use S60 CDcoumentHandler43 // instead of apparch when opening the files44 #define USE_DOCUMENTHANDLER45 42 46 43 #include <qcoreapplication.h> … … 49 46 #include <private/qcore_symbian_p.h> 50 47 48 #include <f32file.h> // TDriveUnit etc 49 #include <pathinfo.h> // PathInfo 50 51 #ifndef USE_SCHEMEHANDLER 52 #ifdef Q_WS_S60 53 // This flag changes the implementation to use S60 CDcoumentHandler 54 // instead of apparc when opening the files 55 #define USE_DOCUMENTHANDLER 56 #endif 57 51 58 #include <txtrich.h> // CRichText 52 #include <f32file.h> // TDriveUnit etc53 59 #include <eikenv.h> // CEikonEnv 54 60 #include <apgcli.h> // RApaLsSession … … 57 63 #include <rsendasmessage.h> // RSendAsMessage 58 64 59 // copied from miutset.h, so we don't get a dependency into the app layer 60 const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 61 62 #ifdef Q_WS_S60 63 # include <pathinfo.h> // PathInfo 64 # ifdef USE_DOCUMENTHANDLER 65 # include <DocumentHandler.h> // CDocumentHandler 66 # include <AknServerApp.h> 67 # endif 68 #else 69 # warning CDocumentHandler requires support for S60 70 # undef USE_DOCUMENTHANDLER // Fallback to RApaLsSession based implementation 65 #ifdef USE_DOCUMENTHANDLER 66 #include <DocumentHandler.h> // CDocumentHandler 67 #include <AknServerApp.h> 68 #endif 69 #else // USE_SCHEMEHANDLER 70 #include <schemehandler.h> 71 71 #endif 72 72 … … 77 77 _LIT(KBrowserPrefix, "4 " ); 78 78 _LIT(KFontsDir, "z:\\resource\\Fonts\\"); 79 80 #ifndef USE_SCHEMEHANDLER 81 // copied from miutset.h, so we don't get a dependency into the app layer 82 const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 79 83 const TUid KUidBrowser = { 0x10008D39 }; 80 84 … … 135 139 #endif 136 140 137 138 141 static void handleMailtoSchemeLX(const QUrl &url) 139 142 { … … 153 156 QStringList bccs = bcc.split(QLatin1String(","), QString::SkipEmptyParts); 154 157 155 156 158 RSendAs sendAs; 157 159 User::LeaveIfError(sendAs.Connect()); 158 160 QAutoClose<RSendAs> sendAsCleanup(sendAs); 159 160 161 161 162 CSendAsAccounts* accounts = CSendAsAccounts::NewL(); … … 221 222 if (task.Exists()){ 222 223 // Switch to existing browser instance 224 task.BringToForeground(); 223 225 HBufC8* param8 = HBufC8::NewLC(buf16->Length()); 224 226 param8->Des().Append(buf16->Des()); … … 246 248 } 247 249 248 static TDriveUnit exeDrive()249 {250 RProcess me;251 TFileName processFileName = me.FileName();252 TDriveUnit drive(processFileName);253 return drive;254 }255 256 static TDriveUnit writableExeDrive()257 {258 TDriveUnit drive = exeDrive();259 if(drive.operator TInt() == EDriveZ)260 return TDriveUnit(EDriveC);261 return drive;262 }263 264 static TPtrC writableDataRoot()265 {266 TDriveUnit drive = exeDrive();267 #ifdef Q_WS_S60268 switch(drive.operator TInt()){269 case EDriveC:270 return PathInfo::PhoneMemoryRootPath();271 break;272 case EDriveE:273 return PathInfo::MemoryCardRootPath();274 break;275 case EDriveZ:276 // It is not possible to write on ROM drive ->277 // return phone mem root path instead278 return PathInfo::PhoneMemoryRootPath();279 break;280 default:281 return PathInfo::PhoneMemoryRootPath();282 break;283 }284 #else285 #warning No fallback implementation of writableDataRoot()286 return 0;287 #endif288 }289 250 290 251 static void openDocumentL(const TDesC& aUrl) … … 311 272 } 312 273 313 #ifdef USE_SCHEMEHANDLER314 // The schemehandler component only exist in private SDK. This implementation315 // exist here just for convenience in case that we need to use it later on316 // The schemehandle based implementation is not yet tested.317 318 // The biggest advantage of schemehandler is that it can handle319 // wide range of schemes and is extensible by plugins320 static bool handleUrl(const QUrl &url)321 {322 if (!url.isValid())323 return false;324 325 QString urlString(url.toString());326 TPtrC urlPtr(qt_QString2TPtrC(urlString));327 TRAPD( err, handleUrlL(urlPtr));328 return err ? false : true;329 }330 331 static void handleUrlL(const TDesC& aUrl)332 {333 CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl);334 CleanupStack::PushL(schemeHandler);335 schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode336 CleanupStack::PopAndDestroy();337 }338 static bool launchWebBrowser(const QUrl &url)339 {340 return handleUrl(url);341 }342 343 static bool openDocument(const QUrl &file)344 {345 return handleUrl(url);346 }347 #endif348 349 274 static bool launchWebBrowser(const QUrl &url) 350 275 { … … 370 295 } 371 296 297 #else //USE_SCHEMEHANDLER 298 // The schemehandler component only exist in private SDK. This implementation 299 // exist here just for convenience in case that we need to use it later on 300 // The schemehandle based implementation is not yet tested. 301 302 // The biggest advantage of schemehandler is that it can handle 303 // wide range of schemes and is extensible by plugins 304 static void handleUrlL(const TDesC& aUrl) 305 { 306 CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl); 307 CleanupStack::PushL(schemeHandler); 308 schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode 309 CleanupStack::PopAndDestroy(); 310 } 311 312 static bool handleUrl(const QUrl &url) 313 { 314 if (!url.isValid()) 315 return false; 316 317 QString urlString(url.toString()); 318 TPtrC urlPtr(qt_QString2TPtrC(urlString)); 319 TRAPD( err, handleUrlL(urlPtr)); 320 return err ? false : true; 321 } 322 323 static bool launchWebBrowser(const QUrl &url) 324 { 325 return handleUrl(url); 326 } 327 328 static bool openDocument(const QUrl &file) 329 { 330 return handleUrl(file); 331 } 332 333 #endif //USE_SCHEMEHANDLER 334 335 // Common functions to all implementations 336 337 static TDriveUnit exeDrive() 338 { 339 RProcess me; 340 TFileName processFileName = me.FileName(); 341 TDriveUnit drive(processFileName); 342 return drive; 343 } 344 345 static TDriveUnit writableExeDrive() 346 { 347 TDriveUnit drive = exeDrive(); 348 if (drive.operator TInt() == EDriveZ) 349 return TDriveUnit(EDriveC); 350 return drive; 351 } 352 353 static TPtrC writableDataRoot() 354 { 355 TDriveUnit drive = exeDrive(); 356 switch (drive.operator TInt()){ 357 case EDriveC: 358 return PathInfo::PhoneMemoryRootPath(); 359 break; 360 case EDriveE: 361 return PathInfo::MemoryCardRootPath(); 362 break; 363 case EDriveZ: 364 // It is not possible to write on ROM drive -> 365 // return phone mem root path instead 366 return PathInfo::PhoneMemoryRootPath(); 367 break; 368 default: 369 return PathInfo::PhoneMemoryRootPath(); 370 break; 371 } 372 } 373 372 374 QString QDesktopServices::storageLocation(StandardLocation type) 373 375 { … … 392 394 case MusicLocation: 393 395 path.Append(writableDataRoot()); 394 #ifdef Q_WS_S60395 396 path.Append(PathInfo::SoundsPath()); 396 #endif397 397 break; 398 398 case MoviesLocation: 399 399 path.Append(writableDataRoot()); 400 #ifdef Q_WS_S60401 400 path.Append(PathInfo::VideosPath()); 402 #endif403 401 break; 404 402 case PicturesLocation: 405 403 path.Append(writableDataRoot()); 406 #ifdef Q_WS_S60407 404 path.Append(PathInfo::ImagesPath()); 408 #endif409 405 break; 410 406 case TempLocation: … … 416 412 break; 417 413 case DataLocation: 418 CEikonEnv::Static()->FsSession().PrivatePath(path);414 qt_s60GetRFs().PrivatePath(path); 419 415 path.Insert(0, writableExeDrive().Name()); 420 416 break; 421 417 case CacheLocation: 422 CEikonEnv::Static()->FsSession().PrivatePath(path);418 qt_s60GetRFs().PrivatePath(path); 423 419 path.Insert(0, writableExeDrive().Name()); 424 420 path.Append(KCacheSubDir);
Note:
See TracChangeset
for help on using the changeset viewer.