Fix Bug 294445 - Renaming currently viewed folder in Folders sidebar doesn't update main area

Review Request #107070 - Created Oct. 27, 2012 and submitted

Information
Emmanuel Pescosta
kde-baseapps
294445, 309338
Reviewers
dolphin
freininghaus
Fix Bug 294445 - Renaming currently viewed folder in Folders sidebar doesn't update main area

Especially the error, while renaming a folder in the folderview panel. (Error-dialog appears when you rename the same folder several times)


Question:

void KItemListView::editRole(int index, const QByteArray& role)
{
    KItemListWidget* widget = m_visibleItems.value(index);
    if (!widget || m_editingRole) {
        return;
    }

    m_editingRole = true;
    widget->setEditedRole(role);

    connect(widget, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)),
            this, SLOT(slotRoleEditingCanceled(int,QByteArray,QVariant)));
    connect(widget, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
            this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
}

Should we disconnect the signals roleEditingCanceled and roleEditingFinished from KItemListWidget* widget, before we connect the signals? When you rename the same folder/file several times, the slots are called multiple times ...

1. Rename -> 1 Slot call
2. Rename -> 2 Slot calls
3. Rename -> 3 Slot calls 
...

Solution:

widget->disconnect(SIGNAL(roleEditingCanceled(int,QByteArray,QVariant), this);
widget->disconnect(SIGNAL(roleEditingFinished(int,QByteArray,QVariant), this);
Renaming a folder in the folderview-panel works without problems. 
Frank Reininghaus
Emmanuel Pescosta
Frank Reininghaus
Emmanuel Pescosta
Emmanuel Pescosta
Frank Reininghaus
Commit Hook
Emmanuel Pescosta
Review request changed

Status: Closed (submitted)

Loading...