Diffstat (limited to 'noncore/unsupported/mailit/textparser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/textparser.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/noncore/unsupported/mailit/textparser.cpp b/noncore/unsupported/mailit/textparser.cpp index f082417..3fa5f6e 100644 --- a/noncore/unsupported/mailit/textparser.cpp +++ b/noncore/unsupported/mailit/textparser.cpp | |||
@@ -59,33 +59,43 @@ void TextParser::createSeparators() | |||
59 | separators = " @#,.:;<>*/(){}|'?-+=_"; | 59 | separators = " @#,.:;<>*/(){}|'?-+=_"; |
60 | } | 60 | } |
61 | 61 | ||
62 | /*Returns pos of given search criteria, -1 if not found */ | 62 | /*Returns pos of given search criteria, -1 if not found */ |
63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) | 63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) |
64 | { | 64 | { |
65 | |||
66 | t_splitElm parsstr; | ||
67 | QString pString; | ||
68 | |||
65 | int atLine = 0, atPosElm = 0; | 69 | int atLine = 0, atPosElm = 0; |
66 | 70 | ||
67 | for (int x = 0; x < totalElmCount; x++) { | 71 | getLineReference(pos,&atLine,&atPosElm); |
68 | if (x >= pos) { | 72 | |
69 | if (upperCase) { | 73 | for (int x = pos; x < totalElmCount; x++) |
70 | if ((splitDone[atLine].elm[atPosElm].str.upper() == target) && | 74 | { |
71 | (splitDone[atLine].elm[atPosElm].separator == sep)) | 75 | parsstr=splitDone[atLine].elm[atPosElm++]; |
72 | return x; | 76 | |
73 | } else { | 77 | if (upperCase) |
74 | if ((splitDone[atLine].elm[atPosElm].str == target) && | 78 | { |
75 | (splitDone[atLine].elm[atPosElm].separator == sep)) | 79 | pString=parsstr.str.upper(); |
76 | return x; | 80 | target=target.upper(); |
77 | } | 81 | } |
82 | else | ||
83 | { | ||
84 | pString=parsstr.str; | ||
78 | } | 85 | } |
79 | atPosElm++; | 86 | if ((pString == target) && (parsstr.separator == sep)) |
80 | if (atPosElm >= splitDone[atLine].elmCount) { //new Line | 87 | { |
88 | return x; | ||
89 | } | ||
90 | if (atPosElm >= splitDone[atLine].elmCount) | ||
91 | { //new Line | ||
81 | atLine++; | 92 | atLine++; |
82 | atPosElm = 0; | 93 | atPosElm = 0; |
83 | } | 94 | } |
84 | } | 95 | } |
85 | |||
86 | return -1; | 96 | return -1; |
87 | } | 97 | } |
88 | 98 | ||
89 | int TextParser::elmCount() | 99 | int TextParser::elmCount() |
90 | { | 100 | { |
91 | return totalElmCount; | 101 | return totalElmCount; |