diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
commit | 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch) | |
tree | 073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /ksirc/chanparser.cpp | |
parent | 3467e6464beac3a162839bf7078e22e3a74d73e7 (diff) | |
download | tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip |
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/chanparser.cpp')
-rw-r--r-- | ksirc/chanparser.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/ksirc/chanparser.cpp b/ksirc/chanparser.cpp index f3015019..9c65c3bb 100644 --- a/ksirc/chanparser.cpp +++ b/ksirc/chanparser.cpp @@ -38,7 +38,7 @@ ChannelParser::ChannelParser(KSircTopLevel *_top) if(parserTable.isEmpty() == TRUE){ parserTable.setAutoDelete(TRUE); parserTable.insert("`l`", new parseFunc(&ChannelParser::parseSSFEClear)); - parserTable.insert("`s`", new parseFunc(&ChannelParser::parseSSFEStatus)); + parserTable.insert("`s`", new parseFunc(&ChannelParser::parseSSFEtqStatus)); parserTable.insert("`i`", new parseFunc(&ChannelParser::parseSSFEInit)); parserTable.insert("`t`", new parseFunc(&ChannelParser::parseSSFEMsg)); parserTable.insert("`o`", new parseFunc(&ChannelParser::parseSSFEOut)); @@ -66,7 +66,7 @@ ChannelParser::ChannelParser(KSircTopLevel *_top) parseResult *ChannelParser::parse(TQString string) { - // for older Qts + // for older TQts parseFunc *pf; if(string.length() < 3){ @@ -118,12 +118,12 @@ parseResult * ChannelParser::parseSSFEClear(TQString string) { // top->mainw->clear(); top->clearWindow(); -// top->mainw->repaint(TRUE); +// top->mainw->tqrepaint(TRUE); string.truncate(0); - return new parseSucc(TQString::null); // Null string, don't display anything + return new parseSucc(TQString()); // Null string, don't display anything } -parseResult * ChannelParser::parseSSFEStatus(TQString string) +parseResult * ChannelParser::parseSSFEtqStatus(TQString string) { string.remove(0, 12); // strip off the first 12 characters "<junk> [sirc] " if(string.length() == 0) @@ -143,12 +143,12 @@ parseResult * ChannelParser::parseSSFEStatus(TQString string) /* * fix up modes which may have gotten the (away) part */ - if(modes.contains("away")){ + if(modes.tqcontains("away")){ modes = ""; } bool away = false; - if(string.contains("(away)")) + if(string.tqcontains("(away)")) away = true; if(away){ @@ -159,39 +159,39 @@ parseResult * ChannelParser::parseSSFEStatus(TQString string) if ( nickItem ) { if(nickItem->away() != away){ nickItem->setAway( away ); - top->nicks->viewport()->repaint( top->nicks->itemRect( nickItem ), false ); + top->nicks->viewport()->tqrepaint( top->nicks->tqitemRect( nickItem ), false ); } nickItem->forceColour(&ksopts->ownNickColor); } top->ksircProcess()->setNick(nick); - if (chanmode.findRev("t") != -1) + if (chanmode.tqfindRev("t") != -1) top->channelButtons->setProtectMode(true); else top->channelButtons->setProtectMode(false); - if (chanmode.findRev("m") != -1) + if (chanmode.tqfindRev("m") != -1) top->channelButtons->setModerateMode(true); else top->channelButtons->setModerateMode(false); - if (chanmode.findRev("n") != -1) + if (chanmode.tqfindRev("n") != -1) top->channelButtons->setNooutsideMode(true); else top->channelButtons->setNooutsideMode(false); - if (chanmode.findRev("i") != -1) + if (chanmode.tqfindRev("i") != -1) top->channelButtons->setMenuItemMode(0, true); else top->channelButtons->setMenuItemMode(0, false); - if (chanmode.findRev("s") != -1) + if (chanmode.tqfindRev("s") != -1) top->channelButtons->setMenuItemMode(3, true); else top->channelButtons->setMenuItemMode(3, false); - if (modes.findRev("i") != -1) + if (modes.tqfindRev("i") != -1) top->channelButtons->setMenuItemMode(4, true); else top->channelButtons->setMenuItemMode(4, false); - if (modes.findRev("w") != -1) + if (modes.tqfindRev("w") != -1) top->channelButtons->setMenuItemMode(5, true); else top->channelButtons->setMenuItemMode(5, false); - if (modes.findRev("s") != -1) + if (modes.tqfindRev("s") != -1) top->channelButtons->setMenuItemMode(6, true); else top->channelButtons->setMenuItemMode(6, false); - TQString status_line = TQString("%1 (%2) %3 (%4) ").arg(chan).arg(chanmode).arg(nick).arg(modes); + TQString status_line = TQString("%1 (%2) %3 (%4) ").tqarg(chan).tqarg(chanmode).tqarg(nick).tqarg(modes); /* * Go srearching for key and limit messages @@ -199,7 +199,7 @@ parseResult * ChannelParser::parseSSFEStatus(TQString string) TQRegExp rxKey("<key: (\\S+)>"); if(rxKey.search(string) >= 0){ top->channelButtons->setMenuItemMode(2, true); - status_line += TQString("<key: %1>").arg(rxKey.cap(1)); + status_line += TQString("<key: %1>").tqarg(rxKey.cap(1)); } else { top->channelButtons->setMenuItemMode(2, false); @@ -208,7 +208,7 @@ parseResult * ChannelParser::parseSSFEStatus(TQString string) TQRegExp rxLimit("<limit: (\\S+)>"); if(rxLimit.search(string) >= 0){ top->channelButtons->setMenuItemMode(1, true); - status_line += TQString("<limit: %1>").arg(rxLimit.cap(1)); + status_line += TQString("<limit: %1>").tqarg(rxLimit.cap(1)); } else { top->channelButtons->setMenuItemMode(1, false); @@ -241,30 +241,30 @@ parseResult * ChannelParser::parseSSFEStatus(TQString string) top->caption = status_line; // Make copy so we're not // constantly changing the title bar } - return new parseSucc(TQString::null); // Null string, don't display anything + return new parseSucc(TQString()); // Null string, don't display anything } parseResult * ChannelParser::parseSSFEInit(TQString) { - return new parseSucc(TQString::null); // Null string, don't display anything + return new parseSucc(TQString()); // Null string, don't display anything } parseResult * ChannelParser::parseSSFEOut(TQString) { - return new parseSucc(TQString::null); // Null string, don't display anything + return new parseSucc(TQString()); // Null string, don't display anything } parseResult * ChannelParser::parseSSFEMsg(TQString string) { if(string.length() > 100) - return new parseError(TQString::null, i18n("String length for nick is greater than 100 characters. This is unacceptably long.")); + return new parseError(TQString(), i18n("String length for nick is greater than 100 characters. This is unacceptably long.")); int l = string.length(); if (l <= 0) return new parseError(string, i18n("String not long enough")); - return new parseSucc(TQString::null); // Null string, don't display anything + return new parseSucc(TQString()); // Null string, don't display anything } @@ -300,7 +300,7 @@ parseResult * ChannelParser::parseSSFEPrompt(TQString string) } if(last[0] == '['){ /* strip time stamp */ - prompt = last.mid(last.find(' ')); + prompt = last.mid(last.tqfind(' ')); } else { prompt = last; @@ -319,7 +319,7 @@ parseResult * ChannelParser::parseSSFEPrompt(TQString string) prompt_active = FALSE; } - return new parseSucc(TQString::null); // Null string, don't display anything + return new parseSucc(TQString()); // Null string, don't display anything } parseResult * ChannelParser::parseSSFEReconnect(TQString) @@ -331,7 +331,7 @@ parseResult * ChannelParser::parseSSFEReconnect(TQString) emit top->outputUnicodeLine(str); } - return new parseSucc(TQString::null); // Null string, don't display anything + return new parseSucc(TQString()); // Null string, don't display anything } parseResult * ChannelParser::parseINFOInfo(TQString string) @@ -367,13 +367,13 @@ parseResult * ChannelParser::parseINFONicks(TQString in_string) if(current_item > 0) top->nicks->setCurrentItem(current_item); top->nicks->setTopItem(top_item); - top->nicks->repaint(TRUE); - return new parseSucc(TQString::null); // Parsing ok, don't print anything though + top->nicks->tqrepaint(TRUE); + return new parseSucc(TQString()); // Parsing ok, don't print anything though } else if(string[1] == '$'){ top->nicks->clearAdvOps(); //kdDebug(5008) << "Turning off advanced ops" << endl; - return new parseSucc(TQString::null); // Parsing ok, don't print anything though + return new parseSucc(TQString()); // Parsing ok, don't print anything though } @@ -399,7 +399,7 @@ parseResult * ChannelParser::parseINFONicks(TQString in_string) top->nicks->clear(); } - //int start = string.find(": ", 0, FALSE); // Find start of nicks + //int start = string.tqfind(": ", 0, FALSE); // Find start of nicks //if (start < 0) // return new parseError(string, i18n("Could not find start of nicks")); // @@ -417,7 +417,7 @@ parseResult * ChannelParser::parseINFONicks(TQString in_string) uint i; for(i = 0; i < nick.length();i++){ - switch(nick[0].unicode()){ + switch(nick[0].tqunicode()){ case '@': irc->setOp(TRUE); nick.remove(0,1); @@ -448,7 +448,7 @@ parseResult * ChannelParser::parseINFONicks(TQString in_string) top->nicks->inSort(irc); } - return new parseSucc(TQString::null); // Parsing ok, don't print anything though + return new parseSucc(TQString()); // Parsing ok, don't print anything though } parseResult * ChannelParser::parseINFOJoin(TQString string) @@ -525,7 +525,7 @@ parseResult * ChannelParser::parseINFOPart(TQString string) if(top->channelInfo().channel().lower() == channel.lower()) { TQApplication::postEvent(top, new TQCloseEvent()); // WE'RE DEAD - return new parseSucc(TQString::null); + return new parseSucc(TQString()); } pixname = "user|part"; } @@ -540,7 +540,7 @@ parseResult * ChannelParser::parseINFOPart(TQString string) return new parseWrongChannel(string, ksopts->errorColor, "user|kick"); if (ksopts->autoRejoin == TRUE) { - TQString str = TQString("/join %1\n").arg(top->channelInfo().channel()); + TQString str = TQString("/join %1\n").tqarg(top->channelInfo().channel()); emit top->outputUnicodeLine(str); /* if(top->ticker) top->ticker->show(); @@ -555,7 +555,7 @@ parseResult * ChannelParser::parseINFOPart(TQString string) int result = KMessageBox::questionYesNo(top, string, i18n("You Have Been Kicked"), i18n("Rejoin"), i18n("Leave")); if (result == KMessageBox::Yes) { - TQString str = TQString("/join %1\n").arg(top->channelInfo().channel()); + TQString str = TQString("/join %1\n").tqarg(top->channelInfo().channel()); emit top->outputUnicodeLine(str); /* if(top->ticker) * top->ticker->show(); @@ -584,7 +584,7 @@ parseResult * ChannelParser::parseINFOPart(TQString string) foundNick = true; } else{ - return new parseWrongChannel(TQString::null); + return new parseWrongChannel(TQString()); } pixname = "user|part"; highlightNick(string, nick); @@ -599,7 +599,7 @@ parseResult * ChannelParser::parseINFOPart(TQString string) if(top->channelInfo().channel().lower() == channel.lower()) { foundNick = true; } else { - return new parseWrongChannel(TQString::null); + return new parseWrongChannel(TQString()); } highlightNick(string, nick); pixname = "user|kick"; @@ -615,7 +615,7 @@ parseResult * ChannelParser::parseINFOPart(TQString string) return new parseJoinPart(" " + string, ksopts->channelColor, pixname); } else { - return new parseJoinPart(TQString::null); + return new parseJoinPart(TQString()); } } else { @@ -638,11 +638,11 @@ parseResult * ChannelParser::parseINFOChangeNick(TQString string) //kdDebug(5008) << "Nick change: " << string << endl; TQRegExp rx("(\\S+) is now known as (\\S+)"); if(rx.search(string) == -1){ - if(string.contains("already taken")){ + if(string.tqcontains("already taken")){ return new parseSucc(" " + string, ksopts->errorColor, "user|error"); } - return new parseError(i18n("Unable to parse: %1").arg(string), i18n("Unable to parse change nick code")); + return new parseError(i18n("Unable to parse: %1").tqarg(string), i18n("Unable to parse change nick code")); } old_nick = rx.cap(1); @@ -678,7 +678,7 @@ parseResult * ChannelParser::parseINFOChangeNick(TQString string) top->changeCompleteNick(old_nick, new_nick); top->nicks->setCurrentItem(selection); - top->nicks->repaint(TRUE); + top->nicks->tqrepaint(TRUE); // We're done, so let's finish up return new parseSucc(" " + string, ksopts->channelColor, "user|join"); } @@ -687,12 +687,12 @@ parseResult * ChannelParser::parseINFOChangeNick(TQString string) top->channelInfo().channel() == old_nick) return new parseSucc(" " + string, ksopts->channelColor, "user|elipsis"); else - return new parseSucc(TQString::null); + return new parseSucc(TQString()); } // warning("Toplevel-N: nick change search failed on %s", s3.data()); - // return new parseSucc(TQString::null); + // return new parseSucc(TQString()); } class mode_info { @@ -747,7 +747,7 @@ parseResult * ChannelParser::parseINFOMode(TQString string) TQString modes, args, channel; int found = 0; - if(string.find("for user") >= 0) + if(string.tqfind("for user") >= 0) return new parseSucc(" " + string, ksopts->infoColor, "user|mode"); /* @@ -780,7 +780,7 @@ parseResult * ChannelParser::parseINFOMode(TQString string) if(found == 0) - return new parseError(" Failed to parse mode change: " + string, TQString::null); + return new parseError(" Failed to parse mode change: " + string, TQString()); /* * op specifie if it's a + or -. tru is + false is - @@ -801,7 +801,7 @@ parseResult * ChannelParser::parseINFOMode(TQString string) pmList.setAutoDelete(true); for(uint pos = 0; pos < modes.length(); pos++){ - switch(modes.at(pos).unicode()){ + switch(modes.tqat(pos).tqunicode()){ case '+': op = true; break; @@ -814,15 +814,15 @@ parseResult * ChannelParser::parseINFOMode(TQString string) * +l otoh does, so read the argument */ if(op == false){ - pmList.append(new mode_info(op, 'l', TQString::null)); + pmList.append(new mode_info(op, 'l', TQString())); break; } case 'o': // Op, arg is the nick case 'v': // Voice, arg is the nick - case 'b': // Ban, arg is mask banned + case 'b': // Ban, arg is tqmask banned case 'k': // kcik, arg is nick if(ai == NULL) - return new parseError(i18n("Unable to parse mode change: %1").arg(string), TQString::null); + return new parseError(i18n("Unable to parse mode change: %1").tqarg(string), TQString()); pmList.append(new mode_info(op, modes.at(pos), *ai)); ai++; break; @@ -837,11 +837,11 @@ parseResult * ChannelParser::parseINFOMode(TQString string) /* * Mode changes which don't take args */ - pmList.append(new mode_info(op, modes.at(pos), TQString::null)); + pmList.append(new mode_info(op, modes.at(pos), TQString())); break; default: kdDebug(5008) << "Unknown mode change: " << modes.mid(pos, 1) << " Assume no args" << endl; - pmList.append(new mode_info(op, modes.at(pos), TQString::null)); + pmList.append(new mode_info(op, modes.at(pos), TQString())); } } // We have the modes set in mode and arg, now we go though @@ -858,7 +858,7 @@ parseResult * ChannelParser::parseINFOMode(TQString string) /* * Look at the second character, it's uniq, check for +,- latter */ - if(mi->mode().unicode() == 'o'){ + if(mi->mode().tqunicode() == 'o'){ mode_o_plus = mi->op(); mode_o_minus = !mi->op(); @@ -878,7 +878,7 @@ parseResult * ChannelParser::parseINFOMode(TQString string) irc->setOp(mi->op()); // add new nick in sorted pass,with colour top->nicks->inSort(irc); - top->nicks->repaint(TRUE); + top->nicks->tqrepaint(TRUE); } else{ kdDebug(5008) << "Toplevel+o: nick search failed on " << mi->arg() << endl; @@ -922,7 +922,7 @@ parseResult * ChannelParser::parseINFOMode(TQString string) irc->setVoice(voice) ; // add new nick in sorted pass,with colour top->nicks->inSort(irc); - top->nicks->repaint(); + top->nicks->tqrepaint(); } } else if(mi->mode() == 'b'){ @@ -993,7 +993,7 @@ parseResult * ChannelParser::parseINFOTopic(TQString string) if(rx.search( string ) != -1){ TQString channel = rx.cap(1); TQString topic = rx.cap(2); - topic.replace( TQRegExp( "~~" ), "~" ); + topic.tqreplace( TQRegExp( "~~" ), "~" ); /* * check where it's going. @@ -1025,7 +1025,7 @@ parseResult * ChannelParser::parseINFOTopic(TQString string) if(top->channelInfo().channel().lower() == channel.lower()){ TQString topic = rx.cap(3); //kdDebug(5008) << "Topic: " << topic << endl; - topic.replace(TQRegExp("~~"), "~"); + topic.tqreplace(TQRegExp("~~"), "~"); /* * topic is in double quotes, so remove them */ @@ -1041,7 +1041,7 @@ parseResult * ChannelParser::parseINFOTopic(TQString string) void ChannelParser::highlightNick(TQString &string, TQString &nick) { - TQRegExp rx(TQString("(^|\\s+)%1(\\s+|$)").arg(TQRegExp::escape(nick))); - string.replace(rx, "\\1~n" + nick + "~n\\2"); + TQRegExp rx(TQString("(^|\\s+)%1(\\s+|$)").tqarg(TQRegExp::escape(nick))); + string.tqreplace(rx, "\\1~n" + nick + "~n\\2"); } |