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:
parent
f1a0de0f53
commit
a82a8b2abe
@ -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 )
|
||||
{
|
||||
|
@ -97,6 +97,8 @@ private slots:
|
||||
void changePage( QListWidgetItem*, QListWidgetItem* );
|
||||
void serventReady();
|
||||
|
||||
void aclEntryClearButtonClicked();
|
||||
|
||||
void requiresRestart();
|
||||
|
||||
private:
|
||||
|
@ -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>
|
||||
|
@ -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:
|
||||
/**
|
||||
|
@ -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 &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user