-rw-r--r-- | noncore/multimedia/opieplayer2/playlistfileview.cpp | 17 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistfileview.h | 8 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 15 |
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 | |||
@@ -21,2 +21,5 @@ PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QStrin | |||
21 | setSelectionMode( QListView::Extended ); | 21 | setSelectionMode( QListView::Extended ); |
22 | |||
23 | connect( this, SIGNAL( selectionChanged() ), | ||
24 | this, SLOT( checkSelection() ) ); | ||
22 | } | 25 | } |
@@ -27,2 +30,11 @@ PlayListFileView::~PlayListFileView() | |||
27 | 30 | ||
31 | bool PlayListFileView::hasSelection() const | ||
32 | { | ||
33 | for ( QListViewItemIterator it( const_cast<PlayListFileView *>( this ) ); it.current(); ++it ) | ||
34 | if ( it.current()->isSelected() ) | ||
35 | return true; | ||
36 | |||
37 | return false; | ||
38 | } | ||
39 | |||
28 | void PlayListFileView::scanFiles() | 40 | void PlayListFileView::scanFiles() |
@@ -76,2 +88,7 @@ void PlayListFileView::populateView() | |||
76 | 88 | ||
89 | void PlayListFileView::checkSelection() | ||
90 | { | ||
91 | emit itemsSelected( hasSelection() ); | ||
92 | } | ||
93 | |||
77 | /* vim: et sw=4 ts=4 | 94 | /* 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 | |||
@@ -14,2 +14,4 @@ public: | |||
14 | 14 | ||
15 | bool hasSelection() const; | ||
16 | |||
15 | public slots: | 17 | public slots: |
@@ -18,2 +20,8 @@ public slots: | |||
18 | 20 | ||
21 | signals: | ||
22 | void itemsSelected( bool selected ); | ||
23 | |||
24 | private slots: | ||
25 | void checkSelection(); | ||
26 | |||
19 | private: | 27 | private: |
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 | |||
@@ -546,2 +546,7 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
546 | 546 | ||
547 | disconnect( audioView, SIGNAL( itemsSelected( bool ) ), | ||
548 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | ||
549 | disconnect( videoView, SIGNAL( itemsSelected( bool ) ), | ||
550 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | ||
551 | |||
547 | switch ( currentTab() ) { | 552 | switch ( currentTab() ) { |
@@ -567,2 +572,7 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
567 | d->tbAddToList->setEnabled(TRUE); | 572 | d->tbAddToList->setEnabled(TRUE); |
573 | |||
574 | connect( audioView, SIGNAL( itemsSelected( bool ) ), | ||
575 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | ||
576 | |||
577 | d->tbPlay->setEnabled( audioView->hasSelection() ); | ||
568 | } | 578 | } |
@@ -577,2 +587,7 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
577 | d->tbAddToList->setEnabled(TRUE); | 587 | d->tbAddToList->setEnabled(TRUE); |
588 | |||
589 | connect( videoView, SIGNAL( itemsSelected( bool ) ), | ||
590 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | ||
591 | |||
592 | d->tbPlay->setEnabled( videoView->hasSelection() ); | ||
578 | } | 593 | } |