diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-04-22 20:25:58 +0200 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2015-04-22 20:25:58 +0200 |
commit | 89f765117b8576fb7161417d7b5794d437e86034 (patch) | |
tree | 026e378baa6b6c31ac2026abd18c3ea94fb92c9f | |
parent | 651a2aac88e47cc09a72d9dfa507fb1c99d23846 (diff) |
retrieve name from uid field (need on linux aparently)
-rw-r--r-- | mainwindow.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index 3074249b..8ef131e2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -680,16 +680,30 @@ QList<UserInfo> MainWindow::listKeys(QString keystring) if (process->exitStatus() != QProcess::NormalExit) { return users; } + QString currentKey; + QString currentName; + bool saved; QStringList keys = QString(process->readAllStandardOutput()).split(QRegExp("[\r\n]"), QString::SkipEmptyParts); foreach (QString key, keys) { QStringList props = key.split(':'); - if (props.size() < 10 || props[0] != "pub") { + if (props.size() < 10) { continue; } - UserInfo i; - i.name = props[9]; - i.key_id = props[4]; - users.append(i); + if(props[0] == "pub") { + saved = false; + currentKey = props[4]; + currentName = props[9]; + } else if (props[0] == "uid") { + if (currentName.isEmpty()) { + currentName = props[9]; + } + } else if (props[0] == "sub" && !saved) { + UserInfo i; + i.name = currentName; + i.key_id = currentKey; + users.append(i); + saved = true; + } } return users; } |