18 #include <QPushButton>
19 #include <QHBoxLayout>
20 #include <QVBoxLayout>
44 if( m_mergeItem == 0 ) {
48 switch( m_resolveAction ) {
68 QDialogButtonBox::StandardButton standardButton = m_box->standardButton( button );
69 switch(standardButton) {
70 case QDialogButtonBox::NoButton:
72 int actionRole = button->property(
"ActionRole" ).toInt();
73 switch( actionRole ) {
102 void ConflictDialog::prepareLayout()
105 qDeleteAll( children() );
106 m_box =
new QDialogButtonBox( QDialogButtonBox::Cancel );
108 QPushButton *localButton =
new QPushButton( tr(
"Use local" ) );
109 QPushButton *cloudButton =
new QPushButton( tr(
"Use cloud" ) );
110 QPushButton *allLocalButton =
new QPushButton( tr(
"Always use local" ) );
111 QPushButton *allCloudButton =
new QPushButton( tr(
"Always use cloud" ) );
113 localButton->setDefault(
true );
119 m_box->addButton( localButton, QDialogButtonBox::ActionRole );
120 m_box->addButton( cloudButton, QDialogButtonBox::ActionRole );
121 m_box->addButton( allLocalButton, QDialogButtonBox::ActionRole );
122 m_box->addButton( allCloudButton, QDialogButtonBox::ActionRole );
124 QVBoxLayout *leftLayout =
new QVBoxLayout();
125 QString localHeaderText = tr(
"Local placemark" );
126 QString localDetailText = tr(
"Path: %0 <br /> Name: %1 <br /> Description: %2 <br /> Status: %3" )
128 switch( m_mergeItem->
actionA() ) {
130 localDetailText = localDetailText.arg( tr(
"Changed" ) );
133 localDetailText = localDetailText.arg( tr(
"Deleted" ) );
139 QLabel *localHeaderLabel =
new QLabel( localHeaderText );
140 QLabel *localDetailLabel =
new QLabel( localDetailText );
141 leftLayout->addWidget( localHeaderLabel );
142 leftLayout->addWidget( localDetailLabel );
144 QVBoxLayout *rightLayout =
new QVBoxLayout();
145 QString cloudHeaderText = tr(
"Cloud placemark" );
146 QString cloudDetailText = tr(
"Path: %0 <br /> Name: %1 <br /> Description: %2 <br /> Status: %3" )
148 switch( m_mergeItem->
actionB() ) {
150 cloudDetailText = cloudDetailText.arg( tr(
"Changed" ) );
153 cloudDetailText = cloudDetailText.arg( tr(
"Deleted" ) );
158 QLabel *cloudHeaderLabel =
new QLabel( cloudHeaderText );
159 QLabel *cloudDetailLabel =
new QLabel( cloudDetailText );
160 rightLayout->addWidget( cloudHeaderLabel );
161 rightLayout->addWidget( cloudDetailLabel );
163 QHBoxLayout *detailLayout =
new QHBoxLayout();
164 detailLayout->addLayout( leftLayout );
165 detailLayout->addLayout( rightLayout );
167 QLabel *descriptionLabel =
new QLabel();
168 QString descriptionText = tr(
"A bookmark on this device conflicts " \
169 "with a cloud bookmark. Which one do " \
170 "you want to keep?" );
171 descriptionLabel->setText( descriptionText );
173 QVBoxLayout *mainLayout =
new QVBoxLayout();
174 mainLayout->addWidget( descriptionLabel );
175 mainLayout->addLayout( detailLayout );
176 mainLayout->addWidget( m_box );
178 setLayout( mainLayout );
179 setWindowTitle( tr(
"Synchronization Conflict" ) );
187 #include "ConflictDialog.moc"
MergeItem::Action actionA
MergeItem::Action actionB
void setResolution(MergeItem::Resolution resolution)
void setMergeItem(MergeItem *item)
void resolveConflict(MergeItem *mergeItem)
ConflictDialog(QWidget *parent=0)