Commit 8256c440 authored by Scott Wheeler's avatar Scott Wheeler

Slightly modified patch from Michael Pyne to fix #66485 where item text was

not being shown in the default view mode after hiding in the system tray and
restoring.

CCMAIL:66485-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=271075
parent 613ecdbf
......@@ -60,6 +60,7 @@ PlaylistBox::PlaylistBox(PlaylistSplitter *parent, const QString &name) :
// Find the main window and then get the associated KActionCollection.
QObject *w = parent;
while(w && !dynamic_cast<KMainWindow *>(w))
w = w->parent();
......@@ -121,6 +122,7 @@ void PlaylistBox::createItem(Playlist *playlist, const char *icon, bool raise, b
Item *i = new Item(this, icon, playlist->name(), playlist);
setupItem(i, playlist);
viewMode()->queueRefresh();
if(raise) {
setSingleItem(i);
......@@ -248,8 +250,10 @@ void PlaylistBox::rename(Item *item)
// Telling the playlist to change it's name will emit a signal that
// is connected to Item::slotSetName().
if(item->playlist())
if(item->playlist()) {
item->playlist()->setName(name);
viewMode()->queueRefresh();
}
sort();
setSelected(item, true);
......
......@@ -32,7 +32,8 @@
ViewMode::ViewMode(PlaylistBox *b) : QObject(b),
m_playlistBox(b),
m_visible(false)
m_visible(false),
m_needsRefresh(false)
{
connect(this, SIGNAL(signalCreateSearchList(const PlaylistSearch &, const QString &, const QString &)),
b, SIGNAL(signalCreateSearchList(const PlaylistSearch &, const QString &, const QString &)));
......@@ -53,6 +54,9 @@ void ViewMode::paintCell(PlaylistBox::Item *i,
if(width < i->pixmap(column)->width())
return;
if(m_needsRefresh)
updateHeights();
PlaylistBox::Item *item = static_cast<PlaylistBox::Item *>(i);
QFontMetrics fm = painter->fontMetrics();
......@@ -89,15 +93,15 @@ PlaylistBox::Item *ViewMode::createSearchItem(PlaylistBox *box, SearchPlaylist *
bool ViewMode::eventFilter(QObject *watched, QEvent *e)
{
if(m_visible &&
watched == m_playlistBox->viewport() &&
e->type() == QEvent::Resize)
{
if(m_visible && watched == m_playlistBox->viewport() && e->type() == QEvent::Resize) {
QResizeEvent *re = static_cast<QResizeEvent *>(e);
if(re->size().width() != re->oldSize().width())
updateHeights();
m_needsRefresh = true;
}
if(e->type() == QEvent::Hide)
m_needsRefresh = true;
return QObject::eventFilter(watched, e);
}
......@@ -106,7 +110,7 @@ void ViewMode::setShown(bool shown)
m_visible = shown;
if(shown) {
updateIcons(32);
updateHeights();
m_needsRefresh = true;
}
}
......@@ -132,6 +136,8 @@ void ViewMode::updateHeights()
i->setHeight(height);
i->invalidateHeight();
}
m_needsRefresh = false;
}
QStringList ViewMode::lines(const PlaylistBox::Item *item,
......
......@@ -53,6 +53,9 @@ public:
virtual bool eventFilter(QObject *watched, QEvent *e);
void queueRefresh() { m_needsRefresh = true; }
protected:
PlaylistBox *playlistBox() const { return m_playlistBox; }
bool visible() const { return m_visible; }
......@@ -72,6 +75,7 @@ private:
PlaylistBox *m_playlistBox;
bool m_visible;
bool m_needsRefresh;
QMap<PlaylistBox::Item *, QStringList> m_lines;
};
......
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