[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeutils/kgpg
From: Rolf Eike Beer <kde () opensource ! sf-tec ! de>
Date: 2011-03-13 12:58:56
Message-ID: 20110313125856.98B36AC8C7 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1224687 by dakon:
use a UI file for the key information dialog
The basic work was done by Philip Greggory Lee <rocketman768@gmail.com> with me \
fixing only some layout glitches.
CCMAIL:rocketman768@gmail.com
M +1 -1 CMakeLists.txt
M +20 -183 keyinfodialog.cpp
M +4 -23 keyinfodialog.h
A kgpgKeyInfo.ui
--- trunk/KDE/kdeutils/kgpg/CMakeLists.txt #1224686:1224687
@@ -2,7 +2,6 @@
find_package( KdepimLibs REQUIRED )
-
add_subdirectory( icons )
include_directories( ${KDEPIMLIBS_INCLUDE_DIR} core editor model transactions )
@@ -115,6 +114,7 @@
newkey.ui
keyexport.ui
conf_encryption.ui
+ kgpgKeyInfo.ui
kgpgrevokewidget.ui
keyserver.ui
conf_decryption.ui
--- trunk/KDE/kdeutils/kgpg/keyinfodialog.cpp #1224686:1224687
@@ -1,7 +1,8 @@
/*
* Copyright (C) 2002 Jean-Baptiste Mardelle <bj@altern.org>
* Copyright (C) 2007 Jimmy Gilles <jimmygilles@gmail.com>
- * Copyright (C) 2008 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2008,2009,2010,2011 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2011 Philip Greggory Lee <rocketman768@gmail.com>
*/
/***************************************************************************
@@ -18,6 +19,7 @@
#include <QGridLayout>
#include <QHBoxLayout>
#include <QVBoxLayout>
+#include <QFormLayout>
#include <QGroupBox>
#include <QCheckBox>
#include <QPixmap>
@@ -56,9 +58,10 @@
m_color_w->setLineWidth(1);
m_color_w->setFrameShape(QFrame::Box);
m_color_w->setAutoFillBackground(true);
+ m_color_w->setMinimumWidth(64);
QHBoxLayout *layout = new QHBoxLayout(this);
- layout->setSpacing(0);
+ layout->setSpacing(10);
layout->setMargin(2);
layout->addWidget(m_text_w);
layout->addWidget(m_color_w);
@@ -108,38 +111,25 @@
Q_ASSERT(m_model != NULL);
Q_ASSERT(m_node != NULL);
+ setupUi(this);
+
setButtons(Ok | Apply | Cancel);
setDefaultButton(Ok);
setModal(true);
enableButtonApply(false);
- QWidget *page = new QWidget(this);
- QWidget *top = new QWidget(page);
- QWidget *right = new QWidget(top);
+ m_email->setUnderline(false);
+ m_trust = new KgpgTrustLabel(this);
+ int trustRow;
+ formLayout_keyproperties->getWidgetPosition(tl_trust, &trustRow, NULL);
+ formLayout_keyproperties->setWidget(trustRow, QFormLayout::FieldRole, m_trust);
- QGroupBox *gr_properties = _keypropertiesGroup(top);
- QGroupBox *gr_photo = _photoGroup(right);
- QGroupBox *gr_buttons = _buttonsGroup(right);
- QGroupBox *gr_fingerprint = _fingerprintGroup(page);
+ // Hide some widgets if this is not a secret node.
+ if ( ! m_node->isSecret() ) {
+ m_expirationbtn->hide();
+ m_password->hide();
+ }
- QVBoxLayout *layout_right = new QVBoxLayout(right);
- layout_right->setSpacing(spacingHint());
- layout_right->setMargin(0);
- layout_right->addWidget(gr_photo);
- layout_right->addWidget(gr_buttons);
-
- QHBoxLayout *layout_top = new QHBoxLayout(top);
- layout_top->setSpacing(spacingHint());
- layout_top->setMargin(0);
- layout_top->addWidget(gr_properties);
- layout_top->addWidget(right);
-
- QVBoxLayout *layout_page = new QVBoxLayout(page);
- layout_page->setSpacing(spacingHint());
- layout_page->setMargin(0);
- layout_page->addWidget(top);
- layout_page->addWidget(gr_fingerprint);
-
setMainWidget(page);
connect(m_owtrust, SIGNAL(activated(int)), this, SLOT(slotChangeTrust(int)));
@@ -149,8 +139,11 @@
connect(this, SIGNAL(cancelClicked()), this, SLOT(slotPreCancel()));
connect(this, SIGNAL(applyClicked()), SLOT(slotApply()));
connect(keychange, SIGNAL(done(int)), SLOT(slotApplied(int)));
+ connect(m_disable, SIGNAL(toggled(bool)), this, SLOT(slotDisableKey(bool)));
displayKey();
+ adjustSize();
+ gr_fingerprint->setMinimumHeight(gr_fingerprint->height());
}
KgpgKeyInfo::~KgpgKeyInfo()
@@ -159,162 +152,6 @@
keychange->selfdestruct(false);
}
-QGroupBox* KgpgKeyInfo::_keypropertiesGroup(QWidget *parent)
-{
- QGroupBox *group = new QGroupBox(i18n("Key properties"), parent);
-
- /************************/
- /* --- name / email --- */
-
- QWidget *widget_name = new QWidget(group);
-
- m_name = new QLabel(widget_name);
- m_name->setTextInteractionFlags(Qt::TextSelectableByMouse);
-
- m_email = new KUrlLabel(widget_name);
- m_email->setUnderline(false);
- m_email->setTextInteractionFlags(Qt::TextSelectableByMouse);
-
- /**********************/
- /* --- properties --- */
-
- QWidget *widget_properties = new QWidget(group);
-
- QLabel *tl_id = new QLabel(i18n("Key ID:"), widget_properties);
- QLabel *tl_comment = new QLabel(i18n("Comment:"), widget_properties);
- QLabel *tl_creation = new QLabel(i18n("Creation:"), widget_properties);
- QLabel *tl_expiration = new QLabel(i18n("Expiration:"), widget_properties);
- QLabel *tl_trust = new QLabel(i18n("Trust:"), widget_properties);
- QLabel *tl_owtrust = new QLabel(i18n("Owner trust:"), widget_properties);
- QLabel *tl_algorithm = new QLabel(i18n("Algorithm:"), widget_properties);
- QLabel *tl_length = new QLabel(i18n("Length:"), widget_properties);
-
- m_id = new QLabel(widget_properties);
- m_comment = new QLabel(widget_properties);
- m_creation = new QLabel(widget_properties);
- m_expiration = new QLabel(widget_properties);
- m_trust = new KgpgTrustLabel(widget_properties);
- m_owtrust = new KComboBox(widget_properties);
- m_algorithm = new QLabel(widget_properties);
- m_length = new QLabel(widget_properties);
-
- m_owtrust->addItem(i18n("I do not know"));
- m_owtrust->addItem(i18n("I do NOT trust"));
- m_owtrust->addItem(i18n("Marginally"));
- m_owtrust->addItem(i18n("Fully"));
- m_owtrust->addItem(i18n("Ultimately"));
-
- m_id->setTextInteractionFlags(Qt::TextSelectableByMouse);
- m_comment->setTextInteractionFlags(Qt::TextSelectableByMouse);
- m_creation->setTextInteractionFlags(Qt::TextSelectableByMouse);
- m_expiration->setTextInteractionFlags(Qt::TextSelectableByMouse);
- m_algorithm->setTextInteractionFlags(Qt::TextSelectableByMouse);
- m_length->setTextInteractionFlags(Qt::TextSelectableByMouse);
-
- QHBoxLayout *layout_name = new QHBoxLayout(widget_name);
- layout_name->setMargin(0);
- layout_name->setSpacing(spacingHint());
- layout_name->addWidget(m_name);
- layout_name->addWidget(m_email);
- layout_name->addStretch();
-
- QGridLayout *layout_properties = new QGridLayout(widget_properties);
- layout_properties->setMargin(0);
- layout_properties->setSpacing(spacingHint());
- layout_properties->addWidget(tl_id, 0, 0, Qt::AlignRight);
- layout_properties->addWidget(m_id, 0, 1);
- layout_properties->addWidget(tl_comment, 1, 0, Qt::AlignRight);
- layout_properties->addWidget(m_comment, 1, 1);
- layout_properties->addWidget(tl_creation, 2, 0, Qt::AlignRight);
- layout_properties->addWidget(m_creation, 2, 1);
- layout_properties->addWidget(tl_expiration, 3, 0, Qt::AlignRight);
- layout_properties->addWidget(m_expiration, 3, 1);
- layout_properties->addWidget(tl_trust, 4, 0, Qt::AlignRight);
- layout_properties->addWidget(m_trust, 4, 1);
- layout_properties->addWidget(tl_owtrust, 5, 0, Qt::AlignRight);
- layout_properties->addWidget(m_owtrust, 5, 1);
- layout_properties->addWidget(tl_algorithm, 6, 0, Qt::AlignRight);
- layout_properties->addWidget(m_algorithm, 6, 1);
- layout_properties->addWidget(tl_length, 7, 0, Qt::AlignRight);
- layout_properties->addWidget(m_length, 7, 1);
- layout_properties->setColumnStretch(1, 1);
- layout_properties->setRowStretch(8, 1);
-
- QVBoxLayout *layout_keyproperties = new QVBoxLayout(group);
- layout_keyproperties->addWidget(widget_name);
- layout_keyproperties->addWidget(widget_properties);
-
- return group;
-}
-
-QGroupBox* KgpgKeyInfo::_photoGroup(QWidget *parent)
-{
- QGroupBox *group = new QGroupBox(i18n("Photo"), parent);
- m_photo = new QLabel(i18n("No Photo"), group);
- m_photoid = new KComboBox(group);
-
- m_photo->setMinimumSize(120, 140);
- m_photo->setMaximumSize(32767, 140);
- m_photo->setLineWidth(2);
- m_photo->setAlignment(Qt::AlignCenter);
- m_photo->setFrameShape(QFrame::Box);
- m_photo->setWhatsThis(i18n("<qt><b>Photo:</b><p>A photo can be included with a \
public key for extra security. The photo can be used as an additional method of \
authenticating the key. However, it should not be relied upon as the only form of \
authentication.</p></qt>"));
-
- QVBoxLayout *layout = new QVBoxLayout(group);
- layout->setMargin(marginHint());
- layout->setSpacing(spacingHint());
- layout->addWidget(m_photo);
- layout->addWidget(m_photoid);
- layout->addStretch();
-
- return group;
-}
-
-QGroupBox* KgpgKeyInfo::_buttonsGroup(QWidget *parent)
-{
- QGroupBox *group = new QGroupBox(parent);
- m_disable = new QCheckBox(i18n("Disable key"), group);
-
- if (m_node->isSecret()) {
- m_expirationbtn = new KPushButton(i18n("Change Expiration..."), group);
- m_password = new KPushButton(i18n("Change Passphrase..."), group);
-
- connect(m_expirationbtn, SIGNAL(clicked()), this, SLOT(slotChangeDate()));
- connect(m_password, SIGNAL(clicked()), this, SLOT(slotChangePass()));
- } else {
- m_password = 0;
- m_expirationbtn = 0;
- }
-
- connect(m_disable, SIGNAL(toggled(bool)), this, SLOT(slotDisableKey(bool)));
-
- QVBoxLayout *layout = new QVBoxLayout(group);
- layout->setMargin(marginHint());
- layout->setSpacing(spacingHint());
- layout->addWidget(m_disable);
-
- if (m_node->isSecret()) {
- layout->addWidget(m_expirationbtn);
- layout->addWidget(m_password);
- }
-
- return group;
-}
-
-QGroupBox* KgpgKeyInfo::_fingerprintGroup(QWidget *parent)
-{
- QGroupBox *group = new QGroupBox(i18n("Fingerprint"), parent);
- m_fingerprint = new QLabel(group);
- m_fingerprint->setTextInteractionFlags(Qt::TextSelectableByMouse);
-
- QVBoxLayout *layout = new QVBoxLayout(group);
- layout->setMargin(marginHint());
- layout->setSpacing(spacingHint());
- layout->addWidget(m_fingerprint);
-
- return group;
-}
-
void KgpgKeyInfo::reloadNode()
{
const QString kid(m_node->getId());
--- trunk/KDE/kdeutils/kgpg/keyinfodialog.h #1224686:1224687
@@ -2,6 +2,7 @@
* Copyright (C) 2002 Jean-Baptiste Mardelle <bj@altern.org>
* Copyright (C) 2007 Jimmy Gilles <jimmygilles@gmail.com>
* Copyright (C) 2008 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2011 Philip G. Lee <rocketman768@gmail.com>
*/
/***************************************************************************
@@ -22,6 +23,8 @@
#include <KDialog>
+#include "ui_kgpgKeyInfo.h"
+
class QCheckBox;
class QGroupBox;
@@ -57,7 +60,7 @@
QColor m_color;
};
-class KgpgKeyInfo : public KDialog
+class KgpgKeyInfo : public KDialog, public Ui::kgpgKeyInfo
{
Q_OBJECT
@@ -73,11 +76,6 @@
void keyNeedsRefresh(KGpgKeyNode *node);
private:
- QGroupBox *_keypropertiesGroup(QWidget *parent);
- QGroupBox *_photoGroup(QWidget *parent);
- QGroupBox *_buttonsGroup(QWidget *parent);
- QGroupBox *_fingerprintGroup(QWidget *parent);
-
void reloadKey();
void reloadNode();
void displayKey();
@@ -109,23 +107,6 @@
KGpgItemModel *m_model;
KGpgChangePass *m_changepass;
- QCheckBox *m_disable;
- QLabel *m_name;
- QLabel *m_id;
- QLabel *m_comment;
- QLabel *m_creation;
- QLabel *m_expiration;
- QLabel *m_algorithm;
- QLabel *m_length;
- QLabel *m_fingerprint;
- QLabel *m_photo;
-
- KPushButton *m_expirationbtn;
- KPushButton *m_password;
- KUrlLabel *m_email;
- KComboBox *m_photoid;
- KComboBox *m_owtrust;
-
KgpgTrustLabel *m_trust;
bool m_keywaschanged;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic