22 #include <tdelocale.h>
26 #include <tqpushbutton.h>
28 #include "addresseediffalgo.h"
29 #include "genericdiffalgo.h"
30 #include "htmldiffalgodisplay.h"
31 #include "memberinfo.h"
33 #include "singleconflictdialog.h"
35 SingleConflictDialog::SingleConflictDialog( QSync::SyncMapping &mapping, TQWidget *parent )
40 TQString format = mapping.changeAt( 0 ).objectFormatName();
41 QSync::SyncChange leftChange = mapping.changeAt( 0 );
42 QSync::SyncChange rightChange = mapping.changeAt( 1 );
44 if ( format ==
"file" ) {
45 mDiffAlgo =
new KSync::GenericDiffAlgo( leftChange.data(), rightChange.data() );
46 }
else if ( format ==
"vcard" ) {
47 }
else if ( format ==
"calendar" ) {
48 }
else if ( format ==
"xml-contact" ) {
49 mDiffAlgo =
new KSync::AddresseeDiffAlgo( leftChange.data(), rightChange.data() );
52 MemberInfo miLeft( leftChange.member() );
53 mDiffAlgoDisplay->setLeftSourceTitle( miLeft.name() );
54 MemberInfo miRight( rightChange.member() );
55 mDiffAlgoDisplay->setRightSourceTitle( miRight.name() );
58 mDiffAlgo->addDisplay( mDiffAlgoDisplay );
63 SingleConflictDialog::~SingleConflictDialog()
69 void SingleConflictDialog::useFirstChange()
71 mMapping.solve( mMapping.changeAt( 0 ) );
76 void SingleConflictDialog::useSecondChange()
78 mMapping.solve( mMapping.changeAt( 1 ) );
83 void SingleConflictDialog::duplicateChange()
90 void SingleConflictDialog::ignoreChange()
97 void SingleConflictDialog::initGUI()
99 TQGridLayout *layout =
new TQGridLayout(
this, 3, 4, KDialog::marginHint(), KDialog::spacingHint() );
101 layout->addMultiCellWidget(
new TQLabel( i18n(
"A conflict has appeared, please solve it manually." ),
this ), 0, 0, 0, 3 );
102 mDiffAlgoDisplay =
new KSync::HTMLDiffAlgoDisplay(
this );
104 layout->addMultiCellWidget( mDiffAlgoDisplay, 1, 1, 0, 3 );
106 TQPushButton *button =
new TQPushButton( i18n(
"Use Item" ),
this );
107 connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( useFirstChange() ) );
108 layout->addWidget( button, 2, 0 );
110 button =
new TQPushButton( i18n(
"Duplicate Items" ),
this );
111 connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( duplicateChange() ) );
112 layout->addWidget( button, 2, 1 );
114 button =
new TQPushButton( i18n(
"Ignore Conflict" ),
this );
115 connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( ignoreChange() ) );
116 layout->addWidget( button, 2, 2 );
118 button =
new TQPushButton( i18n(
"Use Item" ),
this );
119 connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( useSecondChange() ) );
120 layout->addWidget( button, 2, 3 );
123 #include "singleconflictdialog.moc"