diff options
Diffstat (limited to 'src/pwgui')
-rw-r--r-- | src/pwgui/pwgui.cpp | 77 | ||||
-rw-r--r-- | src/pwgui/pwgui.h | 32 | ||||
-rw-r--r-- | src/pwgui/pwgui.ui | 145 |
3 files changed, 0 insertions, 254 deletions
diff --git a/src/pwgui/pwgui.cpp b/src/pwgui/pwgui.cpp deleted file mode 100644 index 193341b..0000000 --- a/src/pwgui/pwgui.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "pwgui.h" -#include "ui_pwgui.h" -#include <QMessageBox> -#include <QTimer> -#include <QDesktopWidget> -#include <unistd.h> - -#define BUFLEN 400 - -// ____________________________________________________________________________ -PwGui::PwGui(int pfd, char *user, QWidget *parent) : - QMainWindow(parent), - ui(new Ui::PwGui), - pipefd(pfd) -{ - // Initialize UI - initializeUI(user); - connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(on_accept())); - connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(on_reject())); -} - -// ____________________________________________________________________________ -PwGui::~PwGui() -{ - delete ui; -} - -// ____________________________________________________________________________ -void PwGui::initializeUI(char *user) -{ - ui->setupUi(this); - - // Prefill username - if (user != NULL) { - ui->lineEditUser->setText(QString::fromUtf8(user)); - } - - // Protect password from being seen - ui->lineEditPass->setEchoMode(QLineEdit::Password); - ui->lineEditPass->setInputMethodHints(ui->lineEditPass->inputMethodHints() | Qt::ImhNoAutoUppercase); - - /* Main Window properties */ - - // Disable close button - this->setWindowFlags((this->windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::WindowStaysOnTopHint); - // center dialog on screen center - QRect desktopRect = QApplication::desktop()->screenGeometry(this); - this->move( desktopRect.width()/2-this->width()/2, - desktopRect.height()/2-this->height()/2 ); - this->show(); - this->showNormal(); - this->raise(); - this->activateWindow(); -} - -// ____________________________________________________________________________ -void PwGui::on_accept() -{ - char buffer[BUFLEN + 1]; - int len = snprintf(buffer, BUFLEN, "%s%c%s%c", ui->lineEditUser->text().toUtf8().constData(), 0, ui->lineEditPass->text().toUtf8().constData(), 0); - if (len > BUFLEN) { - len = BUFLEN; - } - buffer[len] = '\0'; - ::write(pipefd, buffer, len); - ::close(pipefd); - // Quit with code 0 - QCoreApplication::instance()->exit(0); -} - -// ____________________________________________________________________________ -void PwGui::on_reject() -{ - // Quit with code 1 - QCoreApplication::instance()->exit(1); -} - diff --git a/src/pwgui/pwgui.h b/src/pwgui/pwgui.h deleted file mode 100644 index 348c5a1..0000000 --- a/src/pwgui/pwgui.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef AUTHENTICATION_H -#define AUTHENTICATION_H - -#include <QMainWindow> -#include <QDebug> - -namespace Ui -{ -class PwGui; -} - -class QTimer; - -class PwGui : public QMainWindow -{ - Q_OBJECT - -public: - explicit PwGui(int pfd, char *user, QWidget *parent = 0); - ~PwGui(); - -private slots: - void on_accept(); - void on_reject(); - -private: - Ui::PwGui *ui; - void initializeUI(char *username); - int pipefd; -}; - -#endif // AUTHENTICATION_H diff --git a/src/pwgui/pwgui.ui b/src/pwgui/pwgui.ui deleted file mode 100644 index 236df30..0000000 --- a/src/pwgui/pwgui.ui +++ /dev/null @@ -1,145 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PwGui</class> - <widget class="QMainWindow" name="PwGui"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>310</width> - <height>160</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string>Drucken - Authentifizierung</string> - </property> - <widget class="QWidget" name="verticalLayoutWidget"> - <property name="geometry"> - <rect> - <x>9</x> - <y>9</y> - <width>291</width> - <height>141</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Benutzername</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLineEdit" name="lineEditUser"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Passwort</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLineEdit" name="lineEditPass"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QLabel" name="labelStatus"> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="frameShape"> - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="text"> - <string>Bitte Anmelden</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - <resources/> - <connections/> -</ui> |