|
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 47-52
Link Here
|
| 47 |
#include <tqtoolbutton.h> |
51 |
#include <tqtoolbutton.h> |
| 48 |
#include <tqradiobutton.h> |
52 |
#include <tqradiobutton.h> |
| 49 |
#include <tqpopupmenu.h> |
53 |
#include <tqpopupmenu.h> |
|
|
54 |
#include <tqcursor.h> |
| 50 |
|
55 |
|
| 51 |
#include <kurlrequester.h> |
56 |
#include <kurlrequester.h> |
| 52 |
#include <tdeio/netaccess.h> |
57 |
#include <tdeio/netaccess.h> |
|
Lines 216-222
Link Here
|
| 216 |
KgpgSelKey::KgpgSelKey(TQWidget *parent, const char *name,bool allowMultipleSelection, TQString preselected): |
221 |
KgpgSelKey::KgpgSelKey(TQWidget *parent, const char *name,bool allowMultipleSelection, TQString preselected): |
| 217 |
KDialogBase( parent, name, true,i18n("Private Key List"),Ok | Cancel) |
222 |
KDialogBase( parent, name, true,i18n("Private Key List"),Ok | Cancel) |
| 218 |
{ |
223 |
{ |
| 219 |
TQString keyname; |
224 |
// not used ??? TQString keyname; |
| 220 |
page = new TQWidget(this); |
225 |
page = new TQWidget(this); |
| 221 |
TQLabel *labeltxt; |
226 |
TQLabel *labeltxt; |
| 222 |
TDEIconLoader *loader = TDEGlobal::iconLoader(); |
227 |
TDEIconLoader *loader = TDEGlobal::iconLoader(); |
|
Lines 239-266
Link Here
|
| 239 |
if (preselected==TQString()) preselected = KGpgSettings::defaultKey(); |
244 |
if (preselected==TQString()) preselected = KGpgSettings::defaultKey(); |
| 240 |
|
245 |
|
| 241 |
FILE *fp,*fp2; |
246 |
FILE *fp,*fp2; |
| 242 |
TQString fullname,tst,tst2; |
|
|
| 243 |
char line[300]; |
247 |
char line[300]; |
| 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 fullname,val,id; |
| 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 |
TQString tst2=TQString::fromUtf8(line); |
| 264 |
if (tst2.startsWith("pub")) { |
292 |
if (tst2.startsWith("pub")) { |
| 265 |
const TQString trust2=tst2.section(':',1,1); |
293 |
const TQString trust2=tst2.section(':',1,1); |
| 266 |
switch( trust2[0] ) { |
294 |
switch( trust2[0] ) { |
|
Lines 282-287
Link Here
|
| 282 |
} |
310 |
} |
| 283 |
} |
311 |
} |
| 284 |
pclose(fp2); |
312 |
pclose(fp2); |
|
|
313 |
} |
| 314 |
if ( tst.startsWith("uid") && fullname.isEmpty() ) |
| 315 |
fullname = tst.section(':',9,9); |
| 316 |
|
| 317 |
} |
| 318 |
|
| 285 |
if (!fullname.isEmpty() && (!dead)) { |
319 |
if (!fullname.isEmpty() && (!dead)) { |
| 286 |
TQString keyMail,keyName; |
320 |
TQString keyMail,keyName; |
| 287 |
if (fullname.find("<")!=-1) { |
321 |
if (fullname.find("<")!=-1) { |
|
Lines 295-301
Link Here
|
| 295 |
|
329 |
|
| 296 |
keyName=KgpgInterface::checkForUtf8(keyName); |
330 |
keyName=KgpgInterface::checkForUtf8(keyName); |
| 297 |
|
331 |
|
| 298 |
|
|
|
| 299 |
item=new TDEListViewItem(keysListpr,keyName,keyMail,id); |
332 |
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)); |
333 |
//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); |
334 |
TDEListViewItem *sub= new TDEListViewItem(item,i18n("Expiration:"),val); |
|
Lines 308-315
Link Here
|
| 308 |
} |
341 |
} |
| 309 |
} |
342 |
} |
| 310 |
} |
343 |
} |
| 311 |
} |
|
|
| 312 |
pclose(fp); |
| 313 |
|
344 |
|
| 314 |
if (warn) |
345 |
if (warn) |
| 315 |
{ |
346 |
{ |
|
Lines 395-400
Link Here
|
| 395 |
KeyView::KeyView( TQWidget *parent, const char *name ) |
426 |
KeyView::KeyView( TQWidget *parent, const char *name ) |
| 396 |
: TDEListView( parent, name ) |
427 |
: TDEListView( parent, name ) |
| 397 |
{ |
428 |
{ |
|
|
429 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 398 |
TDEIconLoader *loader = TDEGlobal::iconLoader(); |
430 |
TDEIconLoader *loader = TDEGlobal::iconLoader(); |
| 399 |
|
431 |
|
| 400 |
pixkeyOrphan=loader->loadIcon("kgpg_key4",TDEIcon::Small,20); |
432 |
pixkeyOrphan=loader->loadIcon("kgpg_key4",TDEIcon::Small,20); |
|
Lines 434-439
Link Here
|
| 434 |
|
466 |
|
| 435 |
void KeyView::droppedfile (KURL url) |
467 |
void KeyView::droppedfile (KURL url) |
| 436 |
{ |
468 |
{ |
|
|
469 |
// // 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) |
470 |
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; |
471 |
return; |
| 439 |
|
472 |
|
|
Lines 479-502
Link Here
|
| 479 |
mySearchLine::mySearchLine(TQWidget *parent, KeyView *listView, const char *name) |
512 |
mySearchLine::mySearchLine(TQWidget *parent, KeyView *listView, const char *name) |
| 480 |
:TDEListViewSearchLine(parent,listView,name) |
513 |
:TDEListViewSearchLine(parent,listView,name) |
| 481 |
{ |
514 |
{ |
| 482 |
searchListView=listView; |
515 |
searchListView=listView; |
| 483 |
setKeepParentsVisible(false); |
516 |
setKeepParentsVisible(false); |
| 484 |
} |
517 |
} |
| 485 |
|
518 |
|
| 486 |
mySearchLine::~ mySearchLine() |
519 |
mySearchLine::~ mySearchLine() |
| 487 |
{} |
520 |
{} |
| 488 |
|
521 |
|
| 489 |
|
|
|
| 490 |
bool mySearchLine::itemMatches(const TQListViewItem *item, const TQString & s) const |
522 |
bool mySearchLine::itemMatches(const TQListViewItem *item, const TQString & s) const |
| 491 |
{ |
523 |
{ |
| 492 |
if (item->depth()!=0) return true; |
524 |
if (item->depth()!=0) return true; |
| 493 |
else return TDEListViewSearchLine::itemMatches(item,s); |
525 |
else return TDEListViewSearchLine::itemMatches(item,s); |
| 494 |
} |
526 |
} |
| 495 |
|
527 |
|
| 496 |
|
|
|
| 497 |
|
| 498 |
void mySearchLine::updateSearch(const TQString& s) |
528 |
void mySearchLine::updateSearch(const TQString& s) |
| 499 |
{ |
529 |
{ |
|
|
530 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 500 |
TDEListViewSearchLine::updateSearch(s); |
531 |
TDEListViewSearchLine::updateSearch(s); |
| 501 |
if (searchListView->displayOnlySecret || !searchListView->displayDisabled) |
532 |
if (searchListView->displayOnlySecret || !searchListView->displayDisabled) |
| 502 |
{ |
533 |
{ |
|
Lines 521-528
Link Here
|
| 521 |
|
552 |
|
| 522 |
listKeys::listKeys(TQWidget *parent, const char *name) : DCOPObject( "KeyInterface" ), TDEMainWindow(parent, name,0) |
553 |
listKeys::listKeys(TQWidget *parent, const char *name) : DCOPObject( "KeyInterface" ), TDEMainWindow(parent, name,0) |
| 523 |
{ |
554 |
{ |
|
|
555 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 524 |
//KWin::setType(TQt::WDestructiveClose); |
556 |
//KWin::setType(TQt::WDestructiveClose); |
| 525 |
|
557 |
|
|
|
558 |
|
| 526 |
keysList2 = new KeyView(this); |
559 |
keysList2 = new KeyView(this); |
| 527 |
keysList2->photoKeysList=TQString(); |
560 |
keysList2->photoKeysList=TQString(); |
| 528 |
keysList2->groupNb=0; |
561 |
keysList2->groupNb=0; |
|
Lines 725-730
Link Here
|
| 725 |
connect(s_kgpgEditor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList))); |
758 |
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))); |
759 |
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))); |
760 |
connect(s_kgpgEditor->view->editor,TQT_SIGNAL(refreshImported(TQStringList)),keysList2,TQT_SLOT(slotReloadKeys(TQStringList))); |
|
|
761 |
|
| 762 |
|
| 763 |
// kdDebug(2100) << k_funcinfo << "getGpgversion" << KgpgInterface::getGpgVersion() <<endl; |
| 728 |
} |
764 |
} |
| 729 |
|
765 |
|
| 730 |
|
766 |
|
|
Lines 849-854
Link Here
|
| 849 |
|
885 |
|
| 850 |
void listKeys::refreshKeyFromServer() |
886 |
void listKeys::refreshKeyFromServer() |
| 851 |
{ |
887 |
{ |
|
|
888 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 852 |
if (keysList2->currentItem()==NULL) |
889 |
if (keysList2->currentItem()==NULL) |
| 853 |
return; |
890 |
return; |
| 854 |
TQString keyIDS; |
891 |
TQString keyIDS; |
|
Lines 874-879
Link Here
|
| 874 |
|
911 |
|
| 875 |
void listKeys::refreshFinished() |
912 |
void listKeys::refreshFinished() |
| 876 |
{ |
913 |
{ |
|
|
914 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 877 |
if (kServer) |
915 |
if (kServer) |
| 878 |
kServer=0L; |
916 |
kServer=0L; |
| 879 |
|
917 |
|
|
Lines 902-907
Link Here
|
| 902 |
|
940 |
|
| 903 |
void listKeys::slotregenerate() |
941 |
void listKeys::slotregenerate() |
| 904 |
{ |
942 |
{ |
|
|
943 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 905 |
FILE *fp; |
944 |
FILE *fp; |
| 906 |
TQString tst; |
945 |
TQString tst; |
| 907 |
char line[300]; |
946 |
char line[300]; |
|
Lines 1029-1034
Link Here
|
| 1029 |
|
1068 |
|
| 1030 |
void listKeys::findKey() |
1069 |
void listKeys::findKey() |
| 1031 |
{ |
1070 |
{ |
|
|
1071 |
//// kdDebug(2100) << k_funcinfo << endl; |
| 1032 |
KFindDialog fd(this,"find_dialog",0,""); |
1072 |
KFindDialog fd(this,"find_dialog",0,""); |
| 1033 |
if ( fd.exec() != TQDialog::Accepted ) |
1073 |
if ( fd.exec() != TQDialog::Accepted ) |
| 1034 |
return; |
1074 |
return; |
|
Lines 1039-1044
Link Here
|
| 1039 |
|
1079 |
|
| 1040 |
void listKeys::findFirstKey() |
1080 |
void listKeys::findFirstKey() |
| 1041 |
{ |
1081 |
{ |
|
|
1082 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1042 |
if (searchString.isEmpty()) |
1083 |
if (searchString.isEmpty()) |
| 1043 |
return; |
1084 |
return; |
| 1044 |
bool foundItem=true; |
1085 |
bool foundItem=true; |
|
Lines 1075-1080
Link Here
|
| 1075 |
|
1116 |
|
| 1076 |
void listKeys::findNextKey() |
1117 |
void listKeys::findNextKey() |
| 1077 |
{ |
1118 |
{ |
|
|
1119 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1078 |
//kdDebug(2100)<<"find next"<<endl; |
1120 |
//kdDebug(2100)<<"find next"<<endl; |
| 1079 |
if (searchString.isEmpty()) { |
1121 |
if (searchString.isEmpty()) { |
| 1080 |
findKey(); |
1122 |
findKey(); |
|
Lines 1119-1124
Link Here
|
| 1119 |
|
1161 |
|
| 1120 |
void listKeys::addToKAB() |
1162 |
void listKeys::addToKAB() |
| 1121 |
{ |
1163 |
{ |
|
|
1164 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1122 |
TDEABC::Key key; |
1165 |
TDEABC::Key key; |
| 1123 |
if (!keysList2->currentItem()) return; |
1166 |
if (!keysList2->currentItem()) return; |
| 1124 |
//TQString email=extractKeyMail(keysList2->currentItem()).stripWhiteSpace(); |
1167 |
//TQString email=extractKeyMail(keysList2->currentItem()).stripWhiteSpace(); |
|
Lines 1200-1205
Link Here
|
| 1200 |
|
1243 |
|
| 1201 |
void listKeys::showKeyServer() |
1244 |
void listKeys::showKeyServer() |
| 1202 |
{ |
1245 |
{ |
|
|
1246 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1203 |
keyServer *ks=new keyServer(this); |
1247 |
keyServer *ks=new keyServer(this); |
| 1204 |
connect(ks,TQT_SIGNAL( importFinished(TQString) ) , keysList2, TQT_SLOT(refreshcurrentkey(TQString))); |
1248 |
connect(ks,TQT_SIGNAL( importFinished(TQString) ) , keysList2, TQT_SLOT(refreshcurrentkey(TQString))); |
| 1205 |
ks->exec(); |
1249 |
ks->exec(); |
|
Lines 1211-1216
Link Here
|
| 1211 |
|
1255 |
|
| 1212 |
void listKeys::checkList() |
1256 |
void listKeys::checkList() |
| 1213 |
{ |
1257 |
{ |
|
|
1258 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1214 |
TQPtrList<TQListViewItem> exportList=keysList2->selectedItems(); |
1259 |
TQPtrList<TQListViewItem> exportList=keysList2->selectedItems(); |
| 1215 |
if (exportList.count()>1) |
1260 |
if (exportList.count()>1) |
| 1216 |
{ |
1261 |
{ |
|
Lines 1266-1271
Link Here
|
| 1266 |
void listKeys::readOptions() |
1311 |
void listKeys::readOptions() |
| 1267 |
{ |
1312 |
{ |
| 1268 |
|
1313 |
|
|
|
1314 |
// kdDebug(2100) << k_funcinfo << endl; |
| 1269 |
clipboardMode=TQClipboard::Clipboard; |
1315 |
clipboardMode=TQClipboard::Clipboard; |
| 1270 |
if (KGpgSettings::useMouseSelection() && (kapp->clipboard()->supportsSelection())) |
1316 |
if (KGpgSettings::useMouseSelection() && (kapp->clipboard()->supportsSelection())) |
| 1271 |
clipboardMode=TQClipboard::Selection; |
1317 |
clipboardMode=TQClipboard::Selection; |
|
Lines 1488-1493
Link Here
|
| 1488 |
|
1534 |
|
| 1489 |
void listKeys::slotexport() |
1535 |
void listKeys::slotexport() |
| 1490 |
{ |
1536 |
{ |
|
|
1537 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1491 |
///////////////////// export key |
1538 |
///////////////////// export key |
| 1492 |
if (keysList2->currentItem()==NULL) |
1539 |
if (keysList2->currentItem()==NULL) |
| 1493 |
return; |
1540 |
return; |
|
Lines 1599-1604
Link Here
|
| 1599 |
|
1646 |
|
| 1600 |
void listKeys::showKeyInfo(TQString keyID) |
1647 |
void listKeys::showKeyInfo(TQString keyID) |
| 1601 |
{ |
1648 |
{ |
|
|
1649 |
//// kdDebug(2100) << k_funcinfo << endl; |
| 1602 |
KgpgKeyInfo *opts=new KgpgKeyInfo(this,"key_props",keyID); |
1650 |
KgpgKeyInfo *opts=new KgpgKeyInfo(this,"key_props",keyID); |
| 1603 |
opts->show(); |
1651 |
opts->show(); |
| 1604 |
} |
1652 |
} |
|
Lines 1606-1621
Link Here
|
| 1606 |
|
1654 |
|
| 1607 |
void listKeys::slotShowPhoto() |
1655 |
void listKeys::slotShowPhoto() |
| 1608 |
{ |
1656 |
{ |
|
|
1657 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1609 |
TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'"); |
1658 |
TDETrader::OfferList offers = TDETrader::self()->query("image/jpeg", "Type == 'Application'"); |
| 1610 |
KService::Ptr ptr = offers.first(); |
1659 |
KService::Ptr ptr = offers.first(); |
| 1611 |
//KMessageBox::sorry(0,ptr->desktopEntryName()); |
1660 |
//KMessageBox::sorry(0,ptr->desktopEntryName()); |
| 1612 |
KProcIO *p=new KProcIO(TQTextCodec::codecForLocale()); |
1661 |
KProcIO *p=new KProcIO(TQTextCodec::codecForLocale()); |
| 1613 |
*p<<"gpg"<<"--no-tty"<<"--photo-viewer"<<TQString(TQFile::encodeName(ptr->desktopEntryName()+" %i"))<<"--edit-key"<<keysList2->currentItem()->parent()->text(6)<<"uid"<<keysList2->currentItem()->text(6)<<"showphoto"<<"quit"; |
1662 |
*p<<"gpg"<<"--no-tty" |
|
|
1663 |
<<"--photo-viewer"<<TQString(TQFile::encodeName(ptr->desktopEntryName()+" %i")) |
| 1664 |
<<"--edit-key"<<keysList2->currentItem()->parent()->text(6) |
| 1665 |
<<"uid"<<keysList2->currentItem()->text(6) |
| 1666 |
<<"showphoto"<<"quit"; |
| 1614 |
p->start(TDEProcess::DontCare,true); |
1667 |
p->start(TDEProcess::DontCare,true); |
| 1615 |
} |
1668 |
} |
| 1616 |
|
1669 |
|
| 1617 |
void listKeys::listsigns() |
1670 |
void listKeys::listsigns() |
| 1618 |
{ |
1671 |
{ |
|
|
1672 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1619 |
//kdDebug(2100)<<"Edit -------------------------------"<<endl; |
1673 |
//kdDebug(2100)<<"Edit -------------------------------"<<endl; |
| 1620 |
if (keysList2->currentItem()==NULL) |
1674 |
if (keysList2->currentItem()==NULL) |
| 1621 |
return; |
1675 |
return; |
|
Lines 1646-1651
Link Here
|
| 1646 |
|
1700 |
|
| 1647 |
void listKeys::groupAdd() |
1701 |
void listKeys::groupAdd() |
| 1648 |
{ |
1702 |
{ |
|
|
1703 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1649 |
TQPtrList<TQListViewItem> addList=gEdit->availableKeys->selectedItems(); |
1704 |
TQPtrList<TQListViewItem> addList=gEdit->availableKeys->selectedItems(); |
| 1650 |
for ( uint i = 0; i < addList.count(); ++i ) |
1705 |
for ( uint i = 0; i < addList.count(); ++i ) |
| 1651 |
if ( addList.at(i) ) { |
1706 |
if ( addList.at(i) ) { |
|
Lines 1655-1660
Link Here
|
| 1655 |
|
1710 |
|
| 1656 |
void listKeys::groupRemove() |
1711 |
void listKeys::groupRemove() |
| 1657 |
{ |
1712 |
{ |
|
|
1713 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1658 |
TQPtrList<TQListViewItem> remList=gEdit->groupKeys->selectedItems(); |
1714 |
TQPtrList<TQListViewItem> remList=gEdit->groupKeys->selectedItems(); |
| 1659 |
for ( uint i = 0; i < remList.count(); ++i ) |
1715 |
for ( uint i = 0; i < remList.count(); ++i ) |
| 1660 |
if ( remList.at(i) ) { |
1716 |
if ( remList.at(i) ) { |
|
Lines 1664-1669
Link Here
|
| 1664 |
|
1720 |
|
| 1665 |
void listKeys::deleteGroup() |
1721 |
void listKeys::deleteGroup() |
| 1666 |
{ |
1722 |
{ |
|
|
1723 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1667 |
if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty()) |
1724 |
if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty()) |
| 1668 |
return; |
1725 |
return; |
| 1669 |
|
1726 |
|
|
Lines 1686-1691
Link Here
|
| 1686 |
|
1743 |
|
| 1687 |
void listKeys::groupChange() |
1744 |
void listKeys::groupChange() |
| 1688 |
{ |
1745 |
{ |
|
|
1746 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1689 |
TQStringList selected; |
1747 |
TQStringList selected; |
| 1690 |
TQListViewItem *item=gEdit->groupKeys->firstChild(); |
1748 |
TQListViewItem *item=gEdit->groupKeys->firstChild(); |
| 1691 |
while (item) { |
1749 |
while (item) { |
|
Lines 1697-1702
Link Here
|
| 1697 |
|
1755 |
|
| 1698 |
void listKeys::createNewGroup() |
1756 |
void listKeys::createNewGroup() |
| 1699 |
{ |
1757 |
{ |
|
|
1758 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1700 |
TQStringList badkeys,keysGroup; |
1759 |
TQStringList badkeys,keysGroup; |
| 1701 |
|
1760 |
|
| 1702 |
if (keysList2->selectedItems().count()>0) { |
1761 |
if (keysList2->selectedItems().count()>0) { |
|
Lines 1745-1751
Link Here
|
| 1745 |
|
1804 |
|
| 1746 |
void listKeys::groupInit(TQStringList keysGroup) |
1805 |
void listKeys::groupInit(TQStringList keysGroup) |
| 1747 |
{ |
1806 |
{ |
| 1748 |
kdDebug(2100)<<"preparing group"<<endl; |
1807 |
// // kdDebug(2100) << k_funcinfo << endl; |
|
|
1808 |
// kdDebug(2100)<<"preparing group"<<endl; |
| 1749 |
TQStringList lostKeys; |
1809 |
TQStringList lostKeys; |
| 1750 |
bool foundId; |
1810 |
bool foundId; |
| 1751 |
|
1811 |
|
|
Lines 1754-1760
Link Here
|
| 1754 |
TQListViewItem *item=gEdit->availableKeys->firstChild(); |
1814 |
TQListViewItem *item=gEdit->availableKeys->firstChild(); |
| 1755 |
foundId=false; |
1815 |
foundId=false; |
| 1756 |
while (item) { |
1816 |
while (item) { |
| 1757 |
kdDebug(2100)<<"Searching in key: "<<item->text(0)<<endl; |
1817 |
// kdDebug(2100)<<"Searching in key: "<<item->text(0)<<endl; |
| 1758 |
if (TQString(*it).right(8).lower()==item->text(2).right(8).lower()) { |
1818 |
if (TQString(*it).right(8).lower()==item->text(2).right(8).lower()) { |
| 1759 |
gEdit->groupKeys->insertItem(item); |
1819 |
gEdit->groupKeys->insertItem(item); |
| 1760 |
foundId=true; |
1820 |
foundId=true; |
|
Lines 1771-1776
Link Here
|
| 1771 |
|
1831 |
|
| 1772 |
void listKeys::editGroup() |
1832 |
void listKeys::editGroup() |
| 1773 |
{ |
1833 |
{ |
|
|
1834 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1774 |
if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty()) |
1835 |
if (!keysList2->currentItem() || !keysList2->currentItem()->text(6).isEmpty()) |
| 1775 |
return; |
1836 |
return; |
| 1776 |
TQStringList keysGroup; |
1837 |
TQStringList keysGroup; |
|
Lines 1826-1831
Link Here
|
| 1826 |
|
1887 |
|
| 1827 |
void listKeys::signkey() |
1888 |
void listKeys::signkey() |
| 1828 |
{ |
1889 |
{ |
|
|
1890 |
// >> HERE |
| 1891 |
// kdDebug(2100) << k_funcinfo << endl; |
| 1829 |
/////////////// sign a key |
1892 |
/////////////// sign a key |
| 1830 |
if (keysList2->currentItem()==NULL) |
1893 |
if (keysList2->currentItem()==NULL) |
| 1831 |
return; |
1894 |
return; |
|
Lines 1833-1849
Link Here
|
| 1833 |
return; |
1896 |
return; |
| 1834 |
|
1897 |
|
| 1835 |
signList=keysList2->selectedItems(); |
1898 |
signList=keysList2->selectedItems(); |
|
|
1899 |
|
| 1900 |
for ( uint i = 0; i < signList.count(); ++i ) { |
| 1901 |
// kdDebug(2100) << k_funcinfo << "List at: " << signList.at(i)->text(6) << endl; |
| 1902 |
} |
| 1903 |
|
| 1836 |
bool keyDepth=true; |
1904 |
bool keyDepth=true; |
| 1837 |
for ( uint i = 0; i < signList.count(); ++i ) |
1905 |
for ( uint i = 0; i < signList.count(); ++i ) { |
| 1838 |
if ( signList.at(i) ) |
1906 |
if ( signList.at(i) ) |
| 1839 |
if (signList.at(i)->depth()!=0) |
1907 |
if (signList.at(i)->depth()!=0) |
| 1840 |
keyDepth=false; |
1908 |
keyDepth=false; |
|
|
1909 |
// kdDebug(2100) << k_funcinfo << "List at: " << signList.at(i)->text(6) << endl; |
| 1910 |
} |
| 1841 |
if (!keyDepth) { |
1911 |
if (!keyDepth) { |
| 1842 |
KMessageBox::sorry(this,i18n("You can only sign primary keys. Please check your selection.")); |
1912 |
KMessageBox::sorry(this,i18n("You can only sign primary keys. Please check your selection.")); |
| 1843 |
return; |
1913 |
return; |
| 1844 |
} |
1914 |
} |
| 1845 |
|
1915 |
|
| 1846 |
|
|
|
| 1847 |
if (signList.count()==1) { |
1916 |
if (signList.count()==1) { |
| 1848 |
FILE *pass; |
1917 |
FILE *pass; |
| 1849 |
char line[200]=""; |
1918 |
char line[200]=""; |
|
Lines 1859-1864
Link Here
|
| 1859 |
if ((len > 0) && (len % 4 == 0)) |
1928 |
if ((len > 0) && (len % 4 == 0)) |
| 1860 |
for (uint n = 0; 4*(n+1) < len; n++) |
1929 |
for (uint n = 0; 4*(n+1) < len; n++) |
| 1861 |
fingervalue.insert(5*n+4, ' '); |
1930 |
fingervalue.insert(5*n+4, ' '); |
|
|
1931 |
break; |
| 1862 |
} |
1932 |
} |
| 1863 |
} |
1933 |
} |
| 1864 |
pclose(pass); |
1934 |
pclose(pass); |
|
Lines 1916-1921
Link Here
|
| 1916 |
keyCount=0; |
1986 |
keyCount=0; |
| 1917 |
delete opts; |
1987 |
delete opts; |
| 1918 |
globalCount=signList.count(); |
1988 |
globalCount=signList.count(); |
|
|
1989 |
|
| 1990 |
// kdDebug(2100) << k_funcinfo << "Terminal sign checked: " << terminalSign->isChecked() << endl; |
| 1991 |
// kdDebug(2100) << k_funcinfo << "globalCount : " << globalCount << endl; |
| 1992 |
// kdDebug(2100) << k_funcinfo << "signList Count : " << globalCount << endl; |
| 1993 |
|
| 1919 |
if (!terminalSign->isChecked()) |
1994 |
if (!terminalSign->isChecked()) |
| 1920 |
signLoop(); |
1995 |
signLoop(); |
| 1921 |
else { |
1996 |
else { |
|
Lines 1924-1949
Link Here
|
| 1924 |
TDEConfig *config = TDEGlobal::config(); |
1999 |
TDEConfig *config = TDEGlobal::config(); |
| 1925 |
config->setGroup("General"); |
2000 |
config->setGroup("General"); |
| 1926 |
kp<< config->readPathEntry("TerminalApplication","konsole"); |
2001 |
kp<< config->readPathEntry("TerminalApplication","konsole"); |
| 1927 |
kp<<"-e" |
2002 |
kp<<"-e" <<"gpg" <<"--no-secmem-warning" |
| 1928 |
<<"gpg" |
2003 |
<<"-u" <<globalkeyID <<"--edit-key" <<signList.at(0)->text(6); |
| 1929 |
<<"--no-secmem-warning" |
|
|
| 1930 |
<<"-u" |
| 1931 |
<<globalkeyID |
| 1932 |
<<"--edit-key" |
| 1933 |
<<signList.at(0)->text(6); |
| 1934 |
if (globalisLocal) |
2004 |
if (globalisLocal) |
| 1935 |
kp<<"lsign"; |
2005 |
kp<<"lsign"; |
| 1936 |
else |
2006 |
else |
| 1937 |
kp<<"sign"; |
2007 |
kp<<"sign"; |
|
|
2008 |
|
| 2009 |
TQApplication::setOverrideCursor(TQCursor(TQt::BusyCursor)); |
| 1938 |
kp.start(TDEProcess::Block); |
2010 |
kp.start(TDEProcess::Block); |
| 1939 |
keysList2->refreshcurrentkey(keysList2->currentItem()); |
2011 |
keysList2->refreshcurrentkey(keysList2->currentItem()); |
|
|
2012 |
TQApplication::restoreOverrideCursor(); |
| 1940 |
} |
2013 |
} |
| 1941 |
} |
2014 |
} |
| 1942 |
|
2015 |
|
| 1943 |
void listKeys::signLoop() |
2016 |
void listKeys::signLoop() |
| 1944 |
{ |
2017 |
{ |
|
|
2018 |
|
| 2019 |
// >> HERE |
| 2020 |
// kdDebug(2100) << k_funcinfo << endl; |
| 1945 |
if (keyCount<globalCount) { |
2021 |
if (keyCount<globalCount) { |
| 1946 |
kdDebug(2100)<<"Sign process for key: "<<keyCount<<" on a total of "<<signList.count()<<endl; |
2022 |
// kdDebug(2100)<<"Sign process for key: "<<keyCount<<" on a total of "<<signList.count()<<endl; |
| 1947 |
if ( signList.at(keyCount) ) { |
2023 |
if ( signList.at(keyCount) ) { |
| 1948 |
KgpgInterface *signKeyProcess=new KgpgInterface(); |
2024 |
KgpgInterface *signKeyProcess=new KgpgInterface(); |
| 1949 |
TQObject::connect(signKeyProcess,TQT_SIGNAL(signatureFinished(int)),TQT_TQOBJECT(this),TQT_SLOT(signatureResult(int))); |
2025 |
TQObject::connect(signKeyProcess,TQT_SIGNAL(signatureFinished(int)),TQT_TQOBJECT(this),TQT_SLOT(signatureResult(int))); |
|
Lines 1954-1962
Link Here
|
| 1954 |
|
2030 |
|
| 1955 |
void listKeys::signatureResult(int success) |
2031 |
void listKeys::signatureResult(int success) |
| 1956 |
{ |
2032 |
{ |
| 1957 |
if (success==3) |
2033 |
// kdDebug(2100) << k_funcinfo << endl; |
|
|
2034 |
// kdDebug(2100) << k_funcinfo << "success" << success << endl; |
| 2035 |
if ( success>=3 ) |
| 1958 |
keysList2->refreshcurrentkey(signList.at(keyCount)); |
2036 |
keysList2->refreshcurrentkey(signList.at(keyCount)); |
| 1959 |
|
|
|
| 1960 |
else if (success==2) |
2037 |
else if (success==2) |
| 1961 |
KMessageBox::sorry(this,i18n("<qt>Bad passphrase, key <b>%1</b> not signed.</qt>").arg(signList.at(keyCount)->text(0)+i18n(" (")+signList.at(keyCount)->text(1)+i18n(")"))); |
2038 |
KMessageBox::sorry(this,i18n("<qt>Bad passphrase, key <b>%1</b> not signed.</qt>").arg(signList.at(keyCount)->text(0)+i18n(" (")+signList.at(keyCount)->text(1)+i18n(")"))); |
| 1962 |
|
2039 |
|
|
Lines 1967-1972
Link Here
|
| 1967 |
|
2044 |
|
| 1968 |
void listKeys::importallsignkey() |
2045 |
void listKeys::importallsignkey() |
| 1969 |
{ |
2046 |
{ |
|
|
2047 |
//// kdDebug(2100) << k_funcinfo << endl; |
| 1970 |
if (keysList2->currentItem()==NULL) |
2048 |
if (keysList2->currentItem()==NULL) |
| 1971 |
return; |
2049 |
return; |
| 1972 |
if (! keysList2->currentItem()->firstChild()) { |
2050 |
if (! keysList2->currentItem()->firstChild()) { |
|
Lines 1989-1994
Link Here
|
| 1989 |
|
2067 |
|
| 1990 |
void listKeys::preimportsignkey() |
2068 |
void listKeys::preimportsignkey() |
| 1991 |
{ |
2069 |
{ |
|
|
2070 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 1992 |
if (keysList2->currentItem()==NULL) |
2071 |
if (keysList2->currentItem()==NULL) |
| 1993 |
return; |
2072 |
return; |
| 1994 |
else |
2073 |
else |
|
Lines 1997-2003
Link Here
|
| 1997 |
|
2076 |
|
| 1998 |
bool listKeys::importRemoteKey(TQString keyID) |
2077 |
bool listKeys::importRemoteKey(TQString keyID) |
| 1999 |
{ |
2078 |
{ |
| 2000 |
|
2079 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2001 |
kServer=new keyServer(0,"server_dialog",false,true); |
2080 |
kServer=new keyServer(0,"server_dialog",false,true); |
| 2002 |
kServer->page->kLEimportid->setText(keyID); |
2081 |
kServer->page->kLEimportid->setText(keyID); |
| 2003 |
kServer->page->Buttonimport->setDefault(true); |
2082 |
kServer->page->Buttonimport->setDefault(true); |
|
Lines 2013-2018
Link Here
|
| 2013 |
|
2092 |
|
| 2014 |
void listKeys::dcopImportFinished() |
2093 |
void listKeys::dcopImportFinished() |
| 2015 |
{ |
2094 |
{ |
|
|
2095 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2016 |
if (kServer) |
2096 |
if (kServer) |
| 2017 |
kServer=0L; |
2097 |
kServer=0L; |
| 2018 |
TQByteArray params; |
2098 |
TQByteArray params; |
|
Lines 2024-2034
Link Here
|
| 2024 |
|
2104 |
|
| 2025 |
void listKeys::importsignkey(TQString importKeyId) |
2105 |
void listKeys::importsignkey(TQString importKeyId) |
| 2026 |
{ |
2106 |
{ |
|
|
2107 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2027 |
/////////////// sign a key |
2108 |
/////////////// sign a key |
| 2028 |
kServer=new keyServer(0,"server_dialog",false); |
2109 |
kServer=new keyServer(0,"server_dialog",false); |
| 2029 |
kServer->page->kLEimportid->setText(importKeyId); |
2110 |
kServer->page->kLEimportid->setText(importKeyId); |
| 2030 |
//kServer->Buttonimport->setDefault(true); |
2111 |
//kServer->Buttonimport->setDefault(true); |
| 2031 |
kServer->slotImport(); |
2112 |
kServer->slotImport(); |
|
|
2113 |
// kServer->slotSearch(); |
| 2032 |
//kServer->show(); |
2114 |
//kServer->show(); |
| 2033 |
connect( kServer, TQT_SIGNAL( importFinished(TQString) ) , this, TQT_SLOT( importfinished())); |
2115 |
connect( kServer, TQT_SIGNAL( importFinished(TQString) ) , this, TQT_SLOT( importfinished())); |
| 2034 |
} |
2116 |
} |
|
Lines 2036-2041
Link Here
|
| 2036 |
|
2118 |
|
| 2037 |
void listKeys::importfinished() |
2119 |
void listKeys::importfinished() |
| 2038 |
{ |
2120 |
{ |
|
|
2121 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2039 |
if (kServer) |
2122 |
if (kServer) |
| 2040 |
kServer=0L; |
2123 |
kServer=0L; |
| 2041 |
refreshkey(); |
2124 |
refreshkey(); |
|
Lines 2044-2053
Link Here
|
| 2044 |
|
2127 |
|
| 2045 |
void listKeys::delsignkey() |
2128 |
void listKeys::delsignkey() |
| 2046 |
{ |
2129 |
{ |
|
|
2130 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2047 |
/////////////// sign a key |
2131 |
/////////////// sign a key |
| 2048 |
if (keysList2->currentItem()==NULL) |
2132 |
if (keysList2->currentItem()==NULL) |
| 2049 |
return; |
2133 |
return; |
| 2050 |
if (keysList2->currentItem()->depth()>1) { |
2134 |
if ( (keysList2->currentItem()->depth()>1 && KgpgInterface::getGpgVersion() < 210 ) |
|
|
2135 |
|| (keysList2->currentItem()->depth()>2 && KgpgInterface::getGpgVersion() >= 210 ) ) { |
| 2051 |
KMessageBox::sorry(this,i18n("Edit key manually to delete this signature.")); |
2136 |
KMessageBox::sorry(this,i18n("Edit key manually to delete this signature.")); |
| 2052 |
return; |
2137 |
return; |
| 2053 |
} |
2138 |
} |
|
Lines 2055-2063
Link Here
|
| 2055 |
TQString signID,parentKey,signMail,parentMail; |
2140 |
TQString signID,parentKey,signMail,parentMail; |
| 2056 |
|
2141 |
|
| 2057 |
////////////////// open a key selection dialog (KgpgSelKey, see begining of this file) |
2142 |
////////////////// open a key selection dialog (KgpgSelKey, see begining of this file) |
| 2058 |
parentKey=keysList2->currentItem()->parent()->text(6); |
2143 |
parentKey=( KgpgInterface::getGpgVersion() < 210 ) ? keysList2->currentItem()->parent()->text(6) : keysList2->currentItem()->parent()->parent()->text(6); |
| 2059 |
signID=keysList2->currentItem()->text(6); |
2144 |
signID=keysList2->currentItem()->text(6); |
| 2060 |
parentMail=keysList2->currentItem()->parent()->text(0)+" ("+keysList2->currentItem()->parent()->text(1)+")"; |
2145 |
parentMail=( KgpgInterface::getGpgVersion() < 210 ) ? keysList2->currentItem()->parent()->text(0)+" ("+keysList2->currentItem()->parent()->text(1)+")" : keysList2->currentItem()->parent()->parent()->text(0)+" ("+keysList2->currentItem()->parent()->parent()->text(1)+")"; |
| 2061 |
signMail=keysList2->currentItem()->text(0)+" ("+keysList2->currentItem()->text(1)+")"; |
2146 |
signMail=keysList2->currentItem()->text(0)+" ("+keysList2->currentItem()->text(1)+")"; |
| 2062 |
|
2147 |
|
| 2063 |
if (parentKey==signID) { |
2148 |
if (parentKey==signID) { |
|
Lines 2075-2080
Link Here
|
| 2075 |
|
2160 |
|
| 2076 |
void listKeys::delsignatureResult(bool success) |
2161 |
void listKeys::delsignatureResult(bool success) |
| 2077 |
{ |
2162 |
{ |
|
|
2163 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2078 |
if (success) { |
2164 |
if (success) { |
| 2079 |
TQListViewItem *top=keysList2->currentItem(); |
2165 |
TQListViewItem *top=keysList2->currentItem(); |
| 2080 |
while (top->depth()!=0) |
2166 |
while (top->depth()!=0) |
|
Lines 2088-2093
Link Here
|
| 2088 |
|
2174 |
|
| 2089 |
void listKeys::slotedit() |
2175 |
void listKeys::slotedit() |
| 2090 |
{ |
2176 |
{ |
|
|
2177 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2091 |
if (!keysList2->currentItem()) |
2178 |
if (!keysList2->currentItem()) |
| 2092 |
return; |
2179 |
return; |
| 2093 |
if (keysList2->currentItem()->depth()!=0) |
2180 |
if (keysList2->currentItem()->depth()!=0) |
|
Lines 2100-2111
Link Here
|
| 2100 |
TDEConfig *config = TDEGlobal::config(); |
2187 |
TDEConfig *config = TDEGlobal::config(); |
| 2101 |
config->setGroup("General"); |
2188 |
config->setGroup("General"); |
| 2102 |
kp<< config->readPathEntry("TerminalApplication","konsole"); |
2189 |
kp<< config->readPathEntry("TerminalApplication","konsole"); |
| 2103 |
kp<<"-e" |
2190 |
kp<<"-e" <<"gpg" <<"--no-secmem-warning" <<"--utf8-strings" |
| 2104 |
<<"gpg" |
2191 |
<<"--edit-key" <<keysList2->currentItem()->text(6) |
| 2105 |
<<"--no-secmem-warning" |
|
|
| 2106 |
<<"--utf8-strings" |
| 2107 |
<<"--edit-key" |
| 2108 |
<<keysList2->currentItem()->text(6) |
| 2109 |
<<"help"; |
2192 |
<<"help"; |
| 2110 |
kp.start(TDEProcess::Block); |
2193 |
kp.start(TDEProcess::Block); |
| 2111 |
keysList2->refreshcurrentkey(keysList2->currentItem()); |
2194 |
keysList2->refreshcurrentkey(keysList2->currentItem()); |
|
Lines 2114-2119
Link Here
|
| 2114 |
|
2197 |
|
| 2115 |
void listKeys::slotgenkey() |
2198 |
void listKeys::slotgenkey() |
| 2116 |
{ |
2199 |
{ |
|
|
2200 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2117 |
////////// generate key |
2201 |
////////// generate key |
| 2118 |
keyGenerate *genkey=new keyGenerate(this,0); |
2202 |
keyGenerate *genkey=new keyGenerate(this,0); |
| 2119 |
if (genkey->exec()==TQDialog::Accepted) { |
2203 |
if (genkey->exec()==TQDialog::Accepted) { |
|
Lines 2230-2252
Link Here
|
| 2230 |
|
2314 |
|
| 2231 |
void listKeys::readgenprocess(KProcIO *p) |
2315 |
void listKeys::readgenprocess(KProcIO *p) |
| 2232 |
{ |
2316 |
{ |
|
|
2317 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2233 |
TQString required; |
2318 |
TQString required; |
| 2234 |
while (p->readln(required,true)!=-1) { |
2319 |
while (p->readln(required,true)!=-1) { |
| 2235 |
if (required.find("KEY_CREATED")!=-1) |
2320 |
if (required.find("KEY_CREATED")!=-1) |
| 2236 |
newkeyFinger=required.stripWhiteSpace().section(' ',-1); |
2321 |
newkeyFinger=required.stripWhiteSpace().section(' ',-1); |
| 2237 |
message+=required+"\n"; |
2322 |
message+=required+"\n"; |
| 2238 |
} |
2323 |
} |
| 2239 |
|
|
|
| 2240 |
// sample: [GNUPG:] KEY_CREATED B 156A4305085A58C01E2988229282910254D1B368 |
2324 |
// sample: [GNUPG:] KEY_CREATED B 156A4305085A58C01E2988229282910254D1B368 |
| 2241 |
} |
2325 |
} |
| 2242 |
|
2326 |
|
| 2243 |
void listKeys::genover(TDEProcess *) |
2327 |
void listKeys::genover(TDEProcess *) |
| 2244 |
{ |
2328 |
{ |
|
|
2329 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2245 |
newkeyID=TQString(); |
2330 |
newkeyID=TQString(); |
| 2246 |
continueSearch=true; |
2331 |
continueSearch=true; |
| 2247 |
KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale()); |
2332 |
KProcIO *conprocess=new KProcIO(TQTextCodec::codecForLocale()); |
|
|
2333 |
TQString fpropt = (KgpgInterface::getGpgVersion() < 210 ) ? "--fingerprint" : "--with-fingerprint"; |
| 2248 |
*conprocess<< "gpg"; |
2334 |
*conprocess<< "gpg"; |
| 2249 |
*conprocess<<"--no-secmem-warning"<<"--with-colons"<<"--fingerprint"<<"--list-keys"<<newKeyName; |
2335 |
*conprocess<<"--no-secmem-warning" |
|
|
2336 |
<<"--with-colons" |
| 2337 |
<< fpropt |
| 2338 |
<<"--list-keys"<<newKeyName; |
| 2250 |
TQObject::connect(conprocess,TQT_SIGNAL(readReady(KProcIO *)),TQT_TQOBJECT(this),TQT_SLOT(slotReadFingerProcess(KProcIO *))); |
2339 |
TQObject::connect(conprocess,TQT_SIGNAL(readReady(KProcIO *)),TQT_TQOBJECT(this),TQT_SLOT(slotReadFingerProcess(KProcIO *))); |
| 2251 |
TQObject::connect(conprocess, TQT_SIGNAL(processExited(TDEProcess *)),TQT_TQOBJECT(this), TQT_SLOT(newKeyDone(TDEProcess *))); |
2340 |
TQObject::connect(conprocess, TQT_SIGNAL(processExited(TDEProcess *)),TQT_TQOBJECT(this), TQT_SLOT(newKeyDone(TDEProcess *))); |
| 2252 |
conprocess->start(TDEProcess::NotifyOnExit,true); |
2341 |
conprocess->start(TDEProcess::NotifyOnExit,true); |
|
Lines 2255-2270
Link Here
|
| 2255 |
|
2344 |
|
| 2256 |
void listKeys::slotReadFingerProcess(KProcIO *p) |
2345 |
void listKeys::slotReadFingerProcess(KProcIO *p) |
| 2257 |
{ |
2346 |
{ |
|
|
2347 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2258 |
TQString outp; |
2348 |
TQString outp; |
| 2259 |
while (p->readln(outp)!=-1) { |
2349 |
while (p->readln(outp)!=-1) { |
| 2260 |
if (outp.startsWith("pub") && (continueSearch)) { |
2350 |
if ( outp.startsWith("pub") && (continueSearch)) { |
| 2261 |
newkeyID=outp.section(':',4,4).right(8).prepend("0x"); |
2351 |
newkeyID=outp.section(':',4,4).right(8).prepend("0x"); |
| 2262 |
|
2352 |
|
| 2263 |
} |
2353 |
} |
| 2264 |
if (outp.startsWith("fpr")) { |
2354 |
if (outp.startsWith("fpr")) { |
| 2265 |
if (newkeyFinger.lower()==outp.section(':',9,9).lower()) |
2355 |
if (newkeyFinger.lower()==outp.section(':',9,9).lower()) |
| 2266 |
continueSearch=false; |
2356 |
continueSearch=false; |
| 2267 |
// kdDebug(2100)<<newkeyFinger<<" test:"<<outp.section(':',9,9)<<endl; |
2357 |
// // kdDebug(2100)<<newkeyFinger<<" test:"<<outp.section(':',9,9)<<endl; |
| 2268 |
} |
2358 |
} |
| 2269 |
} |
2359 |
} |
| 2270 |
} |
2360 |
} |
|
Lines 2272-2277
Link Here
|
| 2272 |
|
2362 |
|
| 2273 |
void listKeys::newKeyDone(TDEProcess *) |
2363 |
void listKeys::newKeyDone(TDEProcess *) |
| 2274 |
{ |
2364 |
{ |
|
|
2365 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2275 |
changeMessage(i18n("Ready"),0); |
2366 |
changeMessage(i18n("Ready"),0); |
| 2276 |
// refreshkey(); |
2367 |
// refreshkey(); |
| 2277 |
if (newkeyID.isEmpty()) { |
2368 |
if (newkeyID.isEmpty()) { |
|
Lines 2321-2326
Link Here
|
| 2321 |
|
2412 |
|
| 2322 |
void listKeys::doFilePrint(TQString url) |
2413 |
void listKeys::doFilePrint(TQString url) |
| 2323 |
{ |
2414 |
{ |
|
|
2415 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2324 |
TQFile qfile(url); |
2416 |
TQFile qfile(url); |
| 2325 |
if (qfile.open(IO_ReadOnly)) { |
2417 |
if (qfile.open(IO_ReadOnly)) { |
| 2326 |
TQTextStream t( &qfile ); |
2418 |
TQTextStream t( &qfile ); |
|
Lines 2331-2336
Link Here
|
| 2331 |
|
2423 |
|
| 2332 |
void listKeys::doPrint(TQString txt) |
2424 |
void listKeys::doPrint(TQString txt) |
| 2333 |
{ |
2425 |
{ |
|
|
2426 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2334 |
KPrinter prt; |
2427 |
KPrinter prt; |
| 2335 |
//kdDebug(2100)<<"Printing..."<<endl; |
2428 |
//kdDebug(2100)<<"Printing..."<<endl; |
| 2336 |
if (prt.setup(this)) { |
2429 |
if (prt.setup(this)) { |
|
Lines 2355-2362
Link Here
|
| 2355 |
TDEConfig *config = TDEGlobal::config(); |
2448 |
TDEConfig *config = TDEGlobal::config(); |
| 2356 |
config->setGroup("General"); |
2449 |
config->setGroup("General"); |
| 2357 |
*conprocess<< config->readPathEntry("TerminalApplication","konsole"); |
2450 |
*conprocess<< config->readPathEntry("TerminalApplication","konsole"); |
| 2358 |
*conprocess<<"-e"<<"gpg" |
2451 |
*conprocess<<"-e"<<"gpg" <<"--no-secmem-warning" |
| 2359 |
<<"--no-secmem-warning" |
|
|
| 2360 |
<<"--delete-secret-key"<<keysList2->currentItem()->text(6); |
2452 |
<<"--delete-secret-key"<<keysList2->currentItem()->text(6); |
| 2361 |
TQObject::connect(conprocess, TQT_SIGNAL(processExited(TDEProcess *)),TQT_TQOBJECT(this), TQT_SLOT(reloadSecretKeys())); |
2453 |
TQObject::connect(conprocess, TQT_SIGNAL(processExited(TDEProcess *)),TQT_TQOBJECT(this), TQT_SLOT(reloadSecretKeys())); |
| 2362 |
conprocess->start(TDEProcess::NotifyOnExit,TDEProcess::AllOutput); |
2454 |
conprocess->start(TDEProcess::NotifyOnExit,TDEProcess::AllOutput); |
|
Lines 2364-2369
Link Here
|
| 2364 |
|
2456 |
|
| 2365 |
void listKeys::reloadSecretKeys() |
2457 |
void listKeys::reloadSecretKeys() |
| 2366 |
{ |
2458 |
{ |
|
|
2459 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2367 |
FILE *fp; |
2460 |
FILE *fp; |
| 2368 |
char line[300]; |
2461 |
char line[300]; |
| 2369 |
keysList2->secretList=TQString(); |
2462 |
keysList2->secretList=TQString(); |
|
Lines 2379-2384
Link Here
|
| 2379 |
|
2472 |
|
| 2380 |
void listKeys::confirmdeletekey() |
2473 |
void listKeys::confirmdeletekey() |
| 2381 |
{ |
2474 |
{ |
|
|
2475 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2382 |
if (keysList2->currentItem()->depth()!=0) { |
2476 |
if (keysList2->currentItem()->depth()!=0) { |
| 2383 |
if ((keysList2->currentItem()->depth()==1) && (keysList2->currentItem()->text(4)=="-") && (keysList2->currentItem()->text(6).startsWith("0x"))) |
2477 |
if ((keysList2->currentItem()->depth()==1) && (keysList2->currentItem()->text(4)=="-") && (keysList2->currentItem()->text(6).startsWith("0x"))) |
| 2384 |
delsignkey(); |
2478 |
delsignkey(); |
|
Lines 2422-2445
Link Here
|
| 2422 |
|
2516 |
|
| 2423 |
void listKeys::deletekey() |
2517 |
void listKeys::deletekey() |
| 2424 |
{ |
2518 |
{ |
|
|
2519 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2425 |
TQPtrList<TQListViewItem> exportList=keysList2->selectedItems(); |
2520 |
TQPtrList<TQListViewItem> exportList=keysList2->selectedItems(); |
|
|
2521 |
// kdDebug(2100) << k_funcinfo << "Delete list count: " << exportList.count() << endl; |
| 2426 |
if (exportList.count()==0) |
2522 |
if (exportList.count()==0) |
| 2427 |
return; |
2523 |
return; |
| 2428 |
TDEProcess gp; |
2524 |
TDEProcess gp; |
| 2429 |
gp << "gpg" |
2525 |
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 ) |
2526 |
for ( uint i = 0; i < exportList.count(); ++i ) |
| 2436 |
if ( exportList.at(i) ) |
2527 |
if ( exportList.at(i) ) |
| 2437 |
gp<<(exportList.at(i)->text(6)).stripWhiteSpace(); |
2528 |
gp<<(exportList.at(i)->text(6)).stripWhiteSpace(); |
| 2438 |
gp.start(TDEProcess::Block); |
2529 |
gp.start(TDEProcess::Block); |
| 2439 |
|
2530 |
|
| 2440 |
for ( uint i = 0; i < exportList.count(); ++i ) |
2531 |
// FIXME: this produces an error when key was successfully removed |
| 2441 |
if ( exportList.at(i) ) |
2532 |
// for ( uint i = 0; i < exportList.count(); ++i ) |
| 2442 |
keysList2->refreshcurrentkey(exportList.at(i)); |
2533 |
// if ( exportList.at(i) ) |
|
|
2534 |
// keysList2->refreshcurrentkey(exportList.at(i)); |
| 2535 |
|
| 2443 |
if (keysList2->currentItem()) { |
2536 |
if (keysList2->currentItem()) { |
| 2444 |
TQListViewItem * myChild = keysList2->currentItem(); |
2537 |
TQListViewItem * myChild = keysList2->currentItem(); |
| 2445 |
while(!myChild->isVisible()) { |
2538 |
while(!myChild->isVisible()) { |
|
Lines 2460-2472
Link Here
|
| 2460 |
keysList2->setCurrentItem(myChild); |
2553 |
keysList2->setCurrentItem(myChild); |
| 2461 |
} |
2554 |
} |
| 2462 |
} |
2555 |
} |
| 2463 |
else stateChanged("empty_list"); |
2556 |
else |
|
|
2557 |
stateChanged("empty_list"); |
| 2558 |
|
| 2559 |
keysList2->refreshkeylist(); // update the list to remove signitures from the deleted key |
| 2464 |
changeMessage(i18n("%1 Keys, %2 Groups").arg(keysList2->childCount()-keysList2->groupNb).arg(keysList2->groupNb),1); |
2560 |
changeMessage(i18n("%1 Keys, %2 Groups").arg(keysList2->childCount()-keysList2->groupNb).arg(keysList2->groupNb),1); |
| 2465 |
} |
2561 |
} |
| 2466 |
|
2562 |
|
| 2467 |
|
2563 |
|
| 2468 |
void listKeys::slotPreImportKey() |
2564 |
void listKeys::slotPreImportKey() |
| 2469 |
{ |
2565 |
{ |
|
|
2566 |
// // 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); |
2567 |
KDialogBase *dial=new KDialogBase( KDialogBase::Swallow, i18n("Key Import"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, this, "key_import",true); |
| 2471 |
|
2568 |
|
| 2472 |
SrcSelect *page=new SrcSelect(); |
2569 |
SrcSelect *page=new SrcSelect(); |
|
Lines 2504-2512
Link Here
|
| 2504 |
|
2601 |
|
| 2505 |
void KeyView::expandGroup(TQListViewItem *item) |
2602 |
void KeyView::expandGroup(TQListViewItem *item) |
| 2506 |
{ |
2603 |
{ |
| 2507 |
|
2604 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2508 |
TQStringList keysGroup=KgpgInterface::getGpgGroupSetting(item->text(0),KGpgSettings::gpgConfigPath()); |
2605 |
TQStringList keysGroup=KgpgInterface::getGpgGroupSetting(item->text(0),KGpgSettings::gpgConfigPath()); |
| 2509 |
kdDebug(2100)<<keysGroup<<endl; |
2606 |
// kdDebug(2100)<<keysGroup<<endl; |
| 2510 |
for ( TQStringList::Iterator it = keysGroup.begin(); it != keysGroup.end(); ++it ) { |
2607 |
for ( TQStringList::Iterator it = keysGroup.begin(); it != keysGroup.end(); ++it ) { |
| 2511 |
UpdateViewItem *item2=new UpdateViewItem(item,TQString(*it),TQString(),TQString(),TQString(),TQString(),TQString(),TQString()); |
2608 |
UpdateViewItem *item2=new UpdateViewItem(item,TQString(*it),TQString(),TQString(),TQString(),TQString(),TQString(),TQString()); |
| 2512 |
item2->setPixmap(0,pixkeyGroup); |
2609 |
item2->setPixmap(0,pixkeyGroup); |
|
Lines 2516-2525
Link Here
|
| 2516 |
|
2613 |
|
| 2517 |
TQPixmap KeyView::slotGetPhoto(TQString photoId,bool mini) |
2614 |
TQPixmap KeyView::slotGetPhoto(TQString photoId,bool mini) |
| 2518 |
{ |
2615 |
{ |
|
|
2616 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2519 |
KTempFile *phototmp=new KTempFile(); |
2617 |
KTempFile *phototmp=new KTempFile(); |
| 2520 |
TQString popt="cp %i "+phototmp->name(); |
2618 |
TQString popt="cp %i "+phototmp->name(); |
| 2521 |
KProcIO *p=new KProcIO(TQTextCodec::codecForLocale()); |
2619 |
KProcIO *p=new KProcIO(TQTextCodec::codecForLocale()); |
| 2522 |
*p<<"gpg"<<"--show-photos"<<"--photo-viewer"<<TQString(TQFile::encodeName(popt))<<"--list-keys"<<photoId; |
2620 |
*p<<"gpg"<<"--show-photos" |
|
|
2621 |
<<"--photo-viewer"<<TQString(TQFile::encodeName(popt)) |
| 2622 |
<<"--list-keys"<<photoId; |
| 2523 |
p->start(TDEProcess::Block); |
2623 |
p->start(TDEProcess::Block); |
| 2524 |
|
2624 |
|
| 2525 |
TQPixmap pixmap; |
2625 |
TQPixmap pixmap; |
|
Lines 2538-2585
Link Here
|
| 2538 |
|
2638 |
|
| 2539 |
void KeyView::expandKey(TQListViewItem *item) |
2639 |
void KeyView::expandKey(TQListViewItem *item) |
| 2540 |
{ |
2640 |
{ |
| 2541 |
|
2641 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2542 |
if (item->childCount()!=0) |
2642 |
if (item->childCount()!=0) |
| 2543 |
return; // key has already been expanded |
2643 |
return; // key has already been expanded |
| 2544 |
FILE *fp; |
2644 |
FILE *fp; |
| 2545 |
TQString cycle; |
2645 |
|
| 2546 |
TQStringList tst; |
2646 |
|
| 2547 |
char tmpline[300]; |
2647 |
char line[300]; |
|
|
2648 |
TQString currentKey; |
| 2649 |
TQMap<TQString,TQStringList> hashMap; |
| 2650 |
// kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl; |
| 2651 |
|
| 2652 |
TQApplication::setOverrideCursor(TQCursor(TQt::BusyCursor)); |
| 2653 |
fp = popen(TQFile::encodeName(TQString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs "+item->text(6))), "r"); |
| 2654 |
|
| 2655 |
while ( fgets( line, sizeof(line), fp)) { |
| 2656 |
TQString tst=TQString::fromUtf8(line); |
| 2657 |
// // kdDebug(2100) << k_funcinfo << "Read one public sig line: " << tst; |
| 2658 |
if ( tst.startsWith("pub") ) { |
| 2659 |
currentKey = tst.section(':',4,4).right(8); |
| 2660 |
TQStringList lst; lst << tst; |
| 2661 |
hashMap.insert(currentKey,lst); |
| 2662 |
} |
| 2663 |
else |
| 2664 |
hashMap.find(currentKey).data().append(tst); |
| 2665 |
|
| 2666 |
} |
| 2667 |
pclose(fp); |
| 2668 |
|
| 2669 |
TQMap<TQString,TQStringList>::Iterator ite; |
| 2670 |
for (ite = hashMap.begin(); ite != hashMap.end(); ite++) { |
| 2671 |
TQStringList::Iterator it; |
| 2672 |
TQString cycle="pub"; |
| 2673 |
bool noID = (KgpgInterface::getGpgVersion() < 210 ) ? false : true; |
| 2674 |
|
| 2548 |
UpdateViewItem *itemsub=NULL; |
2675 |
UpdateViewItem *itemsub=NULL; |
| 2549 |
UpdateViewItem *itemuid=NULL; |
2676 |
UpdateViewItem *itemuid=NULL; |
| 2550 |
UpdateViewItem *itemsig=NULL; |
2677 |
UpdateViewItem *itemsig=NULL; |
| 2551 |
UpdateViewItem *itemrev=NULL; |
2678 |
UpdateViewItem *itemrev=NULL; |
| 2552 |
TQPixmap keyPhotoId; |
2679 |
TQPixmap keyPhotoId; |
| 2553 |
int uidNumber=2; |
2680 |
int uidNumber=2; |
| 2554 |
bool dropFirstUid=false; |
|
|
| 2555 |
|
| 2556 |
kdDebug(2100)<<"Expanding Key: "<<item->text(6)<<endl; |
| 2557 |
|
2681 |
|
| 2558 |
cycle="pub"; |
2682 |
for (it = ite.data().begin(); it != ite.data().end(); it++) { |
| 2559 |
bool noID=false; |
2683 |
TQString line = (*it); |
| 2560 |
fp = popen(TQFile::encodeName(TQString("gpg --no-secmem-warning --no-tty --with-colons --list-sigs "+item->text(6))), "r"); |
2684 |
TQStringList tst=TQStringList::split(":",line,true); |
| 2561 |
|
2685 |
// // kdDebug(2100)<<"Loop: "<< tst[0] << " : " << tst[9] <<endl; |
| 2562 |
while ( fgets( tmpline, sizeof(tmpline), fp)) { |
2686 |
if ((tst[0]=="pub") && (tst[9].isEmpty())) {/// Primary User Id is separated from public key |
| 2563 |
TQString line = TQString::fromUtf8( tmpline ); |
2687 |
noID=true; |
| 2564 |
tst=TQStringList::split(":",line,true); |
2688 |
continue; |
| 2565 |
if ((tst[0]=="pub") && (tst[9].isEmpty())) /// Primary User Id is separated from public key |
2689 |
} |
| 2566 |
uidNumber=1; |
|
|
| 2567 |
if (tst[0]=="uid" || tst[0]=="uat") { |
2690 |
if (tst[0]=="uid" || tst[0]=="uat") { |
| 2568 |
if (dropFirstUid) { |
|
|
| 2569 |
dropFirstUid=false; |
| 2570 |
} else { |
| 2571 |
gpgKey uidKey=extractKey(line); |
2691 |
gpgKey uidKey=extractKey(line); |
| 2572 |
|
2692 |
|
| 2573 |
if (tst[0]=="uat") { |
2693 |
if (tst[0]=="uat") { |
| 2574 |
kdDebug(2100)<<"Found photo at uid "<<uidNumber<<endl; |
2694 |
// kdDebug(2100)<<"Found photo at uid "<<uidNumber<<endl; |
| 2575 |
itemuid= new UpdateViewItem(item,i18n("Photo id"),TQString(),TQString(),"-","-","-",TQString::number(uidNumber)); |
2695 |
itemuid= new UpdateViewItem(item,i18n("Photo id"),TQString(),TQString(),"-","-","-",TQString::number(uidNumber)); |
| 2576 |
if (displayPhoto) { |
2696 |
if (displayPhoto) { |
| 2577 |
kgpgphototmp=new KTempFile(); |
2697 |
kgpgphototmp=new KTempFile(); |
| 2578 |
kgpgphototmp->setAutoDelete(true); |
2698 |
kgpgphototmp->setAutoDelete(true); |
| 2579 |
TQString pgpgOutput="cp %i "+kgpgphototmp->name(); |
2699 |
TQString pgpgOutput="cp %i "+kgpgphototmp->name(); |
| 2580 |
KProcIO *p=new KProcIO(TQTextCodec::codecForLocale()); |
2700 |
KProcIO *p=new KProcIO(TQTextCodec::codecForLocale()); |
| 2581 |
*p<<"gpg"<<"--no-tty"<<"--photo-viewer"<<TQString(TQFile::encodeName(pgpgOutput)); |
2701 |
*p<<"gpg"<<"--no-tty" |
| 2582 |
*p<<"--edit-key"<<item->text(6)<<"uid"<<TQString::number(uidNumber)<<"showphoto"<<"quit"; |
2702 |
<<"--photo-viewer"<<TQString(TQFile::encodeName(pgpgOutput)) |
|
|
2703 |
<<"--edit-key"<<item->text(6) |
| 2704 |
<<"uid"<<TQString::number(uidNumber) |
| 2705 |
<<"showphoto"<<"quit"; |
| 2583 |
p->start(TDEProcess::Block); |
2706 |
p->start(TDEProcess::Block); |
| 2584 |
TQPixmap pixmap; |
2707 |
TQPixmap pixmap; |
| 2585 |
pixmap.load(kgpgphototmp->name()); |
2708 |
pixmap.load(kgpgphototmp->name()); |
|
Lines 2592-2626
Link Here
|
| 2592 |
} else |
2715 |
} else |
| 2593 |
itemuid->setPixmap(0,pixuserphoto); |
2716 |
itemuid->setPixmap(0,pixuserphoto); |
| 2594 |
itemuid->setPixmap(2,uidKey.trustpic); |
2717 |
itemuid->setPixmap(2,uidKey.trustpic); |
| 2595 |
cycle="uid"; |
|
|
| 2596 |
} else { |
2718 |
} else { |
| 2597 |
kdDebug(2100)<<"Found uid at "<<uidNumber<<endl; |
2719 |
// kdDebug(2100)<<"Found uid at "<<uidNumber<<endl; |
| 2598 |
itemuid= new UpdateViewItem(item,uidKey.gpgkeyname,uidKey.gpgkeymail,TQString(),"-","-","-","-"); |
2720 |
itemuid= new UpdateViewItem(item,uidKey.gpgkeyname,uidKey.gpgkeymail,TQString(),"-","-",uidKey.gpgkeycreation,uidKey.gpgkeyid); |
| 2599 |
itemuid->setPixmap(2,uidKey.trustpic); |
2721 |
itemuid->setPixmap(2,uidKey.trustpic); |
|
|
2722 |
// FIXME not sure if first item is oldest item - the one set when key was generated |
| 2723 |
// but in my opinion the identity of the oldest item should be assigned to the pub/main entry |
| 2600 |
if (noID) { |
2724 |
if (noID) { |
| 2601 |
item->setText(0,uidKey.gpgkeyname); |
2725 |
item->setText(0,uidKey.gpgkeyname); |
| 2602 |
item->setText(1,uidKey.gpgkeymail); |
2726 |
item->setText(1,uidKey.gpgkeymail); |
| 2603 |
noID=false; |
2727 |
noID=false; |
| 2604 |
} |
2728 |
} |
| 2605 |
itemuid->setPixmap(0,pixuserid); |
2729 |
itemuid->setPixmap(0,pixuserid); |
| 2606 |
cycle="uid"; |
|
|
| 2607 |
} |
| 2608 |
} |
2730 |
} |
|
|
2731 |
cycle="uid"; |
| 2609 |
uidNumber++; |
2732 |
uidNumber++; |
| 2610 |
} else |
2733 |
} |
| 2611 |
if (tst[0]=="rev") { |
2734 |
if (tst[0]=="rev") { |
| 2612 |
gpgKey revKey=extractKey(line); |
2735 |
gpgKey revKey=extractKey(line); |
| 2613 |
if (cycle=="uid" || cycle=="uat") |
2736 |
if (cycle=="uid") |
| 2614 |
itemrev= new UpdateViewItem(itemuid,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid); |
2737 |
itemrev= new UpdateViewItem(itemuid,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid); |
| 2615 |
else if (cycle=="pub") { //////////////public key revoked |
2738 |
if (cycle=="pub") //////////////public key revoked |
| 2616 |
itemrev= new UpdateViewItem(item,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid); |
2739 |
itemrev= new UpdateViewItem(item,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid); |
| 2617 |
dropFirstUid=true; |
2740 |
//dropFirstUid=true; |
| 2618 |
} else if (cycle=="sub") |
2741 |
if (cycle=="sub") |
| 2619 |
itemrev= new UpdateViewItem(itemsub,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid); |
2742 |
itemrev= new UpdateViewItem(itemsub,revKey.gpgkeyname,revKey.gpgkeymail+i18n(" [Revocation signature]"),"-","-","-",revKey.gpgkeycreation,revKey.gpgkeyid); |
| 2620 |
itemrev->setPixmap(0,pixRevoke); |
2743 |
itemrev->setPixmap(0,pixRevoke); |
| 2621 |
} else |
2744 |
} |
| 2622 |
|
|
|
| 2623 |
|
| 2624 |
if (tst[0]=="sig") { |
2745 |
if (tst[0]=="sig") { |
| 2625 |
gpgKey sigKey=extractKey(line); |
2746 |
gpgKey sigKey=extractKey(line); |
| 2626 |
|
2747 |
|
|
Lines 2628-2673
Link Here
|
| 2628 |
sigKey.gpgkeymail+=i18n(" [local]"); |
2749 |
sigKey.gpgkeymail+=i18n(" [local]"); |
| 2629 |
|
2750 |
|
| 2630 |
if (cycle=="pub") |
2751 |
if (cycle=="pub") |
| 2631 |
itemsig= new UpdateViewItem(item,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid); |
2752 |
itemsig= new UpdateViewItem( |
|
|
2753 |
item, |
| 2754 |
sigKey.gpgkeyname, |
| 2755 |
sigKey.gpgkeymail, |
| 2756 |
"-", |
| 2757 |
sigKey.gpgkeyexpiration, |
| 2758 |
"-", |
| 2759 |
sigKey.gpgkeycreation, |
| 2760 |
sigKey.gpgkeyid); |
| 2632 |
if (cycle=="sub") |
2761 |
if (cycle=="sub") |
| 2633 |
itemsig= new UpdateViewItem(itemsub,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid); |
2762 |
itemsig= new UpdateViewItem( |
|
|
2763 |
itemsub, |
| 2764 |
sigKey.gpgkeyname, |
| 2765 |
sigKey.gpgkeymail, |
| 2766 |
"-", |
| 2767 |
sigKey.gpgkeyexpiration, |
| 2768 |
"-", |
| 2769 |
sigKey.gpgkeycreation, |
| 2770 |
sigKey.gpgkeyid); |
| 2634 |
if (cycle=="uid") |
2771 |
if (cycle=="uid") |
| 2635 |
itemsig= new UpdateViewItem(itemuid,sigKey.gpgkeyname,sigKey.gpgkeymail,"-",sigKey.gpgkeyexpiration,"-",sigKey.gpgkeycreation,sigKey.gpgkeyid); |
2772 |
itemsig= new UpdateViewItem( |
| 2636 |
|
2773 |
itemuid, |
|
|
2774 |
sigKey.gpgkeyname, |
| 2775 |
sigKey.gpgkeymail, |
| 2776 |
"-", |
| 2777 |
sigKey.gpgkeyexpiration, |
| 2778 |
"-", |
| 2779 |
sigKey.gpgkeycreation, |
| 2780 |
sigKey.gpgkeyid); |
| 2637 |
itemsig->setPixmap(0,pixsignature); |
2781 |
itemsig->setPixmap(0,pixsignature); |
| 2638 |
} else |
2782 |
} |
| 2639 |
if (tst[0]=="sub") { |
2783 |
if (tst[0]=="sub") { |
| 2640 |
gpgKey subKey=extractKey(line); |
2784 |
gpgKey subKey=extractKey(line); |
| 2641 |
itemsub= new UpdateViewItem(item,i18n("%1 subkey").arg(subKey.gpgkeyalgo),TQString(),TQString(),subKey.gpgkeyexpiration,subKey.gpgkeysize,subKey.gpgkeycreation,subKey.gpgkeyid); |
2785 |
itemsub= new UpdateViewItem( |
|
|
2786 |
item, |
| 2787 |
i18n("%1 subkey").arg(subKey.gpgkeyalgo), |
| 2788 |
TQString(), |
| 2789 |
TQString(), |
| 2790 |
subKey.gpgkeyexpiration, |
| 2791 |
subKey.gpgkeysize, |
| 2792 |
subKey.gpgkeycreation, |
| 2793 |
subKey.gpgkeyid |
| 2794 |
); |
| 2642 |
itemsub->setPixmap(0,pixkeySingle); |
2795 |
itemsub->setPixmap(0,pixkeySingle); |
| 2643 |
itemsub->setPixmap(2,subKey.trustpic); |
2796 |
itemsub->setPixmap(2,subKey.trustpic); |
| 2644 |
cycle="sub"; |
2797 |
cycle="sub"; |
| 2645 |
|
|
|
| 2646 |
} |
2798 |
} |
| 2647 |
} |
2799 |
} |
| 2648 |
pclose(fp); |
2800 |
} |
|
|
2801 |
TQApplication::restoreOverrideCursor(); |
| 2649 |
} |
2802 |
} |
| 2650 |
|
2803 |
|
| 2651 |
|
2804 |
|
| 2652 |
void listKeys::refreshkey() |
2805 |
void listKeys::refreshkey() |
| 2653 |
{ |
2806 |
{ |
|
|
2807 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2654 |
keysList2->refreshkeylist(); |
2808 |
keysList2->refreshkeylist(); |
| 2655 |
listViewSearch->updateSearch(listViewSearch->text()); |
2809 |
listViewSearch->updateSearch(listViewSearch->text()); |
| 2656 |
} |
2810 |
} |
| 2657 |
|
2811 |
|
| 2658 |
void KeyView::refreshkeylist() |
2812 |
void KeyView::refreshkeylist() |
| 2659 |
{ |
2813 |
{ |
|
|
2814 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2660 |
emit statusMessage(i18n("Loading Keys..."),0,true); |
2815 |
emit statusMessage(i18n("Loading Keys..."),0,true); |
| 2661 |
kapp->processEvents(); |
2816 |
kapp->processEvents(); |
| 2662 |
//////// update display of keys in main management window |
2817 |
//////// update display of keys in main management window |
| 2663 |
kdDebug(2100)<<"Refreshing key list"<<endl; |
2818 |
// kdDebug(2100)<<"Refreshing key list"<<endl; |
| 2664 |
TQString tst; |
2819 |
|
| 2665 |
char line[300]; |
2820 |
char line[300]; |
| 2666 |
UpdateViewItem *item=NULL; |
2821 |
UpdateViewItem *item=NULL; |
| 2667 |
bool noID=false; |
|
|
| 2668 |
bool emptyList=true; |
| 2669 |
TQString openKeys; |
2822 |
TQString openKeys; |
|
|
2823 |
bool emptyList=true; |
| 2824 |
TQMap<TQString,TQStringList> hashMap; |
| 2670 |
|
2825 |
|
|
|
2826 |
TQApplication::setOverrideCursor(TQCursor(TQt::BusyCursor)); |
| 2671 |
// get current position. |
2827 |
// get current position. |
| 2672 |
TQListViewItem *current = currentItem(); |
2828 |
TQListViewItem *current = currentItem(); |
| 2673 |
if(current != NULL) { |
2829 |
if(current != NULL) { |
|
Lines 2686-2717
Link Here
|
| 2686 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2842 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
| 2687 |
while ( fgets( line, sizeof(line), fp2)) { |
2843 |
while ( fgets( line, sizeof(line), fp2)) { |
| 2688 |
TQString lineRead=TQString::fromUtf8(line); |
2844 |
TQString lineRead=TQString::fromUtf8(line); |
| 2689 |
kdDebug(2100) << k_funcinfo << "Read one secret key line: " << lineRead << endl; |
2845 |
// // kdDebug(2100) << k_funcinfo << "Read one secret key line: " << lineRead << endl; |
| 2690 |
if (lineRead.startsWith("sec")) |
2846 |
if (lineRead.startsWith("sec")) |
| 2691 |
issec<<lineRead.section(':',4,4).right(8); |
2847 |
issec<<lineRead.section(':',4,4).right(8); |
| 2692 |
} |
2848 |
} |
| 2693 |
pclose(fp2); |
2849 |
pclose(fp2); |
| 2694 |
|
2850 |
|
| 2695 |
TQString defaultKey = KGpgSettings::defaultKey(); |
2851 |
TQString defaultKey = KGpgSettings::defaultKey(); |
|
|
2852 |
TQString currentKey; |
| 2853 |
|
| 2696 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r"); |
2854 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-keys", "r"); |
| 2697 |
while ( fgets( line, sizeof(line), fp)) { |
2855 |
while ( fgets( line, sizeof(line), fp)) { |
| 2698 |
tst=TQString::fromUtf8(line); |
2856 |
TQString tst=TQString::fromUtf8(line); |
| 2699 |
kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl; |
2857 |
// // kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl; |
| 2700 |
if (tst.startsWith("pub")) { |
2858 |
if ( tst.startsWith("pub") ) { |
| 2701 |
emptyList=false; |
2859 |
currentKey = tst.section(':',4,4); |
| 2702 |
noID=false; |
2860 |
TQStringList lst; lst << tst; |
| 2703 |
gpgKey pubKey=extractKey(tst); |
2861 |
hashMap.insert(currentKey,lst); |
|
|
2862 |
} |
| 2863 |
else |
| 2864 |
hashMap.find(currentKey).data().append(tst); |
| 2704 |
|
2865 |
|
|
|
2866 |
} |
| 2867 |
pclose(fp); |
| 2868 |
|
| 2869 |
// process the list |
| 2870 |
|
| 2871 |
TQMap<TQString,TQStringList>::Iterator ite; |
| 2872 |
for (ite = hashMap.begin(); ite != hashMap.end(); ite++) { |
| 2873 |
TQStringList::Iterator it; |
| 2874 |
gpgKey pubKey; |
| 2705 |
bool isbold=false; |
2875 |
bool isbold=false; |
| 2706 |
bool isexpired=false; |
2876 |
bool isexpired=false; |
|
|
2877 |
|
| 2878 |
for (it = ite.data().begin(); it != ite.data().end(); it++) { |
| 2879 |
TQString tst = (*it); |
| 2880 |
if ( tst.startsWith("pub") ){ |
| 2881 |
emptyList=false; |
| 2882 |
pubKey=extractKey(tst); |
| 2707 |
if (pubKey.gpgkeyid==defaultKey) |
2883 |
if (pubKey.gpgkeyid==defaultKey) |
| 2708 |
isbold=true; |
2884 |
isbold=true; |
| 2709 |
if (pubKey.gpgkeytrust==i18n("Expired")) |
2885 |
if (pubKey.gpgkeytrust==i18n("Expired")) |
| 2710 |
isexpired=true; |
2886 |
isexpired=true; |
| 2711 |
if (pubKey.gpgkeyname.isEmpty()) |
2887 |
} |
| 2712 |
noID=true; |
2888 |
if ( tst.startsWith("uid") && pubKey.gpgkeyname.isEmpty() ){ |
|
|
2889 |
gpgKey tmpKey=extractKey(tst); |
| 2890 |
pubKey.gpgkeyname = tmpKey.gpgkeyname; |
| 2891 |
pubKey.gpgkeymail = tmpKey.gpgkeymail; |
| 2892 |
} |
| 2893 |
} |
| 2713 |
|
2894 |
|
| 2714 |
item=new UpdateViewItem(this,pubKey.gpgkeyname,pubKey.gpgkeymail,TQString(),pubKey.gpgkeyexpiration,pubKey.gpgkeysize,pubKey.gpgkeycreation,pubKey.gpgkeyid,isbold,isexpired); |
2895 |
item=new UpdateViewItem( |
|
|
2896 |
this, |
| 2897 |
pubKey.gpgkeyname, |
| 2898 |
pubKey.gpgkeymail, |
| 2899 |
TQString(), |
| 2900 |
pubKey.gpgkeyexpiration, |
| 2901 |
pubKey.gpgkeysize, |
| 2902 |
pubKey.gpgkeycreation, |
| 2903 |
pubKey.gpgkeyid, |
| 2904 |
isbold, |
| 2905 |
isexpired); |
| 2715 |
|
2906 |
|
| 2716 |
item->setPixmap(2,pubKey.trustpic); |
2907 |
item->setPixmap(2,pubKey.trustpic); |
| 2717 |
item->setExpandable(true); |
2908 |
item->setExpandable(true); |
|
Lines 2729-2753
Link Here
|
| 2729 |
item->setOpen(true); |
2920 |
item->setOpen(true); |
| 2730 |
} |
2921 |
} |
| 2731 |
|
2922 |
|
| 2732 |
} |
2923 |
|
| 2733 |
pclose(fp); |
|
|
| 2734 |
if (!issec.isEmpty()) |
2924 |
if (!issec.isEmpty()) |
| 2735 |
insertOrphanedKeys(issec); |
2925 |
insertOrphanedKeys(issec); |
| 2736 |
if (emptyList) { |
2926 |
if (emptyList) { |
| 2737 |
kdDebug(2100)<<"No key found"<<endl; |
2927 |
// kdDebug(2100)<<"No key found"<<endl; |
| 2738 |
emit statusMessage(i18n("Ready"),0); |
2928 |
emit statusMessage(i18n("Ready"),0); |
| 2739 |
return; |
2929 |
return; |
| 2740 |
} |
2930 |
} |
| 2741 |
kdDebug(2100)<<"Checking Groups"<<endl; |
2931 |
// kdDebug(2100)<<"Checking Groups"<<endl; |
| 2742 |
TQStringList groups=KgpgInterface::getGpgGroupNames(KGpgSettings::gpgConfigPath()); |
2932 |
TQStringList groups=KgpgInterface::getGpgGroupNames(KGpgSettings::gpgConfigPath()); |
| 2743 |
groupNb=groups.count(); |
2933 |
groupNb=groups.count(); |
| 2744 |
for ( TQStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) |
2934 |
for ( TQStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) |
| 2745 |
if (!TQString(*it).isEmpty()) { |
2935 |
if (!TQString(*it).isEmpty()) { |
| 2746 |
item=new UpdateViewItem(this,TQString(*it),TQString(),TQString(),TQString(),TQString(),TQString(),TQString(),false,false); |
2936 |
item=new UpdateViewItem( |
|
|
2937 |
this, |
| 2938 |
TQString(*it), |
| 2939 |
TQString(), |
| 2940 |
TQString(), |
| 2941 |
TQString(), |
| 2942 |
TQString(), |
| 2943 |
TQString(), |
| 2944 |
TQString(), |
| 2945 |
false, |
| 2946 |
false); |
| 2747 |
item->setPixmap(0,pixkeyGroup); |
2947 |
item->setPixmap(0,pixkeyGroup); |
| 2748 |
item->setExpandable(false); |
2948 |
item->setExpandable(false); |
| 2749 |
} |
2949 |
} |
| 2750 |
kdDebug(2100)<<"Finished Groups"<<endl; |
2950 |
// kdDebug(2100)<<"Finished Groups"<<endl; |
| 2751 |
|
2951 |
|
| 2752 |
TQListViewItem *newPos=0L; |
2952 |
TQListViewItem *newPos=0L; |
| 2753 |
if(current != NULL) { |
2953 |
if(current != NULL) { |
|
Lines 2770-2792
Link Here
|
| 2770 |
|
2970 |
|
| 2771 |
emit statusMessage(i18n("%1 Keys, %2 Groups").arg(childCount()-groupNb).arg(groupNb),1); |
2971 |
emit statusMessage(i18n("%1 Keys, %2 Groups").arg(childCount()-groupNb).arg(groupNb),1); |
| 2772 |
emit statusMessage(i18n("Ready"),0); |
2972 |
emit statusMessage(i18n("Ready"),0); |
| 2773 |
kdDebug(2100)<<"Refresh Finished"<<endl; |
2973 |
TQApplication::restoreOverrideCursor(); |
|
|
2974 |
// kdDebug(2100)<<"Refresh Finished"<<endl; |
| 2774 |
} |
2975 |
} |
| 2775 |
|
2976 |
|
| 2776 |
void KeyView::insertOrphan(TQString currentID) |
2977 |
void KeyView::insertOrphan(TQString currentID) |
| 2777 |
{ |
2978 |
{ |
|
|
2979 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2778 |
FILE *fp; |
2980 |
FILE *fp; |
| 2779 |
char line[300]; |
2981 |
char line[300]; |
| 2780 |
UpdateViewItem *item=NULL; |
2982 |
UpdateViewItem *item=NULL; |
| 2781 |
bool keyFound=false; |
2983 |
bool keyFound=false; |
|
|
2984 |
TQString currentKey; |
| 2985 |
TQMap<TQString,TQStringList> hashMap; |
| 2986 |
|
| 2782 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
2987 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
| 2783 |
while ( fgets( line, sizeof(line), fp)) { |
2988 |
while ( fgets( line, sizeof(line), fp)) { |
| 2784 |
TQString lineRead=TQString::fromUtf8(line); |
2989 |
TQString tst=TQString::fromUtf8(line); |
| 2785 |
if ((lineRead.startsWith("sec")) && (lineRead.section(':',4,4).right(8))==currentID.right(8)) { |
2990 |
// // kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl; |
| 2786 |
gpgKey orphanedKey=extractKey(lineRead); |
2991 |
if ( tst.startsWith("sec") ) { |
| 2787 |
keyFound=true; |
2992 |
currentKey = tst.section(':',4,4); |
|
|
2993 |
TQStringList lst; lst << tst; |
| 2994 |
hashMap.insert(currentKey,lst); |
| 2995 |
} |
| 2996 |
else |
| 2997 |
hashMap.find(currentKey).data().append(tst); |
| 2998 |
|
| 2999 |
} |
| 3000 |
pclose(fp); |
| 3001 |
// process the list |
| 3002 |
|
| 3003 |
TQMap<TQString,TQStringList>::Iterator ite; |
| 3004 |
for (ite = hashMap.begin(); ite != hashMap.end(); ite++) { |
| 3005 |
TQStringList::Iterator it; |
| 3006 |
gpgKey orphanedKey; |
| 3007 |
keyFound=false; |
| 2788 |
bool isbold=false; |
3008 |
bool isbold=false; |
| 2789 |
bool isexpired=false; |
3009 |
bool isexpired=false; |
|
|
3010 |
|
| 3011 |
for (it = ite.data().begin(); it != ite.data().end(); it++) { |
| 3012 |
TQString tmp = (*it); |
| 3013 |
if ((tmp.startsWith("sec")) && (tmp.section(':',4,4).right(8))==currentID.right(8)) { |
| 3014 |
orphanedKey=extractKey(tmp); |
| 3015 |
keyFound=true; |
| 2790 |
// if (orphanedKey.gpgkeyid==defaultKey) |
3016 |
// if (orphanedKey.gpgkeyid==defaultKey) |
| 2791 |
// isbold=true; |
3017 |
// isbold=true; |
| 2792 |
if (orphanedKey.gpgkeytrust==i18n("Expired")) |
3018 |
if (orphanedKey.gpgkeytrust==i18n("Expired")) |
|
Lines 2794-2804
Link Here
|
| 2794 |
// if (orphanedKey.gpgkeyname.isEmpty()) |
3020 |
// if (orphanedKey.gpgkeyname.isEmpty()) |
| 2795 |
// noID=true; |
3021 |
// noID=true; |
| 2796 |
|
3022 |
|
| 2797 |
item=new UpdateViewItem(this,orphanedKey.gpgkeyname,orphanedKey.gpgkeymail,TQString(),orphanedKey.gpgkeyexpiration,orphanedKey.gpgkeysize,orphanedKey.gpgkeycreation,orphanedKey.gpgkeyid,isbold,isexpired); |
|
|
| 2798 |
item->setPixmap(0,pixkeyOrphan); |
| 2799 |
} |
3023 |
} |
|
|
3024 |
if ( tmp.startsWith("uid") && orphanedKey.gpgkeyname.isEmpty() ){ |
| 3025 |
gpgKey tmpKey=extractKey(tmp); |
| 3026 |
orphanedKey.gpgkeyname = tmpKey.gpgkeyname; |
| 3027 |
orphanedKey.gpgkeymail = tmpKey.gpgkeymail; |
| 2800 |
} |
3028 |
} |
| 2801 |
pclose(fp); |
3029 |
} |
|
|
3030 |
item=new UpdateViewItem( |
| 3031 |
this, |
| 3032 |
orphanedKey.gpgkeyname, |
| 3033 |
orphanedKey.gpgkeymail, |
| 3034 |
TQString(), |
| 3035 |
orphanedKey.gpgkeyexpiration, |
| 3036 |
orphanedKey.gpgkeysize, |
| 3037 |
orphanedKey.gpgkeycreation, |
| 3038 |
orphanedKey.gpgkeyid, |
| 3039 |
isbold, |
| 3040 |
isexpired); |
| 3041 |
item->setPixmap(0,pixkeyOrphan); |
| 3042 |
} |
| 3043 |
|
| 2802 |
if (!keyFound) { |
3044 |
if (!keyFound) { |
| 2803 |
orphanList.remove(currentID); |
3045 |
orphanList.remove(currentID); |
| 2804 |
setSelected(currentItem(),true); |
3046 |
setSelected(currentItem(),true); |
|
Lines 2811-2842
Link Here
|
| 2811 |
|
3053 |
|
| 2812 |
void KeyView::insertOrphanedKeys(TQStringList orphans) |
3054 |
void KeyView::insertOrphanedKeys(TQStringList orphans) |
| 2813 |
{ |
3055 |
{ |
|
|
3056 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2814 |
FILE *fp; |
3057 |
FILE *fp; |
| 2815 |
char line[300]; |
3058 |
char line[300]; |
|
|
3059 |
TQString currentKey; |
| 3060 |
TQMap<TQString,TQStringList> hashMap; |
| 3061 |
|
| 2816 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
3062 |
fp = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
| 2817 |
while ( fgets( line, sizeof(line), fp)) { |
3063 |
while ( fgets( line, sizeof(line), fp)) { |
| 2818 |
TQString lineRead=TQString::fromUtf8(line); |
3064 |
TQString tst=TQString::fromUtf8(line); |
| 2819 |
if ((lineRead.startsWith("sec")) && (orphans.find(lineRead.section(':',4,4).right(8))!=orphans.end())) { |
3065 |
// // kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl; |
| 2820 |
gpgKey orphanedKey=extractKey(lineRead); |
3066 |
if ( tst.startsWith("sec") ) { |
|
|
3067 |
currentKey = tst.section(':',4,4); |
| 3068 |
TQStringList lst; lst << tst; |
| 3069 |
hashMap.insert(currentKey,lst); |
| 3070 |
} |
| 3071 |
else |
| 3072 |
hashMap.find(currentKey).data().append(tst); |
| 2821 |
|
3073 |
|
|
|
3074 |
} |
| 3075 |
pclose(fp); |
| 3076 |
// process the list |
| 3077 |
|
| 3078 |
TQMap<TQString,TQStringList>::Iterator ite; |
| 3079 |
for (ite = hashMap.begin(); ite != hashMap.end(); ite++) { |
| 3080 |
TQStringList::Iterator it; |
| 3081 |
gpgKey orphanedKey; |
| 2822 |
bool isbold=false; |
3082 |
bool isbold=false; |
| 2823 |
bool isexpired=false; |
3083 |
bool isexpired=false; |
| 2824 |
// if (orphanedKey.gpgkeyid==defaultKey) |
3084 |
|
| 2825 |
// isbold=true; |
3085 |
for (it = ite.data().begin(); it != ite.data().end(); it++) { |
|
|
3086 |
TQString tmp = (*it); |
| 3087 |
if ((tmp.startsWith("sec")) && (orphans.find(tmp.section(':',4,4).right(8))!=orphans.end())) { |
| 3088 |
orphanedKey=extractKey(tmp); |
| 3089 |
// if (orphanedKey.gpgkeyid==defaultKey) |
| 3090 |
// isbold=true; |
| 2826 |
if (orphanedKey.gpgkeytrust==i18n("Expired")) |
3091 |
if (orphanedKey.gpgkeytrust==i18n("Expired")) |
| 2827 |
isexpired=true; |
3092 |
isexpired=true; |
| 2828 |
// if (orphanedKey.gpgkeyname.isEmpty()) |
|
|
| 2829 |
// noID=true; |
| 2830 |
orphanList+=orphanedKey.gpgkeyid+","; |
3093 |
orphanList+=orphanedKey.gpgkeyid+","; |
| 2831 |
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); |
| 2833 |
} |
3094 |
} |
|
|
3095 |
if ( tmp.startsWith("uid") && orphanedKey.gpgkeyname.isEmpty() ){ |
| 3096 |
gpgKey tmpKey=extractKey(tmp); |
| 3097 |
orphanedKey.gpgkeyname = tmpKey.gpgkeyname; |
| 3098 |
orphanedKey.gpgkeymail = tmpKey.gpgkeymail; |
| 3099 |
} |
| 3100 |
} |
| 3101 |
UpdateViewItem *item=new UpdateViewItem( |
| 3102 |
this, |
| 3103 |
orphanedKey.gpgkeyname, |
| 3104 |
orphanedKey.gpgkeymail, |
| 3105 |
TQString(), |
| 3106 |
orphanedKey.gpgkeyexpiration, |
| 3107 |
orphanedKey.gpgkeysize, |
| 3108 |
orphanedKey.gpgkeycreation, |
| 3109 |
orphanedKey.gpgkeyid, |
| 3110 |
isbold, |
| 3111 |
isexpired); |
| 3112 |
item->setPixmap(0,pixkeyOrphan); |
| 2834 |
} |
3113 |
} |
| 2835 |
pclose(fp); |
|
|
| 2836 |
} |
3114 |
} |
| 2837 |
|
3115 |
|
| 2838 |
void KeyView::refreshgroups() |
3116 |
void KeyView::refreshgroups() |
| 2839 |
{ |
3117 |
{ |
|
|
3118 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2840 |
TQListViewItem *item=firstChild(); |
3119 |
TQListViewItem *item=firstChild(); |
| 2841 |
while (item) { |
3120 |
while (item) { |
| 2842 |
if (item->text(6).isEmpty()) { |
3121 |
if (item->text(6).isEmpty()) { |
|
Lines 2851-2857
Link Here
|
| 2851 |
groupNb=groups.count(); |
3130 |
groupNb=groups.count(); |
| 2852 |
for ( TQStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) |
3131 |
for ( TQStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) |
| 2853 |
if (!TQString(*it).isEmpty()) { |
3132 |
if (!TQString(*it).isEmpty()) { |
| 2854 |
item=new UpdateViewItem(this,TQString(*it),TQString(),TQString(),TQString(),TQString(),TQString(),TQString(),false,false); |
3133 |
item=new UpdateViewItem( |
|
|
3134 |
this, |
| 3135 |
TQString(*it), |
| 3136 |
TQString(), |
| 3137 |
TQString(), |
| 3138 |
TQString(), |
| 3139 |
TQString(), |
| 3140 |
TQString(), |
| 3141 |
TQString(), |
| 3142 |
false, |
| 3143 |
false); |
| 2855 |
item->setPixmap(0,pixkeyGroup); |
3144 |
item->setPixmap(0,pixkeyGroup); |
| 2856 |
item->setExpandable(false); |
3145 |
item->setExpandable(false); |
| 2857 |
} |
3146 |
} |
|
Lines 2861-2867
Link Here
|
| 2861 |
|
3150 |
|
| 2862 |
void KeyView::refreshselfkey() |
3151 |
void KeyView::refreshselfkey() |
| 2863 |
{ |
3152 |
{ |
| 2864 |
kdDebug(2100)<<"Refreshing key"<<endl; |
3153 |
// // kdDebug(2100) << k_funcinfo << endl; |
|
|
3154 |
// kdDebug(2100)<<"Refreshing key"<<endl; |
| 2865 |
if (currentItem()->depth()==0) |
3155 |
if (currentItem()->depth()==0) |
| 2866 |
refreshcurrentkey(currentItem()); |
3156 |
refreshcurrentkey(currentItem()); |
| 2867 |
else |
3157 |
else |
|
Lines 2870-2875
Link Here
|
| 2870 |
|
3160 |
|
| 2871 |
void KeyView::slotReloadKeys(TQStringList keyIDs) |
3161 |
void KeyView::slotReloadKeys(TQStringList keyIDs) |
| 2872 |
{ |
3162 |
{ |
|
|
3163 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2873 |
if (keyIDs.isEmpty()) |
3164 |
if (keyIDs.isEmpty()) |
| 2874 |
return; |
3165 |
return; |
| 2875 |
if (keyIDs.first()=="ALL") |
3166 |
if (keyIDs.first()=="ALL") |
|
Lines 2880-2886
Link Here
|
| 2880 |
for ( TQStringList::Iterator it = keyIDs.begin(); it != keyIDs.end(); ++it ) { |
3171 |
for ( TQStringList::Iterator it = keyIDs.begin(); it != keyIDs.end(); ++it ) { |
| 2881 |
refreshcurrentkey(*it); |
3172 |
refreshcurrentkey(*it); |
| 2882 |
} |
3173 |
} |
| 2883 |
kdDebug(2100)<<"Refreshing key:--------"<<TQString((keyIDs.last()).right(8).prepend("0x"))<<endl; |
3174 |
// kdDebug(2100)<<"Refreshing key:--------"<<TQString((keyIDs.last()).right(8).prepend("0x"))<<endl; |
| 2884 |
ensureItemVisible(this->findItem((keyIDs.last()).right(8).prepend("0x"),6)); |
3175 |
ensureItemVisible(this->findItem((keyIDs.last()).right(8).prepend("0x"),6)); |
| 2885 |
emit statusMessage(i18n("%1 Keys, %2 Groups").arg(childCount()-groupNb).arg(groupNb),1); |
3176 |
emit statusMessage(i18n("%1 Keys, %2 Groups").arg(childCount()-groupNb).arg(groupNb),1); |
| 2886 |
emit statusMessage(i18n("Ready"),0); |
3177 |
emit statusMessage(i18n("Ready"),0); |
|
Lines 2888-2893
Link Here
|
| 2888 |
|
3179 |
|
| 2889 |
void KeyView::slotReloadOrphaned() |
3180 |
void KeyView::slotReloadOrphaned() |
| 2890 |
{ |
3181 |
{ |
|
|
3182 |
// // kdDebug(2100) << k_funcinfo << endl; |
| 2891 |
TQStringList issec; |
3183 |
TQStringList issec; |
| 2892 |
FILE *fp,*fp2; |
3184 |
FILE *fp,*fp2; |
| 2893 |
char line[300]; |
3185 |
char line[300]; |
|
Lines 2923-2934
Link Here
|
| 2923 |
|
3215 |
|
| 2924 |
void KeyView::refreshcurrentkey(TQString currentID) |
3216 |
void KeyView::refreshcurrentkey(TQString currentID) |
| 2925 |
{ |
3217 |
{ |
|
|
3218 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2926 |
if (currentID.isNull()) return; |
3219 |
if (currentID.isNull()) return; |
| 2927 |
UpdateViewItem *item=NULL; |
|
|
| 2928 |
TQString issec=TQString(); |
| 2929 |
FILE *fp,*fp2; |
3220 |
FILE *fp,*fp2; |
| 2930 |
char line[300]; |
3221 |
char line[300]; |
|
|
3222 |
TQString issec=TQString(); |
| 2931 |
|
3223 |
|
|
|
3224 |
TQString defaultKey = KGpgSettings::defaultKey(); |
| 3225 |
TQString currentKey; |
| 3226 |
TQMap<TQString,TQStringList> hashMap; |
| 3227 |
|
| 3228 |
TQApplication::setOverrideCursor(TQCursor(TQt::BusyCursor)); |
| 2932 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
3229 |
fp2 = popen("gpg --no-secmem-warning --no-tty --with-colons --list-secret-keys", "r"); |
| 2933 |
while ( fgets( line, sizeof(line), fp2)) { |
3230 |
while ( fgets( line, sizeof(line), fp2)) { |
| 2934 |
TQString lineRead=TQString::fromUtf8(line); |
3231 |
TQString lineRead=TQString::fromUtf8(line); |
|
Lines 2937-2960
Link Here
|
| 2937 |
} |
3234 |
} |
| 2938 |
pclose(fp2); |
3235 |
pclose(fp2); |
| 2939 |
|
3236 |
|
| 2940 |
TQString defaultKey = KGpgSettings::defaultKey(); |
3237 |
// 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; |
3238 |
TQString cmd="gpg --no-secmem-warning --no-tty --with-colons --list-keys "+currentID; |
| 2945 |
fp = popen(TQFile::encodeName(cmd), "r"); |
3239 |
fp = popen(TQFile::encodeName(cmd), "r"); |
| 2946 |
while ( fgets( line, sizeof(line), fp)) { |
3240 |
while ( fgets( line, sizeof(line), fp)) { |
| 2947 |
tst=TQString::fromUtf8(line); |
3241 |
TQString tst=TQString::fromUtf8(line); |
| 2948 |
if (tst.startsWith("pub")) { |
3242 |
// // kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl; |
| 2949 |
gpgKey pubKey=extractKey(tst); |
3243 |
if ( tst.startsWith("pub") ) { |
| 2950 |
keyFound=true; |
3244 |
currentKey = tst.section(':',4,4); |
|
|
3245 |
TQStringList lst; lst << tst; |
| 3246 |
hashMap.insert(currentKey,lst); |
| 3247 |
} |
| 3248 |
else |
| 3249 |
hashMap.find(currentKey).data().append(tst); |
| 3250 |
|
| 3251 |
} |
| 3252 |
pclose(fp); |
| 3253 |
if (hashMap.isEmpty()) return; // deleted keys do not exist |
| 3254 |
|
| 3255 |
// process the list |
| 3256 |
|
| 3257 |
TQMap<TQString,TQStringList>::Iterator ite; |
| 3258 |
for (ite = hashMap.begin(); ite != hashMap.end(); ite++) { |
| 3259 |
UpdateViewItem *item=NULL; |
| 3260 |
TQStringList::Iterator it; |
| 3261 |
gpgKey pubKey; |
| 3262 |
bool keyFound=false; |
| 2951 |
bool isbold=false; |
3263 |
bool isbold=false; |
| 2952 |
bool isexpired=false; |
3264 |
bool isexpired=false; |
|
|
3265 |
|
| 3266 |
for (it = ite.data().begin(); it != ite.data().end(); it++) { |
| 3267 |
TQString tst = (*it); |
| 3268 |
if ( tst.startsWith("pub") ){ |
| 3269 |
keyFound=true; |
| 3270 |
pubKey=extractKey(tst); |
| 2953 |
if (pubKey.gpgkeyid==defaultKey) |
3271 |
if (pubKey.gpgkeyid==defaultKey) |
| 2954 |
isbold=true; |
3272 |
isbold=true; |
| 2955 |
if (pubKey.gpgkeytrust==i18n("Expired")) |
3273 |
if (pubKey.gpgkeytrust==i18n("Expired")) |
| 2956 |
isexpired=true; |
3274 |
isexpired=true; |
| 2957 |
item=new UpdateViewItem(this,pubKey.gpgkeyname,pubKey.gpgkeymail,TQString(),pubKey.gpgkeyexpiration,pubKey.gpgkeysize,pubKey.gpgkeycreation,pubKey.gpgkeyid,isbold,isexpired); |
3275 |
} |
|
|
3276 |
if ( tst.startsWith("uid") && pubKey.gpgkeyname.isEmpty() ){ |
| 3277 |
gpgKey tmpKey=extractKey(tst); |
| 3278 |
pubKey.gpgkeyname = tmpKey.gpgkeyname; |
| 3279 |
pubKey.gpgkeymail = tmpKey.gpgkeymail; |
| 3280 |
} |
| 3281 |
} |
| 3282 |
|
| 3283 |
item=new UpdateViewItem( |
| 3284 |
this, |
| 3285 |
pubKey.gpgkeyname, |
| 3286 |
pubKey.gpgkeymail, |
| 3287 |
TQString(), |
| 3288 |
pubKey.gpgkeyexpiration, |
| 3289 |
pubKey.gpgkeysize, |
| 3290 |
pubKey.gpgkeycreation, |
| 3291 |
pubKey.gpgkeyid, |
| 3292 |
isbold, |
| 3293 |
isexpired); |
| 2958 |
item->setPixmap(2,pubKey.trustpic); |
3294 |
item->setPixmap(2,pubKey.trustpic); |
| 2959 |
item->setVisible(true); |
3295 |
item->setVisible(true); |
| 2960 |
item->setExpandable(true); |
3296 |
item->setExpandable(true); |
|
Lines 2964-2972
Link Here
|
| 2964 |
} else { |
3300 |
} else { |
| 2965 |
item->setPixmap(0,pixkeySingle); |
3301 |
item->setPixmap(0,pixkeySingle); |
| 2966 |
} |
3302 |
} |
| 2967 |
} |
|
|
| 2968 |
} |
| 2969 |
pclose(fp); |
| 2970 |
|
3303 |
|
| 2971 |
if (!keyFound) { |
3304 |
if (!keyFound) { |
| 2972 |
if (orphanList.find(currentID)==-1) |
3305 |
if (orphanList.find(currentID)==-1) |
|
Lines 2979-2989
Link Here
|
| 2979 |
|
3312 |
|
| 2980 |
clearSelection(); |
3313 |
clearSelection(); |
| 2981 |
setCurrentItem(item); |
3314 |
setCurrentItem(item); |
|
|
3315 |
} |
| 3316 |
TQApplication::restoreOverrideCursor(); |
| 2982 |
|
3317 |
|
| 2983 |
} |
3318 |
} |
| 2984 |
|
3319 |
|
| 2985 |
void KeyView::refreshcurrentkey(TQListViewItem *current) |
3320 |
void KeyView::refreshcurrentkey(TQListViewItem *current) |
| 2986 |
{ |
3321 |
{ |
|
|
3322 |
// kdDebug(2100) << k_funcinfo << endl; |
| 2987 |
if (!current) |
3323 |
if (!current) |
| 2988 |
return; |
3324 |
return; |
| 2989 |
bool keyIsOpen=false; |
3325 |
bool keyIsOpen=false; |
|
Lines 3002-3034
Link Here
|
| 3002 |
|
3338 |
|
| 3003 |
void KeyView::refreshTrust(int color,TQColor newColor) |
3339 |
void KeyView::refreshTrust(int color,TQColor newColor) |
| 3004 |
{ |
3340 |
{ |
| 3005 |
if (!newColor.isValid()) return; |
3341 |
// kdDebug(2100) << k_funcinfo << endl; |
| 3006 |
TQPixmap blankFrame,newtrust; |
3342 |
if (!newColor.isValid()) return; |
| 3007 |
int trustFinger=0; |
3343 |
TQPixmap blankFrame,newtrust; |
| 3008 |
blankFrame.load(locate("appdata", "pics/kgpg_blank.png")); |
3344 |
int trustFinger=0; |
| 3009 |
newtrust.load(locate("appdata", "pics/kgpg_fill.png")); |
3345 |
blankFrame.load(locate("appdata", "pics/kgpg_blank.png")); |
| 3010 |
newtrust.fill(newColor); |
3346 |
newtrust.load(locate("appdata", "pics/kgpg_fill.png")); |
| 3011 |
bitBlt(&newtrust,0,0,&blankFrame,0,0,50,15); |
3347 |
newtrust.fill(newColor); |
| 3012 |
switch (color) |
3348 |
bitBlt(&newtrust,0,0,&blankFrame,0,0,50,15); |
| 3013 |
{ |
3349 |
switch (color) |
| 3014 |
case GoodColor: |
3350 |
{ |
| 3015 |
trustFinger=trustgood.serialNumber(); |
3351 |
case GoodColor: |
| 3016 |
trustgood=newtrust; |
3352 |
trustFinger=trustgood.serialNumber(); |
| 3017 |
break; |
3353 |
trustgood=newtrust; |
| 3018 |
case BadColor: |
3354 |
break; |
| 3019 |
trustFinger=trustbad.serialNumber(); |
3355 |
case BadColor: |
| 3020 |
trustbad=newtrust; |
3356 |
trustFinger=trustbad.serialNumber(); |
| 3021 |
break; |
3357 |
trustbad=newtrust; |
| 3022 |
case UnknownColor: |
3358 |
break; |
| 3023 |
trustFinger=trustunknown.serialNumber(); |
3359 |
case UnknownColor: |
| 3024 |
trustunknown=newtrust; |
3360 |
trustFinger=trustunknown.serialNumber(); |
| 3025 |
break; |
3361 |
trustunknown=newtrust; |
| 3026 |
case RevColor: |
3362 |
break; |
| 3027 |
trustFinger=trustrevoked.serialNumber(); |
3363 |
case RevColor: |
| 3028 |
trustrevoked=newtrust; |
3364 |
trustFinger=trustrevoked.serialNumber(); |
| 3029 |
break; |
3365 |
trustrevoked=newtrust; |
| 3030 |
} |
3366 |
break; |
| 3031 |
TQListViewItem *item=firstChild(); |
3367 |
} |
|
|
3368 |
TQListViewItem *item=firstChild(); |
| 3032 |
while (item) { |
3369 |
while (item) { |
| 3033 |
if (item->pixmap(2)) |
3370 |
if (item->pixmap(2)) |
| 3034 |
{ |
3371 |
{ |
|
Lines 3040-3064
Link Here
|
| 3040 |
|
3377 |
|
| 3041 |
gpgKey KeyView::extractKey(TQString keyColon) |
3378 |
gpgKey KeyView::extractKey(TQString keyColon) |
| 3042 |
{ |
3379 |
{ |
|
|
3380 |
// kdDebug(2100) << k_funcinfo << "keyColon: " << keyColon<<endl; |
| 3043 |
TQStringList keyString=TQStringList::split(":",keyColon,true); |
3381 |
TQStringList keyString=TQStringList::split(":",keyColon,true); |
| 3044 |
gpgKey ret; |
|
|
| 3045 |
|
3382 |
|
|
|
3383 |
gpgKey ret; |
| 3046 |
ret.gpgkeysize=keyString[2]; |
3384 |
ret.gpgkeysize=keyString[2]; |
| 3047 |
ret.gpgkeycreation=keyString[5]; |
3385 |
ret.gpgkeycreation=keyString[5]; |
| 3048 |
if(!ret.gpgkeycreation.isEmpty()) { |
3386 |
if(!ret.gpgkeycreation.isEmpty()) { |
| 3049 |
TQDate date = TQDate::fromString(ret.gpgkeycreation, Qt::ISODate); |
3387 |
TQDate date; |
|
|
3388 |
if (KgpgInterface::getGpgVersion() >= 210 ) { |
| 3389 |
TQDateTime timestamp; |
| 3390 |
timestamp.setTime_t( ret.gpgkeycreation.toInt()); |
| 3391 |
date = timestamp.date(); |
| 3392 |
} |
| 3393 |
else { |
| 3394 |
date = TQDate::fromString(ret.gpgkeycreation, Qt::ISODate); |
| 3395 |
} |
| 3396 |
Q_ASSERT (date.isValid()) /*tqWarning("create date is not valid")*/; |
| 3050 |
ret.gpgkeycreation=TDEGlobal::locale()->formatDate(date, true); |
3397 |
ret.gpgkeycreation=TDEGlobal::locale()->formatDate(date, true); |
| 3051 |
} |
3398 |
} |
| 3052 |
TQString tid=keyString[4]; |
3399 |
TQString tid= (keyColon.startsWith("uid")) ? keyString[7] : keyString[4]; |
| 3053 |
ret.gpgkeyid=TQString("0x"+tid.right(8)); |
3400 |
ret.gpgkeyid=TQString("0x"+tid.right(8)); |
|
|
3401 |
// ret.gpgkeyid=(keyColon.startsWith("uid")) ? keyString[7] : keyString[4]; |
| 3054 |
ret.gpgkeyexpiration=keyString[6]; |
3402 |
ret.gpgkeyexpiration=keyString[6]; |
| 3055 |
if (ret.gpgkeyexpiration.isEmpty()) |
3403 |
if (ret.gpgkeyexpiration.isEmpty()) |
| 3056 |
ret.gpgkeyexpiration=i18n("Unlimited"); |
3404 |
ret.gpgkeyexpiration=i18n("Unlimited"); |
| 3057 |
else { |
3405 |
else { |
| 3058 |
TQDate date = TQDate::fromString(ret.gpgkeyexpiration, Qt::ISODate); |
3406 |
TQDate date; |
|
|
3407 |
if (KgpgInterface::getGpgVersion() >= 210 ) { |
| 3408 |
TQDateTime timestamp; |
| 3409 |
timestamp.setTime_t(ret.gpgkeyexpiration.toInt()); |
| 3410 |
date = timestamp.date(); |
| 3411 |
} |
| 3412 |
else { |
| 3413 |
date = TQDate::fromString(ret.gpgkeyexpiration, Qt::ISODate); |
| 3414 |
} |
| 3415 |
Q_ASSERT (date.isValid()) /*tqWarning("expire date is not valid")*/; |
| 3059 |
ret.gpgkeyexpiration=TDEGlobal::locale()->formatDate(date, true); |
3416 |
ret.gpgkeyexpiration=TDEGlobal::locale()->formatDate(date, true); |
| 3060 |
} |
3417 |
} |
|
|
3418 |
|
| 3419 |
// search for Fullname |
| 3420 |
if ( ! keyString[9].isEmpty() ) { |
| 3421 |
|
| 3061 |
TQString fullname=keyString[9]; |
3422 |
TQString fullname=keyString[9]; |
|
|
3423 |
|
| 3062 |
if (fullname.find("<")!=-1) { |
3424 |
if (fullname.find("<")!=-1) { |
| 3063 |
ret.gpgkeymail=fullname.section('<',-1,-1); |
3425 |
ret.gpgkeymail=fullname.section('<',-1,-1); |
| 3064 |
ret.gpgkeymail.truncate(ret.gpgkeymail.length()-1); |
3426 |
ret.gpgkeymail.truncate(ret.gpgkeymail.length()-1); |
|
Lines 3069-3075
Link Here
|
| 3069 |
ret.gpgkeyname=fullname; |
3431 |
ret.gpgkeyname=fullname; |
| 3070 |
//ret.gpgkeyname=fullname.section('(',0,0); |
3432 |
//ret.gpgkeyname=fullname.section('(',0,0); |
| 3071 |
} |
3433 |
} |
| 3072 |
|
3434 |
} |
| 3073 |
//ret.gpgkeyname=KgpgInterface::checkForUtf8(ret.gpgkeyname); // FIXME lukas |
3435 |
//ret.gpgkeyname=KgpgInterface::checkForUtf8(ret.gpgkeyname); // FIXME lukas |
| 3074 |
|
3436 |
|
| 3075 |
TQString algo=keyString[3]; |
3437 |
TQString algo=keyString[3]; |