kioslave
common.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2008 Jarosław Staniek <staniek@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _KIOSLAVE_COMMON_H 00021 #define _KIOSLAVE_COMMON_H 00022 00023 00024 #include <stdio.h> 00025 #include <QFile> 00026 #include <QDir> 00027 #include <KStandardDirs> 00028 00029 extern "C" { 00030 #include <sasl/sasl.h> 00031 } 00032 00033 inline bool initSASL() 00034 { 00035 #ifdef Q_OS_WIN32 //krazy:exclude=cpp 00036 QByteArray libInstallPath( QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("lib")+QLatin1String("sasl2"))) ); 00037 QByteArray configPath( QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("config")+QLatin1String("sasl2"))) ); 00038 if ( sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK 00039 || sasl_set_path(SASL_PATH_TYPE_CONFIG, configPath.data()) != SASL_OK ) 00040 { 00041 fprintf(stderr, "SASL path initialization failed!\n"); 00042 return false; 00043 } 00044 #endif 00045 00046 if ( sasl_client_init( NULL ) != SASL_OK ) { 00047 fprintf(stderr, "SASL library initialization failed!\n"); 00048 return false; 00049 } 00050 return true; 00051 } 00052 00053 00054 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 7 2012 23:55:30 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 7 2012 23:55:30 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.