1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 23:39:42 +01:00

Add ACL-clearing button to settings

This commit is contained in:
Jeff Mitchell 2012-06-18 01:03:34 -04:00
parent f1a0de0f53
commit a82a8b2abe
5 changed files with 51 additions and 4 deletions

View File

@ -30,6 +30,7 @@
#include <QtGui/QSizeGrip>
#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 )
{

View File

@ -97,6 +97,8 @@ private slots:
void changePage( QListWidgetItem*, QListWidgetItem* );
void serventReady();
void aclEntryClearButtonClicked();
void requiresRestart();
private:

View File

@ -418,6 +418,30 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="aclEntryClearLayout">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="aclEntryClearButton">
<property name="text">
<string>Clear All Access Control Entries</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@ -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:
/**

View File

@ -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 &&