File indexing completed on 2024-12-22 04:56:57
0001 /* 0002 SPDX-FileCopyrightText: 2010 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_urlconfigurationdialog.h" 0010 0011 #include <KDAV/Enums> 0012 0013 #include <QDialog> 0014 #include <QString> 0015 0016 class KJob; 0017 class QButtonGroup; 0018 class QModelIndex; 0019 class QStandardItemModel; 0020 class QPushButton; 0021 class UrlConfigurationDialog : public QDialog 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 explicit UrlConfigurationDialog(QWidget *parent = nullptr); 0027 ~UrlConfigurationDialog() override; 0028 0029 KDAV::Protocol protocol() const; 0030 void setProtocol(KDAV::Protocol protocol); 0031 0032 QString remoteUrl() const; 0033 void setRemoteUrl(const QString &url); 0034 0035 bool useDefaultCredentials() const; 0036 void setUseDefaultCredentials(bool defaultCreds); 0037 0038 QString username() const; 0039 void setDefaultUsername(const QString &name); 0040 void setUsername(const QString &name); 0041 0042 QString password() const; 0043 void setDefaultPassword(const QString &password); 0044 void setPassword(const QString &password); 0045 0046 private: 0047 void onConfigChanged(); 0048 void checkUserInput(); 0049 void onFetchButtonClicked(); 0050 void onOkButtonClicked(); 0051 void onCollectionsFetchDone(KJob *job); 0052 void onModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); 0053 void onChangeDisplayNameFinished(KJob *job); 0054 void initModel(); 0055 bool checkUserAuthInput(); 0056 void addModelRow(const QString &displayName, const QString &url); 0057 void writeConfig(); 0058 void readConfig(); 0059 0060 Ui::UrlConfigurationDialog mUi; 0061 QStandardItemModel *const mModel; 0062 QString mDefaultUsername; 0063 QString mDefaultPassword; 0064 QPushButton *mOkButton = nullptr; 0065 QButtonGroup *const mRemoteProtocolGroup; 0066 };