void SourcePage::initializePage()
{
    if ( _source.size() == 1 )
    {
            _ui->sourceList->clear();
        _ui->sourceList->addItems(Msg::MusicControl::getInstance().getAudioPlugins());
        //load source from wizard, if available
        if ( !((AlarmWizard*) wizard())->getSource().isEmpty() )
        {
            QString src = ((AlarmWizard*) wizard())->getSource();
            int index = src.indexOf("/");
            src.remove(index, src.length());
            QList<QListWidgetItem*> items = _ui->sourceList->findItems(src, Qt::MatchExactly);
            if ( items.size() != 1 )
                return;

            _ui->sourceList->clearSelection();
            //items.first()->setSelected(true);
            _ui->sourceList->setCurrentItem(items.first());
            selectSource(items.first());
        }
    } else {
        Msg::AudioPlugin* plugin = getPlugin();
        _ui->sourceList->addItems(plugin->getSourceList());
        //load source from wizard, if available
        if ( !((AlarmWizard*) wizard())->getSource().isEmpty() )
        {
            QString src = ((AlarmWizard*) wizard())->getSource();
            int index = src.indexOf("/");
            src.remove(0, index + 1);
            QList<QListWidgetItem*> items = _ui->sourceList->findItems(src, Qt::MatchExactly);
            if ( items.size() != 1 )
                return;

            _ui->sourceList->clearSelection();
            items.first()->setSelected(true);
            selectSource(items.first());
        }
    }

    if ( _ui->sourceList->selectedItems().size() == 0 )
    {
            _ui->sourceList->setCurrentItem(_ui->sourceList->itemAt(1,1));
            selectSource(_ui->sourceList->selectedItems().first());
    }
}
void PackageHandling::setFile(const QString &a)
{

	if (a != filename) {
		filename = a;
		selectSource();
		emit fileChanged();
	}
}
QList<PopupDropperAction*>
Playlist::ViewCommon::actionsFor( QWidget *parent, const QModelIndex *index, bool coverActions )
{
    QList<PopupDropperAction*> actions;

    Meta::TrackPtr track = index->data( Playlist::TrackRole ).value< Meta::TrackPtr >();

    PopupDropperAction *separator = new PopupDropperAction( parent );
    separator->setSeparator( true );
    
    const bool isCurrentTrack = index->data( Playlist::ActiveTrackRole ).toBool();

    PopupDropperAction *stopAction = new PopupDropperAction( KIcon( "media-playback-stop-amarok" ), i18n( "Stop Playing After This Track" ), parent );
    QObject::connect( stopAction, SIGNAL( triggered() ), parent, SLOT( stopAfterTrack() ) );
    actions << stopAction;
    
    actions << separator;
    
    const bool isQueued = index->data( Playlist::StateRole ).toInt() & Item::Queued;
    const QString queueText = !isQueued ? i18n( "Queue Track" ) : i18n( "Dequeue Track" );
    PopupDropperAction *queueAction = new PopupDropperAction( KIcon( "media-track-queue-amarok" ), queueText, parent );
    if( isQueued )
        QObject::connect( queueAction, SIGNAL( triggered() ), parent, SLOT( dequeueSelection() ) );
    else
        QObject::connect( queueAction, SIGNAL( triggered() ), parent, SLOT( queueSelection() ) );

    actions << queueAction;

    actions << separator;

    PopupDropperAction *removeAction = new PopupDropperAction( KIcon( "media-track-remove-amarok" ), i18n( "Remove From Playlist" ), parent );
    QObject::connect( removeAction, SIGNAL( triggered() ), parent, SLOT( removeSelection() ) );
    actions << removeAction;

    actions << separator;

    //lets see if parent is the currently playing tracks, and if it has CurrentTrackActionsCapability
    if( isCurrentTrack )
    {
        QList<QAction*> globalCurrentTrackActions = The::globalCurrentTrackActions()->actions();
        foreach( QAction *action, globalCurrentTrackActions )
            actions << PopupDropperAction::from( action );
        
        if ( track->hasCapabilityInterface( Meta::Capability::CurrentTrackActions ) )
        {
            Meta::CurrentTrackActionsCapability *cac = track->create<Meta::CurrentTrackActionsCapability>();
            if ( cac )
            {
                QList<PopupDropperAction *> actions = cac->customActions();

                foreach( PopupDropperAction *action, actions )
                    actions << action;
            }
            delete cac;
        }
    }

    actions << separator;

    if ( coverActions )
    {
        Meta::AlbumPtr album = track->album();
        if ( album )
        {
            Meta::CustomActionsCapability *cac = album->create<Meta::CustomActionsCapability>();
            if ( cac )
            {
                QList<PopupDropperAction *> customActions = cac->customActions();

                foreach( PopupDropperAction *customAction, customActions )
                    actions << customAction;
            }
            delete cac;
        }
    }

    actions << separator;
    
    const bool isMultiSource = index->data( Playlist::MultiSourceRole ).toBool();
    if( isMultiSource )
    {
        PopupDropperAction *selectSourceAction = new PopupDropperAction( KIcon( "media-playlist-repeat" ), i18n( "Select Source" ), parent );
        QObject::connect( selectSourceAction, SIGNAL( triggered() ), parent, SLOT( selectSource() ) );

        actions << selectSourceAction;
    }
    
    PopupDropperAction *editAction = new PopupDropperAction( KIcon( "media-track-edit-amarok" ), i18n( "Edit Track Details" ), parent );
    QObject::connect( editAction, SIGNAL( triggered() ), parent, SLOT( editTrackInformation() ) );
    actions << editAction;

    return actions;
}