Fixed some uncrustify's code formatting offending files.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/114/head
Michele Calgaro 4 years ago
parent 5cb3ed2e54
commit 491e1c72c7
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -37,8 +37,6 @@ typedef unsigned long CARD32;
#endif
typedef unsigned short CARD16;
typedef unsigned char CARD8;
#define B32 :32
#define B16 :16
#include <unistd.h>
#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) */

@ -52,18 +52,13 @@ extern "C" {
#include <KDE-ICE/ICEmsg.h>
#include <KDE-ICE/ICEproto.h>
#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};

@ -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) \

@ -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<KService> 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<KService> *items)
}
else if (domElem.tagName() == "Not")
{
FOR_ALL_APPLICATIONS(it)
for (appsInfo *info = m_appsInfoStack.first(); info; info = m_appsInfoStack.next())
{
for (TQDictIterator<KService> it( info->applications ); it.current(); ++it )
{
KService *s = it.current();
items->replace(s->menuId(), s);
}
FOR_ALL_APPLICATIONS_END
}
TQDict<KService> notItems;
TQDomNode n = domElem.firstChild();
@ -955,21 +938,29 @@ VFolderMenu::processCondition(TQDomElement &domElem, TQDict<KService> *items)
}
else if (domElem.tagName() == "Category")
{
FOR_CATEGORY(domElem.text(), it)
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);
}
FOR_CATEGORY_END
}
}
}
else if (domElem.tagName() == "All")
{
FOR_ALL_APPLICATIONS(it)
for (appsInfo *info = m_appsInfoStack.first(); info; info = m_appsInfoStack.next())
{
for (TQDictIterator<KService> it( info->applications ); it.current(); ++it )
{
KService *s = it.current();
items->replace(s->menuId(), s);
}
FOR_ALL_APPLICATIONS_END
}
}
else if (domElem.tagName() == "Filename")
{

@ -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}{*/

@ -1340,7 +1340,9 @@ while (0)
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
{ \
YYFPRINTF Args; \
} \
} while (0)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \

@ -361,11 +361,12 @@ Number::Number(int i)
Number::Number(unsigned int u)
: Value(SimpleNumber::fits(u) ? SimpleNumber::make(u) : new NumberImp(static_cast<double>(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

@ -2378,21 +2378,17 @@ int KURL::uriMode() const
KURL::URIMode KURL::uriModeForProtocol(const TQString& protocol)
{
#ifndef KDE_QT_ONLY
KURL::URIMode mode = Auto;
#ifndef KDE_QT_ONLY
if (protocol == fileProt)
return URL;
if (TDEGlobal::_instance)
mode = KProtocolInfo::uriParseMode(protocol);
if (mode == Auto ) {
#else
KURL::URIMode mode = Auto;
#endif
if (mode == Auto ) {
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;
}

@ -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

@ -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) \

@ -579,7 +579,9 @@ while (0)
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
{ \
YYFPRINTF Args; \
} \
} while (0)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \

@ -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()

@ -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;

@ -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) \

@ -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;

@ -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() );

@ -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; \
} \
}

@ -26,51 +26,62 @@
#include <shellapi.h>
#include <tchar.h>
KDEWIN32_EXPORT
TQString getWin32RegistryValue(HKEY key, const TQString& subKey, const TQString& item, bool *ok)
{
#define FAILURE \
{ if (ok) \
{ \
if (ok) \
{ \
*ok = false; \
return TQString::null; }
} \
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;
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);
}
@ -81,74 +92,95 @@ TQCString getWin32LocaleName()
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);
}
//<js>
//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) {
if (p != -1)
{
new_f = current.left(p);
new_name = current.mid(p+1);
new_name = current.mid(p + 1);
}
else {
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;
}

Loading…
Cancel
Save