Fix problems from porting Qt3->Qt4, which were caused by introducing takeFirst()...
[vlp.git] / src / help / help.cpp
index 714589266c167de22ab98d6b6e9a653731118c1e..9645f411e9559827b554d7e5020b70c330e72b80 100644 (file)
@@ -233,11 +233,12 @@ void HTMLAnalyzer::AnalyzeTag(QString *t)
 void HTMLAnalyzer::DumpList()
 {
        Tag *pom;
-       pom = tags.first();
-       while (pom != NULL) {
+       QListIterator<Tag *> tagsIterator(tags);
+
+       while (tagsIterator.hasNext()) {
+               pom = tagsIterator.next();
                fprintf(stderr, "%s:%s,%s,%s\n", names[pom->tag_type],
                        pom->tag_text, pom->tag_link, pom->tag_label);
-               pom=tags.takeFirst();
        }
 }
 
@@ -245,12 +246,13 @@ void HTMLAnalyzer::PackLinks()
 {
        Tag *pom,*pom1;
        char s[255];
+       QListIterator<Tag *> tagsIterator(tags);
 
-       pom = tags.first();
-       while (pom!=NULL) {
+       while (tagsIterator.hasNext()) {
+               pom = tagsIterator.next();
                if ((pom->tag_type == TAG_LINK) ||
                        (pom->tag_type == TAG_ANCHOR)) {
-                       pom1 = tags.takeFirst();
+                       pom1 = tagsIterator.next();
                        strcpy(s, "");
                        while ((pom1 != NULL) &&
                                (pom1->tag_type != TAG_LINK_END)) {
@@ -263,7 +265,7 @@ void HTMLAnalyzer::PackLinks()
                        tags.removeOne(pom1);
                        pom = tags.current();
                } else {
-                       pom = tags.takeFirst();
+                       pom = tagsIterator.next();
                }
        }
 }
@@ -272,14 +274,15 @@ void HTMLAnalyzer::PackLinks()
 Tag *HTMLAnalyzer::CheckTag(int x,int y)
 {
        Tag *pom;
-       pom=tags.first();
-       while (pom != NULL) {
+       QListIterator<Tag *> tagsIterator(tags);
+
+       while (tagsIterator.hasNext()) {
+               pom = tagsIterator.next();
                if (pom->tag_type==TAG_LINK)
                        if ((x >= pom->x) && (x <= pom->x + pom->w) &&
                                (y >= pom->y) && (y <= pom->y + pom->h)) {
                                return pom;
                        }
-               pom=tags.takeFirst();
        }
        return NULL;
 }
@@ -287,13 +290,14 @@ Tag *HTMLAnalyzer::CheckTag(int x,int y)
 Tag *HTMLAnalyzer::FindAnchor(char *name)
 {
        Tag *pom;
-       pom = tags.first();
-       while (pom != NULL) {
+       QListIterator<Tag *> tagsIterator(tags);
+
+       while (tagsIterator.hasNext()) {
+               pom = tagsIterator.next();
                if ((pom->tag_type == TAG_ANCHOR) &&
                        (strcmp(pom->tag_label, name) == 0)) {
                                return(pom);
                        }
-               pom=tags.takeFirst();
        }
        return pom;
 }
@@ -473,8 +477,10 @@ void QHTML::DrawList()
                map->fill(backgroundColor());
                p.begin(map);
 
-               pom = analyzer->tags.first();
-               while (pom != NULL) {
+               QListIterator<Tag *> tagsIterator(tags);
+
+               while (tagsIterator.hasNext()) {
+                       pom = tagsIterator.next();
                        switch(pom->tag_type) {
                        case TAG_TEXT:
                                p.setFont(*actual_font);
@@ -576,7 +582,6 @@ void QHTML::DrawList()
                                cy = cy + p.fontMetrics().height();
                                break;
                        }
-                       pom = analyzer->tags.takeFirst();
                }
                p.end();
                repaint();