Commit a918d34d authored by Sebastian Sauer's avatar Sebastian Sauer

* fix crash on startup if treeviewmode was chosen

* fix crash on startup if another juk-instance was running already
* made switching viewmodes working again


svn path=/trunk/KDE/kdemultimedia/juk/; revision=880034
parent 48f038db
......@@ -77,8 +77,10 @@ JuK::JuK(QWidget *parent) :
readSettings();
if(m_showSplash && !m_startDocked && Cache::cacheFileExists()) {
SplashScreen::instance()->show();
kapp->processEvents();
if(SplashScreen* splash = SplashScreen::instance()) {
SplashScreen::instance()->show();
kapp->processEvents();
}
}
setupActions();
......
......@@ -107,26 +107,17 @@ PlaylistBox::PlaylistBox(QWidget *parent, Q3WidgetStack *playlistStack) :
new KSelectAction( KIcon("view-choose"), i18n("View Modes"), ActionCollection::actions());
ActionCollection::actions()->addAction("viewModeMenu", viewModeAction);
m_viewModes.append(new ViewMode(this));
m_viewModes.append(new CompactViewMode(this));
m_viewModes.append(new TreeViewMode(this));
ViewMode* viewmode = new ViewMode(this);
m_viewModes.append(viewmode);
viewModeAction->addAction(KIcon("view-list-details"), viewmode->name());
QStringList modeNames;
CompactViewMode* compactviewmode = new CompactViewMode(this);
m_viewModes.append(compactviewmode);
viewModeAction->addAction(KIcon("view-list-text"), compactviewmode->name());
for(QList<ViewMode *>::Iterator it = m_viewModes.begin(); it != m_viewModes.end(); ++it)
modeNames.append((*it)->name());
viewModeAction->setItems(modeNames);
#ifdef __GNUC__
#warning This needs to be ported to proper QActions
#endif
#if 0
QMenu *p = viewModeAction->menu();
p->changeItem(0, SmallIconSet("view-list-details"), modeNames[0]);
p->changeItem(1, SmallIconSet("view-list-text"), modeNames[1]);
p->changeItem(2, SmallIconSet("view-list-tree"), modeNames[2]);
#endif
TreeViewMode* treeviewmode = new TreeViewMode(this);
m_viewModes.append(treeviewmode);
viewModeAction->addAction(KIcon("view-list-tree"), treeviewmode->name());
CollectionList::initialize(this);
......@@ -137,7 +128,7 @@ PlaylistBox::PlaylistBox(QWidget *parent, Q3WidgetStack *playlistStack) :
raise(CollectionList::instance());
m_contextMenu->addAction( viewModeAction );
connect(viewModeAction, SIGNAL(activated(int)), this, SLOT(slotSetViewMode(int)));
connect(viewModeAction, SIGNAL(triggered(int)), this, SLOT(slotSetViewMode(int)));
connect(this, SIGNAL(selectionChanged()),
this, SLOT(slotPlaylistChanged()));
......
......@@ -64,7 +64,8 @@ PlaylistObserver::~PlaylistObserver()
PlaylistObserver::PlaylistObserver(PlaylistInterface *playlist) :
m_playlist(playlist)
{
playlist->addObserver(this);
if(m_playlist)
playlist->addObserver(this);
}
const PlaylistInterface *PlaylistObserver::playlist() const
......
......@@ -412,13 +412,13 @@ void TreeViewMode::setupDynamicPlaylists()
PlaylistBox::Item *i;
PlaylistBox::Item *collectionItem = PlaylistBox::Item::collectionItem();
i = new PlaylistBox::Item(collectionItem, "cdimage", i18n("Artists"));
i = new PlaylistBox::Item(collectionItem, "media-optical-audio", i18n("Artists"));
m_searchCategories.insert("artists", i);
i = new PlaylistBox::Item(collectionItem, "cdimage", i18n("Albums"));
i = new PlaylistBox::Item(collectionItem, "media-optical-audio", i18n("Albums"));
m_searchCategories.insert("albums", i);
i = new PlaylistBox::Item(collectionItem, "cdimage", i18n("Genres"));
i = new PlaylistBox::Item(collectionItem, "media-optical-audio", i18n("Genres"));
m_searchCategories.insert("genres", i);
}
......
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