diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp index 54fab5fa5..f8d3860f9 100644 --- a/src/SettingsDialog.cpp +++ b/src/SettingsDialog.cpp @@ -30,6 +30,7 @@ #include #include "AtticaManager.h" +#include "AclRegistry.h" #include "TomahawkApp.h" #include "TomahawkSettings.h" #include "accounts/DelegateConfigWrapper.h" @@ -98,6 +99,8 @@ SettingsDialog::SettingsDialog( QWidget *parent ) ui->enableProxyCheckBox->setChecked( useProxy ); ui->proxyButton->setEnabled( useProxy ); + ui->aclEntryClearButton->setEnabled( TomahawkSettings::instance()->aclEntries().size() > 0 ); + connect( ui->aclEntryClearButton, SIGNAL( clicked( bool ) ), this, SLOT( aclEntryClearButtonClicked() ) ); createIcons(); #ifdef Q_WS_X11 @@ -497,6 +500,24 @@ SettingsDialog::installFromFile() } +void +SettingsDialog::aclEntryClearButtonClicked() +{ + QMessageBox::StandardButton button = QMessageBox::question( + ui->stackedWidget, + tr( "Delete all Access Control entries?" ), + tr( "Do you really want to delete all Access Control entries? You will be be asked for a decision again for each peer that you connect to." ), + QMessageBox::Ok | QMessageBox::Cancel, + QMessageBox::Ok + ); + if ( button == QMessageBox::Ok ) + { + ACLRegistry::instance()->wipeEntries(); + ui->aclEntryClearButton->setEnabled( false ); + } +} + + void SettingsDialog::scrollTo( const QModelIndex& idx ) { diff --git a/src/SettingsDialog.h b/src/SettingsDialog.h index cbd8eb724..487f6e4ae 100644 --- a/src/SettingsDialog.h +++ b/src/SettingsDialog.h @@ -97,6 +97,8 @@ private slots: void changePage( QListWidgetItem*, QListWidgetItem* ); void serventReady(); + void aclEntryClearButtonClicked(); + void requiresRestart(); private: diff --git a/src/StackedSettingsDialog.ui b/src/StackedSettingsDialog.ui index 9c1d9ef37..08dcdf48b 100644 --- a/src/StackedSettingsDialog.ui +++ b/src/StackedSettingsDialog.ui @@ -418,6 +418,30 @@ + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Clear All Access Control Entries + + + + + diff --git a/src/libtomahawk/AclRegistry.h b/src/libtomahawk/AclRegistry.h index 37011ec48..f2ee66997 100644 --- a/src/libtomahawk/AclRegistry.h +++ b/src/libtomahawk/AclRegistry.h @@ -99,17 +99,15 @@ public slots: * @return ACLRegistry::ACL **/ ACLRegistry::ACL isAuthorizedUser( const QString &dbid, const QString &username, ACLRegistry::ACL globalType = ACLRegistry::NotFound, bool skipEmission = false ); - + void wipeEntries(); + #ifndef ENABLE_HEADLESS void getUserDecision( ACLRegistry::User user, const QString &username ); -#endif private slots: -#ifndef ENABLE_HEADLESS void userDecision( ACLRegistry::User user ); void queueNextJob(); #endif - void wipeEntries(); private: /** diff --git a/src/libtomahawk/jobview/AclJobItem.cpp b/src/libtomahawk/jobview/AclJobItem.cpp index 12a46bab1..81f9869d8 100644 --- a/src/libtomahawk/jobview/AclJobItem.cpp +++ b/src/libtomahawk/jobview/AclJobItem.cpp @@ -119,6 +119,8 @@ AclJobDelegate::drawRoundedButton( QPainter* painter, const QRect& btnRect, bool bool AclJobDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index ) { + Q_UNUSED( option ) + Q_UNUSED( model ) //tDebug( LOGVERBOSE ) << Q_FUNC_INFO; if ( event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseButtonRelease &&