void SimilarArtistsApplet::init() { DEBUG_BLOCK // Call the base implementation. Context::Applet::init(); enableHeader( true ); setHeaderText( i18n( "Similar Artists" ) ); QAction* backwardAction = new QAction( this ); backwardAction->setIcon( KIcon( "go-previous" ) ); backwardAction->setEnabled( false ); backwardAction->setText( i18n( "Back" ) ); m_backwardIcon = addLeftHeaderAction( backwardAction ); connect( m_backwardIcon, SIGNAL(clicked()), this, SLOT(goBackward()) ); QAction* forwardAction = new QAction( this ); forwardAction->setIcon( KIcon( "go-next" ) ); forwardAction->setEnabled( false ); forwardAction->setText( i18n( "Forward" ) ); m_forwardIcon = addLeftHeaderAction( forwardAction ); connect( m_forwardIcon, SIGNAL(clicked()), this, SLOT(goForward()) ); QAction *currentAction = new QAction( this ); currentAction->setIcon( KIcon( "filename-artist-amarok" ) ); currentAction->setEnabled( true ); currentAction->setText( i18n( "Show Similar Artists for Currently Playing Track" ) ); m_currentArtistIcon = addRightHeaderAction( currentAction ); connect( m_currentArtistIcon, SIGNAL(clicked()), this, SLOT(queryForCurrentTrack()) ); QAction* settingsAction = new QAction( this ); settingsAction->setIcon( KIcon( "preferences-system" ) ); settingsAction->setEnabled( true ); settingsAction->setText( i18n( "Settings" ) ); m_settingsIcon = addRightHeaderAction( settingsAction ); connect( m_settingsIcon, SIGNAL(clicked()), this, SLOT(configure()) ); setCollapseOffHeight( -1 ); setCollapseHeight( m_header->height() ); setMinimumHeight( collapseHeight() ); setPreferredHeight( collapseHeight() ); // create a scrollarea m_scroll = new ArtistsListWidget( this ); m_scroll->hide(); connect( m_scroll, SIGNAL(showSimilarArtists(QString)), SLOT(showSimilarArtists(QString)) ); connect( m_scroll, SIGNAL(showBio(QString)), SLOT(showArtistBio(QString)) ); m_layout = new QGraphicsLinearLayout( Qt::Vertical, this ); m_layout->addItem( m_header ); m_layout->addItem( m_scroll ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); // Read config and inform the engine. KConfigGroup config = Amarok::config( "SimilarArtists Applet" ); m_maxArtists = config.readEntry( "maxArtists", "5" ).toInt(); Plasma::DataEngine *engine = dataEngine( "amarok-similarArtists" ); connect( engine, SIGNAL(sourceAdded(QString)), SLOT(connectSource(QString)) ); engine->setProperty( "maximumArtists", m_maxArtists ); engine->query( "similarArtists" ); }
void ScrollPanner::connectSource(QAbstractScrollArea *area) { connectSource(area->horizontalScrollBar(), area->verticalScrollBar()); }