| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 FilterNotifier::Topic::SUBSCRIPTION_REMOVED, | 107 FilterNotifier::Topic::SUBSCRIPTION_REMOVED, |
| 108 subscription | 108 subscription |
| 109 ); | 109 ); |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool FilterStorage::MoveSubscription(Subscription& subscription, | 113 bool FilterStorage::MoveSubscription(Subscription& subscription, |
| 114 const Subscription* insertBefore) | 114 const Subscription* insertBefore) |
| 115 { | 115 { |
| 116 int oldPos = IndexOfSubscription(subscription); | 116 int oldPos = IndexOfSubscription(subscription); |
| 117 assert2(oldPos >= 0, u"Attempt to move a subscription that is not in the list"
_str); | 117 assert2(oldPos >= 0, ABP_TEXT("Attempt to move a subscription that is not in t
he list"_str)); |
| 118 if (oldPos == -1) | 118 if (oldPos == -1) |
| 119 return false; | 119 return false; |
| 120 | 120 |
| 121 int newPos = -1; | 121 int newPos = -1; |
| 122 if (insertBefore) | 122 if (insertBefore) |
| 123 newPos = IndexOfSubscription(*insertBefore); | 123 newPos = IndexOfSubscription(*insertBefore); |
| 124 if (newPos == -1) | 124 if (newPos == -1) |
| 125 newPos = mSubscriptions.size(); | 125 newPos = mSubscriptions.size(); |
| 126 | 126 |
| 127 if (newPos > oldPos) | 127 if (newPos > oldPos) |
| 128 newPos--; | 128 newPos--; |
| 129 | 129 |
| 130 if (newPos == oldPos) | 130 if (newPos == oldPos) |
| 131 return false; | 131 return false; |
| 132 | 132 |
| 133 mSubscriptions.erase(mSubscriptions.begin() + oldPos); | 133 mSubscriptions.erase(mSubscriptions.begin() + oldPos); |
| 134 mSubscriptions.emplace(mSubscriptions.begin() + newPos, &subscription); | 134 mSubscriptions.emplace(mSubscriptions.begin() + newPos, &subscription); |
| 135 | 135 |
| 136 FilterNotifier::SubscriptionChange( | 136 FilterNotifier::SubscriptionChange( |
| 137 FilterNotifier::Topic::SUBSCRIPTION_MOVED, | 137 FilterNotifier::Topic::SUBSCRIPTION_MOVED, |
| 138 subscription | 138 subscription |
| 139 ); | 139 ); |
| 140 return true; | 140 return true; |
| 141 } | 141 } |
| OLD | NEW |