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() {
|
||||
ResetSessionId();
|
||||
RemoveItems();
|
||||
}
|
||||
|
||||
void GroovesharkService::RemoveItems() {
|
||||
root_->removeRows(0, root_->rowCount());
|
||||
// 'search', 'favorites', 'popular', ... items were root's children, and have
|
||||
// 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_->addSeparator();
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
@ -509,6 +515,11 @@ void GroovesharkService::Homepage() {
|
|||
QDesktopServices::openUrl(QUrl(kHomepage));
|
||||
}
|
||||
|
||||
void GroovesharkService::RefreshItems() {
|
||||
RemoveItems();
|
||||
EnsureItemsCreated();
|
||||
}
|
||||
|
||||
void GroovesharkService::EnsureItemsCreated() {
|
||||
if (IsLoggedIn() && !search_) {
|
||||
search_ = new QStandardItem(IconLoader::Load("edit-find"),
|
||||
|
|
|
@ -175,10 +175,13 @@ class GroovesharkService : public InternetService {
|
|||
void SongMarkedAsComplete();
|
||||
|
||||
void Homepage();
|
||||
// Refresh all Grooveshark's items, and re-fill them
|
||||
void RefreshItems();
|
||||
|
||||
private:
|
||||
void EnsureMenuCreated();
|
||||
void EnsureItemsCreated();
|
||||
void RemoveItems();
|
||||
void EnsureConnected();
|
||||
|
||||
// Create a playlist item, with data set as excepted. Doesn't fill the item
|
||||
|
|
Loading…
Reference in New Issue