Lines 246-252
Link Here
|
246 |
bool warn=false; |
246 |
bool warn=false; |
247 |
KListViewItem *item; |
247 |
KListViewItem *item; |
248 |
|
248 |
|
249 |
fp = popen("gpg --no-tty --with-colons --list-secret-keys", "r"); |
249 |
fp = popen("gpg --no-tty --with-colons --list-secret-keys --fixed-list-mode", "r"); |
250 |
while ( fgets( line, sizeof(line), fp)) { |
250 |
while ( fgets( line, sizeof(line), fp)) { |
251 |
tst=QString::fromUtf8(line); |
251 |
tst=QString::fromUtf8(line); |
252 |
if (tst.startsWith("sec")) { |
252 |
if (tst.startsWith("sec")) { |
Lines 257-263
Link Here
|
257 |
val=i18n("Unlimited"); |
257 |
val=i18n("Unlimited"); |
258 |
fullname=keyString[9]; |
258 |
fullname=keyString[9]; |
259 |
|
259 |
|
260 |
fp2 = popen(QFile::encodeName(QString("gpg --no-tty --with-colons --list-key %1").arg(KShellProcess::quote(id))), "r"); |
260 |
fp2 = popen(QFile::encodeName(QString("gpg --no-tty --with-colons --fixed-list-mode --list-key %1").arg(KShellProcess::quote(id))), "r"); |
261 |
bool dead=true; |
261 |
bool dead=true; |
262 |
while ( fgets( line, sizeof(line), fp2)) { |
262 |
while ( fgets( line, sizeof(line), fp2)) { |
263 |
tst2=QString::fromUtf8(line); |
263 |
tst2=QString::fromUtf8(line); |
Lines 1848-1854
Link Here
|
1848 |
FILE *pass; |
1848 |
FILE *pass; |
1849 |
char line[200]=""; |
1849 |
char line[200]=""; |
1850 |
QString opt,fingervalue; |
1850 |
QString opt,fingervalue; |
1851 |
QString gpgcmd="gpg --no-tty --no-secmem-warning --with-colons --fingerprint "+KShellProcess::quote(keysList2->currentItem()->text(6)); |
1851 |
QString gpgcmd="gpg --no-tty --no-secmem-warning --with-colons --fixed-list-mode --fingerprint "+KShellProcess::quote(keysList2->currentItem()->text(6)); |
1852 |
pass=popen(QFile::encodeName(gpgcmd),"r"); |
1852 |
pass=popen(QFile::encodeName(gpgcmd),"r"); |
1853 |
while ( fgets( line, sizeof(line), pass)) { |
1853 |
while ( fgets( line, sizeof(line), pass)) { |
1854 |
opt=QString::fromUtf8(line); |
1854 |
opt=QString::fromUtf8(line); |
Lines 2246-2252
Link Here
|
2246 |
continueSearch=true; |
2246 |
continueSearch=true; |
2247 |
KProcIO *conprocess=new KProcIO(QTextCodec::codecForLocale()); |
2247 |
KProcIO *conprocess=new KProcIO(QTextCodec::codecForLocale()); |
2248 |
*conprocess<< "gpg"; |
2248 |
*conprocess<< "gpg"; |
2249 |
*conprocess<<"--no-secmem-warning"<<"--with-colons"<<"--fingerprint"<<"--list-keys"<<newKeyName; |
2249 |
*conprocess<<"--no-secmem-warning"<<"--with-colons"<<"--fixed-list-mode"<<"--fingerprint"<<"--list-keys"<<newKeyName; |
2250 |
QObject::connect(conprocess,SIGNAL(readReady(KProcIO *)),this,SLOT(slotReadFingerProcess(KProcIO *))); |
2250 |
QObject::connect(conprocess,SIGNAL(readReady(KProcIO *)),this,SLOT(slotReadFingerProcess(KProcIO *))); |
2251 |
QObject::connect(conprocess, SIGNAL(processExited(KProcess *)),this, SLOT(newKeyDone(KProcess *))); |
2251 |
QObject::connect(conprocess, SIGNAL(processExited(KProcess *)),this, SLOT(newKeyDone(KProcess *))); |
2252 |
conprocess->start(KProcess::NotifyOnExit,true); |
2252 |
conprocess->start(KProcess::NotifyOnExit,true); |
Lines 2367-2373
Link Here
|
2367 |
FILE *fp; |
2367 |
FILE *fp; |
2368 |
char line[300]; |
2368 |
char line[300]; |
2369 |
keysList2->secretList=QString::null; |
2369 |
keysList2->secretList=QString::null; |
2370 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2370 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --fixed-list-mode --list-secret-keys", "r"); |
2371 |
while ( fgets( line, sizeof(line), fp)) { |
2371 |
while ( fgets( line, sizeof(line), fp)) { |
2372 |
QString lineRead=QString::fromUtf8(line); |
2372 |
QString lineRead=QString::fromUtf8(line); |
2373 |
if (lineRead.startsWith("sec")) |
2373 |
if (lineRead.startsWith("sec")) |
Lines 2550-2563
Link Here
|
2550 |
UpdateViewItem *itemsig=NULL; |
2550 |
UpdateViewItem *itemsig=NULL; |
2551 |
UpdateViewItem *itemrev=NULL; |
2551 |
UpdateViewItem *itemrev=NULL; |
2552 |
QPixmap keyPhotoId; |
2552 |
QPixmap keyPhotoId; |
2553 |
int uidNumber=2; |
2553 |
int uidNumber=0; |
2554 |
bool dropFirstUid=false; |
2554 |
bool dropFirstUid=false; |
2555 |
|
2555 |
|
2556 |
kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl; |
2556 |
kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl; |
2557 |
|
2557 |
|
2558 |
cycle="pub"; |
2558 |
cycle="pub"; |
2559 |
bool noID=false; |
2559 |
bool noID=false; |
2560 |
fp = popen(QFile::encodeName(QString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs "+item->text(6))), "r"); |
2560 |
fp = popen(QFile::encodeName(QString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs --fixed-list-mode "+item->text(6))), "r"); |
2561 |
|
2561 |
|
2562 |
while ( fgets( tmpline, sizeof(tmpline), fp)) { |
2562 |
while ( fgets( tmpline, sizeof(tmpline), fp)) { |
2563 |
QString line = QString::fromUtf8( tmpline ); |
2563 |
QString line = QString::fromUtf8( tmpline ); |
Lines 2683-2689
Link Here
|
2683 |
QStringList issec; |
2683 |
QStringList issec; |
2684 |
secretList=QString::null; |
2684 |
secretList=QString::null; |
2685 |
orphanList=QString::null; |
2685 |
orphanList=QString::null; |
2686 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2686 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys --fixed-list-mode", "r"); |
2687 |
while ( fgets( line, sizeof(line), fp2)) { |
2687 |
while ( fgets( line, sizeof(line), fp2)) { |
2688 |
QString lineRead=QString::fromUtf8(line); |
2688 |
QString lineRead=QString::fromUtf8(line); |
2689 |
kdDebug(2100) << k_funcinfo << "Read one secret key line: " << lineRead << endl; |
2689 |
kdDebug(2100) << k_funcinfo << "Read one secret key line: " << lineRead << endl; |
Lines 2692-2732
Link Here
|
2692 |
} |
2692 |
} |
2693 |
pclose(fp2); |
2693 |
pclose(fp2); |
2694 |
|
2694 |
|
|
|
2695 |
gpgKey lastKey; |
2696 |
bool gotLastKey = false; |
2697 |
bool isbold=false; |
2698 |
bool isexpired=false; |
2695 |
QString defaultKey = KGpgSettings::defaultKey(); |
2699 |
QString defaultKey = KGpgSettings::defaultKey(); |
2696 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r"); |
2700 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys --fixed-list-mode", "r"); |
2697 |
while ( fgets( line, sizeof(line), fp)) { |
2701 |
while ( fgets( line, sizeof(line), fp)) { |
2698 |
tst=QString::fromUtf8(line); |
2702 |
tst=QString::fromUtf8(line); |
2699 |
kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl; |
2703 |
kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl; |
2700 |
if (tst.startsWith("pub")) { |
2704 |
if (tst.startsWith("pub")) { |
2701 |
emptyList=false; |
2705 |
emptyList=false; |
2702 |
noID=false; |
2706 |
noID=false; |
2703 |
gpgKey pubKey=extractKey(tst); |
2707 |
lastKey=extractKey(tst); |
|
|
2708 |
gotLastKey = true; |
2704 |
|
2709 |
|
2705 |
bool isbold=false; |
2710 |
if (lastKey.gpgkeyid==defaultKey) |
2706 |
bool isexpired=false; |
|
|
2707 |
if (pubKey.gpgkeyid==defaultKey) |
2708 |
isbold=true; |
2711 |
isbold=true; |
2709 |
if (pubKey.gpgkeytrust==i18n("Expired")) |
2712 |
if (lastKey.gpgkeytrust==i18n("Expired")) |
2710 |
isexpired=true; |
2713 |
isexpired=true; |
2711 |
if (pubKey.gpgkeyname.isEmpty()) |
2714 |
if (lastKey.gpgkeyname.isEmpty()) |
2712 |
noID=true; |
2715 |
noID=true; |
|
|
2716 |
} else if (tst.startsWith("uid")) { |
2717 |
if (gotLastKey) { |
2718 |
gpgKey uidKey = extractKey(tst); |
2719 |
item=new UpdateViewItem(this,uidKey.gpgkeyname,uidKey.gpgkeymail,QString::null,lastKey.gpgkeyexpiration,lastKey.gpgkeysize,lastKey.gpgkeycreation,lastKey.gpgkeyid,isbold,isexpired); |
2713 |
|
2720 |
|
2714 |
item=new UpdateViewItem(this,pubKey.gpgkeyname,pubKey.gpgkeymail,QString::null,pubKey.gpgkeyexpiration,pubKey.gpgkeysize,pubKey.gpgkeycreation,pubKey.gpgkeyid,isbold,isexpired); |
2721 |
item->setPixmap(2,uidKey.trustpic); |
|
|
2722 |
item->setExpandable(true); |
2715 |
|
2723 |
|
2716 |
item->setPixmap(2,pubKey.trustpic); |
2724 |
QStringList::Iterator ite; |
2717 |
item->setExpandable(true); |
2725 |
ite=issec.find(lastKey.gpgkeyid.right(8)); |
|
|
2726 |
if (ite!=issec.end()) { |
2727 |
item->setPixmap(0,pixkeyPair); |
2728 |
secretList+=lastKey.gpgkeyid; |
2729 |
issec.remove(*ite); |
2730 |
} else item->setPixmap(0,pixkeySingle); |
2718 |
|
2731 |
|
|
|
2732 |
if (openKeys.find(lastKey.gpgkeyid)!=-1) |
2733 |
item->setOpen(true); |
2719 |
|
2734 |
|
2720 |
QStringList::Iterator ite; |
2735 |
gotLastKey = false; |
2721 |
ite=issec.find(pubKey.gpgkeyid.right(8)); |
2736 |
} |
2722 |
if (ite!=issec.end()) { |
|
|
2723 |
item->setPixmap(0,pixkeyPair); |
2724 |
secretList+=pubKey.gpgkeyid; |
2725 |
issec.remove(*ite); |
2726 |
} else item->setPixmap(0,pixkeySingle); |
2727 |
|
2737 |
|
2728 |
if (openKeys.find(pubKey.gpgkeyid)!=-1) |
|
|
2729 |
item->setOpen(true); |
2730 |
} |
2738 |
} |
2731 |
|
2739 |
|
2732 |
} |
2740 |
} |
Lines 2779-2785
Link Here
|
2779 |
char line[300]; |
2787 |
char line[300]; |
2780 |
UpdateViewItem *item=NULL; |
2788 |
UpdateViewItem *item=NULL; |
2781 |
bool keyFound=false; |
2789 |
bool keyFound=false; |
2782 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2790 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --fixed-list-mode --list-secret-keys", "r"); |
2783 |
while ( fgets( line, sizeof(line), fp)) { |
2791 |
while ( fgets( line, sizeof(line), fp)) { |
2784 |
QString lineRead=QString::fromUtf8(line); |
2792 |
QString lineRead=QString::fromUtf8(line); |
2785 |
if ((lineRead.startsWith("sec")) && (lineRead.section(':',4,4).right(8))==currentID.right(8)) { |
2793 |
if ((lineRead.startsWith("sec")) && (lineRead.section(':',4,4).right(8))==currentID.right(8)) { |
Lines 2813-2819
Link Here
|
2813 |
{ |
2821 |
{ |
2814 |
FILE *fp; |
2822 |
FILE *fp; |
2815 |
char line[300]; |
2823 |
char line[300]; |
2816 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2824 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --fixed-list-mode --list-secret-keys", "r"); |
2817 |
while ( fgets( line, sizeof(line), fp)) { |
2825 |
while ( fgets( line, sizeof(line), fp)) { |
2818 |
QString lineRead=QString::fromUtf8(line); |
2826 |
QString lineRead=QString::fromUtf8(line); |
2819 |
if ((lineRead.startsWith("sec")) && (orphans.find(lineRead.section(':',4,4).right(8))!=orphans.end())) { |
2827 |
if ((lineRead.startsWith("sec")) && (orphans.find(lineRead.section(':',4,4).right(8))!=orphans.end())) { |
Lines 2892-2898
Link Here
|
2892 |
FILE *fp,*fp2; |
2900 |
FILE *fp,*fp2; |
2893 |
char line[300]; |
2901 |
char line[300]; |
2894 |
|
2902 |
|
2895 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2903 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --fixed-list-mode --list-secret-keys", "r"); |
2896 |
while ( fgets( line, sizeof(line), fp2)) { |
2904 |
while ( fgets( line, sizeof(line), fp2)) { |
2897 |
QString lineRead=QString::fromUtf8(line); |
2905 |
QString lineRead=QString::fromUtf8(line); |
2898 |
if (lineRead.startsWith("sec")) |
2906 |
if (lineRead.startsWith("sec")) |
Lines 2900-2906
Link Here
|
2900 |
} |
2908 |
} |
2901 |
pclose(fp2); |
2909 |
pclose(fp2); |
2902 |
|
2910 |
|
2903 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r"); |
2911 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --fixed-list-mode --list-keys", "r"); |
2904 |
while ( fgets( line, sizeof(line), fp)) { |
2912 |
while ( fgets( line, sizeof(line), fp)) { |
2905 |
QString lineRead=QString::fromUtf8(line); |
2913 |
QString lineRead=QString::fromUtf8(line); |
2906 |
if (lineRead.startsWith("pub")) |
2914 |
if (lineRead.startsWith("pub")) |
Lines 2929-2935
Link Here
|
2929 |
FILE *fp,*fp2; |
2937 |
FILE *fp,*fp2; |
2930 |
char line[300]; |
2938 |
char line[300]; |
2931 |
|
2939 |
|
2932 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2940 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --fixed-list-mode --list-secret-keys", "r"); |
2933 |
while ( fgets( line, sizeof(line), fp2)) { |
2941 |
while ( fgets( line, sizeof(line), fp2)) { |
2934 |
QString lineRead=QString::fromUtf8(line); |
2942 |
QString lineRead=QString::fromUtf8(line); |
2935 |
if (lineRead.startsWith("sec")) |
2943 |
if (lineRead.startsWith("sec")) |
Lines 2941-2947
Link Here
|
2941 |
|
2949 |
|
2942 |
QString tst; |
2950 |
QString tst; |
2943 |
bool keyFound=false; |
2951 |
bool keyFound=false; |
2944 |
QString cmd="gpg --no-secmem-warning --no-tty --with-colons --list-keys "+currentID; |
2952 |
QString cmd="gpg --no-secmem-warning --no-tty --with-colons --fixed-list-mode --list-keys "+currentID; |
2945 |
fp = popen(QFile::encodeName(cmd), "r"); |
2953 |
fp = popen(QFile::encodeName(cmd), "r"); |
2946 |
while ( fgets( line, sizeof(line), fp)) { |
2954 |
while ( fgets( line, sizeof(line), fp)) { |
2947 |
tst=QString::fromUtf8(line); |
2955 |
tst=QString::fromUtf8(line); |
Lines 3046-3053
Link Here
|
3046 |
ret.gpgkeysize=keyString[2]; |
3054 |
ret.gpgkeysize=keyString[2]; |
3047 |
ret.gpgkeycreation=keyString[5]; |
3055 |
ret.gpgkeycreation=keyString[5]; |
3048 |
if(!ret.gpgkeycreation.isEmpty()) { |
3056 |
if(!ret.gpgkeycreation.isEmpty()) { |
3049 |
QDate date = QDate::fromString(ret.gpgkeycreation, Qt::ISODate); |
3057 |
QDateTime dateTime; |
3050 |
ret.gpgkeycreation=KGlobal::locale()->formatDate(date, true); |
3058 |
dateTime.setTime_t(ret.gpgkeycreation.toUInt()); |
|
|
3059 |
ret.gpgkeycreation=KGlobal::locale()->formatDate(dateTime.date(), true); |
3051 |
} |
3060 |
} |
3052 |
QString tid=keyString[4]; |
3061 |
QString tid=keyString[4]; |
3053 |
ret.gpgkeyid=QString("0x"+tid.right(8)); |
3062 |
ret.gpgkeyid=QString("0x"+tid.right(8)); |
Lines 3055-3062
Link Here
|
3055 |
if (ret.gpgkeyexpiration.isEmpty()) |
3064 |
if (ret.gpgkeyexpiration.isEmpty()) |
3056 |
ret.gpgkeyexpiration=i18n("Unlimited"); |
3065 |
ret.gpgkeyexpiration=i18n("Unlimited"); |
3057 |
else { |
3066 |
else { |
3058 |
QDate date = QDate::fromString(ret.gpgkeyexpiration, Qt::ISODate); |
3067 |
QDateTime dateTime; |
3059 |
ret.gpgkeyexpiration=KGlobal::locale()->formatDate(date, true); |
3068 |
dateTime.setTime_t(ret.gpgkeyexpiration.toUInt()); |
|
|
3069 |
ret.gpgkeyexpiration=KGlobal::locale()->formatDate(dateTime.date(), true); |
3060 |
} |
3070 |
} |
3061 |
QString fullname=keyString[9]; |
3071 |
QString fullname=keyString[9]; |
3062 |
if (fullname.find("<")!=-1) { |
3072 |
if (fullname.find("<")!=-1) { |