|
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]; |