| Summary: | can not set the primary user ID with kgpg | ||
|---|---|---|---|
| Product: | [Applications] kgpg | Reporter: | Daniel <kdebugs.slum554> |
| Component: | general | Assignee: | bj |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Daniel
2004-05-03 18:56:43 UTC
*** This bug has been confirmed by popular vote. *** SVN commit 699446 by dakon:
Implement setting the primary user id of a secret key.
BUG:80848
While at it improve deleting a user id: preselect the selected user id in
gpg command window.
M +1 -0 core/kgpgkey.cpp
M +1 -0 core/kgpgkey.h
M +4 -1 keylistview.cpp
M +29 -3 keysmanager.cpp
M +2 -0 keysmanager.h
M +5 -0 kgpginterface.cpp
--- trunk/KDE/kdeutils/kgpg/core/kgpgkey.cpp #699445:699446
@@ -231,6 +231,7 @@
: QObject()
{
d = other.d;
+ index = other.index;
}
void KgpgKeyUid::setName(const QString &name)
--- trunk/KDE/kdeutils/kgpg/core/kgpgkey.h #699445:699446
@@ -239,6 +239,7 @@
QString comment() const;
bool valide() const;
KgpgKeyTrust trust() const;
+ unsigned int index;
void addSign(const KgpgKeySign &sign);
KgpgKeySignList signList();
--- trunk/KDE/kdeutils/kgpg/keylistview.cpp #699445:699446
@@ -690,8 +690,11 @@
for (int i = 0; i < key.uidList()->size(); ++i)
{
KgpgKeyUid uid = key.uidList()->at(i);
+ QString index;
- tmpitem = new KeyListViewItem(item, uid.name(), uid.email(), QString(), "-", "-", "-", "-", false, false, KeyListViewItem::Uid);
+ index.setNum(uid.index);
+
+ tmpitem = new KeyListViewItem(item, uid.name(), uid.email(), QString(), "-", "-", "-", index, false, false, KeyListViewItem::Uid);
tmpitem->setPixmap(2, getTrustPix(key.trust(), key.valide()));
tmpitem->setPixmap(0, Images::userId());
insertSigns(tmpitem, uid.signList());
--- trunk/KDE/kdeutils/kgpg/keysmanager.cpp #699445:699446
@@ -261,6 +261,9 @@
QAction *delUid = actionCollection()->addAction("del_uid");
delUid->setText(i18n("&Delete User Id"));
connect(delUid, SIGNAL(triggered(bool)), SLOT(slotDelUid()));
+ setPrimUid = actionCollection()->addAction("prim_uid");
+ setPrimUid->setText(i18n("Set User Id as &primary"));
+ connect(setPrimUid, SIGNAL(triggered(bool)), SLOT(slotPrimUid()));
QAction *openPhoto = actionCollection()->addAction("key_photo");
openPhoto->setIcon(KIcon("image"));
openPhoto->setText(i18n("&Open Photo"));
@@ -365,6 +368,7 @@
m_popupuid = new KMenu();
m_popupuid->addAction(delUid);
+ m_popupuid->addAction(setPrimUid);
m_popuporphan = new KMenu();
m_popuporphan->addAction(regeneratePublic);
@@ -747,7 +751,8 @@
void KeysManager::slotDelUid()
{
- KeyListViewItem *item = keysList2->currentItem();
+ KeyListViewItem *uitem = keysList2->currentItem();
+ KeyListViewItem *item = uitem;
while (item->depth()>0)
item = item->parent();
@@ -756,12 +761,30 @@
QString terminalApp = config.readPathEntry("TerminalApplication", "konsole");
QStringList args;
args << "-e" << KGpgSettings::gpgBinaryPath();
- args << "--edit-key" << item->keyId() << "uid";
+ args << "--edit-key" << item->keyId() << "uid" << uitem->text(6) << "deluid";
process->start(terminalApp, args);
process->waitForFinished();
keysList2->refreshselfkey();
}
+void KeysManager::slotPrimUid()
+{
+ KeyListViewItem *uitem = keysList2->currentItem();
+ KeyListViewItem *item = uitem;
+ while (item->depth()>0)
+ item = item->parent();
+
+ QProcess *process = new QProcess(this);
+ KConfigGroup config(KGlobal::config(), "General");
+ QString terminalApp = config.readPathEntry("TerminalApplication", "konsole");
+ QStringList args;
+ args << "-e" << KGpgSettings::gpgBinaryPath();
+ args << "--edit-key" << item->keyId() << "uid" << uitem->text(6) << "primary" << "save";
+ process->start(terminalApp, args);
+ process->waitForFinished();
+ keysList2->refreshselfkey();
+}
+
void KeysManager::slotregenerate()
{
FILE *fp;
@@ -1315,8 +1338,11 @@
if (sel->text(0) == i18n("Photo id"))
m_popupphoto->exec(pos);
else
- if (sel->text(6) == ("-"))
+ if (sel->pixmap(0)->serialNumber() == Images::userId().serialNumber()) {
+ KeyListViewItem *parent = sel->parent();
+ setPrimUid->setVisible(parent->itemType() & KeyListViewItem::Secret);
m_popupuid->exec(pos);
+ }
}
else
{
--- trunk/KDE/kdeutils/kgpg/keysmanager.h #699445:699446
@@ -133,6 +133,7 @@
void slotToggleDisabled();
void slotGotoDefaultKey();
void slotDelUid();
+ void slotPrimUid();
void slotAddUid();
void slotAddUidEnable(const QString &name);
void slotUpdatePhoto();
@@ -220,6 +221,7 @@
QAction *importAllSignKeys;
QAction *signKey;
QAction *refreshKey;
+ QAction *setPrimUid;
KeyServer *kServer;
groupEdit *gEdit;
--- trunk/KDE/kdeutils/kgpg/kgpginterface.cpp #699445:699446
@@ -523,6 +523,8 @@
{
QString line;
bool partial = false;
+ unsigned int uidnum = 0;
+
while (p->readln(line, false, &partial) != -1)
{
if (partial == true)
@@ -614,6 +616,8 @@
m_publickey.setName(kname);
cycle = "pub";
+ // the first uid is merged into the public key
+ uidnum = 1;
}
else
if (line.startsWith("fpr"))
@@ -679,6 +683,7 @@
else
uid.setValide(true);
+ uid.index = ++uidnum;
QString fullname = line.section(':', 9, 9);
if (fullname.contains('<') )
{
|