summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmview.cpp
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/pwmview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmview.cpp92
1 files changed, 86 insertions, 6 deletions
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index e23ce25..e53124f 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -456,11 +456,91 @@ void PwMView::copyCommentToClip()
456 PwM::copyToClipboard(d.comment.c_str()); 456 PwM::copyToClipboard(d.comment.c_str());
457} 457}
458 458
459/************************************************************************
460 *
461 *
462 *
463 ************************************************************************/
464
465
466PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name )
467 : QTextBrowser( parent, name )
468
469
470{
471//US setWrapPolicy( QTextEdit::AtWordBoundary );
472 setLinkUnderline( false );
473 // setVScrollBarMode( QScrollView::AlwaysOff );
474 //setHScrollBarMode( QScrollView::AlwaysOff );
475
476//US QStyleSheet *sheet = styleSheet();
477//US QStyleSheetItem *link = sheet->item( "a" );
478//US link->setColor( KGlobalSettings::linkColor() );
479
480}
481
482void PwMDataItemView::setPwMDataItem( const PwMDataItem& a )
483
484{
485 mItem = a;
486 // clear view
487 setText( QString::null );
488
489
490 QString dynamicPart;
491 QString format = "<tr><td align=\"right\"><b>%1</b></td>"
492 "<td align=\"left\">%2</td></tr>";
493
494 dynamicPart += format
495 .arg( i18n("Description") )
496 .arg( mItem.desc.c_str() );
459 497
498 dynamicPart += format
499 .arg( i18n("Name") )
500 .arg( mItem.name.c_str() );
501
502 dynamicPart += format
503 .arg( i18n("Password") )
504 .arg( mItem.pw.c_str() );
505
506 QString comment(mItem.pw.c_str());
507 dynamicPart += format
508 .arg( i18n("Comment") )
509 .arg( comment.replace( QRegExp("\n"), "<br>" ) );
510
511 dynamicPart += format
512 .arg( i18n("URL") )
513 .arg( mItem.url.c_str() );
514
515 dynamicPart += format
516 .arg( i18n("Launcher") )
517 .arg( mItem.launcher.c_str() );
518
519 QString mText = "<table><td colspan=\"2\">&nbsp;</td>";
520
521 mText += dynamicPart;
522 mText += "</table>";
523
524 // at last display it...
525 setText( mText );
526
527}
528
529PwMDataItem PwMDataItemView::pwmdataitem() const
530{
531 return mItem;
532}
533
534/************************************************************************
535 *
536 *
537 *
538 ************************************************************************/
460 539
461 540
462PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, 541PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name )
463 true ,i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false) 542 : KDialogBase(parent, name, true ,
543 i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false)
464{ 544{
465 findButton( Close )->setText( i18n("Cancel Sync")); 545 findButton( Close )->setText( i18n("Cancel Sync"));
466 findButton( Ok )->setText( i18n("Remote")); 546 findButton( Ok )->setText( i18n("Remote"));
@@ -478,15 +558,15 @@ PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool t
478 QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); 558 QLabel* lab = new QLabel( i18n("Local Entry"), subframe );
479 if ( takeloc ) 559 if ( takeloc )
480 lab->setBackgroundColor(Qt::green.light() ); 560 lab->setBackgroundColor(Qt::green.light() );
481 // AddresseeView * av = new AddresseeView( subframe ); 561 PwMDataItemView * av = new PwMDataItemView( subframe );
482 // av->setAddressee( loc ); 562 av->setPwMDataItem( loc );
483 subframe = new QVBox( topframe ); 563 subframe = new QVBox( topframe );
484 bl->addWidget(subframe ); 564 bl->addWidget(subframe );
485 lab = new QLabel( i18n("Remote Entry"), subframe ); 565 lab = new QLabel( i18n("Remote Entry"), subframe );
486 if ( !takeloc ) 566 if ( !takeloc )
487 lab->setBackgroundColor(Qt::green.light() ); 567 lab->setBackgroundColor(Qt::green.light() );
488 // av = new AddresseeView( subframe ); 568 av = new PwMDataItemView( subframe );
489 // av->setAddressee( rem ); 569 av->setPwMDataItem( rem );
490 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); 570 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
491 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); 571 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
492#ifndef DESKTOP_VERSION 572#ifndef DESKTOP_VERSION