Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/positioner.cpp
Show First 20 Lines • Show All 397 Lines • ▼ Show 20 Line(s) | 397 | if (to == -1) { | |||
---|---|---|---|---|---|
398 | to = firstFreeRow(); | 398 | to = firstFreeRow(); | ||
399 | 399 | | |||
400 | if (to == -1) { | 400 | if (to == -1) { | ||
401 | to = lastRow() + 1; | 401 | to = lastRow() + 1; | ||
402 | } | 402 | } | ||
403 | } | 403 | } | ||
404 | 404 | | |||
405 | if (!fromIndices.contains(to) && !isBlank(to)) { | 405 | if (!fromIndices.contains(to) && !isBlank(to)) { | ||
406 | // find the next blank space | 406 | /* find the next blank space | ||
407 | while (!isBlank(to) && from != to) { | 407 | * we won't be happy if we're moving two icons to the same place | ||
408 | */ | ||||
409 | while ((!isBlank(to) && from != to) || toIndices.contains(to)) { | ||||
408 | to++; | 410 | to++; | ||
409 | } | 411 | } | ||
410 | } | 412 | } | ||
411 | 413 | | |||
412 | toIndices[i] = to; | 414 | toIndices[i] = to; | ||
413 | 415 | | |||
414 | if (!toIndices.contains(from)) { | 416 | if (!toIndices.contains(from)) { | ||
415 | m_proxyToSource.remove(from); | 417 | m_proxyToSource.remove(from); | ||
416 | } | 418 | } | ||
McPain: AFAIK, the first part of condition is "check if `to` is blank and if it's not, check whether… | |||||
417 | 419 | | |||
418 | updateMaps(to, sourceRow); | 420 | updateMaps(to, sourceRow); | ||
419 | 421 | | |||
420 | const QModelIndex &fromIdx = index(from, 0); | 422 | const QModelIndex &fromIdx = index(from, 0); | ||
421 | emit dataChanged(fromIdx, fromIdx); | 423 | emit dataChanged(fromIdx, fromIdx); | ||
422 | 424 | | |||
423 | if (to < oldCount) { | 425 | if (to < oldCount) { | ||
424 | const QModelIndex &toIdx = index(to, 0); | 426 | const QModelIndex &toIdx = index(to, 0); | ||
▲ Show 20 Lines • Show All 549 Lines • Show Last 20 Lines |
AFAIK, the first part of condition is "check if to is blank and if it's not, check whether we're not moving icon to itself, and if we do, it's alright"
The second part is "check if we're already moving another icon to to and if we do so, try to+1"