diff options
author | Mrudul Pendharkar <mrudul.v.pendharkar@nokia.com> | 2012-05-18 16:13:51 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-31 13:45:30 +0200 |
commit | a63a84db1696326f3a336af04da3f9b66ae70a54 (patch) | |
tree | 1845b339dfb81a4ec54b6caf8d3bdaa01cb45125 /src | |
parent | f839320dd7173bf5f1cda8de3d30394b09fb5ecf (diff) |
Cleaning code and removing dependency on QCoreApplication
Change-Id: Ie37bc765656ec420989460563cc0424813f2f7a9
Reviewed-by: Jaakko Korpela <jaakko.korpela@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/feedback/feedback.pro | 22 | ||||
-rw-r--r-- | src/feedback/qfeedbackplugin.cpp | 8 | ||||
-rw-r--r-- | src/feedback/qfeedbackpluginsearch.h (renamed from src/feedback/qmobilitypluginsearch.h) | 64 |
3 files changed, 11 insertions, 83 deletions
diff --git a/src/feedback/feedback.pro b/src/feedback/feedback.pro index 0663ef1..b714b69 100644 --- a/src/feedback/feedback.pro +++ b/src/feedback/feedback.pro @@ -15,30 +15,14 @@ load(qt_module_config) PUBLIC_HEADERS += qfeedbackglobal.h \ qfeedbackactuator.h \ qfeedbackeffect.h \ - qfeedbackplugininterfaces.h + qfeedbackplugininterfaces.h \ + qfeedbackpluginsearch.h PRIVATE_HEADERS += qfeedbackeffect_p.h \ qfeedbackplugin_p.h -HEADERS = qtfeedbackversion.h $$PUBLIC_HEADERS $$PRIVATE_HEADERS +HEADERS = $$PUBLIC_HEADERS $$PRIVATE_HEADERS SOURCES += qfeedbackactuator.cpp \ qfeedbackeffect.cpp \ qfeedbackplugin.cpp - -symbian { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = ALL \ - -TCB - - # UID - TARGET.UID3 = 0x2002BFCE - - LIBS += -lefsrv - - # Main library - FEEDBACK_DEPLOYMENT.sources = QtFeedback.dll - FEEDBACK_DEPLOYMENT.path = /sys/bin - DEPLOYMENT += FEEDBACK_DEPLOYMENT - deploy.path = $$EPOCROOT -} diff --git a/src/feedback/qfeedbackplugin.cpp b/src/feedback/qfeedbackplugin.cpp index cf60b8e..4a164bf 100644 --- a/src/feedback/qfeedbackplugin.cpp +++ b/src/feedback/qfeedbackplugin.cpp @@ -43,7 +43,7 @@ #include "qfeedbackplugin_p.h" #include "qfeedbackeffect_p.h" -#include "qmobilitypluginsearch.h" +#include "qfeedbackpluginsearch.h" #include <QtCore/QCoreApplication> #include <QtCore/QStringList> @@ -257,10 +257,8 @@ class BackendManager public: BackendManager() { - QStringList pluginPaths = mobilityPlugins(QLatin1String("feedback")); - // Testing hook to force "no plugin mode" - if (qApp->property("QFEEDBACK_TEST_NO_PLUGINS").isValid()) - pluginPaths.clear(); + QStringList pluginPaths = getPluginPaths(QLatin1String("feedback")); + foreach (const QString& pluginPath, pluginPaths) { QPluginLoader loader(pluginPath); diff --git a/src/feedback/qmobilitypluginsearch.h b/src/feedback/qfeedbackpluginsearch.h index c34c279..fb18607 100644 --- a/src/feedback/qmobilitypluginsearch.h +++ b/src/feedback/qfeedbackpluginsearch.h @@ -3,7 +3,7 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtFeedback Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -38,65 +38,30 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QMOBILITYPLUGINSEARCH_H -#define QMOBILITYPLUGINSEARCH_H +#ifndef QFEEDBACKPLUGINSEARCH_H +#define QFEEDBACKPLUGINSEARCH_H #include <QCoreApplication> #include <QStringList> #include <QDir> #include <QDebug> -#if defined(Q_OS_SYMBIAN) -# include <f32file.h> -#endif - QT_BEGIN_NAMESPACE -#if defined(Q_OS_SYMBIAN) -static inline bool qSymbian_CheckDir(const QDir& dir, RFs& rfs) -{ - bool pathFound = false; - // In Symbian, going cdUp() in a c:/private/<uid3>/ will result in *platsec* error at fileserver (requires AllFiles capability) - // Also, trying to cd() to a nonexistent directory causes *platsec* error. This does not cause functional harm, but should - // nevertheless be changed to use native Symbian methods to avoid unnecessary platsec warnings (as per qpluginloader.cpp). - // Use native Symbian code to check for directory existence, because checking - // for files from under non-existent protected dir like E:/private/<uid> using - // QDir::exists causes platform security violations on most apps. - QString nativePath = QDir::toNativeSeparators(dir.absolutePath()); - TPtrC ptr = TPtrC16(static_cast<const TUint16*>(nativePath.utf16()), nativePath.length()); - TUint attributes; - TInt err = rfs.Att(ptr, attributes); - if (err == KErrNone) { - // yes, the directory exists. - pathFound = true; - } - return pathFound; -} -#define CHECKDIR(dir) qSymbian_CheckDir(dir, rfs) -#else #define CHECKDIR(dir) (dir).exists() -#endif -inline QStringList mobilityPlugins(const QString& plugintype) +inline QStringList getPluginPaths(const QString& plugintype) { #if !defined QT_NO_DEBUG const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0; #endif QStringList paths = QCoreApplication::libraryPaths(); -/*#ifdef QTM_PLUGIN_PATH - paths << QLatin1String(QTM_PLUGIN_PATH); -#endif*/ #if !defined QT_NO_DEBUG if (showDebug) qDebug() << "Plugin paths:" << paths; #endif -#if defined(Q_OS_SYMBIAN) - RFs rfs; - qt_symbian_throwIfError(rfs.Connect()); -#endif - // Temp variable to avoid multiple identical paths // (we don't convert the list to set first, because that loses the order) QSet<QString> processed; @@ -145,26 +110,7 @@ inline QStringList mobilityPlugins(const QString& plugintype) } } - /* Add application path + plugintype */ - QDir appldir(QCoreApplication::applicationDirPath()); - if(appldir.cd(plugintype)){ - if (!processed.contains(appldir.absolutePath())){ - processed.insert(appldir.absolutePath()); - QStringList files = appldir.entryList(QDir::Files); -#if !defined QT_NO_DEBUG - if (showDebug) - qDebug() << "Looking for " << plugintype << " plugins in" << appldir.path() << files; -#endif - for (int j=0; j < files.count(); j++) { - plugins << appldir.absoluteFilePath(files.at(j)); - } - } - } - -#if defined(Q_OS_SYMBIAN) - rfs.Close(); -#endif - return plugins; + return plugins; } QT_END_NAMESPACE |