diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2010-09-03 08:32:20 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2010-09-03 18:39:52 (GMT) |
commit | a59924437dadf4ea3b972a528f449ebb2b760d81 (patch) | |
tree | fecac8426225d99add3563d31f87208760c5bcaa /src/corelib/io/qabstractfileengine.cpp | |
parent | 4fd2aced96d9095254d89f9da9c911bd88f15245 (diff) | |
download | Qt-a59924437dadf4ea3b972a528f449ebb2b760d81.zip Qt-a59924437dadf4ea3b972a528f449ebb2b760d81.tar.gz Qt-a59924437dadf4ea3b972a528f449ebb2b760d81.tar.bz2 |
QAbstractFileEngine: Exposing custom file engine handlers
So we can invoke custom handlers from QFileSystemEngine.
Diffstat (limited to 'src/corelib/io/qabstractfileengine.cpp')
-rw-r--r-- | src/corelib/io/qabstractfileengine.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp index 37a093c..e055e7b 100644 --- a/src/corelib/io/qabstractfileengine.cpp +++ b/src/corelib/io/qabstractfileengine.cpp @@ -149,6 +149,29 @@ QAbstractFileEngineHandler::~QAbstractFileEngineHandler() } } +/* + \ìnternal + + Handles calls to custom file engine handlers. +*/ +QAbstractFileEngine *qt_custom_file_engine_handler_create(const QString &path) +{ + QAbstractFileEngine *engine = 0; + + if (qt_file_engine_handlers_in_use) { + QReadLocker locker(fileEngineHandlerMutex()); + + // check for registered handlers that can load the file + QAbstractFileEngineHandlerList *handlers = fileEngineHandlers(); + for (int i = 0; i < handlers->size(); i++) { + if ((engine = handlers->at(i)->create(path))) + break; + } + } + + return engine; +} + /*! \fn QAbstractFileEngine *QAbstractFileEngineHandler::create(const QString &fileName) const @@ -177,16 +200,8 @@ QAbstractFileEngineHandler::~QAbstractFileEngineHandler() */ QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName) { - if (qt_file_engine_handlers_in_use) { - QReadLocker locker(fileEngineHandlerMutex()); - - // check for registered handlers that can load the file - QAbstractFileEngineHandlerList *handlers = fileEngineHandlers(); - for (int i = 0; i < handlers->size(); i++) { - if (QAbstractFileEngine *ret = handlers->at(i)->create(fileName)) - return ret; - } - } + if (QAbstractFileEngine *engine = qt_custom_file_engine_handler_create(filePath)) + return engine; #ifdef QT_BUILD_CORE_LIB for (int prefixSeparator = 0; prefixSeparator < fileName.size(); ++prefixSeparator) { |