From 8155225c9be993acc0512956416d195edfef4eb9 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 19 Jan 2011 01:42:14 +0000 Subject: Enable compilation with TQt for Qt4 3.4.0 TP2 This should not break compatibility with TQt for Qt3; if it does please fix it ASAP! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1215552 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kioslave/man/kio_man.cpp | 84 +++++++++++++++++++++++------------------------ kioslave/man/kmanpart.cpp | 4 +-- kioslave/man/kmanpart.h | 2 +- kioslave/man/man2html.cpp | 73 ++++++++++++++++++++-------------------- 4 files changed, 82 insertions(+), 81 deletions(-) (limited to 'kioslave/man') diff --git a/kioslave/man/kio_man.cpp b/kioslave/man/kio_man.cpp index 013a15248..2bce71229 100644 --- a/kioslave/man/kio_man.cpp +++ b/kioslave/man/kio_man.cpp @@ -60,17 +60,17 @@ void stripExtension( TQString *name ) { int pos = name->length(); - if ( name->find(".gz", -3) != -1 ) + if ( name->tqfind(".gz", -3) != -1 ) pos -= 3; - else if ( name->find(".z", -2, false) != -1 ) + else if ( name->tqfind(".z", -2, false) != -1 ) pos -= 2; - else if ( name->find(".bz2", -4) != -1 ) + else if ( name->tqfind(".bz2", -4) != -1 ) pos -= 4; - else if ( name->find(".bz", -3) != -1 ) + else if ( name->tqfind(".bz", -3) != -1 ) pos -= 3; if ( pos > 0 ) - pos = name->findRev('.', pos-1); + pos = name->tqfindRev('.', pos-1); if ( pos > 0 ) name->truncate( pos ); @@ -98,7 +98,7 @@ bool parseUrl(const TQString& _url, TQString &title, TQString §ion) title = url; - int pos = url.find('('); + int pos = url.tqfind('('); if (pos < 0) return true; @@ -144,7 +144,7 @@ void MANProtocol::parseWhatIs( TQMap &i, TQTextStream &t, co { TQString names = l.left(pos); TQString descr = l.mid(pos + re.matchedLength()); - while ((pos = names.find(",")) != -1) + while ((pos = names.tqfind(",")) != -1) { i[names.left(pos++)] = descr; while (names[pos] == ' ') @@ -172,9 +172,9 @@ TQMap MANProtocol::buildIndexMap(const TQString §ion) TQStringList man_dirs = manDirectories(); // Supplementary places for whatis databases man_dirs += m_mandbpath; - if (man_dirs.find("/var/cache/man")==man_dirs.end()) + if (man_dirs.tqfind("/var/cache/man")==man_dirs.end()) man_dirs << "/var/cache/man"; - if (man_dirs.find("/var/catman")==man_dirs.end()) + if (man_dirs.tqfind("/var/catman")==man_dirs.end()) man_dirs << "/var/catman"; TQStringList names; @@ -238,14 +238,14 @@ TQStringList MANProtocol::manDirectories() && S_ISDIR( sbuf.st_mode ) ) { const TQString p = TQDir(dir).canonicalPath(); - if (!man_dirs.contains(p)) man_dirs += p; + if (!man_dirs.tqcontains(p)) man_dirs += p; } } } // Untranslated pages in "" const TQString p = TQDir(*it_dir).canonicalPath(); - if (!man_dirs.contains(p)) man_dirs += p; + if (!man_dirs.tqcontains(p)) man_dirs += p; } return man_dirs; } @@ -331,7 +331,7 @@ TQStringList MANProtocol::findPages(const TQString &_section, if (sect.lower()==it_real) it_real = sect; // Only add sect if not already contained, avoid duplicates - if (!sect_list.contains(sect) && _section.isEmpty()) { + if (!sect_list.tqcontains(sect) && _section.isEmpty()) { kdDebug() << "another section " << sect << endl; sect_list += sect; } @@ -425,11 +425,11 @@ static TQString text2html(const TQString& txt) { TQString reply = txt; - reply = reply.replace('&', "&"); - reply = reply.replace('<', "<"); - reply = reply.replace('>', ">"); - reply = reply.replace('"', "&dquot;"); - reply = reply.replace('\'', """); + reply = reply.tqreplace('&', "&"); + reply = reply.tqreplace('<', "<"); + reply = reply.tqreplace('>', ">"); + reply = reply.tqreplace('"', "&dquot;"); + reply = reply.tqreplace('\'', """); return reply; } @@ -534,7 +534,7 @@ char *MANProtocol::readManPage(const char *_filename) * If the path name constains the string sman, assume that it's SGML and * convert it to roff format (used on Solaris). */ //TQString file_mimetype = KMimeType::findByPath(TQString(filename), 0, false)->name(); - if (filename.contains("sman", false)) //file_mimetype == "text/html" || ) + if (filename.tqcontains("sman", false)) //file_mimetype == "text/html" || ) { myStdStream =TQString::null; KProcess proc; @@ -560,14 +560,14 @@ char *MANProtocol::readManPage(const char *_filename) kdDebug(7107) << "relative " << filename << endl; filename = TQDir::cleanDirPath(lastdir + "/" + filename).utf8(); if (!KStandardDirs::exists(filename)) { // exists perhaps with suffix - lastdir = filename.left(filename.findRev('/')); + lastdir = filename.left(filename.tqfindRev('/')); TQDir mandir(lastdir); - mandir.setNameFilter(filename.mid(filename.findRev('/') + 1) + ".*"); + mandir.setNameFilter(filename.mid(filename.tqfindRev('/') + 1) + ".*"); filename = lastdir + "/" + TQFile::encodeName(mandir.entryList().first()); } kdDebug(7107) << "resolved to " << filename << endl; } - lastdir = filename.left(filename.findRev('/')); + lastdir = filename.left(filename.tqfindRev('/')); myStdStream = TQString::null; KProcess proc; @@ -883,7 +883,7 @@ void MANProtocol::constructPath(TQStringList& constr_path, TQStringList constr_c } } /* sections are not used - else if ( section_regex.find(line, 0) == 0 ) + else if ( section_regex.tqfind(line, 0) == 0 ) { if ( !conf_section.isEmpty() ) conf_section += ':'; @@ -920,7 +920,7 @@ void MANProtocol::constructPath(TQStringList& constr_path, TQStringList constr_c int i = 0; while (manpaths[i]) { - if ( constr_path.findIndex( TQString( manpaths[i] ) ) == -1 ) + if ( constr_path.tqfindIndex( TQString( manpaths[i] ) ) == -1 ) constr_path += TQString( manpaths[i] ); i++; } @@ -944,35 +944,35 @@ void MANProtocol::constructPath(TQStringList& constr_path, TQStringList constr_c if ( !mandir.isEmpty() ) { // a path mapping exists - if ( constr_path.findIndex( mandir ) == -1 ) + if ( constr_path.tqfindIndex( mandir ) == -1 ) constr_path += mandir; } else { // no manpath mapping, use "/man" and "/../man" mandir = dir + TQString( "/man" ); - if ( constr_path.findIndex( mandir ) == -1 ) + if ( constr_path.tqfindIndex( mandir ) == -1 ) constr_path += mandir; - int pos = dir.findRev( '/' ); + int pos = dir.tqfindRev( '/' ); if ( pos > 0 ) { mandir = dir.left( pos ) + TQString("/man"); - if ( constr_path.findIndex( mandir ) == -1 ) + if ( constr_path.tqfindIndex( mandir ) == -1 ) constr_path += mandir; } } TQString catmandir = mandb_map[ mandir ]; if ( !mandir.isEmpty() ) { - if ( constr_catmanpath.findIndex( catmandir ) == -1 ) + if ( constr_catmanpath.tqfindIndex( catmandir ) == -1 ) constr_catmanpath += catmandir; } else { // What is the default mapping? catmandir = mandir; - catmandir.replace("/usr/share/","/var/cache/"); - if ( constr_catmanpath.findIndex( catmandir ) == -1 ) + catmandir.tqreplace("/usr/share/","/var/cache/"); + if ( constr_catmanpath.tqfindIndex( catmandir ) == -1 ) constr_catmanpath += catmandir; } } @@ -1001,7 +1001,7 @@ void MANProtocol::checkManPaths() if ( manpath_env.isEmpty() || manpath_env[0] == ':' || manpath_env[manpath_env.length()-1] == ':' - || manpath_env.contains( "::" ) ) + || manpath_env.tqcontains( "::" ) ) { construct_path = true; // need to read config file } @@ -1041,7 +1041,7 @@ void MANProtocol::checkManPaths() if ( !dir.isEmpty() ) { // Add dir to the man path if it exists - if ( m_manpath.findIndex( dir ) == -1 ) { + if ( m_manpath.tqfindIndex( dir ) == -1 ) { if ( ::stat( TQFile::encodeName( dir ), &sbuf ) == 0 && S_ISDIR( sbuf.st_mode ) ) { @@ -1060,7 +1060,7 @@ void MANProtocol::checkManPaths() dir = (*it2); if ( !dir.isEmpty() ) { - if ( m_manpath.findIndex( dir ) == -1 ) { + if ( m_manpath.tqfindIndex( dir ) == -1 ) { if ( ::stat( TQFile::encodeName( dir ), &sbuf ) == 0 && S_ISDIR( sbuf.st_mode ) ) { @@ -1080,7 +1080,7 @@ void MANProtocol::checkManPaths() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "n", 0L }; for ( int i = 0; default_sect[i] != 0L; i++ ) - if ( m_mansect.findIndex( TQString( default_sect[i] ) ) == -1 ) + if ( m_mansect.tqfindIndex( TQString( default_sect[i] ) ) == -1 ) m_mansect += TQString( default_sect[i] ); */ @@ -1239,7 +1239,7 @@ void MANProtocol::showIndex(const TQString& section) stripExtension( &fileName ); - pos = fileName.findRev('/'); + pos = fileName.tqfindRev('/'); if (pos > 0) fileName = fileName.mid(pos+1); @@ -1253,7 +1253,7 @@ void MANProtocol::showIndex(const TQString& section) { os << "\n" << it.key() << "  " - << (indexmap.contains(it.key()) ? indexmap[it.key()] : "" ) + << (indexmap.tqcontains(it.key()) ? indexmap[it.key()] : "" ) << "" << endl; } @@ -1384,12 +1384,12 @@ void MANProtocol::showIndex(const TQString& section) { struct man_index_t *manindex = indexlist[i]; - // qstrncmp(): + // tqstrncmp(): // "last_man" has already a \0 string ending, but // "manindex->manpage_begin" has not, // so do compare at most "manindex->manpage_len" of the strings. if (last_index->manpage_len == manindex->manpage_len && - !qstrncmp(last_index->manpage_begin, + !tqstrncmp(last_index->manpage_begin, manindex->manpage_begin, manindex->manpage_len) ) @@ -1415,7 +1415,7 @@ void MANProtocol::showIndex(const TQString& section) ((char *)manindex->manpage_begin)[manindex->manpage_len] = '\0'; os << manindex->manpage_begin << "  " - << (indexmap.contains(manindex->manpage_begin) ? indexmap[manindex->manpage_begin] : "" ) + << (indexmap.tqcontains(manindex->manpage_begin) ? indexmap[manindex->manpage_begin] : "" ) << "" << endl; last_index = manindex; } @@ -1438,12 +1438,12 @@ void MANProtocol::showIndex(const TQString& section) { struct man_index_t *manindex = mit.current(); - // qstrncmp(): + // tqstrncmp(): // "last_man" has already a \0 string ending, but // "manindex->manpage_begin" has not, // so do compare at most "manindex->manpage_len" of the strings. if (last_index->manpage_len == manindex->manpage_len && - !qstrncmp(last_index->manpage_begin, + !tqstrncmp(last_index->manpage_begin, manindex->manpage_begin, manindex->manpage_len) ) @@ -1457,7 +1457,7 @@ void MANProtocol::showIndex(const TQString& section) manindex->manpage_begin[manindex->manpage_len] = '\0'; os << manindex->manpage_begin << "  " - << (indexmap.contains(manindex->manpage_begin) ? indexmap[manindex->manpage_begin] : "" ) + << (indexmap.tqcontains(manindex->manpage_begin) ? indexmap[manindex->manpage_begin] : "" ) << "" << endl; last_index = manindex; } diff --git a/kioslave/man/kmanpart.cpp b/kioslave/man/kmanpart.cpp index b52085596..e48754a55 100644 --- a/kioslave/man/kmanpart.cpp +++ b/kioslave/man/kmanpart.cpp @@ -50,10 +50,10 @@ KManPartFactory::~KManPartFactory() delete s_about; } -KParts::Part* KManPartFactory::createPartObject( TQWidget * parentWidget, const char* /*widgetName*/, TQObject *, +KParts::Part* KManPartFactory::createPartObject( TQWidget * tqparentWidget, const char* /*widgetName*/, TQObject *, const char* name, const char* /*className*/,const TQStringList & ) { - KManPart* part = new KManPart(parentWidget, name ); + KManPart* part = new KManPart(tqparentWidget, name ); return part; } diff --git a/kioslave/man/kmanpart.h b/kioslave/man/kmanpart.h index f2d9e3891..92d51e18b 100644 --- a/kioslave/man/kmanpart.h +++ b/kioslave/man/kmanpart.h @@ -44,7 +44,7 @@ class KManPartFactory: public KParts::Factory KManPartFactory( TQObject * parent = 0, const char * name = 0 ); virtual ~KManPartFactory(); - virtual KParts::Part* createPartObject( TQWidget * parentWidget, const char * widgetName , + virtual KParts::Part* createPartObject( TQWidget * tqparentWidget, const char * widgetName , TQObject* parent, const char* name, const char * classname, const TQStringList &args); diff --git a/kioslave/man/man2html.cpp b/kioslave/man/man2html.cpp index 089ba239b..e9e0c1f19 100644 --- a/kioslave/man/man2html.cpp +++ b/kioslave/man/man2html.cpp @@ -822,7 +822,7 @@ static void add_links(char *c) e=h+1; sec=f[1]; subsec=f[2]; - int index = fstr.find(')', 2); + int index = fstr.tqfind(')', 2); if (index != -1) subsec = fstr.mid(2, index - 2); else // No closing ')' found, take first character as subsection. @@ -882,7 +882,7 @@ static void add_links(char *c) if (g-7>=c && g[-1]==':') { // We have perhaps an email address starting with mailto: - if (!qstrncmp("mailto:",g-7,7)) + if (!tqstrncmp("mailto:",g-7,7)) g-=7; } h=f+1; @@ -1166,7 +1166,7 @@ static TQCString scan_named_character( char*& c ) { TQCString cstr; c = scan_escape_direct( c+1, cstr ); - const int result = cstr.find(']'); + const int result = cstr.tqfind(']'); if ( result == -1 ) name += cstr; else @@ -1198,7 +1198,7 @@ static TQCString scan_named_character( char*& c ) { TQCString cstr; c = scan_escape_direct( c+1, cstr ); - const int result = cstr.find('\''); + const int result = cstr.tqfind('\''); if ( result == -1 ) name += cstr; else @@ -1223,7 +1223,7 @@ static TQCString scan_named_character( char*& c ) // Note: characters with a one character length name doe not exist, as they would collide with other escapes // Now we have the name, let us find it between the string names - TQMap::iterator it=s_characterDefinitionMap.find(name); + TQMap::iterator it=s_characterDefinitionMap.tqfind(name); if (it==s_characterDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find character with name: " << name << endl; @@ -1270,7 +1270,7 @@ static TQCString scan_named_string(char*& c) { TQCString cstr; c = scan_escape_direct( c+1, cstr ); - const int result = cstr.find(']'); + const int result = cstr.tqfind(']'); if ( result == -1 ) name += cstr; else @@ -1299,7 +1299,7 @@ static TQCString scan_named_string(char*& c) c++; } // Now we have the name, let us find it between the string names - TQMap::iterator it=s_stringDefinitionMap.find(name); + TQMap::iterator it=s_stringDefinitionMap.tqfind(name); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string with name: " << name << endl; @@ -1514,7 +1514,7 @@ static int scan_number_register( char*& c) } else { - TQMap< TQCString, NumberDefinition >::iterator it = s_numberDefinitionMap.find( name ); + TQMap< TQCString, NumberDefinition >::iterator it = s_numberDefinitionMap.tqfind( name ); if ( it == s_numberDefinitionMap.end() ) { return 0; // Undefined variable @@ -1560,7 +1560,7 @@ static TQCString scan_named_font( char*& c ) { TQCString cstr; c = scan_escape_direct( c+1, cstr ); - const int result = cstr.find(']'); + const int result = cstr.tqfind(']'); if ( result == -1 ) name += cstr; else @@ -2085,7 +2085,7 @@ static char *scan_table(char *c) /* scan table options */ while (c::iterator it=s_stringDefinitionMap.find(macroName); + TQMap::iterator it=s_stringDefinitionMap.tqfind(macroName); if (it!=s_stringDefinitionMap.end()) { kdDebug(7107) << "CALLING MACRO: " << macroName << endl; @@ -3237,11 +3237,11 @@ static char *scan_request(char *c) while (*c && *c!='\n') c++; c++; h=c; - while (*c && qstrncmp(c,".di",3)) while (*c && *c++!='\n'); + while (*c && tqstrncmp(c,".di",3)) while (*c && *c++!='\n'); *c='\0'; char* result=0; scan_troff(h,0,&result); - TQMap::iterator it=s_stringDefinitionMap.find(name); + TQMap::iterator it=s_stringDefinitionMap.tqfind(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; @@ -3276,7 +3276,7 @@ static char *scan_request(char *c) curpos=0; char* result=0; c=scan_troff(c,1,&result); - TQMap::iterator it=s_stringDefinitionMap.find(name); + TQMap::iterator it=s_stringDefinitionMap.tqfind(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; @@ -3358,7 +3358,7 @@ static char *scan_request(char *c) { char *line=NULL; c=scan_troff(c,1, &line); - if (line && qstrncmp(line, "
", 4)) + if (line && tqstrncmp(line, "
", 4)) { out_html(line); out_html("
\n"); @@ -3489,7 +3489,7 @@ static char *scan_request(char *c) while (*c && *c!='\n') c++,i++; } c++; - while (*c && qstrncmp(c,endwith,i)) while (*c++!='\n'); + while (*c && tqstrncmp(c,endwith,i)) while (*c++!='\n'); while (*c && *c++!='\n'); break; } @@ -4015,7 +4015,7 @@ static char *scan_request(char *c) out_html("\n

"); else out_html("\n

"); - mandoc_synopsis = qstrncmp(c, "SYNOPSIS", 8) == 0; + mandoc_synopsis = tqstrncmp(c, "SYNOPSIS", 8) == 0; c = mandoc_command ? scan_troff_mandoc(c,1,NULL) : scan_troff(c,1,NULL); if (mode) out_html("

\n"); @@ -4064,8 +4064,8 @@ static char *scan_request(char *c) { if (wordlist[i][0] == '\007') wordlist[i]++; - if (wordlist[i][qstrlen(wordlist[i])-1] == '\007') - wordlist[i][qstrlen(wordlist[i])-1] = 0; + if (wordlist[i][tqstrlen(wordlist[i])-1] == '\007') + wordlist[i][tqstrlen(wordlist[i])-1] = 0; } output_possible=true; out_html( DOCTYPE"\n\n"); @@ -4147,7 +4147,7 @@ static char *scan_request(char *c) out_html(set_font("I")); if (words>1) wordlist[1][-1]='\0'; const char *c2=lookup_abbrev(wordlist[0]); - curpos+=qstrlen(c2); + curpos+=tqstrlen(c2); out_html(c2); out_html(set_font("R")); if (words>1) @@ -4181,7 +4181,7 @@ static char *scan_request(char *c) } } c=skip_till_newline(c); - TQMap::iterator it=s_stringDefinitionMap.find(name); + TQMap::iterator it=s_stringDefinitionMap.tqfind(name); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to rename or remove: " << name << endl; @@ -4240,7 +4240,7 @@ static char *scan_request(char *c) c=scan_expression( c, &increment ); } c = skip_till_newline( c ); - TQMap ::iterator it = s_numberDefinitionMap.find( name ); + TQMap ::iterator it = s_numberDefinitionMap.tqfind( name ); if ( it == s_numberDefinitionMap.end() ) { if ( sign < 1 ) @@ -4293,8 +4293,8 @@ static char *scan_request(char *c) } c = next_line; sl=c; - const int length=qstrlen(endmacro); - while (*c && qstrncmp(c,endmacro,length)) + const int length=tqstrlen(endmacro); + while (*c && tqstrncmp(c,endmacro,length)) c=skip_till_newline(c); TQCString macro; @@ -4310,7 +4310,7 @@ static char *scan_request(char *c) sl++; } - TQMap::iterator it=s_stringDefinitionMap.find(name); + TQMap::iterator it=s_stringDefinitionMap.tqfind(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; @@ -4322,7 +4322,8 @@ static char *scan_request(char *c) { // .am Append Macro (*it).m_length=0; // It could be formerly a string - if ((*it).m_output.right(1)!='\n') +// if ((*it).m_output.right(1)!='\n') + if (*((*it).m_output.right(1).data())!='\n') (*it).m_output+='\n'; (*it).m_output+=macro; } @@ -4401,7 +4402,7 @@ static char *scan_request(char *c) case REQ_It: // mdoc(7) "list ITem" { c=c+j; - if (qstrncmp(c, "Xo", 2) == 0 && isspace(*(c+2))) + if (tqstrncmp(c, "Xo", 2) == 0 && isspace(*(c+2))) c = skip_till_newline(c); if (dl_set[itemdepth] & BL_DESC_LIST) { @@ -5090,7 +5091,7 @@ static char *scan_request(char *c) break; } // Second parametr is origin (unlike in .rn) - TQMap::iterator it=s_stringDefinitionMap.find(name2); + TQMap::iterator it=s_stringDefinitionMap.tqfind(name2); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; @@ -5114,7 +5115,7 @@ static char *scan_request(char *c) break; } c = skip_till_newline( c ); - TQMap ::iterator it = s_numberDefinitionMap.find( name ); + TQMap ::iterator it = s_numberDefinitionMap.tqfind( name ); if ( it == s_numberDefinitionMap.end() ) { kdDebug(7107) << "EXCEPTION: trying to remove inexistant number register: " << endl; @@ -5144,7 +5145,7 @@ static char *scan_request(char *c) break; } c = skip_till_newline( c ); - TQMap::iterator it=s_numberDefinitionMap.find(name); + TQMap::iterator it=s_numberDefinitionMap.tqfind(name); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find number register to rename: " << name << endl; @@ -5188,7 +5189,7 @@ static char *scan_request(char *c) break; } // Second parametr is origin (unlike in .rnn) - TQMap::iterator it=s_numberDefinitionMap.find(name2); + TQMap::iterator it=s_numberDefinitionMap.tqfind(name2); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; @@ -5303,7 +5304,7 @@ static char *scan_troff(char *c, bool san, char **result) if (result) { if (*result) { buffer=*result; - buffpos=qstrlen(buffer); + buffpos=tqstrlen(buffer); buffmax=buffpos; } else { buffer = stralloc(LARGE_STR_MAX); @@ -5528,7 +5529,7 @@ void scan_man_page(const char *man_page) s_dollarZero = ""; // No macro called yet! output_possible = false; - int strLength = qstrlen(man_page); + int strLength = tqstrlen(man_page); char *buf = new char[strLength + 2]; qstrcpy(buf+1, man_page); buf[0] = '\n'; -- cgit v1.2.1