emailQt/ParametersProvider.hpp

47 lines
886 B
C++

#pragma once
#include <QDialog>
#include <QIntValidator>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QSettings>
#include <QString>
#include <QVBoxLayout>
#include <QWidget>
#include "KeychainClass.hpp"
class ParametersProvider : public QDialog {
Q_OBJECT
public:
struct settings {
std::string userS, passS, imapS;
int port = 0;
};
explicit ParametersProvider(QWidget *parent = nullptr);
~ParametersProvider() = default;
void setFocusInternal();
const settings &getSettings();
signals:
void done();
public slots:
// Keychain to save password
void keyRead(const QString &key, const QString &value) const;
// When clicking OK
void start();
private:
settings sett;
QLineEdit *userField, *passField, *imapField, *portField;
KeychainClass keychain;
QSettings mSettings;
};