mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 13:30:36 -04:00
Workaround for erroneously accept of Qt::Key_Delete on QAbstractItemView
see http://bugreports.qt.nokia.com/browse/QTBUG-8270 solved for PeersDialog, MessagesDialog and TransfersDialog git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2858 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
47f97e20b9
commit
aae947ecd8
6 changed files with 72 additions and 44 deletions
|
@ -105,6 +105,11 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||
|
||||
ui.downloadList->setAutoScroll(false) ;
|
||||
|
||||
// workaround for Qt bug, should be solved in next Qt release 4.7.0
|
||||
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
|
||||
QShortcut *Shortcut = new QShortcut(QKeySequence (Qt::Key_Delete), ui.downloadList, 0, 0, Qt::WidgetShortcut);
|
||||
connect(Shortcut, SIGNAL(activated()), this, SLOT( cancel ()));
|
||||
|
||||
//Selection Setup
|
||||
selection = ui.downloadList->selectionModel();
|
||||
|
||||
|
@ -257,16 +262,17 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||
connect( playAct , SIGNAL( triggered() ), this, SLOT( openTransfer() ) );
|
||||
}
|
||||
|
||||
void TransfersDialog::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if(e->key() == Qt::Key_Delete)
|
||||
{
|
||||
cancel() ;
|
||||
e->accept() ;
|
||||
}
|
||||
else
|
||||
RsAutoUpdatePage::keyPressEvent(e) ;
|
||||
}
|
||||
// replaced by shortcut
|
||||
//void TransfersDialog::keyPressEvent(QKeyEvent *e)
|
||||
//{
|
||||
// if(e->key() == Qt::Key_Delete)
|
||||
// {
|
||||
// cancel() ;
|
||||
// e->accept() ;
|
||||
// }
|
||||
// else
|
||||
// RsAutoUpdatePage::keyPressEvent(e) ;
|
||||
//}
|
||||
|
||||
void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
{
|
||||
|
@ -877,18 +883,25 @@ QString TransfersDialog::getPeerName(const std::string& id) const
|
|||
|
||||
void TransfersDialog::cancel()
|
||||
{
|
||||
QString queryWrn2;
|
||||
queryWrn2.clear();
|
||||
queryWrn2.append(tr("Are you sure that you want to cancel and delete these files?"));
|
||||
bool first = true;
|
||||
for(int i = 0; i < DLListModel->rowCount(); i++) {
|
||||
if(selection->isRowSelected(i, QModelIndex())) {
|
||||
if (first) {
|
||||
first = false;
|
||||
QString queryWrn2;
|
||||
queryWrn2.clear();
|
||||
queryWrn2.append(tr("Are you sure that you want to cancel and delete these files?"));
|
||||
|
||||
if ((QMessageBox::question(this, tr("RetroShare"),queryWrn2,QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok))== QMessageBox::Ok)
|
||||
for(int i = 0; i <= DLListModel->rowCount(); i++)
|
||||
if(selection->isRowSelected(i, QModelIndex()))
|
||||
{
|
||||
std::string id = getID(i, DLListModel).toStdString();
|
||||
if ((QMessageBox::question(this, tr("RetroShare"),queryWrn2,QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)) == QMessageBox::No) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rsFiles->FileCancel(id); /* hash */
|
||||
}
|
||||
std::string id = getID(i, DLListModel).toStdString();
|
||||
|
||||
rsFiles->FileCancel(id); /* hash */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//void TransfersDialog::handleDownloadRequest(const QString& url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue