138 dest += ".dat"; |
138 dest += ".dat"; |
139 } |
139 } |
140 |
140 |
141 // If the part starts with s\ or s/, then use parts/s/. Same goes with |
141 // If the part starts with s\ or s/, then use parts/s/. Same goes with |
142 // 48\ and p/48/. |
142 // 48\ and p/48/. |
143 if (dest.left (2) == "s\\" || dest.left (2) == "s/") |
143 if (eq (dest.left (2), "s\\", "s/")) |
144 { |
144 { |
145 dest.remove (0, 2); |
145 dest.remove (0, 2); |
146 dest.prepend ("parts/s/"); |
146 dest.prepend ("parts/s/"); |
147 } elif (dest.left (3) == "48\\" || dest.left (3) == "48/") |
147 } |
|
148 elif (eq (dest.left (3), "48\\", "48/")) |
148 { |
149 { |
149 dest.remove (0, 3); |
150 dest.remove (0, 3); |
150 dest.prepend ("p/48/"); |
151 dest.prepend ("p/48/"); |
151 } |
152 } |
152 |
153 |
171 |
172 |
172 if (QRegExp (subpartRegex).exactMatch (dest)) |
173 if (QRegExp (subpartRegex).exactMatch (dest)) |
173 dest.prepend ("parts/s/"); |
174 dest.prepend ("parts/s/"); |
174 elif (QRegExp (partRegex).exactMatch (dest)) |
175 elif (QRegExp (partRegex).exactMatch (dest)) |
175 dest.prepend ("parts/"); |
176 dest.prepend ("parts/"); |
176 elif (dest.left (6) != "parts/" && dest.left (2) != "p/") |
177 elif (not dest.startsWith ("parts/") && not dest.startsWith ("p/")) |
177 dest.prepend ("p/"); |
178 dest.prepend ("p/"); |
178 } |
179 } |
179 |
180 |
180 // ============================================================================= |
181 // ============================================================================= |
181 // |
182 // |
516 |
517 |
517 // ============================================================================= |
518 // ============================================================================= |
518 // |
519 // |
519 bool PartDownloadRequest::isFinished() const |
520 bool PartDownloadRequest::isFinished() const |
520 { |
521 { |
521 return state() == DLRQ_Finished || state() == DLRQ_Failed; |
522 return eq (state(), DLRQ_Finished, DLRQ_Failed); |
522 } |
523 } |
523 |
524 |
524 // ============================================================================= |
525 // ============================================================================= |
525 // |
526 // |
526 void PartDownloadRequest::abort() |
527 void PartDownloadRequest::abort() |