Skip to content

Commit

Permalink
Update to new UI
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Dec 3, 2024
1 parent 96605f1 commit 947e6d2
Show file tree
Hide file tree
Showing 29 changed files with 1,136 additions and 1,408 deletions.
40 changes: 0 additions & 40 deletions client/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,6 @@ class DigidocConf final: public digidoc::XmlConfCurrent
#ifdef Q_OS_MAC
std::string TSLCache() const final
{ return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation).toStdString(); }

void setProxyHost( const std::string &host ) final
{ Settings::PROXY_HOST = host; }
void setProxyPort( const std::string &port ) final
{ Settings::PROXY_PORT = port; }
void setProxyUser( const std::string &user ) final
{ Settings::PROXY_USER = user; }
void setProxyPass( const std::string &pass ) final
{ Settings::PROXY_PASS = pass; }
#endif

std::vector<digidoc::X509Cert> TSCerts() const final
Expand Down Expand Up @@ -609,10 +600,6 @@ QVariant Application::confValue( ConfParameter parameter, const QVariant &value
switch( parameter )
{
case SiVaUrl: r = i->verifyServiceUri().c_str(); break;
case ProxyHost: r = i->proxyHost().c_str(); break;
case ProxyPort: r = i->proxyPort().c_str(); break;
case ProxyUser: r = i->proxyUser().c_str(); break;
case ProxyPass: r = i->proxyPass().c_str(); break;
case TSAUrl: r = i->TSUrl().c_str(); break;
case TSLUrl: r = i->TSLUrl().c_str(); break;
case TSLCache: r = i->TSLCache().c_str(); break;
Expand Down Expand Up @@ -884,33 +871,6 @@ int Application::run()
return exec();
}

void Application::setConfValue( ConfParameter parameter, const QVariant &value )
{
try
{
auto *i = dynamic_cast<digidoc::XmlConfCurrent*>(digidoc::Conf::instance());
if(!i)
return;
QByteArray v = value.toString().toUtf8();
switch( parameter )
{
case ProxyHost: i->setProxyHost( v.isEmpty()? std::string() : v.constData() ); break;
case ProxyPort: i->setProxyPort( v.isEmpty()? std::string() : v.constData() ); break;
case ProxyUser: i->setProxyUser( v.isEmpty()? std::string() : v.constData() ); break;
case ProxyPass: i->setProxyPass( v.isEmpty()? std::string() : v.constData() ); break;
case TSAUrl:
case SiVaUrl:
case TSLCerts:
case TSLUrl:
case TSLCache: break;
}
}
catch( const digidoc::Exception &e )
{
showWarning(tr("Caught exception!"), e);
}
}

void Application::showClient(const QStringList &params, bool crypto, bool sign, bool newWindow)
{
if(sign)
Expand Down
5 changes: 0 additions & 5 deletions client/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ class Application final: public BaseApplication
enum ConfParameter : quint8
{
SiVaUrl,
ProxyHost,
ProxyPort,
ProxyUser,
ProxyPass,
TSAUrl,
TSLUrl,
TSLCerts,
Expand Down Expand Up @@ -77,7 +73,6 @@ class Application final: public BaseApplication
static QWidget* mainWindow();
static void openHelp();
static uint readTSLVersion(const QString &path);
static void setConfValue( ConfParameter parameter, const QVariant &value );
static void showClient(const QStringList &params = {}, bool crypto = false, bool sign = false, bool newWindow = false);
static void updateTSLCache(const QDateTime &tslTime);

Expand Down
1 change: 1 addition & 0 deletions client/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const Option<QString, QString (*)()> Settings::CDOC2_DEFAULT_KEYSERVER { QString
return Application::confValue(QLatin1String("CDOC2-DEFAULT-KEYSERVER"))
.toString(QStringLiteral("00000000-0000-0000-0000-000000000000"));
}};
const Option<QString> Settings::CDOC2_UUID { QStringLiteral("CDOC2-UUID"), QStringLiteral("00000000-0000-0000-0000-000000000002") };
const Option<QString> Settings::CDOC2_GET { QStringLiteral("CDOC2-GET"), QStringLiteral(CDOC2_GET_URL) };
const Option<QByteArray> Settings::CDOC2_GET_CERT { QStringLiteral("CDOC2-GET-CERT") };
const Option<QString> Settings::CDOC2_POST { QStringLiteral("CDOC2-POST"), QStringLiteral(CDOC2_POST_URL) };
Expand Down
4 changes: 4 additions & 0 deletions client/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ struct Settings
void operator =(const T &value) const {
operator =(QVariant(value));
}
void operator() (const T &value) const {
operator =(QVariant(value));
}
template <typename P = T, typename = if_QString<P>>
void operator =(const std::string &value) const {
operator =(QString::fromStdString(value));
Expand Down Expand Up @@ -101,6 +104,7 @@ struct Settings
static const Option<bool> CDOC2_NOTIFICATION;
static const Option<bool> CDOC2_USE_KEYSERVER;
static const Option<QString, QString (*)()> CDOC2_DEFAULT_KEYSERVER;
static const Option<QString> CDOC2_UUID;
static const Option<QString> CDOC2_GET;
static const Option<QByteArray> CDOC2_GET_CERT;
static const Option<QString> CDOC2_POST;
Expand Down
Loading

0 comments on commit 947e6d2

Please sign in to comment.