IDBError MemoryIDBBackingStore::renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName)
{
    LOG(IndexedDB, "MemoryIDBBackingStore::renameIndex");

    ASSERT(m_databaseInfo);
    auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
    if (!objectStoreInfo)
        return { IDBDatabaseException::ConstraintError };

    auto* indexInfo = objectStoreInfo->infoForExistingIndex(indexIdentifier);
    if (!indexInfo)
        return { IDBDatabaseException::ConstraintError };

    auto transaction = m_transactions.get(transactionIdentifier);
    ASSERT(transaction);
    ASSERT(transaction->isVersionChange());

    auto objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
    ASSERT(objectStore);
    if (!objectStore)
        return { IDBDatabaseException::ConstraintError };

    auto* index = objectStore->indexForIdentifier(indexIdentifier);
    ASSERT(index);
    if (!index)
        return { IDBDatabaseException::ConstraintError };

    String oldName = index->info().name();
    objectStore->renameIndex(*index, newName);
    transaction->indexRenamed(*index, oldName);

    indexInfo->rename(newName);

    return { };
}
void IDBServer::renameIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName)
{
    LOG(IndexedDB, "IDBServer::renameIndex");

    auto transaction = m_transactions.get(requestData.transactionIdentifier());
    if (!transaction)
        return;

    ASSERT(transaction->isVersionChange());
    transaction->renameIndex(requestData, objectStoreIdentifier, indexIdentifier, newName);
}
PlaylistsInFoldersProxy::PlaylistsInFoldersProxy( QAbstractItemModel *model )
    : QtGroupingProxy( model, QModelIndex(), PlaylistBrowserNS::UserModel::LabelColumn )
{
    m_renameFolderAction =  new QAction( KIcon( "media-track-edit-amarok" ),
                                         i18n( "&Rename Folder..." ), this );
    m_renameFolderAction->setProperty( "popupdropper_svg_id", "edit_group" );
    connect( m_renameFolderAction, SIGNAL(triggered()), this,
             SLOT(slotRenameFolder()) );

    m_deleteFolderAction = new QAction( KIcon( "media-track-remove-amarok" ),
                                        i18n( "&Delete Folder" ), this );
    m_deleteFolderAction->setProperty( "popupdropper_svg_id", "delete_group" );
    m_deleteFolderAction->setObjectName( "deleteAction" );
    connect( m_deleteFolderAction, SIGNAL(triggered()), this,
             SLOT(slotDeleteFolder()) );

    connect( sourceModel(), SIGNAL(renameIndex(QModelIndex)),
             SLOT(slotRenameIndex(QModelIndex)) );
}
void ExecutionListView::DecorateContextMenu ( QMenu * menu_p )
{
    QModelIndexList sel = selectedIndexes();
    if (sel.isEmpty())
        return;
    ExecutionListModel *model_p=_model();
    if (! model_p)
        return;
    SortFilterProxy *sort_model_p=_sort_model();
    bool editable=false;
    for (int i=0; i<sel.count(); i++)
    {
        QModelIndex index;
        if (sort_model_p)
            index=sort_model_p->mapToSource(sel.at(i));
        else
            index=sel.at(i);
        Qt::ItemFlags flags=model_p->flags(index);
        if (index.column()==0 && ( (flags&Qt::ItemIsEditable) == Qt::ItemIsEditable) )
            editable=true;
    }

    menu_p->addAction(tr("Delete"),this,SLOT(deleteIndex()));
    if (editable)
    {
        menu_p->addAction(tr("Rename..."),this,SLOT(renameIndex()));
        menu_p->addAction(tr("Place in folder..."),this,SLOT(moveIndexToFolder()));
        menu_p->addAction(tr("Comment..."),this,SLOT(setComment()));
    }
    if (csmes_p)
    {
        menu_p->addSeparator();
        menu_p->addAction(tr("Rename multiple executions..."),this,SLOT(renameRegex()));
        menu_p->addAction(tr("Delete multiple executions..."),this,SLOT(deleteRegex()));
        menu_p->addAction(tr("Merge executions together..."),this,SLOT(mergeRegex()));
    }
}