mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Add ACL-clearing button to settings
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
#include <QtGui/QSizeGrip>
|
#include <QtGui/QSizeGrip>
|
||||||
|
|
||||||
#include "AtticaManager.h"
|
#include "AtticaManager.h"
|
||||||
|
#include "AclRegistry.h"
|
||||||
#include "TomahawkApp.h"
|
#include "TomahawkApp.h"
|
||||||
#include "TomahawkSettings.h"
|
#include "TomahawkSettings.h"
|
||||||
#include "accounts/DelegateConfigWrapper.h"
|
#include "accounts/DelegateConfigWrapper.h"
|
||||||
@@ -98,6 +99,8 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
|||||||
ui->enableProxyCheckBox->setChecked( useProxy );
|
ui->enableProxyCheckBox->setChecked( useProxy );
|
||||||
ui->proxyButton->setEnabled( useProxy );
|
ui->proxyButton->setEnabled( useProxy );
|
||||||
|
|
||||||
|
ui->aclEntryClearButton->setEnabled( TomahawkSettings::instance()->aclEntries().size() > 0 );
|
||||||
|
connect( ui->aclEntryClearButton, SIGNAL( clicked( bool ) ), this, SLOT( aclEntryClearButtonClicked() ) );
|
||||||
|
|
||||||
createIcons();
|
createIcons();
|
||||||
#ifdef Q_WS_X11
|
#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
|
void
|
||||||
SettingsDialog::scrollTo( const QModelIndex& idx )
|
SettingsDialog::scrollTo( const QModelIndex& idx )
|
||||||
{
|
{
|
||||||
|
@@ -97,6 +97,8 @@ private slots:
|
|||||||
void changePage( QListWidgetItem*, QListWidgetItem* );
|
void changePage( QListWidgetItem*, QListWidgetItem* );
|
||||||
void serventReady();
|
void serventReady();
|
||||||
|
|
||||||
|
void aclEntryClearButtonClicked();
|
||||||
|
|
||||||
void requiresRestart();
|
void requiresRestart();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -418,6 +418,30 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@@ -99,17 +99,15 @@ public slots:
|
|||||||
* @return ACLRegistry::ACL
|
* @return ACLRegistry::ACL
|
||||||
**/
|
**/
|
||||||
ACLRegistry::ACL isAuthorizedUser( const QString &dbid, const QString &username, ACLRegistry::ACL globalType = ACLRegistry::NotFound, bool skipEmission = false );
|
ACLRegistry::ACL isAuthorizedUser( const QString &dbid, const QString &username, ACLRegistry::ACL globalType = ACLRegistry::NotFound, bool skipEmission = false );
|
||||||
|
void wipeEntries();
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
void getUserDecision( ACLRegistry::User user, const QString &username );
|
void getUserDecision( ACLRegistry::User user, const QString &username );
|
||||||
#endif
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
#ifndef ENABLE_HEADLESS
|
|
||||||
void userDecision( ACLRegistry::User user );
|
void userDecision( ACLRegistry::User user );
|
||||||
void queueNextJob();
|
void queueNextJob();
|
||||||
#endif
|
#endif
|
||||||
void wipeEntries();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@@ -119,6 +119,8 @@ AclJobDelegate::drawRoundedButton( QPainter* painter, const QRect& btnRect, bool
|
|||||||
bool
|
bool
|
||||||
AclJobDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
|
AclJobDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( option )
|
||||||
|
Q_UNUSED( model )
|
||||||
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||||
if ( event->type() != QEvent::MouseButtonPress &&
|
if ( event->type() != QEvent::MouseButtonPress &&
|
||||||
event->type() != QEvent::MouseButtonRelease &&
|
event->type() != QEvent::MouseButtonRelease &&
|
||||||
|
Reference in New Issue
Block a user