File indexing completed on 2024-12-22 04:56:55

0001 /*
0002     SPDX-FileCopyrightText: 2009 Grégory Oestreicher <greg@kamago.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_configdialog.h"
0010 
0011 #include <KDAV/Enums>
0012 
0013 #include <QDialog>
0014 
0015 #include <QList>
0016 #include <QPair>
0017 #include <QString>
0018 class QPushButton;
0019 class KConfigDialogManager;
0020 class QStandardItemModel;
0021 
0022 class ConfigDialog : public QDialog
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit ConfigDialog(QWidget *parent = nullptr);
0028     ~ConfigDialog() override;
0029 
0030     void setPassword(const QString &password);
0031 
0032 private:
0033     void onSyncRangeStartTypeChanged();
0034     void checkUserInput();
0035     void onAddButtonClicked();
0036     void onSearchButtonClicked();
0037     void onRemoveButtonClicked();
0038     void onEditButtonClicked();
0039     void checkConfiguredUrlsButtonsState();
0040     void onOkClicked();
0041     void onCancelClicked();
0042 
0043     void readConfig();
0044     void writeConfig();
0045     void addModelRow(const QString &protocol, const QString &url);
0046     void insertModelRow(int index, const QString &protocol, const QString &url);
0047 
0048     Ui::ConfigDialog mUi;
0049     KConfigDialogManager *mManager = nullptr;
0050     QList<QPair<QString, KDAV::Protocol>> mAddedUrls;
0051     QList<QPair<QString, KDAV::Protocol>> mRemovedUrls;
0052     QStandardItemModel *const mModel;
0053     QPushButton *mOkButton = nullptr;
0054 };