00001 #ifndef __X_CONFIG_H__
00002 #define __X_CONFIG_H__
00003
00005
00006
00007
00008
00009
00010
00011
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00029
00031
00032 #include "Misc.h"
00033 #include <tqptrlist.h>
00034 #include <tqstring.h>
00035 #include <tqstringlist.h>
00036 #include <time.h>
00037
00038 namespace KFI
00039 {
00040
00041 class CFontEngine;
00042
00043 class CXConfig
00044 {
00045 public:
00046
00047 struct TPath
00048 {
00049 enum EType
00050 {
00051 DIR,
00052 FONT_SERVER,
00053 FONT_CONFIG
00054 };
00055
00056 TPath(const TQString &d, bool u=false, EType t=DIR, bool o=true)
00057 : dir(DIR==t ? Misc::dirSyntax(d) : d), unscaled(u), orig(o), type(t) {}
00058
00059 static EType getType(const TQString &d);
00060
00061 TQString dir;
00062 bool unscaled,
00063 orig;
00064 EType type;
00065 };
00066
00067 enum EType
00068 {
00069 XFS,
00070 X11
00071 };
00072
00073 public:
00074
00075 CXConfig(EType type, const TQString &file);
00076
00077 static bool configureDir(const TQString &dir);
00078
00079 bool ok() { return itsOk; }
00080 bool writable() { return itsWritable; }
00081 bool readConfig();
00082 bool writeConfig();
00083 bool madeChanges();
00084 void addPath(const TQString &dir, bool unscaled=false);
00085 bool inPath(TPath::EType type);
00086 bool xfsInPath() { return inPath(TPath::FONT_SERVER); }
00087 bool fcInPath() { return inPath(TPath::FONT_CONFIG); }
00088 void refreshPaths() { refreshPaths(XFS==itsType); }
00089 void restart();
00090 EType getType() { return itsType; }
00091
00092 static void refreshPaths(bool xfs);
00093
00094 private:
00095
00096 bool processX11(bool read);
00097 bool processXfs(bool read);
00098
00099 TPath * findPath(const TQString &dir);
00100
00101 private:
00102
00103 EType itsType;
00104 TQPtrList<TPath> itsPaths;
00105 TQString itsFileName,
00106 itsInsertPos;
00107 bool itsOk,
00108 itsWritable;
00109 time_t itsTime;
00110 };
00111
00112 }
00113
00114 #endif