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

View File

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

View File

@ -2,7 +2,7 @@
//
// 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
// it under the terms of the GNU General Public License version 2 as
@ -22,14 +22,15 @@
#include <qmessagebox.h>
#include "rdapplication.h"
#include "rddb.h"
#include "rdescape_string.h"
#include "rdidvalidator.h"
#include "rdadd_log.h"
RDAddLog::RDAddLog(QString *logname,QString *svcname,
RDLogFilter::FilterMode mode,RDUser *user,RDStation *station,
const QString &caption,QWidget *parent)
RDLogFilter::FilterMode mode,const QString &caption,
QWidget *parent)
: QDialog(parent,"",true)
{
QStringList services_list;
@ -37,7 +38,6 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname,
RDSqlQuery *q;
log_name=logname;
log_svc=svcname;
log_station=station;
//
// Fix the Window Size
@ -116,15 +116,14 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname,
break;
case RDLogFilter::UserFilter:
if(user!=NULL) {
sql=QString("select SERVICE_NAME from USER_SERVICE_PERMS where ")+
"USER_NAME=\""+RDEscapeString(user->name())+"\" order by SERVICE_NAME";
}
sql=QString("select SERVICE_NAME from USER_SERVICE_PERMS where ")+
"USER_NAME=\""+RDEscapeString(rda->user()->name())+"\" "+
"order by SERVICE_NAME";
break;
case RDLogFilter::StationFilter:
sql=QString("select SERVICE_NAME from SERVICE_PERMS where ")+
"STATION_NAME=\""+RDEscapeString(station->name())+"\" "+
"STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\" "+
"order by SERVICE_NAME";
break;
}

View File

@ -5,7 +5,7 @@
// This class creates a basic dialog requesting from the user a name and
// 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
// it under the terms of the GNU General Public License version 2 as
@ -29,19 +29,15 @@
#include <qlineedit.h>
#include <qpushbutton.h>
#include <rdstation.h>
#include <rdlog.h>
#include <rdlogfilter.h>
#include <rduser.h>
class RDAddLog : public QDialog
{
Q_OBJECT
public:
RDAddLog(QString *logname,QString *svcname,RDLogFilter::FilterMode mode,
RDUser *user,RDStation *station,const QString &caption,
QWidget *parent=0);
const QString &caption,QWidget *parent=0);
~RDAddLog();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
@ -61,9 +57,8 @@ class RDAddLog : public QDialog
QPushButton *add_cancel_button;
QString *log_name;
QString *log_svc;
RDStation *log_station;
};
#endif
#endif // RDADD_LOG_H

View File

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

View File

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

View File

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