By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 2791
Collapse All | Expand All

(-)tdeutils.orig/kgpg/keyinfowidget.cpp (-85 / +150 lines)
Lines 4-9 Link Here
4
    begin                : Mon Nov 18 2002
4
    begin                : Mon Nov 18 2002
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
6
    email                : bj@altern.org
6
    email                : bj@altern.org
7
8
    updated to handle gpg21 : Sun Jul 30 10:18:29 CEST 2017
9
    copyright          : (C) 2017 by Emanoil Kotsev
10
    email              : deloptes@yahoo.com
7
 ***************************************************************************/
11
 ***************************************************************************/
8
12
9
/***************************************************************************
13
/***************************************************************************
Lines 90-125 Link Here
90
94
91
void KgpgKeyInfo::slotDisableKey(bool isOn)
95
void KgpgKeyInfo::slotDisableKey(bool isOn)
92
{
96
{
93
TDEProcess kp;
97
//	kdDebug(2100) << k_funcinfo << endl;
98
	TDEProcess kp;
94
99
95
	kp<<"gpg"
100
	kp<<"gpg" <<"--no-tty" <<"--edit-key" <<displayedKeyID;
96
        <<"--no-tty"
101
	if (isOn) kp<<"disable";
97
	<<"--edit-key"
102
	else kp<<"enable";
98
        <<displayedKeyID;
99
if (isOn) kp<<"disable";
100
else kp<<"enable";
101
	kp<<"save";
103
	kp<<"save";
102
        kp.start(TDEProcess::Block);
104
        kp.start(TDEProcess::Block);
103
loadKey(displayedKeyID);
105
	loadKey(displayedKeyID);
104
keyWasChanged=true;
106
	keyWasChanged=true;
105
}
107
}
106
108
107
void KgpgKeyInfo::loadKey(TQString Keyid)
109
void KgpgKeyInfo::loadKey(TQString Keyid)
108
{
110
{
109
TQColor trustColor;
111
//	kdDebug(2100) << k_funcinfo << endl;
110
TQString fingervalue=TQString();
112
	FILE *pass;
111
FILE *pass;
113
	char line[200]="";
112
char line[200]="";
114
	TQString currentKey;
113
TQString gpgOutput,fullID;
115
	TQMap<TQString,TQStringList> hashMap;
114
116
115
TQString gpgcmd="gpg --no-tty --no-secmem-warning --with-colon --with-fingerprint --list-key "+KShellProcess::quote(Keyid);
117
	TQString gpgcmd="gpg --no-tty --no-secmem-warning --with-colon --with-fingerprint --list-key "+KShellProcess::quote(Keyid);
116
118
117
        pass=popen(TQFile::encodeName(gpgcmd),"r");
119
        pass=popen(TQFile::encodeName(gpgcmd),"r");
118
        while ( fgets( line, sizeof(line), pass)) {
120
	while ( fgets( line, sizeof(line), pass) ) {
119
                gpgOutput=TQString::fromUtf8(line);
121
		TQString tst=TQString::fromUtf8(line);
122
                if ( tst.startsWith("pub")  ) {
123
                	currentKey = tst.section(':',4,4);
124
                	TQStringList lst; lst << tst;
125
			hashMap.insert(currentKey,lst);
126
                }
127
		else
128
			hashMap.find(currentKey).data().append(tst);
129
130
	}
131
	pclose(pass);
132
133
	TQMap<TQString,TQStringList>::Iterator ite;
134
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
135
		TQStringList::Iterator it;
136
		TQString fullname,gpgOutput;
137
		TQColor trustColor;
138
		TQString fingervalue=TQString();
139
140
		for (it = ite.data().begin(); it != ite.data().end(); it++) {	
141
			TQString gpgOutput =  (*it);
142
120
                if (gpgOutput.startsWith("uat"))
143
                if (gpgOutput.startsWith("uat"))
121
                        hasPhoto=true;
144
                        hasPhoto=true;
122
                if (gpgOutput.startsWith("pub")) {
145
			if ( gpgOutput.startsWith("pub") ) {
123
                        TQString algo=gpgOutput.section(':',3,3);
146
                        TQString algo=gpgOutput.section(':',3,3);
124
                        switch( algo.toInt() ) {
147
                        switch( algo.toInt() ) {
125
                        case  1:
148
                        case  1:
Lines 198-216 Link Here
198
                        prop->kLTrust->setText(tr);
221
                        prop->kLTrust->setText(tr);
199
                        prop->pixmapTrust->setPaletteBackgroundColor(trustColor);
222
                        prop->pixmapTrust->setPaletteBackgroundColor(trustColor);
200
223
201
			fullID=gpgOutput.section(':',4,4);
224
				TQString fullID=gpgOutput.section(':',4,4);
202
                        displayedKeyID=fullID.right(8);
225
                        displayedKeyID=fullID.right(8);
203
                        prop->tLID->setText(fullID);
226
                        prop->tLID->setText(fullID);
204
227
205
                        TQString fullname=gpgOutput.section(':',9,9);
228
				fullname=gpgOutput.section(':',9,9);
206
229
207
                        TQDate date = TQDate::fromString(gpgOutput.section(':',5,5), Qt::ISODate);
208
                        prop->tLCreation->setText(TDEGlobal::locale()->formatDate(date));
209
230
231
				TQDate date;
232
				if (KgpgInterface::getGpgVersion() >= 210 ) {
233
					TQDateTime timestamp;
234
					timestamp.setTime_t(gpgOutput.section(':',5,5).toInt());
235
					date = timestamp.date();
236
				}
237
				else {
238
					date = TQDate::fromString(gpgOutput.section(':',5,5), Qt::ISODate);
239
				}
240
				Q_ASSERT ( date.isValid())/*  tqWarning("create date is not valid")*/;
241
	
242
				prop->tLCreation->setText(TDEGlobal::locale()->formatDate(date));
210
			if (gpgOutput.section(':',6,6).isEmpty()) expirationDate=i18n("Unlimited");
243
			if (gpgOutput.section(':',6,6).isEmpty()) expirationDate=i18n("Unlimited");
211
			else
244
			else
212
			{
245
			{
246
					if (KgpgInterface::getGpgVersion() >= 210 ) {
247
						TQDateTime timestamp;
248
						timestamp.setTime_t(gpgOutput.section(':',6,6).toInt());
249
						date = timestamp.date();
250
					}
251
					else {
213
			date = TQDate::fromString(gpgOutput.section(':',6,6), Qt::ISODate);
252
			date = TQDate::fromString(gpgOutput.section(':',6,6), Qt::ISODate);
253
					}
254
					Q_ASSERT (date.isValid()) /* tqWarning("Expirationdate date is not valid")*/;
214
			expirationDate=TDEGlobal::locale()->formatDate(date);
255
			expirationDate=TDEGlobal::locale()->formatDate(date);
215
			}
256
			}
216
                        prop->tLExpiration->setText(expirationDate);
257
                        prop->tLExpiration->setText(expirationDate);
Lines 240-246 Link Here
240
                                break;
281
                                break;
241
                        }
282
                        }
242
                        prop->kCOwnerTrust->setCurrentItem(ownerTrust);
283
                        prop->kCOwnerTrust->setCurrentItem(ownerTrust);
284
			}
285
	
286
 			if ( gpgOutput.startsWith("uid") && fullname.isEmpty() )
287
 				fullname = gpgOutput.section(':',9,9);
288
289
			if (gpgOutput.startsWith("fpr") && (fingervalue.isNull())) {
290
				fingervalue=gpgOutput.section(':',9,9);
291
				// format fingervalue in 4-digit groups
292
				uint len = fingervalue.length();
293
				if ((len > 0) && (len % 4 == 0))
294
					for (uint n = 0; 4*(n+1) < len; n++)
295
						fingervalue.insert(5*n+4, ' ');
296
						prop->lEFinger->setText(fingervalue);
297
			}
298
		}
243
299
300
		if (!fullname.isEmpty()) {
244
                        if (fullname.find("<")!=-1) {
301
                        if (fullname.find("<")!=-1) {
245
                                TQString kmail=fullname;
302
                                TQString kmail=fullname;
246
				if (fullname.find(")")!=-1)
303
				if (fullname.find(")")!=-1)
Lines 266-294 Link Here
266
                                prop->tLComment->setText(i18n("none"));
323
                                prop->tLComment->setText(i18n("none"));
267
324
268
			prop->tLName->setText("<qt><b>"+KgpgInterface::checkForUtf8(kname).replace(TQRegExp("<"),"&lt;")+"</b></qt>");
325
			prop->tLName->setText("<qt><b>"+KgpgInterface::checkForUtf8(kname).replace(TQRegExp("<"),"&lt;")+"</b></qt>");
269
270
                }
271
		if (gpgOutput.startsWith("fpr") && (fingervalue.isNull())) {
272
                        fingervalue=gpgOutput.section(':',9,9);
273
                        // format fingervalue in 4-digit groups
274
                        uint len = fingervalue.length();
275
                        if ((len > 0) && (len % 4 == 0))
276
                                for (uint n = 0; 4*(n+1) < len; n++)
277
                                        fingervalue.insert(5*n+4, ' ');
278
					prop->lEFinger->setText(fingervalue);
279
                }
326
                }
280
        }
327
        }
281
        pclose(pass);
282
}
328
}
283
329
284
void KgpgKeyInfo::slotSetMainPhoto(TQStringList list)
330
void KgpgKeyInfo::slotSetMainPhoto(TQStringList list)
285
{
331
{
332
//	kdDebug(2100) << k_funcinfo << endl;
286
prop->comboId->insertStringList(list);
333
prop->comboId->insertStringList(list);
287
reloadMainPhoto(prop->comboId->currentText());
334
reloadMainPhoto(prop->comboId->currentText());
288
}
335
}
289
336
290
void KgpgKeyInfo::reloadMainPhoto(const TQString &uid)
337
void KgpgKeyInfo::reloadMainPhoto(const TQString &uid)
291
{
338
{
339
//	kdDebug(2100) << k_funcinfo << endl;
292
340
293
                kgpginfotmp=new KTempFile();
341
                kgpginfotmp=new KTempFile();
294
                kgpginfotmp->setAutoDelete(true);
342
                kgpginfotmp->setAutoDelete(true);
Lines 305-310 Link Here
305
353
306
void KgpgKeyInfo::slotMainImageRead(TDEProcess *p)
354
void KgpgKeyInfo::slotMainImageRead(TDEProcess *p)
307
{
355
{
356
//	kdDebug(2100) << k_funcinfo << endl;
308
	p->deleteLater();
357
	p->deleteLater();
309
	TQPixmap pixmap;
358
	TQPixmap pixmap;
310
        pixmap.load(kgpginfotmp->name());
359
        pixmap.load(kgpginfotmp->name());
Lines 319-328 Link Here
319
368
320
void KgpgKeyInfo::slotSetPhoto(const TQPixmap &pix)
369
void KgpgKeyInfo::slotSetPhoto(const TQPixmap &pix)
321
{
370
{
322
TQImage dup=pix.convertToImage();
371
//	kdDebug(2100) << k_funcinfo << endl;
323
TQPixmap dup2;
372
	TQImage dup=pix.convertToImage();
324
dup2.convertFromImage(dup.scale(prop->pLPhoto->width(),prop->pLPhoto->height(),TQ_ScaleMin));
373
	TQPixmap dup2;
325
prop->pLPhoto->setPixmap(dup2);
374
	dup2.convertFromImage(dup.scale(prop->pLPhoto->width(),prop->pLPhoto->height(),TQ_ScaleMin));
375
	prop->pLPhoto->setPixmap(dup2);
326
}
376
}
327
377
328
378
Lines 330-335 Link Here
330
380
331
void KgpgKeyInfo::finishphotoreadprocess(KProcIO *p)
381
void KgpgKeyInfo::finishphotoreadprocess(KProcIO *p)
332
{
382
{
383
//	kdDebug(2100) << k_funcinfo << endl;
333
        TQString required=TQString();
384
        TQString required=TQString();
334
        while (p->readln(required,true)!=-1)
385
        while (p->readln(required,true)!=-1)
335
		if (required.find("keyedit.prompt")!=-1) {
386
		if (required.find("keyedit.prompt")!=-1) {
Lines 342-347 Link Here
342
393
343
void KgpgKeyInfo::openPhoto()
394
void KgpgKeyInfo::openPhoto()
344
{
395
{
396
//	kdDebug(2100) << k_funcinfo << endl;
345
			 TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'");
397
			 TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'");
346
 			KService::Ptr ptr = offers.first();
398
 			KService::Ptr ptr = offers.first();
347
 			//KMessageBox::sorry(0,ptr->desktopEntryName());
399
 			//KMessageBox::sorry(0,ptr->desktopEntryName());
Lines 352-389 Link Here
352
404
353
void KgpgKeyInfo::slotChangeExp()
405
void KgpgKeyInfo::slotChangeExp()
354
{
406
{
355
chdate=new KDialogBase( this, "choose_date", true,i18n("Choose New Expiration"),KDialogBase::Ok | KDialogBase::Cancel);
407
//	kdDebug(2100) << k_funcinfo << endl;
356
TQWidget *page = new TQWidget(chdate);
408
	chdate=new KDialogBase( this, "choose_date", true,i18n("Choose New Expiration"),KDialogBase::Ok | KDialogBase::Cancel);
357
kb= new TQCheckBox(i18n("Unlimited"),page );
409
	TQWidget *page = new TQWidget(chdate);
358
410
	kb= new TQCheckBox(i18n("Unlimited"),page );
359
if (prop->tLExpiration->text()==i18n("Unlimited"))
411
	
360
{
412
	if (prop->tLExpiration->text()==i18n("Unlimited"))
361
kdt= new KDatePicker( page );
413
	{
362
kb->setChecked(true);
414
		kdt= new KDatePicker( page );
363
kdt->setEnabled(false);
415
		kb->setChecked(true);
364
}
416
		kdt->setEnabled(false);
365
else
417
	}
366
kdt= new KDatePicker(page,TDEGlobal::locale()->readDate(prop->tLExpiration->text()));
418
	else
367
TQVBoxLayout *vbox=new TQVBoxLayout(page,3);
419
		kdt= new KDatePicker(page,TDEGlobal::locale()->readDate(prop->tLExpiration->text()));
368
vbox->addWidget(kdt);
420
	TQVBoxLayout *vbox=new TQVBoxLayout(page,3);
369
vbox->addWidget(kb);
421
	vbox->addWidget(kdt);
370
connect(kb,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableDate(bool)));
422
	vbox->addWidget(kb);
371
connect(chdate,TQT_SIGNAL(okClicked()),this,TQT_SLOT(slotChangeDate()));
423
	connect(kb,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableDate(bool)));
372
connect(kdt,TQT_SIGNAL(dateChanged(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
424
	connect(chdate,TQT_SIGNAL(okClicked()),this,TQT_SLOT(slotChangeDate()));
373
connect(kdt,TQT_SIGNAL(dateEntered(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
425
	connect(kdt,TQT_SIGNAL(dateChanged(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
426
	connect(kdt,TQT_SIGNAL(dateEntered(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
374
427
375
chdate->setMainWidget(page);
428
	chdate->setMainWidget(page);
376
chdate->show();
429
	chdate->show();
377
}
430
}
378
431
379
void KgpgKeyInfo::slotCheckDate(TQDate date)
432
void KgpgKeyInfo::slotCheckDate(TQDate date)
380
{
433
{
381
chdate->enableButtonOK(date>=TQDate::currentDate ());
434
//	kdDebug(2100) << k_funcinfo << endl;
435
//kdDebug(2100) << "slotCheckDate" << date<<endl;
436
	chdate->enableButtonOK(date>=TQDate::currentDate ());
382
}
437
}
383
438
384
void KgpgKeyInfo::slotChangeDate()
439
void KgpgKeyInfo::slotChangeDate()
385
{
440
{
386
KgpgInterface *KeyExpirationProcess=new KgpgInterface();
441
//	kdDebug(2100) << k_funcinfo << endl;
442
	KgpgInterface *KeyExpirationProcess=new KgpgInterface();
443
//kdDebug(2100) << "slotChangeDate" << kdt->date()<<endl;
387
		if (kb->isChecked())
444
		if (kb->isChecked())
388
                KeyExpirationProcess->KgpgKeyExpire(displayedKeyID,TQDate::currentDate(),true);
445
                KeyExpirationProcess->KgpgKeyExpire(displayedKeyID,TQDate::currentDate(),true);
389
		else
446
		else
Lines 393-412 Link Here
393
450
394
void KgpgKeyInfo::slotEnableDate(bool isOn)
451
void KgpgKeyInfo::slotEnableDate(bool isOn)
395
{
452
{
396
if (isOn)
453
//	kdDebug(2100) << k_funcinfo << endl;
397
{
454
	if (isOn)
398
kdt->setEnabled(false);
455
	{
399
chdate->enableButtonOK(true);
456
		kdt->setEnabled(false);
400
}
457
		chdate->enableButtonOK(true);
401
else
458
	}
402
{
459
	else
403
kdt->setEnabled(true);
460
	{
404
chdate->enableButtonOK(kdt->date()>=TQDate::currentDate ());
461
		kdt->setEnabled(true);
405
}
462
		//kdDebug(2100) << "slotEnableDate" << kdt->date()<<endl;
463
		chdate->enableButtonOK(kdt->date()>=TQDate::currentDate ());
464
	}
406
}
465
}
407
466
408
void KgpgKeyInfo::slotinfoimgread(TDEProcess *)
467
void KgpgKeyInfo::slotinfoimgread(TDEProcess *)
409
{
468
{
469
//	kdDebug(2100) << k_funcinfo << endl;
410
	TQPixmap pixmap;
470
	TQPixmap pixmap;
411
        pixmap.load(kgpginfotmp->name());
471
        pixmap.load(kgpginfotmp->name());
412
	emit signalPhotoId(pixmap);
472
	emit signalPhotoId(pixmap);
Lines 415-420 Link Here
415
475
416
void KgpgKeyInfo::slotChangePass()
476
void KgpgKeyInfo::slotChangePass()
417
{
477
{
478
//	kdDebug(2100) << k_funcinfo << endl;
418
        KgpgInterface *ChangeKeyPassProcess=new KgpgInterface();
479
        KgpgInterface *ChangeKeyPassProcess=new KgpgInterface();
419
        ChangeKeyPassProcess->KgpgChangePass(displayedKeyID);
480
        ChangeKeyPassProcess->KgpgChangePass(displayedKeyID);
420
	connect(ChangeKeyPassProcess,TQT_SIGNAL(passwordChanged()),this,TQT_SLOT(slotInfoPasswordChanged()));
481
	connect(ChangeKeyPassProcess,TQT_SIGNAL(passwordChanged()),this,TQT_SLOT(slotInfoPasswordChanged()));
Lines 422-427 Link Here
422
483
423
void KgpgKeyInfo::slotChangeTrust(int newTrust)
484
void KgpgKeyInfo::slotChangeTrust(int newTrust)
424
{
485
{
486
//	kdDebug(2100) << k_funcinfo << endl;
425
        KgpgInterface *KeyTrustProcess=new KgpgInterface();
487
        KgpgInterface *KeyTrustProcess=new KgpgInterface();
426
                KeyTrustProcess->KgpgTrustExpire(displayedKeyID,newTrust);
488
                KeyTrustProcess->KgpgTrustExpire(displayedKeyID,newTrust);
427
                connect(KeyTrustProcess,TQT_SIGNAL(trustfinished()),this,TQT_SLOT(slotInfoTrustChanged()));
489
                connect(KeyTrustProcess,TQT_SIGNAL(trustfinished()),this,TQT_SLOT(slotInfoTrustChanged()));
Lines 430-465 Link Here
430
492
431
void KgpgKeyInfo::slotInfoPasswordChanged()
493
void KgpgKeyInfo::slotInfoPasswordChanged()
432
{
494
{
495
// 	kdDebug(2100) << k_funcinfo << endl;
433
KPassivePopup::message(i18n("Passphrase for the key was changed"),TQString(),TDEGlobal::iconLoader()->loadIcon("kgpg",TDEIcon::Desktop),this);
496
KPassivePopup::message(i18n("Passphrase for the key was changed"),TQString(),TDEGlobal::iconLoader()->loadIcon("kgpg",TDEIcon::Desktop),this);
434
}
497
}
435
498
436
void KgpgKeyInfo::slotInfoTrustChanged()
499
void KgpgKeyInfo::slotInfoTrustChanged()
437
{
500
{
438
keyWasChanged=true;
501
	keyWasChanged=true;
439
loadKey(displayedKeyID);
502
	loadKey(displayedKeyID);
440
//KPassivePopup::message(i18n("Owner trust of the key was changed"),TQString(),TDEGlobal::iconLoader()->loadIcon("kgpg",TDEIcon::Desktop),this,0,600);
503
//KPassivePopup::message(i18n("Owner trust of the key was changed"),TQString(),TDEGlobal::iconLoader()->loadIcon("kgpg",TDEIcon::Desktop),this,0,600);
441
}
504
}
442
505
443
void KgpgKeyInfo::slotInfoExpirationChanged(int res)
506
void KgpgKeyInfo::slotInfoExpirationChanged(int res)
444
{
507
{
445
TQString infoMessage,infoText;
508
// 	kdDebug(2100) << k_funcinfo << endl;
446
if (res==3)
509
	TQString infoMessage,infoText;
447
{
510
	if (res==3)
448
keyWasChanged=true;
511
	{
449
if (kb->isChecked()) prop->tLExpiration->setText(i18n("Unlimited"));
512
		keyWasChanged=true;
450
else prop->tLExpiration->setText(TDEGlobal::locale()->formatDate(kdt->date()));
513
		if (kb->isChecked()) prop->tLExpiration->setText(i18n("Unlimited"));
451
}
514
		else prop->tLExpiration->setText(TDEGlobal::locale()->formatDate(kdt->date()));
452
if (res==2) {
515
	}
453
infoMessage=i18n("Could not change expiration");infoText=i18n("Bad passphrase");
516
	if (res==2) {
454
KPassivePopup::message(infoMessage,infoText,TDEGlobal::iconLoader()->loadIcon("kgpg",TDEIcon::Desktop),this);
517
		infoMessage=i18n("Could not change expiration");infoText=i18n("Bad passphrase");
455
}
518
		KPassivePopup::message(infoMessage,infoText,TDEGlobal::iconLoader()->loadIcon("kgpg",TDEIcon::Desktop),this);
519
	}
456
}
520
}
457
521
458
522
459
void KgpgKeyInfo::slotPreOk()
523
void KgpgKeyInfo::slotPreOk()
460
{
524
{
461
if (keyWasChanged) emit keyNeedsRefresh();
525
// 	kdDebug(2100) << k_funcinfo << endl;
462
accept();
526
	if (keyWasChanged) emit keyNeedsRefresh();
527
	accept();
463
}
528
}
464
529
465
#include "keyinfowidget.moc"
530
#include "keyinfowidget.moc"
(-)tdeutils.orig/kgpg/keyservers.cpp (-11 / +48 lines)
Lines 4-9 Link Here
4
    begin                : Tue Nov 26 2002
4
    begin                : Tue Nov 26 2002
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
6
    email                : bj@altern.org
6
    email                : bj@altern.org
7
8
    updated to handle gpg21 : Sun Jul 30 10:18:29 CEST 2017
9
    copyright          : (C) 2017 by Emanoil Kotsev
10
    email              : deloptes@yahoo.com
7
 ***************************************************************************/
11
 ***************************************************************************/
8
12
9
/***************************************************************************
13
/***************************************************************************
Lines 67-76 Link Here
67
        connect(page->Buttonexport,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotPreExport()));
71
        connect(page->Buttonexport,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotPreExport()));
68
        connect(this,TQT_SIGNAL(okClicked()),this,TQT_SLOT(slotOk()));
72
        connect(this,TQT_SIGNAL(okClicked()),this,TQT_SLOT(slotOk()));
69
73
74
	if (KgpgInterface::getGpgVersion() < 210 ) { // was removed in 2.1
70
        connect(page->cBproxyI,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableProxyI(bool)));
75
        connect(page->cBproxyI,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableProxyI(bool)));
71
        connect(page->cBproxyE,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableProxyE(bool)));
76
        connect(page->cBproxyE,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableProxyE(bool)));
77
	}
72
78
73
        connect(page->kLEimportid,  TQT_SIGNAL( textChanged ( const TQString & )), this,  TQT_SLOT( slotTextChanged( const TQString &)));
79
        connect(page->kLEimportid,  TQT_SIGNAL( textChanged ( const TQString & )), this,  TQT_SLOT( slotTextChanged( const TQString &)));
80
	if (KgpgInterface::getGpgVersion() < 210 ) { // was removed in 2.1
74
	page->cBproxyI->setChecked(KGpgSettings::useProxy());
81
	page->cBproxyI->setChecked(KGpgSettings::useProxy());
75
        page->cBproxyE->setChecked(KGpgSettings::useProxy());
82
        page->cBproxyE->setChecked(KGpgSettings::useProxy());
76
        const char *httpproxy = getenv("http_proxy");
83
        const char *httpproxy = getenv("http_proxy");
Lines 80-85 Link Here
80
                page->kLEproxyI->setText(httpproxy);
87
                page->kLEproxyI->setText(httpproxy);
81
                page->kLEproxyE->setText(httpproxy);
88
                page->kLEproxyE->setText(httpproxy);
82
        }
89
        }
90
        }
83
91
84
92
85
        KProcIO *encid=new KProcIO(TQTextCodec::codecForLocale());
93
        KProcIO *encid=new KProcIO(TQTextCodec::codecForLocale());
Lines 117-130 Link Here
117
void keyServer::slotprocread(KProcIO *p)
125
void keyServer::slotprocread(KProcIO *p)
118
{
126
{
119
        ///////////////////////////////////////////////////////////////// extract  encryption keys
127
        ///////////////////////////////////////////////////////////////// extract  encryption keys
120
        bool dead;
128
//         bool dead;
121
        TQString tst;
129
        TQString tst,currentKey;
130
	TQMap<TQString,TQStringList> hashMap;
122
	//TQPixmap pixkeySingle(TDEGlobal::iconLoader()->loadIcon("kgpg_key1",TDEIcon::Small,20));
131
	//TQPixmap pixkeySingle(TDEGlobal::iconLoader()->loadIcon("kgpg_key1",TDEIcon::Small,20));
123
        while (p->readln(tst)!=-1) {
132
        while (p->readln(tst)!=-1) {
133
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
134
                if ( tst.startsWith("pub")  ) {
135
                	currentKey = tst.section(':',4,4);
136
                	TQStringList lst; lst << tst;
137
			hashMap.insert(currentKey,tst);
138
                }
139
		else
140
			hashMap.find(currentKey).data().append(tst);
141
142
	}
143
144
	TQMap<TQString,TQStringList>::Iterator ite;
145
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
146
		TQStringList::Iterator it;
147
		TQString fullname,id;
148
		bool dead;
149
150
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
151
			TQString line =  (*it);
124
                //tst=tst.stripWhiteSpace();
152
                //tst=tst.stripWhiteSpace();
125
                if (tst.startsWith("pub")) {
153
                if (tst.startsWith("pub")) {
126
                        const TQString trust=tst.section(':',1,1);
154
                        const TQString trust=tst.section(':',1,1);
127
                        TQString id=TQString("0x"+tst.section(':',4,4).right(8));
155
				id=TQString("0x"+tst.section(':',4,4).right(8));
128
                        switch( trust[0] ) {
156
                        switch( trust[0] ) {
129
                        case 'i':
157
                        case 'i':
130
                                dead=true;
158
                                dead=true;
Lines 142-156 Link Here
142
                                dead=false;
170
                                dead=false;
143
                                break;
171
                                break;
144
                        }
172
                        }
145
                        tst=tst.section(':',9,9);
173
				fullname = tst.section(':',9,9);
146
                        if (tst.length()>35) {
174
			}
147
                                tst.remove(35,tst.length());
175
 			if ( line.startsWith("uid") && fullname.isEmpty() )
148
                                tst+="...";
176
 				fullname = line.section(':',9,9);
149
                        }
150
                        if ((!dead) && (!tst.isEmpty()))
151
//                                page->kCBexportkey->insertItem(pixkeySingle,id+": "+tst);
152
                                page->kCBexportkey->insertItem(id+": "+tst);
153
                }
177
                }
178
		if (fullname.length()>35) {
179
			fullname.remove(35,fullname.length());
180
			fullname+="...";
181
		}
182
		if ((!dead) && (!fullname.isEmpty()))
183
	//		page->kCBexportkey->insertItem(pixkeySingle,id+": "+tst);
184
			page->kCBexportkey->insertItem(id+": "+fullname);
154
        }
185
        }
155
}
186
}
156
187
Lines 188-198 Link Here
188
        searchproc=new KProcIO(TQTextCodec::codecForLocale());
219
        searchproc=new KProcIO(TQTextCodec::codecForLocale());
189
        TQString keyserv=page->kCBimportks->currentText();
220
        TQString keyserv=page->kCBimportks->currentText();
190
        *searchproc<<"gpg"<<"--utf8-strings";
221
        *searchproc<<"gpg"<<"--utf8-strings";
222
	if (KgpgInterface::getGpgVersion() < 210 ) { // was removed in 2.1
191
        if (page->cBproxyI->isChecked()) {
223
        if (page->cBproxyI->isChecked()) {
192
                searchproc->setEnvironment("http_proxy",page->kLEproxyI->text());
224
                searchproc->setEnvironment("http_proxy",page->kLEproxyI->text());
193
                *searchproc<<	"--keyserver-options"<<"honor-http-proxy";
225
                *searchproc<<	"--keyserver-options"<<"honor-http-proxy";
194
        } else
226
        } else
195
                *searchproc<<	"--keyserver-options"<<"no-honor-http-proxy";
227
                *searchproc<<	"--keyserver-options"<<"no-honor-http-proxy";
228
        }
196
        *searchproc<<"--keyserver"<<keyserv<<"--command-fd=0"<<"--status-fd=2"<<"--search-keys"<<page->kLEimportid->text().stripWhiteSpace();
229
        *searchproc<<"--keyserver"<<keyserv<<"--command-fd=0"<<"--status-fd=2"<<"--search-keys"<<page->kLEimportid->text().stripWhiteSpace();
197
230
198
        keyNumbers=0;
231
        keyNumbers=0;
Lines 357-367 Link Here
357
	if (!page->exportAttributes->isChecked())
390
	if (!page->exportAttributes->isChecked())
358
                *exportproc<<"--export-options"<<"no-include-attributes";
391
                *exportproc<<"--export-options"<<"no-include-attributes";
359
392
393
	if (KgpgInterface::getGpgVersion() < 210 ) { // was removed in 2.1
360
        if (page->cBproxyE->isChecked()) {
394
        if (page->cBproxyE->isChecked()) {
361
                exportproc->setEnvironment("http_proxy",page->kLEproxyE->text());
395
                exportproc->setEnvironment("http_proxy",page->kLEproxyE->text());
362
                *exportproc<<	"--keyserver-options"<<"honor-http-proxy";
396
                *exportproc<<	"--keyserver-options"<<"honor-http-proxy";
363
        } else
397
        } else
364
                *exportproc<<	"--keyserver-options"<<"no-honor-http-proxy";
398
                *exportproc<<	"--keyserver-options"<<"no-honor-http-proxy";
399
	}
365
        *exportproc << "--status-fd=2" << "--keyserver" << keyserv << "--send-keys" << keyIds;
400
        *exportproc << "--status-fd=2" << "--keyserver" << keyserv << "--send-keys" << keyIds;
366
401
367
        TQObject::connect(exportproc, TQT_SIGNAL(processExited(TDEProcess *)),this, TQT_SLOT(slotexportresult(TDEProcess *)));
402
        TQObject::connect(exportproc, TQT_SIGNAL(processExited(TDEProcess *)),this, TQT_SLOT(slotexportresult(TDEProcess *)));
Lines 414-424 Link Here
414
        TQString keyserv=page->kCBimportks->currentText();
449
        TQString keyserv=page->kCBimportks->currentText();
415
450
416
        *importproc<<"gpg"<<"--utf8-strings";
451
        *importproc<<"gpg"<<"--utf8-strings";
452
	if (KgpgInterface::getGpgVersion() < 210 ) { // was removed in 2.1
417
        if (page->cBproxyI->isChecked()) {
453
        if (page->cBproxyI->isChecked()) {
418
                importproc->setEnvironment("http_proxy",page->kLEproxyI->text());
454
                importproc->setEnvironment("http_proxy",page->kLEproxyI->text());
419
                *importproc<<	"--keyserver-options"<<"honor-http-proxy";
455
                *importproc<<	"--keyserver-options"<<"honor-http-proxy";
420
        } else
456
        } else
421
                *importproc<<	"--keyserver-options"<<"no-honor-http-proxy";
457
                *importproc<<	"--keyserver-options"<<"no-honor-http-proxy";
458
	}
422
459
423
        *importproc<<"--status-fd=2"<<"--keyserver"<<keyserv<<"--recv-keys";
460
        *importproc<<"--status-fd=2"<<"--keyserver"<<keyserv<<"--recv-keys";
424
        TQString keyNames=page->kLEimportid->text();
461
        TQString keyNames=page->kLEimportid->text();
(-)tdeutils.orig/kgpg/kgpg.cpp (-15 / +73 lines)
Lines 4-9 Link Here
4
    begin                : Mon Nov 18 2002
4
    begin                : Mon Nov 18 2002
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
6
    email                : bj@altern.org
6
    email                : bj@altern.org
7
8
    updated to handle gpg21 : Sun Jul 30 10:18:29 CEST 2017
9
    copyright          : (C) 2017 by Emanoil Kotsev
10
    email              : deloptes@yahoo.com
7
 ***************************************************************************/
11
 ***************************************************************************/
8
12
9
/***************************************************************************
13
/***************************************************************************
Lines 646-678 Link Here
646
        wiz->kURLRequester2->setMode(2);*/
650
        wiz->kURLRequester2->setMode(2);*/
647
651
648
        FILE *fp,*fp2;
652
        FILE *fp,*fp2;
649
        TQString tst,tst2,name,trustedvals="idre-";
653
        TQString trustedvals="idre-";
650
        TQString firstKey=TQString();
654
        TQString firstKey=TQString();
651
        char line[300];
655
        char line[300];
652
        bool counter=false;
656
        bool counter=false;
657
	TQString currentKey;
658
	TQMap<TQString,TQStringList> hashMap;
653
659
654
        fp = popen("gpg --display-charset=utf-8 --no-tty --with-colon --list-secret-keys", "r");
660
        fp = popen("gpg --display-charset=utf-8 --no-tty --with-colon --list-secret-keys", "r");
655
        while ( fgets( line, sizeof(line), fp)) {
661
        while ( fgets( line, sizeof(line), fp)) {
656
                tst=TQString::fromUtf8(line);
662
                TQString tst=TQString::fromUtf8(line);
657
                if (tst.startsWith("sec")) {
663
                kdDebug(2100) << k_funcinfo << "Read one secret key line: " << tst << endl;
664
                if ( tst.startsWith("sec")  ) {
665
                	currentKey = tst.section(':',4,4);
666
                	TQStringList lst; lst << tst;
667
			hashMap.insert(currentKey,lst);
668
                }
669
		else
670
			hashMap.find(currentKey).data().append(tst);
671
672
	}
673
	pclose(fp);
674
675
	TQMap<TQString,TQStringList>::Iterator ite;
676
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
677
		TDEListViewItem *item;
678
		TQStringList::Iterator it;
679
680
		TQString name,id;
681
682
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
683
			TQString tst =  (*it);
684
			if (tst.startsWith("sec") ) {
685
				if ( KgpgInterface::getGpgVersion() < 210)
658
                        name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
686
                        name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
687
				id = tst.section(':',4,4);
688
			}
689
			if ( tst.startsWith("uid") && KgpgInterface::getGpgVersion() >= 210 )
690
				name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
691
		}
692
659
                        if (!name.isEmpty()) {
693
                        if (!name.isEmpty()) {
660
                                fp2 = popen("gpg --display-charset=utf-8 --no-tty --with-colon --list-keys "+TQFile::encodeName(tst.section(':',4,4)), "r");
694
			fp2 = popen("gpg --display-charset=utf-8 --no-tty --with-colon --list-keys "+TQFile::encodeName(id), "r");
661
                                while ( fgets( line, sizeof(line), fp2)) {
695
                                while ( fgets( line, sizeof(line), fp2)) {
662
                                        tst2=TQString::fromUtf8(line);
696
				TQString tst2=TQString::fromUtf8(line);
663
                                        if (tst2.startsWith("pub") && (trustedvals.find(tst2.section(':',1,1))==-1)) {
697
                                        if (tst2.startsWith("pub") && (trustedvals.find(tst2.section(':',1,1))==-1)) {
664
                                                counter=true;
698
                                                counter=true;
665
                                                wiz->CBdefault->insertItem(tst.section(':',4,4).right(8)+": "+name);
699
					wiz->CBdefault->insertItem(id.right(8)+": "+name);
666
                                                if (firstKey.isEmpty())
700
                                                if (firstKey.isEmpty())
667
                                                        firstKey=tst.section(':',4,4).right(8)+": "+name;
701
						firstKey=id.right(8)+": "+name;
668
						break;
702
						break;
669
                                        }
703
                                        }
670
                                }
704
                                }
671
                                pclose(fp2);
705
                                pclose(fp2);
672
                        }
706
                        }
673
                }
707
                }
674
        }
708
675
        pclose(fp);
676
	wiz->CBdefault->setCurrentItem(firstKey);
709
	wiz->CBdefault->setCurrentItem(firstKey);
677
        //connect(wiz->pushButton4,TQT_SIGNAL(clicked()),TQT_TQOBJECT(this),TQT_SLOT(slotGenKey()));
710
        //connect(wiz->pushButton4,TQT_SIGNAL(clicked()),TQT_TQOBJECT(this),TQT_SLOT(slotGenKey()));
678
        if (!counter)
711
        if (!counter)
Lines 692-714 Link Here
692
725
693
void  MyView::slotWizardChange()
726
void  MyView::slotWizardChange()
694
{
727
{
695
        TQString tst,name;
696
        char line[300];
697
        FILE *fp;
698
728
699
        if (wiz->indexOf(wiz->currentPage())==2) {
729
        if (wiz->indexOf(wiz->currentPage())==2) {
700
                TQString defaultID=KgpgInterface::getGpgSetting("default-key",wiz->kURLRequester1->url());
730
                TQString defaultID=KgpgInterface::getGpgSetting("default-key",wiz->kURLRequester1->url());
701
                if (defaultID.isEmpty())
731
                if (defaultID.isEmpty())
702
                        return;
732
                        return;
733
734
		char line[300];
735
		FILE *fp;
736
		TQString id, name, currentKey;
737
		TQMap<TQString,TQStringList> hashMap;
703
                fp = popen("gpg --display-charset=utf-8 --no-tty --with-colon --list-secret-keys "+TQFile::encodeName(defaultID), "r");
738
                fp = popen("gpg --display-charset=utf-8 --no-tty --with-colon --list-secret-keys "+TQFile::encodeName(defaultID), "r");
704
                while ( fgets( line, sizeof(line), fp)) {
739
                while ( fgets( line, sizeof(line), fp)) {
740
			TQString tst=TQString::fromUtf8(line);
741
			kdDebug(2100) << k_funcinfo << "Read one secret key line: " << tst << endl;
742
			if ( tst.startsWith("sec")  ) {
743
				currentKey = tst.section(':',4,4);
744
				TQStringList lst; lst << tst;
745
				hashMap.insert(currentKey,lst);
746
			}
747
			else
748
				hashMap.find(currentKey).data().append(tst);
749
	
750
		}
751
		pclose(fp);
752
753
754
		TQMap<TQString,TQStringList>::Iterator ite;
755
		for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
756
			for (TQStringList::Iterator it = ite.data().begin(); it != ite.data().end(); it++) {
757
				TQString tst =  (*it);
705
                        tst=TQString::fromUtf8(line);
758
                        tst=TQString::fromUtf8(line);
706
                        if (tst.startsWith("sec")) {
759
				if ( tst.startsWith("sec") ) {
760
					if (KgpgInterface::getGpgVersion() < 210)
707
				name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
761
				name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
708
                                wiz->CBdefault->setCurrentItem(tst.section(':',4,4).right(8)+": "+name);
762
					id=tst.section(':',4,4).right(8);
709
                        }
763
                        }
764
				if ( (tst.startsWith("uid") && KgpgInterface::getGpgVersion() >= 210) ) {
765
					name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
710
                }
766
                }
711
                pclose(fp);
767
			}
768
		}
769
		wiz->CBdefault->setCurrentItem(id+": "+name);
712
        }
770
        }
713
}
771
}
714
772
(-)tdeutils.orig/kgpg/kgpginterface.cpp (-4 / +101 lines)
Lines 4-9 Link Here
4
    begin                : Mon Jul 8 2002
4
    begin                : Mon Jul 8 2002
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
6
    email                : bj@altern.org
6
    email                : bj@altern.org
7
8
    updated to handle gpg21 : Sun Jul 30 10:18:29 CEST 2017
9
    copyright          : (C) 2017 by Emanoil Kotsev
10
    email              : deloptes@yahoo.com
7
 ***************************************************************************/
11
 ***************************************************************************/
8
12
9
/***************************************************************************
13
/***************************************************************************
Lines 76-81 Link Here
76
80
77
void KgpgInterface::updateIDs(TQString txtString)
81
void KgpgInterface::updateIDs(TQString txtString)
78
{
82
{
83
	kdDebug(2100) << k_funcinfo << endl;
79
 int cut=txtString.find(' ',22,false);
84
 int cut=txtString.find(' ',22,false);
80
          txtString.remove(0,cut);
85
          txtString.remove(0,cut);
81
          if (txtString.find("(",0,false)!=-1)
86
          if (txtString.find("(",0,false)!=-1)
Lines 91-96 Link Here
91
96
92
void KgpgInterface::KgpgEncryptFile(TQStringList encryptKeys,KURL srcUrl,KURL destUrl, TQStringList Options, bool symetrical)
97
void KgpgInterface::KgpgEncryptFile(TQStringList encryptKeys,KURL srcUrl,KURL destUrl, TQStringList Options, bool symetrical)
93
{
98
{
99
	kdDebug(2100) << k_funcinfo << endl;
94
        sourceFile=srcUrl;
100
        sourceFile=srcUrl;
95
        message=TQString();
101
        message=TQString();
96
102
Lines 123-128 Link Here
123
129
124
void KgpgInterface::encryptfin(TDEProcess *)
130
void KgpgInterface::encryptfin(TDEProcess *)
125
{
131
{
132
	kdDebug(2100) << k_funcinfo << endl;
126
        if (message.find("END_ENCRYPTION")!=-1)
133
        if (message.find("END_ENCRYPTION")!=-1)
127
                emit encryptionfinished(sourceFile);
134
                emit encryptionfinished(sourceFile);
128
        else {
135
        else {
Lines 132-137 Link Here
132
139
133
void KgpgInterface::readencprocess(KProcIO *p)
140
void KgpgInterface::readencprocess(KProcIO *p)
134
{
141
{
142
	kdDebug(2100) << k_funcinfo << endl;
135
        TQString required;
143
        TQString required;
136
        while (p->readln(required,true)!=-1) {
144
        while (p->readln(required,true)!=-1) {
137
                if (required.find("BEGIN_ENCRYPTION",0,false)!=-1)
145
                if (required.find("BEGIN_ENCRYPTION",0,false)!=-1)
Lines 162-167 Link Here
162
170
163
void KgpgInterface::KgpgDecryptFile(KURL srcUrl,KURL destUrl,TQStringList Options)
171
void KgpgInterface::KgpgDecryptFile(KURL srcUrl,KURL destUrl,TQStringList Options)
164
{
172
{
173
	kdDebug(2100) << k_funcinfo << endl;
165
        message=TQString();
174
        message=TQString();
166
        step=3;
175
        step=3;
167
	decryptUrl=srcUrl.path();
176
	decryptUrl=srcUrl.path();
Lines 187-192 Link Here
187
196
188
void KgpgInterface::decryptfin(TDEProcess *)
197
void KgpgInterface::decryptfin(TDEProcess *)
189
{
198
{
199
	kdDebug(2100) << k_funcinfo << endl;
190
        if ((message.find("DECRYPTION_OKAY")!=-1) && (message.find("END_DECRYPTION")!=-1)) //&& (message.find("GOODMDC")!=-1)
200
        if ((message.find("DECRYPTION_OKAY")!=-1) && (message.find("END_DECRYPTION")!=-1)) //&& (message.find("GOODMDC")!=-1)
191
                emit decryptionfinished();
201
                emit decryptionfinished();
192
        else
202
        else
Lines 196-201 Link Here
196
206
197
void KgpgInterface::readdecprocess(KProcIO *p)
207
void KgpgInterface::readdecprocess(KProcIO *p)
198
{
208
{
209
	kdDebug(2100) << k_funcinfo << endl;
199
        TQString required;
210
        TQString required;
200
        while (p->readln(required,true)!=-1) {
211
        while (p->readln(required,true)!=-1) {
201
                if (required.find("BEGIN_DECRYPTION",0,false)!=-1)
212
                if (required.find("BEGIN_DECRYPTION",0,false)!=-1)
Lines 247-252 Link Here
247
258
248
void KgpgInterface::KgpgEncryptText(TQString text,TQStringList userIDs, TQStringList Options)
259
void KgpgInterface::KgpgEncryptText(TQString text,TQStringList userIDs, TQStringList Options)
249
{
260
{
261
	kdDebug(2100) << k_funcinfo << endl;
250
        message=TQString();
262
        message=TQString();
251
	//TQTextCodec *codec = TDEGlobal::charsets()->codecForName(TDEGlobal::locale()->encoding());
263
	//TQTextCodec *codec = TDEGlobal::charsets()->codecForName(TDEGlobal::locale()->encoding());
252
	TQTextCodec *codec =TQTextCodec::codecForLocale ();
264
	TQTextCodec *codec =TQTextCodec::codecForLocale ();
Lines 279-284 Link Here
279
291
280
void KgpgInterface::txtencryptfin(TDEProcess *)
292
void KgpgInterface::txtencryptfin(TDEProcess *)
281
{
293
{
294
	kdDebug(2100) << k_funcinfo << endl;
282
        if (!message.isEmpty())
295
        if (!message.isEmpty())
283
                emit txtencryptionfinished(message);
296
                emit txtencryptionfinished(message);
284
        else
297
        else
Lines 287-292 Link Here
287
300
288
void KgpgInterface::txtreadencprocess(KProcIO *p)
301
void KgpgInterface::txtreadencprocess(KProcIO *p)
289
{
302
{
303
	kdDebug(2100) << k_funcinfo << endl;
290
        TQString required;
304
        TQString required;
291
        while (p->readln(required,true)!=-1) {
305
        while (p->readln(required,true)!=-1) {
292
	  if (required.find("BEGIN_ENCRYPTION",0,false)!=-1)
306
	  if (required.find("BEGIN_ENCRYPTION",0,false)!=-1)
Lines 318-323 Link Here
318
332
319
void KgpgInterface::KgpgDecryptText(TQString text,TQStringList Options)
333
void KgpgInterface::KgpgDecryptText(TQString text,TQStringList Options)
320
{
334
{
335
	kdDebug(2100) << k_funcinfo << endl;
321
  gpgOutput=TQString();
336
  gpgOutput=TQString();
322
  log=TQString();
337
  log=TQString();
323
338
Lines 345-350 Link Here
345
360
346
void KgpgInterface::txtdecryptfin(TDEProcess *)
361
void KgpgInterface::txtdecryptfin(TDEProcess *)
347
{
362
{
363
	kdDebug(2100) << k_funcinfo << endl;
348
if ((decok) && (!badmdc))
364
if ((decok) && (!badmdc))
349
emit txtdecryptionfinished(message);
365
emit txtdecryptionfinished(message);
350
366
Lines 360-371 Link Here
360
376
361
void KgpgInterface::getOutput(TDEProcess *, char *data, int )
377
void KgpgInterface::getOutput(TDEProcess *, char *data, int )
362
{
378
{
379
	kdDebug(2100) << k_funcinfo << endl;
363
	message.append(TQString::fromUtf8(data));
380
	message.append(TQString::fromUtf8(data));
364
}
381
}
365
382
366
383
367
void KgpgInterface::getCmdOutput(TDEProcess *p, char *data, int )
384
void KgpgInterface::getCmdOutput(TDEProcess *p, char *data, int )
368
{
385
{
386
	kdDebug(2100) << k_funcinfo << endl;
369
  gpgOutput.append(TQString::fromUtf8(data));
387
  gpgOutput.append(TQString::fromUtf8(data));
370
  log.append(data);
388
  log.append(data);
371
389
Lines 434-439 Link Here
434
452
435
void KgpgInterface::KgpgSignText(TQString text,TQString userIDs, TQStringList Options)
453
void KgpgInterface::KgpgSignText(TQString text,TQString userIDs, TQStringList Options)
436
{
454
{
455
	kdDebug(2100) << k_funcinfo << endl;
437
        message=TQString();
456
        message=TQString();
438
	step=4;
457
	step=4;
439
	TQString txtprocess;
458
	TQString txtprocess;
Lines 450-456 Link Here
450
469
451
        /////////  when process ends, update dialog infos
470
        /////////  when process ends, update dialog infos
452
471
453
        TQObject::connect(proc, TQT_SIGNAL(processExited(TDEProcess *)),this,TQT_SLOT(txtsignfin(TDEProcess *)));
472
        TQObject::connect(proc,TQT_SIGNAL(processExited(TDEProcess *)),this,TQT_SLOT(txtsignfin(TDEProcess *)));
454
        TQObject::connect(proc,TQT_SIGNAL(readReady(KProcIO *)),this,TQT_SLOT(txtsignprocess(KProcIO *)));
473
        TQObject::connect(proc,TQT_SIGNAL(readReady(KProcIO *)),this,TQT_SLOT(txtsignprocess(KProcIO *)));
455
474
456
	//emit txtsigningstarted();
475
	//emit txtsigningstarted();
Lines 470-475 Link Here
470
489
471
void KgpgInterface::txtsignfin(TDEProcess *)
490
void KgpgInterface::txtsignfin(TDEProcess *)
472
{
491
{
492
	kdDebug(2100) << k_funcinfo << endl;
493
	kdDebug(2100) << k_funcinfo << "MSG: " << message<<endl;
473
        if (!message.isEmpty())
494
        if (!message.isEmpty())
474
                emit txtSignOver(message);
495
                emit txtSignOver(message);
475
        else
496
        else
Lines 478-484 Link Here
478
499
479
void KgpgInterface::txtsignprocess(KProcIO *p)
500
void KgpgInterface::txtsignprocess(KProcIO *p)
480
{
501
{
502
	kdDebug(2100) << k_funcinfo << endl;
481
        TQString required;
503
        TQString required;
504
482
        while (p->readln(required,true)!=-1) {
505
        while (p->readln(required,true)!=-1) {
483
//	kdDebug(2100)<<"SIGNING: "<<required<<endl;
506
//	kdDebug(2100)<<"SIGNING: "<<required<<endl;
484
507
Lines 492-497 Link Here
492
	p->closeWhenDone();
515
	p->closeWhenDone();
493
	}
516
	}
494
517
518
		if (required.find("BEGIN_SIGNING")!=-1) {
519
			p->writeStdin(message,true);
520
			message=TQString();
521
			p->closeWhenDone();
522
		}
523
	
495
	if ((required.find("passphrase.enter")!=-1))
524
	if ((required.find("passphrase.enter")!=-1))
496
            {
525
            {
497
	      if (step>1) step--;
526
	      if (step>1) step--;
Lines 513-518 Link Here
513
            }
542
            }
514
	    else
543
	    else
515
		if (!required.startsWith("[GNUPG:]")) message+=required+"\n";
544
		if (!required.startsWith("[GNUPG:]")) message+=required+"\n";
545
//		kdDebug(2100)<<"SIGNING: "<<message<<endl;
516
        }
546
        }
517
}
547
}
518
548
Lines 521-534 Link Here
521
551
522
void KgpgInterface::KgpgDecryptFileToText(KURL srcUrl,TQStringList Options)
552
void KgpgInterface::KgpgDecryptFileToText(KURL srcUrl,TQStringList Options)
523
{
553
{
554
	kdDebug(2100) << k_funcinfo << endl;
524
555
525
  message=TQString();
556
  message=TQString();
526
  userIDs=TQString();
557
  userIDs=TQString();
527
  step=3;
558
  step=3;
528
  anonymous=false;
559
  anonymous=false;
529
decfinished=false;
560
  decfinished=false;
530
decok=false;
561
  decok=false;
531
badmdc=false;
562
  badmdc=false;
532
563
533
  TDEProcess *proc=new TDEProcess();
564
  TDEProcess *proc=new TDEProcess();
534
  *proc<<"gpg"<<"--no-tty"<<"--utf8-strings"<<"--no-secmem-warning"<<"--command-fd=0"<<"--status-fd=2"<<"--no-batch"<<"-o"<<"-";
565
  *proc<<"gpg"<<"--no-tty"<<"--utf8-strings"<<"--no-secmem-warning"<<"--command-fd=0"<<"--status-fd=2"<<"--no-batch"<<"-o"<<"-";
Lines 551-556 Link Here
551
582
552
void KgpgInterface::KgpgVerifyText(TQString text)
583
void KgpgInterface::KgpgVerifyText(TQString text)
553
{
584
{
585
	kdDebug(2100) << k_funcinfo << endl;
554
586
555
		TQTextCodec *codec =TQTextCodec::codecForLocale ();
587
		TQTextCodec *codec =TQTextCodec::codecForLocale ();
556
		if (!codec->canEncode(text)) text=text.utf8();
588
		if (!codec->canEncode(text)) text=text.utf8();
Lines 569-574 Link Here
569
601
570
void KgpgInterface::slotverifyresult(TDEProcess*)
602
void KgpgInterface::slotverifyresult(TDEProcess*)
571
{
603
{
604
	kdDebug(2100) << k_funcinfo << endl;
572
if (signmiss) emit missingSignature(signID);
605
if (signmiss) emit missingSignature(signID);
573
    else {
606
    else {
574
	if (signID.isEmpty()) signID=i18n("No signature found.");
607
	if (signID.isEmpty()) signID=i18n("No signature found.");
Lines 579-584 Link Here
579
612
580
void KgpgInterface::slotverifyread(KProcIO *p)
613
void KgpgInterface::slotverifyread(KProcIO *p)
581
{
614
{
615
	kdDebug(2100) << k_funcinfo << endl;
582
TQString required;
616
TQString required;
583
  while (p->readln(required,true)!=-1)
617
  while (p->readln(required,true)!=-1)
584
    {
618
    {
Lines 613-618 Link Here
613
647
614
Md5Widget::Md5Widget(TQWidget *parent, const char *name,KURL url):KDialogBase( parent, name, true,i18n("MD5 Checksum"),Apply | Close)
648
Md5Widget::Md5Widget(TQWidget *parent, const char *name,KURL url):KDialogBase( parent, name, true,i18n("MD5 Checksum"),Apply | Close)
615
{
649
{
650
	kdDebug(2100) << k_funcinfo << endl;
616
        setButtonApply(i18n("Compare MD5 with Clipboard"));
651
        setButtonApply(i18n("Compare MD5 with Clipboard"));
617
        mdSum=TQString();
652
        mdSum=TQString();
618
        TQFile f(url.path());
653
        TQFile f(url.path());
Lines 664-669 Link Here
664
699
665
void Md5Widget::slotApply()
700
void Md5Widget::slotApply()
666
{
701
{
702
	kdDebug(2100) << k_funcinfo << endl;
667
        TQClipboard *cb = TQApplication::clipboard();
703
        TQClipboard *cb = TQApplication::clipboard();
668
        TQString text;
704
        TQString text;
669
        // Copy text from the clipboard (paste)
705
        // Copy text from the clipboard (paste)
Lines 692-697 Link Here
692
728
693
void KgpgInterface::KgpgSignFile(TQString keyID,KURL srcUrl,TQStringList Options)
729
void KgpgInterface::KgpgSignFile(TQString keyID,KURL srcUrl,TQStringList Options)
694
{
730
{
731
	kdDebug(2100) << k_funcinfo << endl;
695
        //////////////////////////////////////   create a detached signature for a chosen file
732
        //////////////////////////////////////   create a detached signature for a chosen file
696
        message=TQString();
733
        message=TQString();
697
        step=3;
734
        step=3;
Lines 714-719 Link Here
714
751
715
void KgpgInterface::signfin(TDEProcess *)
752
void KgpgInterface::signfin(TDEProcess *)
716
{
753
{
754
	kdDebug(2100) << k_funcinfo << endl;
717
        if (message.find("SIG_CREATED")!=-1)
755
        if (message.find("SIG_CREATED")!=-1)
718
                KMessageBox::information(0,i18n("The signature file %1 was successfully created.").arg(file.fileName()));
756
                KMessageBox::information(0,i18n("The signature file %1 was successfully created.").arg(file.fileName()));
719
        else if (message.find("BAD_PASSPHRASE")!=-1)
757
        else if (message.find("BAD_PASSPHRASE")!=-1)
Lines 726-731 Link Here
726
764
727
void KgpgInterface::readsignprocess(KProcIO *p)
765
void KgpgInterface::readsignprocess(KProcIO *p)
728
{
766
{
767
	kdDebug(2100) << k_funcinfo << endl;
729
        TQString required;
768
        TQString required;
730
        while (p->readln(required,true)!=-1) {
769
        while (p->readln(required,true)!=-1) {
731
                if (required.find("USERID_HINT",0,false)!=-1)
770
                if (required.find("USERID_HINT",0,false)!=-1)
Lines 766-771 Link Here
766
805
767
void KgpgInterface::KgpgVerifyFile(KURL sigUrl,KURL srcUrl)
806
void KgpgInterface::KgpgVerifyFile(KURL sigUrl,KURL srcUrl)
768
{
807
{
808
	kdDebug(2100) << k_funcinfo << endl;
769
        //////////////////////////////////////   verify signature for a chosen file
809
        //////////////////////////////////////   verify signature for a chosen file
770
        message=TQString();
810
        message=TQString();
771
	signID=TQString();
811
	signID=TQString();
Lines 786-791 Link Here
786
826
787
void KgpgInterface::readprocess(KProcIO *p)
827
void KgpgInterface::readprocess(KProcIO *p)
788
{
828
{
829
	kdDebug(2100) << k_funcinfo << endl;
789
TQString required;
830
TQString required;
790
  while (p->readln(required,true)!=-1)
831
  while (p->readln(required,true)!=-1)
791
    {
832
    {
Lines 821-826 Link Here
821
862
822
void KgpgInterface::verifyfin(TDEProcess *)
863
void KgpgInterface::verifyfin(TDEProcess *)
823
{
864
{
865
	kdDebug(2100) << k_funcinfo << endl;
824
    if (!signmiss) {
866
    if (!signmiss) {
825
        if (signID.isEmpty()) signID=i18n("No signature found.");
867
        if (signID.isEmpty()) signID=i18n("No signature found.");
826
        (void) new KDetailedInfo(0,"verify_result",signID,message);
868
        (void) new KDetailedInfo(0,"verify_result",signID,message);
Lines 839-844 Link Here
839
881
840
void KgpgInterface::KgpgSignKey(TQString keyID,TQString signKeyID,TQString signKeyMail,bool local,int checking)
882
void KgpgInterface::KgpgSignKey(TQString keyID,TQString signKeyID,TQString signKeyMail,bool local,int checking)
841
{
883
{
884
	kdDebug(2100) << k_funcinfo << endl;
842
        signKeyMail.replace(TQRegExp("<"),"&lt;");
885
        signKeyMail.replace(TQRegExp("<"),"&lt;");
843
        konsChecked=checking;
886
        konsChecked=checking;
844
        konsLocal=local;
887
        konsLocal=local;
Lines 866-871 Link Here
866
909
867
void KgpgInterface::sigprocess(KProcIO *p)
910
void KgpgInterface::sigprocess(KProcIO *p)
868
{
911
{
912
	kdDebug(2100) << k_funcinfo << endl;
869
        TQString required=TQString();
913
        TQString required=TQString();
870
914
871
        while (p->readln(required,true)!=-1)
915
        while (p->readln(required,true)!=-1)
Lines 943-948 Link Here
943
987
944
void KgpgInterface::signover(TDEProcess *)
988
void KgpgInterface::signover(TDEProcess *)
945
{
989
{
990
	kdDebug(2100) << k_funcinfo << endl;
946
        if (signSuccess>1)
991
        if (signSuccess>1)
947
                emit signatureFinished(signSuccess);  ////   signature successful or bad passphrase
992
                emit signatureFinished(signSuccess);  ////   signature successful or bad passphrase
948
        else {
993
        else {
Lines 957-962 Link Here
957
1002
958
void KgpgInterface::openSignConsole()
1003
void KgpgInterface::openSignConsole()
959
{
1004
{
1005
	kdDebug(2100) << k_funcinfo << endl;
960
        TDEProcess conprocess;
1006
        TDEProcess conprocess;
961
	TDEConfig *config = TDEGlobal::config();
1007
	TDEConfig *config = TDEGlobal::config();
962
	config->setGroup("General");
1008
	config->setGroup("General");
Lines 977-982 Link Here
977
1023
978
void KgpgInterface::KgpgDelSignature(TQString keyID,TQString signKeyID)
1024
void KgpgInterface::KgpgDelSignature(TQString keyID,TQString signKeyID)
979
{
1025
{
1026
	kdDebug(2100) << k_funcinfo << endl;
980
        if (checkuid(keyID)>0) {
1027
        if (checkuid(keyID)>0) {
981
                KMessageBox::sorry(0,i18n("This key has more than one user ID.\nEdit the key manually to delete signature."));
1028
                KMessageBox::sorry(0,i18n("This key has more than one user ID.\nEdit the key manually to delete signature."));
982
                return;
1029
                return;
Lines 1015-1020 Link Here
1015
1062
1016
void KgpgInterface::delsigprocess(KProcIO *p)
1063
void KgpgInterface::delsigprocess(KProcIO *p)
1017
{
1064
{
1065
	kdDebug(2100) << k_funcinfo << endl;
1018
1066
1019
        TQString required=TQString();
1067
        TQString required=TQString();
1020
        while (p->readln(required,true)!=-1)
1068
        while (p->readln(required,true)!=-1)
Lines 1044-1049 Link Here
1044
1092
1045
void KgpgInterface::delsignover(TDEProcess *)
1093
void KgpgInterface::delsignover(TDEProcess *)
1046
{
1094
{
1095
	kdDebug(2100) << k_funcinfo << endl;
1047
        emit delsigfinished(deleteSuccess);
1096
        emit delsigfinished(deleteSuccess);
1048
}
1097
}
1049
1098
Lines 1051-1056 Link Here
1051
1100
1052
int KgpgInterface::checkuid(TQString KeyID)
1101
int KgpgInterface::checkuid(TQString KeyID)
1053
{
1102
{
1103
	kdDebug(2100) << k_funcinfo << endl;
1054
        FILE *fp;
1104
        FILE *fp;
1055
        TQString encResult;
1105
        TQString encResult;
1056
        char buffer[200];
1106
        char buffer[200];
Lines 1074-1085 Link Here
1074
1124
1075
void KgpgInterface::KgpgKeyExpire(TQString keyID,TQDate date,bool unlimited)
1125
void KgpgInterface::KgpgKeyExpire(TQString keyID,TQDate date,bool unlimited)
1076
{
1126
{
1127
	kdDebug(2100) << k_funcinfo << endl;
1128
1129
//	kdDebug(2100) << "KgpgKeyExpire date: " << date;
1130
	
1077
        expSuccess=0;
1131
        expSuccess=0;
1078
        step=0;
1132
        step=0;
1079
        if (unlimited)
1133
        if (unlimited)
1080
                expirationDelay=0;
1134
                expirationDelay=0;
1081
        else
1135
        else
1082
                expirationDelay=TQDate::currentDate().daysTo(date);
1136
                expirationDelay=TQDate::currentDate().daysTo(date);
1137
//	kdDebug(2100) << "KgpgKeyExpire date: " << TQDate::currentDate().daysTo(date) <<endl;
1083
        output=TQString();
1138
        output=TQString();
1084
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
1139
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
1085
        *conprocess<<"gpg"<<"--no-secmem-warning"<<"--no-tty"<<"--command-fd=0"<<"--status-fd=2"<<"--utf8-strings";
1140
        *conprocess<<"gpg"<<"--no-secmem-warning"<<"--no-tty"<<"--command-fd=0"<<"--status-fd=2"<<"--utf8-strings";
Lines 1092-1097 Link Here
1092
1147
1093
void KgpgInterface::expprocess(KProcIO *p)
1148
void KgpgInterface::expprocess(KProcIO *p)
1094
{
1149
{
1150
	kdDebug(2100) << k_funcinfo << endl;
1095
        TQString required=TQString();
1151
        TQString required=TQString();
1096
1152
1097
        while (p->readln(required,true)!=-1) {
1153
        while (p->readln(required,true)!=-1) {
Lines 1152-1157 Link Here
1152
1208
1153
void KgpgInterface::expover(TDEProcess *)
1209
void KgpgInterface::expover(TDEProcess *)
1154
{
1210
{
1211
	kdDebug(2100) << k_funcinfo << endl;
1155
        if ((expSuccess==3) || (expSuccess==2))
1212
        if ((expSuccess==3) || (expSuccess==2))
1156
                emit expirationFinished(expSuccess);  ////   signature successful or bad passphrase
1213
                emit expirationFinished(expSuccess);  ////   signature successful or bad passphrase
1157
        else {
1214
        else {
Lines 1171-1176 Link Here
1171
1228
1172
void KgpgInterface::KgpgTrustExpire(TQString keyID,int keyTrust)
1229
void KgpgInterface::KgpgTrustExpire(TQString keyID,int keyTrust)
1173
{
1230
{
1231
	kdDebug(2100) << k_funcinfo << endl;
1174
	trustValue=keyTrust+1;
1232
	trustValue=keyTrust+1;
1175
/*	Don't know=1; Do NOT trust=2; Marginally=3; Fully=4; Ultimately=5;   */
1233
/*	Don't know=1; Do NOT trust=2; Marginally=3; Fully=4; Ultimately=5;   */
1176
1234
Lines 1186-1191 Link Here
1186
1244
1187
void KgpgInterface::trustprocess(KProcIO *p)
1245
void KgpgInterface::trustprocess(KProcIO *p)
1188
{
1246
{
1247
	kdDebug(2100) << k_funcinfo << endl;
1189
        TQString required=TQString();
1248
        TQString required=TQString();
1190
        while (p->readln(required,true)!=-1) {
1249
        while (p->readln(required,true)!=-1) {
1191
                output+=required+"\n";
1250
                output+=required+"\n";
Lines 1219-1224 Link Here
1219
1278
1220
void KgpgInterface::trustover(TDEProcess *)
1279
void KgpgInterface::trustover(TDEProcess *)
1221
{
1280
{
1281
	kdDebug(2100) << k_funcinfo << endl;
1222
        emit trustfinished();
1282
        emit trustfinished();
1223
}
1283
}
1224
1284
Lines 1228-1233 Link Here
1228
1288
1229
void KgpgInterface::KgpgChangePass(TQString keyID)
1289
void KgpgInterface::KgpgChangePass(TQString keyID)
1230
{
1290
{
1291
	kdDebug(2100) << k_funcinfo << endl;
1231
        step=1;
1292
        step=1;
1232
        output=TQString();
1293
        output=TQString();
1233
        message=TQString();
1294
        message=TQString();
Lines 1242-1247 Link Here
1242
1303
1243
void KgpgInterface::passprocess(KProcIO *p)
1304
void KgpgInterface::passprocess(KProcIO *p)
1244
{
1305
{
1306
	kdDebug(2100) << k_funcinfo << endl;
1245
        TQString required=TQString();
1307
        TQString required=TQString();
1246
1308
1247
        while (p->readln(required,true)!=-1) {
1309
        while (p->readln(required,true)!=-1) {
Lines 1320-1325 Link Here
1320
1382
1321
void KgpgInterface::passover(TDEProcess *)
1383
void KgpgInterface::passover(TDEProcess *)
1322
{
1384
{
1385
	kdDebug(2100) << k_funcinfo << endl;
1323
        //emit trustfinished();
1386
        //emit trustfinished();
1324
}
1387
}
1325
1388
Lines 1329-1334 Link Here
1329
1392
1330
TQString KgpgInterface::getKey(TQStringList IDs, bool attributes)
1393
TQString KgpgInterface::getKey(TQStringList IDs, bool attributes)
1331
{
1394
{
1395
	kdDebug(2100) << k_funcinfo << endl;
1332
        keyString=TQString();
1396
        keyString=TQString();
1333
        KProcIO *proc=new KProcIO(TQTextCodec::codecForLocale());
1397
        KProcIO *proc=new KProcIO(TQTextCodec::codecForLocale());
1334
        *proc<< "gpg"<<"--no-tty"<<"--no-secmem-warning"<<"--utf8-strings";
1398
        *proc<< "gpg"<<"--no-tty"<<"--no-secmem-warning"<<"--utf8-strings";
Lines 1346-1351 Link Here
1346
1410
1347
void KgpgInterface::slotReadKey(KProcIO *p)
1411
void KgpgInterface::slotReadKey(KProcIO *p)
1348
{
1412
{
1413
	kdDebug(2100) << k_funcinfo << endl;
1349
        TQString outp;
1414
        TQString outp;
1350
        while (p->readln(outp)!=-1)
1415
        while (p->readln(outp)!=-1)
1351
                if (!outp.startsWith("gpg:")) keyString+=outp+"\n";
1416
                if (!outp.startsWith("gpg:")) keyString+=outp+"\n";
Lines 1358-1363 Link Here
1358
{
1423
{
1359
        /////////////      import a key
1424
        /////////////      import a key
1360
1425
1426
	kdDebug(2100) << k_funcinfo << endl;
1361
        if( TDEIO::NetAccess::download( url, tempKeyFile,0) ) {
1427
        if( TDEIO::NetAccess::download( url, tempKeyFile,0) ) {
1362
                message=TQString();
1428
                message=TQString();
1363
                KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
1429
                KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
Lines 1386-1391 Link Here
1386
1452
1387
void KgpgInterface::importover(TDEProcess *)
1453
void KgpgInterface::importover(TDEProcess *)
1388
{
1454
{
1455
	kdDebug(2100) << k_funcinfo << endl;
1389
TQStringList importedKeysIds;
1456
TQStringList importedKeysIds;
1390
TQStringList messageList;
1457
TQStringList messageList;
1391
TQString resultMessage;
1458
TQString resultMessage;
Lines 1450-1455 Link Here
1450
1517
1451
void KgpgInterface::importURLover(TDEProcess *p)
1518
void KgpgInterface::importURLover(TDEProcess *p)
1452
{
1519
{
1520
	kdDebug(2100) << k_funcinfo << endl;
1453
        TDEIO::NetAccess::removeTempFile(tempKeyFile);
1521
        TDEIO::NetAccess::removeTempFile(tempKeyFile);
1454
        importover(p);
1522
        importover(p);
1455
        //KMessageBox::information(0,message);
1523
        //KMessageBox::information(0,message);
Lines 1458-1463 Link Here
1458
1526
1459
void KgpgInterface::importprocess(KProcIO *p)
1527
void KgpgInterface::importprocess(KProcIO *p)
1460
{
1528
{
1529
	kdDebug(2100) << k_funcinfo << endl;
1461
        TQString outp;
1530
        TQString outp;
1462
        while (p->readln(outp)!=-1) {
1531
        while (p->readln(outp)!=-1) {
1463
                if (outp.find("http-proxy")==-1)
1532
                if (outp.find("http-proxy")==-1)
Lines 1471-1476 Link Here
1471
1540
1472
void KgpgInterface::KgpgAddUid(TQString keyID,TQString name,TQString email,TQString comment)
1541
void KgpgInterface::KgpgAddUid(TQString keyID,TQString name,TQString email,TQString comment)
1473
{
1542
{
1543
	kdDebug(2100) << k_funcinfo << endl;
1474
uidName=name;
1544
uidName=name;
1475
uidComment=comment;
1545
uidComment=comment;
1476
uidEmail=email;
1546
uidEmail=email;
Lines 1487-1498 Link Here
1487
1557
1488
void KgpgInterface::adduidover(TDEProcess *)
1558
void KgpgInterface::adduidover(TDEProcess *)
1489
{
1559
{
1560
	kdDebug(2100) << k_funcinfo << endl;
1490
if (addSuccess) emit addUidFinished();
1561
if (addSuccess) emit addUidFinished();
1491
else emit addUidError(output);
1562
else emit addUidError(output);
1492
}
1563
}
1493
1564
1494
void KgpgInterface::adduidprocess(KProcIO *p)
1565
void KgpgInterface::adduidprocess(KProcIO *p)
1495
{
1566
{
1567
	kdDebug(2100) << k_funcinfo << endl;
1496
        TQString required=TQString();
1568
        TQString required=TQString();
1497
        while (p->readln(required,true)!=-1) {
1569
        while (p->readln(required,true)!=-1) {
1498
                output+=required+"\n";
1570
                output+=required+"\n";
Lines 1556-1561 Link Here
1556
1628
1557
void KgpgInterface::KgpgGetPhotoList(TQString keyID)
1629
void KgpgInterface::KgpgGetPhotoList(TQString keyID)
1558
{
1630
{
1631
	kdDebug(2100) << k_funcinfo << endl;
1559
photoList.clear();
1632
photoList.clear();
1560
output=TQString();
1633
output=TQString();
1561
photoCount=1;
1634
photoCount=1;
Lines 1571-1576 Link Here
1571
1644
1572
void KgpgInterface::photoreadprocess(KProcIO *p)
1645
void KgpgInterface::photoreadprocess(KProcIO *p)
1573
{
1646
{
1647
	kdDebug(2100) << k_funcinfo << endl;
1574
        TQString required=TQString();
1648
        TQString required=TQString();
1575
        while (p->readln(required,true)!=-1) {
1649
        while (p->readln(required,true)!=-1) {
1576
                output+=required+"\n";
1650
                output+=required+"\n";
Lines 1581-1586 Link Here
1581
1655
1582
void KgpgInterface::photoreadover(TDEProcess *)
1656
void KgpgInterface::photoreadover(TDEProcess *)
1583
{
1657
{
1658
	kdDebug(2100) << k_funcinfo << endl;
1584
for (int i=1;i<photoCount+1;i++)
1659
for (int i=1;i<photoCount+1;i++)
1585
if (isPhotoId(i)) photoList+=TQString::number(i);
1660
if (isPhotoId(i)) photoList+=TQString::number(i);
1586
1661
Lines 1589-1594 Link Here
1589
1664
1590
bool KgpgInterface::isPhotoId(int uid)
1665
bool KgpgInterface::isPhotoId(int uid)
1591
{
1666
{
1667
	kdDebug(2100) << k_funcinfo << endl;
1592
KTempFile *kgpginfotmp=new KTempFile();
1668
KTempFile *kgpginfotmp=new KTempFile();
1593
                kgpginfotmp->setAutoDelete(true);
1669
                kgpginfotmp->setAutoDelete(true);
1594
                TQString pgpgOutput="cp %i "+kgpginfotmp->name();
1670
                TQString pgpgOutput="cp %i "+kgpginfotmp->name();
Lines 1608-1613 Link Here
1608
1684
1609
void KgpgInterface::KgpgDeletePhoto(TQString keyID,TQString uid)
1685
void KgpgInterface::KgpgDeletePhoto(TQString keyID,TQString uid)
1610
{
1686
{
1687
	kdDebug(2100) << k_funcinfo << endl;
1611
	delSuccess=true;
1688
	delSuccess=true;
1612
	output=TQString();
1689
	output=TQString();
1613
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
1690
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
Lines 1620-1631 Link Here
1620
1697
1621
void KgpgInterface::delphotoover(TDEProcess *)
1698
void KgpgInterface::delphotoover(TDEProcess *)
1622
{
1699
{
1700
	kdDebug(2100) << k_funcinfo << endl;
1623
if (delSuccess) emit delPhotoFinished();
1701
if (delSuccess) emit delPhotoFinished();
1624
else emit delPhotoError(output);
1702
else emit delPhotoError(output);
1625
}
1703
}
1626
1704
1627
void KgpgInterface::delphotoprocess(KProcIO *p)
1705
void KgpgInterface::delphotoprocess(KProcIO *p)
1628
{
1706
{
1707
	kdDebug(2100) << k_funcinfo << endl;
1629
        TQString required=TQString();
1708
        TQString required=TQString();
1630
        while (p->readln(required,true)!=-1) {
1709
        while (p->readln(required,true)!=-1) {
1631
                output+=required+"\n";
1710
                output+=required+"\n";
Lines 1670-1675 Link Here
1670
1749
1671
void KgpgInterface::KgpgAddPhoto(TQString keyID,TQString imagePath)
1750
void KgpgInterface::KgpgAddPhoto(TQString keyID,TQString imagePath)
1672
{
1751
{
1752
	kdDebug(2100) << k_funcinfo << endl;
1673
photoUrl=imagePath;
1753
photoUrl=imagePath;
1674
output=TQString();
1754
output=TQString();
1675
addSuccess=true;
1755
addSuccess=true;
Lines 1683-1694 Link Here
1683
1763
1684
void KgpgInterface::addphotoover(TDEProcess *)
1764
void KgpgInterface::addphotoover(TDEProcess *)
1685
{
1765
{
1766
	kdDebug(2100) << k_funcinfo << endl;
1686
if (addSuccess) emit addPhotoFinished();
1767
if (addSuccess) emit addPhotoFinished();
1687
else emit addPhotoError(output);
1768
else emit addPhotoError(output);
1688
}
1769
}
1689
1770
1690
void KgpgInterface::addphotoprocess(KProcIO *p)
1771
void KgpgInterface::addphotoprocess(KProcIO *p)
1691
{
1772
{
1773
	kdDebug(2100) << k_funcinfo << endl;
1692
        TQString required=TQString();
1774
        TQString required=TQString();
1693
        while (p->readln(required,true)!=-1) {
1775
        while (p->readln(required,true)!=-1) {
1694
                output+=required+"\n";
1776
                output+=required+"\n";
Lines 1747-1752 Link Here
1747
1829
1748
void KgpgInterface::KgpgRevokeKey(TQString keyID,TQString revokeUrl,int reason,TQString description)
1830
void KgpgInterface::KgpgRevokeKey(TQString keyID,TQString revokeUrl,int reason,TQString description)
1749
{
1831
{
1832
	kdDebug(2100) << k_funcinfo << endl;
1750
        revokeReason=reason;
1833
        revokeReason=reason;
1751
        revokeSuccess=false;
1834
        revokeSuccess=false;
1752
        revokeDescription=description;
1835
        revokeDescription=description;
Lines 1764-1769 Link Here
1764
1847
1765
void KgpgInterface::revokeover(TDEProcess *)
1848
void KgpgInterface::revokeover(TDEProcess *)
1766
{
1849
{
1850
	kdDebug(2100) << k_funcinfo << endl;
1767
        if (!revokeSuccess)
1851
        if (!revokeSuccess)
1768
                KMessageBox::detailedSorry(0,i18n("Creation of the revocation certificate failed..."),output);
1852
                KMessageBox::detailedSorry(0,i18n("Creation of the revocation certificate failed..."),output);
1769
        else {
1853
        else {
Lines 1778-1783 Link Here
1778
1862
1779
void KgpgInterface::revokeprocess(KProcIO *p)
1863
void KgpgInterface::revokeprocess(KProcIO *p)
1780
{
1864
{
1865
	kdDebug(2100) << k_funcinfo << endl;
1781
        TQString required=TQString();
1866
        TQString required=TQString();
1782
        while (p->readln(required,true)!=-1) {
1867
        while (p->readln(required,true)!=-1) {
1783
                output+=required+"\n";
1868
                output+=required+"\n";
Lines 1833-1838 Link Here
1833
1918
1834
TQString KgpgInterface::getGpgSetting(TQString name,TQString configFile)
1919
TQString KgpgInterface::getGpgSetting(TQString name,TQString configFile)
1835
{
1920
{
1921
	kdDebug(2100) << k_funcinfo << endl;
1836
        name=name.stripWhiteSpace()+" ";
1922
        name=name.stripWhiteSpace()+" ";
1837
        TQFile qfile(TQFile::encodeName(configFile));
1923
        TQFile qfile(TQFile::encodeName(configFile));
1838
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
1924
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
Lines 1855-1860 Link Here
1855
1941
1856
TQString KgpgInterface::getGpgMultiSetting(TQString name,TQString configFile)
1942
TQString KgpgInterface::getGpgMultiSetting(TQString name,TQString configFile)
1857
{
1943
{
1944
	kdDebug(2100) << k_funcinfo << endl;
1858
// get GnuPG setting for item that can have multiple entries (eg. encrypt-to)
1945
// get GnuPG setting for item that can have multiple entries (eg. encrypt-to)
1859
1946
1860
TQString parsedResult=TQString();
1947
TQString parsedResult=TQString();
Lines 1884-1889 Link Here
1884
1971
1885
void KgpgInterface::delGpgGroup(TQString name, TQString configFile)
1972
void KgpgInterface::delGpgGroup(TQString name, TQString configFile)
1886
{
1973
{
1974
	kdDebug(2100) << k_funcinfo << endl;
1887
        TQString textToWrite;
1975
        TQString textToWrite;
1888
        TQFile qfile(TQFile::encodeName(configFile));
1976
        TQFile qfile(TQFile::encodeName(configFile));
1889
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
1977
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
Lines 1912-1917 Link Here
1912
2000
1913
void KgpgInterface::setGpgGroupSetting(TQString name,TQStringList values, TQString configFile)
2001
void KgpgInterface::setGpgGroupSetting(TQString name,TQStringList values, TQString configFile)
1914
{
2002
{
2003
	kdDebug(2100) << k_funcinfo << endl;
1915
        TQString textToWrite;
2004
        TQString textToWrite;
1916
        bool found=false;
2005
        bool found=false;
1917
        TQFile qfile(TQFile::encodeName(configFile));
2006
        TQFile qfile(TQFile::encodeName(configFile));
Lines 1951-1956 Link Here
1951
2040
1952
TQStringList KgpgInterface::getGpgGroupSetting(TQString name,TQString configFile)
2041
TQStringList KgpgInterface::getGpgGroupSetting(TQString name,TQString configFile)
1953
{
2042
{
2043
	kdDebug(2100) << k_funcinfo << endl;
1954
2044
1955
        TQFile qfile(TQFile::encodeName(configFile));
2045
        TQFile qfile(TQFile::encodeName(configFile));
1956
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
2046
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
Lines 1978-1983 Link Here
1978
2068
1979
TQStringList KgpgInterface::getGpgGroupNames(TQString configFile)
2069
TQStringList KgpgInterface::getGpgGroupNames(TQString configFile)
1980
{
2070
{
2071
	kdDebug(2100) << k_funcinfo << endl;
1981
        TQStringList groups;
2072
        TQStringList groups;
1982
        TQFile qfile(TQFile::encodeName(configFile));
2073
        TQFile qfile(TQFile::encodeName(configFile));
1983
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
2074
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
Lines 2000-2005 Link Here
2000
2091
2001
bool KgpgInterface::getGpgBoolSetting(TQString name,TQString configFile)
2092
bool KgpgInterface::getGpgBoolSetting(TQString name,TQString configFile)
2002
{
2093
{
2094
	kdDebug(2100) << k_funcinfo << endl;
2003
        name=name;
2095
        name=name;
2004
        TQFile qfile(TQFile::encodeName(configFile));
2096
        TQFile qfile(TQFile::encodeName(configFile));
2005
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
2097
        if (qfile.open(IO_ReadOnly) && (qfile.exists())) {
Lines 2019-2024 Link Here
2019
2111
2020
void KgpgInterface::setGpgSetting(TQString name,TQString value,TQString url)
2112
void KgpgInterface::setGpgSetting(TQString name,TQString value,TQString url)
2021
{
2113
{
2114
	kdDebug(2100) << k_funcinfo << endl;
2022
        name=name+" ";
2115
        name=name+" ";
2023
        TQString textToWrite;
2116
        TQString textToWrite;
2024
        bool found=false;
2117
        bool found=false;
Lines 2054-2059 Link Here
2054
2147
2055
void KgpgInterface::setGpgMultiSetting(TQString name,TQStringList values,TQString url)
2148
void KgpgInterface::setGpgMultiSetting(TQString name,TQStringList values,TQString url)
2056
{
2149
{
2150
	kdDebug(2100) << k_funcinfo << endl;
2057
        name=name+" ";
2151
        name=name+" ";
2058
        TQString textToWrite;
2152
        TQString textToWrite;
2059
        bool found=false;
2153
        bool found=false;
Lines 2086-2091 Link Here
2086
2180
2087
void KgpgInterface::setGpgBoolSetting(TQString name,bool enable,TQString url)
2181
void KgpgInterface::setGpgBoolSetting(TQString name,bool enable,TQString url)
2088
{
2182
{
2183
	kdDebug(2100) << k_funcinfo << endl;
2089
        TQString textToWrite;
2184
        TQString textToWrite;
2090
        bool found=false;
2185
        bool found=false;
2091
        TQFile qfile(TQFile::encodeName(url));
2186
        TQFile qfile(TQFile::encodeName(url));
Lines 2119-2124 Link Here
2119
2214
2120
TQString KgpgInterface::checkForUtf8bis(TQString txt)
2215
TQString KgpgInterface::checkForUtf8bis(TQString txt)
2121
{
2216
{
2217
	kdDebug(2100) << k_funcinfo << endl;
2122
    if (strchr (txt.ascii(), 0xc3) || (txt.find("\\x")!=-1))
2218
    if (strchr (txt.ascii(), 0xc3) || (txt.find("\\x")!=-1))
2123
	txt=checkForUtf8(txt);
2219
	txt=checkForUtf8(txt);
2124
    else {
2220
    else {
Lines 2131-2136 Link Here
2131
2227
2132
TQString KgpgInterface::checkForUtf8(TQString txt)
2228
TQString KgpgInterface::checkForUtf8(TQString txt)
2133
{
2229
{
2230
	kdDebug(2100) << k_funcinfo << endl;
2134
        //    code borrowed from gpa
2231
        //    code borrowed from gpa
2135
        const char *s;
2232
        const char *s;
2136
2233
(-)tdeutils.orig/kgpg/kgpgoptions.cpp (-35 / +70 lines)
Lines 83-89 Link Here
83
		else defaultConfigPath=TQString();
83
		else defaultConfigPath=TQString();
84
		}
84
		}
85
85
86
kdDebug(2100)<<"Adding pages"<<endl;
86
	kdDebug(2100)<<"Adding pages"<<endl;
87
        page1=new Encryption();
87
        page1=new Encryption();
88
        page2=new Decryption();
88
        page2=new Decryption();
89
        page3=new UIConf();
89
        page3=new UIConf();
Lines 185-193 Link Here
185
185
186
void kgpgOptions::slotChangeHome()
186
void kgpgOptions::slotChangeHome()
187
{
187
{
188
TQString gpgHome=KFileDialog::getExistingDirectory(page4->gpg_home_path->text(),this,i18n("New GnuPG Home Location"));
188
	TQString gpgHome=KFileDialog::getExistingDirectory(page4->gpg_home_path->text(),this,i18n("New GnuPG Home Location"));
189
if (gpgHome.isEmpty()) return;
189
	if (gpgHome.isEmpty()) return;
190
if (!gpgHome.endsWith("/")) gpgHome.append("/");
190
	if (!gpgHome.endsWith("/")) gpgHome.append("/");
191
	TQString confPath="options";
191
	TQString confPath="options";
192
        if (!TQFile(gpgHome+confPath).exists()) {
192
        if (!TQFile(gpgHome+confPath).exists()) {
193
                confPath="gpg.conf";
193
                confPath="gpg.conf";
Lines 201-207 Link Here
201
		confPath="gpg.conf";
201
		confPath="gpg.conf";
202
		TQFile confFile(gpgHome+confPath);
202
		TQFile confFile(gpgHome+confPath);
203
		if (!confFile.open(IO_WriteOnly))
203
		if (!confFile.open(IO_WriteOnly))
204
		{KMessageBox::sorry(this,i18n("Cannot create configuration file. Please check if destination media is mounted and if you have write access"));
204
				{
205
					KMessageBox::sorry(this,i18n("Cannot create configuration file. Please check if destination media is mounted and if you have write access"));
205
		return;
206
		return;
206
		}
207
		}
207
		else
208
		else
Lines 220-226 Link Here
220
221
221
void kgpgOptions::updateWidgets()
222
void kgpgOptions::updateWidgets()
222
{
223
{
223
TQString pubKeyring,privKeyring;
224
	TQString pubKeyring,privKeyring;
224
225
225
        gpgConfigPath = KGpgSettings::gpgConfigPath();
226
        gpgConfigPath = KGpgSettings::gpgConfigPath();
226
	page4->gpg_conf_path->setText(KURL(gpgConfigPath).fileName());
227
	page4->gpg_conf_path->setText(KURL(gpgConfigPath).fileName());
Lines 485-494 Link Here
485
        TQFile qfile(path);
486
        TQFile qfile(path);
486
        if (qfile.exists())
487
        if (qfile.exists())
487
                qfile.remove();
488
                qfile.remove();
488
        {
489
//         {
489
                //if (!qfile.remove()) KMessageBox::sorry(this,i18n("Cannot remove service menu. Check permissions"));
490
                //if (!qfile.remove()) KMessageBox::sorry(this,i18n("Cannot remove service menu. Check permissions"));
490
                //else KMessageBox::information(this,i18n("Service menu 'Decrypt File' has been removed."));
491
                //else KMessageBox::information(this,i18n("Service menu 'Decrypt File' has been removed."));
491
        }
492
//         }
492
        //else KMessageBox::sorry(this,i18n("No service menu found"));
493
        //else KMessageBox::sorry(this,i18n("No service menu found"));
493
494
494
}
495
}
Lines 518-526 Link Here
518
519
519
        ////////   update display of keys in main management window
520
        ////////   update display of keys in main management window
520
        FILE *fp;
521
        FILE *fp;
521
        TQString tst,name,trustedvals="idre-",issec;
522
        TQString name,trustedvals="idre-",issec;
522
        int counter=0;
523
        int counter=0;
523
        char line[300];
524
        char line[300];
525
	TQString currentKey;
526
	TQMap<TQString,TQStringList> hashMap;
524
527
525
	FILE *fp2;
528
	FILE *fp2;
526
529
Lines 535-552 Link Here
535
538
536
        fp = popen("gpg --no-tty --with-colon --list-keys", "r");
539
        fp = popen("gpg --no-tty --with-colon --list-keys", "r");
537
        while ( fgets( line, sizeof(line), fp)) {
540
        while ( fgets( line, sizeof(line), fp)) {
538
                tst=line;
541
                TQString tst=TQString::fromUtf8(line);
539
                if (tst.startsWith("pub")) {
542
                kdDebug(2100) << k_funcinfo << "Read one secret key line: " << tst << endl;
543
                if ( tst.startsWith("sec")  ) {
544
                	currentKey = tst.section(':',4,4);
545
                	TQStringList lst; lst << tst;
546
			hashMap.insert(currentKey,lst);
547
                }
548
		else
549
			hashMap.find(currentKey).data().append(tst);
550
551
	}
552
	pclose(fp);
553
554
// process the list
555
556
	TQMap<TQString,TQStringList>::Iterator ite;
557
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
558
		TDEListViewItem *item;
559
		TQStringList::Iterator it;
560
		bool dead = true;	
561
		TQString name,id,val;
562
563
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
564
			TQString tst =  (*it);
565
			if ( tst.startsWith("pub") ) {
566
				if ( KgpgInterface::getGpgVersion() < 210 )
567
					name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
568
				val = tst.section(':',1,1);
569
				id = tst.section(':',4,4);
570
			}
571
			if ( tst.startsWith("uid") && KgpgInterface::getGpgVersion() >= 210 )
540
                        name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
572
                        name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
541
                        if ((!name.isEmpty()) && (trustedvals.find(tst.section(':',1,1))==-1)) {
573
		}
574
575
		if ((!name.isEmpty()) && (trustedvals.find(val)==-1)) {
542
                                counter++;
576
                                counter++;
543
                                //name=name.section('<',-1,-1);
577
                                //name=name.section('<',-1,-1);
544
                                //  name=name.section('>',0,0);
578
                                //  name=name.section('>',0,0);
545
                                names+=name;
579
                                names+=name;
546
                                ids+=tst.section(':',4,4);
580
			ids+=id;
547
                                if (tst.section(':',4,4).right(8)==alwaysKeyID)
581
			if (id.right(8)==alwaysKeyID)
548
                                        alwaysKeyName=tst.section(':',4,4).right(8)+":"+name;
582
				alwaysKeyName=id.right(8)+":"+name;
549
				if (issec.find(tst.section(':',4,4).right(8),0,FALSE)!=-1)
583
			if (issec.find(id.right(8),0,FALSE)!=-1)
550
				{
584
				{
551
//***                           page1->file_key->insertItem(pixkeyDouble,tst.section(':',4,4).right(8)+":"+name);
585
//***                           page1->file_key->insertItem(pixkeyDouble,tst.section(':',4,4).right(8)+":"+name);
552
//***                           page1->always_key->insertItem(pixkeyDouble,tst.section(':',4,4).right(8)+":"+name);
586
//***                           page1->always_key->insertItem(pixkeyDouble,tst.section(':',4,4).right(8)+":"+name);
Lines 558-565 Link Here
558
				}
592
				}
559
                        }
593
                        }
560
                }
594
                }
561
        }
595
562
        pclose(fp);
563
        if (counter==0) {
596
        if (counter==0) {
564
                ids+="0";
597
                ids+="0";
565
//***                           page1->file_key->insertItem(i18n("none"));
598
//***                           page1->file_key->insertItem(i18n("none"));
Lines 569-600 Link Here
569
602
570
void kgpgOptions::slotAddKeyServer()
603
void kgpgOptions::slotAddKeyServer()
571
{
604
{
572
TQString newServer=KInputDialog::getText(i18n("Add New Key Server"),i18n("Server URL:"));
605
	TQString newServer=KInputDialog::getText(i18n("Add New Key Server"),i18n("Server URL:"));
573
if (!newServer.isEmpty())
606
	if (!newServer.isEmpty())
574
page6->ServerBox->insertItem(newServer.stripWhiteSpace());
607
		page6->ServerBox->insertItem(newServer.stripWhiteSpace());
575
page6->ServerBox->setSelected(page6->ServerBox->findItem(newServer.stripWhiteSpace()),true);
608
	page6->ServerBox->setSelected(page6->ServerBox->findItem(newServer.stripWhiteSpace()),true);
576
}
609
}
577
610
578
void kgpgOptions::slotDelKeyServer()
611
void kgpgOptions::slotDelKeyServer()
579
{
612
{
580
bool defaultDeleted=false;
613
	bool defaultDeleted=false;
581
if (page6->ServerBox->currentText().find(" ")!=-1) defaultDeleted=true;
614
	if (page6->ServerBox->currentText().find(" ")!=-1) 
582
page6->ServerBox->removeItem(page6->ServerBox->currentItem());
615
		defaultDeleted=true;
583
page6->ServerBox->setSelected(0,true);
616
	page6->ServerBox->removeItem(page6->ServerBox->currentItem());
584
if (defaultDeleted) page6->ServerBox->changeItem(page6->ServerBox->currentText().section(" ",0,0)+" "+i18n("(Default)"),0);
617
	page6->ServerBox->setSelected(0,true);
618
	if (defaultDeleted) 
619
		page6->ServerBox->changeItem(page6->ServerBox->currentText().section(" ",0,0)+" "+i18n("(Default)"),0);
585
}
620
}
586
621
587
void kgpgOptions::slotDefaultKeyServer()
622
void kgpgOptions::slotDefaultKeyServer()
588
{
623
{
589
uint curr=page6->ServerBox->currentItem();
624
	uint curr=page6->ServerBox->currentItem();
590
page6->ServerBox->changeItem(page6->ServerBox->currentText ().section(" ",0,0)+" "+i18n("(Default)"),curr);
625
	page6->ServerBox->changeItem(page6->ServerBox->currentText ().section(" ",0,0)+" "+i18n("(Default)"),curr);
591
626
592
for (uint i=0;i<page6->ServerBox->count();i++)
627
	for (uint i=0;i<page6->ServerBox->count();i++)
593
{
628
	{
594
if (i!=curr)
629
		if (i!=curr)
595
page6->ServerBox->changeItem(page6->ServerBox->text(i).section(" ",0,0),i);
630
			page6->ServerBox->changeItem(page6->ServerBox->text(i).section(" ",0,0),i);
596
}
631
	}
597
page6->ServerBox->setSelected(curr,true);
632
	page6->ServerBox->setSelected(curr,true);
598
}
633
}
599
634
600
#include "kgpgoptions.moc"
635
#include "kgpgoptions.moc"
(-)tdeutils.orig/kgpg/listkeys.cpp (-129 / +368 lines)
Lines 4-9 Link Here
4
    begin                : Thu Jul 4 2002
4
    begin                : Thu Jul 4 2002
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
6
    email                : bj@altern.org
6
    email                : bj@altern.org
7
8
    updated to handle gpg21 : Sun Jul 30 10:18:29 CEST 2017
9
    copyright          : (C) 2017 by Emanoil Kotsev
10
    email              : deloptes@yahoo.com
7
 ***************************************************************************/
11
 ***************************************************************************/
8
12
9
/***************************************************************************
13
/***************************************************************************
Lines 216-222 Link Here
216
KgpgSelKey::KgpgSelKey(TQWidget *parent, const char *name,bool allowMultipleSelection, TQString preselected):
220
KgpgSelKey::KgpgSelKey(TQWidget *parent, const char *name,bool allowMultipleSelection, TQString preselected):
217
KDialogBase( parent, name, true,i18n("Private Key List"),Ok | Cancel)
221
KDialogBase( parent, name, true,i18n("Private Key List"),Ok | Cancel)
218
{
222
{
219
        TQString keyname;
223
// not used ???        TQString keyname;
220
        page = new TQWidget(this);
224
        page = new TQWidget(this);
221
        TQLabel *labeltxt;
225
        TQLabel *labeltxt;
222
        TDEIconLoader *loader = TDEGlobal::iconLoader();
226
        TDEIconLoader *loader = TDEGlobal::iconLoader();
Lines 239-266 Link Here
239
        if (preselected==TQString()) preselected = KGpgSettings::defaultKey();
243
        if (preselected==TQString()) preselected = KGpgSettings::defaultKey();
240
244
241
        FILE *fp,*fp2;
245
        FILE *fp,*fp2;
242
        TQString fullname,tst,tst2;
243
        char line[300];
246
        char line[300];
244
247
245
        bool selectedok=false;
248
        bool selectedok=false;
246
	bool warn=false;
249
	bool warn=false;
247
	TDEListViewItem *item;
250
	TQString currentKey;
251
	TQMap<TQString,TQStringList> hashMap;
248
252
249
        fp = popen("gpg --no-tty --with-colons --list-secret-keys", "r");
253
        fp = popen("gpg --no-tty --with-colons --list-secret-keys", "r");
250
        while ( fgets( line, sizeof(line), fp)) {
254
        while ( fgets( line, sizeof(line), fp)) {
251
                tst=TQString::fromUtf8(line);
255
                TQString tst=TQString::fromUtf8(line);
252
                if (tst.startsWith("sec")) {
256
                kdDebug(2100) << k_funcinfo << "Read one secret key line: " << tst << endl;
257
                if ( tst.startsWith("sec")  ) {
258
                	currentKey = tst.section(':',4,4);
259
                	TQStringList lst; lst << tst;
260
			hashMap.insert(currentKey,lst);
261
                }
262
		else
263
			hashMap.find(currentKey).data().append(tst);
264
265
	}
266
	pclose(fp);
267
268
// process the list
269
270
	TQMap<TQString,TQStringList>::Iterator ite;
271
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
272
		TDEListViewItem *item;
273
		TQStringList::Iterator it;
274
		bool dead = true;	
275
		TQString fullname,val,id;
276
277
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
278
			TQString tst =  (*it);
253
                        TQStringList keyString=TQStringList::split(":",tst,true);
279
                        TQStringList keyString=TQStringList::split(":",tst,true);
254
                        TQString val=keyString[6];
280
			if (tst.startsWith("sec")) {		
255
                        TQString id=TQString("0x"+keyString[4].right(8));
281
				val=keyString[6];
282
				id=TQString("0x"+keyString[4].right(8));
256
                        if (val.isEmpty())
283
                        if (val.isEmpty())
257
                                val=i18n("Unlimited");
284
                                val=i18n("Unlimited");
258
                        fullname=keyString[9];
285
                        fullname=keyString[9];
259
286
260
                        fp2 = popen(TQFile::encodeName(TQString("gpg --no-tty --with-colons --list-key %1").arg(KShellProcess::quote(id))), "r");
287
                        fp2 = popen(TQFile::encodeName(TQString("gpg --no-tty --with-colons --list-key %1").arg(KShellProcess::quote(id))), "r");
261
                        bool dead=true;
288
				dead=true;
262
                        while ( fgets( line, sizeof(line), fp2)) {
289
                        while ( fgets( line, sizeof(line), fp2)) {
263
                                tst2=TQString::fromUtf8(line);
290
					TQString tst2=TQString::fromUtf8(line);
264
                                if (tst2.startsWith("pub")) {
291
                                if (tst2.startsWith("pub")) {
265
                         const TQString trust2=tst2.section(':',1,1);
292
                         const TQString trust2=tst2.section(':',1,1);
266
                        switch( trust2[0] ) {
293
                        switch( trust2[0] ) {
Lines 282-287 Link Here
282
                                }
309
                                }
283
                        }
310
                        }
284
                        pclose(fp2);
311
                        pclose(fp2);
312
			}
313
			if ( tst.startsWith("uid") && fullname.isEmpty() ) {
314
				TQStringList key=TQStringList::split(":",tst,true);
315
				fullname = key[9];
316
			}
317
318
                }
319
285
                        if (!fullname.isEmpty() && (!dead)) {
320
                        if (!fullname.isEmpty() && (!dead)) {
286
			TQString keyMail,keyName;
321
			TQString keyMail,keyName;
287
			if (fullname.find("<")!=-1) {
322
			if (fullname.find("<")!=-1) {
Lines 295-301 Link Here
295
330
296
        		keyName=KgpgInterface::checkForUtf8(keyName);
331
        		keyName=KgpgInterface::checkForUtf8(keyName);
297
332
298
299
                                item=new TDEListViewItem(keysListpr,keyName,keyMail,id);
333
                                item=new TDEListViewItem(keysListpr,keyName,keyMail,id);
300
                                //TDEListViewItem *sub= new TDEListViewItem(item,i18n("ID: %1, trust: %2, expiration: %3").arg(id).arg(trust).arg(val));
334
                                //TDEListViewItem *sub= new TDEListViewItem(item,i18n("ID: %1, trust: %2, expiration: %3").arg(id).arg(trust).arg(val));
301
				TDEListViewItem *sub= new TDEListViewItem(item,i18n("Expiration:"),val);
335
				TDEListViewItem *sub= new TDEListViewItem(item,i18n("Expiration:"),val);
Lines 308-315 Link Here
308
                                }
342
                                }
309
                        }
343
                        }
310
                }
344
                }
311
        }
312
        pclose(fp);
313
345
314
	if (warn)
346
	if (warn)
315
	{
347
	{
Lines 395-400 Link Here
395
KeyView::KeyView( TQWidget *parent, const char *name )
427
KeyView::KeyView( TQWidget *parent, const char *name )
396
                : TDEListView( parent, name )
428
                : TDEListView( parent, name )
397
{
429
{
430
//         kdDebug(2100) << k_funcinfo << endl;
398
        TDEIconLoader *loader = TDEGlobal::iconLoader();
431
        TDEIconLoader *loader = TDEGlobal::iconLoader();
399
432
400
        pixkeyOrphan=loader->loadIcon("kgpg_key4",TDEIcon::Small,20);
433
        pixkeyOrphan=loader->loadIcon("kgpg_key4",TDEIcon::Small,20);
Lines 434-439 Link Here
434
467
435
void  KeyView::droppedfile (KURL url)
468
void  KeyView::droppedfile (KURL url)
436
{
469
{
470
//         kdDebug(2100) << k_funcinfo << endl;
437
        if (KMessageBox::questionYesNo(this,i18n("<p>Do you want to import file <b>%1</b> into your key ring?</p>").arg(url.path()), TQString(), i18n("Import"), i18n("Do Not Import"))!=KMessageBox::Yes)
471
        if (KMessageBox::questionYesNo(this,i18n("<p>Do you want to import file <b>%1</b> into your key ring?</p>").arg(url.path()), TQString(), i18n("Import"), i18n("Do Not Import"))!=KMessageBox::Yes)
438
                return;
472
                return;
439
473
Lines 479-502 Link Here
479
mySearchLine::mySearchLine(TQWidget *parent, KeyView *listView, const char *name)
513
mySearchLine::mySearchLine(TQWidget *parent, KeyView *listView, const char *name)
480
:TDEListViewSearchLine(parent,listView,name)
514
:TDEListViewSearchLine(parent,listView,name)
481
{
515
{
482
searchListView=listView;
516
	searchListView=listView;
483
setKeepParentsVisible(false);
517
	setKeepParentsVisible(false);
484
}
518
}
485
519
486
mySearchLine::~ mySearchLine()
520
mySearchLine::~ mySearchLine()
487
{}
521
{}
488
522
489
490
bool mySearchLine::itemMatches(const TQListViewItem *item, const TQString & s) const
523
bool mySearchLine::itemMatches(const TQListViewItem *item, const TQString & s) const
491
{
524
{
492
if (item->depth()!=0) return true;
525
if (item->depth()!=0) return true;
493
else return TDEListViewSearchLine::itemMatches(item,s);
526
else return TDEListViewSearchLine::itemMatches(item,s);
494
}
527
}
495
528
496
497
498
void mySearchLine::updateSearch(const TQString& s)
529
void mySearchLine::updateSearch(const TQString& s)
499
{
530
{
531
//         kdDebug(2100) << k_funcinfo << endl;
500
    TDEListViewSearchLine::updateSearch(s);
532
    TDEListViewSearchLine::updateSearch(s);
501
    if (searchListView->displayOnlySecret || !searchListView->displayDisabled)
533
    if (searchListView->displayOnlySecret || !searchListView->displayDisabled)
502
    {
534
    {
Lines 521-528 Link Here
521
553
522
listKeys::listKeys(TQWidget *parent, const char *name) : DCOPObject( "KeyInterface" ), TDEMainWindow(parent, name,0)
554
listKeys::listKeys(TQWidget *parent, const char *name) : DCOPObject( "KeyInterface" ), TDEMainWindow(parent, name,0)
523
{
555
{
556
//         kdDebug(2100) << k_funcinfo << endl;
524
        //KWin::setType(TQt::WDestructiveClose);
557
        //KWin::setType(TQt::WDestructiveClose);
525
558
559
526
        keysList2 = new KeyView(this);
560
        keysList2 = new KeyView(this);
527
        keysList2->photoKeysList=TQString();
561
        keysList2->photoKeysList=TQString();
528
        keysList2->groupNb=0;
562
        keysList2->groupNb=0;
Lines 725-730 Link Here
725
        connect(s_kgpgEditor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList)));
759
        connect(s_kgpgEditor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList)));
726
        connect(this,TQT_SIGNAL(fontChanged(TQFont)),s_kgpgEditor,TQT_SLOT(slotSetFont(TQFont)));
760
        connect(this,TQT_SIGNAL(fontChanged(TQFont)),s_kgpgEditor,TQT_SLOT(slotSetFont(TQFont)));
727
        connect(s_kgpgEditor->view->editor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList)));
761
        connect(s_kgpgEditor->view->editor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList)));
762
763
764
//	kdDebug(2100) << k_funcinfo << "getGpgversion" << KgpgInterface::getGpgVersion() <<endl;
728
}
765
}
729
766
730
767
Lines 849-854 Link Here
849
886
850
void listKeys::refreshKeyFromServer()
887
void listKeys::refreshKeyFromServer()
851
{
888
{
889
//         kdDebug(2100) << k_funcinfo << endl;
852
        if (keysList2->currentItem()==NULL)
890
        if (keysList2->currentItem()==NULL)
853
                return;
891
                return;
854
        TQString keyIDS;
892
        TQString keyIDS;
Lines 874-879 Link Here
874
912
875
void listKeys::refreshFinished()
913
void listKeys::refreshFinished()
876
{
914
{
915
//         kdDebug(2100) << k_funcinfo << endl;
877
        if (kServer)
916
        if (kServer)
878
                kServer=0L;
917
                kServer=0L;
879
918
Lines 902-907 Link Here
902
941
903
void listKeys::slotregenerate()
942
void listKeys::slotregenerate()
904
{
943
{
944
//         kdDebug(2100) << k_funcinfo << endl;
905
        FILE *fp;
945
        FILE *fp;
906
        TQString tst;
946
        TQString tst;
907
        char line[300];
947
        char line[300];
Lines 1029-1034 Link Here
1029
1069
1030
void listKeys::findKey()
1070
void listKeys::findKey()
1031
{
1071
{
1072
 //        kdDebug(2100) << k_funcinfo << endl;
1032
        KFindDialog fd(this,"find_dialog",0,"");
1073
        KFindDialog fd(this,"find_dialog",0,"");
1033
        if ( fd.exec() != TQDialog::Accepted )
1074
        if ( fd.exec() != TQDialog::Accepted )
1034
                return;
1075
                return;
Lines 1039-1044 Link Here
1039
1080
1040
void listKeys::findFirstKey()
1081
void listKeys::findFirstKey()
1041
{
1082
{
1083
//         kdDebug(2100) << k_funcinfo << endl;
1042
        if (searchString.isEmpty())
1084
        if (searchString.isEmpty())
1043
                return;
1085
                return;
1044
        bool foundItem=true;
1086
        bool foundItem=true;
Lines 1075-1080 Link Here
1075
1117
1076
void listKeys::findNextKey()
1118
void listKeys::findNextKey()
1077
{
1119
{
1120
//         kdDebug(2100) << k_funcinfo << endl;
1078
				//kdDebug(2100)<<"find next"<<endl;
1121
				//kdDebug(2100)<<"find next"<<endl;
1079
        if (searchString.isEmpty()) {
1122
        if (searchString.isEmpty()) {
1080
                findKey();
1123
                findKey();
Lines 1119-1124 Link Here
1119
1162
1120
void listKeys::addToKAB()
1163
void listKeys::addToKAB()
1121
{
1164
{
1165
//         kdDebug(2100) << k_funcinfo << endl;
1122
        TDEABC::Key key;
1166
        TDEABC::Key key;
1123
	if (!keysList2->currentItem()) return;
1167
	if (!keysList2->currentItem()) return;
1124
        //TQString email=extractKeyMail(keysList2->currentItem()).stripWhiteSpace();
1168
        //TQString email=extractKeyMail(keysList2->currentItem()).stripWhiteSpace();
Lines 1200-1205 Link Here
1200
1244
1201
void listKeys::showKeyServer()
1245
void listKeys::showKeyServer()
1202
{
1246
{
1247
//         kdDebug(2100) << k_funcinfo << endl;
1203
        keyServer *ks=new keyServer(this);
1248
        keyServer *ks=new keyServer(this);
1204
	connect(ks,TQT_SIGNAL( importFinished(TQString) ) , keysList2, TQT_SLOT(refreshcurrentkey(TQString)));
1249
	connect(ks,TQT_SIGNAL( importFinished(TQString) ) , keysList2, TQT_SLOT(refreshcurrentkey(TQString)));
1205
        ks->exec();
1250
        ks->exec();
Lines 1211-1216 Link Here
1211
1256
1212
void listKeys::checkList()
1257
void listKeys::checkList()
1213
{
1258
{
1259
//         kdDebug(2100) << k_funcinfo << endl;
1214
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
1260
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
1215
        if (exportList.count()>1)
1261
        if (exportList.count()>1)
1216
                {
1262
                {
Lines 1266-1271 Link Here
1266
void listKeys::readOptions()
1312
void listKeys::readOptions()
1267
{
1313
{
1268
1314
1315
        kdDebug(2100) << k_funcinfo << endl;
1269
        clipboardMode=TQClipboard::Clipboard;
1316
        clipboardMode=TQClipboard::Clipboard;
1270
        if (KGpgSettings::useMouseSelection() && (kapp->clipboard()->supportsSelection()))
1317
        if (KGpgSettings::useMouseSelection() && (kapp->clipboard()->supportsSelection()))
1271
                clipboardMode=TQClipboard::Selection;
1318
                clipboardMode=TQClipboard::Selection;
Lines 1488-1493 Link Here
1488
1535
1489
void listKeys::slotexport()
1536
void listKeys::slotexport()
1490
{
1537
{
1538
//         kdDebug(2100) << k_funcinfo << endl;
1491
        /////////////////////  export key
1539
        /////////////////////  export key
1492
        if (keysList2->currentItem()==NULL)
1540
        if (keysList2->currentItem()==NULL)
1493
                return;
1541
                return;
Lines 1599-1604 Link Here
1599
1647
1600
void listKeys::showKeyInfo(TQString keyID)
1648
void listKeys::showKeyInfo(TQString keyID)
1601
{
1649
{
1650
//        kdDebug(2100) << k_funcinfo << endl;
1602
        KgpgKeyInfo *opts=new KgpgKeyInfo(this,"key_props",keyID);
1651
        KgpgKeyInfo *opts=new KgpgKeyInfo(this,"key_props",keyID);
1603
        opts->show();
1652
        opts->show();
1604
}
1653
}
Lines 1606-1611 Link Here
1606
1655
1607
void listKeys::slotShowPhoto()
1656
void listKeys::slotShowPhoto()
1608
{
1657
{
1658
//         kdDebug(2100) << k_funcinfo << endl;
1609
        TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'");
1659
        TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'");
1610
        KService::Ptr ptr = offers.first();
1660
        KService::Ptr ptr = offers.first();
1611
        //KMessageBox::sorry(0,ptr->desktopEntryName());
1661
        //KMessageBox::sorry(0,ptr->desktopEntryName());
Lines 1616-1621 Link Here
1616
1666
1617
void listKeys::listsigns()
1667
void listKeys::listsigns()
1618
{
1668
{
1669
//         kdDebug(2100) << k_funcinfo << endl;
1619
        //kdDebug(2100)<<"Edit -------------------------------"<<endl;
1670
        //kdDebug(2100)<<"Edit -------------------------------"<<endl;
1620
        if (keysList2->currentItem()==NULL)
1671
        if (keysList2->currentItem()==NULL)
1621
                return;
1672
                return;
Lines 1646-1651 Link Here
1646
1697
1647
void listKeys::groupAdd()
1698
void listKeys::groupAdd()
1648
{
1699
{
1700
//         kdDebug(2100) << k_funcinfo << endl;
1649
        TQPtrList<TQListViewItem> addList=gEdit->availableKeys->selectedItems();
1701
        TQPtrList<TQListViewItem> addList=gEdit->availableKeys->selectedItems();
1650
        for ( uint i = 0; i < addList.count(); ++i )
1702
        for ( uint i = 0; i < addList.count(); ++i )
1651
                if ( addList.at(i) ) {
1703
                if ( addList.at(i) ) {
Lines 1655-1660 Link Here
1655
1707
1656
void listKeys::groupRemove()
1708
void listKeys::groupRemove()
1657
{
1709
{
1710
//         kdDebug(2100) << k_funcinfo << endl;
1658
        TQPtrList<TQListViewItem> remList=gEdit->groupKeys->selectedItems();
1711
        TQPtrList<TQListViewItem> remList=gEdit->groupKeys->selectedItems();
1659
        for ( uint i = 0; i < remList.count(); ++i )
1712
        for ( uint i = 0; i < remList.count(); ++i )
1660
                if ( remList.at(i) ) {
1713
                if ( remList.at(i) ) {
Lines 1664-1669 Link Here
1664
1717
1665
void listKeys::deleteGroup()
1718
void listKeys::deleteGroup()
1666
{
1719
{
1720
//         kdDebug(2100) << k_funcinfo << endl;
1667
        if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1721
        if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1668
                return;
1722
                return;
1669
1723
Lines 1686-1691 Link Here
1686
1740
1687
void listKeys::groupChange()
1741
void listKeys::groupChange()
1688
{
1742
{
1743
//         kdDebug(2100) << k_funcinfo << endl;
1689
        TQStringList selected;
1744
        TQStringList selected;
1690
        TQListViewItem *item=gEdit->groupKeys->firstChild();
1745
        TQListViewItem *item=gEdit->groupKeys->firstChild();
1691
        while (item) {
1746
        while (item) {
Lines 1697-1702 Link Here
1697
1752
1698
void listKeys::createNewGroup()
1753
void listKeys::createNewGroup()
1699
{
1754
{
1755
//         kdDebug(2100) << k_funcinfo << endl;
1700
        TQStringList badkeys,keysGroup;
1756
        TQStringList badkeys,keysGroup;
1701
1757
1702
        if (keysList2->selectedItems().count()>0) {
1758
        if (keysList2->selectedItems().count()>0) {
Lines 1745-1750 Link Here
1745
1801
1746
void listKeys::groupInit(TQStringList keysGroup)
1802
void listKeys::groupInit(TQStringList keysGroup)
1747
{
1803
{
1804
//         kdDebug(2100) << k_funcinfo << endl;
1748
        kdDebug(2100)<<"preparing group"<<endl;
1805
        kdDebug(2100)<<"preparing group"<<endl;
1749
        TQStringList lostKeys;
1806
        TQStringList lostKeys;
1750
        bool foundId;
1807
        bool foundId;
Lines 1771-1776 Link Here
1771
1828
1772
void listKeys::editGroup()
1829
void listKeys::editGroup()
1773
{
1830
{
1831
//         kdDebug(2100) << k_funcinfo << endl;
1774
  if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1832
  if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1775
                return;
1833
                return;
1776
        TQStringList keysGroup;
1834
        TQStringList keysGroup;
Lines 1826-1831 Link Here
1826
1884
1827
void listKeys::signkey()
1885
void listKeys::signkey()
1828
{
1886
{
1887
//         kdDebug(2100) << k_funcinfo << endl;
1829
        ///////////////  sign a key
1888
        ///////////////  sign a key
1830
        if (keysList2->currentItem()==NULL)
1889
        if (keysList2->currentItem()==NULL)
1831
                return;
1890
                return;
Lines 1924-1936 Link Here
1924
                TDEConfig *config = TDEGlobal::config();
1983
                TDEConfig *config = TDEGlobal::config();
1925
                config->setGroup("General");
1984
                config->setGroup("General");
1926
                kp<< config->readPathEntry("TerminalApplication","konsole");
1985
                kp<< config->readPathEntry("TerminalApplication","konsole");
1927
                kp<<"-e"
1986
                kp<<"-e" <<"gpg" <<"--no-secmem-warning" <<"-u" <<globalkeyID <<"--edit-key" <<signList.at(0)->text(6);
1928
                <<"gpg"
1929
                <<"--no-secmem-warning"
1930
                <<"-u"
1931
                <<globalkeyID
1932
                <<"--edit-key"
1933
                <<signList.at(0)->text(6);
1934
                if (globalisLocal)
1987
                if (globalisLocal)
1935
                        kp<<"lsign";
1988
                        kp<<"lsign";
1936
                else
1989
                else
Lines 1942-1947 Link Here
1942
1995
1943
void listKeys::signLoop()
1996
void listKeys::signLoop()
1944
{
1997
{
1998
//         kdDebug(2100) << k_funcinfo << endl;
1945
        if (keyCount<globalCount) {
1999
        if (keyCount<globalCount) {
1946
                kdDebug(2100)<<"Sign process for key: "<<keyCount<<" on a total of "<<signList.count()<<endl;
2000
                kdDebug(2100)<<"Sign process for key: "<<keyCount<<" on a total of "<<signList.count()<<endl;
1947
                if ( signList.at(keyCount) ) {
2001
                if ( signList.at(keyCount) ) {
Lines 1954-1959 Link Here
1954
2008
1955
void listKeys::signatureResult(int success)
2009
void listKeys::signatureResult(int success)
1956
{
2010
{
2011
//         kdDebug(2100) << k_funcinfo << endl;
1957
        if (success==3)
2012
        if (success==3)
1958
                keysList2->refreshcurrentkey(signList.at(keyCount));
2013
                keysList2->refreshcurrentkey(signList.at(keyCount));
1959
2014
Lines 1967-1972 Link Here
1967
2022
1968
void listKeys::importallsignkey()
2023
void listKeys::importallsignkey()
1969
{
2024
{
2025
//        kdDebug(2100) << k_funcinfo << endl;
1970
        if (keysList2->currentItem()==NULL)
2026
        if (keysList2->currentItem()==NULL)
1971
                return;
2027
                return;
1972
        if (! keysList2->currentItem()->firstChild()) {
2028
        if (! keysList2->currentItem()->firstChild()) {
Lines 1989-1994 Link Here
1989
2045
1990
void listKeys::preimportsignkey()
2046
void listKeys::preimportsignkey()
1991
{
2047
{
2048
//         kdDebug(2100) << k_funcinfo << endl;
1992
        if (keysList2->currentItem()==NULL)
2049
        if (keysList2->currentItem()==NULL)
1993
                return;
2050
                return;
1994
        else
2051
        else
Lines 1997-2003 Link Here
1997
2054
1998
bool listKeys::importRemoteKey(TQString keyID)
2055
bool listKeys::importRemoteKey(TQString keyID)
1999
{
2056
{
2000
2057
//         kdDebug(2100) << k_funcinfo << endl;
2001
        kServer=new keyServer(0,"server_dialog",false,true);
2058
        kServer=new keyServer(0,"server_dialog",false,true);
2002
        kServer->page->kLEimportid->setText(keyID);
2059
        kServer->page->kLEimportid->setText(keyID);
2003
        kServer->page->Buttonimport->setDefault(true);
2060
        kServer->page->Buttonimport->setDefault(true);
Lines 2013-2018 Link Here
2013
2070
2014
void listKeys::dcopImportFinished()
2071
void listKeys::dcopImportFinished()
2015
{
2072
{
2073
// 	kdDebug(2100) << k_funcinfo << endl;
2016
        if (kServer)
2074
        if (kServer)
2017
                kServer=0L;
2075
                kServer=0L;
2018
    TQByteArray params;
2076
    TQByteArray params;
Lines 2024-2029 Link Here
2024
2082
2025
void listKeys::importsignkey(TQString importKeyId)
2083
void listKeys::importsignkey(TQString importKeyId)
2026
{
2084
{
2085
// 	kdDebug(2100) << k_funcinfo << endl;
2027
        ///////////////  sign a key
2086
        ///////////////  sign a key
2028
        kServer=new keyServer(0,"server_dialog",false);
2087
        kServer=new keyServer(0,"server_dialog",false);
2029
        kServer->page->kLEimportid->setText(importKeyId);
2088
        kServer->page->kLEimportid->setText(importKeyId);
Lines 2036-2041 Link Here
2036
2095
2037
void listKeys::importfinished()
2096
void listKeys::importfinished()
2038
{
2097
{
2098
	kdDebug(2100) << k_funcinfo << endl;
2039
        if (kServer)
2099
        if (kServer)
2040
                kServer=0L;
2100
                kServer=0L;
2041
        refreshkey();
2101
        refreshkey();
Lines 2044-2049 Link Here
2044
2104
2045
void listKeys::delsignkey()
2105
void listKeys::delsignkey()
2046
{
2106
{
2107
// 	kdDebug(2100) << k_funcinfo << endl;
2047
        ///////////////  sign a key
2108
        ///////////////  sign a key
2048
        if (keysList2->currentItem()==NULL)
2109
        if (keysList2->currentItem()==NULL)
2049
                return;
2110
                return;
Lines 2075-2080 Link Here
2075
2136
2076
void listKeys::delsignatureResult(bool success)
2137
void listKeys::delsignatureResult(bool success)
2077
{
2138
{
2139
// 	kdDebug(2100) << k_funcinfo << endl;
2078
        if (success) {
2140
        if (success) {
2079
                TQListViewItem *top=keysList2->currentItem();
2141
                TQListViewItem *top=keysList2->currentItem();
2080
                while (top->depth()!=0)
2142
                while (top->depth()!=0)
Lines 2088-2093 Link Here
2088
2150
2089
void listKeys::slotedit()
2151
void listKeys::slotedit()
2090
{
2152
{
2153
// 	kdDebug(2100) << k_funcinfo << endl;
2091
        if (!keysList2->currentItem())
2154
        if (!keysList2->currentItem())
2092
                return;
2155
                return;
2093
        if (keysList2->currentItem()->depth()!=0)
2156
        if (keysList2->currentItem()->depth()!=0)
Lines 2100-2112 Link Here
2100
        TDEConfig *config = TDEGlobal::config();
2163
        TDEConfig *config = TDEGlobal::config();
2101
        config->setGroup("General");
2164
        config->setGroup("General");
2102
        kp<< config->readPathEntry("TerminalApplication","konsole");
2165
        kp<< config->readPathEntry("TerminalApplication","konsole");
2103
        kp<<"-e"
2166
        kp<<"-e" <<"gpg" <<"--no-secmem-warning" <<"--utf8-strings" <<"--edit-key" <<keysList2->currentItem()->text(6) <<"help";
2104
        <<"gpg"
2105
        <<"--no-secmem-warning"
2106
        <<"--utf8-strings"
2107
        <<"--edit-key"
2108
        <<keysList2->currentItem()->text(6)
2109
        <<"help";
2110
        kp.start(TDEProcess::Block);
2167
        kp.start(TDEProcess::Block);
2111
        keysList2->refreshcurrentkey(keysList2->currentItem());
2168
        keysList2->refreshcurrentkey(keysList2->currentItem());
2112
}
2169
}
Lines 2114-2119 Link Here
2114
2171
2115
void listKeys::slotgenkey()
2172
void listKeys::slotgenkey()
2116
{
2173
{
2174
// 	kdDebug(2100) << k_funcinfo << endl;
2117
        //////////  generate key
2175
        //////////  generate key
2118
        keyGenerate *genkey=new keyGenerate(this,0);
2176
        keyGenerate *genkey=new keyGenerate(this,0);
2119
        if (genkey->exec()==TQDialog::Accepted) {
2177
        if (genkey->exec()==TQDialog::Accepted) {
Lines 2230-2235 Link Here
2230
2288
2231
void listKeys::readgenprocess(KProcIO *p)
2289
void listKeys::readgenprocess(KProcIO *p)
2232
{
2290
{
2291
// 	kdDebug(2100) << k_funcinfo << endl;
2233
        TQString required;
2292
        TQString required;
2234
        while (p->readln(required,true)!=-1) {
2293
        while (p->readln(required,true)!=-1) {
2235
                if (required.find("KEY_CREATED")!=-1)
2294
                if (required.find("KEY_CREATED")!=-1)
Lines 2242-2247 Link Here
2242
2301
2243
void listKeys::genover(TDEProcess *)
2302
void listKeys::genover(TDEProcess *)
2244
{
2303
{
2304
// 	kdDebug(2100) << k_funcinfo << endl;
2245
        newkeyID=TQString();
2305
        newkeyID=TQString();
2246
        continueSearch=true;
2306
        continueSearch=true;
2247
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
2307
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
Lines 2255-2263 Link Here
2255
2315
2256
void listKeys::slotReadFingerProcess(KProcIO *p)
2316
void listKeys::slotReadFingerProcess(KProcIO *p)
2257
{
2317
{
2318
// 	kdDebug(2100) << k_funcinfo << endl;
2258
        TQString outp;
2319
        TQString outp;
2259
        while (p->readln(outp)!=-1) {
2320
        while (p->readln(outp)!=-1) {
2260
                if (outp.startsWith("pub") && (continueSearch)) {
2321
		if ( outp.startsWith("pub") && (continueSearch)) {
2261
                        newkeyID=outp.section(':',4,4).right(8).prepend("0x");
2322
                        newkeyID=outp.section(':',4,4).right(8).prepend("0x");
2262
2323
2263
                }
2324
                }
Lines 2272-2277 Link Here
2272
2333
2273
void listKeys::newKeyDone(TDEProcess *)
2334
void listKeys::newKeyDone(TDEProcess *)
2274
{
2335
{
2336
// 	kdDebug(2100) << k_funcinfo << endl;
2275
        changeMessage(i18n("Ready"),0);
2337
        changeMessage(i18n("Ready"),0);
2276
        //        refreshkey();
2338
        //        refreshkey();
2277
        if (newkeyID.isEmpty()) {
2339
        if (newkeyID.isEmpty()) {
Lines 2321-2326 Link Here
2321
2383
2322
void listKeys::doFilePrint(TQString url)
2384
void listKeys::doFilePrint(TQString url)
2323
{
2385
{
2386
// 	kdDebug(2100) << k_funcinfo << endl;
2324
        TQFile qfile(url);
2387
        TQFile qfile(url);
2325
        if (qfile.open(IO_ReadOnly)) {
2388
        if (qfile.open(IO_ReadOnly)) {
2326
                TQTextStream t( &qfile );
2389
                TQTextStream t( &qfile );
Lines 2331-2336 Link Here
2331
2394
2332
void listKeys::doPrint(TQString txt)
2395
void listKeys::doPrint(TQString txt)
2333
{
2396
{
2397
// 	kdDebug(2100) << k_funcinfo << endl;
2334
        KPrinter prt;
2398
        KPrinter prt;
2335
        //kdDebug(2100)<<"Printing..."<<endl;
2399
        //kdDebug(2100)<<"Printing..."<<endl;
2336
        if (prt.setup(this)) {
2400
        if (prt.setup(this)) {
Lines 2355-2369 Link Here
2355
        TDEConfig *config = TDEGlobal::config();
2419
        TDEConfig *config = TDEGlobal::config();
2356
        config->setGroup("General");
2420
        config->setGroup("General");
2357
        *conprocess<< config->readPathEntry("TerminalApplication","konsole");
2421
        *conprocess<< config->readPathEntry("TerminalApplication","konsole");
2358
        *conprocess<<"-e"<<"gpg"
2422
	*conprocess<<"-e"<<"gpg" <<"--no-secmem-warning" <<"--delete-secret-key"<<keysList2->currentItem()->text(6);
2359
        <<"--no-secmem-warning"
2360
        <<"--delete-secret-key"<<keysList2->currentItem()->text(6);
2361
        TQObject::connect(conprocess, TQT_SIGNAL(processExited(TDEProcess *)),TQT_TQOBJECT(this), TQT_SLOT(reloadSecretKeys()));
2423
        TQObject::connect(conprocess, TQT_SIGNAL(processExited(TDEProcess *)),TQT_TQOBJECT(this), TQT_SLOT(reloadSecretKeys()));
2362
        conprocess->start(TDEProcess::NotifyOnExit,TDEProcess::AllOutput);
2424
        conprocess->start(TDEProcess::NotifyOnExit,TDEProcess::AllOutput);
2363
}
2425
}
2364
2426
2365
void listKeys::reloadSecretKeys()
2427
void listKeys::reloadSecretKeys()
2366
{
2428
{
2429
// 	kdDebug(2100) << k_funcinfo << endl;
2367
        FILE *fp;
2430
        FILE *fp;
2368
        char line[300];
2431
        char line[300];
2369
        keysList2->secretList=TQString();
2432
        keysList2->secretList=TQString();
Lines 2379-2384 Link Here
2379
2442
2380
void listKeys::confirmdeletekey()
2443
void listKeys::confirmdeletekey()
2381
{
2444
{
2445
// 	kdDebug(2100) << k_funcinfo << endl;
2382
        if (keysList2->currentItem()->depth()!=0) {
2446
        if (keysList2->currentItem()->depth()!=0) {
2383
                if ((keysList2->currentItem()->depth()==1) && (keysList2->currentItem()->text(4)=="-") && (keysList2->currentItem()->text(6).startsWith("0x")))
2447
                if ((keysList2->currentItem()->depth()==1) && (keysList2->currentItem()->text(4)=="-") && (keysList2->currentItem()->text(6).startsWith("0x")))
2384
                        delsignkey();
2448
                        delsignkey();
Lines 2422-2437 Link Here
2422
2486
2423
void listKeys::deletekey()
2487
void listKeys::deletekey()
2424
{
2488
{
2489
// 	kdDebug(2100) << k_funcinfo << endl;
2425
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
2490
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
2426
        if (exportList.count()==0)
2491
        if (exportList.count()==0)
2427
                return;
2492
                return;
2428
        TDEProcess gp;
2493
        TDEProcess gp;
2429
        gp << "gpg"
2494
	gp << "gpg" << "--no-tty" << "--no-secmem-warning" << "--batch" << "--yes" << "--delete-key";
2430
        << "--no-tty"
2431
        << "--no-secmem-warning"
2432
        << "--batch"
2433
        << "--yes"
2434
        << "--delete-key";
2435
        for ( uint i = 0; i < exportList.count(); ++i )
2495
        for ( uint i = 0; i < exportList.count(); ++i )
2436
                if ( exportList.at(i) )
2496
                if ( exportList.at(i) )
2437
                        gp<<(exportList.at(i)->text(6)).stripWhiteSpace();
2497
                        gp<<(exportList.at(i)->text(6)).stripWhiteSpace();
Lines 2467-2472 Link Here
2467
2527
2468
void listKeys::slotPreImportKey()
2528
void listKeys::slotPreImportKey()
2469
{
2529
{
2530
// 	kdDebug(2100) << k_funcinfo << endl;
2470
        KDialogBase *dial=new KDialogBase( KDialogBase::Swallow, i18n("Key Import"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, this, "key_import",true);
2531
        KDialogBase *dial=new KDialogBase( KDialogBase::Swallow, i18n("Key Import"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, this, "key_import",true);
2471
2532
2472
        SrcSelect *page=new SrcSelect();
2533
        SrcSelect *page=new SrcSelect();
Lines 2504-2510 Link Here
2504
2565
2505
void KeyView::expandGroup(TQListViewItem *item)
2566
void KeyView::expandGroup(TQListViewItem *item)
2506
{
2567
{
2507
2568
// 	kdDebug(2100) << k_funcinfo << endl;
2508
        TQStringList keysGroup=KgpgInterface::getGpgGroupSetting(item->text(0),KGpgSettings::gpgConfigPath());
2569
        TQStringList keysGroup=KgpgInterface::getGpgGroupSetting(item->text(0),KGpgSettings::gpgConfigPath());
2509
        kdDebug(2100)<<keysGroup<<endl;
2570
        kdDebug(2100)<<keysGroup<<endl;
2510
        for ( TQStringList::Iterator it = keysGroup.begin(); it != keysGroup.end(); ++it ) {
2571
        for ( TQStringList::Iterator it = keysGroup.begin(); it != keysGroup.end(); ++it ) {
Lines 2516-2521 Link Here
2516
2577
2517
TQPixmap KeyView::slotGetPhoto(TQString photoId,bool mini)
2578
TQPixmap KeyView::slotGetPhoto(TQString photoId,bool mini)
2518
{
2579
{
2580
// 	kdDebug(2100) << k_funcinfo << endl;
2519
        KTempFile *phototmp=new KTempFile();
2581
        KTempFile *phototmp=new KTempFile();
2520
        TQString popt="cp %i "+phototmp->name();
2582
        TQString popt="cp %i "+phototmp->name();
2521
        KProcIO *p=new KProcIO(TQTextCodec::codecForLocale());
2583
        KProcIO *p=new KProcIO(TQTextCodec::codecForLocale());
Lines 2538-2567 Link Here
2538
2600
2539
void KeyView::expandKey(TQListViewItem *item)
2601
void KeyView::expandKey(TQListViewItem *item)
2540
{
2602
{
2541
2603
// 	kdDebug(2100) << k_funcinfo << endl;
2542
        if (item->childCount()!=0)
2604
        if (item->childCount()!=0)
2543
                return;   // key has already been expanded
2605
                return;   // key has already been expanded
2544
        FILE *fp;
2606
        FILE *fp;
2545
        TQString cycle;
2607
        //TQString cycle;
2546
        TQStringList tst;
2608
        //TQStringList tst;
2547
        char tmpline[300];
2609
        char line[300];
2610
	TQString currentKey;
2611
	TQMap<TQString,TQStringList> hashMap;
2612
2613
        kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl;
2614
2615
2616
        fp = popen(TQFile::encodeName(TQString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs "+item->text(6))), "r");
2617
2618
        while ( fgets( line, sizeof(line), fp)) {
2619
                TQString tst=TQString::fromUtf8(line);
2620
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2621
                if ( tst.startsWith("pub")  ) {
2622
                	currentKey = tst.section(':',4,4);
2623
                	TQStringList lst; lst << tst;
2624
			hashMap.insert(currentKey,lst);
2625
                }
2626
		else
2627
			hashMap.find(currentKey).data().append(tst);
2628
2629
	}
2630
	pclose(fp);
2631
2632
	TQMap<TQString,TQStringList>::Iterator ite;
2633
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2634
		TQStringList::Iterator it;
2635
		bool dropFirstUid=true;
2636
//		gpgKey pubKey;
2637
		TQString cycle="pub";
2638
		bool noID=false;
2639
2548
        UpdateViewItem *itemsub=NULL;
2640
        UpdateViewItem *itemsub=NULL;
2549
        UpdateViewItem *itemuid=NULL;
2641
        UpdateViewItem *itemuid=NULL;
2550
        UpdateViewItem *itemsig=NULL;
2642
        UpdateViewItem *itemsig=NULL;
2551
        UpdateViewItem *itemrev=NULL;
2643
        UpdateViewItem *itemrev=NULL;
2552
        TQPixmap keyPhotoId;
2644
        TQPixmap keyPhotoId;
2553
        int uidNumber=2;
2645
        int uidNumber=2;
2554
        bool dropFirstUid=false;
2646
// 		bool dropFirstUid=false;
2555
2556
        kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl;
2557
2647
2558
        cycle="pub";
2648
		for (it = ite.data().begin(); it != ite.data().end(); it++) {	
2559
        bool noID=false;
2649
			TQString line = (*it);
2560
        fp = popen(TQFile::encodeName(TQString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs "+item->text(6))), "r");
2650
			TQStringList tst=TQStringList::split(":",line,true);
2561
2651
//		kdDebug(2100)<<"Loop: "<< tst[0] << " : " << tst[9] <<endl;
2562
        while ( fgets( tmpline, sizeof(tmpline), fp)) {
2563
                TQString line = TQString::fromUtf8( tmpline );
2564
                tst=TQStringList::split(":",line,true);
2565
                if ((tst[0]=="pub") && (tst[9].isEmpty())) /// Primary User Id is separated from public key
2652
                if ((tst[0]=="pub") && (tst[9].isEmpty())) /// Primary User Id is separated from public key
2566
                        uidNumber=1;
2653
                        uidNumber=1;
2567
                if (tst[0]=="uid" || tst[0]=="uat") {
2654
                if (tst[0]=="uid" || tst[0]=="uat") {
Lines 2607-2613 Link Here
2607
                                }
2694
                                }
2608
                        }
2695
                        }
2609
                        uidNumber++;
2696
                        uidNumber++;
2610
                } else
2697
			} else {
2611
                        if (tst[0]=="rev") {
2698
                        if (tst[0]=="rev") {
2612
                                gpgKey revKey=extractKey(line);
2699
                                gpgKey revKey=extractKey(line);
2613
                                if (cycle=="uid" || cycle=="uat")
2700
                                if (cycle=="uid" || cycle=="uat")
Lines 2618-2634 Link Here
2618
                                } else if (cycle=="sub")
2705
                                } else if (cycle=="sub")
2619
                                        itemrev= new UpdateViewItem(itemsub,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid);
2706
                                        itemrev= new UpdateViewItem(itemsub,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid);
2620
                                itemrev->setPixmap(0,pixRevoke);
2707
                                itemrev->setPixmap(0,pixRevoke);
2621
                        } else
2708
				} else {
2622
2623
2624
                                if (tst[0]=="sig") {
2709
                                if (tst[0]=="sig") {
2625
                                        gpgKey sigKey=extractKey(line);
2710
                                        gpgKey sigKey=extractKey(line);
2626
2711
2627
                                        if (tst[10].endsWith("l"))
2712
                                        if (tst[10].endsWith("l"))
2628
                                                sigKey.gpgkeymail+=i18n(" [local]");
2713
                                                sigKey.gpgkeymail+=i18n(" [local]");
2629
2714
2630
                                        if (cycle=="pub")
2715
						if (cycle=="pub") {
2631
                                                itemsig= new UpdateViewItem(item,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2716
                                                itemsig= new UpdateViewItem(item,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2717
						}
2632
                                        if (cycle=="sub")
2718
                                        if (cycle=="sub")
2633
                                                itemsig= new UpdateViewItem(itemsub,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2719
                                                itemsig= new UpdateViewItem(itemsub,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2634
                                        if (cycle=="uid")
2720
                                        if (cycle=="uid")
Lines 2642-2673 Link Here
2642
                                                itemsub->setPixmap(0,pixkeySingle);
2728
                                                itemsub->setPixmap(0,pixkeySingle);
2643
                                                itemsub->setPixmap(2,subKey.trustpic);
2729
                                                itemsub->setPixmap(2,subKey.trustpic);
2644
                                                cycle="sub";
2730
                                                cycle="sub";
2645
2646
                                        }
2731
                                        }
2647
        }
2732
        }
2648
        pclose(fp);
2733
			}
2734
        	}
2735
	}
2649
}
2736
}
2650
2737
2651
2738
2652
void listKeys::refreshkey()
2739
void listKeys::refreshkey()
2653
{
2740
{
2741
	kdDebug(2100) << k_funcinfo << endl;
2654
        keysList2->refreshkeylist();
2742
        keysList2->refreshkeylist();
2655
	listViewSearch->updateSearch(listViewSearch->text());
2743
	listViewSearch->updateSearch(listViewSearch->text());
2656
}
2744
}
2657
2745
2658
void KeyView::refreshkeylist()
2746
void KeyView::refreshkeylist()
2659
{
2747
{
2748
// 	kdDebug(2100) << k_funcinfo << endl;
2660
        emit statusMessage(i18n("Loading Keys..."),0,true);
2749
        emit statusMessage(i18n("Loading Keys..."),0,true);
2661
        kapp->processEvents();
2750
        kapp->processEvents();
2662
        ////////   update display of keys in main management window
2751
        ////////   update display of keys in main management window
2663
        kdDebug(2100)<<"Refreshing key list"<<endl;
2752
        kdDebug(2100)<<"Refreshing key list"<<endl;
2664
        TQString tst;
2753
2665
        char line[300];
2754
        char line[300];
2666
        UpdateViewItem *item=NULL;
2755
        UpdateViewItem *item=NULL;
2667
        bool noID=false;
2668
        bool emptyList=true;
2669
        TQString openKeys;
2756
        TQString openKeys;
2670
2757
2758
        bool emptyList=true;
2759
2760
	TQMap<TQString,TQStringList> hashMap;
2761
2671
        // get current position.
2762
        // get current position.
2672
        TQListViewItem *current = currentItem();
2763
        TQListViewItem *current = currentItem();
2673
        if(current != NULL) {
2764
        if(current != NULL) {
Lines 2693-2713 Link Here
2693
        pclose(fp2);
2784
        pclose(fp2);
2694
2785
2695
        TQString defaultKey = KGpgSettings::defaultKey();
2786
        TQString defaultKey = KGpgSettings::defaultKey();
2787
	TQString currentKey;
2788
2696
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r");
2789
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r");
2697
        while ( fgets( line, sizeof(line), fp)) {
2790
        while ( fgets( line, sizeof(line), fp)) {
2698
                tst=TQString::fromUtf8(line);
2791
                TQString tst=TQString::fromUtf8(line);
2699
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2792
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2700
                if (tst.startsWith("pub")) {
2793
                if ( tst.startsWith("pub")  ) {
2701
                        emptyList=false;
2794
                	currentKey = tst.section(':',4,4);
2702
                        noID=false;
2795
                	TQStringList lst; lst << tst;
2703
                        gpgKey pubKey=extractKey(tst);
2796
			hashMap.insert(currentKey,lst);
2797
                }
2798
		else
2799
			hashMap.find(currentKey).data().append(tst);
2800
2801
	}
2802
	pclose(fp);
2704
2803
2804
// process the list
2805
2806
	TQMap<TQString,TQStringList>::Iterator ite;
2807
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2808
		TQStringList::Iterator it;
2809
		gpgKey pubKey;
2810
		bool noID=false;
2705
                        bool isbold=false;
2811
                        bool isbold=false;
2706
                        bool isexpired=false;
2812
                        bool isexpired=false;
2813
2814
		for (it = ite.data().begin(); it != ite.data().end(); it++) {	
2815
			TQString tst =  (*it);
2816
			if ( tst.startsWith("pub") ){
2817
				emptyList=false;
2818
				//noID=false;
2819
				pubKey=extractKey(tst);
2707
                        if (pubKey.gpgkeyid==defaultKey)
2820
                        if (pubKey.gpgkeyid==defaultKey)
2708
                                isbold=true;
2821
                                isbold=true;
2709
                        if (pubKey.gpgkeytrust==i18n("Expired"))
2822
                        if (pubKey.gpgkeytrust==i18n("Expired"))
2710
                                isexpired=true;
2823
                                isexpired=true;
2824
			}
2825
			if ( tst.startsWith("uid") && pubKey.gpgkeyname.isEmpty() ){
2826
				gpgKey tmpKey=extractKey(tst);
2827
				if (! tmpKey.gpgkeyname.isEmpty() ) pubKey.gpgkeyname = tmpKey.gpgkeyname;
2828
				if (! tmpKey.gpgkeymail.isEmpty() ) pubKey.gpgkeymail = tmpKey.gpgkeymail;
2829
			}
2830
		}
2711
                        if (pubKey.gpgkeyname.isEmpty())
2831
                        if (pubKey.gpgkeyname.isEmpty())
2712
                                noID=true;
2832
                                noID=true;
2713
2833
Lines 2729-2736 Link Here
2729
                                item->setOpen(true);
2849
                                item->setOpen(true);
2730
                }
2850
                }
2731
2851
2732
        }
2852
2733
        pclose(fp);
2734
        if (!issec.isEmpty())
2853
        if (!issec.isEmpty())
2735
                insertOrphanedKeys(issec);
2854
                insertOrphanedKeys(issec);
2736
        if (emptyList) {
2855
        if (emptyList) {
Lines 2775-2792 Link Here
2775
2894
2776
void KeyView::insertOrphan(TQString currentID)
2895
void KeyView::insertOrphan(TQString currentID)
2777
{
2896
{
2897
// 	kdDebug(2100) << k_funcinfo << endl;
2778
        FILE *fp;
2898
        FILE *fp;
2779
        char line[300];
2899
        char line[300];
2780
        UpdateViewItem *item=NULL;
2900
        UpdateViewItem *item=NULL;
2781
        bool keyFound=false;
2901
        bool keyFound=false;
2902
	TQString currentKey;
2903
	TQMap<TQString,TQStringList> hashMap;
2904
2782
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2905
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2783
        while ( fgets( line, sizeof(line), fp)) {
2906
        while ( fgets( line, sizeof(line), fp)) {
2784
                TQString lineRead=TQString::fromUtf8(line);
2907
		TQString tst=TQString::fromUtf8(line);
2785
                if ((lineRead.startsWith("sec")) && (lineRead.section(':',4,4).right(8))==currentID.right(8)) {
2908
		kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2786
                        gpgKey orphanedKey=extractKey(lineRead);
2909
		if ( tst.startsWith("sec")  ) {
2787
                        keyFound=true;
2910
			currentKey = tst.section(':',4,4);
2911
			TQStringList lst; lst << tst;
2912
			hashMap.insert(currentKey,lst);
2913
		}
2914
		else
2915
			hashMap.find(currentKey).data().append(tst);
2916
2917
	}
2918
	pclose(fp);
2919
// process the list
2920
2921
	TQMap<TQString,TQStringList>::Iterator ite;
2922
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2923
		TQStringList::Iterator it;
2924
		gpgKey orphanedKey;
2925
		keyFound=false;
2788
                        bool isbold=false;
2926
                        bool isbold=false;
2789
                        bool isexpired=false;
2927
                        bool isexpired=false;
2928
2929
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
2930
			TQString tmp = (*it);
2931
			if ((tmp.startsWith("sec")) && (tmp.section(':',4,4).right(8))==currentID.right(8)) {
2932
				orphanedKey=extractKey(tmp);
2933
				keyFound=true;
2790
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2934
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2791
                        //               isbold=true;
2935
                        //               isbold=true;
2792
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
2936
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
Lines 2794-2804 Link Here
2794
                        //          if (orphanedKey.gpgkeyname.isEmpty())
2938
                        //          if (orphanedKey.gpgkeyname.isEmpty())
2795
                        //              noID=true;
2939
                        //              noID=true;
2796
2940
2941
			}
2942
			if ( tmp.startsWith("uid") && orphanedKey.gpgkeyname.isEmpty() ){
2943
				gpgKey tmpKey=extractKey(tmp);
2944
				if (! tmpKey.gpgkeyname.isEmpty() ) orphanedKey.gpgkeyname = tmpKey.gpgkeyname;
2945
				if (! tmpKey.gpgkeymail.isEmpty() ) orphanedKey.gpgkeymail = tmpKey.gpgkeymail;
2946
			}
2947
		}
2797
                        item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired);
2948
                        item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired);
2798
                        item->setPixmap(0,pixkeyOrphan);
2949
                        item->setPixmap(0,pixkeyOrphan);
2950
2799
                }
2951
                }
2800
        }
2952
2801
        pclose(fp);
2802
        if (!keyFound) {
2953
        if (!keyFound) {
2803
                orphanList.remove(currentID);
2954
                orphanList.remove(currentID);
2804
                setSelected(currentItem(),true);
2955
                setSelected(currentItem(),true);
Lines 2811-2826 Link Here
2811
2962
2812
void KeyView::insertOrphanedKeys(TQStringList orphans)
2963
void KeyView::insertOrphanedKeys(TQStringList orphans)
2813
{
2964
{
2965
// 	kdDebug(2100) << k_funcinfo << endl;
2814
        FILE *fp;
2966
        FILE *fp;
2815
        char line[300];
2967
        char line[300];
2968
	TQString currentKey;
2969
	TQMap<TQString,TQStringList> hashMap;
2970
2816
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2971
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2817
        while ( fgets( line, sizeof(line), fp)) {
2972
        while ( fgets( line, sizeof(line), fp)) {
2818
                TQString lineRead=TQString::fromUtf8(line);
2973
                TQString tst=TQString::fromUtf8(line);
2819
                if ((lineRead.startsWith("sec")) && (orphans.find(lineRead.section(':',4,4).right(8))!=orphans.end())) {
2974
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2820
                        gpgKey orphanedKey=extractKey(lineRead);
2975
                if ( tst.startsWith("sec")  ) {
2976
                	currentKey = tst.section(':',4,4);
2977
                	TQStringList lst; lst << tst;
2978
			hashMap.insert(currentKey,lst);
2979
                }
2980
		else
2981
			hashMap.find(currentKey).data().append(tst);
2982
2983
	}
2984
        pclose(fp);
2985
// process the list
2821
2986
2987
	TQMap<TQString,TQStringList>::Iterator ite;
2988
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2989
		TQStringList::Iterator it;
2990
		gpgKey orphanedKey;
2822
                        bool isbold=false;
2991
                        bool isbold=false;
2823
                        bool isexpired=false;
2992
                        bool isexpired=false;
2993
2994
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
2995
			TQString tmp = (*it);
2996
			if ((tmp.startsWith("sec")) && (orphans.find(tmp.section(':',4,4).right(8))!=orphans.end())) {
2997
				orphanedKey=extractKey(tmp);
2824
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2998
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2825
                        //               isbold=true;
2999
                        //               isbold=true;
2826
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
3000
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
Lines 2828-2842 Link Here
2828
                        //          if (orphanedKey.gpgkeyname.isEmpty())
3002
                        //          if (orphanedKey.gpgkeyname.isEmpty())
2829
                        //              noID=true;
3003
                        //              noID=true;
2830
                        orphanList+=orphanedKey.gpgkeyid+",";
3004
                        orphanList+=orphanedKey.gpgkeyid+",";
3005
			}
3006
			if ( tmp.startsWith("uid") && orphanedKey.gpgkeyname.isEmpty() ){
3007
				gpgKey tmpKey=extractKey(tmp);
3008
				if (! tmpKey.gpgkeyname.isEmpty() ) orphanedKey.gpgkeyname = tmpKey.gpgkeyname;
3009
				if (! tmpKey.gpgkeymail.isEmpty() ) orphanedKey.gpgkeymail = tmpKey.gpgkeymail;
3010
			}
3011
		}
2831
                        UpdateViewItem *item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired);
3012
                        UpdateViewItem *item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired);
2832
                        item->setPixmap(0,pixkeyOrphan);
3013
                        item->setPixmap(0,pixkeyOrphan);
2833
                }
3014
                }
2834
        }
2835
        pclose(fp);
2836
}
3015
}
2837
3016
2838
void KeyView::refreshgroups()
3017
void KeyView::refreshgroups()
2839
{
3018
{
3019
// 	kdDebug(2100) << k_funcinfo << endl;
2840
        TQListViewItem *item=firstChild();
3020
        TQListViewItem *item=firstChild();
2841
        while (item) {
3021
        while (item) {
2842
                if (item->text(6).isEmpty()) {
3022
                if (item->text(6).isEmpty()) {
Lines 2861-2866 Link Here
2861
3041
2862
void KeyView::refreshselfkey()
3042
void KeyView::refreshselfkey()
2863
{
3043
{
3044
// 	kdDebug(2100) << k_funcinfo << endl;
2864
        kdDebug(2100)<<"Refreshing key"<<endl;
3045
        kdDebug(2100)<<"Refreshing key"<<endl;
2865
        if (currentItem()->depth()==0)
3046
        if (currentItem()->depth()==0)
2866
                refreshcurrentkey(currentItem());
3047
                refreshcurrentkey(currentItem());
Lines 2870-2875 Link Here
2870
3051
2871
void KeyView::slotReloadKeys(TQStringList keyIDs)
3052
void KeyView::slotReloadKeys(TQStringList keyIDs)
2872
{
3053
{
3054
// 	kdDebug(2100) << k_funcinfo << endl;
2873
        if (keyIDs.isEmpty())
3055
        if (keyIDs.isEmpty())
2874
                return;
3056
                return;
2875
	if (keyIDs.first()=="ALL")
3057
	if (keyIDs.first()=="ALL")
Lines 2888-2893 Link Here
2888
3070
2889
void KeyView::slotReloadOrphaned()
3071
void KeyView::slotReloadOrphaned()
2890
{
3072
{
3073
// 	kdDebug(2100) << k_funcinfo << endl;
2891
        TQStringList issec;
3074
        TQStringList issec;
2892
        FILE *fp,*fp2;
3075
        FILE *fp,*fp2;
2893
        char line[300];
3076
        char line[300];
Lines 2923-2933 Link Here
2923
3106
2924
void KeyView::refreshcurrentkey(TQString currentID)
3107
void KeyView::refreshcurrentkey(TQString currentID)
2925
{
3108
{
3109
// 	kdDebug(2100) << k_funcinfo << endl;
2926
	if (currentID.isNull()) return;
3110
	if (currentID.isNull()) return;
2927
        UpdateViewItem *item=NULL;
2928
        TQString issec=TQString();
2929
        FILE *fp,*fp2;
3111
        FILE *fp,*fp2;
2930
        char line[300];
3112
        char line[300];
3113
	TQString issec=TQString();
3114
3115
        TQString defaultKey = KGpgSettings::defaultKey();
3116
        TQString currentKey;
3117
	TQMap<TQString,TQStringList> hashMap;
2931
3118
2932
        fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
3119
        fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2933
        while ( fgets( line, sizeof(line), fp2)) {
3120
        while ( fgets( line, sizeof(line), fp2)) {
Lines 2937-2959 Link Here
2937
        }
3124
        }
2938
        pclose(fp2);
3125
        pclose(fp2);
2939
3126
2940
        TQString defaultKey = KGpgSettings::defaultKey();
3127
	kdDebug(2100) << "currentID: " << currentID <<endl;
2941
2942
        TQString tst;
2943
        bool keyFound=false;
2944
        TQString cmd="gpg --no-secmem-warning --no-tty --with-colons --list-keys "+currentID;
3128
        TQString cmd="gpg --no-secmem-warning --no-tty --with-colons --list-keys "+currentID;
2945
        fp = popen(TQFile::encodeName(cmd), "r");
3129
        fp = popen(TQFile::encodeName(cmd), "r");
2946
        while ( fgets( line, sizeof(line), fp)) {
3130
        while ( fgets( line, sizeof(line), fp)) {
2947
                tst=TQString::fromUtf8(line);
3131
                TQString tst=TQString::fromUtf8(line);
2948
                if (tst.startsWith("pub")) {
3132
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2949
                        gpgKey pubKey=extractKey(tst);
3133
                if ( tst.startsWith("pub")  ) {
2950
                        keyFound=true;
3134
                	currentKey = tst.section(':',4,4);
3135
                	TQStringList lst; lst << tst;
3136
			hashMap.insert(currentKey,lst);
3137
                }
3138
		else
3139
			hashMap.find(currentKey).data().append(tst);
3140
3141
	}
3142
	pclose(fp);
3143
3144
// process the list
3145
3146
	TQMap<TQString,TQStringList>::Iterator ite;
3147
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
3148
		UpdateViewItem *item=NULL;
3149
		TQStringList::Iterator it;
3150
		gpgKey pubKey;
3151
		bool keyFound=false;
2951
                        bool isbold=false;
3152
                        bool isbold=false;
2952
                        bool isexpired=false;
3153
                        bool isexpired=false;
3154
3155
		for (it = ite.data().begin(); it != ite.data().end(); it++) {	
3156
			TQString tst =  (*it);
3157
			if ( tst.startsWith("pub") ){
3158
                        	keyFound=true;
3159
				pubKey=extractKey(tst);
2953
                        if (pubKey.gpgkeyid==defaultKey)
3160
                        if (pubKey.gpgkeyid==defaultKey)
2954
                                isbold=true;
3161
                                isbold=true;
2955
                        if (pubKey.gpgkeytrust==i18n("Expired"))
3162
                        if (pubKey.gpgkeytrust==i18n("Expired"))
2956
                                isexpired=true;
3163
                                isexpired=true;
3164
			}
3165
			if ( tst.startsWith("uid") && pubKey.gpgkeyname.isEmpty() ){
3166
				gpgKey tmpKey=extractKey(tst);
3167
				if (! tmpKey.gpgkeyname.isEmpty() ) pubKey.gpgkeyname = tmpKey.gpgkeyname;
3168
				if (! tmpKey.gpgkeymail.isEmpty() ) pubKey.gpgkeymail = tmpKey.gpgkeymail;
3169
			}
3170
		}
3171
2957
                        item=new UpdateViewItem(this,pubKey.gpgkeyname,pubKey.gpgkeymail,TQString(),pubKey.gpgkeyexpiration,pubKey.gpgkeysize,pubKey.gpgkeycreation,pubKey.gpgkeyid,isbold,isexpired);
3172
                        item=new UpdateViewItem(this,pubKey.gpgkeyname,pubKey.gpgkeymail,TQString(),pubKey.gpgkeyexpiration,pubKey.gpgkeysize,pubKey.gpgkeycreation,pubKey.gpgkeyid,isbold,isexpired);
2958
                        item->setPixmap(2,pubKey.trustpic);
3173
                        item->setPixmap(2,pubKey.trustpic);
2959
			item->setVisible(true);
3174
			item->setVisible(true);
Lines 2964-2972 Link Here
2964
                        } else {
3179
                        } else {
2965
                                item->setPixmap(0,pixkeySingle);
3180
                                item->setPixmap(0,pixkeySingle);
2966
                        }
3181
                        }
2967
                }
2968
        }
2969
        pclose(fp);
2970
3182
2971
        if (!keyFound) {
3183
        if (!keyFound) {
2972
                if (orphanList.find(currentID)==-1)
3184
                if (orphanList.find(currentID)==-1)
Lines 2979-2989 Link Here
2979
3191
2980
        clearSelection();
3192
        clearSelection();
2981
        setCurrentItem(item);
3193
        setCurrentItem(item);
3194
	}
2982
3195
2983
}
3196
}
2984
3197
2985
void KeyView::refreshcurrentkey(TQListViewItem *current)
3198
void KeyView::refreshcurrentkey(TQListViewItem *current)
2986
{
3199
{
3200
//	kdDebug(2100) << k_funcinfo << endl;
2987
        if (!current)
3201
        if (!current)
2988
                return;
3202
                return;
2989
        bool keyIsOpen=false;
3203
        bool keyIsOpen=false;
Lines 3002-3034 Link Here
3002
3216
3003
void KeyView::refreshTrust(int color,TQColor newColor)
3217
void KeyView::refreshTrust(int color,TQColor newColor)
3004
{
3218
{
3005
if (!newColor.isValid()) return;
3219
//	kdDebug(2100) << k_funcinfo << endl;
3006
TQPixmap blankFrame,newtrust;
3220
	if (!newColor.isValid()) return;
3007
int trustFinger=0;
3221
	TQPixmap blankFrame,newtrust;
3008
blankFrame.load(locate("appdata", "pics/kgpg_blank.png"));
3222
	int trustFinger=0;
3009
newtrust.load(locate("appdata", "pics/kgpg_fill.png"));
3223
	blankFrame.load(locate("appdata", "pics/kgpg_blank.png"));
3010
newtrust.fill(newColor);
3224
	newtrust.load(locate("appdata", "pics/kgpg_fill.png"));
3011
bitBlt(&newtrust,0,0,&blankFrame,0,0,50,15);
3225
	newtrust.fill(newColor);
3012
switch (color)
3226
	bitBlt(&newtrust,0,0,&blankFrame,0,0,50,15);
3013
{
3227
	switch (color)
3014
case GoodColor:
3228
	{
3015
trustFinger=trustgood.serialNumber();
3229
		case GoodColor:
3016
trustgood=newtrust;
3230
			trustFinger=trustgood.serialNumber();
3017
break;
3231
			trustgood=newtrust;
3018
case BadColor:
3232
			break;
3019
trustFinger=trustbad.serialNumber();
3233
		case BadColor:
3020
trustbad=newtrust;
3234
			trustFinger=trustbad.serialNumber();
3021
break;
3235
			trustbad=newtrust;
3022
case UnknownColor:
3236
			break;
3023
trustFinger=trustunknown.serialNumber();
3237
		case UnknownColor:
3024
trustunknown=newtrust;
3238
			trustFinger=trustunknown.serialNumber();
3025
break;
3239
			trustunknown=newtrust;
3026
case RevColor:
3240
			break;
3027
trustFinger=trustrevoked.serialNumber();
3241
		case RevColor:
3028
trustrevoked=newtrust;
3242
			trustFinger=trustrevoked.serialNumber();
3029
break;
3243
			trustrevoked=newtrust;
3030
}
3244
			break;
3031
TQListViewItem *item=firstChild();
3245
	}
3246
	TQListViewItem *item=firstChild();
3032
                while (item) {
3247
                while (item) {
3033
			if (item->pixmap(2))
3248
			if (item->pixmap(2))
3034
			{
3249
			{
Lines 3040-3052 Link Here
3040
3255
3041
gpgKey KeyView::extractKey(TQString keyColon)
3256
gpgKey KeyView::extractKey(TQString keyColon)
3042
{
3257
{
3258
//	kdDebug(2100) << k_funcinfo << "keyColon: " << keyColon<<endl;
3043
        TQStringList keyString=TQStringList::split(":",keyColon,true);
3259
        TQStringList keyString=TQStringList::split(":",keyColon,true);
3044
        gpgKey ret;
3045
3260
3261
	gpgKey ret;
3046
        ret.gpgkeysize=keyString[2];
3262
        ret.gpgkeysize=keyString[2];
3047
        ret.gpgkeycreation=keyString[5];
3263
        ret.gpgkeycreation=keyString[5];
3048
        if(!ret.gpgkeycreation.isEmpty()) {
3264
        if(!ret.gpgkeycreation.isEmpty()) {
3049
                TQDate date = TQDate::fromString(ret.gpgkeycreation, Qt::ISODate);
3265
		TQDate date;
3266
		if (KgpgInterface::getGpgVersion() >= 210 ) {
3267
			TQDateTime timestamp;
3268
			timestamp.setTime_t( ret.gpgkeycreation.toInt());
3269
			date = timestamp.date();
3270
		}
3271
		else {
3272
			date = TQDate::fromString(ret.gpgkeycreation, Qt::ISODate);
3273
		}
3274
		Q_ASSERT (date.isValid()) /*tqWarning("create date is not valid")*/;
3050
                ret.gpgkeycreation=TDEGlobal::locale()->formatDate(date, true);
3275
                ret.gpgkeycreation=TDEGlobal::locale()->formatDate(date, true);
3051
        }
3276
        }
3052
        TQString tid=keyString[4];
3277
        TQString tid=keyString[4];
Lines 3055-3064 Link Here
3055
        if (ret.gpgkeyexpiration.isEmpty())
3280
        if (ret.gpgkeyexpiration.isEmpty())
3056
                ret.gpgkeyexpiration=i18n("Unlimited");
3281
                ret.gpgkeyexpiration=i18n("Unlimited");
3057
        else {
3282
        else {
3058
                TQDate date = TQDate::fromString(ret.gpgkeyexpiration, Qt::ISODate);
3283
		TQDate date;
3284
		if (KgpgInterface::getGpgVersion() >= 210 ) {
3285
			TQDateTime timestamp;
3286
			timestamp.setTime_t(ret.gpgkeyexpiration.toInt());
3287
			date = timestamp.date();
3288
		}
3289
		else {
3290
			date = TQDate::fromString(ret.gpgkeyexpiration, Qt::ISODate);
3291
		}
3292
		Q_ASSERT (date.isValid()) /*tqWarning("expire date is not valid")*/;
3059
                ret.gpgkeyexpiration=TDEGlobal::locale()->formatDate(date, true);
3293
                ret.gpgkeyexpiration=TDEGlobal::locale()->formatDate(date, true);
3060
        }
3294
        }
3295
3296
	// search for Fullname
3297
	if ( ! keyString[9].isEmpty() ) {
3298
		
3061
        TQString fullname=keyString[9];
3299
        TQString fullname=keyString[9];
3300
3062
        if (fullname.find("<")!=-1) {
3301
        if (fullname.find("<")!=-1) {
3063
                ret.gpgkeymail=fullname.section('<',-1,-1);
3302
                ret.gpgkeymail=fullname.section('<',-1,-1);
3064
                ret.gpgkeymail.truncate(ret.gpgkeymail.length()-1);
3303
                ret.gpgkeymail.truncate(ret.gpgkeymail.length()-1);
Lines 3069-3075 Link Here
3069
		ret.gpgkeyname=fullname;
3308
		ret.gpgkeyname=fullname;
3070
                //ret.gpgkeyname=fullname.section('(',0,0);
3309
                //ret.gpgkeyname=fullname.section('(',0,0);
3071
        }
3310
        }
3072
3311
	}
3073
        //ret.gpgkeyname=KgpgInterface::checkForUtf8(ret.gpgkeyname); // FIXME lukas
3312
        //ret.gpgkeyname=KgpgInterface::checkForUtf8(ret.gpgkeyname); // FIXME lukas
3074
3313
3075
        TQString algo=keyString[3];
3314
        TQString algo=keyString[3];
(-)tdeutils.orig/kgpg/main.cpp (-1 / +3 lines)
Lines 4-9 Link Here
4
    begin                : Mon Jul 8 2002
4
    begin                : Mon Jul 8 2002
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
5
    copyright          : (C) 2002 by Jean-Baptiste Mardelle
6
    email                : bj@altern.org
6
    email                : bj@altern.org
7
8
    updated main version : Sun Jul 30 10:18:29 CEST 2017
7
 ***************************************************************************/
9
 ***************************************************************************/
8
10
9
/***************************************************************************
11
/***************************************************************************
Lines 29-35 Link Here
29
static const char description[] =
31
static const char description[] =
30
        I18N_NOOP("Kgpg - simple gui for gpg\n\nKgpg was designed to make gpg very easy to use.\nI tried to make it as secure as possible.\nHope you enjoy it.");
32
        I18N_NOOP("Kgpg - simple gui for gpg\n\nKgpg was designed to make gpg very easy to use.\nI tried to make it as secure as possible.\nHope you enjoy it.");
31
33
32
static const char version[] = "1.2.2";
34
static const char version[] = "1.3.0";
33
35
34
static TDECmdLineOptions options[] =
36
static TDECmdLineOptions options[] =
35
        {
37
        {
(-)tdeutils.orig/kgpg/popuppublic.cpp (-15 / +48 lines)
Lines 4-9 Link Here
4
    begin                : Sat Jun 29 2002
4
    begin                : Sat Jun 29 2002
5
    copyright            : (C) 2002 by Jean-Baptiste Mardelle
5
    copyright            : (C) 2002 by Jean-Baptiste Mardelle
6
    email                : bj@altern.org
6
    email                : bj@altern.org
7
8
    updated to handle gpg21 : Sun Jul 30 10:18:29 CEST 2017
9
    copyright          : (C) 2017 by Emanoil Kotsev
10
    email              : deloptes@yahoo.com
7
 ***************************************************************************/
11
 ***************************************************************************/
8
12
9
/***************************************************************************
13
/***************************************************************************
Lines 366-384 Link Here
366
370
367
void popupPublic::slotprocread(KProcIO *p)
371
void popupPublic::slotprocread(KProcIO *p)
368
{
372
{
373
	kdDebug(2100) << k_funcinfo << endl;
369
        ///////////////////////////////////////////////////////////////// extract  encryption keys
374
        ///////////////////////////////////////////////////////////////// extract  encryption keys
370
        bool dead;
375
        TQString tst,currentKey;
371
        TQString tst,keyname,keymail;
376
	TQMap<TQString,TQStringList> hashMap;
372
377
373
        TQString defaultKey = KGpgSettings::defaultKey().right(8);
378
        TQString defaultKey = KGpgSettings::defaultKey().right(8);
374
379
375
        while (p->readln(tst)!=-1) {
380
        while (p->readln(tst)!=-1) {
376
                if (tst.startsWith("pub")) {
381
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
377
			TQStringList keyString=TQStringList::split(":",tst,true);
382
                if ( tst.startsWith("pub")  ) {
383
                	currentKey = tst.section(':',4,4);
384
                	TQStringList lst; lst << tst;
385
			hashMap.insert(currentKey,tst);
386
                }
387
		else
388
			hashMap.find(currentKey).data().append(tst);
389
390
	}
391
392
	TQMap<TQString,TQStringList>::Iterator ite;
393
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
394
		TQStringList::Iterator it;
395
		TQString fullname,keyname,keymail,val,id;
396
		bool dead;
397
398
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
399
			TQString line =  (*it);
400
401
			if (line.startsWith("pub")) {
402
				TQStringList keyString=TQStringList::split(":",line,true);
378
                        dead=false;
403
                        dead=false;
379
                        const TQString trust=keyString[1];
404
                        const TQString trust=keyString[1];
380
                        TQString val=keyString[6];
405
				val=keyString[6];
381
                        TQString id=TQString("0x"+keyString[4].right(8));
406
				id=TQString("0x"+keyString[4].right(8));
382
                        if (val.isEmpty())
407
                        if (val.isEmpty())
383
                                val=i18n("Unlimited");
408
                                val=i18n("Unlimited");
384
                        TQString tr;
409
                        TQString tr;
Lines 416-445 Link Here
416
                                break;
441
                                break;
417
                        }
442
                        }
418
			if (keyString[11].find('D')!=-1) dead=true;
443
			if (keyString[11].find('D')!=-1) dead=true;
419
                        tst=keyString[9];
444
				fullname=keyString[9];
420
			if (tst.find("<")!=-1) {
445
			}
421
                keymail=tst.section('<',-1,-1);
446
447
	
448
 			if ( line.startsWith("uid") && fullname.isEmpty() )
449
 				fullname = line.section(':',9,9);
450
451
		}
452
453
		if (fullname.find("<")!=-1) {
454
			keymail=fullname.section('<',-1,-1);
422
                keymail.truncate(keymail.length()-1);
455
                keymail.truncate(keymail.length()-1);
423
                keyname=tst.section('<',0,0);
456
			keyname=fullname.section('<',0,0);
424
                //if (keyname.find("(")!=-1)
457
                //if (keyname.find("(")!=-1)
425
                 //       keyname=keyname.section('(',0,0);
458
                 //       keyname=keyname.section('(',0,0);
426
        } else {
459
        } else {
427
                keymail=TQString();
460
                keymail=TQString();
428
                keyname=tst;//.section('(',0,0);
461
			keyname=fullname;//.section('(',0,0);
429
        }
462
        }
430
                        if ((!dead) && (!tst.isEmpty())) {
463
		if ((!dead) && (!fullname.isEmpty())) {
431
				bool isDefaultKey=false;
464
				bool isDefaultKey=false;
432
                                if (id.right(8)==defaultKey) isDefaultKey=true;
465
                                if (id.right(8)==defaultKey) isDefaultKey=true;
433
                                        UpdateViewItem2 *item=new UpdateViewItem2(keysList,keyname,keymail,id,isDefaultKey);
466
                                        UpdateViewItem2 *item=new UpdateViewItem2(keysList,keyname,keymail,id,isDefaultKey);
434
					//TDEListViewItem *sub= new TDEListViewItem(item,i18n("ID: %1, trust: %2, validity: %3").arg(id).arg(tr).arg(val));
467
					//TDEListViewItem *sub= new TDEListViewItem(item,i18n("ID: %1, trust: %2, validity: %3").arg(id).arg(tr).arg(val));
435
                                        //sub->setSelectable(false);
468
                                        //sub->setSelectable(false);
436
                                        if (seclist.find(tst,0,FALSE)!=-1)
469
			if (seclist.find(fullname,0,FALSE)!=-1)
437
                                                item->setPixmap(0,keyPair);
470
                                                item->setPixmap(0,keyPair);
438
                                        else
471
                                        else
439
                                                item->setPixmap(0,keySingle);
472
                                                item->setPixmap(0,keySingle);
440
                        }
473
                        }
441
                }
474
                }
442
        }
443
}
475
}
444
476
445
477
Lines 459-466 Link Here
459
        if (selectedKeys.isEmpty() && !CBsymmetric->isChecked())
491
        if (selectedKeys.isEmpty() && !CBsymmetric->isChecked())
460
                return;
492
                return;
461
	if (CBsymmetric->isChecked()) selectedKeys=NULL;
493
	if (CBsymmetric->isChecked()) selectedKeys=NULL;
462
kdDebug(2100)<<"Selected Key:"<<selectedKeys<<endl;
494
	kdDebug(2100)<<"Selected Key:"<<selectedKeys<<endl;
463
        TQStringList returnOptions;
495
        TQStringList returnOptions;
496
464
        if (CBuntrusted->isChecked())
497
        if (CBuntrusted->isChecked())
465
                returnOptions<<"--always-trust";
498
                returnOptions<<"--always-trust";
466
        if (CBarmor->isChecked())
499
        if (CBarmor->isChecked())

Return to bug 2791