1
0
mirror of https://github.com/ElvishArtisan/rivendell.git synced 2025-05-30 23:52:34 +02:00

2018-02-06 Fred Gleason <fredg@paravelsystems.com>

* Refactored the RDAddLog class to use RDApplication.
This commit is contained in:
Fred Gleason 2018-02-05 23:31:54 -05:00
parent fc004e073e
commit bdb4283794
6 changed files with 19 additions and 23 deletions

@ -16681,3 +16681,5 @@
* Refactored the RDCartDialog class to use RDApplication. * Refactored the RDCartDialog class to use RDApplication.
2018-02-06 Fred Gleason <fredg@paravelsystems.com> 2018-02-06 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDCutDialog class to use RDApplication. * Refactored the RDCutDialog class to use RDApplication.
2018-02-06 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDAddLog class to use RDApplication.

@ -2,7 +2,7 @@
// //
// Create a Rivendell Log // Create a Rivendell Log
// //
// (C) Copyright 2002-2004,2016-2017 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2004,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
@ -22,14 +22,15 @@
#include <qmessagebox.h> #include <qmessagebox.h>
#include "rdapplication.h"
#include "rddb.h" #include "rddb.h"
#include "rdescape_string.h" #include "rdescape_string.h"
#include "rdidvalidator.h" #include "rdidvalidator.h"
#include "rdadd_log.h" #include "rdadd_log.h"
RDAddLog::RDAddLog(QString *logname,QString *svcname, RDAddLog::RDAddLog(QString *logname,QString *svcname,
RDLogFilter::FilterMode mode,RDUser *user,RDStation *station, RDLogFilter::FilterMode mode,const QString &caption,
const QString &caption,QWidget *parent) QWidget *parent)
: QDialog(parent,"",true) : QDialog(parent,"",true)
{ {
QStringList services_list; QStringList services_list;
@ -37,7 +38,6 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname,
RDSqlQuery *q; RDSqlQuery *q;
log_name=logname; log_name=logname;
log_svc=svcname; log_svc=svcname;
log_station=station;
// //
// Fix the Window Size // Fix the Window Size
@ -116,15 +116,14 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname,
break; break;
case RDLogFilter::UserFilter: case RDLogFilter::UserFilter:
if(user!=NULL) {
sql=QString("select SERVICE_NAME from USER_SERVICE_PERMS where ")+ sql=QString("select SERVICE_NAME from USER_SERVICE_PERMS where ")+
"USER_NAME=\""+RDEscapeString(user->name())+"\" order by SERVICE_NAME"; "USER_NAME=\""+RDEscapeString(rda->user()->name())+"\" "+
} "order by SERVICE_NAME";
break; break;
case RDLogFilter::StationFilter: case RDLogFilter::StationFilter:
sql=QString("select SERVICE_NAME from SERVICE_PERMS where ")+ sql=QString("select SERVICE_NAME from SERVICE_PERMS where ")+
"STATION_NAME=\""+RDEscapeString(station->name())+"\" "+ "STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\" "+
"order by SERVICE_NAME"; "order by SERVICE_NAME";
break; break;
} }

@ -5,7 +5,7 @@
// This class creates a basic dialog requesting from the user a name and // This class creates a basic dialog requesting from the user a name and
// corresponding service that is later used to create a new log. // corresponding service that is later used to create a new log.
// //
// (C) Copyright 2002-2003,2016-2017 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2003,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
@ -29,19 +29,15 @@
#include <qlineedit.h> #include <qlineedit.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <rdstation.h>
#include <rdlog.h> #include <rdlog.h>
#include <rdlogfilter.h> #include <rdlogfilter.h>
#include <rduser.h>
class RDAddLog : public QDialog class RDAddLog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
RDAddLog(QString *logname,QString *svcname,RDLogFilter::FilterMode mode, RDAddLog(QString *logname,QString *svcname,RDLogFilter::FilterMode mode,
RDUser *user,RDStation *station,const QString &caption, const QString &caption,QWidget *parent=0);
QWidget *parent=0);
~RDAddLog(); ~RDAddLog();
QSize sizeHint() const; QSize sizeHint() const;
QSizePolicy sizePolicy() const; QSizePolicy sizePolicy() const;
@ -61,9 +57,8 @@ class RDAddLog : public QDialog
QPushButton *add_cancel_button; QPushButton *add_cancel_button;
QString *log_name; QString *log_name;
QString *log_svc; QString *log_svc;
RDStation *log_station;
}; };
#endif #endif // RDADD_LOG_H

@ -203,8 +203,8 @@ void ListLogs::saveAsButtonData()
QString logname; QString logname;
QString svcname=*list_svcname; QString svcname=*list_svcname;
RDAddLog *log; RDAddLog *log;
log=new RDAddLog(&logname,&svcname,RDLogFilter::StationFilter,rda->user(), log=new RDAddLog(&logname,&svcname,RDLogFilter::StationFilter,
rda->station(),tr("Rename Log"),this); tr("Rename Log"),this);
if(log->exec()<0) { if(log->exec()<0) {
delete log; delete log;
return; return;

@ -1117,8 +1117,8 @@ void EditLog::saveasData()
QString err_msg; QString err_msg;
if(rda->user()->createLog()) { if(rda->user()->createLog()) {
log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter,rda->user(), log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter,
rda->station(),tr("Add Log"),this); tr("Add Log"),this);
if(log->exec()<0) { if(log->exec()<0) {
return; return;
} }

@ -363,8 +363,8 @@ void MainWidget::addData()
RDAddLog *log; RDAddLog *log;
if(rda->user()->createLog()) { if(rda->user()->createLog()) {
log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter,rda->user(), log=new RDAddLog(&logname,&svcname,RDLogFilter::UserFilter,
rda->station(),tr("Add Log"),this); tr("Add Log"),this);
if(log->exec()!=0) { if(log->exec()!=0) {
delete log; delete log;
return; return;