qtmobileextensions/src/utils/xqutils_p.cpp
branchRCL_3
changeset 10 cd2778e5acfe
parent 9 5d007b20cfd0
child 11 19a54be74e5e
equal deleted inserted replaced
9:5d007b20cfd0 10:cd2778e5acfe
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
       
    19 *
       
    20 */
       
    21 
       
    22 #include "xqutils.h"
       
    23 #include "xqutils_p.h"
       
    24 
       
    25 #include <DocumentHandler.h>
       
    26 #include <apmstd.h>
       
    27 #include <pathinfo.h>
       
    28 
       
    29 XQUtilsPrivate::XQUtilsPrivate(XQUtils* utils): q(utils)
       
    30 {
       
    31 }
       
    32 
       
    33 XQUtilsPrivate::~XQUtilsPrivate()
       
    34 {
       
    35     delete iDocHandler;
       
    36 }
       
    37 
       
    38 bool XQUtilsPrivate::launchFile(const QString& filename)
       
    39 {
       
    40     TRAP(iError,
       
    41         if (!iDocHandler)
       
    42         {
       
    43             iDocHandler = CDocumentHandler::NewL();
       
    44         }
       
    45         TPtrC16 textPtr(reinterpret_cast<const TUint16*>(filename.utf16()));
       
    46         TDataType dataType;
       
    47         User::LeaveIfError(iDocHandler->OpenFileEmbeddedL(textPtr, dataType));
       
    48     )
       
    49     return (iError == KErrNone);
       
    50 }
       
    51 
       
    52 void XQUtilsPrivate::resetInactivityTime()
       
    53 {
       
    54     User::ResetInactivityTime();
       
    55 }
       
    56 
       
    57 QString XQUtilsPrivate::romRootPath()
       
    58 {
       
    59     TPtrC romRootPath = PathInfo::RomRootPath();
       
    60     return QString::fromUtf16(romRootPath.Ptr(), romRootPath.Length());
       
    61 }
       
    62 
       
    63 QString XQUtilsPrivate::phoneMemoryRootPath()
       
    64 {
       
    65     TPtrC phoneMemoryRootPath = PathInfo::PhoneMemoryRootPath();
       
    66     return QString::fromUtf16(phoneMemoryRootPath.Ptr(), phoneMemoryRootPath.Length());
       
    67 }
       
    68 
       
    69 QString XQUtilsPrivate::memoryCardRootPath()
       
    70 {
       
    71     TPtrC memoryCardRootPath = PathInfo::MemoryCardRootPath();
       
    72     return QString::fromUtf16(memoryCardRootPath.Ptr(), memoryCardRootPath.Length());
       
    73 }
       
    74 
       
    75 QString XQUtilsPrivate::gamesPath()
       
    76 {
       
    77     TPtrC gamesPath = PathInfo::GamesPath();
       
    78     return QString::fromUtf16(gamesPath.Ptr(), gamesPath.Length());
       
    79 }
       
    80 
       
    81 QString XQUtilsPrivate::installsPath()
       
    82 {
       
    83     TPtrC installsPath = PathInfo::InstallsPath();
       
    84     return QString::fromUtf16(installsPath.Ptr(), installsPath.Length());
       
    85 }
       
    86 
       
    87 QString XQUtilsPrivate::othersPath()
       
    88 {
       
    89     TPtrC othersPath = PathInfo::OthersPath();
       
    90     return QString::fromUtf16(othersPath.Ptr(), othersPath.Length());
       
    91 }
       
    92 
       
    93 QString XQUtilsPrivate::videosPath()
       
    94 {
       
    95     TPtrC videosPath = PathInfo::VideosPath();
       
    96     return QString::fromUtf16(videosPath.Ptr(), videosPath.Length());
       
    97 }
       
    98 
       
    99 QString XQUtilsPrivate::imagesPath()
       
   100 {
       
   101     TPtrC imagesPath = PathInfo::ImagesPath();
       
   102     return QString::fromUtf16(imagesPath.Ptr(), imagesPath.Length());
       
   103 }
       
   104 
       
   105 QString XQUtilsPrivate::picturesPath()
       
   106 {
       
   107     TPtrC picturesPath = PathInfo::PicturesPath();
       
   108     return QString::fromUtf16(picturesPath.Ptr(), picturesPath.Length());
       
   109 }
       
   110 
       
   111 QString XQUtilsPrivate::gmsPicturesPath()
       
   112 {
       
   113     TPtrC gmsPicturesPath = PathInfo::GmsPicturesPath();
       
   114     return QString::fromUtf16(gmsPicturesPath.Ptr(), gmsPicturesPath.Length());
       
   115 }
       
   116 
       
   117 QString XQUtilsPrivate::mmsBackgroundImagesPath()
       
   118 {
       
   119     TPtrC mmsBackgroundImagesPath = PathInfo::MmsBackgroundImagesPath();
       
   120     return QString::fromUtf16(mmsBackgroundImagesPath.Ptr(), mmsBackgroundImagesPath.Length());
       
   121 }
       
   122 
       
   123 QString XQUtilsPrivate::presenceLogosPath()
       
   124 {
       
   125     TPtrC presenceLogosPath = PathInfo::PresenceLogosPath();
       
   126     return QString::fromUtf16(presenceLogosPath.Ptr(), presenceLogosPath.Length());
       
   127 }
       
   128 
       
   129 QString XQUtilsPrivate::soundsPath()
       
   130 {
       
   131     TPtrC soundsPath = PathInfo::SoundsPath();
       
   132     return QString::fromUtf16(soundsPath.Ptr(), soundsPath.Length());
       
   133 }
       
   134 
       
   135 QString XQUtilsPrivate::digitalSoundsPath()
       
   136 {
       
   137     TPtrC digitalSoundsPath = PathInfo::DigitalSoundsPath();
       
   138     return QString::fromUtf16(digitalSoundsPath.Ptr(), digitalSoundsPath.Length());
       
   139 }
       
   140 
       
   141 QString XQUtilsPrivate::simpleSoundsPath()
       
   142 {
       
   143     TPtrC simpleSoundsPath = PathInfo::SimpleSoundsPath();
       
   144     return QString::fromUtf16(simpleSoundsPath.Ptr(), simpleSoundsPath.Length());
       
   145 }
       
   146 
       
   147 QString XQUtilsPrivate::imagesThumbnailPath()
       
   148 {
       
   149     TPtrC imagesThumbnailPath = PathInfo::ImagesThumbnailPath();
       
   150     return QString::fromUtf16(imagesThumbnailPath.Ptr(), imagesThumbnailPath.Length());
       
   151 }
       
   152 
       
   153 QString XQUtilsPrivate::memoryCardContactsPath()
       
   154 {
       
   155     TPtrC memoryCardContactsPath = PathInfo::MemoryCardContactsPath();
       
   156     return QString::fromUtf16(memoryCardContactsPath.Ptr(), memoryCardContactsPath.Length());
       
   157 }
       
   158 
       
   159 XQUtils::Error XQUtilsPrivate::error() const
       
   160 {
       
   161     switch (iError)
       
   162     {
       
   163         case KErrNone:
       
   164             return XQUtils::NoError;
       
   165         case KErrNoMemory:
       
   166             return XQUtils::OutOfMemoryError;
       
   167         case KUserCancel:
       
   168             return XQUtils::UserCancelledError;
       
   169         default:
       
   170             return XQUtils::UnknownError;
       
   171     }
       
   172 }
       
   173 
       
   174 // End of file