author | simon <simon> | 2002-12-08 19:57:21 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 19:57:21 (UTC) |
commit | ce313e53a56591fd883348f5e265606865fdcb50 (patch) (side-by-side diff) | |
tree | f7227b5ed4270b35c92e81545f0e067cf6da90c1 /noncore/multimedia/opieplayer2/playlistfileview.cpp | |
parent | 77ab301a0ab41befda91e6a210c64a72f0d7c264 (diff) | |
download | opie-ce313e53a56591fd883348f5e265606865fdcb50.zip opie-ce313e53a56591fd883348f5e265606865fdcb50.tar.gz opie-ce313e53a56591fd883348f5e265606865fdcb50.tar.bz2 |
- when the file list view is visible only enable the play button if there
is something selected. one crash less ;)
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistfileview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistfileview.cpp | 17 |
1 files changed, 17 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 @@ -16,18 +16,30 @@ PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QStrin setColumnAlignment( 1, Qt::AlignRight ); setColumnAlignment( 2, Qt::AlignRight ); setAllColumnsShowFocus( TRUE ); 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(); QListIterator<DocLnk> sdit( m_files.children() ); for ( ; sdit.current(); ++sdit ) delete sdit.current(); @@ -71,8 +83,13 @@ void PlayListFileView::populateView() dit.current()->file() ); newItem->setPixmap( 0, Resource::loadPixmap( m_itemPixmapName ) ); } } } +void PlayListFileView::checkSelection() +{ + emit itemsSelected( hasSelection() ); +} + /* vim: et sw=4 ts=4 */ |