From 86558de34134f67cf3815a29612edc2d730f2ea2 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 21 Oct 2011 20:12:01 +0200 Subject: Move path information from QDesktopServices (gui) to QStandardPaths (core) Change-Id: Ic596c21894d83b4dab0c3f5b1aed916ddd590f2f Reviewed-by: Thiago Macieira (Intel) --- src/gui/util/qdesktopservices_s60.cpp | 125 ---------------------------------- 1 file changed, 125 deletions(-) (limited to 'src/gui/util/qdesktopservices_s60.cpp') diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 41fc0f3b3c..f4d8fe99e1 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -327,130 +327,5 @@ static bool openDocument(const QUrl &file) #endif //USE_SCHEMEHANDLER -// Common functions to all implementations - -static TDriveUnit exeDrive() -{ - RProcess me; - TFileName processFileName = me.FileName(); - TDriveUnit drive(processFileName); - return drive; -} - -static TDriveUnit writableExeDrive() -{ - TDriveUnit drive = exeDrive(); - if (drive.operator TInt() == EDriveZ) - return TDriveUnit(EDriveC); - return drive; -} - -static TPtrC writableDataRoot() -{ - TDriveUnit drive = exeDrive(); - switch (drive.operator TInt()){ - case EDriveC: - return PathInfo::PhoneMemoryRootPath(); - break; - case EDriveE: - return PathInfo::MemoryCardRootPath(); - break; - case EDriveZ: - // It is not possible to write on ROM drive -> - // return phone mem root path instead - return PathInfo::PhoneMemoryRootPath(); - break; - default: - return PathInfo::PhoneMemoryRootPath(); - break; - } -} - -QString QDesktopServices::storageLocation(StandardLocation type) -{ - TFileName path; - - switch (type) { - case DesktopLocation: - qWarning("No desktop concept in Symbian OS"); - // But lets still use some feasible default - path.Append(writableDataRoot()); - break; - case DocumentsLocation: - path.Append(writableDataRoot()); - break; - case FontsLocation: - path.Append(KFontsDir); - break; - case ApplicationsLocation: - path.Append(exeDrive().Name()); - path.Append(KSysBin); - break; - case MusicLocation: - path.Append(writableDataRoot()); - path.Append(PathInfo::SoundsPath()); - break; - case MoviesLocation: - path.Append(writableDataRoot()); - path.Append(PathInfo::VideosPath()); - break; - case PicturesLocation: - path.Append(writableDataRoot()); - path.Append(PathInfo::ImagesPath()); - break; - case TempLocation: - return QDir::tempPath(); - break; - case HomeLocation: - path.Append(writableDataRoot()); - //return QDir::homePath(); break; - break; - case DataLocation: - qt_s60GetRFs().PrivatePath(path); - path.Insert(0, writableExeDrive().Name()); - break; - case CacheLocation: - qt_s60GetRFs().PrivatePath(path); - path.Insert(0, writableExeDrive().Name()); - path.Append(KCacheSubDir); - break; - default: - // Lets use feasible default - path.Append(writableDataRoot()); - break; - } - - // Convert to cross-platform format and clean the path - QString nativePath = QString::fromUtf16(path.Ptr(), path.Length()); - QString qtPath = QDir::fromNativeSeparators(nativePath); - qtPath = QDir::cleanPath(qtPath); - - // Note: The storage location returned can be a directory that does not exist; - // i.e., it may need to be created by the system or the user. - return qtPath; -} - -typedef QString (*LocalizerFunc)(QString&); - -static QString defaultLocalizedDirectoryName(QString&) -{ - return QString(); -} - -QString QDesktopServices::displayName(StandardLocation type) -{ - static LocalizerFunc ptrLocalizerFunc = NULL; - - if (!ptrLocalizerFunc) { - ptrLocalizerFunc = reinterpret_cast - (qt_resolveS60PluginFunc(S60Plugin_LocalizedDirectoryName)); - if (!ptrLocalizerFunc) - ptrLocalizerFunc = &defaultLocalizedDirectoryName; - } - - QString rawPath = storageLocation(type); - return ptrLocalizerFunc(rawPath); -} - QT_END_NAMESPACE -- cgit v1.2.3