2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "PluginDatabase.h"
25 static const char QTPLUGIN_FILTER[] = "*.qtplugin";
26 static const char QT_PLUGIN_FOLDER[] = ":\\resource\\qt\\plugins\\npqtplugins\\";
30 Vector<String> PluginDatabase::defaultPluginDirectories()
32 Vector<String> directories;
33 //find the installation drive
38 if (fsSession.Connect() == KErrNone && fsSession.DriveList(drivelist) == KErrNone) {
39 for (TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++) {
40 if (drivelist[driveNumber] && fsSession.DriveToChar(driveNumber, driveLetter) == KErrNone) {
41 QString driveStringValue(QChar((uint)driveLetter.GetUpperCase()));
43 stubDirPath.append(driveStringValue);
44 stubDirPath.append(QT_PLUGIN_FOLDER);
45 if (QFileInfo(stubDirPath).exists())
46 directories.append(stubDirPath);
55 bool PluginDatabase::isPreferredPluginDirectory(const String& path)
60 void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const
62 // FIXME: This should be a case insensitive set.
63 HashSet<String> uniqueFilenames;
65 String fileNameFilter(QTPLUGIN_FILTER);
67 Vector<String>::const_iterator dirsEnd = m_pluginDirectories.end();
68 for (Vector<String>::const_iterator dIt = m_pluginDirectories.begin(); dIt != dirsEnd; ++dIt) {
69 Vector<String> pluginPaths = listDirectory(*dIt, fileNameFilter);
70 Vector<String>::const_iterator pluginsEnd = pluginPaths.end();
71 for (Vector<String>::const_iterator pIt = pluginPaths.begin(); pIt != pluginsEnd; ++pIt) {
72 if (!fileExists(*pIt))