Commit 86d85e1d authored by Scott Wheeler's avatar Scott Wheeler

Fix notification of CollectionList creation so that the tree view is

populated on startup when selected.

svn path=/trunk/kdemultimedia/juk/; revision=317533
parent 7f500894
......@@ -53,9 +53,6 @@ void CollectionList::initialize(PlaylistCollection *collection, bool restoreOnLo
m_list = new CollectionList(collection);
m_list->setName(i18n("Collection List"));
collection->setupPlaylist(m_list, "folder_sound");
// TODO: don't fetch the fileInfo from the tag, but rather from the FileHandle
if(restoreOnLoad) {
for(FileHandleHash::Iterator it = Cache::instance()->begin();
......@@ -65,6 +62,8 @@ void CollectionList::initialize(PlaylistCollection *collection, bool restoreOnLo
new CollectionListItem(*it);
}
}
collection->setupPlaylist(m_list, "folder_sound");
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -625,6 +625,11 @@ void PlaylistBox::Item::init()
if(m_playlist == CollectionList::instance()) {
m_sortedFirst = true;
m_collectionItem = this;
if(dynamic_cast<TreeViewMode *>(list->viewMode())) {
kdDebug(65432) << "setting up categories" << endl;
static_cast<TreeViewMode *>(list->viewMode())->setupCategories();
}
}
}
......
......@@ -70,9 +70,6 @@ protected:
virtual void setupPlaylist(Playlist *playlist, const QString &iconName);
virtual void setupPlaylist(Playlist *playlist, const QString &iconName, Item *parentItem);
signals:
void signalCollectionInitialized();
private:
void readConfig();
void saveConfig();
......
......@@ -96,12 +96,6 @@ void ViewMode::paintCell(PlaylistBox::Item *item,
paintDropIndicator(painter, width, item->height());
}
PlaylistBox::Item *ViewMode::createSearchItem(PlaylistBox *box, SearchPlaylist *playlist,
const QString &)
{
return new PlaylistBox::Item(box, "midi", playlist->name(), playlist);
}
bool ViewMode::eventFilter(QObject *watched, QEvent *e)
{
if(m_visible && watched == m_playlistBox->viewport() && e->type() == QEvent::Resize) {
......@@ -263,14 +257,11 @@ void TreeViewMode::setShown(bool show)
if(show) {
PlaylistBox::Item *collectionItem = PlaylistBox::Item::collectionItem();
if(!collectionItem) {
connect(playlistBox(), SIGNAL(signalCollectionInitialized()),
this, SLOT(slotSetupCategories()));
if(!collectionItem)
return;
}
if(collectionItem && m_searchCategories.isEmpty())
slotSetupCategories();
setupCategories();
else {
for(QDictIterator<PlaylistBox::Item> it(m_searchCategories); it.current(); ++it)
it.current()->setVisible(true);
......@@ -282,12 +273,6 @@ void TreeViewMode::setShown(bool show)
}
}
PlaylistBox::Item *TreeViewMode::createSearchItem(PlaylistBox *, SearchPlaylist *playlist,
const QString &searchCategory)
{
return new PlaylistBox::Item(m_searchCategories[searchCategory], "midi", playlist->name(), playlist);
}
void TreeViewMode::setupCategory(const QString &searchCategory, const QStringList &members, int column, bool exact)
{
CollectionList *collection = CollectionList::instance();
......@@ -323,10 +308,9 @@ void TreeViewMode::setupCategory(const QString &searchCategory, const QStringLis
KApplication::restoreOverrideCursor();
}
void TreeViewMode::slotSetupCategories()
void TreeViewMode::setupCategories()
{
PlaylistBox::Item *i;
PlaylistBox::Item *collectionItem = PlaylistBox::Item::collectionItem();
i = new PlaylistBox::Item(collectionItem, "cdimage", i18n("Artists"));
......
......@@ -43,10 +43,6 @@ public:
const QColorGroup &colorGroup,
int column, int width, int align);
virtual PlaylistBox::Item *createSearchItem(PlaylistBox *box,
SearchPlaylist *playlist,
const QString &searchCategory);
virtual bool eventFilter(QObject *watched, QEvent *e);
......@@ -104,21 +100,11 @@ public:
virtual QString name() const { return i18n("Tree"); }
virtual void setShown(bool shown);
virtual PlaylistBox::Item *createSearchItem(PlaylistBox *box,
SearchPlaylist *playlist,
const QString &searchCategory);
void setupCategories();
private:
void setupCategory(const QString &searchCategory, const QStringList &members,
int column, bool exact = true);
private slots:
/**
* Setup all of the categories.
*/
void slotSetupCategories();
private:
QDict<PlaylistBox::Item> m_searchCategories;
};
......
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