-rw-r--r-- | core/apps/embeddedkonsole/playlistselection.cpp | 28 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/playlistselection.h | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/core/apps/embeddedkonsole/playlistselection.cpp b/core/apps/embeddedkonsole/playlistselection.cpp index b9b9401..4dd3126 100644 --- a/core/apps/embeddedkonsole/playlistselection.cpp +++ b/core/apps/embeddedkonsole/playlistselection.cpp @@ -38,124 +38,124 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) : QListView( parent, name ) { setAllColumnsShowFocus( TRUE ); addColumn( tr( "Command Selection" ) ); header()->hide(); setSorting( -1, FALSE ); } PlayListSelection::~PlayListSelection() { } void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { - QListViewItem *currentItem = selectedItem(); - QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); - if ( currentItem && currentItem->itemAbove() == itemUnder ) - moveSelectedUp(); - else if ( currentItem && currentItem->itemBelow() == itemUnder ) - moveSelectedDown(); + QListViewItem *currentItem = selectedItem(); + QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); + if ( currentItem && currentItem->itemAbove() == itemUnder ) + moveSelectedUp(); + else if ( currentItem && currentItem->itemBelow() == itemUnder ) + moveSelectedDown(); } } const QString *PlayListSelection::current() { PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); if ( item ) - return item->file(); + return item->file(); return NULL; } void PlayListSelection::addToSelection( QListViewItem *lnk ) { PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); QListViewItem *current = selectedItem(); if ( current ) item->moveItem( current ); setSelected( item, TRUE ); ensureItemVisible( selectedItem() ); } void PlayListSelection::addStringToSelection (const QString & lnk) { PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) ); QListViewItem *current = selectedItem(); if ( current ) item->moveItem( current ); setSelected( item, TRUE ); ensureItemVisible( selectedItem() ); } void PlayListSelection::removeSelected() { qDebug("removeSelected()"); QListViewItem *item = selectedItem(); if ( item ) - delete item; + delete item; setSelected( currentItem(), TRUE ); ensureItemVisible( selectedItem() ); } void PlayListSelection::moveSelectedUp() { QListViewItem *item = selectedItem(); if ( item && item->itemAbove() ) - item->itemAbove()->moveItem( item ); + item->itemAbove()->moveItem( item ); ensureItemVisible( selectedItem() ); } void PlayListSelection::moveSelectedDown() { QListViewItem *item = selectedItem(); if ( item && item->itemBelow() ) item->moveItem( item->itemBelow() ); ensureItemVisible( selectedItem() ); } bool PlayListSelection::prev() { QListViewItem *item = selectedItem(); if ( item && item->itemAbove() ) setSelected( item->itemAbove(), TRUE ); else - return FALSE; + return FALSE; ensureItemVisible( selectedItem() ); return TRUE; } bool PlayListSelection::next() { QListViewItem *item = selectedItem(); if ( item && item->itemBelow() ) setSelected( item->itemBelow(), TRUE ); else - return FALSE; + return FALSE; ensureItemVisible( selectedItem() ); return TRUE; } bool PlayListSelection::first() { QListViewItem *item = firstChild(); if ( item ) setSelected( item, TRUE ); else - return FALSE; + return FALSE; ensureItemVisible( selectedItem() ); return TRUE; } bool PlayListSelection::last() { QListViewItem *prevItem = NULL; QListViewItem *item = firstChild(); while ( ( item = item->nextSibling() ) ) - prevItem = item; + prevItem = item; if ( prevItem ) setSelected( prevItem, TRUE ); else - return FALSE; + return FALSE; ensureItemVisible( selectedItem() ); return TRUE; } diff --git a/core/apps/embeddedkonsole/playlistselection.h b/core/apps/embeddedkonsole/playlistselection.h index c307f14..f340124 100644 --- a/core/apps/embeddedkonsole/playlistselection.h +++ b/core/apps/embeddedkonsole/playlistselection.h @@ -15,33 +15,33 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef PLAY_LIST_SELECTION_H #define PLAY_LIST_SELECTION_H #include <qlist.h> #include <qlistview.h> #include <qpe/applnk.h> class PlayListSelectionItem : public QListViewItem { public: PlayListSelectionItem( QListView *parent, QString *f ) : QListViewItem( parent ), fl( f ) { - setText(0, *f ); + setText(0, *f ); } ~PlayListSelectionItem() { }; const QString *file() const { return fl; } private: const QString *fl; }; class PlayListSelection : public QListView { Q_OBJECT public: PlayListSelection( QWidget *parent, const char *name=0 ); ~PlayListSelection(); |