Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 2750703f authored by Scott Wheeler's avatar Scott Wheeler

Overrode KListView::selectedItems() to return a QPtrList<FileListItem> and

made the appropriate changes to make use of this.

svn path=/trunk/kdemultimedia/juk/; revision=158081
parent 31938908
......@@ -79,29 +79,34 @@ void FileList::append(FileListItem *item)
emit(dataChanged());
}
void FileList::append(QPtrList<QListViewItem> &items)
void FileList::append(QPtrList<FileListItem> &items)
{
QPtrListIterator<QListViewItem> it(items);
QPtrListIterator<FileListItem> it(items);
while(it.current()) {
append(dynamic_cast<FileListItem *>(it.current()));
append(it.current());
++it;
}
// the emit(dataChanged()) is handled in the above function
}
void FileList::remove(QPtrList<QListViewItem> &items)
void FileList::remove(QPtrList<FileListItem> &items)
{
QPtrListIterator<QListViewItem> it(items);
QPtrListIterator<FileListItem> it(items);
while(it.current()) {
members.remove(static_cast<FileListItem *>(it.current())->absFilePath());
members.remove(it.current()->absFilePath());
delete(it.current());
++it;
}
}
FileListItem *FileList::getSelectedItem()
QPtrList<FileListItem> FileList::selectedItems()
{
return(dynamic_cast<FileListItem *>(currentItem()));
QPtrList<FileListItem> list;
for(FileListItem *i = static_cast<FileListItem *>(firstChild()); i != 0; i = static_cast<FileListItem *>(i->itemBelow())) {
if(i->isSelected())
list.append(i);
}
return(list);
}
QStringList *FileList::getArtistList()
......
......@@ -36,11 +36,11 @@ public:
void append(QString item);
void append(QStringList &items);
void append(FileListItem *item);
void append(QPtrList<QListViewItem> &items);
void append(QPtrList<FileListItem> &items);
void remove(QPtrList<QListViewItem> &items);
void remove(QPtrList<FileListItem> &items);
FileListItem *getSelectedItem();
QPtrList<FileListItem> selectedItems();
QStringList *getArtistList();
QStringList *getAlbumList();
......
......@@ -212,13 +212,13 @@ void JuK::showPlaylist()
void JuK::addToPlaylist()
{
QPtrList<QListViewItem> items(tagger->getSelectedItems());
QPtrList<FileListItem> items(tagger->getSelectedItems());
playlist->add(items);
}
void JuK::removeFromPlaylist()
{
QPtrList<QListViewItem> items(tagger->getSelectedItems());
QPtrList<FileListItem> items(tagger->getSelectedItems());
playlist->remove(items);
}
......@@ -234,7 +234,7 @@ void JuK::playFile()
}
}
else if(playlist) {
QPtrList<QListViewItem> items(tagger->getSelectedItems());
QPtrList<FileListItem> items(tagger->getSelectedItems());
if(items.count() > 0)
playItem(dynamic_cast<FileListItem *>(items.at(0)));
else
......
......@@ -53,12 +53,12 @@ void PlaylistWidget::add(FileListItem *item)
playlistList->append(item);
}
void PlaylistWidget::add(QPtrList<QListViewItem> &items)
void PlaylistWidget::add(QPtrList<FileListItem> &items)
{
playlistList->append(items);
}
void PlaylistWidget::remove(QPtrList<QListViewItem> &items)
void PlaylistWidget::remove(QPtrList<FileListItem> &items)
{
playlistList->remove(items);
}
......@@ -68,7 +68,7 @@ FileList *PlaylistWidget::getPlaylistList()
return(playlistList);
}
QPtrList<QListViewItem> PlaylistWidget::getSelectedItems()
QPtrList<FileListItem> PlaylistWidget::getSelectedItems()
{
return(playlistList->selectedItems());
}
......
......@@ -34,12 +34,12 @@ public:
void add(QString item);
void add(QStringList &items);
void add(FileListItem *item);
void add(QPtrList<QListViewItem> &items);
void add(QPtrList<FileListItem> &items);
void remove(QPtrList<QListViewItem> &items);
void remove(QPtrList<FileListItem> &items);
FileList *getPlaylistList();
QPtrList<QListViewItem> getSelectedItems();
QPtrList<FileListItem> getSelectedItems();
FileListItem *firstItem();
private:
void setupLayout();
......
......@@ -61,7 +61,7 @@ FileList *TaggerWidget::getTaggerList()
return(taggerList);
}
QPtrList<QListViewItem> TaggerWidget::getSelectedItems()
QPtrList<FileListItem> TaggerWidget::getSelectedItems()
{
return(taggerList->selectedItems());
}
......@@ -72,7 +72,7 @@ QPtrList<QListViewItem> TaggerWidget::getSelectedItems()
void TaggerWidget::save()
{
QPtrList<QListViewItem> items = taggerList->selectedItems();
QPtrList<FileListItem> items = taggerList->selectedItems();
if(items.count() > 0) {
......@@ -298,7 +298,7 @@ void TaggerWidget::updateBoxes() // this needs to be updated to properly work wi
{
// kdDebug() << "updateBoxes(): " << item->filePath() << endl;
QPtrList<QListViewItem> items = taggerList->selectedItems();
QPtrList<FileListItem> items = taggerList->selectedItems();
if(items.count() > 0) {
......
......@@ -43,8 +43,7 @@ public:
FileList *getTaggerList();
// FileListItem *getSelectedItem();
QPtrList<QListViewItem> getSelectedItems();
QPtrList<FileListItem> getSelectedItems();
public slots:
void save();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment