1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-05 14:28:40 +01:00

Ask for confirmation also on tab close button for now

This commit is contained in:
Andrea Decorte 2011-06-26 12:30:19 +00:00
parent 1df5db5ee3
commit a36d0706b5
2 changed files with 9 additions and 9 deletions

View File

@ -38,7 +38,7 @@ PlaylistTabBar::PlaylistTabBar(QWidget *parent)
menu_index_(-1), menu_index_(-1),
suppress_current_changed_(false), suppress_current_changed_(false),
rename_editor_(new RenameTabLineEdit(this)), rename_editor_(new RenameTabLineEdit(this)),
removing_from_menu_(true) removing_with_confirm_(true)
{ {
setAcceptDrops(true); setAcceptDrops(true);
setElideMode(Qt::ElideRight); setElideMode(Qt::ElideRight);
@ -92,7 +92,7 @@ void PlaylistTabBar::mouseReleaseEvent(QMouseEvent* e) {
// Update menu index // Update menu index
menu_index_ = tabAt(e->pos()); menu_index_ = tabAt(e->pos());
// So we don't ask for confirmation // So we don't ask for confirmation
removing_from_menu_ = false; removing_with_confirm_ = false;
Remove(); Remove();
} }
@ -154,22 +154,22 @@ void PlaylistTabBar::Remove() {
if (menu_index_ == -1) if (menu_index_ == -1)
return; return;
// Ask for confirmation only when we arrive here by clicking in the menu // Ask for confirmation if not middle clicking the tab
if (removing_from_menu_ && QMessageBox::question(this, tr("Remove playlist"), if (removing_with_confirm_ && QMessageBox::question(this, tr("Remove playlist"),
tr("This playlist will be removed; the action can't be undone. " tr("This playlist will be removed; the action can't be undone. "
"Are you sure you want to continue?"), "Are you sure you want to continue?"),
QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes)
return; return;
removing_from_menu_ = true; removing_with_confirm_ = true;
emit Remove(tabData(menu_index_).toInt()); emit Remove(tabData(menu_index_).toInt());
} }
void PlaylistTabBar::RemoveFromTabIndex(int index) { void PlaylistTabBar::RemoveFromTabIndex(int index) {
// Update the global index // Update the global index
menu_index_ = index; menu_index_ = index;
// So we don't ask for confirmation // Ask for confirmation
removing_from_menu_ = false; removing_with_confirm_ = true;
Remove(); Remove();
} }

View File

@ -99,8 +99,8 @@ private:
// Editor for inline renaming // Editor for inline renaming
RenameTabLineEdit* rename_editor_; RenameTabLineEdit* rename_editor_;
// We want to ask confirmation only after a menu click // We want to ask for confirmation only in certain cases
bool removing_from_menu_; bool removing_with_confirm_;
}; };
#endif // PLAYLISTTABBAR_H #endif // PLAYLISTTABBAR_H