Update dialogs calls
This commit is contained in:
parent
051e0c0f9b
commit
418eef9e21
|
@ -313,12 +313,12 @@ void MainWindow::readConfigs()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
file = QString::fromStdString( this->configs_path );
|
||||
}
|
||||
DialogSec::errConfFileNotReadable( nullptr, file );
|
||||
DialogSec::errConfFileNotReadable( file );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// the given path doesn't point to a file
|
||||
proceed = DialogSec::choiceFileNotFile( nullptr, QString::fromStdString( this->configs_path ) );
|
||||
proceed = DialogSec::choiceFileNotFile( QString::fromStdString( this->configs_path ) );
|
||||
if ( proceed ) {
|
||||
proceed = IOutils::renameAsCopy( this->configs_path );
|
||||
if ( ! proceed ) {
|
||||
|
@ -326,7 +326,7 @@ void MainWindow::readConfigs()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
path = QString::fromStdString( this->configs_path );
|
||||
}
|
||||
DialogSec::errRenaming( nullptr, QString::fromStdString( this->configs_path ) );
|
||||
DialogSec::errRenaming( QString::fromStdString( this->configs_path ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ void MainWindow::readConfigs()
|
|||
if ( this->dialogs_level == 2 ) {
|
||||
file = QString::fromStdString( this->configs_path );
|
||||
}
|
||||
DialogSec::warnConfFileNotFound( nullptr, file );
|
||||
DialogSec::warnConfFileNotFound( file );
|
||||
}
|
||||
|
||||
if ( proceed ) {
|
||||
|
@ -376,12 +376,12 @@ void MainWindow::readConfigs()
|
|||
if ( var == "Language" ) {
|
||||
if ( val.size() > 2 ) {
|
||||
// not a valid locale, keep the default
|
||||
DialogSec::errLangLocaleInvalid( nullptr, QString::fromStdString( val ) );
|
||||
DialogSec::errLangLocaleInvalid( QString::fromStdString( val ) );
|
||||
} else {
|
||||
if ( val == "en" || val == "es" || val == "fr" || val == "it" ) {
|
||||
this->language = val;
|
||||
} else {
|
||||
DialogSec::errLangNotAccepted( nullptr, QString::fromStdString( val ) );
|
||||
DialogSec::errLangNotAccepted( QString::fromStdString( val ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -564,11 +564,11 @@ void MainWindow::readConfigs()
|
|||
} catch (const std::ios_base::failure& err) {
|
||||
// failed reading
|
||||
QString msg = DialogSec::tr("An error occured while reading the configuration file");
|
||||
DialogSec::errGeneric( nullptr, msg );
|
||||
DialogSec::errGeneric( msg );
|
||||
} catch (...) {
|
||||
// something failed
|
||||
QString msg = DialogSec::tr("An error occured while parsing configuration file's data");
|
||||
DialogSec::errGeneric( nullptr, msg );
|
||||
DialogSec::errGeneric( msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -594,13 +594,13 @@ void MainWindow::writeConfigs()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
file = QString::fromStdString( this->configs_path );
|
||||
}
|
||||
DialogSec::errConfFileNotWritable( nullptr, file );
|
||||
DialogSec::errConfFileNotWritable( file );
|
||||
msg_shown = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// the given path doesn't point to a file
|
||||
proceed = DialogSec::choiceFileNotFile( nullptr, QString::fromStdString( this->configs_path ) );
|
||||
proceed = DialogSec::choiceFileNotFile( QString::fromStdString( this->configs_path ) );
|
||||
if ( proceed ) {
|
||||
proceed = IOutils::renameAsCopy( this->configs_path );
|
||||
if ( ! proceed ) {
|
||||
|
@ -608,7 +608,7 @@ void MainWindow::writeConfigs()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
path = QString::fromStdString( this->configs_path );
|
||||
}
|
||||
DialogSec::errRenaming( nullptr, path );
|
||||
DialogSec::errRenaming( path );
|
||||
msg_shown = true;
|
||||
}
|
||||
}
|
||||
|
@ -631,13 +631,13 @@ void MainWindow::writeConfigs()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
file = QString::fromStdString( base_path );
|
||||
}
|
||||
DialogSec::errConfDirNotWritable( nullptr, file );
|
||||
DialogSec::errConfDirNotWritable( file );
|
||||
msg_shown = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// not a directory
|
||||
proceed = DialogSec::choiceDirNotDir( nullptr, QString::fromStdString( base_path ) );
|
||||
proceed = DialogSec::choiceDirNotDir( QString::fromStdString( base_path ) );
|
||||
if ( proceed ) {
|
||||
proceed = IOutils::renameAsCopy( base_path );
|
||||
if ( ! proceed ) {
|
||||
|
@ -645,7 +645,7 @@ void MainWindow::writeConfigs()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
path = QString::fromStdString( base_path );
|
||||
}
|
||||
DialogSec::errRenaming( nullptr, path );
|
||||
DialogSec::errRenaming( path );
|
||||
msg_shown = true;
|
||||
} else {
|
||||
// make the new folder
|
||||
|
@ -671,7 +671,7 @@ void MainWindow::writeConfigs()
|
|||
}
|
||||
}
|
||||
if ( !proceed && !msg_shown ) {
|
||||
DialogSec::errConfFailedWriting( nullptr, msg );
|
||||
DialogSec::errConfFailedWriting( msg );
|
||||
}
|
||||
|
||||
if ( proceed ) {
|
||||
|
@ -757,10 +757,10 @@ void MainWindow::writeConfigs()
|
|||
|
||||
} catch (const std::ios_base::failure& err) {
|
||||
// failed writing
|
||||
DialogSec::errGeneric( nullptr, DialogSec::tr("An error occured while writing the configuration file") );
|
||||
DialogSec::errGeneric( DialogSec::tr("An error occured while writing the configuration file") );
|
||||
} catch (...) {
|
||||
// something failed
|
||||
DialogSec::errGeneric( nullptr, DialogSec::tr("An error occured while preparing the configuration file's data") );
|
||||
DialogSec::errGeneric( DialogSec::tr("An error occured while preparing the configuration file's data") );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ void MainWindow::backupDatabase()
|
|||
if ( std::filesystem::exists( path ) ) {
|
||||
if ( !std::filesystem::is_directory( path, err ) ) {
|
||||
// exists but it's not a directory, rename as copy and make a new one
|
||||
proceed = DialogSec::choiceDirNotDir( nullptr, QString::fromStdString( path ) );
|
||||
proceed = DialogSec::choiceDirNotDir( QString::fromStdString( path ) );
|
||||
if ( proceed ) {
|
||||
proceed = IOutils::renameAsCopy( path );
|
||||
if ( ! proceed ) {
|
||||
|
@ -784,7 +784,7 @@ void MainWindow::backupDatabase()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
p = QString::fromStdString( path );
|
||||
}
|
||||
DialogSec::errRenaming( nullptr, p );
|
||||
DialogSec::errRenaming( p );
|
||||
} else {
|
||||
// sucesfully renamed, make the new one
|
||||
proceed = IOutils::makeDir( path );
|
||||
|
@ -793,7 +793,7 @@ void MainWindow::backupDatabase()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
msg += ":\n"+QString::fromStdString( path );
|
||||
}
|
||||
DialogSec::errFailedMakeDir( nullptr, msg );
|
||||
DialogSec::errFailedMakeDir( msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ void MainWindow::backupDatabase()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
msg += ":\n"+QString::fromStdString( path );
|
||||
}
|
||||
DialogSec::errFailedMakeDir( nullptr, msg );
|
||||
DialogSec::errFailedMakeDir( msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ void MainWindow::backupDatabase()
|
|||
err );
|
||||
if ( ! proceed ) {
|
||||
// failed to copy
|
||||
DialogSec::errDatabaseFailedBackup( nullptr, DialogSec::tr( "Failed to copy the database file" ) );
|
||||
DialogSec::errDatabaseFailedBackup( DialogSec::tr( "Failed to copy the database file" ) );
|
||||
} else {
|
||||
// succesfully copied, now rename the already existing copies (up to the choosen number of copies)
|
||||
std::string path, new_path;
|
||||
|
@ -832,7 +832,7 @@ void MainWindow::backupDatabase()
|
|||
std::ignore = std::filesystem::remove_all( path, err );
|
||||
proceed = ! std::filesystem::exists( path );
|
||||
if ( ! proceed ) {
|
||||
DialogSec::errDatabaseFailedBackup( nullptr, DialogSec::tr( "Failed to update the backups" ) );
|
||||
DialogSec::errDatabaseFailedBackup( DialogSec::tr( "Failed to update the backups" ) );
|
||||
}
|
||||
}
|
||||
if ( proceed ) {
|
||||
|
@ -846,7 +846,7 @@ void MainWindow::backupDatabase()
|
|||
}
|
||||
if ( ! proceed ) {
|
||||
// seems it failed to rename
|
||||
DialogSec::errDatabaseFailedBackup( nullptr, DialogSec::tr( "Failed to update the backups" ) );
|
||||
DialogSec::errDatabaseFailedBackup( DialogSec::tr( "Failed to update the backups" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ void MainWindow::makeInitialChecks()
|
|||
// check that the sqlite plugin is available
|
||||
if ( ! QSqlDatabase::drivers().contains("QSQLITE") ) {
|
||||
// checks failed, abort
|
||||
DialogSec::errSqlDriverNotFound( nullptr, "QSQLITE" );
|
||||
DialogSec::errSqlDriverNotFound( "QSQLITE" );
|
||||
ok = false;
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1053,7 @@ void MainWindow::makeInitialChecks()
|
|||
err );
|
||||
} catch (...) {
|
||||
ok = false;
|
||||
DialogSec::errDirNotReadable( nullptr, QString::fromStdString( path ) );
|
||||
DialogSec::errDirNotReadable( QString::fromStdString( path ) );
|
||||
}
|
||||
}
|
||||
if ( ok ) {
|
||||
|
@ -1065,14 +1065,14 @@ void MainWindow::makeInitialChecks()
|
|||
err );
|
||||
} catch (...) {
|
||||
ok = false;
|
||||
DialogSec::errDirNotWritable( nullptr, QString::fromStdString( path ) );
|
||||
DialogSec::errDirNotWritable( QString::fromStdString( path ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// not a directory, rename as copy a make a new one
|
||||
ok = DialogSec::choiceDirNotDir( nullptr, QString::fromStdString( path ) );
|
||||
ok = DialogSec::choiceDirNotDir( QString::fromStdString( path ) );
|
||||
if ( ok ) {
|
||||
ok = IOutils::renameAsCopy( path );
|
||||
if ( ! ok ) {
|
||||
|
@ -1080,7 +1080,7 @@ void MainWindow::makeInitialChecks()
|
|||
if ( this->dialogs_level > 0 ) {
|
||||
p = QString::fromStdString( path );
|
||||
}
|
||||
DialogSec::errRenaming( nullptr, p );
|
||||
DialogSec::errRenaming( p );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1342,15 +1342,15 @@ void MainWindow::showHelp( const std::string& filename )
|
|||
}
|
||||
} else {
|
||||
// resource not readable
|
||||
DialogSec::errHelpNotReadable( nullptr, QString::fromStdString( link ) );
|
||||
DialogSec::errHelpNotReadable( QString::fromStdString( link ) );
|
||||
}
|
||||
} else {
|
||||
// resource is not a file
|
||||
DialogSec::errHelpFailed( nullptr, QString::fromStdString( link ), DialogSec::tr("unrecognized entry") );
|
||||
DialogSec::errHelpFailed( QString::fromStdString( link ), DialogSec::tr("unrecognized entry") );
|
||||
}
|
||||
} else {
|
||||
// resource not found
|
||||
DialogSec::errHelpNotFound( nullptr, QString::fromStdString( link ) );
|
||||
DialogSec::errHelpNotFound( QString::fromStdString( link ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1673,7 +1673,7 @@ void MainWindow::on_button_LogFiles_ViewFile_clicked()
|
|||
} catch (const GenericException& e) {
|
||||
// failed to find file
|
||||
proceed = false;
|
||||
DialogSec::errFileNotFound( nullptr, QString::fromStdString( item.path ), true );
|
||||
DialogSec::errFileNotFound( QString::fromStdString( item.path ), true );
|
||||
}
|
||||
|
||||
FormatOps::LogsFormat format = this->craplog.getCurrentLogFormat();
|
||||
|
@ -1701,7 +1701,7 @@ void MainWindow::on_button_LogFiles_ViewFile_clicked()
|
|||
// failed closing gzip file pointer
|
||||
proceed = false;
|
||||
// >> e.what() << //
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg(
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg(
|
||||
DialogSec::tr("Failed to read gzipped file"),
|
||||
item.name) );
|
||||
|
||||
|
@ -1709,11 +1709,11 @@ void MainWindow::on_button_LogFiles_ViewFile_clicked()
|
|||
// failed reading as text
|
||||
proceed = false;
|
||||
// >> err.what() << //
|
||||
DialogSec::errFailedReadFile( nullptr, item.name );*/
|
||||
DialogSec::errFailedReadFile( item.name );*/
|
||||
} catch (...) {
|
||||
// failed somehow
|
||||
proceed = false;
|
||||
DialogSec::errFailedReadFile( nullptr, item.name );
|
||||
DialogSec::errFailedReadFile( item.name );
|
||||
}
|
||||
|
||||
if ( proceed ) {
|
||||
|
@ -1797,10 +1797,18 @@ void MainWindow::on_button_MakeStats_Start_clicked()
|
|||
if ( (*i)->checkState(0) == Qt::CheckState::Checked ) {
|
||||
// tell Craplog to set this file as selected
|
||||
if ( ! this->craplog.setLogFileSelected( (*i)->text(0) ) ) {
|
||||
// this shouldn't be, but...
|
||||
if ( ! DialogSec::choiceSelectedFileNotFound( nullptr, (*i)->text(0) ) ) {
|
||||
// failed to retrieve the file. this shouldn't be, but...
|
||||
const int choice = DialogSec::choiceSelectedFileNotFound( (*i)->text(0) );
|
||||
if ( choice == 0 ) {
|
||||
// choosed to abort all
|
||||
proceed = false;
|
||||
break;
|
||||
} else if ( choice == 1 ) {
|
||||
// choosed to discard the file and continue
|
||||
;
|
||||
} else {
|
||||
// shouldn't be here
|
||||
throw GenericException( "Unexpeced value returned: "+std::to_string(choice) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,9 +279,9 @@ void Craplog::setApacheLogFormat( const std::string& format_string )
|
|||
this->formatOps.processApacheFormatString( format_string );
|
||||
this->logs_format_strings.at( this->APACHE_ID ) = format_string;
|
||||
} catch ( LogFormatException& e ) {
|
||||
DialogSec::errInvalidLogFormatString( nullptr, e.what() );
|
||||
DialogSec::errInvalidLogFormatString( e.what() );
|
||||
} catch (...) {
|
||||
DialogSec::errGeneric( nullptr, DialogSec::tr("An error occured while parsing the format string"), true );
|
||||
DialogSec::errGeneric( DialogSec::tr("An error occured while parsing the format string"), true );
|
||||
}
|
||||
}
|
||||
void Craplog::setNginxLogFormat( const std::string& format_string )
|
||||
|
@ -292,9 +292,9 @@ void Craplog::setNginxLogFormat( const std::string& format_string )
|
|||
this->formatOps.processNginxFormatString( format_string );
|
||||
this->logs_format_strings.at( this->NGINX_ID ) = format_string;
|
||||
} catch ( LogFormatException& e ) {
|
||||
DialogSec::errInvalidLogFormatString( nullptr, e.what() );
|
||||
DialogSec::errInvalidLogFormatString( e.what() );
|
||||
} catch (...) {
|
||||
DialogSec::errGeneric( nullptr, DialogSec::tr("An error occured while parsing the format string"), true );
|
||||
DialogSec::errGeneric( DialogSec::tr("An error occured while parsing the format string"), true );
|
||||
}
|
||||
}
|
||||
void Craplog::setIisLogFormat( const std::string& format_string, const int& log_module )
|
||||
|
@ -306,9 +306,9 @@ void Craplog::setIisLogFormat( const std::string& format_string, const int& log_
|
|||
this->logs_format_strings.at( this->IIS_ID ) = format_string;
|
||||
this->changeIisLogsBaseNames( log_module );
|
||||
} catch ( LogFormatException& e ) {
|
||||
DialogSec::errInvalidLogFormatString( nullptr, e.what() );
|
||||
DialogSec::errInvalidLogFormatString( e.what() );
|
||||
} catch (...) {
|
||||
DialogSec::errGeneric( nullptr, DialogSec::tr("An error occured while parsing the format string"), true );
|
||||
DialogSec::errGeneric( DialogSec::tr("An error occured while parsing the format string"), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,7 @@ void Craplog::scanLogsDir()
|
|||
if ( ! IOutils::isDir( logs_path ) ) {
|
||||
// this directory doesn't exists
|
||||
if ( IOutils::exists( logs_path ) ) {
|
||||
DialogSec::errDirNotExists( nullptr, QString::fromStdString( logs_path ) );
|
||||
DialogSec::errDirNotExists( QString::fromStdString( logs_path ) );
|
||||
}
|
||||
successful = false;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ void Craplog::scanLogsDir()
|
|||
if ( ! IOutils::checkFile( path, true ) ) {
|
||||
// not readable, skip
|
||||
if ( this->dialogs_level == 2 ) {
|
||||
DialogSec::warnFileNotReadable( nullptr, name );
|
||||
DialogSec::warnFileNotReadable( name );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -468,13 +468,13 @@ void Craplog::scanLogsDir()
|
|||
|
||||
} catch (GenericException& e) {
|
||||
// failed closing gzip file pointer
|
||||
DialogSec::errGeneric( nullptr, e.what() );
|
||||
DialogSec::errGeneric( e.what() );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( content.size() == 0 ) {
|
||||
if ( this->dialogs_level == 2 ) {
|
||||
DialogSec::warnEmptyFile( nullptr, name );
|
||||
DialogSec::warnEmptyFile( name );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ void Craplog::scanLogsDir()
|
|||
content.clear();
|
||||
if ( log_type == LogOps::LogType::Failed ) {
|
||||
// failed to get the log type, do not append
|
||||
DialogSec::errFailedDefiningLogType( nullptr, name );
|
||||
DialogSec::errFailedDefiningLogType( name );
|
||||
continue;
|
||||
} else if ( log_type == LogOps::LogType::Discarded ) {
|
||||
// skip
|
||||
|
@ -501,7 +501,7 @@ void Craplog::scanLogsDir()
|
|||
hash = this->hashOps.digestFile( path );
|
||||
} catch (GenericException& e) {
|
||||
// failed to digest
|
||||
DialogSec::errGeneric( nullptr, e.what() );
|
||||
DialogSec::errGeneric( e.what() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -743,7 +743,7 @@ void Craplog::run()
|
|||
|
||||
// only catch generic, leave others un-catched
|
||||
} catch (GenericException& e) {
|
||||
DialogSec::errGeneric( nullptr, e.what() );
|
||||
DialogSec::errGeneric( e.what() );
|
||||
this->proceed = false;;
|
||||
}
|
||||
|
||||
|
@ -772,17 +772,21 @@ const bool Craplog::checkStuff()
|
|||
if ( this->dialogs_level == 2 ) {
|
||||
msg += "\n" + QString::fromStdString( file.hash );
|
||||
}
|
||||
int choice = DialogSec::choiceFileAlreadyUsed( nullptr, msg );
|
||||
if ( choice < 0 ) {
|
||||
const int choice = DialogSec::choiceFileAlreadyUsed( msg );
|
||||
if ( choice == 0 ) {
|
||||
// choosed to abort all
|
||||
this->proceed = false;
|
||||
break;
|
||||
} else if ( choice > 0 ) {
|
||||
// choosed to discard and continue
|
||||
} else if ( choice == 1 ) {
|
||||
// choosed to discard the file and continue
|
||||
continue;
|
||||
}/* else {
|
||||
} else if ( choice == 2 ) {
|
||||
// choosed to ignore and use the file anyway
|
||||
}*/
|
||||
;
|
||||
} else {
|
||||
// shouldn't be here
|
||||
throw GenericException( "Unexpeced value returned: "+std::to_string(choice) );
|
||||
}
|
||||
}
|
||||
|
||||
// check if the file respects the warning size
|
||||
|
@ -813,17 +817,21 @@ const bool Craplog::checkStuff()
|
|||
msg += QString("\n\n%1:\n%2%3").arg( DialogSec::tr("Warning size parameter"), size_str, size_sfx.c_str() );
|
||||
}
|
||||
}
|
||||
int choice = DialogSec::choiceFileSizeWarning( nullptr, msg );
|
||||
if ( choice < 0 ) {
|
||||
const int choice = DialogSec::choiceFileSizeWarning( msg );
|
||||
if ( choice == 0 ) {
|
||||
// choosed to abort all
|
||||
this->proceed = false;
|
||||
break;
|
||||
} else if ( choice > 0 ) {
|
||||
// choosed to discard and continue
|
||||
} else if ( choice == 1 ) {
|
||||
// choosed to discard the file and continue
|
||||
continue;
|
||||
}/* else {
|
||||
} else if ( choice == 2 ) {
|
||||
// choosed to ignore and use the file anyway
|
||||
}*/
|
||||
;
|
||||
} else {
|
||||
// shouldn't be here
|
||||
throw GenericException( "Unexpeced value returned: "+std::to_string(choice) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -930,7 +938,12 @@ void Craplog::storeLogLines()
|
|||
QString db_path = QString::fromStdString( this->db_stats_path );
|
||||
QString db_name = QString::fromStdString( this->db_stats_path.substr( this->db_stats_path.find_last_of( '/' ) + 1 ) );
|
||||
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
QSqlDatabase db;
|
||||
if ( QSqlDatabase::contains("qt_sql_default_connection") ) {
|
||||
db = QSqlDatabase::database("qt_sql_default_connection");
|
||||
} else {
|
||||
db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
}
|
||||
db.setDatabaseName( db_path );
|
||||
|
||||
if ( ! db.open() ) {
|
||||
|
@ -940,7 +953,7 @@ void Craplog::storeLogLines()
|
|||
if ( this->dialogs_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( db_name, err_msg );
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -957,7 +970,7 @@ void Craplog::storeLogLines()
|
|||
err_msg = db.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, stmt_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg );
|
||||
}
|
||||
|
||||
if ( this->proceed && this->data_collection.size() > 0 ) {
|
||||
|
@ -977,7 +990,7 @@ void Craplog::storeLogLines()
|
|||
err_msg= db.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, stmt_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg );
|
||||
}
|
||||
}
|
||||
if ( ! proceed ) {
|
||||
|
@ -999,14 +1012,14 @@ void Craplog::storeLogLines()
|
|||
err_msg = db.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, stmt_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg );
|
||||
err_shown = true;
|
||||
}
|
||||
if ( ! err_shown ) {
|
||||
// show a message
|
||||
DialogSec::errGeneric( nullptr, QString("%1\n\n%2").arg(
|
||||
DialogSec::errGeneric( QString("%1\n\n%2").arg(
|
||||
DialogSec::tr("An error occured while working on the database"),
|
||||
DialogSec::tr( f_ABORTING.c_str() ) ) );
|
||||
DialogSec::tr("Aborting") ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ bool HashOps::loadUsedHashesLists( const std::string& db_path )
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( db_name, err_msg );
|
||||
|
||||
} else {
|
||||
QSqlQuery query = QSqlQuery( db );
|
||||
|
@ -47,7 +47,7 @@ bool HashOps::loadUsedHashesLists( const std::string& db_path )
|
|||
if ( ! query.exec("SELECT hash FROM "+name+";") ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() );
|
||||
break;
|
||||
} else {
|
||||
// iterate over results
|
||||
|
@ -155,7 +155,7 @@ bool HashOps::insertUsedHash( QSqlQuery& query, const QString& db_name, const st
|
|||
err_msg = query.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, query_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, query_msg, err_msg );
|
||||
}
|
||||
}/* else {
|
||||
// hash already stored
|
||||
|
@ -184,7 +184,7 @@ bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector<st
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( db_name, err_msg );
|
||||
|
||||
} else {
|
||||
QSqlQuery query = QSqlQuery( db );
|
||||
|
@ -198,7 +198,7 @@ bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector<st
|
|||
err_msg = db.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, stmt_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg );
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -223,7 +223,7 @@ bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector<st
|
|||
err_msg= db.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, stmt_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg );
|
||||
}
|
||||
}
|
||||
if ( ! proceed ) {
|
||||
|
@ -245,13 +245,13 @@ bool HashOps::insertUsedHashes( const std::string& db_path, const std::vector<st
|
|||
err_msg = db.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, stmt_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, stmt_msg, err_msg );
|
||||
err_shown = true;
|
||||
}
|
||||
if ( ! err_shown ) {
|
||||
// show a message
|
||||
QString msg = DialogSec::tr("An error occured while working on the database\n\nAborting");
|
||||
DialogSec::errGeneric( nullptr, msg );
|
||||
DialogSec::errGeneric( msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ bool StoreOps::storeData( QSqlDatabase& db, Craplog& craplog, const std::vector<
|
|||
err_msg = query.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, query_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, query_msg, err_msg );
|
||||
}
|
||||
|
||||
// sum stored data size for the perfs
|
||||
|
@ -276,7 +276,7 @@ bool StoreOps::storeData( QSqlDatabase& db, Craplog& craplog, const std::vector<
|
|||
err_msg = query.lastError().text();
|
||||
}
|
||||
}
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, query_msg, err_msg );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, query_msg, err_msg );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void Crapup::versionCheck( const float& v, const int& dialog_level )
|
|||
if ( reply->error() ) {
|
||||
// failed
|
||||
if ( dialog_level == 2 ) {
|
||||
DialogSec::warnConnectionFailed( nullptr,
|
||||
DialogSec::warnConnectionFailed(
|
||||
QString::fromStdString( URL ),
|
||||
QString::fromStdString( reply->errorString().toStdString() ) );
|
||||
}
|
||||
|
@ -112,6 +112,6 @@ void Crapup::versionCheck( const float& v, const int& dialog_level )
|
|||
successful = false;
|
||||
}
|
||||
} else {
|
||||
DialogSec::errVersionCheckFailed( nullptr, err );
|
||||
DialogSec::errVersionCheckFailed( err );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ void DbQuery::refreshDates(std::tuple<bool, std::unordered_map<int, std::unorder
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
// recursively query years, months and days for every WebServer
|
||||
|
@ -186,7 +186,7 @@ void DbQuery::refreshDates(std::tuple<bool, std::unordered_map<int, std::unorder
|
|||
if ( ! Y_query.exec( QString("SELECT DISTINCT \"year\" FROM \"%1\" ORDER BY \"year\" ASC;").arg(tbl) ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, Y_query.lastQuery(), Y_query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, Y_query.lastQuery(), Y_query.lastError().text() );
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
@ -204,7 +204,7 @@ void DbQuery::refreshDates(std::tuple<bool, std::unordered_map<int, std::unorder
|
|||
err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_TABLE_NAME.c_str()), tbl );
|
||||
}
|
||||
}
|
||||
DialogSec::errGeneric( nullptr, err_msg );
|
||||
DialogSec::errGeneric( err_msg );
|
||||
break;
|
||||
}
|
||||
// successfully get the year
|
||||
|
@ -213,7 +213,7 @@ void DbQuery::refreshDates(std::tuple<bool, std::unordered_map<int, std::unorder
|
|||
if ( ! M_query.exec( QString("SELECT DISTINCT \"month\" FROM \"%1\" WHERE \"year\"=%2 ORDER BY \"month\" ASC;").arg(tbl).arg(year) ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, M_query.lastQuery(), M_query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, M_query.lastQuery(), M_query.lastError().text() );
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
@ -230,7 +230,7 @@ void DbQuery::refreshDates(std::tuple<bool, std::unordered_map<int, std::unorder
|
|||
err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_TABLE_NAME.c_str()), tbl );
|
||||
}
|
||||
}
|
||||
DialogSec::errGeneric( nullptr, err_msg );
|
||||
DialogSec::errGeneric( err_msg );
|
||||
break;
|
||||
}
|
||||
// successfully get the month
|
||||
|
@ -239,7 +239,7 @@ void DbQuery::refreshDates(std::tuple<bool, std::unordered_map<int, std::unorder
|
|||
if ( ! D_query.exec( QString("SELECT DISTINCT \"day\" FROM \"%1\" WHERE \"year\"=%2 AND \"month\"=%3 ORDER BY \"day\" ASC;").arg(tbl).arg(year).arg(month) ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, D_query.lastQuery(), D_query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, D_query.lastQuery(), D_query.lastError().text() );
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
@ -256,7 +256,7 @@ void DbQuery::refreshDates(std::tuple<bool, std::unordered_map<int, std::unorder
|
|||
err_msg += QString("\n\n%1:\n%2").arg( TR::tr(this->MSG_TABLE_NAME.c_str()), tbl );
|
||||
}
|
||||
}
|
||||
DialogSec::errGeneric( nullptr, err_msg );
|
||||
DialogSec::errGeneric( err_msg );
|
||||
break;
|
||||
}
|
||||
// successfully get the day
|
||||
|
@ -303,13 +303,13 @@ void DbQuery::updateWarnings( const QString& web_server, const std::vector<std::
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
|
||||
if ( successful ) {
|
||||
|
@ -325,7 +325,7 @@ void DbQuery::updateWarnings( const QString& web_server, const std::vector<std::
|
|||
|
||||
if ( ! query.exec( stmt.replace("'","''") ) ) {
|
||||
// error querying database
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -353,13 +353,13 @@ void DbQuery::getWarnCounts( std::tuple<bool, std::vector<std::vector<std::vecto
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
int year, month, day, hour;
|
||||
if ( successful ) {
|
||||
|
@ -374,7 +374,7 @@ void DbQuery::getWarnCounts( std::tuple<bool, std::vector<std::vector<std::vecto
|
|||
} catch (...) {
|
||||
// failed to convert to integers
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
}
|
||||
}
|
||||
if ( successful ) {
|
||||
|
@ -398,7 +398,7 @@ void DbQuery::getWarnCounts( std::tuple<bool, std::vector<std::vector<std::vecto
|
|||
if ( ! query.exec( stmt.replace("'","''") ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -420,7 +420,7 @@ void DbQuery::getWarnCounts( std::tuple<bool, std::vector<std::vector<std::vecto
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ void DbQuery::getWarnCounts( std::tuple<bool, std::vector<std::vector<std::vecto
|
|||
if ( ! query.exec( stmt.replace("'","''") ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -460,7 +460,7 @@ void DbQuery::getWarnCounts( std::tuple<bool, std::vector<std::vector<std::vecto
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -492,13 +492,13 @@ void DbQuery::getSpeedData(std::tuple<bool, std::vector<std::tuple<long long, st
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
int year, month, day;
|
||||
if ( successful ) {
|
||||
|
@ -510,7 +510,7 @@ void DbQuery::getSpeedData(std::tuple<bool, std::vector<std::tuple<long long, st
|
|||
} catch (...) {
|
||||
// failed to convert to integers
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
}
|
||||
}
|
||||
if ( successful ) {
|
||||
|
@ -599,7 +599,7 @@ void DbQuery::getSpeedData(std::tuple<bool, std::vector<std::tuple<long long, st
|
|||
if ( ! query.exec( stmt ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -809,7 +809,7 @@ void DbQuery::getSpeedData(std::tuple<bool, std::vector<std::tuple<long long, st
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -843,13 +843,13 @@ void DbQuery::getItemsCount( std::tuple<bool, std::vector<std::tuple<QString, in
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
if ( successful ) {
|
||||
// build the query statement
|
||||
|
@ -865,7 +865,7 @@ void DbQuery::getItemsCount( std::tuple<bool, std::vector<std::tuple<QString, in
|
|||
if ( ! query.exec( stmt.replace("'","''") ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -886,7 +886,7 @@ void DbQuery::getItemsCount( std::tuple<bool, std::vector<std::tuple<QString, in
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -952,13 +952,13 @@ void DbQuery::getDaytimeCounts( std::tuple<bool, std::unordered_map<int, std::un
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
int from_year, from_month, from_day,
|
||||
to_year, to_month, to_day;
|
||||
|
@ -974,7 +974,7 @@ void DbQuery::getDaytimeCounts( std::tuple<bool, std::unordered_map<int, std::un
|
|||
} catch (...) {
|
||||
// failed to convert to integers
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
}
|
||||
}
|
||||
if ( successful ) {
|
||||
|
@ -1036,7 +1036,7 @@ void DbQuery::getDaytimeCounts( std::tuple<bool, std::unordered_map<int, std::un
|
|||
if ( ! query.exec( stmt ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -1058,7 +1058,7 @@ void DbQuery::getDaytimeCounts( std::tuple<bool, std::unordered_map<int, std::un
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1117,7 +1117,7 @@ void DbQuery::getDaytimeCounts( std::tuple<bool, std::unordered_map<int, std::un
|
|||
if ( ! query.exec( stmt ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -1144,7 +1144,7 @@ void DbQuery::getDaytimeCounts( std::tuple<bool, std::unordered_map<int, std::un
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
break;
|
||||
}
|
||||
query.finish();
|
||||
|
@ -1190,13 +1190,13 @@ void DbQuery::getRelationalCountsDay(std::tuple<bool, std::vector<std::tuple<lon
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
|
||||
int year, month, day;
|
||||
|
@ -1209,7 +1209,7 @@ void DbQuery::getRelationalCountsDay(std::tuple<bool, std::vector<std::tuple<lon
|
|||
} catch (...) {
|
||||
// failed to convert to integers
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
}
|
||||
}
|
||||
if ( successful ) {
|
||||
|
@ -1301,7 +1301,7 @@ void DbQuery::getRelationalCountsDay(std::tuple<bool, std::vector<std::tuple<lon
|
|||
if ( ! query.exec( stmt ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -1401,7 +1401,7 @@ void DbQuery::getRelationalCountsDay(std::tuple<bool, std::vector<std::tuple<lon
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1433,13 +1433,13 @@ void DbQuery::getRelationalCountsPeriod(std::tuple<bool, std::vector<std::tuple<
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
int from_year, from_month, from_day,
|
||||
to_year, to_month, to_day;
|
||||
|
@ -1455,7 +1455,7 @@ void DbQuery::getRelationalCountsPeriod(std::tuple<bool, std::vector<std::tuple<
|
|||
} catch (...) {
|
||||
// failed to convert to integers
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING_DATES.c_str()), true );
|
||||
}
|
||||
}
|
||||
if ( successful ) {
|
||||
|
@ -1534,7 +1534,7 @@ void DbQuery::getRelationalCountsPeriod(std::tuple<bool, std::vector<std::tuple<
|
|||
if ( ! query.exec( stmt ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -1631,7 +1631,7 @@ void DbQuery::getRelationalCountsPeriod(std::tuple<bool, std::vector<std::tuple<
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1705,7 +1705,7 @@ void DbQuery::getRelationalCountsPeriod(std::tuple<bool, std::vector<std::tuple<
|
|||
if ( ! query.exec( stmt ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
|
||||
} else {
|
||||
try {
|
||||
|
@ -1774,7 +1774,7 @@ void DbQuery::getRelationalCountsPeriod(std::tuple<bool, std::vector<std::tuple<
|
|||
} catch (...) {
|
||||
// something failed
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
DialogSec::errGeneric( TR::tr(this->MSG_ERR_PROCESSING.c_str()), true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1818,13 +1818,13 @@ const bool DbQuery::getGlobalCounts( const QString& web_server, const std::unord
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = db.lastError().text();
|
||||
}
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, this->db_name, err_msg );
|
||||
DialogSec::errDatabaseFailedOpening( this->db_name, err_msg );
|
||||
|
||||
} else {
|
||||
if ( web_server != "apache" && web_server != "nginx" && web_server != "iis" ) {
|
||||
// unexpected WebServer
|
||||
successful = false;
|
||||
DialogSec::errGeneric( nullptr, QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
DialogSec::errGeneric( QString("%1:\n%2").arg( TR::tr(this->MSG_ERR_UNX_WS.c_str()), web_server ), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1853,7 +1853,7 @@ const bool DbQuery::getGlobalCounts( const QString& web_server, const std::unord
|
|||
.arg( web_server ).arg( year ).arg( month ).replace("'","''") ) ) {
|
||||
// error querying database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( this->db_name, query.lastQuery(), query.lastError().text() );
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
@ -1920,7 +1920,7 @@ const bool DbQuery::getGlobalCounts( const QString& web_server, const std::unord
|
|||
if ( this->dialog_level == 2 ) {
|
||||
err_msg = TR::tr(this->MSG_ERR_PROCESSING.c_str());
|
||||
}
|
||||
DialogSec::errGeneric( nullptr, err_msg );
|
||||
DialogSec::errGeneric( err_msg );
|
||||
break;
|
||||
}
|
||||
if ( successful ) {
|
||||
|
|
|
@ -22,7 +22,7 @@ int CheckSec::checkDatabaseTablesNames( QSqlDatabase& db, const QString& db_name
|
|||
if ( ! query.exec("SELECT name FROM sqlite_schema WHERE type = 'table';") ) {
|
||||
// error querying database
|
||||
ok = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() );
|
||||
} else {
|
||||
std::unordered_map<QString, bool> tables_checks = {
|
||||
{"apache", false},
|
||||
|
@ -32,7 +32,7 @@ int CheckSec::checkDatabaseTablesNames( QSqlDatabase& db, const QString& db_name
|
|||
QString table_name = query.value(0).toString();
|
||||
if ( tables_checks.find( table_name ) == tables_checks.end() ) {
|
||||
// unexpected table name
|
||||
if ( DialogSec::choiceDatabaseWrongTable( nullptr, db_name, table_name ) ) {
|
||||
if ( DialogSec::choiceDatabaseWrongTable( db_name, table_name ) ) {
|
||||
// agreed to renew
|
||||
make_new = true;
|
||||
} else {
|
||||
|
@ -50,7 +50,7 @@ int CheckSec::checkDatabaseTablesNames( QSqlDatabase& db, const QString& db_name
|
|||
for ( const auto& [ tbl, res ] : tables_checks ) {
|
||||
if ( ! res ) {
|
||||
// a table has not been found
|
||||
if ( DialogSec::choiceDatabaseMissingTable( nullptr, db_name, tbl ) ) {
|
||||
if ( DialogSec::choiceDatabaseMissingTable( db_name, tbl ) ) {
|
||||
// agreed to renew
|
||||
make_new = true;
|
||||
} else {
|
||||
|
@ -82,7 +82,7 @@ bool CheckSec::newStatsDatabase( QSqlDatabase& db, const std::string& db_path, c
|
|||
if ( ! db.open() ) {
|
||||
// error opening database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, db_name, db.lastError().text() );
|
||||
DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() );
|
||||
|
||||
} else {
|
||||
// succesfully creted database file, now create the tables
|
||||
|
@ -115,7 +115,7 @@ bool CheckSec::newStatsDatabase( QSqlDatabase& db, const std::string& db_path, c
|
|||
if ( ! query.exec() ) {
|
||||
// error creating table
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr,
|
||||
DialogSec::errDatabaseFailedExecuting(
|
||||
QString( db_name ),
|
||||
QString("CREATE TABLE \"%1\" (...)").arg( ws_name ),
|
||||
QString( query.lastError().text() ) );
|
||||
|
@ -126,7 +126,7 @@ bool CheckSec::newStatsDatabase( QSqlDatabase& db, const std::string& db_path, c
|
|||
|
||||
// inform about creation
|
||||
if ( successful ) {
|
||||
DialogSec::msgDatabaseCreated( nullptr, db_name );
|
||||
DialogSec::msgDatabaseCreated( db_name );
|
||||
}
|
||||
}
|
||||
return successful;
|
||||
|
@ -146,15 +146,15 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
// database file exists
|
||||
if ( ! IOutils::isFile( db_path ) ) {
|
||||
// path doesn't point to a file
|
||||
DialogSec::errDatabaseNotFile( nullptr, QString(db_name) );
|
||||
DialogSec::errDatabaseNotFile( QString(db_name) );
|
||||
ok = false;
|
||||
} else if ( ! IOutils::checkFile( db_path, true ) ) {
|
||||
// database not readable, abort
|
||||
DialogSec::errDatabaseNotReadable( nullptr, QString(db_name) );
|
||||
DialogSec::errDatabaseNotReadable( QString(db_name) );
|
||||
ok = false;
|
||||
} else if ( ! IOutils::checkFile( db_path, false, true ) ) {
|
||||
// database not writable, abort
|
||||
DialogSec::errDatabaseNotWritable( nullptr, QString(db_name) );
|
||||
DialogSec::errDatabaseNotWritable( QString(db_name) );
|
||||
ok = false;
|
||||
|
||||
} else {
|
||||
|
@ -162,7 +162,7 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
if ( ! db.open() ) {
|
||||
// error opening database
|
||||
ok = false;
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, db_name, db.lastError().text() );
|
||||
DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() );
|
||||
|
||||
} else {
|
||||
// database successfully opened, now check the tables
|
||||
|
@ -207,7 +207,7 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
if ( ! query.exec( "SELECT name, type FROM pragma_table_info('"+table+"') AS tbinfo;" ) ) {
|
||||
// error opening database
|
||||
ok = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() );
|
||||
}
|
||||
// iterate over results
|
||||
while ( query.next() ) {
|
||||
|
@ -215,7 +215,7 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
col_type = query.value(1).toString();
|
||||
if ( data_types.find( col_name ) == data_types.end() ) {
|
||||
// unexpected column
|
||||
if ( DialogSec::choiceDatabaseWrongColumn( nullptr, db_name, table, col_name ) ) {
|
||||
if ( DialogSec::choiceDatabaseWrongColumn( db_name, table, col_name ) ) {
|
||||
// agreed to renew
|
||||
make_new = true;
|
||||
} else {
|
||||
|
@ -232,7 +232,7 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
data_types.at( col_name ) = std::tuple( data_type, true );
|
||||
} else {
|
||||
// different data-type, ask to renew
|
||||
if ( DialogSec::choiceDatabaseWrongDataType( nullptr, db_name, table, col_name, col_type ) ) {
|
||||
if ( DialogSec::choiceDatabaseWrongDataType( db_name, table, col_name, col_type ) ) {
|
||||
// agreed to renew
|
||||
make_new = true;
|
||||
} else {
|
||||
|
@ -247,7 +247,7 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
for ( const auto& [ col, tup ] : data_types ) {
|
||||
if ( ! std::get<1>( tup ) ) {
|
||||
// a table has not been found
|
||||
if ( DialogSec::choiceDatabaseMissingColumn( nullptr, db_name, table, col ) ) {
|
||||
if ( DialogSec::choiceDatabaseMissingColumn( db_name, table, col ) ) {
|
||||
// agreed to renew
|
||||
make_new = true;
|
||||
} else {
|
||||
|
@ -268,7 +268,7 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
|
||||
} else {
|
||||
// database does not exist, yet, ask to create a new one
|
||||
if ( DialogSec::choiceDatabaseNotFound( nullptr, QString(db_name) ) ) {
|
||||
if ( DialogSec::choiceDatabaseNotFound( QString(db_name) ) ) {
|
||||
// choosed to create it
|
||||
make_new = true;
|
||||
|
||||
|
@ -285,7 +285,7 @@ bool CheckSec::checkStatsDatabase( const std::string& db_path )
|
|||
if ( ! IOutils::renameAsCopy( db_path ) ) {
|
||||
// failed to rename
|
||||
ok = false;
|
||||
DialogSec::errRenaming( nullptr, QString::fromStdString(db_path) );
|
||||
DialogSec::errRenaming( QString::fromStdString(db_path) );
|
||||
}/* else {
|
||||
// renamed successfully, make new one
|
||||
}*/
|
||||
|
@ -308,7 +308,7 @@ bool CheckSec::newHashesDatabase( QSqlDatabase& db, const std::string& db_path,
|
|||
if ( ! db.open() ) {
|
||||
// error opening database
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, db_name, db.lastError().text() );
|
||||
DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() );
|
||||
|
||||
} else {
|
||||
// succesfully creted database file, now create the tables
|
||||
|
@ -323,7 +323,7 @@ bool CheckSec::newHashesDatabase( QSqlDatabase& db, const std::string& db_path,
|
|||
if ( ! query.exec() ) {
|
||||
// error creating table
|
||||
successful = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr,
|
||||
DialogSec::errDatabaseFailedExecuting(
|
||||
QString( db_name ),
|
||||
QString("CREATE TABLE \"%1\" (...)").arg( ws_name ),
|
||||
QString( query.lastError().text() ) );
|
||||
|
@ -334,7 +334,7 @@ bool CheckSec::newHashesDatabase( QSqlDatabase& db, const std::string& db_path,
|
|||
|
||||
// inform about creation
|
||||
if ( successful ) {
|
||||
DialogSec::msgDatabaseCreated( nullptr, db_name );
|
||||
DialogSec::msgDatabaseCreated( db_name );
|
||||
}
|
||||
}
|
||||
return successful;
|
||||
|
@ -354,15 +354,15 @@ bool CheckSec::checkHashesDatabase( const std::string& db_path )
|
|||
// database file exists
|
||||
if ( ! IOutils::isFile( db_path ) ) {
|
||||
// path doesn't point to a file
|
||||
DialogSec::errDatabaseNotFile( nullptr, QString(db_name) );
|
||||
DialogSec::errDatabaseNotFile( QString(db_name) );
|
||||
ok = false;
|
||||
} else if ( ! IOutils::checkFile( db_path, true ) ) {
|
||||
// database not readable, abort
|
||||
DialogSec::errDatabaseNotReadable( nullptr, QString(db_name) );
|
||||
DialogSec::errDatabaseNotReadable( QString(db_name) );
|
||||
ok = false;
|
||||
} else if ( ! IOutils::checkFile( db_path, false, true ) ) {
|
||||
// database not writable, abort
|
||||
DialogSec::errDatabaseNotWritable( nullptr, QString(db_name) );
|
||||
DialogSec::errDatabaseNotWritable( QString(db_name) );
|
||||
ok = false;
|
||||
|
||||
} else {
|
||||
|
@ -370,7 +370,7 @@ bool CheckSec::checkHashesDatabase( const std::string& db_path )
|
|||
if ( ! db.open() ) {
|
||||
// error opening database
|
||||
ok = false;
|
||||
DialogSec::errDatabaseFailedOpening( nullptr, db_name, db.lastError().text() );
|
||||
DialogSec::errDatabaseFailedOpening( db_name, db.lastError().text() );
|
||||
|
||||
} else {
|
||||
// database successfully opened, now check the tables
|
||||
|
@ -395,7 +395,7 @@ bool CheckSec::checkHashesDatabase( const std::string& db_path )
|
|||
if ( ! query.exec( "SELECT name, type FROM pragma_table_info('"+table+"') AS tbinfo;" ) ) {
|
||||
// error opening database
|
||||
ok = false;
|
||||
DialogSec::errDatabaseFailedExecuting( nullptr, db_name, query.lastQuery(), query.lastError().text() );
|
||||
DialogSec::errDatabaseFailedExecuting( db_name, query.lastQuery(), query.lastError().text() );
|
||||
}
|
||||
// iterate over results
|
||||
while ( query.next() ) {
|
||||
|
@ -403,7 +403,7 @@ bool CheckSec::checkHashesDatabase( const std::string& db_path )
|
|||
col_type = query.value(1).toString();
|
||||
if ( col_name != "hash" ) {
|
||||
// unexpected column
|
||||
if ( DialogSec::choiceDatabaseWrongColumn( nullptr, db_name, table, col_name ) ) {
|
||||
if ( DialogSec::choiceDatabaseWrongColumn( db_name, table, col_name ) ) {
|
||||
// agreed to renew
|
||||
make_new = true;
|
||||
} else {
|
||||
|
@ -420,7 +420,7 @@ bool CheckSec::checkHashesDatabase( const std::string& db_path )
|
|||
type_ok = true;
|
||||
} else {
|
||||
// different data-type, ask to renew
|
||||
if ( DialogSec::choiceDatabaseWrongDataType( nullptr, db_name, table, col_name, col_type ) ) {
|
||||
if ( DialogSec::choiceDatabaseWrongDataType( db_name, table, col_name, col_type ) ) {
|
||||
// agreed to renew
|
||||
make_new = true;
|
||||
} else {
|
||||
|
@ -444,7 +444,7 @@ bool CheckSec::checkHashesDatabase( const std::string& db_path )
|
|||
|
||||
} else {
|
||||
// database does not exist, yet, ask to create a new one
|
||||
if ( DialogSec::choiceDatabaseNotFound( nullptr, QString(db_name) ) ) {
|
||||
if ( DialogSec::choiceDatabaseNotFound( QString(db_name) ) ) {
|
||||
// choosed to create it
|
||||
make_new = true;
|
||||
|
||||
|
@ -461,7 +461,7 @@ bool CheckSec::checkHashesDatabase( const std::string& db_path )
|
|||
if ( ! IOutils::renameAsCopy( db_path ) ) {
|
||||
// failed to rename
|
||||
ok = false;
|
||||
DialogSec::errRenaming( nullptr, QString::fromStdString(db_path) );
|
||||
DialogSec::errRenaming( QString::fromStdString(db_path) );
|
||||
}/* else {
|
||||
// renamed successfully, make new one
|
||||
}*/
|
||||
|
|
Loading…
Reference in New Issue