void GoogleDriveService::ShowContextMenu(const QPoint& global_pos) {
  if (!context_menu_) {
    context_menu_.reset(new QMenu);
    context_menu_->addActions(GetPlaylistActions());
    open_in_drive_action_ = context_menu_->addAction(
        QIcon(":/providers/googledrive.png"), tr("Open in Google Drive"), this,
        SLOT(OpenWithDrive()));
    context_menu_->addSeparator();
    context_menu_->addAction(IconLoader::Load("download"), tr("Cover Manager"),
                             this, SLOT(ShowCoverManager()));
    context_menu_->addAction(IconLoader::Load("configure"), tr("Configure..."),
                             this, SLOT(ShowSettingsDialog()));
  }

  // Only show some actions if there are real songs selected
  bool songs_selected = false;
  for (const QModelIndex& index : model()->selected_indexes()) {
    const int type = index.data(LibraryModel::Role_Type).toInt();
    if (type == LibraryItem::Type_Song || type == LibraryItem::Type_Container) {
      songs_selected = true;
      break;
    }
  }

  open_in_drive_action_->setEnabled(songs_selected);

  context_menu_->popup(global_pos);
}
示例#2
0
void CloudFileService::ShowContextMenu(const QPoint& global_pos) {
  if (!context_menu_) {
    context_menu_.reset(new QMenu);
    context_menu_->addActions(GetPlaylistActions());
    context_menu_->addAction(
        IconLoader::Load("download"),
        tr("Cover Manager"),
        this,
        SLOT(ShowCoverManager()));
  }
  context_menu_->popup(global_pos);
}
void CloudFileService::ShowContextMenu(const QPoint& global_pos) {
  if (!context_menu_) {
    context_menu_.reset(new QMenu);
    context_menu_->addActions(GetPlaylistActions());
    context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), 
                             tr("Cover Manager"), this, 
                             SLOT(ShowCoverManager()));
    context_menu_->addSeparator();
    context_menu_->addAction(IconLoader::Load("configure", IconLoader::Base), 
                             tr("Configure..."), this, 
                             SLOT(ShowSettingsDialog()));
  }
  context_menu_->popup(global_pos);
}