Revision 1788 trunk/client/gui_qt/DownloadQueueSelectionModel.cpp

DownloadQueueSelectionModel.cpp (revision 1788)
16 16
    /* Is the current row selected? */
17 17
    QModelIndex idx = sourceParent.child(sourceStart, 0);
18 18
    if (!idx.isValid()) {
19
        qWarning("Invalid index");
19
        idx = model()->index(sourceStart, 0);
20
        if (!idx.isValid()) {
21
            qWarning("DownloadQueueSelectionModel::onRowsAboutToBeMoved: Invalid index (sourceParent)");
22
        }
20 23
    }
24

                
21 25
    if (isSelected(idx)) {
22 26
        /* Deselect the row and keep track of it so we can re-select it after the move has completed */
23
        select(sourceParent.child(sourceStart, 0), Toggle | Rows);
27
        select(idx, Toggle | Rows);
24 28
        deselectedSourceParent = sourceParent;
25 29
        deselectedSourceStart = sourceStart;
26 30

                
... ...
30 34

                
31 35
        QModelIndex idx = destinationParent.child(destinationRow, 0);
32 36
        if (!idx.isValid()) {
33
            qWarning("Invalid index");
37
            idx = model()->index(destinationRow, 0);
38
            if (!idx.isValid()) {
39
                qWarning("DownloadQueueSelectionModel::onRowsAboutToBeMoved: Invalid index (destinationParent)");
40
            }
34 41
        }
35 42
        select(idx, Toggle | Rows);
36 43
    } else {
... ...
42 49
void DownloadQueueSelectionModel::onRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
43 50
{
44 51
    Q_UNUSED(sourceEnd);
52
    Q_UNUSED(destinationParent);
53
    Q_UNUSED(destinationRow);
45 54

                
46 55
    /* Was the original row selected? */
47 56
    if (deselectedSourceParent != sourceParent ||
... ...
50 59
        return;
51 60
    }
52 61

                
53
    //QModelIndex idx = destinationParent.child(destinationRow, 0);
54
    //if (!idx.isValid()) {
55
    //    qWarning("Invalid index");
56
    //}
57
    //select(idx, Toggle | Rows);
62
//    QModelIndex idx = destinationParent.child(destinationRow, 0);
63
//    if (!idx.isValid()) {
64
//        idx = model()->index(destinationRow, 0);
65
//        if (!idx.isValid()) {
66
//            qWarning("DownloadQueueSelectionModel::onRowsMoved: Invalid index (destinationParent)");
67
//        }
68
//    }
69
//    select(idx, Toggle | Rows);
58 70
}

Also available in: Unified diff