diff --git a/dcop/KDE-ICE/ICEproto.h b/dcop/KDE-ICE/ICEproto.h index ff848df04..f66b86ac0 100644 --- a/dcop/KDE-ICE/ICEproto.h +++ b/dcop/KDE-ICE/ICEproto.h @@ -37,8 +37,6 @@ typedef unsigned long CARD32; #endif typedef unsigned short CARD16; typedef unsigned char CARD8; -#define B32 :32 -#define B16 :16 #include #endif @@ -46,18 +44,18 @@ typedef struct { CARD8 majorOpcode; CARD8 minorOpcode; CARD8 data[2]; - CARD32 length B32; + CARD32 length :32; } iceMsg; typedef struct { CARD8 majorOpcode; CARD8 minorOpcode; - CARD16 errorClass B16; - CARD32 length B32; + CARD16 errorClass :16; + CARD32 length :32; CARD8 offendingMinorOpcode; CARD8 severity; - CARD16 unused B16; - CARD32 offendingSequenceNum B32; + CARD16 unused :16; + CARD32 offendingSequenceNum :32; /* n varying values */ /* p p = pad (n, 8) */ } iceErrorMsg; @@ -67,7 +65,7 @@ typedef struct { CARD8 minorOpcode; CARD8 byteOrder; CARD8 unused; - CARD32 length B32; + CARD32 length :32; } iceByteOrderMsg; typedef struct { @@ -75,7 +73,7 @@ typedef struct { CARD8 minorOpcode; CARD8 versionCount; CARD8 authCount; - CARD32 length B32; + CARD32 length :32; CARD8 mustAuthenticate; CARD8 unused[7]; /* i STRING vendor */ @@ -90,8 +88,8 @@ typedef struct { CARD8 minorOpcode; CARD8 authIndex; CARD8 unused1; - CARD32 length B32; - CARD16 authDataLength B16; + CARD32 length :32; + CARD16 authDataLength :16; CARD8 unused2[6]; /* n varying data */ /* p p = pad (n, 8) */ @@ -101,8 +99,8 @@ typedef struct { CARD8 majorOpcode; CARD8 minorOpcode; CARD8 unused1[2]; - CARD32 length B32; - CARD16 authDataLength B16; + CARD32 length :32; + CARD16 authDataLength :16; CARD8 unused2[6]; /* n varying data */ /* p p = pad (n, 8) */ @@ -112,8 +110,8 @@ typedef struct { CARD8 majorOpcode; CARD8 minorOpcode; CARD8 unused1[2]; - CARD32 length B32; - CARD16 authDataLength B16; + CARD32 length :32; + CARD16 authDataLength :16; CARD8 unused2[6]; /* n varying data */ /* p p = pad (n, 8) */ @@ -124,7 +122,7 @@ typedef struct { CARD8 minorOpcode; CARD8 versionIndex; CARD8 unused; - CARD32 length B32; + CARD32 length :32; /* i STRING vendor */ /* j STRING release */ /* p p = pad (i+j, 8) */ @@ -135,7 +133,7 @@ typedef struct { CARD8 minorOpcode; CARD8 protocolOpcode; CARD8 mustAuthenticate; - CARD32 length B32; + CARD32 length :32; CARD8 versionCount; CARD8 authCount; CARD8 unused[6]; @@ -152,7 +150,7 @@ typedef struct { CARD8 minorOpcode; CARD8 versionIndex; CARD8 protocolOpcode; - CARD32 length B32; + CARD32 length :32; /* i STRING vendor */ /* j STRING release */ /* p p = pad (i+j, 8) */ diff --git a/dcop/dcopglobal.h b/dcop/dcopglobal.h index 8e018226d..559037d2f 100644 --- a/dcop/dcopglobal.h +++ b/dcop/dcopglobal.h @@ -52,18 +52,13 @@ extern "C" { #include #include -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -extern "C" { -#endif extern IcePoAuthStatus _kde_IcePoMagicCookie1Proc (IceConn, void **, int, int, int, void *, int *, void **, char **); extern IcePaAuthStatus _kde_IcePaMagicCookie1Proc (IceConn, void **, int, int, void *, int *, void **, char **); + #ifdef __cplusplus } #endif + /* these 4 below are static, otherwise build with --disable-shared will fail */ static IcePoAuthProc DCOPClientAuthProcs[] = {_kde_IcePoMagicCookie1Proc}; static IcePaAuthProc DCOPServerAuthProcs[] = {_kde_IcePaMagicCookie1Proc}; diff --git a/dcop/dcopidl/yacc.cpp b/dcop/dcopidl/yacc.cpp index 4be32edd0..9a58cefc9 100644 --- a/dcop/dcopidl/yacc.cpp +++ b/dcop/dcopidl/yacc.cpp @@ -1128,7 +1128,9 @@ while (YYID (0)) # define YYDPRINTF(Args) \ do { \ if (yydebug) \ + { \ YYFPRINTF Args; \ + } \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ diff --git a/kded/vfolder_menu.cpp b/kded/vfolder_menu.cpp index 2e04965ea..880a17576 100644 --- a/kded/vfolder_menu.cpp +++ b/kded/vfolder_menu.cpp @@ -311,25 +311,6 @@ VFolderMenu::~VFolderMenu() delete m_rootMenu; } -#define FOR_ALL_APPLICATIONS(it) \ - for(appsInfo *info = m_appsInfoStack.first(); \ - info; info = m_appsInfoStack.next()) \ - { \ - for(TQDictIterator it( info->applications ); \ - it.current(); ++it ) \ - { -#define FOR_ALL_APPLICATIONS_END } } - -#define FOR_CATEGORY(category, it) \ - for(appsInfo *info = m_appsInfoStack.first(); \ - info; info = m_appsInfoStack.next()) \ - { \ - KService::List *list = info->dictCategories.find(category); \ - if (list) for(KService::List::ConstIterator it = list->begin(); \ - it != list->end(); ++it) \ - { -#define FOR_CATEGORY_END } } - KService * VFolderMenu::findApplication(const TQString &relPath) { @@ -934,12 +915,14 @@ VFolderMenu::processCondition(TQDomElement &domElem, TQDict *items) } else if (domElem.tagName() == "Not") { - FOR_ALL_APPLICATIONS(it) - { - KService *s = it.current(); - items->replace(s->menuId(), s); - } - FOR_ALL_APPLICATIONS_END + for (appsInfo *info = m_appsInfoStack.first(); info; info = m_appsInfoStack.next()) + { + for (TQDictIterator it( info->applications ); it.current(); ++it ) + { + KService *s = it.current(); + items->replace(s->menuId(), s); + } + } TQDict notItems; TQDomNode n = domElem.firstChild(); @@ -955,21 +938,29 @@ VFolderMenu::processCondition(TQDomElement &domElem, TQDict *items) } else if (domElem.tagName() == "Category") { - FOR_CATEGORY(domElem.text(), it) - { - KService *s = *it; - items->replace(s->menuId(), s); - } - FOR_CATEGORY_END + for (appsInfo *info = m_appsInfoStack.first(); info; info = m_appsInfoStack.next()) + { + KService::List *list = info->dictCategories.find(domElem.text()); + if (list) + { + for(KService::List::ConstIterator it = list->begin(); it != list->end(); ++it) + { + KService *s = *it; + items->replace(s->menuId(), s); + } + } + } } else if (domElem.tagName() == "All") { - FOR_ALL_APPLICATIONS(it) - { - KService *s = it.current(); - items->replace(s->menuId(), s); - } - FOR_ALL_APPLICATIONS_END + for (appsInfo *info = m_appsInfoStack.first(); info; info = m_appsInfoStack.next()) + { + for (TQDictIterator it( info->applications ); it.current(); ++it ) + { + KService *s = it.current(); + items->replace(s->menuId(), s); + } + } } else if (domElem.tagName() == "Filename") { diff --git a/kjs/dtoa.cpp b/kjs/dtoa.cpp index c39fa5bc6..8fc79ddf7 100644 --- a/kjs/dtoa.cpp +++ b/kjs/dtoa.cpp @@ -2077,7 +2077,7 @@ strtod else if (!(word0(rv) & Bndry_mask) && !word1(rv)) { drop_down: /* boundary case -- decrement exponent */ -#ifdef Sudden_Underflow /*{{*/ +#ifdef Sudden_Underflow L = word0(rv) & Exp_mask; #ifdef IBM if (L < Exp_msk1) @@ -2086,8 +2086,8 @@ strtod if (L <= (scale ? (2*P+1)*Exp_msk1 : Exp_msk1)) #else if (L <= Exp_msk1) -#endif /*Avoid_Underflow*/ -#endif /*IBM*/ +#endif +#endif goto undfl; L -= Exp_msk1; #else /*Sudden_Underflow}{*/ diff --git a/kjs/grammar.cpp b/kjs/grammar.cpp index 03eb07876..9cc7a342f 100644 --- a/kjs/grammar.cpp +++ b/kjs/grammar.cpp @@ -1340,7 +1340,9 @@ while (0) # define YYDPRINTF(Args) \ do { \ if (yydebug) \ + { \ YYFPRINTF Args; \ + } \ } while (0) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ diff --git a/kjs/value.cpp b/kjs/value.cpp index bbf5a05c1..d5a7a9731 100644 --- a/kjs/value.cpp +++ b/kjs/value.cpp @@ -361,11 +361,12 @@ Number::Number(int i) Number::Number(unsigned int u) : Value(SimpleNumber::fits(u) ? SimpleNumber::make(u) : new NumberImp(static_cast(u))) { } -Number::Number(double d) +// check for NaN first if we werent't compiled with -mieee on Alpha #if defined(__alpha) && !defined(_IEEE_FP) - // check for NaN first if we werent't compiled with -mieee on Alpha +Number::Number(double d) : Value(KJS::isNaN(d) ? NumberImp::staticNaN : (SimpleNumber::fits(d) ? SimpleNumber::make((long)d) : new NumberImp(d))) { } #else +Number::Number(double d) : Value(SimpleNumber::fits(d) ? SimpleNumber::make((long)d) : (KJS::isNaN(d) ? NumberImp::staticNaN : new NumberImp(d))) { } #endif diff --git a/tdecore/kurl.cpp b/tdecore/kurl.cpp index 290355552..a80257f76 100644 --- a/tdecore/kurl.cpp +++ b/tdecore/kurl.cpp @@ -2378,21 +2378,17 @@ int KURL::uriMode() const KURL::URIMode KURL::uriModeForProtocol(const TQString& protocol) { + KURL::URIMode mode = Auto; #ifndef KDE_QT_ONLY - KURL::URIMode mode = Auto; - if (protocol == fileProt) - return URL; - if (TDEGlobal::_instance) - mode = KProtocolInfo::uriParseMode(protocol); - if (mode == Auto ) { -#else - KURL::URIMode mode = Auto; + if (protocol == fileProt) + return URL; + if (TDEGlobal::_instance) + mode = KProtocolInfo::uriParseMode(protocol); #endif - if ( protocol == "ed2k" || protocol == "sig2dat" || protocol == "slsk" || protocol == "data" ) mode = RawURI; - else if ( protocol == "mailto" ) mode = Mailto; - else mode = URL; -#ifndef KDE_QT_ONLY - } -#endif - return mode; + if (mode == Auto ) { + if ( protocol == "ed2k" || protocol == "sig2dat" || protocol == "slsk" || protocol == "data" ) mode = RawURI; + else if ( protocol == "mailto" ) mode = Mailto; + else mode = URL; + } + return mode; } diff --git a/tdecore/network/kresolverstandardworkers.cpp b/tdecore/network/kresolverstandardworkers.cpp index 701e074ad..c10c64e97 100644 --- a/tdecore/network/kresolverstandardworkers.cpp +++ b/tdecore/network/kresolverstandardworkers.cpp @@ -199,7 +199,7 @@ namespace # elif defined(HAVE_GETHOSTBYNAME_R) && (!defined(AF_INET6) || !defined(HAVE_GETHOSTBYNAME2)) # define USE_GETHOSTBYNAME_R # elif defined(HAVE_GETHOSTBYNAME2) -# define USE_GETHOSTBYNAME2) +# define USE_GETHOSTBYNAME2 # else # define USE_GETHOSTBYNAME # endif diff --git a/tdehtml/css/parser.cpp b/tdehtml/css/parser.cpp index 6fa18f17c..f664f43cd 100644 --- a/tdehtml/css/parser.cpp +++ b/tdehtml/css/parser.cpp @@ -996,13 +996,17 @@ while (0) # define YYDPRINTF(Args) \ do { \ if (yydebug) \ + { \ YYFPRINTF Args; \ + } \ } while (0) # define YYDSYMPRINT(Args) \ do { \ if (yydebug) \ + { \ yysymprint Args; \ + } \ } while (0) # define YYDSYMPRINTF(Title, Token, Value, Location) \ diff --git a/tdeio/tdeio/yacc.c b/tdeio/tdeio/yacc.c index a4f618769..b845d5cb8 100644 --- a/tdeio/tdeio/yacc.c +++ b/tdeio/tdeio/yacc.c @@ -579,7 +579,9 @@ while (0) # define YYDPRINTF(Args) \ do { \ if (yydebug) \ + { \ YYFPRINTF Args; \ + } \ } while (0) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ diff --git a/tdeioslave/file/file.cpp b/tdeioslave/file/file.cpp index fda72f2d5..b7ac91bfd 100644 --- a/tdeioslave/file/file.cpp +++ b/tdeioslave/file/file.cpp @@ -1446,7 +1446,8 @@ void FileProtocol::mount( bool _ro, const char *_fstype, const TQString& _dev, c buffer.sprintf( "%s %s %s %s 2>%s", mountProg.latin1(), readonly.data(), dev.data(), point.data(), tmp ); else // mount giving device + mountpoint + fstype -#if defined(__svr4__) && defined(__sun__) // MARCO for Solaris 8 and I +#if defined(__svr4__) && defined(__sun__) + // MACRO for Solaris 8 and I // believe this is true for SVR4 in general buffer.sprintf( "%s -F %s %s %s %s 2>%s" mountProg.latin1() diff --git a/tdeprint/fooscanner.cpp b/tdeprint/fooscanner.cpp index 58edc063c..441d411da 100644 --- a/tdeprint/fooscanner.cpp +++ b/tdeprint/fooscanner.cpp @@ -457,10 +457,14 @@ char *yytext; { \ result = tdeprint_foomatic2scanner_device->readBlock( buf, max_size ); \ if ( result < 0 ) \ + { \ result = 0; \ + } \ } \ else \ + { \ result = 0; \ + } \ } TQIODevice* tdeprint_foomatic2scanner_device = NULL; diff --git a/tdeprint/ppdparser.cpp b/tdeprint/ppdparser.cpp index 30df9195d..e54fea840 100644 --- a/tdeprint/ppdparser.cpp +++ b/tdeprint/ppdparser.cpp @@ -578,13 +578,17 @@ while (0) # define YYDPRINTF(Args) \ do { \ if (yydebug) \ + { \ YYFPRINTF Args; \ + } \ } while (0) # define YYDSYMPRINT(Args) \ do { \ if (yydebug) \ + { \ yysymprint Args; \ + } \ } while (0) # define YYDSYMPRINTF(Title, Token, Value, Location) \ diff --git a/tdeprint/ppdscanner.cpp b/tdeprint/ppdscanner.cpp index ebfea8d53..4b37737c0 100644 --- a/tdeprint/ppdscanner.cpp +++ b/tdeprint/ppdscanner.cpp @@ -552,10 +552,14 @@ TQIODevice *tdeprint_ppdscanner_device = NULL; { \ result = tdeprint_ppdscanner_device->readBlock(buf,max_size); \ if (result < 0) \ + { \ result = 0; \ + } \ } \ else \ + { \ result = 0; \ + } \ } int tdeprint_ppdscanner_lno = 0; diff --git a/tdestyles/asteroid/asteroid.cpp b/tdestyles/asteroid/asteroid.cpp index 7119af5a8..305a140c8 100644 --- a/tdestyles/asteroid/asteroid.cpp +++ b/tdestyles/asteroid/asteroid.cpp @@ -46,8 +46,6 @@ #include "asteroid.h" -// #define MINIMUM_PUSHBUTTON_WIDTH 75; -// #define MINIMUM_PUSHBUTTON_HEIGHT 23; #define MINIMUM_PUSHBUTTON_WIDTH 73; #define MINIMUM_PUSHBUTTON_HEIGHT 21; @@ -56,15 +54,6 @@ #define SPINBOX_BUTTON_WIDTH 12 -//#define POPUPMENUITEM_TEXT_ETCH_CONDITIONS ( etchtext && !enabled && !active ) -#define POPUPMENUITEM_TEXT_ETCH_CONDITIONS ( etchtext && !enabled ) - -#define PUSHBUTTON_TEXT_ETCH_CONDITIONS ( etchtext && !enabled ) -#define HEADER_TEXT_ETCH_CONDITIONS ( etchtext && !enabled ) -#define TABBAR_TEXT_ETCH_CONDITIONS ( etchtext && !enabled ) -#define CHECKBOX_TEXT_ETCH_CONDITIONS ( etchtext && !enabled ) -#define RADIOBUTTON_TEXT_ETCH_CONDITIONS ( etchtext && !enabled ) - /* Hackery to make metasources work */ #include "asteroid.moc" @@ -1138,7 +1127,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, tr.setWidth(tr.width()+4); // Compensate for text appearing too far to the left // TQRect tr_offset = TQRect(tr.x()+ETCH_X_OFFSET, tr.y()+ETCH_Y_OFFSET, tr.width(), tr.height()); TQRect tr_offset = TQRect(tr.x()+0, tr.y()+0, tr.width(), tr.height()); - if TABBAR_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); TQColorGroup etchedcg = cg; @@ -1185,7 +1174,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, //TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); TQRect r_offset = TQRect(r.x()+0, r.y()+0, r.width(), r.height()); - if CHECKBOX_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); TQColorGroup etchedcg = cg; @@ -1234,7 +1223,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, // TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); TQRect r_offset = TQRect(r.x()+0, r.y()+0, r.width(), r.height()); - if RADIOBUTTON_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); TQColorGroup etchedcg = cg; @@ -1417,9 +1406,9 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } } - p->setPen( POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():cg.foreground() ); + p->setPen( ( etchtext && !enabled )?cg.dark():cg.foreground() ); TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); - if POPUPMENUITEM_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); p->drawText(r_offset, text_flags, o.menuItem()->text()); @@ -1473,13 +1462,13 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } if (!pb->text().isNull()) { - p->setPen(POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():(enabled ? cg.buttonText() : pb->palette().disabled().buttonText())); + p->setPen(( etchtext && !enabled )?cg.dark():(enabled ? cg.buttonText() : pb->palette().disabled().buttonText())); if (pb->iconSet() && !pb->iconSet()->isNull()) { TQRect tpr(dx, r.y(), r.width()-dx, r.height()); TQRect tr(p->boundingRect(tpr, text_flags, pb->text())); TQRect tr_offset = TQRect(tr.x()+ETCH_X_OFFSET, tr.y()+ETCH_Y_OFFSET, tr.width(), tr.height()); - if PUSHBUTTON_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); p->drawText(tr_offset, text_flags, pb->text()); @@ -1488,7 +1477,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, p->drawText(tr, text_flags, pb->text()); } else { TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); - if PUSHBUTTON_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); p->drawText(r_offset, text_flags, pb->text()); @@ -1515,7 +1504,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, p->drawPixmap(pr.topLeft(), pm); pr = TQRect(pr.width(), r.top(), r.width() - pr.width(), r.height()); TQRect pr_offset = TQRect(pr.x()+ETCH_X_OFFSET, pr.y()+ETCH_Y_OFFSET, pr.width(), pr.height()); - if HEADER_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { p->setPen( cg.dark()) ; TQPen savePen = p->pen(); p->setPen( cg.light() ); @@ -1524,9 +1513,9 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, } p->drawText(pr, text_flags, ceData.textLabel); } else { - p->setPen( POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():cg.buttonText() ); + p->setPen( ( etchtext && !enabled )?cg.dark():cg.buttonText() ); TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height()); - if HEADER_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); p->drawText(r_offset, text_flags, ceData.textLabel); @@ -1611,8 +1600,8 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, if (mi->custom()) { int m = itemVMargin; - p->setPen( POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():cg.foreground() ); - if POPUPMENUITEM_TEXT_ETCH_CONDITIONS { + p->setPen( ( etchtext && !enabled )?cg.dark():cg.foreground() ); + if ( etchtext && !enabled ) { TQPen savePen = p->pen(); p->setPen( cg.light() ); TQColorGroup etchedcg = cg; @@ -1656,7 +1645,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, rr_offset = visualRect(rr_offset, r); } - if POPUPMENUITEM_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { p->setPen(cg.dark()); TQPen savePen = p->pen(); p->setPen( cg.light() ); @@ -1675,7 +1664,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce, text_flags |= AlignRight; } - if POPUPMENUITEM_TEXT_ETCH_CONDITIONS { + if ( etchtext && !enabled ) { p->setPen(cg.dark()); TQPen savePen = p->pen(); p->setPen( cg.light() ); diff --git a/tdeutils/tdecmodulecontainer.h b/tdeutils/tdecmodulecontainer.h index 6d6717370..31961ab7f 100644 --- a/tdeutils/tdecmodulecontainer.h +++ b/tdeutils/tdecmodulecontainer.h @@ -203,8 +203,12 @@ extern "C" \ { \ TQStringList modList = TQStringList::split( ",", TQString(modules).remove( " " )); \ for ( TQStringList::Iterator it = modList.begin(); it != modList.end(); ++it ) \ + { \ if ( TDECModuleLoader::testModule( *it ) ) \ + { \ return true; \ + } \ + } \ return false; \ } \ } diff --git a/win/win32_utils2.cpp b/win/win32_utils2.cpp index 2e46d2acb..946d62e5a 100644 --- a/win/win32_utils2.cpp +++ b/win/win32_utils2.cpp @@ -26,51 +26,62 @@ #include #include -KDEWIN32_EXPORT -TQString getWin32RegistryValue(HKEY key, const TQString& subKey, const TQString& item, bool *ok) -{ -#define FAILURE \ - { if (ok) \ - *ok = false; \ - return TQString::null; } +#define FAILURE \ + { \ + if (ok) \ + { \ + *ok = false; \ + } \ + return TQString::null; \ + } +KDEWIN32_EXPORT +TQString getWin32RegistryValue(HKEY key, const TQString &subKey, const TQString &item, bool *ok) +{ if (!subKey) + { FAILURE; + } HKEY hKey; TCHAR *lszValue; - DWORD dwType=REG_SZ; + DWORD dwType = REG_SZ; DWORD dwSize; - if (ERROR_SUCCESS!=RegOpenKeyEx(key, subKey.ucs2(), NULL, KEY_READ, &hKey)) + if (ERROR_SUCCESS != RegOpenKeyEx(key, subKey.ucs2(), NULL, KEY_READ, &hKey)) + { FAILURE; + } - if (ERROR_SUCCESS!=RegQueryValueEx(hKey, item.ucs2(), NULL, NULL, NULL, &dwSize)) + if (ERROR_SUCCESS != RegQueryValueEx(hKey, item.ucs2(), NULL, NULL, NULL, &dwSize)) + { FAILURE; + } lszValue = new TCHAR[dwSize]; - if (ERROR_SUCCESS!=RegQueryValueEx(hKey, item.ucs2(), NULL, &dwType, (LPBYTE)lszValue, &dwSize)) { - delete [] lszValue; + if (ERROR_SUCCESS != RegQueryValueEx(hKey, item.ucs2(), NULL, &dwType, (LPBYTE)lszValue, &dwSize)) + { + delete[] lszValue; FAILURE; } RegCloseKey(hKey); TQString res = TQString::fromUcs2(lszValue); - delete [] lszValue; + delete[] lszValue; return res; } KDEWIN32_EXPORT -bool showWin32FilePropertyDialog(const TQString& fileName) +bool showWin32FilePropertyDialog(const TQString &fileName) { TQString path_ = TQDir::convertSeparators(TQFileInfo(fileName).absFilePath()); SHELLEXECUTEINFO execInfo; - memset(&execInfo,0,sizeof(execInfo)); + memset(&execInfo, 0, sizeof(execInfo)); execInfo.cbSize = sizeof(execInfo); - execInfo.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; + execInfo.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; const TQString verb("properties"); - execInfo.lpVerb = (TCHAR*)verb.ucs2(); - execInfo.lpFile = (TCHAR*)path_.ucs2(); + execInfo.lpVerb = (TCHAR *)verb.ucs2(); + execInfo.lpFile = (TCHAR *)path_.ucs2(); return ShellExecuteEx(&execInfo); } @@ -78,77 +89,98 @@ KDEWIN32_EXPORT TQCString getWin32LocaleName() { bool ok; - TQString localeNumber = getWin32RegistryValue(HKEY_CURRENT_USER, "Control Panel\\International", - "Locale", &ok); + TQString localeNumber = getWin32RegistryValue(HKEY_CURRENT_USER, "Control Panel\\International", + "Locale", &ok); if (!ok) + { return TQCString(); - TQString localeName = getWin32RegistryValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout\\DosKeybCodes", - localeNumber, &ok); + } + TQString localeName = getWin32RegistryValue(HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout\\DosKeybCodes", localeNumber, + &ok); if (!ok) + { return TQCString(); + } return localeName.latin1(); } KDEWIN32_EXPORT -TQString convertKFileDialogFilterToQFileDialogFilter(const TQString& filter) +TQString convertKFileDialogFilterToQFileDialogFilter(const TQString &filter) { TQString kde_filters = filter; int pos; // Strip the escape characters from // escaped '/' characters. - TQString copy (kde_filters); + TQString copy(kde_filters); for (pos = 0; (pos = copy.find("\\/", pos)) != -1; ++pos) + { copy.remove(pos, 1); + } // //we need to convert KDE filter format to Qt format //Qt format: "some text (*.first *.second)" or "All (*)" //KDE format: "*.first *.second" or "*" - TQStringList filters = TQStringList::split("\n",kde_filters); + TQStringList filters = TQStringList::split("\n", kde_filters); TQString current; TQString converted; //finally - converted filter - for (TQStringList::ConstIterator it = filters.constBegin(); it!=filters.constEnd();++it) { + for (TQStringList::ConstIterator it = filters.constBegin(); it != filters.constEnd(); ++it) + { current = *it; - TQString new_f;//filter part - TQString new_name;//filter name part + TQString new_f; //filter part + TQString new_name; //filter name part int p = (*it).find('|'); - if (p!=-1) { - new_f = current.left(p); - new_name = current.mid(p+1); + if (p != -1) + { + new_f = current.left(p); + new_name = current.mid(p + 1); } - else { - new_f = current; + else + { + new_f = current; new_name = current; //nothing better } //remove (.....) from name - p=new_name.find('('); + p = new_name.find('('); int p2 = new_name.findRev(')'); TQString new_name1, new_name2; - if (p!=-1) + if (p != -1) + { new_name1 = new_name.left(p); - if (p2!=-1) - new_name2 = new_name.mid(p2+1); + } + if (p2 != -1) + { + new_name2 = new_name.mid(p2 + 1); + } if (!new_name1.isEmpty() || !new_name2.isEmpty()) + { new_name = new_name1.stripWhiteSpace() + " " + new_name2.stripWhiteSpace(); - new_name.replace('(',""); - new_name.replace(')',""); + } + new_name.replace('(', ""); + new_name.replace(')', ""); new_name = new_name.stripWhiteSpace(); // make filters unique: remove uppercase extensions (case doesn't matter on win32, BTW) TQStringList allfiltersUnique; - TQStringList origList( TQStringList::split(" ", new_f) ); + TQStringList origList(TQStringList::split(" ", new_f)); for (TQStringList::ConstIterator it = origList.constBegin(); - it!=origList.constEnd(); ++it) + it != origList.constEnd(); ++it) { if ((*it) == (*it).lower()) + { allfiltersUnique += *it; + } } if (!converted.isEmpty()) + { converted += ";;"; + } converted += (new_name + " (" + allfiltersUnique.join(" ") + ")"); } return converted; } +