• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

BackendsManager.cpp

Go to the documentation of this file.
00001 /*
00002 *   Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com>
00003 *
00004 *   This program is free software; you can redistribute it and/or modify
00005 *   it under the terms of the GNU Lesser General Public License as published by
00006 *   the Free Software Foundation; either version 2.1 of the License, or
00007 *   (at your option) any later version.
00008 *
00009 *   This program is distributed in the hope that it will be useful,
00010 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *   GNU General Public License for more details.
00013 *
00014 *   You should have received a copy of the GNU Lesser General Public License
00015 *   along with this program; if not, write to the
00016 *   Free Software Foundation, Inc.,
00017 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .
00018 */
00019 
00020 #include "BackendsManager.h"
00021 
00022 #include <QPluginLoader>
00023 
00024 #ifndef KDE_USE_FINAL
00025 Q_IMPORT_PLUGIN(auth_backend)
00026 Q_IMPORT_PLUGIN(helper_proxy)
00027 #endif
00028 namespace KAuth
00029 {
00030 
00031 AuthBackend *BackendsManager::auth = NULL;
00032 HelperProxy *BackendsManager::helper = NULL;
00033 
00034 BackendsManager::BackendsManager()
00035 {
00036 }
00037 
00038 void BackendsManager::init()
00039 {
00040     QObjectList l = QPluginLoader::staticInstances();
00041     foreach(QObject *o, l) {
00042         AuthBackend *a = qobject_cast<AuthBackend *>(o);
00043         if (a) {
00044             auth = a;
00045         }
00046         HelperProxy *h = qobject_cast<HelperProxy *>(o);
00047         if (h) {
00048             helper = h;
00049         }
00050     }
00051 
00052     Q_ASSERT_X(auth, __FUNCTION__, "No AuthBackend found.");
00053     Q_ASSERT_X(helper, __FUNCTION__, "No HelperBackend found.");
00054 }
00055 
00056 AuthBackend *BackendsManager::authBackend()
00057 {
00058     if (!auth) {
00059         init();
00060     }
00061 
00062     return auth;
00063 }
00064 
00065 HelperProxy *BackendsManager::helperProxy()
00066 {
00067     if (!helper) {
00068         init();
00069     }
00070 
00071     return helper;
00072 }
00073 
00074 } // namespace Auth

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  •     Sodep
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal