mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Make OID resolver Non-modal and let other widgets display details
- column items with context menus - double-click labels of the DN and X509v3 extensions
This commit is contained in:
parent
26d19c488f
commit
6ac9389361
@ -68,7 +68,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_0">
|
||||
<attribute name="title">
|
||||
@ -769,7 +769,7 @@
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="sanLbl"/>
|
||||
<widget class="DoubleClickLabel" name="sanLbl"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="subAltIco">
|
||||
@ -805,7 +805,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="ianLbl"/>
|
||||
<widget class="DoubleClickLabel" name="ianLbl"/>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="issAltName">
|
||||
@ -855,7 +855,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="aiaLbl"/>
|
||||
<widget class="DoubleClickLabel" name="aiaLbl"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="authInfAccIco">
|
||||
@ -917,7 +917,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="crldpLbl"/>
|
||||
<widget class="DoubleClickLabel" name="crldpLbl"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -1176,16 +1176,16 @@
|
||||
<widget class="QLineEdit" name="nsCaPolicyUrl"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="nsCaRevLbl"/>
|
||||
<widget class="DoubleClickLabel" name="nsCaRevLbl"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="nsSslServerName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="nsRevLbl"/>
|
||||
<widget class="DoubleClickLabel" name="nsRevLbl"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="nsSslServerLbl"/>
|
||||
<widget class="DoubleClickLabel" name="nsSslServerLbl"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="nsBaseUrl"/>
|
||||
@ -1194,16 +1194,16 @@
|
||||
<widget class="QLineEdit" name="nsCARevocationUrl"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="nsRenewLbl"/>
|
||||
<widget class="DoubleClickLabel" name="nsRenewLbl"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="nsCommentLbl"/>
|
||||
<widget class="DoubleClickLabel" name="nsCommentLbl"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="nsCaPolicyLbl"/>
|
||||
<widget class="DoubleClickLabel" name="nsCaPolicyLbl"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="nsBaseLbl"/>
|
||||
<widget class="DoubleClickLabel" name="nsBaseLbl"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="nsRevocationUrl"/>
|
||||
@ -1302,6 +1302,11 @@
|
||||
<slot>deleteCurrentRow()</slot>
|
||||
</slots>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>DoubleClickLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">widgets/clicklabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>fromReqCB</tabstop>
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OidResolver</class>
|
||||
<widget class="QDialog" name="OidResolver">
|
||||
<widget class="QWidget" name="OidResolver">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>266</height>
|
||||
<width>401</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -38,7 +38,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Enter The OID, the Nid, or one of the textual representations</string>
|
||||
<string>Enter the OID, the Nid, or one of the textual representations</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -65,6 +65,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@ -74,6 +77,12 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="CopyLabel" name="oid">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -81,19 +90,18 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Short name</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="CopyLabel" name="sn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -114,6 +122,12 @@
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="CopyLabel" name="ln">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -137,6 +151,12 @@
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="CopyLabel" name="nid">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -151,18 +171,15 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Short name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@ -174,38 +191,6 @@
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>OidResolver</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>OidResolver</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>295</x>
|
||||
<y>167</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>input</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
@ -213,12 +198,12 @@
|
||||
<slot>searchOid(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>131</x>
|
||||
<y>65</y>
|
||||
<x>207</x>
|
||||
<y>103</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>398</x>
|
||||
<y>12</y>
|
||||
<x>144</x>
|
||||
<y>47</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
||||
@ -143,7 +143,7 @@ void MainWindow::init_menu()
|
||||
SLOT(undelete()));
|
||||
extra->addAction(tr("Generate DH parameter"), this,
|
||||
SLOT(generateDHparam()));
|
||||
extra->addAction(tr("OID Resolver"), this, SLOT(resolveOID()));
|
||||
extra->addAction(tr("OID Resolver"), resolver, SLOT(show()));
|
||||
|
||||
help = menuBar()->addMenu(tr("&Help") );
|
||||
help->addAction(tr("&Content"), this, SLOT(help()),
|
||||
@ -402,10 +402,3 @@ QString MainWindow::getOptFlags()
|
||||
flags << "disable_netscape";
|
||||
return flags.join(",");
|
||||
}
|
||||
|
||||
void MainWindow::resolveOID()
|
||||
{
|
||||
OidResolver *o = new OidResolver(this);
|
||||
o->exec();
|
||||
delete o;
|
||||
}
|
||||
|
||||
@ -61,6 +61,8 @@ QString MainWindow::mandatory_dn;
|
||||
QString MainWindow::explicit_dn;
|
||||
QString MainWindow::explicit_dn_default = QString("C,ST,L,O,OU,CN,emailAddress");
|
||||
|
||||
OidResolver *MainWindow::resolver = NULL;
|
||||
|
||||
void MainWindow::enableTokenMenu(bool enable)
|
||||
{
|
||||
foreach(QWidget *w, scardList) {
|
||||
@ -89,7 +91,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
statusBar()->addWidget(dbindex, 1);
|
||||
|
||||
setupUi(this);
|
||||
setWindowTitle(tr(XCA_TITLE));
|
||||
setWindowTitle(XCA_TITLE);
|
||||
|
||||
resolver = new OidResolver(NULL);
|
||||
resolver->setWindowTitle(XCA_TITLE);
|
||||
|
||||
wdList << keyButtons << reqButtons << certButtons <<
|
||||
tempButtons << crlButtons;
|
||||
@ -558,6 +563,14 @@ MainWindow::~MainWindow()
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
if (resolver) {
|
||||
delete resolver;
|
||||
}
|
||||
QMainWindow::closeEvent(e);
|
||||
}
|
||||
|
||||
QString makeSalt(void)
|
||||
{
|
||||
unsigned char rand[2];
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#define __MAINWINDOW_H
|
||||
|
||||
#include "NewX509.h"
|
||||
#include "OidResolver.h"
|
||||
#include "ui_MainWindow.h"
|
||||
#include "lib/db_key.h"
|
||||
#include "lib/db_x509req.h"
|
||||
@ -69,6 +70,7 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
static OidResolver *resolver;
|
||||
QString workingdir;
|
||||
QString string_opt;
|
||||
QString pkcs11path;
|
||||
@ -122,6 +124,10 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
int initPass();
|
||||
void read_cmdline(int argc, char *argv[]);
|
||||
void load_engine();
|
||||
static OidResolver *getResolver()
|
||||
{
|
||||
return resolver;
|
||||
}
|
||||
static void Error(errorEx &err);
|
||||
void cmd_version();
|
||||
void cmd_help(const char* msg);
|
||||
@ -160,6 +166,9 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void openURLs();
|
||||
void changeEvent(QEvent *event);
|
||||
|
||||
protected slots:
|
||||
void closeEvent(QCloseEvent * event);
|
||||
|
||||
private slots:
|
||||
void setOptions();
|
||||
void manageToken();
|
||||
@ -169,6 +178,5 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void initPin();
|
||||
void generateDHparam();
|
||||
void open_database(QAction* a);
|
||||
void resolveOID();
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -142,11 +142,11 @@ NewX509::NewX509(QWidget *parent)
|
||||
QWidget::setTabOrder(description, extDNlist);
|
||||
QWidget *old = description;
|
||||
foreach(int nid, expl_dn_nid) {
|
||||
QLabel *label;
|
||||
DoubleClickLabel *label;
|
||||
QLineEdit *edit;
|
||||
QString trans = dn_translations[nid];
|
||||
|
||||
label = new QLabel(this);
|
||||
label = new DoubleClickLabel(this);
|
||||
if (translate_dn && !trans.isEmpty()) {
|
||||
label->setText(trans);
|
||||
label->setToolTip(QString("[%1] %2")
|
||||
@ -156,6 +156,9 @@ NewX509::NewX509(QWidget *parent)
|
||||
label->setToolTip(QString("[%1] %2")
|
||||
.arg(OBJ_nid2sn(nid)).arg(trans));
|
||||
}
|
||||
label->setClickText(OBJ_nid2sn(nid));
|
||||
connect(label, SIGNAL(doubleClicked(QString)),
|
||||
MainWindow::getResolver(), SLOT(searchOid(QString)));
|
||||
edit = new QLineEdit(this);
|
||||
setupLineEditByNid(nid, edit);
|
||||
nameEdits << nameEdit(nid, edit, label);
|
||||
@ -181,11 +184,11 @@ NewX509::NewX509(QWidget *parent)
|
||||
old = reqSubChange;
|
||||
n = 0;
|
||||
foreach(int nid, attr_nid) {
|
||||
QLabel *label;
|
||||
DoubleClickLabel *label;
|
||||
QLineEdit *edit;
|
||||
QString trans = dn_translations[nid];
|
||||
|
||||
label = new QLabel(this);
|
||||
label = new DoubleClickLabel(this);
|
||||
if (translate_dn && !trans.isEmpty()) {
|
||||
label->setText(trans);
|
||||
label->setToolTip(QString(OBJ_nid2sn(nid)));
|
||||
@ -193,6 +196,9 @@ NewX509::NewX509(QWidget *parent)
|
||||
label->setText(QString(OBJ_nid2ln(nid)));
|
||||
label->setToolTip(trans);
|
||||
}
|
||||
label->setClickText(OBJ_nid2sn(nid));
|
||||
connect(label, SIGNAL(doubleClicked(QString)),
|
||||
MainWindow::getResolver(), SLOT(searchOid(QString)));
|
||||
edit = new QLineEdit(this);
|
||||
attrEdits << nameEdit(nid, edit, label);
|
||||
setupLineEditByNid(nid, edit);
|
||||
@ -212,7 +218,7 @@ NewX509::NewX509(QWidget *parent)
|
||||
pt = none;
|
||||
notAfter->setEndDate(true);
|
||||
|
||||
QMap<int, QLabel*> nidLabel;
|
||||
QMap<int, DoubleClickLabel*> nidLabel;
|
||||
nidLabel[NID_subject_alt_name] = sanLbl;
|
||||
nidLabel[NID_issuer_alt_name] = ianLbl;
|
||||
nidLabel[NID_crl_distribution_points] = crldpLbl;
|
||||
@ -226,13 +232,16 @@ NewX509::NewX509(QWidget *parent)
|
||||
nidLabel[NID_netscape_comment] = nsCommentLbl;
|
||||
|
||||
foreach(int nid, nidLabel.keys()) {
|
||||
QLabel *l = nidLabel[nid];
|
||||
DoubleClickLabel *l = nidLabel[nid];
|
||||
l->setText(translate_dn ?
|
||||
dn_translations[nid] : OBJ_nid2ln(nid));
|
||||
if (l->toolTip().isEmpty()) {
|
||||
l->setToolTip(translate_dn ?
|
||||
OBJ_nid2ln(nid) : dn_translations[nid]);
|
||||
}
|
||||
l->setClickText(OBJ_nid2sn(nid));
|
||||
connect(l, SIGNAL(doubleClicked(QString)),
|
||||
MainWindow::getResolver(), SLOT(searchOid(QString)));
|
||||
}
|
||||
|
||||
QMap<int, QGroupBox*> nidGroupBox;
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "lib/exception.h"
|
||||
|
||||
OidResolver::OidResolver(QWidget *parent)
|
||||
:QDialog(parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
setWindowTitle(tr(XCA_TITLE));
|
||||
setupUi(this);
|
||||
@ -23,6 +23,7 @@ void OidResolver::searchOid(QString s)
|
||||
bool ok;
|
||||
int n;
|
||||
|
||||
input->setText(s);
|
||||
s = s.trimmed();
|
||||
n = s.toUInt(&ok);
|
||||
if (!ok)
|
||||
@ -49,4 +50,6 @@ void OidResolver::searchOid(QString s)
|
||||
}
|
||||
}
|
||||
ign_openssl_error();
|
||||
show();
|
||||
raise();
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#include "ui_OidResolver.h"
|
||||
|
||||
class OidResolver: public QDialog, public Ui::OidResolver
|
||||
class OidResolver: public QWidget, public Ui::OidResolver
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@ -274,7 +274,19 @@ void XcaTreeView::pem2clipboard(void)
|
||||
basemodel->pem2clipboard(getSelectedIndexes());
|
||||
}
|
||||
|
||||
void XcaTreeView::contextMenu(QContextMenuEvent *e, QMenu *parent, int)
|
||||
void XcaTreeView::headerDetails(void)
|
||||
{
|
||||
if (curr_hd && curr_hd->id > 0 && mainwin)
|
||||
mainwin->getResolver()->searchOid(QString::number(curr_hd->id));
|
||||
}
|
||||
|
||||
void XcaTreeView::columnRemove(void)
|
||||
{
|
||||
if (curr_hd->action)
|
||||
curr_hd->action->setChecked(false);
|
||||
}
|
||||
|
||||
void XcaTreeView::contextMenu(QContextMenuEvent *e, QMenu *parent, int col)
|
||||
{
|
||||
int shown = 0;
|
||||
tipMenu *menu, *dn, *v3ext, *current, *v3ns;
|
||||
@ -287,6 +299,15 @@ void XcaTreeView::contextMenu(QContextMenuEvent *e, QMenu *parent, int)
|
||||
v3ext = new tipMenu(tr("X509v3 Extensions"), mainwin);
|
||||
v3ns = new tipMenu(tr("Netscape extensions"), mainwin);
|
||||
menu->addAction(tr("Reset"), basemodel, SLOT(columnResetDefaults()));
|
||||
if (col >= 0 && col < allHeaders.size()) {
|
||||
curr_hd = allHeaders[col];
|
||||
menu->addAction(tr("Remove Column"), this,SLOT(columnRemove()));
|
||||
if (curr_hd->id > 0)
|
||||
menu->addAction(tr("Details"), this,
|
||||
SLOT(headerDetails()));
|
||||
} else {
|
||||
curr_hd = NULL;
|
||||
}
|
||||
sep = menu->addSeparator();
|
||||
foreach(hd, allHeaders) {
|
||||
switch (hd->type) {
|
||||
@ -378,5 +399,5 @@ void XcaTreeView::showContextMenu(QContextMenuEvent *e,
|
||||
|
||||
fillContextMenu(menu, subExport, index, indexes);
|
||||
|
||||
contextMenu(e, menu);
|
||||
contextMenu(e, menu, -1);
|
||||
}
|
||||
|
||||
@ -17,6 +17,9 @@
|
||||
class XcaTreeView: public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
dbheader *curr_hd;
|
||||
|
||||
protected:
|
||||
db_base *basemodel;
|
||||
QSortFilterProxyModel *proxy;
|
||||
@ -56,5 +59,7 @@ class XcaTreeView: public QTreeView
|
||||
void doubleClick(const QModelIndex &m);
|
||||
void load(void);
|
||||
void pem2clipboard(void);
|
||||
void headerDetails(void);
|
||||
void columnRemove(void);
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -11,8 +11,22 @@
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
|
||||
void DoubleClickLabel::mouseDoubleClickEvent(QMouseEvent * e)
|
||||
{
|
||||
QWidget::mouseDoubleClickEvent(e);
|
||||
if (clicktext.isEmpty())
|
||||
emit doubleClicked(text());
|
||||
else
|
||||
emit doubleClicked(clicktext);
|
||||
}
|
||||
|
||||
void DoubleClickLabel::setClickText(QString s)
|
||||
{
|
||||
clicktext = s;
|
||||
}
|
||||
|
||||
ClickLabel::ClickLabel(QWidget *parent)
|
||||
:QLabel(parent)
|
||||
:DoubleClickLabel(parent)
|
||||
{
|
||||
QFont fnt( font() );
|
||||
fnt.setBold(true);
|
||||
@ -31,12 +45,6 @@ ClickLabel::ClickLabel(QWidget *parent)
|
||||
setTextFormat(Qt::PlainText);
|
||||
}
|
||||
|
||||
void ClickLabel::mouseDoubleClickEvent ( QMouseEvent * e )
|
||||
{
|
||||
QWidget::mouseDoubleClickEvent(e);
|
||||
emit doubleClicked(text());
|
||||
}
|
||||
|
||||
void ClickLabel::setColor(const QColor &col)
|
||||
{
|
||||
QPalette pal = palette();
|
||||
@ -62,7 +70,7 @@ void ClickLabel::disableToolTip()
|
||||
|
||||
|
||||
CopyLabel::CopyLabel(QWidget *parent)
|
||||
:QLabel(parent)
|
||||
:DoubleClickLabel(parent)
|
||||
{
|
||||
setFrameShape(QFrame::Panel);
|
||||
setFrameShadow(QFrame::Sunken);
|
||||
|
||||
@ -12,7 +12,23 @@
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
class ClickLabel : public QLabel
|
||||
class DoubleClickLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QString clicktext;
|
||||
public:
|
||||
DoubleClickLabel(QWidget *parent) : QLabel(parent) { }
|
||||
void setClickText(QString s);
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent ( QMouseEvent * e );
|
||||
|
||||
signals:
|
||||
void doubleClicked(QString text);
|
||||
};
|
||||
|
||||
class ClickLabel : public DoubleClickLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -23,14 +39,10 @@ class ClickLabel : public QLabel
|
||||
void disableToolTip();
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent ( QMouseEvent * e );
|
||||
void setColor(const QColor &col);
|
||||
|
||||
signals:
|
||||
void doubleClicked(QString text);
|
||||
};
|
||||
|
||||
class CopyLabel : public QLabel
|
||||
class CopyLabel : public DoubleClickLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
#include "lib/x509name.h"
|
||||
#include "lib/db_x509super.h"
|
||||
#include "lib/base.h"
|
||||
#include "widgets/clicklabel.h"
|
||||
#include "clicklabel.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
DistName::DistName(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
@ -48,7 +49,8 @@ DistName::DistName(QWidget* parent)
|
||||
|
||||
void DistName::setX509name(const x509name &n)
|
||||
{
|
||||
QLabel *l1, *l2;
|
||||
DoubleClickLabel *l1;
|
||||
QLabel *l2;
|
||||
QStringList sl;
|
||||
for (int i=0; i<n.entryCount(); i++) {
|
||||
QString toolt, label, trans;
|
||||
@ -62,10 +64,11 @@ void DistName::setX509name(const x509name &n)
|
||||
toolt = trans;
|
||||
label = sl[1];
|
||||
}
|
||||
l1 = new QLabel(this);
|
||||
l1 = new DoubleClickLabel(this);
|
||||
l2 = new CopyLabel(this);
|
||||
l1->setTextFormat(Qt::PlainText);
|
||||
l1->setText(label);
|
||||
l1->setClickText(sl[1]);
|
||||
if (l1->text().isEmpty())
|
||||
l1->setText(sl[0]);
|
||||
l2->setText(sl[2]);
|
||||
@ -73,6 +76,9 @@ void DistName::setX509name(const x509name &n)
|
||||
l1->setToolTip(QString("[%1] %2").arg(sl[0]).arg(toolt));
|
||||
l2->setToolTip(sl[3]);
|
||||
|
||||
connect(l1, SIGNAL(doubleClicked(QString)),
|
||||
MainWindow::getResolver(), SLOT(searchOid(QString)));
|
||||
|
||||
DistNameLayout->addWidget(l1, i, 0);
|
||||
DistNameLayout->addWidget(l2, i, 1);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user