File indexing completed on 2025-01-05 04:47:08
0001 /* 0002 SPDX-FileCopyrightText: 2010 KDAB 0003 SPDX-FileContributor: Tobias Koenig <tokoe@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <QDialog> 0011 0012 #include "akonadiwidgetstests_export.h" 0013 #include "conflicthandler_p.h" 0014 0015 class QTextBrowser; 0016 0017 namespace Akonadi 0018 { 0019 /** 0020 * @short A dialog to ask the user for a resolve strategy for conflicts. 0021 * 0022 * @author Tobias Koenig <tokoe@kde.org> 0023 */ 0024 class AKONADIWIDGET_TESTS_EXPORT ConflictResolveDialog : public QDialog 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 /** 0030 * Creates a new conflict resolve dialog. 0031 * 0032 * @param parent The parent widget. 0033 */ 0034 explicit ConflictResolveDialog(QWidget *parent = nullptr); 0035 0036 ~ConflictResolveDialog() override; 0037 0038 /** 0039 * Sets the items that causes the conflict. 0040 * 0041 * @param localItem The local item which causes the conflict. 0042 * @param otherItem The conflicting item from the Akonadi storage. 0043 * 0044 * @note Both items need the full payload set. 0045 */ 0046 void setConflictingItems(const Akonadi::Item &localItem, const Akonadi::Item &otherItem); 0047 0048 /** 0049 * Returns the resolve strategy the user choose. 0050 */ 0051 [[nodiscard]] ConflictHandler::ResolveStrategy resolveStrategy() const; 0052 0053 private Q_SLOTS: 0054 void slotUseLocalItemChoosen(); 0055 void slotUseOtherItemChoosen(); 0056 void slotUseBothItemsChoosen(); 0057 void slotOpenEditor(); 0058 0059 private: 0060 ConflictHandler::ResolveStrategy mResolveStrategy; 0061 0062 Akonadi::Item mLocalItem; 0063 Akonadi::Item mOtherItem; 0064 0065 QTextBrowser *mView = nullptr; 0066 QString mTextContent; 0067 }; 0068 0069 }