mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-03 17:39:27 +02:00
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
* Converted rdlogin(1) to use RDApplication.
This commit is contained in:
parent
0adc505ffa
commit
4b6a4e3d65
@ -16609,3 +16609,5 @@
|
|||||||
* Converted rdcatch(1) to use RDApplication.
|
* Converted rdcatch(1) to use RDApplication.
|
||||||
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
|
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Converted rdlogedit(1) to use RDApplication.
|
* Converted rdlogedit(1) to use RDApplication.
|
||||||
|
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Converted rdlogin(1) to use RDApplication.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// The User Login/Logout Utility for Rivendell.
|
// The User Login/Logout Utility for Rivendell.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2008,2016 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2008,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -30,16 +30,15 @@
|
|||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
#include <qtranslator.h>
|
#include <qtranslator.h>
|
||||||
|
|
||||||
|
#include <dbversion.h>
|
||||||
#include <rd.h>
|
#include <rd.h>
|
||||||
#include <rduser.h>
|
#include <rdapplication.h>
|
||||||
#include <rdripc.h>
|
|
||||||
#include <rdcheck_daemons.h>
|
#include <rdcheck_daemons.h>
|
||||||
#include <rdcmd_switch.h>
|
#include <rdcmd_switch.h>
|
||||||
#include <rddbheartbeat.h>
|
|
||||||
#include <rddb.h>
|
#include <rddb.h>
|
||||||
#include <dbversion.h>
|
#include <rddbheartbeat.h>
|
||||||
|
|
||||||
#include <rdlogin.h>
|
#include "rdlogin.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Icons
|
// Icons
|
||||||
@ -54,8 +53,7 @@ MainWidget::MainWidget(QWidget *parent)
|
|||||||
QString str;
|
QString str;
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
bool skip_db_check=false;
|
QString err_msg;
|
||||||
unsigned schema=0;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read Command Options
|
// Read Command Options
|
||||||
@ -63,7 +61,6 @@ MainWidget::MainWidget(QWidget *parent)
|
|||||||
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogin","\n");
|
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogin","\n");
|
||||||
for(unsigned i=0;i<cmd->keys();i++) {
|
for(unsigned i=0;i<cmd->keys();i++) {
|
||||||
if(cmd->key(i)=="--skip-db-check") {
|
if(cmd->key(i)=="--skip-db-check") {
|
||||||
skip_db_check=true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete cmd;
|
delete cmd;
|
||||||
@ -101,50 +98,21 @@ MainWidget::MainWidget(QWidget *parent)
|
|||||||
//
|
//
|
||||||
RDInitializeDaemons();
|
RDInitializeDaemons();
|
||||||
|
|
||||||
//
|
rda=new RDApplication("RDLogin",this);
|
||||||
// Load Configs
|
if(!rda->open(&err_msg)) {
|
||||||
//
|
QMessageBox::critical(this,"RDLogin - "+tr("Error"),err_msg);
|
||||||
login_config=new RDConfig();
|
exit(1);
|
||||||
login_config->load();
|
}
|
||||||
login_config->setModuleName("RDLogin");
|
|
||||||
|
|
||||||
str=QString(tr("RDLogin - Station:"));
|
str=QString(tr("RDLogin - Station:"));
|
||||||
setCaption(QString().sprintf("%s %s",(const char *)str,
|
setCaption(str+" "+rda->config()->stationName());
|
||||||
(const char *)login_config->stationName()));
|
|
||||||
|
|
||||||
//
|
|
||||||
// Open Database
|
|
||||||
//
|
|
||||||
QString err(tr("rdlogin : "));
|
|
||||||
login_db = RDInitDb(&schema,&err);
|
|
||||||
if(!login_db) {
|
|
||||||
QMessageBox::warning(this,tr("Can't Connect"),err);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if((schema!=RD_VERSION_DATABASE)&&(!skip_db_check)) {
|
|
||||||
fprintf(stderr,"rdlogin: database version mismatch, should be %u, is %u\n",
|
|
||||||
RD_VERSION_DATABASE,schema);
|
|
||||||
exit(256);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Station
|
|
||||||
//
|
|
||||||
login_station=new RDStation(login_config->stationName());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// RIPC Connection
|
// RIPC Connection
|
||||||
//
|
//
|
||||||
login_ripc=new RDRipc(login_station,login_config,this);
|
connect(rda->ripc(),SIGNAL(connected(bool)),this,SLOT(connectedData(bool)));
|
||||||
connect(login_ripc,SIGNAL(connected(bool)),this,SLOT(connectedData(bool)));
|
connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userData()));
|
||||||
connect(login_ripc,SIGNAL(userChanged()),this,SLOT(userData()));
|
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,
|
||||||
login_ripc->connectHost("localhost",RIPCD_TCP_PORT,
|
rda->config()->password());
|
||||||
login_config->password());
|
|
||||||
|
|
||||||
//
|
|
||||||
// System
|
|
||||||
//
|
|
||||||
login_system=new RDSystem();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// User Label
|
// User Label
|
||||||
@ -178,7 +146,7 @@ MainWidget::MainWidget(QWidget *parent)
|
|||||||
login_username_label=new QLabel(login_username_box,tr("&Username:"),this);
|
login_username_label=new QLabel(login_username_box,tr("&Username:"),this);
|
||||||
login_username_label->setFont(small_label_font);
|
login_username_label->setFont(small_label_font);
|
||||||
login_username_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
|
login_username_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
|
||||||
if(login_system->showUserList()) {
|
if(rda->system()->showUserList()) {
|
||||||
login_username_edit->hide();
|
login_username_edit->hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -226,9 +194,6 @@ MainWidget::MainWidget(QWidget *parent)
|
|||||||
|
|
||||||
MainWidget::~MainWidget()
|
MainWidget::~MainWidget()
|
||||||
{
|
{
|
||||||
delete login_db;
|
|
||||||
delete login_ripc;
|
|
||||||
delete login_station;
|
|
||||||
delete login_label;
|
delete login_label;
|
||||||
delete login_username_box;
|
delete login_username_box;
|
||||||
delete login_password_edit;
|
delete login_password_edit;
|
||||||
@ -258,7 +223,7 @@ void MainWidget::userData()
|
|||||||
|
|
||||||
str=QString(tr("Current User:"));
|
str=QString(tr("Current User:"));
|
||||||
login_label->setText(QString().sprintf("%s %s",(const char *)str,
|
login_label->setText(QString().sprintf("%s %s",(const char *)str,
|
||||||
(const char *)login_ripc->user()));
|
(const char *)rda->ripc()->user()));
|
||||||
resizeEvent(NULL);
|
resizeEvent(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,18 +232,18 @@ void MainWidget::loginData()
|
|||||||
{
|
{
|
||||||
RDUser *user;
|
RDUser *user;
|
||||||
|
|
||||||
if(login_system->showUserList()) {
|
if(rda->system()->showUserList()) {
|
||||||
user=new RDUser(login_username_box->currentText());
|
user=new RDUser(login_username_box->currentText());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
user=new RDUser(login_username_edit->text());
|
user=new RDUser(login_username_edit->text());
|
||||||
}
|
}
|
||||||
if(user->exists()&&user->checkPassword(login_password_edit->text(),false)) {
|
if(user->exists()&&user->checkPassword(login_password_edit->text(),false)) {
|
||||||
if(login_system->showUserList()) {
|
if(rda->system()->showUserList()) {
|
||||||
login_ripc->setUser(login_username_box->currentText());
|
rda->ripc()->setUser(login_username_box->currentText());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
login_ripc->setUser(login_username_edit->text());
|
rda->ripc()->setUser(login_username_edit->text());
|
||||||
}
|
}
|
||||||
login_password_edit->clear();
|
login_password_edit->clear();
|
||||||
delete user;
|
delete user;
|
||||||
@ -294,8 +259,8 @@ void MainWidget::loginData()
|
|||||||
|
|
||||||
void MainWidget::logoutData()
|
void MainWidget::logoutData()
|
||||||
{
|
{
|
||||||
QString default_name=login_station->defaultName();
|
QString default_name=rda->station()->defaultName();
|
||||||
login_ripc->setUser(default_name);
|
rda->ripc()->setUser(default_name);
|
||||||
login_password_edit->clear();
|
login_password_edit->clear();
|
||||||
for(int i=0;i<login_username_box->count();i++) {
|
for(int i=0;i<login_username_box->count();i++) {
|
||||||
if(login_username_box->text(i)==default_name) {
|
if(login_username_box->text(i)==default_name) {
|
||||||
@ -316,7 +281,6 @@ void MainWidget::cancelData()
|
|||||||
|
|
||||||
void MainWidget::quitMainWidget()
|
void MainWidget::quitMainWidget()
|
||||||
{
|
{
|
||||||
login_db->removeDatabase(login_config->mysqlDbname());
|
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// The User Login/Logout Utility for Rivendell.
|
// The User Login/Logout Utility for Rivendell.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2005,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -27,14 +27,9 @@
|
|||||||
#include <qsqldatabase.h>
|
#include <qsqldatabase.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
|
#include <qlabel.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
|
|
||||||
#include <rduser.h>
|
|
||||||
#include <rdstation.h>
|
|
||||||
#include <rdripc.h>
|
|
||||||
#include <rdconfig.h>
|
|
||||||
#include <rdsystem.h>
|
|
||||||
|
|
||||||
class MainWidget : public QWidget
|
class MainWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -56,11 +51,6 @@ class MainWidget : public QWidget
|
|||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RDConfig *login_config;
|
|
||||||
QSqlDatabase *login_db;
|
|
||||||
RDStation *login_station;
|
|
||||||
RDSystem *login_system;
|
|
||||||
RDRipc *login_ripc;
|
|
||||||
Q_UINT16 login_ripc_hostport;
|
Q_UINT16 login_ripc_hostport;
|
||||||
QLabel *login_label;
|
QLabel *login_label;
|
||||||
QLabel *login_username_label;
|
QLabel *login_username_label;
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>rdlogin : </source>
|
<source>rdlogin : </source>
|
||||||
<translation>rdlogin :</translation>
|
<translation type="obsolete">rdlogin :</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Can't Connect</source>
|
<source>Can't Connect</source>
|
||||||
<translation>Nelze spojit</translation>
|
<translation type="obsolete">Nelze spojit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Current User: unknown</source>
|
<source>Current User: unknown</source>
|
||||||
@ -55,5 +55,9 @@ uživatel</translation>
|
|||||||
<source>Invalid Username or Password!</source>
|
<source>Invalid Username or Password!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>rdlogin : </source>
|
<source>rdlogin : </source>
|
||||||
<translation>rdlogin :</translation>
|
<translation type="obsolete">rdlogin :</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Can't Connect</source>
|
<source>Can't Connect</source>
|
||||||
<translation>Kann nicht verbinden</translation>
|
<translation type="obsolete">Kann nicht verbinden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Current User: unknown</source>
|
<source>Current User: unknown</source>
|
||||||
@ -54,5 +54,9 @@ User</source>
|
|||||||
<source>Invalid Username or Password!</source>
|
<source>Invalid Username or Password!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Can't Connect</source>
|
<source>Can't Connect</source>
|
||||||
<translation>No puedo conectarme</translation>
|
<translation type="obsolete">No puedo conectarme</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Current User:</source>
|
<source>Current User:</source>
|
||||||
@ -49,11 +49,15 @@ User</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>rdlogin : </source>
|
<source>rdlogin : </source>
|
||||||
<translation>rdlogin : </translation>
|
<translation type="obsolete">rdlogin : </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Invalid Username or Password!</source>
|
<source>Invalid Username or Password!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -5,14 +5,6 @@
|
|||||||
<source>RDLogin - Station:</source>
|
<source>RDLogin - Station:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>rdlogin : </source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Can't Connect</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Current User: unknown</source>
|
<source>Current User: unknown</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
@ -50,5 +42,9 @@ User</source>
|
|||||||
<source>Invalid Username or Password!</source>
|
<source>Invalid Username or Password!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>rdlogin : </source>
|
<source>rdlogin : </source>
|
||||||
<translation>rdlogin:</translation>
|
<translation type="obsolete">rdlogin:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Can't Connect</source>
|
<source>Can't Connect</source>
|
||||||
<translation>Greier ikkje kopla til</translation>
|
<translation type="obsolete">Greier ikkje kopla til</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Current User: unknown</source>
|
<source>Current User: unknown</source>
|
||||||
@ -55,5 +55,9 @@ brukar</translation>
|
|||||||
<source>Invalid Username or Password!</source>
|
<source>Invalid Username or Password!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>rdlogin : </source>
|
<source>rdlogin : </source>
|
||||||
<translation>rdlogin:</translation>
|
<translation type="obsolete">rdlogin:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Can't Connect</source>
|
<source>Can't Connect</source>
|
||||||
<translation>Greier ikkje kopla til</translation>
|
<translation type="obsolete">Greier ikkje kopla til</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Current User: unknown</source>
|
<source>Current User: unknown</source>
|
||||||
@ -55,5 +55,9 @@ brukar</translation>
|
|||||||
<source>Invalid Username or Password!</source>
|
<source>Invalid Username or Password!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>rdlogin : </source>
|
<source>rdlogin : </source>
|
||||||
<translation>rdlogin : </translation>
|
<translation type="obsolete">rdlogin : </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Can't Connect</source>
|
<source>Can't Connect</source>
|
||||||
<translation>Não foi possível conectar</translation>
|
<translation type="obsolete">Não foi possível conectar</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Current User: unknown</source>
|
<source>Current User: unknown</source>
|
||||||
@ -56,5 +56,9 @@ Padrão</translation>
|
|||||||
<source>Invalid Username or Password!</source>
|
<source>Invalid Username or Password!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user