diff --git a/images/profile.png b/images/profile.png new file mode 100644 index 0000000..e6e955f Binary files /dev/null and b/images/profile.png differ diff --git a/profiledialog.cpp b/profiledialog.cpp new file mode 100644 index 0000000..38538be --- /dev/null +++ b/profiledialog.cpp @@ -0,0 +1,32 @@ +#include "profiledialog.h" +#include "ui_profiledialog.h" + +ProfileDialog::ProfileDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent) : + ZeiterfassungDialog(parent), + ui(new Ui::ProfileDialog) +{ + ui->setupUi(this); + + ui->spinBoxUserId->setValue(userInfo.userId); + ui->lineEditEmail->setText(userInfo.email); + ui->lineEditLongUsername->setText(userInfo.longUsername); + ui->lineEditText->setText(userInfo.text); + ui->lineEditUsername->setText(userInfo.username); + ui->lineEditStreet->setText(userInfo.street); + ui->lineEditCity->setText(userInfo.city); + ui->dateEditEmployedSince->setDate(userInfo.employedSince); + ui->dateEditEmployedTill->setDate(userInfo.employedTill); + ui->lineEditPlaceOfBirth->setText(userInfo.placeOfBirth); + ui->lineEditZipcode->setText(userInfo.zipcode); + ui->lineEditReligion->setText(userInfo.religion); + ui->lineEditDepartment->setText(userInfo.department); + ui->lineEditVerwendgr->setText(userInfo.verwendgr); + ui->lineEditTaetig->setText(userInfo.taetig); + ui->lineEditArbverh->setText(userInfo.arbverh); + ui->lineEditBetriebsnr->setText(userInfo.betriebsnr); +} + +ProfileDialog::~ProfileDialog() +{ + delete ui; +} diff --git a/profiledialog.h b/profiledialog.h new file mode 100644 index 0000000..3725fd7 --- /dev/null +++ b/profiledialog.h @@ -0,0 +1,18 @@ +#pragma once + +#include "zeiterfassungdialog.h" +#include "replies/getuserinforeply.h" + +namespace Ui { class ProfileDialog; } + +class ProfileDialog : public ZeiterfassungDialog +{ + Q_OBJECT + +public: + explicit ProfileDialog(const GetUserInfoReply::UserInfo &userInfo, QWidget *parent = Q_NULLPTR); + ~ProfileDialog(); + +private: + Ui::ProfileDialog *ui; +}; diff --git a/profiledialog.ui b/profiledialog.ui new file mode 100644 index 0000000..252749c --- /dev/null +++ b/profiledialog.ui @@ -0,0 +1,356 @@ + + + ProfileDialog + + + + 0 + 0 + 454 + 281 + + + + Profile + + + + + + true + + + + + 0 + 0 + 420 + 610 + + + + + + + User-ID: + + + spinBoxUserId + + + + + + + E-Mail: + + + lineEditEmail + + + + + + + Long username: + + + lineEditLongUsername + + + + + + + Text: + + + lineEditText + + + + + + + Username: + + + lineEditUsername + + + + + + + true + + + 16777215 + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + Street: + + + lineEditStreet + + + + + + + City: + + + lineEditCity + + + + + + + Employed since: + + + dateEditEmployedSince + + + + + + + Employed till: + + + dateEditEmployedTill + + + + + + + Place of birth: + + + lineEditPlaceOfBirth + + + + + + + Zipcode: + + + lineEditZipcode + + + + + + + Religion: + + + lineEditReligion + + + + + + + Department: + + + lineEditDepartment + + + + + + + Verwendgr: + + + lineEditVerwendgr + + + + + + + Taetig: + + + lineEditTaetig + + + + + + + Arbverh: + + + lineEditArbverh + + + + + + + Betriebsnr: + + + lineEditBetriebsnr + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + + + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + rejected() + ProfileDialog + close() + + + 226 + 5 + + + 226 + 0 + + + + + diff --git a/profileplugin.cpp b/profileplugin.cpp new file mode 100644 index 0000000..1dc949d --- /dev/null +++ b/profileplugin.cpp @@ -0,0 +1,39 @@ +#include "profileplugin.h" + +#include +#include +#include +#include +#include +#include + +#include "mainwindow.h" + +#include "profiledialog.h" + +ProfilePlugin::ProfilePlugin(QObject *parent) : + ZeiterfassungPlugin(parent) +{ + qDebug() << "called"; + + static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations")); + + if(m_translator.load(QLocale(), QStringLiteral("profileplugin"), QStringLiteral("_"), dir)) + { + if(!QCoreApplication::installTranslator(&m_translator)) + { + qWarning() << "could not install translation profileplugin"; + } + } + else + { + qWarning() << "could not load translation profileplugin"; + } +} + +void ProfilePlugin::attachTo(MainWindow &mainWindow) +{ + auto dialog = new ProfileDialog(mainWindow.userInfo(), &mainWindow); + mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/profileplugin/images/profile.png")), + tr("My profile"), dialog, &QDialog::open); +} diff --git a/profileplugin.h b/profileplugin.h new file mode 100644 index 0000000..ee1f67e --- /dev/null +++ b/profileplugin.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include + +#include "zeiterfassungplugin.h" + +class MainWindow; + +class Q_DECL_EXPORT ProfilePlugin : public ZeiterfassungPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "dbsoftware.zeiterfassung.plugin/1.0" FILE "profileplugin.json") + Q_INTERFACES(ZeiterfassungPlugin) + +public: + explicit ProfilePlugin(QObject *parent = Q_NULLPTR); + + // ZeiterfassungPlugin interface + void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE; + +private: + QTranslator m_translator; +}; diff --git a/profileplugin.json b/profileplugin.json new file mode 100644 index 0000000..e69de29 diff --git a/profileplugin.pro b/profileplugin.pro new file mode 100644 index 0000000..7864b95 --- /dev/null +++ b/profileplugin.pro @@ -0,0 +1,22 @@ +QT += core network gui widgets + +DBLIBS += zeiterfassungcore zeiterfassunggui + +TARGET = profileplugin + +HEADERS += profiledialog.h \ + profileplugin.h + +SOURCES += profiledialog.cpp \ + profileplugin.cpp + +FORMS += profiledialog.ui + +RESOURCES += profileplugin_resources.qrc + +TRANSLATIONS += translations/profileplugin_en.ts \ + translations/profileplugin_de.ts + +OTHER_FILES += profileplugin.json + +include(../plugin.pri) diff --git a/profileplugin_resources.qrc b/profileplugin_resources.qrc new file mode 100644 index 0000000..d1346b0 --- /dev/null +++ b/profileplugin_resources.qrc @@ -0,0 +1,5 @@ + + + images/profile.png + + diff --git a/translations/profileplugin_de.ts b/translations/profileplugin_de.ts new file mode 100644 index 0000000..e8cb231 --- /dev/null +++ b/translations/profileplugin_de.ts @@ -0,0 +1,111 @@ + + + + + ProfileDialog + + + Profile + Profil + + + + User-ID: + Benutzer-ID: + + + + E-Mail: + E-Mail: + + + + Long username: + Langer Benutzername: + + + + Text: + Text: + + + + Username: + Benutzername: + + + + Street: + Straße: + + + + City: + Stadt: + + + + Employed since: + Angestellt seit: + + + + Employed till: + Angestellt bis: + + + + Place of birth: + Geburtsort: + + + + Zipcode: + Postleitzahl: + + + + Religion: + Religion: + + + + Department: + Abteilung: + + + + Verwendgr: + Verwendgr: + + + + Taetig: + Taetig: + + + + Arbverh: + Arbverh: + + + + Betriebsnr: + Betriebsnr: + + + + + dd.MM.yyyy + dd.MM.yyyy + + + + ProfilePlugin + + + My profile + Mein Profil + + + diff --git a/translations/profileplugin_en.ts b/translations/profileplugin_en.ts new file mode 100644 index 0000000..d6f19e1 --- /dev/null +++ b/translations/profileplugin_en.ts @@ -0,0 +1,111 @@ + + + + + ProfileDialog + + + Profile + + + + + User-ID: + + + + + E-Mail: + + + + + Long username: + + + + + Text: + + + + + Username: + + + + + Street: + + + + + City: + + + + + Employed since: + + + + + Employed till: + + + + + Place of birth: + + + + + Zipcode: + + + + + Religion: + + + + + Department: + + + + + Verwendgr: + + + + + Taetig: + + + + + Arbverh: + + + + + Betriebsnr: + + + + + + dd.MM.yyyy + + + + + ProfilePlugin + + + My profile + + + +