Skip to content

Commit 0975c9f

Browse files
committedSep 24, 2015
[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
1 parent b6459b0 commit 0975c9f

14 files changed

+766
-110
lines changed
 
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
class QgsAuthCertEditors : QWidget
2+
{
3+
%TypeHeaderCode
4+
#include <qgsauthcertificatemanager.h>
5+
%End
6+
7+
public:
8+
explicit QgsAuthCertEditors( QWidget *parent /TransferThis/ = 0 );
9+
10+
~QgsAuthCertEditors();
11+
};
12+
13+
class QgsAuthCertManager : QDialog
14+
{
15+
%TypeHeaderCode
16+
#include <qgsauthcertificatemanager.h>
17+
%End
18+
19+
public:
20+
explicit QgsAuthCertManager( QWidget *parent /TransferThis/ = 0 );
21+
22+
~QgsAuthCertManager();
23+
24+
QgsAuthCertEditors *certEditorsWidget();
25+
};

‎python/gui/auth/qgsauthconfigeditor.sip

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ class QgsAuthConfigEditor : QWidget
55
%End
66

77
public:
8-
explicit QgsAuthConfigEditor( QWidget *parent /TransferThis/ = 0 );
8+
explicit QgsAuthConfigEditor( QWidget *parent /TransferThis/ = 0, bool showUtilities = true, QgsMessageBar *msgbar /TransferThis/ = 0 );
99
~QgsAuthConfigEditor();
1010

1111
void toggleTitleVisibility( bool visible );
1212

13+
public slots:
14+
15+
void showUtilitiesButton( bool show = true );
16+
17+
void setMessageBar( QgsMessageBar *msgbar /TransferThis/ = 0 );
1318
};

‎python/gui/auth/qgsautheditorwidgets.sip

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
class QgsAuthMethodPlugins : QDialog
2+
{
3+
%TypeHeaderCode
4+
#include <qgsautheditorwidgets.h>
5+
%End
6+
7+
public:
8+
explicit QgsAuthMethodPlugins( QWidget *parent /TransferThis/ = 0 );
9+
10+
~QgsAuthMethodPlugins();
11+
};
12+
13+
114
class QgsAuthEditorWidgets : QWidget
215
{
316
%TypeHeaderCode
@@ -8,6 +21,4 @@ class QgsAuthEditorWidgets : QWidget
821
explicit QgsAuthEditorWidgets( QWidget *parent /TransferThis/ = 0 );
922

1023
~QgsAuthEditorWidgets();
11-
12-
QTabWidget * tabbedWidget();
1324
};

‎python/gui/gui.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143

144144
%Include auth/qgsauthauthoritieseditor.sip
145145
%Include auth/qgsauthcertificateinfo.sip
146+
%Include auth/qgsauthcertificatemanager.sip
146147
%Include auth/qgsauthcerttrustpolicycombobox.sip
147148
%Include auth/qgsauthconfigeditor.sip
148149
%Include auth/qgsauthconfigselect.sip

‎src/gui/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ SET(QGIS_GUI_SRCS
6161

6262
auth/qgsauthauthoritieseditor.cpp
6363
auth/qgsauthcertificateinfo.cpp
64+
auth/qgsauthcertificatemanager.cpp
6465
auth/qgsauthcerttrustpolicycombobox.cpp
6566
auth/qgsauthconfigedit.cpp
6667
auth/qgsauthconfigeditor.cpp
6768
auth/qgsauthconfigselect.cpp
69+
auth/qgsautheditorwidgets.cpp
6870
auth/qgsauthguiutils.cpp
6971
auth/qgsauthidentitieseditor.cpp
7072
auth/qgsauthimportcertdialog.cpp
@@ -444,6 +446,7 @@ SET(QGIS_GUI_MOC_HDRS
444446

445447
auth/qgsauthauthoritieseditor.h
446448
auth/qgsauthcertificateinfo.h
449+
auth/qgsauthcertificatemanager.h
447450
auth/qgsauthcerttrustpolicycombobox.h
448451
auth/qgsauthconfigedit.h
449452
auth/qgsauthconfigeditor.h
@@ -560,6 +563,7 @@ SET(QGIS_GUI_HDRS
560563

561564
auth/qgsauthauthoritieseditor.h
562565
auth/qgsauthcertificateinfo.h
566+
auth/qgsauthcertificatemanager.h
563567
auth/qgsauthcerttrustpolicycombobox.h
564568
auth/qgsauthconfigedit.h
565569
auth/qgsauthconfigeditor.h
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/***************************************************************************
2+
qgsauthcertificatemanager.cpp
3+
---------------------
4+
begin : September, 2015
5+
copyright : (C) 2015 by Boundless Spatial, Inc. USA
6+
author : Larry Shaffer
7+
email : lshaffer at boundlessgeo dot com
8+
***************************************************************************
9+
* *
10+
* This program is free software; you can redistribute it and/or modify *
11+
* it under the terms of the GNU General Public License as published by *
12+
* the Free Software Foundation; either version 2 of the License, or *
13+
* (at your option) any later version. *
14+
* *
15+
***************************************************************************/
16+
17+
#include "qgsauthcertificatemanager.h"
18+
19+
#include <QDialog>
20+
#include <QDialogButtonBox>
21+
#include <QPushButton>
22+
23+
QgsAuthCertEditors::QgsAuthCertEditors( QWidget *parent )
24+
: QWidget( parent )
25+
{
26+
setupUi( this );
27+
}
28+
29+
QgsAuthCertEditors::~QgsAuthCertEditors()
30+
{
31+
}
32+
33+
34+
35+
QgsAuthCertManager::QgsAuthCertManager( QWidget *parent )
36+
: QDialog( parent )
37+
{
38+
setWindowTitle( tr( "Certificate Manager" ) );
39+
QVBoxLayout *layout = new QVBoxLayout( this );
40+
layout->setMargin( 6 );
41+
42+
mCertEditors = new QgsAuthCertEditors( this );
43+
layout->addWidget( mCertEditors );
44+
45+
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close,
46+
Qt::Horizontal, this );
47+
buttonBox->button( QDialogButtonBox::Close )->setDefault( true );
48+
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
49+
layout->addWidget( buttonBox );
50+
51+
setLayout( layout );
52+
}
53+
54+
QgsAuthCertManager::~QgsAuthCertManager()
55+
{
56+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/***************************************************************************
2+
qgsauthcertificatemanager.h
3+
---------------------
4+
begin : September, 2015
5+
copyright : (C) 2015 by Boundless Spatial, Inc. USA
6+
author : Larry Shaffer
7+
email : lshaffer at boundlessgeo dot com
8+
***************************************************************************
9+
* *
10+
* This program is free software; you can redistribute it and/or modify *
11+
* it under the terms of the GNU General Public License as published by *
12+
* the Free Software Foundation; either version 2 of the License, or *
13+
* (at your option) any later version. *
14+
* *
15+
***************************************************************************/
16+
17+
#ifndef QGSAUTHCERTIFICATEMANAGER_H
18+
#define QGSAUTHCERTIFICATEMANAGER_H
19+
20+
#include "ui_qgsauthcertificatemanager.h"
21+
22+
#include <QWidget>
23+
#include <QDialog>
24+
25+
26+
/** \ingroup gui
27+
* Wrapper widget to manage available certificate editors
28+
*/
29+
class GUI_EXPORT QgsAuthCertEditors : public QWidget, private Ui::QgsAuthCertManager
30+
{
31+
Q_OBJECT
32+
33+
public:
34+
/**
35+
* Construct a widget to contain various certificate editors
36+
* @param parent Parent widget
37+
*/
38+
explicit QgsAuthCertEditors( QWidget *parent = 0 );
39+
40+
~QgsAuthCertEditors();
41+
};
42+
43+
44+
//////////////// Embed in dialog ///////////////////
45+
46+
/** \ingroup gui
47+
* Dialog wrapper for widget to manage available certificate editors
48+
*/
49+
class GUI_EXPORT QgsAuthCertManager : public QDialog
50+
{
51+
Q_OBJECT
52+
53+
public:
54+
/**
55+
* Construct a dialog wrapper for widget to manage available certificate editors
56+
* @param parent Parent widget
57+
*/
58+
explicit QgsAuthCertManager( QWidget *parent = 0 );
59+
60+
~QgsAuthCertManager();
61+
62+
/** Get access to embedded editors widget */
63+
QgsAuthCertEditors *certEditorsWidget() { return mCertEditors; }
64+
65+
private:
66+
QgsAuthCertEditors *mCertEditors;
67+
};
68+
69+
#endif // QGSAUTHCERTIFICATEMANAGER_H

‎src/gui/auth/qgsauthconfigeditor.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "qgsauthconfigedit.h"
2727
#include "qgsauthguiutils.h"
2828

29-
QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
29+
QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent, bool showUtilities, QgsMessageBar *msgbar )
3030
: QWidget( parent )
3131
, mConfigModel( 0 )
3232
, mAuthUtilitiesMenu( 0 )
@@ -49,6 +49,10 @@ QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
4949
else
5050
{
5151
setupUi( this );
52+
53+
setMessageBar( msgbar );
54+
showUtilitiesButton( showUtilities );
55+
5256
mConfigModel = new QSqlTableModel( this, QgsAuthManager::instance()->authDbConnection() );
5357
mConfigModel->setTable( QgsAuthManager::instance()->authDbConfigTable() );
5458
mConfigModel->select();
@@ -113,6 +117,7 @@ QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
113117
mAuthUtilitiesMenu->addAction( mActionEraseAuthDatabase );
114118

115119
btnAuthUtilities->setMenu( mAuthUtilitiesMenu );
120+
lblAuthConfigDb->setVisible( false );
116121
}
117122
}
118123

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

172+
void QgsAuthConfigEditor::showUtilitiesButton( bool show )
173+
{
174+
btnAuthUtilities->setVisible( show );
175+
}
176+
177+
void QgsAuthConfigEditor::setMessageBar( QgsMessageBar *msgbar )
178+
{
179+
if ( msgbar )
180+
{
181+
delete mMsgBar;
182+
mMsgBar = msgbar;
183+
}
184+
}
185+
167186
void QgsAuthConfigEditor::refreshTableView()
168187
{
169188
mConfigModel->select();

‎src/gui/auth/qgsauthconfigeditor.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,22 @@ class GUI_EXPORT QgsAuthConfigEditor : public QWidget, private Ui::QgsAuthConfig
3535
public:
3636
/**
3737
* Widget for editing authentication configurations directly in database
38+
* @param showUtilities Whether to show the widget's utilities button
39+
* @param msgbar Substitute internal message bar for another
3840
*/
39-
explicit QgsAuthConfigEditor( QWidget *parent = 0 );
41+
explicit QgsAuthConfigEditor( QWidget *parent = 0, bool showUtilities = true, QgsMessageBar *msgbar = 0 );
4042
~QgsAuthConfigEditor();
4143

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

47+
public slots:
48+
/** Whether to show the widget's utilities button, e.g. when embedding */
49+
void showUtilitiesButton( bool show = true );
50+
51+
/** Substitute internal message bar for another, e.g. when embedding */
52+
void setMessageBar( QgsMessageBar *msgbar = 0 );
53+
4554
private slots:
4655
/** Repopulate the view with table contents */
4756
void refreshTableView();

0 commit comments

Comments
 (0)
Please sign in to comment.