• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeaccessibility API Reference
  • KDE Home
  • Contact Us
 

jovie

  • sources
  • kde-4.12
  • kdeaccessibility
  • jovie
  • libkttsd
filterconf.cpp
Go to the documentation of this file.
1 /***************************************************** vim:set ts=4 sw=4 sts=4:
2  Filter Configuration class.
3  This is the interface definition for text filter configuration dialogs.
4  -------------------
5  Copyright:
6  (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net>
7  -------------------
8  Original author: Gary Cramblitt <garycramblitt@comcast.net>
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23  ******************************************************************************/
24 
25 // PluginConf includes.
26 #include "filterconf.h"
27 #include "filterconf.moc"
28 
29 // C++ library includes.
30 #include <stdlib.h>
31 #include <sys/param.h>
32 
33 // Qt includes.
34 #include <QtCore/QFile>
35 #include <QtCore/QFileInfo>
36 
37 // KDE includes.
38 #include <kglobal.h>
39 #include <klocale.h>
40 
44 KttsFilterConf::KttsFilterConf( QWidget *parent, const QVariantList &) : QWidget(parent){
45  //setObjectName( QLatin1String( name ) );
46  // kDebug() << "KttsFilterConf::KttsFilterConf: Running";
47  QString systemPath(QLatin1String( qgetenv("PATH" ) ));
48  // kDebug() << "Path is " << systemPath;
49  m_path = systemPath.split( QLatin1Char( ':' ));
50 }
51 
55 KttsFilterConf::~KttsFilterConf(){
56  // kDebug() << "KttsFilterConf::~KttsFilterConf: Running";
57 }
58 
72 void KttsFilterConf::load(KConfig* /*config*/, const QString& /*configGroup*/){
73  // kDebug() << "KttsFilterConf::load: Running";
74 }
75 
86 void KttsFilterConf::save(KConfig* /*config*/, const QString& /*configGroup*/){
87  // kDebug() << "KttsFilterConf::save: Running";
88 }
89 
97 void KttsFilterConf::defaults(){
98  // kDebug() << "KttsFilterConf::defaults: Running";
99 }
100 
106 bool KttsFilterConf::supportsMultiInstance() { return false; }
107 
116 QString KttsFilterConf::userPlugInName() { return QString(); }
117 
122 bool KttsFilterConf::isSBD() { return false; }
123 
130 QString KttsFilterConf::getLocation(const QString &name) {
131  // Iterate over the path and see if 'name' exists in it. Return the
132  // full path to it if it does. Else return an empty QString.
133  if (QFile::exists(name)) return name;
134  // kDebug() << "KttsFilterConf::getLocation: Searching for " << name << " in the path..";
135  // kDebug() << m_path;
136  for(QStringList::iterator it = m_path.begin(); it != m_path.end(); ++it) {
137  QString fullName = *it;
138  fullName += QLatin1Char( '/' );
139  fullName += name;
140  // The user either has the directory of the file in the path...
141  if(QFile::exists(fullName)) {
142  // kDebug() << "KttsFilterConf:getLocation: " << fullName;
143  return fullName;
144  }
145  // ....Or the file itself
146  else if(QFileInfo(*it).baseName().append(QString(QLatin1String( "." )).append(QFileInfo(*it).suffix())) == name) {
147  // kDebug() << "KttsFilterConf:getLocation: " << fullName;
148  return fullName;
149  }
150  }
151  return QString();
152 }
153 
154 /*static*/ QString KttsFilterConf::realFilePath(const QString &filename)
155 {
156  char realpath_buffer[MAXPATHLEN + 1];
157  memset(realpath_buffer, 0, MAXPATHLEN + 1);
158 
159  /* If the path contains symlinks, get the real name */
160  if (realpath( QFile::encodeName(filename).data(), realpath_buffer) != 0) {
161  //succes, use result from realpath
162  return QFile::decodeName(realpath_buffer);
163  }
164  return filename;
165 }
KttsFilterConf::m_path
QStringList m_path
The system path in a QStringList.
Definition: filterconf.h:145
QWidget
filterconf.h
KttsFilterConf::defaults
virtual void defaults()
This function is called to set the settings in the module to sensible default values.
Definition: filterconf.cpp:97
KttsFilterConf::realFilePath
static QString realFilePath(const QString &filename)
Definition: filterconf.cpp:154
KttsFilterConf::userPlugInName
virtual QString userPlugInName()
Returns the name of the plugin.
Definition: filterconf.cpp:116
KttsFilterConf::load
virtual void load(KConfig *config, const QString &configGroup)
This method is invoked whenever the module should read its configuration (most of the times from a co...
Definition: filterconf.cpp:72
KttsFilterConf::save
virtual void save(KConfig *config, const QString &configGroup)
This function gets called when the user wants to save the settings in the user interface, updating the config files or wherever the configuration is stored.
Definition: filterconf.cpp:86
KttsFilterConf::supportsMultiInstance
virtual bool supportsMultiInstance()
Indicates whether the plugin supports multiple instances.
Definition: filterconf.cpp:106
KttsFilterConf::~KttsFilterConf
virtual ~KttsFilterConf()
Destructor.
Definition: filterconf.cpp:55
KttsFilterConf::KttsFilterConf
KttsFilterConf(QWidget *parent, const QVariantList &)
Constructor.
Definition: filterconf.cpp:44
KttsFilterConf::isSBD
virtual bool isSBD()
Returns True if this filter is a Sentence Boundary Detector.
Definition: filterconf.cpp:122
KttsFilterConf::getLocation
QString getLocation(const QString &name)
Searches the $PATH variable for any file.
Definition: filterconf.cpp:130
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:32:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

jovie

Skip menu "jovie"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeaccessibility API Reference

Skip menu "kdeaccessibility API Reference"
  • jovie

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal