From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/kfontinst/lib/FcEngine.cpp | 158 ++++++++++++++++++------------------ kcontrol/kfontinst/lib/FcEngine.h | 52 ++++++------ kcontrol/kfontinst/lib/Misc.cpp | 48 +++++------ kcontrol/kfontinst/lib/Misc.h | 40 ++++----- 4 files changed, 149 insertions(+), 149 deletions(-) (limited to 'kcontrol/kfontinst/lib') diff --git a/kcontrol/kfontinst/lib/FcEngine.cpp b/kcontrol/kfontinst/lib/FcEngine.cpp index 0b3e51767..44d180fd2 100644 --- a/kcontrol/kfontinst/lib/FcEngine.cpp +++ b/kcontrol/kfontinst/lib/FcEngine.cpp @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -23,7 +23,7 @@ #define KFI_PREVIEW_STRING_KEY "String" #ifdef HAVE_XFT -#define KFI_DISPLAY(pix) (pix ? pix->x11Display() : QPaintDevice::x11AppDisplay()) +#define KFI_DISPLAY(pix) (pix ? pix->x11Display() : TQPaintDevice::x11AppDisplay()) #endif namespace KFI @@ -73,25 +73,25 @@ static int fcToQtWeight(int weight) case FC_WEIGHT_THIN: return 0; case FC_WEIGHT_ULTRALIGHT: - return QFont::Light>>1; + return TQFont::Light>>1; case FC_WEIGHT_LIGHT: - return QFont::Light; + return TQFont::Light; default: case FC_WEIGHT_NORMAL: - return QFont::Normal; + return TQFont::Normal; case FC_WEIGHT_MEDIUM: #ifdef KFI_HAVE_MEDIUM_WEIGHT - return (QFont::Normal+QFont::DemiBold)>>1; + return (TQFont::Normal+TQFont::DemiBold)>>1; #endif - return QFont::Normal; + return TQFont::Normal; case FC_WEIGHT_SEMIBOLD: - return QFont::DemiBold; + return TQFont::DemiBold; case FC_WEIGHT_BOLD: - return QFont::Bold; + return TQFont::Bold; case FC_WEIGHT_ULTRABOLD: - return (QFont::Bold+QFont::Black)>>1; + return (TQFont::Bold+TQFont::Black)>>1; case FC_WEIGHT_HEAVY: - return QFont::Black; + return TQFont::Black; } } @@ -130,24 +130,24 @@ static int fcToQtWidth(int weight) switch(weight) { case FC_WIDTH_ULTRACONDENSED: - return QFont::UltraCondensed; + return TQFont::UltraCondensed; case FC_WIDTH_EXTRACONDENSED: - return QFont::ExtraCondensed; + return TQFont::ExtraCondensed; case FC_WIDTH_CONDENSED: - return QFont::Condensed; + return TQFont::Condensed; case FC_WIDTH_SEMICONDENSED: - return QFont::SemiCondensed; + return TQFont::SemiCondensed; default: case FC_WIDTH_NORMAL: - return QFont::Unstretched; + return TQFont::Unstretched; case FC_WIDTH_SEMIEXPANDED: - return QFont::SemiExpanded; + return TQFont::SemiExpanded; case FC_WIDTH_EXPANDED: - return QFont::Expanded; + return TQFont::Expanded; case FC_WIDTH_EXTRAEXPANDED: - return QFont::ExtraExpanded; + return TQFont::ExtraExpanded; case FC_WIDTH_ULTRAEXPANDED: - return QFont::UltraExpanded; + return TQFont::UltraExpanded; } } #endif @@ -183,7 +183,7 @@ static int fcSpacing(int spacing) return FC_CHARCELL; } -static int strToWeight(const QString &str, QString &newStr) +static int strToWeight(const TQString &str, TQString &newStr) { if(0==str.find(i18n(KFI_WEIGHT_THIN), 0, false)) { @@ -261,7 +261,7 @@ static int strToWeight(const QString &str, QString &newStr) } #ifndef KFI_FC_NO_WIDTHS -static int strToWidth(const QString &str, QString &newStr) +static int strToWidth(const TQString &str, TQString &newStr) { if(0==str.find(i18n(KFI_WIDTH_ULTRACONDENSED), 0, false)) { @@ -314,7 +314,7 @@ static int strToWidth(const QString &str, QString &newStr) } #endif -static int strToSlant(const QString &str) +static int strToSlant(const TQString &str) { if(-1!=str.find(i18n(KFI_SLANT_ITALIC))) return FC_SLANT_ITALIC; @@ -323,9 +323,9 @@ static int strToSlant(const QString &str) return FC_SLANT_ROMAN; } -static void drawText(QPainter &painter, int x, int y, int width, const QString &str) +static void drawText(TQPainter &painter, int x, int y, int width, const TQString &str) { - QString s(str); + TQString s(str); bool addedElipses=false; width-=x*2; @@ -366,7 +366,7 @@ inline bool equalSlant(int a, int b) } #ifdef HAVE_XFT -static bool drawChar(QPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor *xftCol, const QString &text, int pos, +static bool drawChar(TQPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor *xftCol, const TQString &text, int pos, int &x, int &y, int w, int h, int fSize, int offset) { XGlyphInfo extents; @@ -389,7 +389,7 @@ static bool drawChar(QPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor return false; } -static bool drawString(QPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor *xftCol, const QString &text, +static bool drawString(TQPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor *xftCol, const TQString &text, int x, int &y, int h, int offset) { XGlyphInfo extents; @@ -406,7 +406,7 @@ static bool drawString(QPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColo return false; } -static bool drawGlyph(QPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor *xftCol, FT_UInt i, +static bool drawGlyph(TQPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor *xftCol, FT_UInt i, int &x, int &y, int &w, int &h, int fSize, int offset) { XGlyphInfo extents; @@ -430,10 +430,10 @@ static bool drawGlyph(QPixmap &pix, XftDraw *xftDraw, XftFont *xftFont, XftColor inline int point2Pixel(int point) { - return (point*QPaintDevice::x11AppDpiX()+36)/72; + return (point*TQPaintDevice::x11AppDpiX()+36)/72; } -static bool hasStr(XftFont *font, QString &str) +static bool hasStr(XftFont *font, TQString &str) { unsigned int slen=str.length(), ch; @@ -457,7 +457,7 @@ CFcEngine::~CFcEngine() FcConfigAppFontClear(FcConfigGetCurrent()); } -QString CFcEngine::getName(const KURL &url, int faceNo) +TQString CFcEngine::getName(const KURL &url, int faceNo) { if(url!=itsLastUrl || faceNo!=itsIndex) parseUrl(url, faceNo); @@ -466,7 +466,7 @@ QString CFcEngine::getName(const KURL &url, int faceNo) } #ifdef HAVE_XFT -bool CFcEngine::draw(const KURL &url, int w, int h, QPixmap &pix, int faceNo, bool thumb) +bool CFcEngine::draw(const KURL &url, int w, int h, TQPixmap &pix, int faceNo, bool thumb) { bool rv=false; @@ -493,7 +493,7 @@ bool CFcEngine::draw(const KURL &url, int w, int h, QPixmap &pix, int faceNo, bo pix.resize(w, h); pix.fill(Qt::white); - QPainter painter(&pix); + TQPainter painter(&pix); getSizes(&pix); @@ -519,7 +519,7 @@ bool CFcEngine::draw(const KURL &url, int w, int h, QPixmap &pix, int faceNo, bo if(thumb) { - QString text(i18n("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789")); + TQString text(i18n("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789")); // // Calculate size of text... @@ -569,7 +569,7 @@ bool CFcEngine::draw(const KURL &url, int w, int h, QPixmap &pix, int faceNo, bo } else { - QString lowercase(getLowercaseLetters()), + TQString lowercase(getLowercaseLetters()), uppercase(getUppercaseLetters()), punctuation(getPunctuation()), title(itsDescriptiveName.isEmpty() @@ -614,7 +614,7 @@ bool CFcEngine::draw(const KURL &url, int w, int h, QPixmap &pix, int faceNo, bo y+=8; } - QString previewString(getPreviewString()); + TQString previewString(getPreviewString()); bool stop=false; if(!drawGlyphs) @@ -685,20 +685,20 @@ bool CFcEngine::draw(const KURL &url, int w, int h, QPixmap &pix, int faceNo, bo } #endif -QString CFcEngine::getPreviewString() +TQString CFcEngine::getPreviewString() { KConfig cfg(KFI_UI_CFG_FILE); cfg.setGroup(KFI_PREVIEW_GROUP); - QString str(cfg.readEntry(KFI_PREVIEW_STRING_KEY)); + TQString str(cfg.readEntry(KFI_PREVIEW_STRING_KEY)); return str.isEmpty() ? i18n("A sentence that uses all of the letters of the alphabet", "The quick brown fox jumps over the lazy dog") : str; } -void CFcEngine::setPreviewString(const QString &str) +void CFcEngine::setPreviewString(const TQString &str) { KConfig cfg(KFI_UI_CFG_FILE); @@ -706,36 +706,36 @@ void CFcEngine::setPreviewString(const QString &str) cfg.writeEntry(KFI_PREVIEW_STRING_KEY, str); } -QString CFcEngine::getUppercaseLetters() +TQString CFcEngine::getUppercaseLetters() { return i18n("All of the letters of the alphabet, uppercase", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } -QString CFcEngine::getLowercaseLetters() +TQString CFcEngine::getLowercaseLetters() { return i18n("All of the letters of the alphabet, lowercase", "abcdefghijklmnopqrstuvwxyz"); } -QString CFcEngine::getPunctuation() +TQString CFcEngine::getPunctuation() { return i18n("Numbers and characters", "0123456789.:,;(*!?'/\\\")£$€%^&-+@~#<>{}[]"); } -QString CFcEngine::getFcString(FcPattern *pat, const char *val, int faceNo) +TQString CFcEngine::getFcString(FcPattern *pat, const char *val, int faceNo) { - QString rv; + TQString rv; FcChar8 *fcStr; if(FcResultMatch==FcPatternGetString(pat, val, faceNo, &fcStr)) - rv=QString::fromUtf8((char *)fcStr); + rv=TQString::fromUtf8((char *)fcStr); return rv; } -QString CFcEngine::createName(FcPattern *pat, int faceNo) +TQString CFcEngine::createName(FcPattern *pat, int faceNo) { //CPD: TODO: the names *need* to match up with kfontchooser's... - QString name(getFcString(pat, FC_FAMILY, faceNo)), + TQString name(getFcString(pat, FC_FAMILY, faceNo)), str; int intVal; bool comma=false; @@ -745,7 +745,7 @@ QString CFcEngine::createName(FcPattern *pat, int faceNo) str=weightStr(intVal); if(!str.isEmpty()) { - name+=QString(", ")+str; + name+=TQString(", ")+str; comma=true; } } @@ -757,10 +757,10 @@ QString CFcEngine::createName(FcPattern *pat, int faceNo) { if(!comma) { - name+=QChar(','); + name+=TQChar(','); comma=true; } - name+=QChar(' ')+str; + name+=TQChar(' ')+str; } } @@ -769,14 +769,14 @@ QString CFcEngine::createName(FcPattern *pat, int faceNo) { str=widthStr(intVal); if(!str.isEmpty()) - name+=QChar(' ')+str; + name+=TQChar(' ')+str; } #endif return name; } -QString CFcEngine::weightStr(int weight, bool emptyNormal) +TQString CFcEngine::weightStr(int weight, bool emptyNormal) { switch(fcWeight(weight)) { @@ -787,7 +787,7 @@ QString CFcEngine::weightStr(int weight, bool emptyNormal) case FC_WEIGHT_LIGHT: return i18n(KFI_WEIGHT_LIGHT); case FC_WEIGHT_NORMAL: - return emptyNormal ? QString::null : i18n(KFI_WEIGHT_NORMAL); + return emptyNormal ? TQString::null : i18n(KFI_WEIGHT_NORMAL); case FC_WEIGHT_MEDIUM: return i18n(KFI_WEIGHT_MEDIUM); case FC_WEIGHT_DEMIBOLD: @@ -802,7 +802,7 @@ QString CFcEngine::weightStr(int weight, bool emptyNormal) } #ifndef KFI_FC_NO_WIDTHS -QString CFcEngine::widthStr(int width, bool emptyNormal) +TQString CFcEngine::widthStr(int width, bool emptyNormal) { switch(fcWidth(width)) { @@ -815,7 +815,7 @@ QString CFcEngine::widthStr(int width, bool emptyNormal) case FC_WIDTH_SEMICONDENSED: return i18n(KFI_WIDTH_SEMICONDENSED); case FC_WIDTH_NORMAL: - return emptyNormal ? QString::null : i18n(KFI_WIDTH_NORMAL); + return emptyNormal ? TQString::null : i18n(KFI_WIDTH_NORMAL); case FC_WIDTH_SEMIEXPANDED: return i18n(KFI_WIDTH_SEMIEXPANDED); case FC_WIDTH_EXPANDED: @@ -828,7 +828,7 @@ QString CFcEngine::widthStr(int width, bool emptyNormal) } #endif -QString CFcEngine::slantStr(int slant, bool emptyNormal) +TQString CFcEngine::slantStr(int slant, bool emptyNormal) { switch(fcSlant(slant)) { @@ -837,11 +837,11 @@ QString CFcEngine::slantStr(int slant, bool emptyNormal) case FC_SLANT_ITALIC: return i18n(KFI_SLANT_ITALIC); default: - return emptyNormal ? QString::null : i18n(KFI_SLANT_ROMAN); + return emptyNormal ? TQString::null : i18n(KFI_SLANT_ROMAN); } } -QString CFcEngine::spacingStr(int spacing) +TQString CFcEngine::spacingStr(int spacing) { switch(fcSpacing(spacing)) { @@ -854,11 +854,11 @@ QString CFcEngine::spacingStr(int spacing) } } -bool CFcEngine::getInfo(const KURL &url, int faceNo, QString &full, QString &family, QString &foundry, QString &weight, +bool CFcEngine::getInfo(const KURL &url, int faceNo, TQString &full, TQString &family, TQString &foundry, TQString &weight, #ifndef KFI_FC_NO_WIDTHS - QString &width, + TQString &width, #endif - QString &spacing, QString &slant) + TQString &spacing, TQString &slant) { if(parseUrl(url, faceNo, true)) { @@ -887,11 +887,11 @@ bool CFcEngine::getInfo(const KURL &url, int faceNo, QString &full, QString &fam return false; } -QFont CFcEngine::getQFont(const QString &name, int size) +TQFont CFcEngine::getQFont(const TQString &name, int size) { parseName(name, 0, false); - QFont font(itsName, size, fcToQtWeight(itsWeight), fcToQtSlant(itsSlant)); + TQFont font(itsName, size, fcToQtWeight(itsWeight), fcToQtSlant(itsSlant)); #ifndef KFI_FC_NO_WIDTHS font.setStretch(fcToQtWidth(itsWidth)); @@ -912,7 +912,7 @@ bool CFcEngine::parseUrl(const KURL &url, int faceNo, bool all) if(KFI_KIO_FONTS_PROTOCOL==url.protocol()) { KIO::UDSEntry udsEntry; - QString name; + TQString name; FcInitReinitialize(); if(KIO::NetAccess::stat(url, udsEntry, NULL)) // Need to stat the url to get its font name... @@ -939,13 +939,13 @@ bool CFcEngine::parseUrl(const KURL &url, int faceNo, bool all) else if(url.isLocalFile()) { // Now lets see if its from the thumbnail job! if so, then file will just contain the URL! - QFile file(url.path()); + TQFile file(url.path()); bool isThumbnailUrl=false; if(file.size()<2048 && file.open(IO_ReadOnly)) // Urls should be less than 2k, and fonts usually above! { - QString thumbUrl; - QTextStream stream(&file); + TQString thumbUrl; + TQTextStream stream(&file); thumbUrl=stream.readLine(); isThumbnailUrl=0==thumbUrl.find(KFI_KIO_FONTS_PROTOCOL) && parseUrl(KURL(thumbUrl), faceNo, all); @@ -957,7 +957,7 @@ bool CFcEngine::parseUrl(const KURL &url, int faceNo, bool all) itsName=url.path(); int count; - FcPattern *pat=FcFreeTypeQuery((const FcChar8 *)(QFile::encodeName(itsName).data()), 0, NULL, &count); + FcPattern *pat=FcFreeTypeQuery((const FcChar8 *)(TQFile::encodeName(itsName).data()), 0, NULL, &count); itsWeight=FC_WEIGHT_NORMAL; #ifndef KFI_FC_NO_WIDTHS @@ -984,7 +984,7 @@ bool CFcEngine::parseUrl(const KURL &url, int faceNo, bool all) FcPatternDestroy(pat); } else - itsDescriptiveName=QString::null; + itsDescriptiveName=TQString::null; itsInstalled=false; itsIndex=faceNo; @@ -997,7 +997,7 @@ bool CFcEngine::parseUrl(const KURL &url, int faceNo, bool all) return true; } -void CFcEngine::parseName(const QString &name, int faceNo, bool all) +void CFcEngine::parseName(const TQString &name, int faceNo, bool all) { int pos; @@ -1014,7 +1014,7 @@ void CFcEngine::parseName(const QString &name, int faceNo, bool all) } else { - QString style(name.mid(pos+2)); + TQString style(name.mid(pos+2)); itsWeight=strToWeight(style, style); #ifndef KFI_FC_NO_WIDTHS @@ -1052,7 +1052,7 @@ void CFcEngine::parseName(const QString &name, int faceNo, bool all) } #ifdef HAVE_XFT -XftFont * CFcEngine::getFont(int size, QPixmap *pix) +XftFont * CFcEngine::getFont(int size, TQPixmap *pix) { if(itsInstalled) return XftFontOpen(KFI_DISPLAY(pix), 0, @@ -1067,7 +1067,7 @@ XftFont * CFcEngine::getFont(int size, QPixmap *pix) else { FcPattern *pattern = FcPatternBuild(NULL, - FC_FILE, FcTypeString, QFile::encodeName(itsName).data(), + FC_FILE, FcTypeString, TQFile::encodeName(itsName).data(), FC_INDEX, FcTypeInteger, itsIndex, FC_PIXEL_SIZE, FcTypeDouble, (double)size, NULL); @@ -1075,7 +1075,7 @@ XftFont * CFcEngine::getFont(int size, QPixmap *pix) } } -void CFcEngine::getSizes(QPixmap *pix) +void CFcEngine::getSizes(TQPixmap *pix) { static const int constNumSizes=11; static const int constNumSizeRanges=2; @@ -1152,7 +1152,7 @@ void CFcEngine::getSizes(QPixmap *pix) FcResultMatch==FcPatternGetInteger(f->pattern, FC_WIDTH, 0, &iv) && equalWidth(iv, itsWidth) && #endif FcResultMatch==FcPatternGetString(f->pattern, FC_FAMILY, 0, &str) && str && - QString::fromUtf8((char *)str)==itsName) + TQString::fromUtf8((char *)str)==itsName) { itsSizes.push_back(constSizes[l][i]); gotSizes=true; diff --git a/kcontrol/kfontinst/lib/FcEngine.h b/kcontrol/kfontinst/lib/FcEngine.h index 4a09b8a55..594a9192a 100644 --- a/kcontrol/kfontinst/lib/FcEngine.h +++ b/kcontrol/kfontinst/lib/FcEngine.h @@ -5,9 +5,9 @@ #include "config.h" #endif -#include -#include -#include +#include +#include +#include #include #include #include @@ -53,33 +53,33 @@ class KDE_EXPORT CFcEngine ~CFcEngine(); #ifdef HAVE_XFT - bool draw(const KURL &url, int w, int h, QPixmap &pix, int faceNo, bool thumb); + bool draw(const KURL &url, int w, int h, TQPixmap &pix, int faceNo, bool thumb); #endif int getNumIndexes() { return itsIndexCount; } // Only valid after draw has been called! - QString getName(const KURL &url, int faceNo=0); - bool getInfo(const KURL &url, int faceNo, QString &full, QString &family, QString &foundry, QString &weight, + TQString getName(const KURL &url, int faceNo=0); + bool getInfo(const KURL &url, int faceNo, TQString &full, TQString &family, TQString &foundry, TQString &weight, #ifndef KFI_FC_NO_WIDTHS - QString &width, + TQString &width, #endif - QString &spacing, QString &slant); - QFont getQFont(const QString &name, int size); + TQString &spacing, TQString &slant); + TQFont getQFont(const TQString &name, int size); - const QValueVector & sizes() const { return itsSizes; } + const TQValueVector & sizes() const { return itsSizes; } int alphaSize() const { return itsAlphaSize; } - static QString getPreviewString(); - static void setPreviewString(const QString &str); - static QString getUppercaseLetters(); - static QString getLowercaseLetters(); - static QString getPunctuation(); - static QString getFcString(FcPattern *pat, const char *val, int faceNo=0); - static QString createName(FcPattern *pat, int faceNo=0); - static QString weightStr(int weight, bool emptyNormal=true); + static TQString getPreviewString(); + static void setPreviewString(const TQString &str); + static TQString getUppercaseLetters(); + static TQString getLowercaseLetters(); + static TQString getPunctuation(); + static TQString getFcString(FcPattern *pat, const char *val, int faceNo=0); + static TQString createName(FcPattern *pat, int faceNo=0); + static TQString weightStr(int weight, bool emptyNormal=true); #ifndef KFI_FC_NO_WIDTHS - static QString widthStr(int width, bool emptyNormal=true); + static TQString widthStr(int width, bool emptyNormal=true); #endif - static QString slantStr(int slant, bool emptyNormal=true); - static QString spacingStr(int spacing); + static TQString slantStr(int slant, bool emptyNormal=true); + static TQString spacingStr(int spacing); static const int constScalableSizes[]; static const int constDefaultAlphaSize; @@ -87,16 +87,16 @@ class KDE_EXPORT CFcEngine private: bool parseUrl(const KURL &url, int faceNo, bool all=false); - void parseName(const QString &name, int faceNo, bool all=false); + void parseName(const TQString &name, int faceNo, bool all=false); #ifdef HAVE_XFT - XftFont * getFont(int size, QPixmap *pix=NULL); - void getSizes(QPixmap *pix=NULL); + XftFont * getFont(int size, TQPixmap *pix=NULL); + void getSizes(TQPixmap *pix=NULL); #endif private: bool itsInstalled; - QString itsName, + TQString itsName, itsDescriptiveName, itsFoundry; int itsIndex, @@ -108,7 +108,7 @@ class KDE_EXPORT CFcEngine itsSlant, itsSpacing, itsAlphaSize; - QValueVector itsSizes; + TQValueVector itsSizes; KURL itsLastUrl; FcBool itsScalable; }; diff --git a/kcontrol/kfontinst/lib/Misc.cpp b/kcontrol/kfontinst/lib/Misc.cpp index 4606ad0ca..1e779b514 100644 --- a/kcontrol/kfontinst/lib/Misc.cpp +++ b/kcontrol/kfontinst/lib/Misc.cpp @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////////////////////////// #include "Misc.h" -#include +#include #include #include #include @@ -40,14 +40,14 @@ namespace KFI namespace Misc { -QString linkedTo(const QString &i) +TQString linkedTo(const TQString &i) { - QString d; + TQString d; if(isLink(i)) { char buffer[1000]; - int n=readlink(QFile::encodeName(i), buffer, 1000); + int n=readlink(TQFile::encodeName(i), buffer, 1000); if(n!=-1) { @@ -59,11 +59,11 @@ QString linkedTo(const QString &i) return d; } -QString dirSyntax(const QString &d) +TQString dirSyntax(const TQString &d) { if(!d.isEmpty()) { - QString ds(d); + TQString ds(d); ds.replace("//", "/"); @@ -78,11 +78,11 @@ QString dirSyntax(const QString &d) return d; } -QString xDirSyntax(const QString &d) +TQString xDirSyntax(const TQString &d) { if(!d.isEmpty()) { - QString ds(d); + TQString ds(d); ds.replace("//", "/"); @@ -96,9 +96,9 @@ QString xDirSyntax(const QString &d) return d; } -QString getDir(const QString &f) +TQString getDir(const TQString &f) { - QString d(f); + TQString d(f); int slashPos=d.findRev('/'); @@ -108,9 +108,9 @@ QString getDir(const QString &f) return dirSyntax(d); } -QString getFile(const QString &f) +TQString getFile(const TQString &f) { - QString d(f); + TQString d(f); int slashPos=d.findRev('/'); @@ -120,7 +120,7 @@ QString getFile(const QString &f) return d; } -bool createDir(const QString &dir) +bool createDir(const TQString &dir) { // // Clear any umask before dir is created @@ -131,7 +131,7 @@ bool createDir(const QString &dir) return status; } -bool doCmd(const QString &cmd, const QString &p1, const QString &p2, const QString &p3) +bool doCmd(const TQString &cmd, const TQString &p1, const TQString &p2, const TQString &p3) { KProcess proc; @@ -149,13 +149,13 @@ bool doCmd(const QString &cmd, const QString &p1, const QString &p2, const QStri return proc.normalExit() && proc.exitStatus()==0; } -QString changeExt(const QString &f, const QString &newExt) +TQString changeExt(const TQString &f, const TQString &newExt) { - QString newStr(f); + TQString newStr(f); int dotPos=newStr.findRev('.'); if(-1==dotPos) - newStr+=QChar('.')+newExt; + newStr+=TQChar('.')+newExt; else { newStr.remove(dotPos+1, newStr.length()); @@ -164,9 +164,9 @@ QString changeExt(const QString &f, const QString &newExt) return newStr; } -void createBackup(const QString &f) +void createBackup(const TQString &f) { - const QString constExt(".bak"); + const TQString constExt(".bak"); if(!fExists(f+constExt) && fExists(f)) doCmd("cp", "-f", f, f+constExt); @@ -179,7 +179,7 @@ void createBackup(const QString &f) // // Associated: /home/a/courier.afm /home/a/courier.pfm // -void getAssociatedUrls(const KURL &url, KURL::List &list, bool afmAndPfm, QWidget *widget) +void getAssociatedUrls(const KURL &url, KURL::List &list, bool afmAndPfm, TQWidget *widget) { const char *afm[]={"afm", "AFM", "Afm", "AFm", "AfM", "aFM", "aFm", "afM", NULL}, *pfm[]={"pfm", "PFM", "Pfm", "PFm", "PfM", "pFM", "pFm", "pfM", NULL}; @@ -217,18 +217,18 @@ void getAssociatedUrls(const KURL &url, KURL::List &list, bool afmAndPfm, QWidge } } -time_t getTimeStamp(const QString &item) +time_t getTimeStamp(const TQString &item) { KDE_struct_stat info; - return !item.isEmpty() && 0==KDE_lstat(QFile::encodeName(item), &info) ? info.st_mtime : 0; + return !item.isEmpty() && 0==KDE_lstat(TQFile::encodeName(item), &info) ? info.st_mtime : 0; } -bool check(const QString &path, unsigned int fmt, bool checkW) +bool check(const TQString &path, unsigned int fmt, bool checkW) { KDE_struct_stat info; - QCString pathC(QFile::encodeName(path)); + TQCString pathC(TQFile::encodeName(path)); return 0==KDE_lstat(pathC, &info) && (info.st_mode&S_IFMT)==fmt && (!checkW || 0==::access(pathC, W_OK)); } diff --git a/kcontrol/kfontinst/lib/Misc.h b/kcontrol/kfontinst/lib/Misc.h index a624f44f9..d20f08358 100644 --- a/kcontrol/kfontinst/lib/Misc.h +++ b/kcontrol/kfontinst/lib/Misc.h @@ -33,8 +33,8 @@ #include #include #include -#include -#include +#include +#include #include class QWidget; @@ -50,25 +50,25 @@ namespace Misc DIR_PERMS = 0755 }; - extern KDE_EXPORT bool check(const QString &path, unsigned int fmt, bool checkW=false); - inline KDE_EXPORT bool fExists(const QString &p) { return check(p, S_IFREG, false); } - inline KDE_EXPORT bool dExists(const QString &p) { return check(p, S_IFDIR, false); } - inline KDE_EXPORT bool fWritable(const QString &p) { return check(p, S_IFREG, true); } - inline KDE_EXPORT bool dWritable(const QString &p) { return check(p, S_IFDIR, true); } - inline KDE_EXPORT bool isLink(const QString &i) { return check(i, S_IFLNK, false); } - extern KDE_EXPORT QString linkedTo(const QString &i); - extern KDE_EXPORT QString dirSyntax(const QString &d); // Has trailing slash: /file/path/ - extern KDE_EXPORT QString xDirSyntax(const QString &d); // No trailing slash: /file/path - inline KDE_EXPORT QString fileSyntax(const QString &f) { return xDirSyntax(f); } - extern KDE_EXPORT QString getDir(const QString &f); - extern KDE_EXPORT QString getFile(const QString &f); - extern KDE_EXPORT bool createDir(const QString &dir); - extern KDE_EXPORT QString changeExt(const QString &f, const QString &newExt); - extern KDE_EXPORT bool doCmd(const QString &cmd, const QString &p1=QString::null, const QString &p2=QString::null, const QString &p3=QString::null); + extern KDE_EXPORT bool check(const TQString &path, unsigned int fmt, bool checkW=false); + inline KDE_EXPORT bool fExists(const TQString &p) { return check(p, S_IFREG, false); } + inline KDE_EXPORT bool dExists(const TQString &p) { return check(p, S_IFDIR, false); } + inline KDE_EXPORT bool fWritable(const TQString &p) { return check(p, S_IFREG, true); } + inline KDE_EXPORT bool dWritable(const TQString &p) { return check(p, S_IFDIR, true); } + inline KDE_EXPORT bool isLink(const TQString &i) { return check(i, S_IFLNK, false); } + extern KDE_EXPORT TQString linkedTo(const TQString &i); + extern KDE_EXPORT TQString dirSyntax(const TQString &d); // Has trailing slash: /file/path/ + extern KDE_EXPORT TQString xDirSyntax(const TQString &d); // No trailing slash: /file/path + inline KDE_EXPORT TQString fileSyntax(const TQString &f) { return xDirSyntax(f); } + extern KDE_EXPORT TQString getDir(const TQString &f); + extern KDE_EXPORT TQString getFile(const TQString &f); + extern KDE_EXPORT bool createDir(const TQString &dir); + extern KDE_EXPORT TQString changeExt(const TQString &f, const TQString &newExt); + extern KDE_EXPORT bool doCmd(const TQString &cmd, const TQString &p1=TQString::null, const TQString &p2=TQString::null, const TQString &p3=TQString::null); inline KDE_EXPORT bool root() { return 0==getuid(); } - extern KDE_EXPORT void getAssociatedUrls(const KURL &url, KURL::List &list, bool afmAndPfm=true, QWidget *widget=NULL); - extern KDE_EXPORT void createBackup(const QString &f); - extern KDE_EXPORT time_t getTimeStamp(const QString &item); + extern KDE_EXPORT void getAssociatedUrls(const KURL &url, KURL::List &list, bool afmAndPfm=true, TQWidget *widget=NULL); + extern KDE_EXPORT void createBackup(const TQString &f); + extern KDE_EXPORT time_t getTimeStamp(const TQString &item); } } -- cgit v1.2.1