Add a refresh action to Grooveshark
This commit is contained in:
parent
cb1b4483ea
commit
6f7e507b30
|
@ -416,6 +416,10 @@ void GroovesharkService::Authenticated() {
|
||||||
|
|
||||||
void GroovesharkService::Logout() {
|
void GroovesharkService::Logout() {
|
||||||
ResetSessionId();
|
ResetSessionId();
|
||||||
|
RemoveItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GroovesharkService::RemoveItems() {
|
||||||
root_->removeRows(0, root_->rowCount());
|
root_->removeRows(0, root_->rowCount());
|
||||||
// 'search', 'favorites', 'popular', ... items were root's children, and have
|
// 'search', 'favorites', 'popular', ... items were root's children, and have
|
||||||
// been deleted: we should update these now invalid pointers
|
// been deleted: we should update these now invalid pointers
|
||||||
|
@ -501,6 +505,8 @@ void GroovesharkService::EnsureMenuCreated() {
|
||||||
context_menu_->addAction(IconLoader::Load("edit-find"), tr("Search Grooveshark (opens a new tab)") + "...", this, SLOT(OpenSearchTab()));
|
context_menu_->addAction(IconLoader::Load("edit-find"), tr("Search Grooveshark (opens a new tab)") + "...", this, SLOT(OpenSearchTab()));
|
||||||
context_menu_->addSeparator();
|
context_menu_->addSeparator();
|
||||||
context_menu_->addAction(IconLoader::Load("download"), tr("Open %1 in browser").arg("grooveshark.com"), this, SLOT(Homepage()));
|
context_menu_->addAction(IconLoader::Load("download"), tr("Open %1 in browser").arg("grooveshark.com"), this, SLOT(Homepage()));
|
||||||
|
context_menu_->addAction(IconLoader::Load("view-refresh"), tr("Refresh"), this, SLOT(RefreshItems()));
|
||||||
|
context_menu_->addSeparator();
|
||||||
context_menu_->addAction(IconLoader::Load("configure"), tr("Configure Grooveshark..."), this, SLOT(ShowConfig()));
|
context_menu_->addAction(IconLoader::Load("configure"), tr("Configure Grooveshark..."), this, SLOT(ShowConfig()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -509,6 +515,11 @@ void GroovesharkService::Homepage() {
|
||||||
QDesktopServices::openUrl(QUrl(kHomepage));
|
QDesktopServices::openUrl(QUrl(kHomepage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroovesharkService::RefreshItems() {
|
||||||
|
RemoveItems();
|
||||||
|
EnsureItemsCreated();
|
||||||
|
}
|
||||||
|
|
||||||
void GroovesharkService::EnsureItemsCreated() {
|
void GroovesharkService::EnsureItemsCreated() {
|
||||||
if (IsLoggedIn() && !search_) {
|
if (IsLoggedIn() && !search_) {
|
||||||
search_ = new QStandardItem(IconLoader::Load("edit-find"),
|
search_ = new QStandardItem(IconLoader::Load("edit-find"),
|
||||||
|
|
|
@ -175,10 +175,13 @@ class GroovesharkService : public InternetService {
|
||||||
void SongMarkedAsComplete();
|
void SongMarkedAsComplete();
|
||||||
|
|
||||||
void Homepage();
|
void Homepage();
|
||||||
|
// Refresh all Grooveshark's items, and re-fill them
|
||||||
|
void RefreshItems();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EnsureMenuCreated();
|
void EnsureMenuCreated();
|
||||||
void EnsureItemsCreated();
|
void EnsureItemsCreated();
|
||||||
|
void RemoveItems();
|
||||||
void EnsureConnected();
|
void EnsureConnected();
|
||||||
|
|
||||||
// Create a playlist item, with data set as excepted. Doesn't fill the item
|
// Create a playlist item, with data set as excepted. Doesn't fill the item
|
||||||
|
|
Loading…
Reference in New Issue