author | llornkcor <llornkcor> | 2003-06-09 01:37:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-06-09 01:37:23 (UTC) |
commit | 364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560 (patch) (unidiff) | |
tree | 1be5d3150c2bda4b3a55f9e7d2529d73fe6d72db /noncore/unsupported/mailit/maillist.cpp | |
parent | 5ee1c7dff5679454d46e3c5bd5747c60ea63c959 (diff) | |
download | opie-364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560.zip opie-364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560.tar.gz opie-364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560.tar.bz2 |
patch from wim delvaux. fix from me
Diffstat (limited to 'noncore/unsupported/mailit/maillist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/maillist.cpp | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/noncore/unsupported/mailit/maillist.cpp b/noncore/unsupported/mailit/maillist.cpp index b5325a9..8c34295 100644 --- a/noncore/unsupported/mailit/maillist.cpp +++ b/noncore/unsupported/mailit/maillist.cpp | |||
@@ -1,131 +1,131 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "maillist.h" | 20 | #include "maillist.h" |
21 | 21 | ||
22 | void MailList::clear() | 22 | void MailList::clear() |
23 | { | 23 | { |
24 | sortedList.setAutoDelete(TRUE); | 24 | sortedList.setAutoDelete(TRUE); |
25 | sortedList.clear(); | 25 | sortedList.clear(); |
26 | currentPos = 0; | 26 | currentPos = 0; |
27 | } | 27 | } |
28 | 28 | ||
29 | int MailList::count() | 29 | int MailList::count() |
30 | { | 30 | { |
31 | return sortedList.count(); | 31 | return sortedList.count(); |
32 | } | 32 | } |
33 | 33 | ||
34 | int* MailList::first() | 34 | int* MailList::first() |
35 | { | 35 | { |
36 | dList *mPtr; | 36 | dList *mPtr; |
37 | 37 | ||
38 | if (sortedList.count() == 0) | 38 | if (sortedList.count() == 0) |
39 | return NULL; | 39 | return NULL; |
40 | 40 | ||
41 | mPtr = sortedList.at(0); | 41 | mPtr = sortedList.at(0); |
42 | currentPos = 1; | 42 | currentPos = 1; |
43 | return &(mPtr->serverId); | 43 | return &(mPtr->serverId); |
44 | } | 44 | } |
45 | 45 | ||
46 | int* MailList::next() | 46 | int* MailList::next() |
47 | { | 47 | { |
48 | dList *mPtr; | 48 | dList *mPtr; |
49 | 49 | ||
50 | if ( (currentPos) >= sortedList.count()) | 50 | if ( (currentPos) >= sortedList.count()) |
51 | return NULL; | 51 | return NULL; |
52 | 52 | ||
53 | mPtr = sortedList.at(currentPos); | 53 | mPtr = sortedList.at(currentPos); |
54 | currentPos++; | 54 | currentPos++; |
55 | return &(mPtr->serverId); | 55 | return &(mPtr->serverId); |
56 | } | 56 | } |
57 | 57 | ||
58 | void MailList::sizeInsert(int serverId, uint size) | 58 | void MailList::sizeInsert(int serverId, uint size) |
59 | { | 59 | { |
60 | dList *tempPtr; | 60 | dList *tempPtr; |
61 | int x; | 61 | int x; |
62 | 62 | ||
63 | dList *newEntry = new dList; | 63 | dList *newEntry = new dList; |
64 | newEntry->serverId = serverId; | 64 | newEntry->serverId = serverId; |
65 | newEntry->size = size; | 65 | newEntry->size = size; |
66 | 66 | ||
67 | for (tempPtr = sortedList.first(); tempPtr != NULL; tempPtr = sortedList.next() ) { | 67 | for (tempPtr = sortedList.first(); tempPtr != NULL; tempPtr = sortedList.next() ) { |
68 | if (newEntry->size < tempPtr->size) { | 68 | if (newEntry->size < tempPtr->size) { |
69 | x = sortedList.at(); | 69 | x = sortedList.at(); |
70 | sortedList.insert(x, newEntry); | 70 | sortedList.insert(x, newEntry); |
71 | return; | 71 | return; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | sortedList.append(newEntry); | 74 | sortedList.append(newEntry); |
75 | } | 75 | } |
76 | 76 | ||
77 | void MailList::moveFront(int serverId, uint size) | 77 | void MailList::moveFront(int serverId, uint/* size*/) |
78 | { | 78 | { |
79 | dList *currentPtr; | 79 | dList *currentPtr; |
80 | uint tempPos; | 80 | uint tempPos; |
81 | QString temp; | 81 | QString temp; |
82 | 82 | ||
83 | tempPos = currentPos; | 83 | tempPos = currentPos; |
84 | if ( tempPos >= sortedList.count() ) | 84 | if ( tempPos >= sortedList.count() ) |
85 | return; | 85 | return; |
86 | currentPtr = sortedList.at(tempPos); | 86 | currentPtr = sortedList.at(tempPos); |
87 | while ( ((tempPos+1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { | 87 | while ( ((tempPos+1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { |
88 | tempPos++; | 88 | tempPos++; |
89 | currentPtr = sortedList.at(tempPos); | 89 | currentPtr = sortedList.at(tempPos); |
90 | } | 90 | } |
91 | 91 | ||
92 | if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { | 92 | if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { |
93 | temp.setNum(currentPtr->serverId); | 93 | temp.setNum(currentPtr->serverId); |
94 | qWarning("moved to front, message: " + temp); | 94 | qWarning("moved to front, message: " + temp); |
95 | 95 | ||
96 | dList *itemPtr = sortedList.take(tempPos); | 96 | dList *itemPtr = sortedList.take(tempPos); |
97 | sortedList.insert(currentPos, itemPtr); | 97 | sortedList.insert(currentPos, itemPtr); |
98 | } | 98 | } |
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | //only works if mail is not already in download | 102 | //only works if mail is not already in download |
103 | bool MailList::remove(int serverId, uint size) | 103 | bool MailList::remove(int serverId, uint /*size*/) |
104 | { | 104 | { |
105 | dList *currentPtr; | 105 | dList *currentPtr; |
106 | uint tempPos; | 106 | uint tempPos; |
107 | QString temp; | 107 | QString temp; |
108 | 108 | ||
109 | tempPos = currentPos; | 109 | tempPos = currentPos; |
110 | if ( tempPos >=sortedList.count() ) | 110 | if ( tempPos >=sortedList.count() ) |
111 | return FALSE; | 111 | return FALSE; |
112 | currentPtr = sortedList.at(tempPos); | 112 | currentPtr = sortedList.at(tempPos); |
113 | while ( ((tempPos + 1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { | 113 | while ( ((tempPos + 1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { |
114 | tempPos++; | 114 | tempPos++; |
115 | currentPtr = sortedList.at(tempPos); | 115 | currentPtr = sortedList.at(tempPos); |
116 | } | 116 | } |
117 | 117 | ||
118 | if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { | 118 | if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { |
119 | temp.setNum(currentPtr->serverId); | 119 | temp.setNum(currentPtr->serverId); |
120 | qWarning("deleted message: " + temp); | 120 | qWarning("deleted message: " + temp); |
121 | sortedList.remove(tempPos); | 121 | sortedList.remove(tempPos); |
122 | 122 | ||
123 | return TRUE; | 123 | return TRUE; |
124 | } | 124 | } |
125 | return FALSE; | 125 | return FALSE; |
126 | } | 126 | } |
127 | 127 | ||
128 | void MailList::insert(int pos, int serverId, uint size) | 128 | void MailList::insert(int /*pos*/, int /*serverId*/, uint/* size*/) |
129 | { | 129 | { |
130 | //sortedList.insert(pos, mPtr); | 130 | // sortedList.insert(pos, mPtr); |
131 | } | 131 | } |