Skip to content
Permalink
Browse files

[auth] Redesign Authentication section of Options

- Separate management options from auth config table
- Add standalone certificate manager
- Add installed auth method plugin dialog, indicating usage per plugin
  • Loading branch information
dakcarto committed Sep 24, 2015
1 parent b6459b0 commit 0975c9f7aa55ca9e2507ebeabca01127da251063
@@ -0,0 +1,25 @@
class QgsAuthCertEditors : QWidget
{
%TypeHeaderCode
#include <qgsauthcertificatemanager.h>
%End

public:
explicit QgsAuthCertEditors( QWidget *parent /TransferThis/ = 0 );

~QgsAuthCertEditors();
};

class QgsAuthCertManager : QDialog
{
%TypeHeaderCode
#include <qgsauthcertificatemanager.h>
%End

public:
explicit QgsAuthCertManager( QWidget *parent /TransferThis/ = 0 );

~QgsAuthCertManager();

QgsAuthCertEditors *certEditorsWidget();
};
@@ -5,9 +5,14 @@ class QgsAuthConfigEditor : QWidget
%End

public:
explicit QgsAuthConfigEditor( QWidget *parent /TransferThis/ = 0 );
explicit QgsAuthConfigEditor( QWidget *parent /TransferThis/ = 0, bool showUtilities = true, QgsMessageBar *msgbar /TransferThis/ = 0 );
~QgsAuthConfigEditor();

void toggleTitleVisibility( bool visible );

public slots:

void showUtilitiesButton( bool show = true );

void setMessageBar( QgsMessageBar *msgbar /TransferThis/ = 0 );
};
@@ -1,3 +1,16 @@
class QgsAuthMethodPlugins : QDialog
{
%TypeHeaderCode
#include <qgsautheditorwidgets.h>
%End

public:
explicit QgsAuthMethodPlugins( QWidget *parent /TransferThis/ = 0 );

~QgsAuthMethodPlugins();
};


class QgsAuthEditorWidgets : QWidget
{
%TypeHeaderCode
@@ -8,6 +21,4 @@ class QgsAuthEditorWidgets : QWidget
explicit QgsAuthEditorWidgets( QWidget *parent /TransferThis/ = 0 );

~QgsAuthEditorWidgets();

QTabWidget * tabbedWidget();
};
@@ -143,6 +143,7 @@

%Include auth/qgsauthauthoritieseditor.sip
%Include auth/qgsauthcertificateinfo.sip
%Include auth/qgsauthcertificatemanager.sip
%Include auth/qgsauthcerttrustpolicycombobox.sip
%Include auth/qgsauthconfigeditor.sip
%Include auth/qgsauthconfigselect.sip
@@ -61,10 +61,12 @@ SET(QGIS_GUI_SRCS

auth/qgsauthauthoritieseditor.cpp
auth/qgsauthcertificateinfo.cpp
auth/qgsauthcertificatemanager.cpp
auth/qgsauthcerttrustpolicycombobox.cpp
auth/qgsauthconfigedit.cpp
auth/qgsauthconfigeditor.cpp
auth/qgsauthconfigselect.cpp
auth/qgsautheditorwidgets.cpp
auth/qgsauthguiutils.cpp
auth/qgsauthidentitieseditor.cpp
auth/qgsauthimportcertdialog.cpp
@@ -444,6 +446,7 @@ SET(QGIS_GUI_MOC_HDRS

auth/qgsauthauthoritieseditor.h
auth/qgsauthcertificateinfo.h
auth/qgsauthcertificatemanager.h
auth/qgsauthcerttrustpolicycombobox.h
auth/qgsauthconfigedit.h
auth/qgsauthconfigeditor.h
@@ -560,6 +563,7 @@ SET(QGIS_GUI_HDRS

auth/qgsauthauthoritieseditor.h
auth/qgsauthcertificateinfo.h
auth/qgsauthcertificatemanager.h
auth/qgsauthcerttrustpolicycombobox.h
auth/qgsauthconfigedit.h
auth/qgsauthconfigeditor.h
@@ -0,0 +1,56 @@
/***************************************************************************
qgsauthcertificatemanager.cpp
---------------------
begin : September, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsauthcertificatemanager.h"

#include <QDialog>
#include <QDialogButtonBox>
#include <QPushButton>

QgsAuthCertEditors::QgsAuthCertEditors( QWidget *parent )
: QWidget( parent )
{
setupUi( this );
}

QgsAuthCertEditors::~QgsAuthCertEditors()
{
}



QgsAuthCertManager::QgsAuthCertManager( QWidget *parent )
: QDialog( parent )
{
setWindowTitle( tr( "Certificate Manager" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 6 );

mCertEditors = new QgsAuthCertEditors( this );
layout->addWidget( mCertEditors );

QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close,
Qt::Horizontal, this );
buttonBox->button( QDialogButtonBox::Close )->setDefault( true );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
layout->addWidget( buttonBox );

setLayout( layout );
}

QgsAuthCertManager::~QgsAuthCertManager()
{
}
@@ -0,0 +1,69 @@
/***************************************************************************
qgsauthcertificatemanager.h
---------------------
begin : September, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSAUTHCERTIFICATEMANAGER_H
#define QGSAUTHCERTIFICATEMANAGER_H

#include "ui_qgsauthcertificatemanager.h"

#include <QWidget>
#include <QDialog>


/** \ingroup gui
* Wrapper widget to manage available certificate editors
*/
class GUI_EXPORT QgsAuthCertEditors : public QWidget, private Ui::QgsAuthCertManager
{
Q_OBJECT

public:
/**
* Construct a widget to contain various certificate editors
* @param parent Parent widget
*/
explicit QgsAuthCertEditors( QWidget *parent = 0 );

~QgsAuthCertEditors();
};


//////////////// Embed in dialog ///////////////////

/** \ingroup gui
* Dialog wrapper for widget to manage available certificate editors
*/
class GUI_EXPORT QgsAuthCertManager : public QDialog
{
Q_OBJECT

public:
/**
* Construct a dialog wrapper for widget to manage available certificate editors
* @param parent Parent widget
*/
explicit QgsAuthCertManager( QWidget *parent = 0 );

~QgsAuthCertManager();

/** Get access to embedded editors widget */
QgsAuthCertEditors *certEditorsWidget() { return mCertEditors; }

private:
QgsAuthCertEditors *mCertEditors;
};

#endif // QGSAUTHCERTIFICATEMANAGER_H
@@ -26,7 +26,7 @@
#include "qgsauthconfigedit.h"
#include "qgsauthguiutils.h"

QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent, bool showUtilities, QgsMessageBar *msgbar )
: QWidget( parent )
, mConfigModel( 0 )
, mAuthUtilitiesMenu( 0 )
@@ -49,6 +49,10 @@ QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
else
{
setupUi( this );

setMessageBar( msgbar );
showUtilitiesButton( showUtilities );

mConfigModel = new QSqlTableModel( this, QgsAuthManager::instance()->authDbConnection() );
mConfigModel->setTable( QgsAuthManager::instance()->authDbConfigTable() );
mConfigModel->select();
@@ -113,6 +117,7 @@ QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
mAuthUtilitiesMenu->addAction( mActionEraseAuthDatabase );

btnAuthUtilities->setMenu( mAuthUtilitiesMenu );
lblAuthConfigDb->setVisible( false );
}
}

@@ -164,6 +169,20 @@ void QgsAuthConfigEditor::toggleTitleVisibility( bool visible )
}
}

void QgsAuthConfigEditor::showUtilitiesButton( bool show )
{
btnAuthUtilities->setVisible( show );
}

void QgsAuthConfigEditor::setMessageBar( QgsMessageBar *msgbar )
{
if ( msgbar )
{
delete mMsgBar;
mMsgBar = msgbar;
}
}

void QgsAuthConfigEditor::refreshTableView()
{
mConfigModel->select();
@@ -35,13 +35,22 @@ class GUI_EXPORT QgsAuthConfigEditor : public QWidget, private Ui::QgsAuthConfig
public:
/**
* Widget for editing authentication configurations directly in database
* @param showUtilities Whether to show the widget's utilities button
* @param msgbar Substitute internal message bar for another
*/
explicit QgsAuthConfigEditor( QWidget *parent = 0 );
explicit QgsAuthConfigEditor( QWidget *parent = 0, bool showUtilities = true, QgsMessageBar *msgbar = 0 );
~QgsAuthConfigEditor();

/** Hide the widget's title, e.g. when embedding */
void toggleTitleVisibility( bool visible );

public slots:
/** Whether to show the widget's utilities button, e.g. when embedding */
void showUtilitiesButton( bool show = true );

/** Substitute internal message bar for another, e.g. when embedding */
void setMessageBar( QgsMessageBar *msgbar = 0 );

private slots:
/** Repopulate the view with table contents */
void refreshTableView();

0 comments on commit 0975c9f

Please sign in to comment.
You can’t perform that action at this time.