summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp17
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h8
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp15
3 files changed, 40 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index cb16415..3ef4d03 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -19,12 +19,24 @@ PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QStrin
setSorting( 3, TRUE );
setMultiSelection( TRUE );
setSelectionMode( QListView::Extended );
+
+ connect( this, SIGNAL( selectionChanged() ),
+ this, SLOT( checkSelection() ) );
}
PlayListFileView::~PlayListFileView()
{
}
+bool PlayListFileView::hasSelection() const
+{
+ for ( QListViewItemIterator it( const_cast<PlayListFileView *>( this ) ); it.current(); ++it )
+ if ( it.current()->isSelected() )
+ return true;
+
+ return false;
+}
+
void PlayListFileView::scanFiles()
{
m_files.detachChildren();
@@ -74,5 +86,10 @@ void PlayListFileView::populateView()
}
}
+void PlayListFileView::checkSelection()
+{
+ emit itemsSelected( hasSelection() );
+}
+
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index 6eea2fc..5b15526 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -12,10 +12,18 @@ public:
PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 );
virtual ~PlayListFileView();
+ bool hasSelection() const;
+
public slots:
void scanFiles();
void populateView();
+signals:
+ void itemsSelected( bool selected );
+
+private slots:
+ void checkSelection();
+
private:
QString m_mimeTypePattern;
QString m_itemPixmapName;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 2df7f27..c05096a 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -544,6 +544,11 @@ void PlayListWidget::tabChanged(QWidget *) {
d->tbPlay->setEnabled( true );
+ disconnect( audioView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+ disconnect( videoView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+
switch ( currentTab() ) {
case CurrentPlayList:
{
@@ -565,6 +570,11 @@ void PlayListWidget::tabChanged(QWidget *) {
}
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
+
+ connect( audioView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+
+ d->tbPlay->setEnabled( audioView->hasSelection() );
}
break;
case VideoFiles:
@@ -575,6 +585,11 @@ void PlayListWidget::tabChanged(QWidget *) {
}
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
+
+ connect( videoView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+
+ d->tbPlay->setEnabled( videoView->hasSelection() );
}
break;
case PlayLists: