Commit e225bf7e authored by Michael Pyne's avatar Michael Pyne

Finally get the "Time" column to show up in the history playlist.

Between Qt 3 and Qt 4 the behavior of QWidget::polish() changed. What used to happen is
that HistoryPlaylist created the first column (column 0) during construction by putting its
addColumn call in HistoryPlaylist::polish(), which somehow got called before the Playlist
class added its columns.

In Qt 4 the polish method seems to have gone away, so we have to take different measures to
ensure that the HistoryPlaylist gets first dibs on making columns. We do this by altering
the ctor in Playlist to add placeholder columns for subclasses to control later.

This fixes a long-standing JuK bug (since KDE 4.0) that doesn't seem to actually have been
opened in b.k.o.

svn path=/trunk/KDE/kdemultimedia/juk/; revision=1136889
parent faf5e09f
......@@ -29,13 +29,16 @@
////////////////////////////////////////////////////////////////////////////////
HistoryPlaylist::HistoryPlaylist(PlaylistCollection *collection) :
Playlist(collection, true),
Playlist(collection, true, 1),
m_timer(new QTimer(this))
{
setAllowDuplicates(true);
m_timer->setSingleShot(true);
connect(m_timer, SIGNAL(timeout()), this, SLOT(slotCreateNewItem()));
setSorting(-1);
setColumnText(0, i18n("Time"));
}
HistoryPlaylist::~HistoryPlaylist()
......@@ -56,17 +59,6 @@ void HistoryPlaylist::createItems(const PlaylistItemList &siblings)
Playlist::createItems<HistoryPlaylistItem, PlaylistItem>(siblings);
}
////////////////////////////////////////////////////////////////////////////////
// HistoryPlaylist protected members
////////////////////////////////////////////////////////////////////////////////
void HistoryPlaylist::polish()
{
addColumn(i18n("Time"));
Playlist::ensurePolished();
setSorting(-1);
}
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////
......
......@@ -56,9 +56,6 @@ public slots:
void clear() {}
void appendProposedItem(const FileHandle &file);
protected:
virtual void polish();
private slots:
void slotCreateNewItem();
......
......@@ -19,6 +19,7 @@
#include "playlist.h"
#include "juk-exception.h"
#include <q3header.h>
#include <kconfig.h>
#include <kapplication.h>
#include <kmessagebox.h>
......@@ -390,7 +391,7 @@ Playlist::Playlist(PlaylistCollection *collection, const QFileInfo &playlistFile
collection->setupPlaylist(this, iconName);
}
Playlist::Playlist(PlaylistCollection *collection, bool delaySetup) :
Playlist::Playlist(PlaylistCollection *collection, bool delaySetup, int extraColumns) :
K3ListView(collection->playlistStack()),
m_collection(collection),
m_fetcher(new WebImageFetcher(this)),
......@@ -407,6 +408,10 @@ Playlist::Playlist(PlaylistCollection *collection, bool delaySetup) :
m_toolTip(0),
m_blockDataChanged(false)
{
for(int i = 0; i < extraColumns; ++i) {
addColumn(i18n("JuK")); // Placeholder text!
}
setup();
if(!delaySetup)
......
......@@ -65,8 +65,13 @@ public:
* This constructor should generally only be used either by the cache
* restoration methods or by subclasses that want to handle calls to
* PlaylistCollection::setupPlaylist() differently.
*
* @param extraColumns is used to preallocate columns for subclasses that
* need them (since extra columns are assumed to start from 0). extraColumns
* should be equal to columnOffset() (we can't use columnOffset until the
* ctor has run).
*/
Playlist(PlaylistCollection *collection, bool delaySetup);
Playlist(PlaylistCollection *collection, bool delaySetup, int extraColumns = 0);
virtual ~Playlist();
......
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