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 (-68 / +133 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
	TQColor trustColor;
111
FILE *pass;
113
	TQString fingervalue=TQString();
112
char line[200]="";
114
	FILE *pass;
113
TQString gpgOutput,fullID;
115
	char line[200]="";
116
	TQString currentKey;
117
	TQMap<TQString,TQStringList> hashMap;
114
118
115
TQString gpgcmd="gpg --no-tty --no-secmem-warning --with-colon --with-fingerprint --list-key "+KShellProcess::quote(Keyid);
119
	TQString gpgcmd="gpg --no-tty --no-secmem-warning --with-colon --with-fingerprint --list-key "+KShellProcess::quote(Keyid);
116
120
117
        pass=popen(TQFile::encodeName(gpgcmd),"r");
121
        pass=popen(TQFile::encodeName(gpgcmd),"r");
118
        while ( fgets( line, sizeof(line), pass)) {
122
	while ( fgets( line, sizeof(line), pass) ) {
119
                gpgOutput=TQString::fromUtf8(line);
123
		TQString tst=TQString::fromUtf8(line);
124
                if ( tst.startsWith("pub")  ) {
125
                	currentKey = tst.section(':',4,4);
126
                	TQStringList lst; lst << tst;
127
			hashMap.insert(currentKey,lst);
128
                }
129
		else
130
			hashMap.find(currentKey).data().append(tst);
131
132
	}
133
	pclose(pass);
134
135
	TQMap<TQString,TQStringList>::Iterator ite;
136
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
137
		TQStringList::Iterator it;
138
		TQString fullname,gpgOutput;
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"))
360
{
361
kdt= new KDatePicker( page );
362
kb->setChecked(true);
363
kdt->setEnabled(false);
364
}
365
else
366
kdt= new KDatePicker(page,TDEGlobal::locale()->readDate(prop->tLExpiration->text()));
367
TQVBoxLayout *vbox=new TQVBoxLayout(page,3);
368
vbox->addWidget(kdt);
369
vbox->addWidget(kb);
370
connect(kb,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableDate(bool)));
371
connect(chdate,TQT_SIGNAL(okClicked()),this,TQT_SLOT(slotChangeDate()));
372
connect(kdt,TQT_SIGNAL(dateChanged(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
373
connect(kdt,TQT_SIGNAL(dateEntered(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
374
411
375
chdate->setMainWidget(page);
412
	if (prop->tLExpiration->text()==i18n("Unlimited"))
376
chdate->show();
413
	{
414
		kdt= new KDatePicker( page );
415
		kb->setChecked(true);
416
		kdt->setEnabled(false);
417
	}
418
	else
419
		kdt= new KDatePicker(page,TDEGlobal::locale()->readDate(prop->tLExpiration->text()));
420
	TQVBoxLayout *vbox=new TQVBoxLayout(page,3);
421
	vbox->addWidget(kdt);
422
	vbox->addWidget(kb);
423
	connect(kb,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotEnableDate(bool)));
424
	connect(chdate,TQT_SIGNAL(okClicked()),this,TQT_SLOT(slotChangeDate()));
425
	connect(kdt,TQT_SIGNAL(dateChanged(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
426
	connect(kdt,TQT_SIGNAL(dateEntered(TQDate)),this,TQT_SLOT(slotCheckDate(TQDate)));
427
	
428
	chdate->setMainWidget(page);
429
	chdate->show();
377
}
430
}
378
431
379
void KgpgKeyInfo::slotCheckDate(TQDate date)
432
void KgpgKeyInfo::slotCheckDate(TQDate date)
380
{
433
{
434
//	kdDebug(2100) << k_funcinfo << endl;
435
//kdDebug(2100) << "slotCheckDate" << date<<endl;
381
chdate->enableButtonOK(date>=TQDate::currentDate ());
436
chdate->enableButtonOK(date>=TQDate::currentDate ());
382
}
437
}
383
438
384
void KgpgKeyInfo::slotChangeDate()
439
void KgpgKeyInfo::slotChangeDate()
385
{
440
{
441
//	kdDebug(2100) << k_funcinfo << endl;
386
KgpgInterface *KeyExpirationProcess=new KgpgInterface();
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-435 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
Lines 442-447 Link Here
442
505
443
void KgpgKeyInfo::slotInfoExpirationChanged(int res)
506
void KgpgKeyInfo::slotInfoExpirationChanged(int res)
444
{
507
{
508
// 	kdDebug(2100) << k_funcinfo << endl;
445
TQString infoMessage,infoText;
509
TQString infoMessage,infoText;
446
if (res==3)
510
if (res==3)
447
{
511
{
Lines 458-463 Link Here
458
522
459
void KgpgKeyInfo::slotPreOk()
523
void KgpgKeyInfo::slotPreOk()
460
{
524
{
525
// 	kdDebug(2100) << k_funcinfo << endl;
461
if (keyWasChanged) emit keyNeedsRefresh();
526
if (keyWasChanged) emit keyNeedsRefresh();
462
accept();
527
accept();
463
}
528
}
(-)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 (-1 / +8 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 671-676 Link Here
671
                                pclose(fp2);
675
                                pclose(fp2);
672
                        }
676
                        }
673
                }
677
                }
678
                if ( tst.startsWith("uid") && KgpgInterface::getGpgVersion() >= 210 )
679
                	name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
674
        }
680
        }
675
        pclose(fp);
681
        pclose(fp);
676
	wiz->CBdefault->setCurrentItem(firstKey);
682
	wiz->CBdefault->setCurrentItem(firstKey);
Lines 703-709 Link Here
703
                fp = popen("gpg --display-charset=utf-8 --no-tty --with-colon --list-secret-keys "+TQFile::encodeName(defaultID), "r");
709
                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)) {
710
                while ( fgets( line, sizeof(line), fp)) {
705
                        tst=TQString::fromUtf8(line);
711
                        tst=TQString::fromUtf8(line);
706
                        if (tst.startsWith("sec")) {
712
                        if ( (tst.startsWith("sec") && KgpgInterface::getGpgVersion() < 210) || 
713
                        	(tst.startsWith("uid") && KgpgInterface::getGpgVersion() >= 210) ) {
707
				name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
714
				name=KgpgInterface::checkForUtf8(tst.section(':',9,9));
708
                                wiz->CBdefault->setCurrentItem(tst.section(':',4,4).right(8)+": "+name);
715
                                wiz->CBdefault->setCurrentItem(tst.section(':',4,4).right(8)+": "+name);
709
                        }
716
                        }
(-)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 (-1 / +1 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();
(-)tdeutils.orig/kgpg/listkeys.cpp (-125 / +365 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 244-264 Link Here
244
248
245
        bool selectedok=false;
249
        bool selectedok=false;
246
	bool warn=false;
250
	bool warn=false;
247
	TDEListViewItem *item;
251
	TQString currentKey;
252
	TQMap<TQString,TQStringList> hashMap;
248
253
249
        fp = popen("gpg --no-tty --with-colons --list-secret-keys", "r");
254
        fp = popen("gpg --no-tty --with-colons --list-secret-keys", "r");
250
        while ( fgets( line, sizeof(line), fp)) {
255
        while ( fgets( line, sizeof(line), fp)) {
251
                tst=TQString::fromUtf8(line);
256
                TQString tst=TQString::fromUtf8(line);
252
                if (tst.startsWith("sec")) {
257
                kdDebug(2100) << k_funcinfo << "Read one secret key line: " << tst << endl;
258
                if ( tst.startsWith("sec")  ) {
259
                	currentKey = tst.section(':',4,4);
260
                	TQStringList lst; lst << tst;
261
			hashMap.insert(currentKey,lst);
262
                }
263
		else
264
			hashMap.find(currentKey).data().append(tst);
265
266
	}
267
	pclose(fp);
268
269
// process the list
270
271
	TQMap<TQString,TQStringList>::Iterator ite;
272
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
273
		TDEListViewItem *item;
274
		TQStringList::Iterator it;
275
		bool dead = true;	
276
		TQString id,val;
277
278
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
279
			TQString tst =  (*it);
253
                        TQStringList keyString=TQStringList::split(":",tst,true);
280
                        TQStringList keyString=TQStringList::split(":",tst,true);
254
                        TQString val=keyString[6];
281
			if (tst.startsWith("sec")) {		
255
                        TQString id=TQString("0x"+keyString[4].right(8));
282
				val=keyString[6];
283
				id=TQString("0x"+keyString[4].right(8));
256
                        if (val.isEmpty())
284
                        if (val.isEmpty())
257
                                val=i18n("Unlimited");
285
                                val=i18n("Unlimited");
258
                        fullname=keyString[9];
286
                        fullname=keyString[9];
259
287
260
                        fp2 = popen(TQFile::encodeName(TQString("gpg --no-tty --with-colons --list-key %1").arg(KShellProcess::quote(id))), "r");
288
                        fp2 = popen(TQFile::encodeName(TQString("gpg --no-tty --with-colons --list-key %1").arg(KShellProcess::quote(id))), "r");
261
                        bool dead=true;
289
				dead=true;
262
                        while ( fgets( line, sizeof(line), fp2)) {
290
                        while ( fgets( line, sizeof(line), fp2)) {
263
                                tst2=TQString::fromUtf8(line);
291
                                tst2=TQString::fromUtf8(line);
264
                                if (tst2.startsWith("pub")) {
292
                                if (tst2.startsWith("pub")) {
Lines 282-287 Link Here
282
                                }
310
                                }
283
                        }
311
                        }
284
                        pclose(fp2);
312
                        pclose(fp2);
313
			}
314
			if ( tst.startsWith("uid") && fullname.isEmpty() ) {
315
				TQStringList key=TQStringList::split(":",tst,true);
316
				fullname = key[9];
317
			}
318
319
                }
320
285
                        if (!fullname.isEmpty() && (!dead)) {
321
                        if (!fullname.isEmpty() && (!dead)) {
286
			TQString keyMail,keyName;
322
			TQString keyMail,keyName;
287
			if (fullname.find("<")!=-1) {
323
			if (fullname.find("<")!=-1) {
Lines 295-301 Link Here
295
331
296
        		keyName=KgpgInterface::checkForUtf8(keyName);
332
        		keyName=KgpgInterface::checkForUtf8(keyName);
297
333
298
299
                                item=new TDEListViewItem(keysListpr,keyName,keyMail,id);
334
                                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));
335
                                //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);
336
				TDEListViewItem *sub= new TDEListViewItem(item,i18n("Expiration:"),val);
Lines 308-315 Link Here
308
                                }
343
                                }
309
                        }
344
                        }
310
                }
345
                }
311
        }
312
        pclose(fp);
313
346
314
	if (warn)
347
	if (warn)
315
	{
348
	{
Lines 395-400 Link Here
395
KeyView::KeyView( TQWidget *parent, const char *name )
428
KeyView::KeyView( TQWidget *parent, const char *name )
396
                : TDEListView( parent, name )
429
                : TDEListView( parent, name )
397
{
430
{
431
//         kdDebug(2100) << k_funcinfo << endl;
398
        TDEIconLoader *loader = TDEGlobal::iconLoader();
432
        TDEIconLoader *loader = TDEGlobal::iconLoader();
399
433
400
        pixkeyOrphan=loader->loadIcon("kgpg_key4",TDEIcon::Small,20);
434
        pixkeyOrphan=loader->loadIcon("kgpg_key4",TDEIcon::Small,20);
Lines 434-439 Link Here
434
468
435
void  KeyView::droppedfile (KURL url)
469
void  KeyView::droppedfile (KURL url)
436
{
470
{
471
//         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)
472
        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;
473
                return;
439
474
Lines 479-502 Link Here
479
mySearchLine::mySearchLine(TQWidget *parent, KeyView *listView, const char *name)
514
mySearchLine::mySearchLine(TQWidget *parent, KeyView *listView, const char *name)
480
:TDEListViewSearchLine(parent,listView,name)
515
:TDEListViewSearchLine(parent,listView,name)
481
{
516
{
482
searchListView=listView;
517
	searchListView=listView;
483
setKeepParentsVisible(false);
518
	setKeepParentsVisible(false);
484
}
519
}
485
520
486
mySearchLine::~ mySearchLine()
521
mySearchLine::~ mySearchLine()
487
{}
522
{}
488
523
489
490
bool mySearchLine::itemMatches(const TQListViewItem *item, const TQString & s) const
524
bool mySearchLine::itemMatches(const TQListViewItem *item, const TQString & s) const
491
{
525
{
492
if (item->depth()!=0) return true;
526
if (item->depth()!=0) return true;
493
else return TDEListViewSearchLine::itemMatches(item,s);
527
else return TDEListViewSearchLine::itemMatches(item,s);
494
}
528
}
495
529
496
497
498
void mySearchLine::updateSearch(const TQString& s)
530
void mySearchLine::updateSearch(const TQString& s)
499
{
531
{
532
//         kdDebug(2100) << k_funcinfo << endl;
500
    TDEListViewSearchLine::updateSearch(s);
533
    TDEListViewSearchLine::updateSearch(s);
501
    if (searchListView->displayOnlySecret || !searchListView->displayDisabled)
534
    if (searchListView->displayOnlySecret || !searchListView->displayDisabled)
502
    {
535
    {
Lines 521-528 Link Here
521
554
522
listKeys::listKeys(TQWidget *parent, const char *name) : DCOPObject( "KeyInterface" ), TDEMainWindow(parent, name,0)
555
listKeys::listKeys(TQWidget *parent, const char *name) : DCOPObject( "KeyInterface" ), TDEMainWindow(parent, name,0)
523
{
556
{
557
//         kdDebug(2100) << k_funcinfo << endl;
524
        //KWin::setType(TQt::WDestructiveClose);
558
        //KWin::setType(TQt::WDestructiveClose);
525
559
560
526
        keysList2 = new KeyView(this);
561
        keysList2 = new KeyView(this);
527
        keysList2->photoKeysList=TQString();
562
        keysList2->photoKeysList=TQString();
528
        keysList2->groupNb=0;
563
        keysList2->groupNb=0;
Lines 725-730 Link Here
725
        connect(s_kgpgEditor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList)));
760
        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)));
761
        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)));
762
        connect(s_kgpgEditor->view->editor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList)));
763
764
765
//	kdDebug(2100) << k_funcinfo << "getGpgversion" << KgpgInterface::getGpgVersion() <<endl;
728
}
766
}
729
767
730
768
Lines 849-854 Link Here
849
887
850
void listKeys::refreshKeyFromServer()
888
void listKeys::refreshKeyFromServer()
851
{
889
{
890
//         kdDebug(2100) << k_funcinfo << endl;
852
        if (keysList2->currentItem()==NULL)
891
        if (keysList2->currentItem()==NULL)
853
                return;
892
                return;
854
        TQString keyIDS;
893
        TQString keyIDS;
Lines 874-879 Link Here
874
913
875
void listKeys::refreshFinished()
914
void listKeys::refreshFinished()
876
{
915
{
916
//         kdDebug(2100) << k_funcinfo << endl;
877
        if (kServer)
917
        if (kServer)
878
                kServer=0L;
918
                kServer=0L;
879
919
Lines 902-907 Link Here
902
942
903
void listKeys::slotregenerate()
943
void listKeys::slotregenerate()
904
{
944
{
945
//         kdDebug(2100) << k_funcinfo << endl;
905
        FILE *fp;
946
        FILE *fp;
906
        TQString tst;
947
        TQString tst;
907
        char line[300];
948
        char line[300];
Lines 1029-1034 Link Here
1029
1070
1030
void listKeys::findKey()
1071
void listKeys::findKey()
1031
{
1072
{
1073
 //        kdDebug(2100) << k_funcinfo << endl;
1032
        KFindDialog fd(this,"find_dialog",0,"");
1074
        KFindDialog fd(this,"find_dialog",0,"");
1033
        if ( fd.exec() != TQDialog::Accepted )
1075
        if ( fd.exec() != TQDialog::Accepted )
1034
                return;
1076
                return;
Lines 1039-1044 Link Here
1039
1081
1040
void listKeys::findFirstKey()
1082
void listKeys::findFirstKey()
1041
{
1083
{
1084
//         kdDebug(2100) << k_funcinfo << endl;
1042
        if (searchString.isEmpty())
1085
        if (searchString.isEmpty())
1043
                return;
1086
                return;
1044
        bool foundItem=true;
1087
        bool foundItem=true;
Lines 1075-1080 Link Here
1075
1118
1076
void listKeys::findNextKey()
1119
void listKeys::findNextKey()
1077
{
1120
{
1121
//         kdDebug(2100) << k_funcinfo << endl;
1078
				//kdDebug(2100)<<"find next"<<endl;
1122
				//kdDebug(2100)<<"find next"<<endl;
1079
        if (searchString.isEmpty()) {
1123
        if (searchString.isEmpty()) {
1080
                findKey();
1124
                findKey();
Lines 1119-1124 Link Here
1119
1163
1120
void listKeys::addToKAB()
1164
void listKeys::addToKAB()
1121
{
1165
{
1166
//         kdDebug(2100) << k_funcinfo << endl;
1122
        TDEABC::Key key;
1167
        TDEABC::Key key;
1123
	if (!keysList2->currentItem()) return;
1168
	if (!keysList2->currentItem()) return;
1124
        //TQString email=extractKeyMail(keysList2->currentItem()).stripWhiteSpace();
1169
        //TQString email=extractKeyMail(keysList2->currentItem()).stripWhiteSpace();
Lines 1200-1205 Link Here
1200
1245
1201
void listKeys::showKeyServer()
1246
void listKeys::showKeyServer()
1202
{
1247
{
1248
//         kdDebug(2100) << k_funcinfo << endl;
1203
        keyServer *ks=new keyServer(this);
1249
        keyServer *ks=new keyServer(this);
1204
	connect(ks,TQT_SIGNAL( importFinished(TQString) ) , keysList2, TQT_SLOT(refreshcurrentkey(TQString)));
1250
	connect(ks,TQT_SIGNAL( importFinished(TQString) ) , keysList2, TQT_SLOT(refreshcurrentkey(TQString)));
1205
        ks->exec();
1251
        ks->exec();
Lines 1211-1216 Link Here
1211
1257
1212
void listKeys::checkList()
1258
void listKeys::checkList()
1213
{
1259
{
1260
//         kdDebug(2100) << k_funcinfo << endl;
1214
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
1261
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
1215
        if (exportList.count()>1)
1262
        if (exportList.count()>1)
1216
                {
1263
                {
Lines 1266-1271 Link Here
1266
void listKeys::readOptions()
1313
void listKeys::readOptions()
1267
{
1314
{
1268
1315
1316
        kdDebug(2100) << k_funcinfo << endl;
1269
        clipboardMode=TQClipboard::Clipboard;
1317
        clipboardMode=TQClipboard::Clipboard;
1270
        if (KGpgSettings::useMouseSelection() && (kapp->clipboard()->supportsSelection()))
1318
        if (KGpgSettings::useMouseSelection() && (kapp->clipboard()->supportsSelection()))
1271
                clipboardMode=TQClipboard::Selection;
1319
                clipboardMode=TQClipboard::Selection;
Lines 1488-1493 Link Here
1488
1536
1489
void listKeys::slotexport()
1537
void listKeys::slotexport()
1490
{
1538
{
1539
//         kdDebug(2100) << k_funcinfo << endl;
1491
        /////////////////////  export key
1540
        /////////////////////  export key
1492
        if (keysList2->currentItem()==NULL)
1541
        if (keysList2->currentItem()==NULL)
1493
                return;
1542
                return;
Lines 1599-1604 Link Here
1599
1648
1600
void listKeys::showKeyInfo(TQString keyID)
1649
void listKeys::showKeyInfo(TQString keyID)
1601
{
1650
{
1651
//        kdDebug(2100) << k_funcinfo << endl;
1602
        KgpgKeyInfo *opts=new KgpgKeyInfo(this,"key_props",keyID);
1652
        KgpgKeyInfo *opts=new KgpgKeyInfo(this,"key_props",keyID);
1603
        opts->show();
1653
        opts->show();
1604
}
1654
}
Lines 1606-1611 Link Here
1606
1656
1607
void listKeys::slotShowPhoto()
1657
void listKeys::slotShowPhoto()
1608
{
1658
{
1659
//         kdDebug(2100) << k_funcinfo << endl;
1609
        TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'");
1660
        TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'");
1610
        KService::Ptr ptr = offers.first();
1661
        KService::Ptr ptr = offers.first();
1611
        //KMessageBox::sorry(0,ptr->desktopEntryName());
1662
        //KMessageBox::sorry(0,ptr->desktopEntryName());
Lines 1616-1621 Link Here
1616
1667
1617
void listKeys::listsigns()
1668
void listKeys::listsigns()
1618
{
1669
{
1670
//         kdDebug(2100) << k_funcinfo << endl;
1619
        //kdDebug(2100)<<"Edit -------------------------------"<<endl;
1671
        //kdDebug(2100)<<"Edit -------------------------------"<<endl;
1620
        if (keysList2->currentItem()==NULL)
1672
        if (keysList2->currentItem()==NULL)
1621
                return;
1673
                return;
Lines 1646-1651 Link Here
1646
1698
1647
void listKeys::groupAdd()
1699
void listKeys::groupAdd()
1648
{
1700
{
1701
//         kdDebug(2100) << k_funcinfo << endl;
1649
        TQPtrList<TQListViewItem> addList=gEdit->availableKeys->selectedItems();
1702
        TQPtrList<TQListViewItem> addList=gEdit->availableKeys->selectedItems();
1650
        for ( uint i = 0; i < addList.count(); ++i )
1703
        for ( uint i = 0; i < addList.count(); ++i )
1651
                if ( addList.at(i) ) {
1704
                if ( addList.at(i) ) {
Lines 1655-1660 Link Here
1655
1708
1656
void listKeys::groupRemove()
1709
void listKeys::groupRemove()
1657
{
1710
{
1711
//         kdDebug(2100) << k_funcinfo << endl;
1658
        TQPtrList<TQListViewItem> remList=gEdit->groupKeys->selectedItems();
1712
        TQPtrList<TQListViewItem> remList=gEdit->groupKeys->selectedItems();
1659
        for ( uint i = 0; i < remList.count(); ++i )
1713
        for ( uint i = 0; i < remList.count(); ++i )
1660
                if ( remList.at(i) ) {
1714
                if ( remList.at(i) ) {
Lines 1664-1669 Link Here
1664
1718
1665
void listKeys::deleteGroup()
1719
void listKeys::deleteGroup()
1666
{
1720
{
1721
//         kdDebug(2100) << k_funcinfo << endl;
1667
        if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1722
        if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1668
                return;
1723
                return;
1669
1724
Lines 1686-1691 Link Here
1686
1741
1687
void listKeys::groupChange()
1742
void listKeys::groupChange()
1688
{
1743
{
1744
//         kdDebug(2100) << k_funcinfo << endl;
1689
        TQStringList selected;
1745
        TQStringList selected;
1690
        TQListViewItem *item=gEdit->groupKeys->firstChild();
1746
        TQListViewItem *item=gEdit->groupKeys->firstChild();
1691
        while (item) {
1747
        while (item) {
Lines 1697-1702 Link Here
1697
1753
1698
void listKeys::createNewGroup()
1754
void listKeys::createNewGroup()
1699
{
1755
{
1756
//         kdDebug(2100) << k_funcinfo << endl;
1700
        TQStringList badkeys,keysGroup;
1757
        TQStringList badkeys,keysGroup;
1701
1758
1702
        if (keysList2->selectedItems().count()>0) {
1759
        if (keysList2->selectedItems().count()>0) {
Lines 1745-1750 Link Here
1745
1802
1746
void listKeys::groupInit(TQStringList keysGroup)
1803
void listKeys::groupInit(TQStringList keysGroup)
1747
{
1804
{
1805
//         kdDebug(2100) << k_funcinfo << endl;
1748
        kdDebug(2100)<<"preparing group"<<endl;
1806
        kdDebug(2100)<<"preparing group"<<endl;
1749
        TQStringList lostKeys;
1807
        TQStringList lostKeys;
1750
        bool foundId;
1808
        bool foundId;
Lines 1771-1776 Link Here
1771
1829
1772
void listKeys::editGroup()
1830
void listKeys::editGroup()
1773
{
1831
{
1832
//         kdDebug(2100) << k_funcinfo << endl;
1774
  if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1833
  if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty())
1775
                return;
1834
                return;
1776
        TQStringList keysGroup;
1835
        TQStringList keysGroup;
Lines 1826-1831 Link Here
1826
1885
1827
void listKeys::signkey()
1886
void listKeys::signkey()
1828
{
1887
{
1888
//         kdDebug(2100) << k_funcinfo << endl;
1829
        ///////////////  sign a key
1889
        ///////////////  sign a key
1830
        if (keysList2->currentItem()==NULL)
1890
        if (keysList2->currentItem()==NULL)
1831
                return;
1891
                return;
Lines 1924-1936 Link Here
1924
                TDEConfig *config = TDEGlobal::config();
1984
                TDEConfig *config = TDEGlobal::config();
1925
                config->setGroup("General");
1985
                config->setGroup("General");
1926
                kp<< config->readPathEntry("TerminalApplication","konsole");
1986
                kp<< config->readPathEntry("TerminalApplication","konsole");
1927
                kp<<"-e"
1987
                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)
1988
                if (globalisLocal)
1935
                        kp<<"lsign";
1989
                        kp<<"lsign";
1936
                else
1990
                else
Lines 1942-1947 Link Here
1942
1996
1943
void listKeys::signLoop()
1997
void listKeys::signLoop()
1944
{
1998
{
1999
//         kdDebug(2100) << k_funcinfo << endl;
1945
        if (keyCount<globalCount) {
2000
        if (keyCount<globalCount) {
1946
                kdDebug(2100)<<"Sign process for key: "<<keyCount<<" on a total of "<<signList.count()<<endl;
2001
                kdDebug(2100)<<"Sign process for key: "<<keyCount<<" on a total of "<<signList.count()<<endl;
1947
                if ( signList.at(keyCount) ) {
2002
                if ( signList.at(keyCount) ) {
Lines 1954-1959 Link Here
1954
2009
1955
void listKeys::signatureResult(int success)
2010
void listKeys::signatureResult(int success)
1956
{
2011
{
2012
//         kdDebug(2100) << k_funcinfo << endl;
1957
        if (success==3)
2013
        if (success==3)
1958
                keysList2->refreshcurrentkey(signList.at(keyCount));
2014
                keysList2->refreshcurrentkey(signList.at(keyCount));
1959
2015
Lines 1967-1972 Link Here
1967
2023
1968
void listKeys::importallsignkey()
2024
void listKeys::importallsignkey()
1969
{
2025
{
2026
//        kdDebug(2100) << k_funcinfo << endl;
1970
        if (keysList2->currentItem()==NULL)
2027
        if (keysList2->currentItem()==NULL)
1971
                return;
2028
                return;
1972
        if (! keysList2->currentItem()->firstChild()) {
2029
        if (! keysList2->currentItem()->firstChild()) {
Lines 1989-1994 Link Here
1989
2046
1990
void listKeys::preimportsignkey()
2047
void listKeys::preimportsignkey()
1991
{
2048
{
2049
//         kdDebug(2100) << k_funcinfo << endl;
1992
        if (keysList2->currentItem()==NULL)
2050
        if (keysList2->currentItem()==NULL)
1993
                return;
2051
                return;
1994
        else
2052
        else
Lines 1997-2003 Link Here
1997
2055
1998
bool listKeys::importRemoteKey(TQString keyID)
2056
bool listKeys::importRemoteKey(TQString keyID)
1999
{
2057
{
2000
2058
//         kdDebug(2100) << k_funcinfo << endl;
2001
        kServer=new keyServer(0,"server_dialog",false,true);
2059
        kServer=new keyServer(0,"server_dialog",false,true);
2002
        kServer->page->kLEimportid->setText(keyID);
2060
        kServer->page->kLEimportid->setText(keyID);
2003
        kServer->page->Buttonimport->setDefault(true);
2061
        kServer->page->Buttonimport->setDefault(true);
Lines 2013-2018 Link Here
2013
2071
2014
void listKeys::dcopImportFinished()
2072
void listKeys::dcopImportFinished()
2015
{
2073
{
2074
// 	kdDebug(2100) << k_funcinfo << endl;
2016
        if (kServer)
2075
        if (kServer)
2017
                kServer=0L;
2076
                kServer=0L;
2018
    TQByteArray params;
2077
    TQByteArray params;
Lines 2024-2029 Link Here
2024
2083
2025
void listKeys::importsignkey(TQString importKeyId)
2084
void listKeys::importsignkey(TQString importKeyId)
2026
{
2085
{
2086
// 	kdDebug(2100) << k_funcinfo << endl;
2027
        ///////////////  sign a key
2087
        ///////////////  sign a key
2028
        kServer=new keyServer(0,"server_dialog",false);
2088
        kServer=new keyServer(0,"server_dialog",false);
2029
        kServer->page->kLEimportid->setText(importKeyId);
2089
        kServer->page->kLEimportid->setText(importKeyId);
Lines 2036-2041 Link Here
2036
2096
2037
void listKeys::importfinished()
2097
void listKeys::importfinished()
2038
{
2098
{
2099
	kdDebug(2100) << k_funcinfo << endl;
2039
        if (kServer)
2100
        if (kServer)
2040
                kServer=0L;
2101
                kServer=0L;
2041
        refreshkey();
2102
        refreshkey();
Lines 2044-2049 Link Here
2044
2105
2045
void listKeys::delsignkey()
2106
void listKeys::delsignkey()
2046
{
2107
{
2108
// 	kdDebug(2100) << k_funcinfo << endl;
2047
        ///////////////  sign a key
2109
        ///////////////  sign a key
2048
        if (keysList2->currentItem()==NULL)
2110
        if (keysList2->currentItem()==NULL)
2049
                return;
2111
                return;
Lines 2075-2080 Link Here
2075
2137
2076
void listKeys::delsignatureResult(bool success)
2138
void listKeys::delsignatureResult(bool success)
2077
{
2139
{
2140
// 	kdDebug(2100) << k_funcinfo << endl;
2078
        if (success) {
2141
        if (success) {
2079
                TQListViewItem *top=keysList2->currentItem();
2142
                TQListViewItem *top=keysList2->currentItem();
2080
                while (top->depth()!=0)
2143
                while (top->depth()!=0)
Lines 2088-2093 Link Here
2088
2151
2089
void listKeys::slotedit()
2152
void listKeys::slotedit()
2090
{
2153
{
2154
// 	kdDebug(2100) << k_funcinfo << endl;
2091
        if (!keysList2->currentItem())
2155
        if (!keysList2->currentItem())
2092
                return;
2156
                return;
2093
        if (keysList2->currentItem()->depth()!=0)
2157
        if (keysList2->currentItem()->depth()!=0)
Lines 2100-2112 Link Here
2100
        TDEConfig *config = TDEGlobal::config();
2164
        TDEConfig *config = TDEGlobal::config();
2101
        config->setGroup("General");
2165
        config->setGroup("General");
2102
        kp<< config->readPathEntry("TerminalApplication","konsole");
2166
        kp<< config->readPathEntry("TerminalApplication","konsole");
2103
        kp<<"-e"
2167
        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);
2168
        kp.start(TDEProcess::Block);
2111
        keysList2->refreshcurrentkey(keysList2->currentItem());
2169
        keysList2->refreshcurrentkey(keysList2->currentItem());
2112
}
2170
}
Lines 2114-2119 Link Here
2114
2172
2115
void listKeys::slotgenkey()
2173
void listKeys::slotgenkey()
2116
{
2174
{
2175
// 	kdDebug(2100) << k_funcinfo << endl;
2117
        //////////  generate key
2176
        //////////  generate key
2118
        keyGenerate *genkey=new keyGenerate(this,0);
2177
        keyGenerate *genkey=new keyGenerate(this,0);
2119
        if (genkey->exec()==TQDialog::Accepted) {
2178
        if (genkey->exec()==TQDialog::Accepted) {
Lines 2230-2235 Link Here
2230
2289
2231
void listKeys::readgenprocess(KProcIO *p)
2290
void listKeys::readgenprocess(KProcIO *p)
2232
{
2291
{
2292
// 	kdDebug(2100) << k_funcinfo << endl;
2233
        TQString required;
2293
        TQString required;
2234
        while (p->readln(required,true)!=-1) {
2294
        while (p->readln(required,true)!=-1) {
2235
                if (required.find("KEY_CREATED")!=-1)
2295
                if (required.find("KEY_CREATED")!=-1)
Lines 2242-2247 Link Here
2242
2302
2243
void listKeys::genover(TDEProcess *)
2303
void listKeys::genover(TDEProcess *)
2244
{
2304
{
2305
// 	kdDebug(2100) << k_funcinfo << endl;
2245
        newkeyID=TQString();
2306
        newkeyID=TQString();
2246
        continueSearch=true;
2307
        continueSearch=true;
2247
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
2308
        KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale());
Lines 2255-2263 Link Here
2255
2316
2256
void listKeys::slotReadFingerProcess(KProcIO *p)
2317
void listKeys::slotReadFingerProcess(KProcIO *p)
2257
{
2318
{
2319
// 	kdDebug(2100) << k_funcinfo << endl;
2258
        TQString outp;
2320
        TQString outp;
2259
        while (p->readln(outp)!=-1) {
2321
        while (p->readln(outp)!=-1) {
2260
                if (outp.startsWith("pub") && (continueSearch)) {
2322
                if ( outp.startsWith("pub") && (continueSearch)) {
2261
                        newkeyID=outp.section(':',4,4).right(8).prepend("0x");
2323
                        newkeyID=outp.section(':',4,4).right(8).prepend("0x");
2262
2324
2263
                }
2325
                }
Lines 2272-2277 Link Here
2272
2334
2273
void listKeys::newKeyDone(TDEProcess *)
2335
void listKeys::newKeyDone(TDEProcess *)
2274
{
2336
{
2337
// 	kdDebug(2100) << k_funcinfo << endl;
2275
        changeMessage(i18n("Ready"),0);
2338
        changeMessage(i18n("Ready"),0);
2276
        //        refreshkey();
2339
        //        refreshkey();
2277
        if (newkeyID.isEmpty()) {
2340
        if (newkeyID.isEmpty()) {
Lines 2321-2326 Link Here
2321
2384
2322
void listKeys::doFilePrint(TQString url)
2385
void listKeys::doFilePrint(TQString url)
2323
{
2386
{
2387
// 	kdDebug(2100) << k_funcinfo << endl;
2324
        TQFile qfile(url);
2388
        TQFile qfile(url);
2325
        if (qfile.open(IO_ReadOnly)) {
2389
        if (qfile.open(IO_ReadOnly)) {
2326
                TQTextStream t( &qfile );
2390
                TQTextStream t( &qfile );
Lines 2331-2336 Link Here
2331
2395
2332
void listKeys::doPrint(TQString txt)
2396
void listKeys::doPrint(TQString txt)
2333
{
2397
{
2398
// 	kdDebug(2100) << k_funcinfo << endl;
2334
        KPrinter prt;
2399
        KPrinter prt;
2335
        //kdDebug(2100)<<"Printing..."<<endl;
2400
        //kdDebug(2100)<<"Printing..."<<endl;
2336
        if (prt.setup(this)) {
2401
        if (prt.setup(this)) {
Lines 2355-2369 Link Here
2355
        TDEConfig *config = TDEGlobal::config();
2420
        TDEConfig *config = TDEGlobal::config();
2356
        config->setGroup("General");
2421
        config->setGroup("General");
2357
        *conprocess<< config->readPathEntry("TerminalApplication","konsole");
2422
        *conprocess<< config->readPathEntry("TerminalApplication","konsole");
2358
        *conprocess<<"-e"<<"gpg"
2423
        *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()));
2424
        TQObject::connect(conprocess, TQT_SIGNAL(processExited(TDEProcess *)),TQT_TQOBJECT(this), TQT_SLOT(reloadSecretKeys()));
2362
        conprocess->start(TDEProcess::NotifyOnExit,TDEProcess::AllOutput);
2425
        conprocess->start(TDEProcess::NotifyOnExit,TDEProcess::AllOutput);
2363
}
2426
}
2364
2427
2365
void listKeys::reloadSecretKeys()
2428
void listKeys::reloadSecretKeys()
2366
{
2429
{
2430
// 	kdDebug(2100) << k_funcinfo << endl;
2367
        FILE *fp;
2431
        FILE *fp;
2368
        char line[300];
2432
        char line[300];
2369
        keysList2->secretList=TQString();
2433
        keysList2->secretList=TQString();
Lines 2379-2384 Link Here
2379
2443
2380
void listKeys::confirmdeletekey()
2444
void listKeys::confirmdeletekey()
2381
{
2445
{
2446
// 	kdDebug(2100) << k_funcinfo << endl;
2382
        if (keysList2->currentItem()->depth()!=0) {
2447
        if (keysList2->currentItem()->depth()!=0) {
2383
                if ((keysList2->currentItem()->depth()==1) && (keysList2->currentItem()->text(4)=="-") && (keysList2->currentItem()->text(6).startsWith("0x")))
2448
                if ((keysList2->currentItem()->depth()==1) && (keysList2->currentItem()->text(4)=="-") && (keysList2->currentItem()->text(6).startsWith("0x")))
2384
                        delsignkey();
2449
                        delsignkey();
Lines 2422-2437 Link Here
2422
2487
2423
void listKeys::deletekey()
2488
void listKeys::deletekey()
2424
{
2489
{
2490
// 	kdDebug(2100) << k_funcinfo << endl;
2425
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
2491
        TQPtrList<TQListViewItem> exportList=keysList2->selectedItems();
2426
        if (exportList.count()==0)
2492
        if (exportList.count()==0)
2427
                return;
2493
                return;
2428
        TDEProcess gp;
2494
        TDEProcess gp;
2429
        gp << "gpg"
2495
        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 )
2496
        for ( uint i = 0; i < exportList.count(); ++i )
2436
                if ( exportList.at(i) )
2497
                if ( exportList.at(i) )
2437
                        gp<<(exportList.at(i)->text(6)).stripWhiteSpace();
2498
                        gp<<(exportList.at(i)->text(6)).stripWhiteSpace();
Lines 2467-2472 Link Here
2467
2528
2468
void listKeys::slotPreImportKey()
2529
void listKeys::slotPreImportKey()
2469
{
2530
{
2531
// 	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);
2532
        KDialogBase *dial=new KDialogBase( KDialogBase::Swallow, i18n("Key Import"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, this, "key_import",true);
2471
2533
2472
        SrcSelect *page=new SrcSelect();
2534
        SrcSelect *page=new SrcSelect();
Lines 2504-2510 Link Here
2504
2566
2505
void KeyView::expandGroup(TQListViewItem *item)
2567
void KeyView::expandGroup(TQListViewItem *item)
2506
{
2568
{
2507
2569
// 	kdDebug(2100) << k_funcinfo << endl;
2508
        TQStringList keysGroup=KgpgInterface::getGpgGroupSetting(item->text(0),KGpgSettings::gpgConfigPath());
2570
        TQStringList keysGroup=KgpgInterface::getGpgGroupSetting(item->text(0),KGpgSettings::gpgConfigPath());
2509
        kdDebug(2100)<<keysGroup<<endl;
2571
        kdDebug(2100)<<keysGroup<<endl;
2510
        for ( TQStringList::Iterator it = keysGroup.begin(); it != keysGroup.end(); ++it ) {
2572
        for ( TQStringList::Iterator it = keysGroup.begin(); it != keysGroup.end(); ++it ) {
Lines 2516-2521 Link Here
2516
2578
2517
TQPixmap KeyView::slotGetPhoto(TQString photoId,bool mini)
2579
TQPixmap KeyView::slotGetPhoto(TQString photoId,bool mini)
2518
{
2580
{
2581
// 	kdDebug(2100) << k_funcinfo << endl;
2519
        KTempFile *phototmp=new KTempFile();
2582
        KTempFile *phototmp=new KTempFile();
2520
        TQString popt="cp %i "+phototmp->name();
2583
        TQString popt="cp %i "+phototmp->name();
2521
        KProcIO *p=new KProcIO(TQTextCodec::codecForLocale());
2584
        KProcIO *p=new KProcIO(TQTextCodec::codecForLocale());
Lines 2538-2567 Link Here
2538
2601
2539
void KeyView::expandKey(TQListViewItem *item)
2602
void KeyView::expandKey(TQListViewItem *item)
2540
{
2603
{
2541
2604
// 	kdDebug(2100) << k_funcinfo << endl;
2542
        if (item->childCount()!=0)
2605
        if (item->childCount()!=0)
2543
                return;   // key has already been expanded
2606
                return;   // key has already been expanded
2544
        FILE *fp;
2607
        FILE *fp;
2545
        TQString cycle;
2608
        //TQString cycle;
2546
        TQStringList tst;
2609
        //TQStringList tst;
2547
        char tmpline[300];
2610
        char line[300];
2611
	bool dropFirstUid=true;
2612
	TQString currentKey;
2613
	TQMap<TQString,TQStringList> hashMap;
2614
2615
        kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl;
2616
2617
2618
        fp = popen(TQFile::encodeName(TQString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs "+item->text(6))), "r");
2619
2620
        while ( fgets( line, sizeof(line), fp)) {
2621
                TQString tst=TQString::fromUtf8(line);
2622
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2623
                if ( tst.startsWith("pub")  ) {
2624
                	currentKey = tst.section(':',4,4);
2625
                	TQStringList lst; lst << tst;
2626
			hashMap.insert(currentKey,lst);
2627
                }
2628
		else
2629
			hashMap.find(currentKey).data().append(tst);
2630
2631
	}
2632
	pclose(fp);
2633
2634
	TQMap<TQString,TQStringList>::Iterator ite;
2635
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2636
		TQStringList::Iterator it;
2637
//		gpgKey pubKey;
2638
		TQString cycle="pub";
2639
		bool noID=false;
2640
2548
        UpdateViewItem *itemsub=NULL;
2641
        UpdateViewItem *itemsub=NULL;
2549
        UpdateViewItem *itemuid=NULL;
2642
        UpdateViewItem *itemuid=NULL;
2550
        UpdateViewItem *itemsig=NULL;
2643
        UpdateViewItem *itemsig=NULL;
2551
        UpdateViewItem *itemrev=NULL;
2644
        UpdateViewItem *itemrev=NULL;
2552
        TQPixmap keyPhotoId;
2645
        TQPixmap keyPhotoId;
2553
        int uidNumber=2;
2646
        int uidNumber=2;
2554
        bool dropFirstUid=false;
2647
// 		bool dropFirstUid=false;
2555
2556
        kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl;
2557
2648
2558
        cycle="pub";
2649
		for (it = ite.data().begin(); it != ite.data().end(); it++) {	
2559
        bool noID=false;
2650
			TQString line = (*it);
2560
        fp = popen(TQFile::encodeName(TQString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs "+item->text(6))), "r");
2651
			TQStringList tst=TQStringList::split(":",line,true);
2561
2652
//		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
2653
                if ((tst[0]=="pub") && (tst[9].isEmpty())) /// Primary User Id is separated from public key
2566
                        uidNumber=1;
2654
                        uidNumber=1;
2567
                if (tst[0]=="uid" || tst[0]=="uat") {
2655
                if (tst[0]=="uid" || tst[0]=="uat") {
Lines 2607-2613 Link Here
2607
                                }
2695
                                }
2608
                        }
2696
                        }
2609
                        uidNumber++;
2697
                        uidNumber++;
2610
                } else
2698
			} else {
2611
                        if (tst[0]=="rev") {
2699
                        if (tst[0]=="rev") {
2612
                                gpgKey revKey=extractKey(line);
2700
                                gpgKey revKey=extractKey(line);
2613
                                if (cycle=="uid" || cycle=="uat")
2701
                                if (cycle=="uid" || cycle=="uat")
Lines 2618-2634 Link Here
2618
                                } else if (cycle=="sub")
2706
                                } else if (cycle=="sub")
2619
                                        itemrev= new UpdateViewItem(itemsub,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid);
2707
                                        itemrev= new UpdateViewItem(itemsub,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid);
2620
                                itemrev->setPixmap(0,pixRevoke);
2708
                                itemrev->setPixmap(0,pixRevoke);
2621
                        } else
2709
				} else {
2622
2623
2624
                                if (tst[0]=="sig") {
2710
                                if (tst[0]=="sig") {
2625
                                        gpgKey sigKey=extractKey(line);
2711
                                        gpgKey sigKey=extractKey(line);
2626
2712
2627
                                        if (tst[10].endsWith("l"))
2713
                                        if (tst[10].endsWith("l"))
2628
                                                sigKey.gpgkeymail+=i18n(" [local]");
2714
                                                sigKey.gpgkeymail+=i18n(" [local]");
2629
2715
2630
                                        if (cycle=="pub")
2716
						if (cycle=="pub") {
2631
                                                itemsig= new UpdateViewItem(item,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2717
                                                itemsig= new UpdateViewItem(item,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2718
						}
2632
                                        if (cycle=="sub")
2719
                                        if (cycle=="sub")
2633
                                                itemsig= new UpdateViewItem(itemsub,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2720
                                                itemsig= new UpdateViewItem(itemsub,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid);
2634
                                        if (cycle=="uid")
2721
                                        if (cycle=="uid")
Lines 2642-2662 Link Here
2642
                                                itemsub->setPixmap(0,pixkeySingle);
2729
                                                itemsub->setPixmap(0,pixkeySingle);
2643
                                                itemsub->setPixmap(2,subKey.trustpic);
2730
                                                itemsub->setPixmap(2,subKey.trustpic);
2644
                                                cycle="sub";
2731
                                                cycle="sub";
2645
2646
                                        }
2732
                                        }
2647
        }
2733
        }
2648
        pclose(fp);
2734
			}
2735
        	}
2736
	}
2649
}
2737
}
2650
2738
2651
2739
2652
void listKeys::refreshkey()
2740
void listKeys::refreshkey()
2653
{
2741
{
2742
	kdDebug(2100) << k_funcinfo << endl;
2654
        keysList2->refreshkeylist();
2743
        keysList2->refreshkeylist();
2655
	listViewSearch->updateSearch(listViewSearch->text());
2744
	listViewSearch->updateSearch(listViewSearch->text());
2656
}
2745
}
2657
2746
2658
void KeyView::refreshkeylist()
2747
void KeyView::refreshkeylist()
2659
{
2748
{
2749
// 	kdDebug(2100) << k_funcinfo << endl;
2660
        emit statusMessage(i18n("Loading Keys..."),0,true);
2750
        emit statusMessage(i18n("Loading Keys..."),0,true);
2661
        kapp->processEvents();
2751
        kapp->processEvents();
2662
        ////////   update display of keys in main management window
2752
        ////////   update display of keys in main management window
Lines 2664-2673 Link Here
2664
        TQString tst;
2754
        TQString tst;
2665
        char line[300];
2755
        char line[300];
2666
        UpdateViewItem *item=NULL;
2756
        UpdateViewItem *item=NULL;
2667
        bool noID=false;
2668
        bool emptyList=true;
2669
        TQString openKeys;
2757
        TQString openKeys;
2670
2758
2759
        bool emptyList=true;
2760
2761
	TQMap<TQString,TQStringList> hashMap;
2762
2671
        // get current position.
2763
        // get current position.
2672
        TQListViewItem *current = currentItem();
2764
        TQListViewItem *current = currentItem();
2673
        if(current != NULL) {
2765
        if(current != NULL) {
Lines 2693-2713 Link Here
2693
        pclose(fp2);
2785
        pclose(fp2);
2694
2786
2695
        TQString defaultKey = KGpgSettings::defaultKey();
2787
        TQString defaultKey = KGpgSettings::defaultKey();
2788
	TQString currentKey;
2789
2696
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r");
2790
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r");
2697
        while ( fgets( line, sizeof(line), fp)) {
2791
        while ( fgets( line, sizeof(line), fp)) {
2698
                tst=TQString::fromUtf8(line);
2792
                TQString tst=TQString::fromUtf8(line);
2699
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2793
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2700
                if (tst.startsWith("pub")) {
2794
                if ( tst.startsWith("pub")  ) {
2701
                        emptyList=false;
2795
                	currentKey = tst.section(':',4,4);
2702
                        noID=false;
2796
                	TQStringList lst; lst << tst;
2703
                        gpgKey pubKey=extractKey(tst);
2797
			hashMap.insert(currentKey,lst);
2798
                }
2799
		else
2800
			hashMap.find(currentKey).data().append(tst);
2704
2801
2802
	}
2803
	pclose(fp);
2804
2805
// process the list
2806
2807
	TQMap<TQString,TQStringList>::Iterator ite;
2808
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2809
		TQStringList::Iterator it;
2810
		gpgKey pubKey;
2811
		bool noID=false;
2705
                        bool isbold=false;
2812
                        bool isbold=false;
2706
                        bool isexpired=false;
2813
                        bool isexpired=false;
2814
2815
		for (it = ite.data().begin(); it != ite.data().end(); it++) {	
2816
			TQString tst =  (*it);
2817
			if ( tst.startsWith("pub") ){
2818
				emptyList=false;
2819
				//noID=false;
2820
				pubKey=extractKey(tst);
2707
                        if (pubKey.gpgkeyid==defaultKey)
2821
                        if (pubKey.gpgkeyid==defaultKey)
2708
                                isbold=true;
2822
                                isbold=true;
2709
                        if (pubKey.gpgkeytrust==i18n("Expired"))
2823
                        if (pubKey.gpgkeytrust==i18n("Expired"))
2710
                                isexpired=true;
2824
                                isexpired=true;
2825
			}
2826
			if ( tst.startsWith("uid") && pubKey.gpgkeyname.isEmpty() ){
2827
				gpgKey tmpKey=extractKey(tst);
2828
				if (! tmpKey.gpgkeyname.isEmpty() ) pubKey.gpgkeyname = tmpKey.gpgkeyname;
2829
				if (! tmpKey.gpgkeymail.isEmpty() ) pubKey.gpgkeymail = tmpKey.gpgkeymail;
2830
			}
2831
		}
2711
                        if (pubKey.gpgkeyname.isEmpty())
2832
                        if (pubKey.gpgkeyname.isEmpty())
2712
                                noID=true;
2833
                                noID=true;
2713
2834
Lines 2729-2736 Link Here
2729
                                item->setOpen(true);
2850
                                item->setOpen(true);
2730
                }
2851
                }
2731
2852
2732
        }
2853
2733
        pclose(fp);
2734
        if (!issec.isEmpty())
2854
        if (!issec.isEmpty())
2735
                insertOrphanedKeys(issec);
2855
                insertOrphanedKeys(issec);
2736
        if (emptyList) {
2856
        if (emptyList) {
Lines 2775-2792 Link Here
2775
2895
2776
void KeyView::insertOrphan(TQString currentID)
2896
void KeyView::insertOrphan(TQString currentID)
2777
{
2897
{
2898
// 	kdDebug(2100) << k_funcinfo << endl;
2778
        FILE *fp;
2899
        FILE *fp;
2779
        char line[300];
2900
        char line[300];
2780
        UpdateViewItem *item=NULL;
2901
        UpdateViewItem *item=NULL;
2781
        bool keyFound=false;
2902
        bool keyFound=false;
2903
	TQString currentKey;
2904
	TQMap<TQString,TQStringList> hashMap;
2905
2782
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2906
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2783
        while ( fgets( line, sizeof(line), fp)) {
2907
        while ( fgets( line, sizeof(line), fp)) {
2784
                TQString lineRead=TQString::fromUtf8(line);
2908
                TQString tst=TQString::fromUtf8(line);
2785
                if ((lineRead.startsWith("sec")) && (lineRead.section(':',4,4).right(8))==currentID.right(8)) {
2909
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2786
                        gpgKey orphanedKey=extractKey(lineRead);
2910
                if ( tst.startsWith("sec")  ) {
2787
                        keyFound=true;
2911
                	currentKey = tst.section(':',4,4);
2912
                	TQStringList lst; lst << tst;
2913
			hashMap.insert(currentKey,lst);
2914
                }
2915
		else
2916
			hashMap.find(currentKey).data().append(tst);
2917
2918
	}
2919
	pclose(fp);
2920
// process the list
2921
2922
	TQMap<TQString,TQStringList>::Iterator ite;
2923
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2924
		TQStringList::Iterator it;
2925
		gpgKey orphanedKey;
2926
		keyFound=false;
2788
                        bool isbold=false;
2927
                        bool isbold=false;
2789
                        bool isexpired=false;
2928
                        bool isexpired=false;
2929
2930
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
2931
			TQString tmp = (*it);
2932
			if ((tmp.startsWith("sec")) && (tmp.section(':',4,4).right(8))==currentID.right(8)) {
2933
				orphanedKey=extractKey(tmp);
2934
				keyFound=true;
2790
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2935
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2791
                        //               isbold=true;
2936
                        //               isbold=true;
2792
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
2937
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
Lines 2794-2804 Link Here
2794
                        //          if (orphanedKey.gpgkeyname.isEmpty())
2939
                        //          if (orphanedKey.gpgkeyname.isEmpty())
2795
                        //              noID=true;
2940
                        //              noID=true;
2796
2941
2942
			}
2943
			if ( tmp.startsWith("uid") && orphanedKey.gpgkeyname.isEmpty() ){
2944
				gpgKey tmpKey=extractKey(tmp);
2945
				if (! tmpKey.gpgkeyname.isEmpty() ) orphanedKey.gpgkeyname = tmpKey.gpgkeyname;
2946
				if (! tmpKey.gpgkeymail.isEmpty() ) orphanedKey.gpgkeymail = tmpKey.gpgkeymail;
2947
			}
2948
		}
2797
                        item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired);
2949
                        item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired);
2798
                        item->setPixmap(0,pixkeyOrphan);
2950
                        item->setPixmap(0,pixkeyOrphan);
2951
2799
                }
2952
                }
2800
        }
2953
2801
        pclose(fp);
2802
        if (!keyFound) {
2954
        if (!keyFound) {
2803
                orphanList.remove(currentID);
2955
                orphanList.remove(currentID);
2804
                setSelected(currentItem(),true);
2956
                setSelected(currentItem(),true);
Lines 2811-2826 Link Here
2811
2963
2812
void KeyView::insertOrphanedKeys(TQStringList orphans)
2964
void KeyView::insertOrphanedKeys(TQStringList orphans)
2813
{
2965
{
2966
// 	kdDebug(2100) << k_funcinfo << endl;
2814
        FILE *fp;
2967
        FILE *fp;
2815
        char line[300];
2968
        char line[300];
2969
	TQString currentKey;
2970
	TQMap<TQString,TQStringList> hashMap;
2971
2816
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2972
        fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2817
        while ( fgets( line, sizeof(line), fp)) {
2973
        while ( fgets( line, sizeof(line), fp)) {
2818
                TQString lineRead=TQString::fromUtf8(line);
2974
                TQString tst=TQString::fromUtf8(line);
2819
                if ((lineRead.startsWith("sec")) && (orphans.find(lineRead.section(':',4,4).right(8))!=orphans.end())) {
2975
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2820
                        gpgKey orphanedKey=extractKey(lineRead);
2976
                if ( tst.startsWith("sec")  ) {
2977
                	currentKey = tst.section(':',4,4);
2978
                	TQStringList lst; lst << tst;
2979
			hashMap.insert(currentKey,lst);
2980
                }
2981
		else
2982
			hashMap.find(currentKey).data().append(tst);
2983
2984
	}
2985
        pclose(fp);
2986
// process the list
2821
2987
2988
	TQMap<TQString,TQStringList>::Iterator ite;
2989
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
2990
		TQStringList::Iterator it;
2991
		gpgKey orphanedKey;
2822
                        bool isbold=false;
2992
                        bool isbold=false;
2823
                        bool isexpired=false;
2993
                        bool isexpired=false;
2994
2995
		for (it = ite.data().begin(); it != ite.data().end(); it++) {
2996
			TQString tmp = (*it);
2997
			if ((tmp.startsWith("sec")) && (orphans.find(tmp.section(':',4,4).right(8))!=orphans.end())) {
2998
				orphanedKey=extractKey(tmp);
2824
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2999
                        //           if (orphanedKey.gpgkeyid==defaultKey)
2825
                        //               isbold=true;
3000
                        //               isbold=true;
2826
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
3001
                        if (orphanedKey.gpgkeytrust==i18n("Expired"))
Lines 2828-2842 Link Here
2828
                        //          if (orphanedKey.gpgkeyname.isEmpty())
3003
                        //          if (orphanedKey.gpgkeyname.isEmpty())
2829
                        //              noID=true;
3004
                        //              noID=true;
2830
                        orphanList+=orphanedKey.gpgkeyid+",";
3005
                        orphanList+=orphanedKey.gpgkeyid+",";
3006
			}
3007
			if ( tmp.startsWith("uid") && orphanedKey.gpgkeyname.isEmpty() ){
3008
				gpgKey tmpKey=extractKey(tmp);
3009
				if (! tmpKey.gpgkeyname.isEmpty() ) orphanedKey.gpgkeyname = tmpKey.gpgkeyname;
3010
				if (! tmpKey.gpgkeymail.isEmpty() ) orphanedKey.gpgkeymail = tmpKey.gpgkeymail;
3011
			}
3012
		}
2831
                        UpdateViewItem *item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired);
3013
                        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);
3014
                        item->setPixmap(0,pixkeyOrphan);
2833
                }
3015
                }
2834
        }
2835
        pclose(fp);
2836
}
3016
}
2837
3017
2838
void KeyView::refreshgroups()
3018
void KeyView::refreshgroups()
2839
{
3019
{
3020
// 	kdDebug(2100) << k_funcinfo << endl;
2840
        TQListViewItem *item=firstChild();
3021
        TQListViewItem *item=firstChild();
2841
        while (item) {
3022
        while (item) {
2842
                if (item->text(6).isEmpty()) {
3023
                if (item->text(6).isEmpty()) {
Lines 2861-2866 Link Here
2861
3042
2862
void KeyView::refreshselfkey()
3043
void KeyView::refreshselfkey()
2863
{
3044
{
3045
// 	kdDebug(2100) << k_funcinfo << endl;
2864
        kdDebug(2100)<<"Refreshing key"<<endl;
3046
        kdDebug(2100)<<"Refreshing key"<<endl;
2865
        if (currentItem()->depth()==0)
3047
        if (currentItem()->depth()==0)
2866
                refreshcurrentkey(currentItem());
3048
                refreshcurrentkey(currentItem());
Lines 2870-2875 Link Here
2870
3052
2871
void KeyView::slotReloadKeys(TQStringList keyIDs)
3053
void KeyView::slotReloadKeys(TQStringList keyIDs)
2872
{
3054
{
3055
// 	kdDebug(2100) << k_funcinfo << endl;
2873
        if (keyIDs.isEmpty())
3056
        if (keyIDs.isEmpty())
2874
                return;
3057
                return;
2875
	if (keyIDs.first()=="ALL")
3058
	if (keyIDs.first()=="ALL")
Lines 2888-2893 Link Here
2888
3071
2889
void KeyView::slotReloadOrphaned()
3072
void KeyView::slotReloadOrphaned()
2890
{
3073
{
3074
// 	kdDebug(2100) << k_funcinfo << endl;
2891
        TQStringList issec;
3075
        TQStringList issec;
2892
        FILE *fp,*fp2;
3076
        FILE *fp,*fp2;
2893
        char line[300];
3077
        char line[300];
Lines 2923-2933 Link Here
2923
3107
2924
void KeyView::refreshcurrentkey(TQString currentID)
3108
void KeyView::refreshcurrentkey(TQString currentID)
2925
{
3109
{
3110
// 	kdDebug(2100) << k_funcinfo << endl;
2926
	if (currentID.isNull()) return;
3111
	if (currentID.isNull()) return;
2927
        UpdateViewItem *item=NULL;
2928
        TQString issec=TQString();
2929
        FILE *fp,*fp2;
3112
        FILE *fp,*fp2;
2930
        char line[300];
3113
        char line[300];
3114
	TQString issec=TQString();
3115
3116
        TQString defaultKey = KGpgSettings::defaultKey();
3117
        TQString currentKey;
3118
	TQMap<TQString,TQStringList> hashMap;
2931
3119
2932
        fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
3120
        fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r");
2933
        while ( fgets( line, sizeof(line), fp2)) {
3121
        while ( fgets( line, sizeof(line), fp2)) {
Lines 2937-2959 Link Here
2937
        }
3125
        }
2938
        pclose(fp2);
3126
        pclose(fp2);
2939
3127
2940
        TQString defaultKey = KGpgSettings::defaultKey();
3128
	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;
3129
        TQString cmd="gpg --no-secmem-warning --no-tty --with-colons --list-keys "+currentID;
2945
        fp = popen(TQFile::encodeName(cmd), "r");
3130
        fp = popen(TQFile::encodeName(cmd), "r");
2946
        while ( fgets( line, sizeof(line), fp)) {
3131
        while ( fgets( line, sizeof(line), fp)) {
2947
                tst=TQString::fromUtf8(line);
3132
                TQString tst=TQString::fromUtf8(line);
2948
                if (tst.startsWith("pub")) {
3133
                kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
2949
                        gpgKey pubKey=extractKey(tst);
3134
                if ( tst.startsWith("pub")  ) {
2950
                        keyFound=true;
3135
                	currentKey = tst.section(':',4,4);
3136
                	TQStringList lst; lst << tst;
3137
			hashMap.insert(currentKey,lst);
3138
                }
3139
		else
3140
			hashMap.find(currentKey).data().append(tst);
3141
3142
	}
3143
	pclose(fp);
3144
3145
// process the list
3146
3147
	TQMap<TQString,TQStringList>::Iterator ite;
3148
	for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
3149
		UpdateViewItem *item=NULL;
3150
		TQStringList::Iterator it;
3151
		gpgKey pubKey;
3152
		bool keyFound=false;
2951
                        bool isbold=false;
3153
                        bool isbold=false;
2952
                        bool isexpired=false;
3154
                        bool isexpired=false;
3155
3156
		for (it = ite.data().begin(); it != ite.data().end(); it++) {	
3157
			TQString tst =  (*it);
3158
			if ( tst.startsWith("pub") ){
3159
                        	keyFound=true;
3160
				pubKey=extractKey(tst);
2953
                        if (pubKey.gpgkeyid==defaultKey)
3161
                        if (pubKey.gpgkeyid==defaultKey)
2954
                                isbold=true;
3162
                                isbold=true;
2955
                        if (pubKey.gpgkeytrust==i18n("Expired"))
3163
                        if (pubKey.gpgkeytrust==i18n("Expired"))
2956
                                isexpired=true;
3164
                                isexpired=true;
3165
			}
3166
			if ( tst.startsWith("uid") && pubKey.gpgkeyname.isEmpty() ){
3167
				gpgKey tmpKey=extractKey(tst);
3168
				if (! tmpKey.gpgkeyname.isEmpty() ) pubKey.gpgkeyname = tmpKey.gpgkeyname;
3169
				if (! tmpKey.gpgkeymail.isEmpty() ) pubKey.gpgkeymail = tmpKey.gpgkeymail;
3170
			}
3171
		}
3172
2957
                        item=new UpdateViewItem(this,pubKey.gpgkeyname,pubKey.gpgkeymail,TQString(),pubKey.gpgkeyexpiration,pubKey.gpgkeysize,pubKey.gpgkeycreation,pubKey.gpgkeyid,isbold,isexpired);
3173
                        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);
3174
                        item->setPixmap(2,pubKey.trustpic);
2959
			item->setVisible(true);
3175
			item->setVisible(true);
Lines 2964-2972 Link Here
2964
                        } else {
3180
                        } else {
2965
                                item->setPixmap(0,pixkeySingle);
3181
                                item->setPixmap(0,pixkeySingle);
2966
                        }
3182
                        }
2967
                }
2968
        }
2969
        pclose(fp);
2970
3183
2971
        if (!keyFound) {
3184
        if (!keyFound) {
2972
                if (orphanList.find(currentID)==-1)
3185
                if (orphanList.find(currentID)==-1)
Lines 2979-2989 Link Here
2979
3192
2980
        clearSelection();
3193
        clearSelection();
2981
        setCurrentItem(item);
3194
        setCurrentItem(item);
3195
	}
2982
3196
2983
}
3197
}
2984
3198
2985
void KeyView::refreshcurrentkey(TQListViewItem *current)
3199
void KeyView::refreshcurrentkey(TQListViewItem *current)
2986
{
3200
{
3201
//	kdDebug(2100) << k_funcinfo << endl;
2987
        if (!current)
3202
        if (!current)
2988
                return;
3203
                return;
2989
        bool keyIsOpen=false;
3204
        bool keyIsOpen=false;
Lines 3002-3034 Link Here
3002
3217
3003
void KeyView::refreshTrust(int color,TQColor newColor)
3218
void KeyView::refreshTrust(int color,TQColor newColor)
3004
{
3219
{
3005
if (!newColor.isValid()) return;
3220
//	kdDebug(2100) << k_funcinfo << endl;
3006
TQPixmap blankFrame,newtrust;
3221
	if (!newColor.isValid()) return;
3007
int trustFinger=0;
3222
	TQPixmap blankFrame,newtrust;
3008
blankFrame.load(locate("appdata", "pics/kgpg_blank.png"));
3223
	int trustFinger=0;
3009
newtrust.load(locate("appdata", "pics/kgpg_fill.png"));
3224
	blankFrame.load(locate("appdata", "pics/kgpg_blank.png"));
3010
newtrust.fill(newColor);
3225
	newtrust.load(locate("appdata", "pics/kgpg_fill.png"));
3011
bitBlt(&newtrust,0,0,&blankFrame,0,0,50,15);
3226
	newtrust.fill(newColor);
3012
switch (color)
3227
	bitBlt(&newtrust,0,0,&blankFrame,0,0,50,15);
3013
{
3228
	switch (color)
3014
case GoodColor:
3229
	{
3015
trustFinger=trustgood.serialNumber();
3230
		case GoodColor:
3016
trustgood=newtrust;
3231
			trustFinger=trustgood.serialNumber();
3017
break;
3232
			trustgood=newtrust;
3018
case BadColor:
3233
			break;
3019
trustFinger=trustbad.serialNumber();
3234
		case BadColor:
3020
trustbad=newtrust;
3235
			trustFinger=trustbad.serialNumber();
3021
break;
3236
			trustbad=newtrust;
3022
case UnknownColor:
3237
			break;
3023
trustFinger=trustunknown.serialNumber();
3238
		case UnknownColor:
3024
trustunknown=newtrust;
3239
			trustFinger=trustunknown.serialNumber();
3025
break;
3240
			trustunknown=newtrust;
3026
case RevColor:
3241
			break;
3027
trustFinger=trustrevoked.serialNumber();
3242
		case RevColor:
3028
trustrevoked=newtrust;
3243
			trustFinger=trustrevoked.serialNumber();
3029
break;
3244
			trustrevoked=newtrust;
3030
}
3245
			break;
3031
TQListViewItem *item=firstChild();
3246
	}
3247
	TQListViewItem *item=firstChild();
3032
                while (item) {
3248
                while (item) {
3033
			if (item->pixmap(2))
3249
			if (item->pixmap(2))
3034
			{
3250
			{
Lines 3040-3052 Link Here
3040
3256
3041
gpgKey KeyView::extractKey(TQString keyColon)
3257
gpgKey KeyView::extractKey(TQString keyColon)
3042
{
3258
{
3259
//	kdDebug(2100) << k_funcinfo << "keyColon: " << keyColon<<endl;
3043
        TQStringList keyString=TQStringList::split(":",keyColon,true);
3260
        TQStringList keyString=TQStringList::split(":",keyColon,true);
3044
        gpgKey ret;
3045
3261
3262
        gpgKey ret;
3046
        ret.gpgkeysize=keyString[2];
3263
        ret.gpgkeysize=keyString[2];
3047
        ret.gpgkeycreation=keyString[5];
3264
        ret.gpgkeycreation=keyString[5];
3048
        if(!ret.gpgkeycreation.isEmpty()) {
3265
        if(!ret.gpgkeycreation.isEmpty()) {
3049
                TQDate date = TQDate::fromString(ret.gpgkeycreation, Qt::ISODate);
3266
                TQDate date;
3267
		if (KgpgInterface::getGpgVersion() >= 210 ) {
3268
			TQDateTime timestamp;
3269
			timestamp.setTime_t( ret.gpgkeycreation.toInt());
3270
			date = timestamp.date();
3271
		}
3272
		else {
3273
			date = TQDate::fromString(ret.gpgkeycreation, Qt::ISODate);
3274
		}
3275
		Q_ASSERT (date.isValid()) /*tqWarning("create date is not valid")*/;
3050
                ret.gpgkeycreation=TDEGlobal::locale()->formatDate(date, true);
3276
                ret.gpgkeycreation=TDEGlobal::locale()->formatDate(date, true);
3051
        }
3277
        }
3052
        TQString tid=keyString[4];
3278
        TQString tid=keyString[4];
Lines 3055-3064 Link Here
3055
        if (ret.gpgkeyexpiration.isEmpty())
3281
        if (ret.gpgkeyexpiration.isEmpty())
3056
                ret.gpgkeyexpiration=i18n("Unlimited");
3282
                ret.gpgkeyexpiration=i18n("Unlimited");
3057
        else {
3283
        else {
3058
                TQDate date = TQDate::fromString(ret.gpgkeyexpiration, Qt::ISODate);
3284
                TQDate date;
3285
		if (KgpgInterface::getGpgVersion() >= 210 ) {
3286
			TQDateTime timestamp;
3287
			timestamp.setTime_t(ret.gpgkeyexpiration.toInt());
3288
			date = timestamp.date();
3289
		}
3290
		else {
3291
                	date = TQDate::fromString(ret.gpgkeyexpiration, Qt::ISODate);
3292
		}
3293
		Q_ASSERT (date.isValid()) /*tqWarning("expire date is not valid")*/;
3059
                ret.gpgkeyexpiration=TDEGlobal::locale()->formatDate(date, true);
3294
                ret.gpgkeyexpiration=TDEGlobal::locale()->formatDate(date, true);
3060
        }
3295
        }
3296
3297
	// search for Fullname
3298
	if ( ! keyString[9].isEmpty() ) {
3299
		
3061
        TQString fullname=keyString[9];
3300
        TQString fullname=keyString[9];
3301
3062
        if (fullname.find("<")!=-1) {
3302
        if (fullname.find("<")!=-1) {
3063
                ret.gpgkeymail=fullname.section('<',-1,-1);
3303
                ret.gpgkeymail=fullname.section('<',-1,-1);
3064
                ret.gpgkeymail.truncate(ret.gpgkeymail.length()-1);
3304
                ret.gpgkeymail.truncate(ret.gpgkeymail.length()-1);
Lines 3069-3075 Link Here
3069
		ret.gpgkeyname=fullname;
3309
		ret.gpgkeyname=fullname;
3070
                //ret.gpgkeyname=fullname.section('(',0,0);
3310
                //ret.gpgkeyname=fullname.section('(',0,0);
3071
        }
3311
        }
3072
3312
	}
3073
        //ret.gpgkeyname=KgpgInterface::checkForUtf8(ret.gpgkeyname); // FIXME lukas
3313
        //ret.gpgkeyname=KgpgInterface::checkForUtf8(ret.gpgkeyname); // FIXME lukas
3074
3314
3075
        TQString algo=keyString[3];
3315
        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 (-14 / +46 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

Return to bug 2791