Beispiel #1
0
void
Controller::unregisterProvider( const ProviderPtr &provider )
{
    disconnect( provider.data(), 0, this, 0 );
    if( m_config->providerKnown( provider->id() ) )
    {
        m_config->updateProvider( provider->id(), provider->prettyName(),
                                  provider->icon(), /* online */ false );
        m_config->save();
    }
    m_providers.removeAll( provider );
}
Beispiel #2
0
void
Controller::registerProvider( const ProviderPtr &provider )
{
    QString id = provider->id();
    bool enabled = false;
    if( m_config->providerKnown( id ) )
        enabled = m_config->providerEnabled( id, false );
    else
    {
        switch( provider->defaultPreference() )
        {
            case Provider::Never:
            case Provider::NoByDefault:
                enabled = false;
                break;
            case Provider::Ask:
            {
                QString text = i18nc( "%1 is collection name", "%1 has an ability to "
                    "synchronize track meta-data such as play count or rating "
                    "with other collections. Do you want to keep %1 synchronized?\n\n"
                    "You can always change the decision in Amarok configuration.",
                    provider->prettyName() );
                enabled = KMessageBox::questionYesNo( The::mainWindow(), text ) == KMessageBox::Yes;
                break;
            }
            case Provider::YesByDefault:
                enabled = true;
                break;
        }
    }

    // don't tell config about Never-by-default providers
    if( provider->defaultPreference() != Provider::Never )
    {
        m_config->updateProvider( id, provider->prettyName(), provider->icon(), true, enabled );
        m_config->save();
    }
    m_providers.append( provider );
    connect( provider.data(), SIGNAL(updated()), SLOT(slotProviderUpdated()) );
    if( enabled )
        delayedStartSynchronization();
}
Beispiel #3
0
KConfigGroup
ImporterManager::providerConfig( const ProviderPtr &provider ) const
{
    return providerConfig( provider->id() );
}