2017-09-20 Fred Gleason <fredg@paravelsystems.com>

* Added a 'Reset' button to the 'Edit Dropbox' dialog
	in rdadmin(1).
This commit is contained in:
Fred Gleason
2017-09-20 13:46:56 -04:00
parent 674bab322e
commit 0ba0267de3
10 changed files with 209 additions and 1 deletions

View File

@@ -56,7 +56,8 @@ EditDropbox::EditDropbox(int id,QWidget *parent)
box_dropbox=new RDDropbox(id);
setCaption(tr("Dropbox Configuration"));
setCaption(tr("Dropbox Configuration")+" ["+
tr("ID")+QString().sprintf(": %d]",id));
//
// Create Fonts
@@ -343,6 +344,17 @@ EditDropbox::EditDropbox(int id,QWidget *parent)
this,SLOT(createDatesToggledData(bool)));
//
// Reset Button
//
QPushButton *reset_button=new QPushButton(this);
reset_button->
setGeometry(10,sizeHint().height()-60,80,50);
reset_button->setDefault(true);
reset_button->setFont(font);
reset_button->setText(tr("&Reset"));
connect(reset_button,SIGNAL(clicked()),this,SLOT(resetData()));
//
// Ok Button
//
@@ -492,6 +504,23 @@ void EditDropbox::createDatesToggledData(bool state)
}
void EditDropbox::resetData()
{
if(QMessageBox::question(this,"RDAdmin - "+tr("Reset Dropbox"),
tr("Resetting the dropbox will clear the list of already imported\nfiles, causing any whose files remain to be imported again.")+"\n\n"+tr("Reset the dropbox?"),
QMessageBox::Yes,QMessageBox::No)!=QMessageBox::Yes) {
return;
}
QString sql=QString("delete from DROPBOX_PATHS where ")+
QString().sprintf("DROPBOX_ID=%d",box_dropbox->id());
printf("SQL: %s\n",(const char *)sql);
RDSqlQuery *q=new RDSqlQuery(sql);
delete q;
QMessageBox::information(this,"RDAdmin - "+tr("Reset Dropbox"),
tr("The dropbox has been reset."));
}
void EditDropbox::okData()
{
QString sql;