kttsd Library API Documentation

pluginconf.cpp

00001 /***************************************************** vim:set ts=4 sw=4 sts=4:
00002   pluginconf.cpp
00003   This file is the templates for the configuration plug ins.
00004   -------------------
00005   Copyright : (C) 2002-2003 by José Pablo Ezequiel "Pupeno" Fernández
00006   -------------------
00007   Original author: José Pablo Ezequiel "Pupeno" Fernández <pupeno@kde.org>
00008   Current Maintainer: Gary Cramblitt <garycramblitt@comcast.net>
00009  ******************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; version 2 of the License.               *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 // C++ library includes.
00020 #include <stdlib.h>
00021 #include <sys/param.h>
00022 
00023 // Qt includes.
00024 #include <qfile.h>
00025 #include <qfileinfo.h>
00026 #include <qstring.h>
00027 
00028 // KDE includes.
00029 #include <kglobal.h>
00030 #include <klocale.h>
00031 
00032 // PluginConf includes.
00033 #include "pluginconf.h"
00034 #include "pluginconf.moc"
00035 
00039 PlugInConf::PlugInConf( QWidget *parent, const char *name) : QWidget(parent, name){
00040     kdDebug() << "PlugInConf::PlugInConf: Running" << endl;
00041     QString systemPath(getenv("PATH"));
00042     // kdDebug() << "Path is " << systemPath << endl;
00043     m_path = QStringList::split(":", systemPath);
00044     m_player = 0;
00045 }
00046 
00050 PlugInConf::~PlugInConf(){
00051     kdDebug() << "PlugInConf::~PlugInConf: Running" << endl;
00052     delete m_player;
00053 }
00054 
00068 void PlugInConf::load(KConfig* /*config*/, const QString& /*configGroup*/){
00069     kdDebug() << "PlugInConf::load: Running" << endl;
00070 }
00071 
00082 void PlugInConf::save(KConfig* /*config*/, const QString& /*configGroup*/){
00083     kdDebug() << "PlugInConf::save: Running" << endl;
00084 }
00085 
00093 void PlugInConf::defaults(){
00094     kdDebug() << "PlugInConf::defaults: Running" << endl;
00095 }
00096 
00106 bool PlugInConf::supportsMultiInstance() { return true; }
00107 
00118 void PlugInConf::setDesiredLanguage(const QString& /*lang*/ ) { }
00119 
00127 QString PlugInConf::getTalkerCode() { return QString::null; }
00128 
00140 QStringList PlugInConf::getSupportedLanguages() { return QStringList(); }
00141 
00148 QString PlugInConf::getLocation(const QString &name) {
00149     // Iterate over the path and see if 'name' exists in it. Return the
00150     // full path to it if it does. Else return an empty QString.
00151     if (QFile::exists(name)) return name;
00152     kdDebug() << "PluginConf::getLocation: Searching for " << name << " in the path.." << endl;
00153     kdDebug() << m_path << endl;
00154     for(QStringList::iterator it = m_path.begin(); it != m_path.end(); ++it) {
00155         QString fullName = *it;
00156         fullName += "/";
00157         fullName += name;
00158         // The user either has the directory of the file in the path...
00159         if(QFile::exists(fullName)) {
00160             return fullName;
00161             kdDebug() << "PluginConf:getLocation: " << fullName << endl;
00162         }
00163         // ....Or the file itself
00164         else if(QFileInfo(*it).baseName().append(QString(".").append(QFileInfo(*it).extension())) == name) {
00165             return fullName;
00166             kdDebug() << "PluginConf:getLocation: " << fullName << endl;
00167         }
00168     }
00169     return "";
00170 }
00171 
00178 QString PlugInConf::splitLanguageCode(const QString& languageCode, QString& countryCode)
00179 {
00180     QString locale = languageCode;
00181     QString langCode;
00182     QString charSet;
00183     KGlobal::locale()->splitLocale(locale, langCode, countryCode, charSet);
00184     return langCode;
00185 }
00186 
00187 QString PlugInConf::realFilePath(const QString &filename)
00188 {
00189     char realpath_buffer[MAXPATHLEN + 1];
00190     memset(realpath_buffer, 0, MAXPATHLEN + 1);
00191 
00192     /* If the path contains symlinks, get the real name */
00193     if (realpath( QFile::encodeName(filename).data(), realpath_buffer) != 0) {
00194         //succes, use result from realpath
00195         return QFile::decodeName(realpath_buffer);
00196     }
00197     return filename;
00198 }
00199 
00203 void PlugInConf::setPlayer(TestPlayer* player) { m_player = player; }
00204 TestPlayer* PlugInConf::getPlayer() { return m_player; }
KDE Logo
This file is part of the documentation for kttsd Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Dec 12 14:37:18 2004 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003