-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 | |||
@@ -46,30 +46,30 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | |||
46 | 46 | ||
47 | PlayListSelection::~PlayListSelection() { | 47 | PlayListSelection::~PlayListSelection() { |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
52 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 52 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
53 | if ( event->state() == QMouseEvent::LeftButton ) { | 53 | if ( event->state() == QMouseEvent::LeftButton ) { |
54 | QListViewItem *currentItem = selectedItem(); | 54 | QListViewItem *currentItem = selectedItem(); |
55 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 55 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
56 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 56 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
57 | moveSelectedUp(); | 57 | moveSelectedUp(); |
58 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 58 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
59 | moveSelectedDown(); | 59 | moveSelectedDown(); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | const QString *PlayListSelection::current() { | 64 | const QString *PlayListSelection::current() { |
65 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 65 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
66 | if ( item ) | 66 | if ( item ) |
67 | return item->file(); | 67 | return item->file(); |
68 | return NULL; | 68 | return NULL; |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | void PlayListSelection::addToSelection( QListViewItem *lnk ) { | 72 | void PlayListSelection::addToSelection( QListViewItem *lnk ) { |
73 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); | 73 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); |
74 | QListViewItem *current = selectedItem(); | 74 | QListViewItem *current = selectedItem(); |
75 | if ( current ) | 75 | if ( current ) |
@@ -86,26 +86,26 @@ void PlayListSelection::addStringToSelection (const QString & lnk) { | |||
86 | setSelected( item, TRUE ); | 86 | setSelected( item, TRUE ); |
87 | ensureItemVisible( selectedItem() ); | 87 | ensureItemVisible( selectedItem() ); |
88 | 88 | ||
89 | } | 89 | } |
90 | void PlayListSelection::removeSelected() { | 90 | void PlayListSelection::removeSelected() { |
91 | qDebug("removeSelected()"); | 91 | qDebug("removeSelected()"); |
92 | QListViewItem *item = selectedItem(); | 92 | QListViewItem *item = selectedItem(); |
93 | if ( item ) | 93 | if ( item ) |
94 | delete item; | 94 | delete item; |
95 | setSelected( currentItem(), TRUE ); | 95 | setSelected( currentItem(), TRUE ); |
96 | ensureItemVisible( selectedItem() ); | 96 | ensureItemVisible( selectedItem() ); |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | void PlayListSelection::moveSelectedUp() { | 100 | void PlayListSelection::moveSelectedUp() { |
101 | QListViewItem *item = selectedItem(); | 101 | QListViewItem *item = selectedItem(); |
102 | if ( item && item->itemAbove() ) | 102 | if ( item && item->itemAbove() ) |
103 | item->itemAbove()->moveItem( item ); | 103 | item->itemAbove()->moveItem( item ); |
104 | ensureItemVisible( selectedItem() ); | 104 | ensureItemVisible( selectedItem() ); |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | void PlayListSelection::moveSelectedDown() { | 108 | void PlayListSelection::moveSelectedDown() { |
109 | QListViewItem *item = selectedItem(); | 109 | QListViewItem *item = selectedItem(); |
110 | if ( item && item->itemBelow() ) | 110 | if ( item && item->itemBelow() ) |
111 | item->moveItem( item->itemBelow() ); | 111 | item->moveItem( item->itemBelow() ); |
@@ -113,49 +113,49 @@ void PlayListSelection::moveSelectedDown() { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | bool PlayListSelection::prev() { | 116 | bool PlayListSelection::prev() { |
117 | QListViewItem *item = selectedItem(); | 117 | QListViewItem *item = selectedItem(); |
118 | if ( item && item->itemAbove() ) | 118 | if ( item && item->itemAbove() ) |
119 | setSelected( item->itemAbove(), TRUE ); | 119 | setSelected( item->itemAbove(), TRUE ); |
120 | else | 120 | else |
121 | return FALSE; | 121 | return FALSE; |
122 | ensureItemVisible( selectedItem() ); | 122 | ensureItemVisible( selectedItem() ); |
123 | return TRUE; | 123 | return TRUE; |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | bool PlayListSelection::next() { | 127 | bool PlayListSelection::next() { |
128 | QListViewItem *item = selectedItem(); | 128 | QListViewItem *item = selectedItem(); |
129 | if ( item && item->itemBelow() ) | 129 | if ( item && item->itemBelow() ) |
130 | setSelected( item->itemBelow(), TRUE ); | 130 | setSelected( item->itemBelow(), TRUE ); |
131 | else | 131 | else |
132 | return FALSE; | 132 | return FALSE; |
133 | ensureItemVisible( selectedItem() ); | 133 | ensureItemVisible( selectedItem() ); |
134 | return TRUE; | 134 | return TRUE; |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | bool PlayListSelection::first() { | 138 | bool PlayListSelection::first() { |
139 | QListViewItem *item = firstChild(); | 139 | QListViewItem *item = firstChild(); |
140 | if ( item ) | 140 | if ( item ) |
141 | setSelected( item, TRUE ); | 141 | setSelected( item, TRUE ); |
142 | else | 142 | else |
143 | return FALSE; | 143 | return FALSE; |
144 | ensureItemVisible( selectedItem() ); | 144 | ensureItemVisible( selectedItem() ); |
145 | return TRUE; | 145 | return TRUE; |
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | bool PlayListSelection::last() { | 149 | bool PlayListSelection::last() { |
150 | QListViewItem *prevItem = NULL; | 150 | QListViewItem *prevItem = NULL; |
151 | QListViewItem *item = firstChild(); | 151 | QListViewItem *item = firstChild(); |
152 | while ( ( item = item->nextSibling() ) ) | 152 | while ( ( item = item->nextSibling() ) ) |
153 | prevItem = item; | 153 | prevItem = item; |
154 | if ( prevItem ) | 154 | if ( prevItem ) |
155 | setSelected( prevItem, TRUE ); | 155 | setSelected( prevItem, TRUE ); |
156 | else | 156 | else |
157 | return FALSE; | 157 | return FALSE; |
158 | ensureItemVisible( selectedItem() ); | 158 | ensureItemVisible( selectedItem() ); |
159 | return TRUE; | 159 | return TRUE; |
160 | } | 160 | } |
161 | 161 | ||
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 | |||
@@ -23,17 +23,17 @@ | |||
23 | 23 | ||
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | 27 | ||
28 | class PlayListSelectionItem : public QListViewItem { | 28 | class PlayListSelectionItem : public QListViewItem { |
29 | public: | 29 | public: |
30 | PlayListSelectionItem( QListView *parent, QString *f ) : QListViewItem( parent ), fl( f ) { | 30 | PlayListSelectionItem( QListView *parent, QString *f ) : QListViewItem( parent ), fl( f ) { |
31 | setText(0, *f ); | 31 | setText(0, *f ); |
32 | } | 32 | } |
33 | 33 | ||
34 | ~PlayListSelectionItem() { | 34 | ~PlayListSelectionItem() { |
35 | }; | 35 | }; |
36 | 36 | ||
37 | const QString *file() const { return fl; } | 37 | const QString *file() const { return fl; } |
38 | 38 | ||
39 | private: | 39 | private: |