summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show 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
19 setSorting( 3, TRUE ); 19 setSorting( 3, TRUE );
20 setMultiSelection( TRUE ); 20 setMultiSelection( TRUE );
21 setSelectionMode( QListView::Extended ); 21 setSelectionMode( QListView::Extended );
22
23 connect( this, SIGNAL( selectionChanged() ),
24 this, SLOT( checkSelection() ) );
22} 25}
23 26
24PlayListFileView::~PlayListFileView() 27PlayListFileView::~PlayListFileView()
25{ 28{
26} 29}
27 30
31bool 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
28void PlayListFileView::scanFiles() 40void PlayListFileView::scanFiles()
29{ 41{
30 m_files.detachChildren(); 42 m_files.detachChildren();
@@ -74,5 +86,10 @@ void PlayListFileView::populateView()
74 } 86 }
75} 87}
76 88
89void PlayListFileView::checkSelection()
90{
91 emit itemsSelected( hasSelection() );
92}
93
77/* vim: et sw=4 ts=4 94/* vim: et sw=4 ts=4
78 */ 95 */
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:
12 PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 ); 12 PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 );
13 virtual ~PlayListFileView(); 13 virtual ~PlayListFileView();
14 14
15 bool hasSelection() const;
16
15public slots: 17public slots:
16 void scanFiles(); 18 void scanFiles();
17 void populateView(); 19 void populateView();
18 20
21signals:
22 void itemsSelected( bool selected );
23
24private slots:
25 void checkSelection();
26
19private: 27private:
20 QString m_mimeTypePattern; 28 QString m_mimeTypePattern;
21 QString m_itemPixmapName; 29 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 *) {
544 544
545 d->tbPlay->setEnabled( true ); 545 d->tbPlay->setEnabled( true );
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() ) {
548 case CurrentPlayList: 553 case CurrentPlayList:
549 { 554 {
@@ -565,6 +570,11 @@ void PlayListWidget::tabChanged(QWidget *) {
565 } 570 }
566 d->tbRemoveFromList->setEnabled(FALSE); 571 d->tbRemoveFromList->setEnabled(FALSE);
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 }
569 break; 579 break;
570 case VideoFiles: 580 case VideoFiles:
@@ -575,6 +585,11 @@ void PlayListWidget::tabChanged(QWidget *) {
575 } 585 }
576 d->tbRemoveFromList->setEnabled(FALSE); 586 d->tbRemoveFromList->setEnabled(FALSE);
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 }
579 break; 594 break;
580 case PlayLists: 595 case PlayLists: