KLog 2.3.4-RC4

This commit is contained in:
d 2024-02-28 17:59:21 +01:00
parent f4b69bf8b0
commit f4d7676813
14 changed files with 123 additions and 288 deletions

View File

@ -5,7 +5,7 @@ Finish add, think/create/review QSO::modify, update: QString MainWindow::readDat
TBD - 2.3.4
- BugFix: After Editing a QSO, lotw_qsl_rcvd is emptied (Closes #656, #659) (TNX N6PAZ, EA5WA)
WIP: - Bugfix: Keep data of SAT tab when entering a QSO stopped working. (TNX EA5WA)
- Bugfix: Keep data of SAT tab when entering a QSO stopped working. (TNX EA5WA)
- BugFix: When editing a split QSO, if TX Frequency is modified, split is disabled and frequencies made equal. (EA5WA)
- BugFix: Incorrect CQ zone saved to DataBase (Closes #666) (EA5WA)
- BugFix: FO/x calls are not properly identified/stored (Closes #677) (EA5WA)
@ -13,6 +13,10 @@ WIP: - Bugfix: Keep data of SAT tab when entering a QSO stopped working. (TNX EA
- Bugfix: Several fields do not meet ADIF specification (Closes #669)
- Bugfix: DX-Cluster activity file can't be edit with normal txt file. (Closes #682)
- Bugfix: QSO_COMPLETE field in database needs to be redefined (Closes #680)
- Bugfix: QRZ.com QSO status was not properly working. (Closes #664)
- Bugfix: Alternative location for logbook.dat was not working properly (Closes #653)
- Bugfix: Clarify how to use mode / submode in the DB (Closes #650)
- Bugfix: Cleared some warning errors about the DB notbeing created in the console.
- Translations: Danish (TNX Peter), Russian (YL3GBC), Spanish (EA4K), Ukrainian (YL3GBC)
Dec 2023 - 2.3.3

View File

@ -322,7 +322,6 @@ TODO: Add color support: messages for slotQRZTextChanged
TODO: SetupPageColors: Check the style in the buttons as the rounds are lost when I change the color!!
TODO: MainWindow::processConfigLine: add support for the cluster data.
TODO: Check when to connect the DXCluster and when no, it tries twice or more...
TODO: Awards: make a function to calculate the total.

View File

@ -39,13 +39,13 @@ DataBase::DataBase(const QString &_parentClass, const QString &_DBName)
softVersion = util->getVersion();
dbName = _DBName;
//connect(this, SIGNAL(debugLog(QString, QString, int)), this, SLOT(slotPrintErrors(QString, QString, int)) );
//qDebug() << "DataBase::DataBase1: dbName: " << dbName ;
//qDebug() << "DataBase::DataBase1: dbName: " << dbName ;
//db = QSqlDatabase::database();
dbVersion = DBVersionf;
createConnection(QString(Q_FUNC_INFO)+"1");
//qDebug() << "DataBase::DataBase: PLAIN - connection Name: " << dbConnectionName ;
//qDebug() << "DataBase::DataBase: PLAIN - connection Name: " << dbConnectionName ;
//qDebug() << "DataBase::DataBase: PLAIN - DB Name: " << db.databaseName() ;
insertPreparedQueries.clear();
insertQueryFields.clear();
@ -241,28 +241,28 @@ bool DataBase::createConnection(const QString &function, bool newDB)
Q_UNUSED(newDB);
QString stringQuery;
QSqlQuery query;
//qDebug() << Q_FUNC_INFO << ": check if open";
if (!db.isOpen())
{
//qDebug() << "DataBase::createConnection: DB NOT Opened" ;
//qDebug() << "DataBase::createConnection: DB NOT Opened" ;
if (!db.isValid())
{
//qDebug() << "DataBase::createConnection: DB is not valid, let's call addDataBase" ;
//qDebug() << "DataBase::createConnection: DB is not valid, let's call addDataBase" ;
if (!db.isOpen())
{
//qDebug() << "DataBase::createConnection: DB is NOT open, let's open: connection name" << db.connectionName();
//qDebug() << "DataBase::createConnection: DB is NOT open, let's open: connection name" << db.connectionName();
QSqlDatabase::removeDatabase("qt_sql_default_connection");
db = QSqlDatabase::addDatabase("QSQLITE");
}
//qDebug() << "DataBase::createConnection: Now we call setDatabaseName" ;
//qDebug() << "DataBase::createConnection: Now we call setDatabaseName" ;
db.setDatabaseName(dbName);
//qDebug() << "DataBase::createConnection: end of not valid" ;
//qDebug() << "DataBase::createConnection: end of not valid" ;
}
//qDebug() << "DataBase::createConnection: end of valid check, let's try if it is open" ;
//qDebug() << "DataBase::createConnection: end of valid check, let's try if it is open" ;
if (!db.open()) /* Flawfinder: ignore */
{
//qDebug() << "DataBase::createConnection:Not open " ;
//qDebug() << "DataBase::createConnection:Not open " ;
QMessageBox::warning(nullptr, QObject::tr("Database Error"), db.lastError().text());
//qDebug() << "DataBase::createConnection: DB creation ERROR" ;
// emit debugLog(Q_FUNC_INFO, "1", 7);
@ -271,17 +271,17 @@ bool DataBase::createConnection(const QString &function, bool newDB)
}
else
{
//qDebug() << "DataBase::createConnection: created and opened after the creation" ;
//qDebug() << "DataBase::createConnection: created and opened after the creation" ;
if (!isTheDBCreated())
{
//qDebug() << "DataBase::createConnection: DB is still not created" ;
//qDebug() << "DataBase::createConnection: DB is still not created" ;
if (!createDataBase())
{
//qDebug() << "DataBase::createConnection: DB creation failed!!" ;
//qDebug() << "DataBase::createConnection: DB creation failed!!" ;
logEvent(Q_FUNC_INFO, "END-2", Debug);
return false;
}
//qDebug() << "DataBase::createConnection: After creation" ;
//qDebug() << "DataBase::createConnection: After creation" ;
stringQuery ="PRAGMA main.page_size = 4096;";
query.exec(stringQuery);
stringQuery ="PRAGMA main.cache_size=10000;";
@ -317,7 +317,7 @@ bool DataBase::createConnection(const QString &function, bool newDB)
logEvent(Q_FUNC_INFO, "END-3", Debug);
return false;
}
//qDebug() << "DataBase::createConnection -------------------------------------------- END" ;
//qDebug() << "DataBase::createConnection -------------------------------------------- END" ;
logEvent(Q_FUNC_INFO, "END", Debug);
return unMarkAllQSO();
}

View File

@ -36,25 +36,33 @@ DataProxy_SQLite::DataProxy_SQLite(const QString &_parentFunction, const QString
//qDebug() << Q_FUNC_INFO << "Running a release build";
#endif
(void)_parentFunction;
//qDebug() << "DataProxy_SQLite::DataProxy_SQLite" << _softVersion << _parentFunction;
//qDebug() << Q_FUNC_INFO << ": " << _softVersion << _parentFunction;
logLevel = None;
//qDebug() << "DataProxy_SQLite::DataProxy_SQLite 1";
//qDebug() << Q_FUNC_INFO << " - 45";
util = new Utilities(Q_FUNC_INFO);
//qDebug() << Q_FUNC_INFO << " - 46";
util->setVersion(_softVersion);
//qDebug() << Q_FUNC_INFO << " - 47";
util->setCallValidation(false);
util->setLongPrefixes(getLongPrefixes());
util->setSpecialCalls(getSpecialCallsigns());
qso = new QSO;
//qDebug() << Q_FUNC_INFO << " - 48";
db = new DataBase(Q_FUNC_INFO, _softVersion, util->getKLogDBFile());
//qDebug() << Q_FUNC_INFO << " - 49";
dbCreated = db->createConnection(Q_FUNC_INFO);
//dbCreated = db->createBandModeMaps();
//qDebug() << "DataProxy_SQLite::DataProxy_SQLite - END";
//qDebug() << Q_FUNC_INFO << " - 50";
util->setLongPrefixes(getLongPrefixes());
//qDebug() << Q_FUNC_INFO << " - 51";
util->setSpecialCalls(getSpecialCallsigns());
//qDebug() << Q_FUNC_INFO << " - 52";
qso = new QSO;
//qDebug() << Q_FUNC_INFO << " - 53";
//qDebug() << Q_FUNC_INFO << " - 54";
searching = false;
executionN = 0;
connect(db, SIGNAL(debugLog(QString, QString, DebugLogLevel)), this, SLOT(slotCaptureDebugLogs(QString, QString, DebugLogLevel)) );
//qDebug() << Q_FUNC_INFO << " - END";
logEvent (Q_FUNC_INFO, "END", Debug);
}

View File

@ -120,7 +120,7 @@ int main(int argc, char *argv[])
}
//qDebug() << Q_FUNC_INFO << " - -20 - end WIN ";
#elif defined(Q_OS_OSX)
//qDebug() << Q_FUNC_INFO << " - OSX ";
//qDebug() << Q_FUNC_INFO << " - OSX ";
if (QFile::exists(QCoreApplication::applicationDirPath() + "/translations/klog_" + (QLocale::system().name()).left(2) + ".qm") ) /* Flawfinder: ignore */
{
@ -135,7 +135,7 @@ int main(int argc, char *argv[])
missingTranslation = true;
}
#else
//qDebug() << Q_FUNC_INFO << " - OTHER OS: " << (QLocale::system()).name();
//qDebug() << Q_FUNC_INFO << " - OTHER OS: " << (QLocale::system()).name();
if (QFile::exists("klog_" + (QLocale::system().name()).left(2) + ".qm") ) /* Flawfinder: ignore */
{
myappTranslator.load("klog_" + (QLocale::system().name()).left(2)); /* Flawfinder: ignore */

View File

@ -111,45 +111,48 @@ MainWindow::MainWindow(const QString &tversion)
//qDebug() << "MainWindow::MainWindow: Debug File: "<< util->getDebugLogFile() ;
//qDebug() << Q_FUNC_INFO << ": BEFORE HAMLIB " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": BEFORE HAMLIB " << QTime::currentTime().toString("hh:mm:ss") ;
hamlib = new HamLibClass();
//qDebug() << Q_FUNC_INFO << ": AFTER HAMLIB " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": AFTER HAMLIB " << QTime::currentTime().toString("hh:mm:ss") ;
dataProxy = new DataProxy_SQLite(Q_FUNC_INFO, softwareVersion);
//qDebug() << Q_FUNC_INFO << ": AFTER dataproxy ";
lotwUtilities = new LoTWUtilities(util->getHomeDir (), softwareVersion, Q_FUNC_INFO, dataProxy);
//qDebug() << Q_FUNC_INFO << ": AFTER lotwUtilities";
eqslUtilities = new eQSLUtilities(Q_FUNC_INFO);
//qDebug() << Q_FUNC_INFO << ": AFTER eQSLUtilities";
mapWindow = new MapWindowWidget(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": Before DXCCStatusWidget " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": Before DXCCStatusWidget " << QTime::currentTime().toString("hh:mm:ss") ;
dxccStatusWidget = new DXCCStatusWidget(dataProxy, Q_FUNC_INFO);
//qDebug() << Q_FUNC_INFO << ": After DXCCStatusWidget " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": After DXCCStatusWidget " << QTime::currentTime().toString("hh:mm:ss") ;
elogClublog = new eLogClubLog();
//qDebug() << Q_FUNC_INFO << ": 00082: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00082: " << QTime::currentTime().toString("hh:mm:ss") ;
elogQRZcom = new eLogQrzLog(dataProxy, Q_FUNC_INFO, softwareVersion);
//qDebug() << Q_FUNC_INFO << ": 00083: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00083: " << QTime::currentTime().toString("hh:mm:ss") ;
updateSatsData = new UpdateSatsData(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 00084: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00084: " << QTime::currentTime().toString("hh:mm:ss") ;
statsWidget = new StatisticsWidget(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 00085: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00085: " << QTime::currentTime().toString("hh:mm:ss") ;
infoLabel1 = new QLabel(tr("Status bar ..."));
infoLabel2 = new QLabel(tr("DX Entity"));
//qDebug() << "MainWindow::MainWindow: 00086" << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << "MainWindow::MainWindow: 00086" << QTime::currentTime().toString("hh:mm:ss") ;
logWindow = new LogWindow(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 00087: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00087: " << QTime::currentTime().toString("hh:mm:ss") ;
searchWidget = new SearchWidget(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 00087.1: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00087.1: " << QTime::currentTime().toString("hh:mm:ss") ;
//advancedSearchWidget = new AdvancedSearchWidget(dataProxy, this);
//qDebug() << "MainWindow::MainWindow: 00087.2" << QTime::currentTime().toString("hh:mm:ss") ;
infoWidget = new InfoWidget(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 00088: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00088: " << QTime::currentTime().toString("hh:mm:ss") ;
awardsWidget = new AwardsWidget(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 0009: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 0009: " << QTime::currentTime().toString("hh:mm:ss") ;
aboutDialog = new AboutDialog(softwareVersion);
tipsDialog = new TipsDialog();
@ -158,36 +161,36 @@ MainWindow::MainWindow(const QString &tversion)
statusBarMessage = tr("Starting KLog");
//qDebug() << Q_FUNC_INFO << ": 40: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 40: " << QTime::currentTime().toString("hh:mm:ss") ;
world = new World(dataProxy, Q_FUNC_INFO);
//qDebug() << Q_FUNC_INFO << ": 50: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 51: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 51: " << QTime::currentTime().toString("hh:mm:ss") ;
setupDialog = new SetupDialog(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": satTabWidget to be created " ;
//qDebug() << Q_FUNC_INFO << ": satTabWidget to be created " ;
satTabWidget = new MainWindowSatTab(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 52: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 52: " << QTime::currentTime().toString("hh:mm:ss") ;
QSOTabWidget = new MainWindowInputQSO(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 53: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 53: " << QTime::currentTime().toString("hh:mm:ss") ;
myDataTabWidget = new MainWindowMyDataTab(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 54: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 54: " << QTime::currentTime().toString("hh:mm:ss") ;
commentTabWidget = new MainWindowInputComment();
//qDebug() << Q_FUNC_INFO << ": 55: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 55: " << QTime::currentTime().toString("hh:mm:ss") ;
othersTabWidget = new MainWindowInputOthers(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 56: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 56: " << QTime::currentTime().toString("hh:mm:ss") ;
eQSLTabWidget = new MainWindowInputEQSL(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 57: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 57: " << QTime::currentTime().toString("hh:mm:ss") ;
QSLTabWidget = new MainWindowInputQSL(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 58: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 58: " << QTime::currentTime().toString("hh:mm:ss") ;
mainQSOEntryWidget = new MainQSOEntryWidget(dataProxy);
//qDebug() << Q_FUNC_INFO << ": locator to be created 59" << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": locator to be created 59" << QTime::currentTime().toString("hh:mm:ss") ;
locator = new Locator();
mainWidget = new QWidget(this);
//qDebug() << Q_FUNC_INFO << ": 60 " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 60 " << QTime::currentTime().toString("hh:mm:ss") ;
dateTime = new QDateTime();
dateTimeTemp = new QDateTime();
@ -195,7 +198,7 @@ MainWindow::MainWindow(const QString &tversion)
infoLabel2 = new QLabel(tr("DX Entity"));
loggWinAct = new QAction(tr("&Log Window"), this);
//qDebug() << Q_FUNC_INFO << ": dxclusterwidget to be created " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": dxclusterwidget to be created " << QTime::currentTime().toString("hh:mm:ss") ;
//dxClusterWidget = new DXClusterWidget(dataProxy, dxclusterServerToConnect , dxclusterServerPort, this);
dxClusterWidget = new DXClusterWidget(dataProxy, this);
@ -1287,6 +1290,9 @@ bool MainWindow::readQSOFromUI()
qso->setQSLSenVia (QSLTabWidget->getSentVia());
qso->setQSLSDate (QSLTabWidget->getQSLSenDate());
qso->setQRZCOMStatus(eQSLTabWidget->getQRZCOMStatus());
qso->setQRZCOMDate(eQSLTabWidget->getQRZCOMDate());
qso->setQSL_RCVD (QSLTabWidget->getQSLRecStatus());
qso->setQSLRecVia (QSLTabWidget->getRecVia());
qso->setQSLRDate (QSLTabWidget->getQSLRecDate());
@ -6628,6 +6634,8 @@ void MainWindow::backupCurrentQSO()
backupQSO->setLoTWQSLRDate (eQSLTabWidget->getLOTWRecDate ());
backupQSO->setClubLogStatus (eQSLTabWidget->getClubLogStatus ());
backupQSO->setClubLogDate (eQSLTabWidget->getClubLogDate ());
backupQSO->setQRZCOMStatus(eQSLTabWidget->getQRZCOMStatus());
backupQSO->setQRZCOMDate(eQSLTabWidget->getQRZCOMDate());
logEvent(Q_FUNC_INFO, "- 050", Devel);
// MainWindowInputComment
backupQSO->setComment (commentTabWidget->getComment ());

View File

@ -399,7 +399,6 @@ private:
bool createConnection();
void openSetup(const int _page=0);
//bool processConfigLine(const QString &_line);
//void readConfigData();
//void saveSettings();
bool loadSettings();

View File

@ -55,7 +55,7 @@ void QSO::logEvent(const QString &_func, const QString &_msg, DebugLogLevel _le
bool QSO::isComplete()
{
return (haveBand && haveMode && haveDateTime && haveCall);
return (haveBand && (haveMode || haveSubMode) && haveDateTime && haveCall);
}
void QSO::clear()
@ -66,6 +66,7 @@ void QSO::clear()
logEvent (Q_FUNC_INFO, "Start", Debug);
haveBand = false;
haveMode = false;
haveSubMode = false;
haveDateTime = false;
haveCall = false;
@ -187,7 +188,7 @@ void QSO::clear()
qslSenVia = QString();
qslRecVia = QString();
qslVia = QString();
qso_complete = QString();
qso_complete = qso_complete = util->getQSO_CompleteFromADIF("Y");
qso_dateTime = QDateTime();
qso_date_off = QDate();
qso_random = true;
@ -2472,6 +2473,8 @@ QString QSO::getState()
bool QSO::setSubmode(const QString &_c)
{
submode = _c;
haveSubMode = true;
//if (requestMode){
// emit getModeSignal(submode);
//}
@ -2975,8 +2978,8 @@ int QSO::getBandIdFromBandName(bool _rxBand)
int QSO::getModeIdFromModeName()
{
// submode is not used, keep it empty.
// mode field is populated with the submode
// We need to save always the submode id
// If submode is no present, then we will store the mode id
//qDebug() << Q_FUNC_INFO;
QSqlQuery query;
//
@ -2987,8 +2990,18 @@ int QSO::getModeIdFromModeName()
{
return -1;
}
//bool ok = query.prepare ("SELECT id from mode WHERE CASE WHEN ''<>:submode THEN submode=:submode ELSE name = :name END");
query.bindValue (":submode", getMode ());
if (haveSubMode)
{
query.bindValue (":submode", getSubmode ());
}
else if (haveMode)
{
query.bindValue (":submode", getMode ());
}
else
{
return -1;
}
if (query.exec ())
{
@ -3000,20 +3013,20 @@ int QSO::getModeIdFromModeName()
}
else
{
//qDebug() << Q_FUNC_INFO << " - Query NOT Valid";
return -4;
}
}
else
{
//qDebug() << Q_FUNC_INFO << " - Query NOT Next";
return -5;
}
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery());
return -1;
return -2;
}
return -1;
return -3;
}
QSqlQuery QSO::getPreparedQuery(const QString &_s)
@ -3166,7 +3179,7 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
query.bindValue(":stx", getStx());
query.bindValue(":state", getState());
query.bindValue(":station_callsign", getStationCallsign());
//query.bindValue(":submode", getModeIdFromModeName (true));
//query.bindValue(":submode", getModeIdFromModeName ());
query.bindValue(":swl", util->boolToCharToSQLite (getSwl()));
query.bindValue(":uksmg", getUksmg ());

View File

@ -426,7 +426,7 @@ private:
bool backup, lotwUpdating, realTime, manualMode, silent_key;
bool keepComment, keepOther, keepMyData, keepSat, modifying, isValidDistance, forceInit, qso_random, swl;
bool haveBand, haveMode, haveDateTime, haveCall;
bool haveBand, haveMode, haveSubMode, haveDateTime, haveCall;
Utilities *util;
Adif *adif;

View File

@ -96,7 +96,7 @@ private:
void saveSettings();
bool loadSettings();
void createIcons();
bool processConfigLine(const QString &_line);
//bool processConfigLine(const QString &_line);
void setDefaults();

View File

@ -30,7 +30,7 @@ CONFIG -=depend_includepath
#CONFIG += release
TEMPLATE = app
PKGVERSION = 2.3.4-RC3
PKGVERSION = 2.3.4-RC4
VERSION = 2.3.4
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

View File

@ -25,7 +25,6 @@
*****************************************************************************/
#include "updatesettings.h"
#include "global.h"
UpdateSettings::UpdateSettings()
{
@ -608,8 +607,6 @@ bool UpdateSettings::processConfigLine(const QString &_line)
settings.endGroup ();
}else if (tab == "LATESTBACKUP"){
settings.setValue ("LatestBackup", value);
}else{
//qDebug() << "SetupDialog::processConfigLine: NONE: " << QT_ENDL;
}
return true;
}

View File

@ -28,9 +28,11 @@
//bool c;
Utilities::Utilities(const QString &_parentName)
{
//qDebug() << Q_FUNC_INFO << " - Start";
parentName = _parentName;
//qDebug() << Q_FUNC_INFO << " (" << _parentName << ")";
init();
//qDebug() << Q_FUNC_INFO << " - END";
}
Utilities::~Utilities()
@ -514,93 +516,31 @@ QString Utilities::getKLogDefaultDatabaseFile()
return getHomeDir() ;
}
QString Utilities::getDBPath()
{ //Returns the path (folder level) of the DB
QSettings settings(getCfgFile (), QSettings::IniFormat);
settings.beginGroup ("Misc");
QString dbPath = settings.value ("DBPath").toString ();
if (dbPath.length()<1)
{
dbPath = getKLogDefaultDatabaseFile();
}
return dbPath;
}
QString Utilities::getKLogDBFile()
{
//qDebug() << "Utilities::getKLogDBFile: start " ;
dbPath = getKLogDefaultDatabaseFile();
QFile file(getCfgFile());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) /* Flawfinder: ignore */
{
//return dbPath;
//return getKLogDatabaseFile(dbPath);
}
else
{
while (!file.atEnd()) {
QByteArray line = file.readLine();
processConfigLine(line);
}
if (dbPath.length()<1)
{
dbPath = getKLogDefaultDatabaseFile();
}
}
//qDebug() << "Utilities::getKLogDBFile: path to use: " << dbPath ;
return dbPath + "/logbook.dat";
{ // Returns the full path to the main DB
return getDBPath() + "/logbook.dat";
}
QString Utilities::getKLogDBBackupFile()
{
//qDebug() << "Utilities::getKLogDBFile: start " ;
dbPath = getKLogDefaultDatabaseFile();
QFile file(getCfgFile());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) /* Flawfinder: ignore */
{
//return dbPath;
//return getKLogDatabaseFile(dbPath);
}
else
{
while (!file.atEnd()) {
QByteArray line = file.readLine();
processConfigLine(line);
}
if (dbPath.length()<1)
{
dbPath = getKLogDefaultDatabaseFile();
}
}
//qDebug() << "Utilities::getKLogDBFile: path to use: " << dbPath ;
return dbPath + "/" + QDateTime::currentDateTime().toString("yyyyMMdd-hhmmss") + "-backup-logbook.dat" ;
{ // Returns the full path to the backup DB
return getDBPath() + "/" + QDateTime::currentDateTime().toString("yyyyMMdd-hhmmss") + "-backup-logbook.dat" ;
}
bool Utilities::processConfigLine(const QString &_line)
{
//qDebug() << "Utilities::processConfigLine: " << _line ;
QString line = _line.simplified();
//line.simplified();
//QString aux;
QStringList values = line.split("=", QT_SKIP);
if (line.startsWith('#')){
//qDebug() << "Utilities::processConfigLine: notes Line!" ;
return true;
}
if (!( (line.contains('=')) && (line.contains(';')))){
//qDebug() << "Utilities::processConfigLine: Wrong Line!" ;
return false;
}
QString field = (values.at(0)).toUpper();
QString value = values.at(1);
int endValue = value.indexOf(';');
if (endValue>-1){
value = value.left(value.length() - (value.length() - endValue));
}
if (field == "DBPATH")
{
//qDebug() << "Utilities::processConfigLine: dbPATH found: " << value ;
dbPath = value;
}
return true;
}
/*
QString Utilities::getKLogDatabaseFile(const QString &_file)
@ -1221,140 +1161,6 @@ QString Utilities::getPrefixFromCall(const QString &_c, bool withAreaNumber)
i--;
}
return QString();
/*
QString call2 = call;
QString call3 = call;
bool keepAnalyzing = true;
bool found = false;
bool secondCharIsNumber = false;
if ((call.at(1)).isDigit())
{
secondCharIsNumber = true;
}
//GW1A
while (keepAnalyzing)
{
//qDebug() << Q_FUNC_INFO << " - call: " << call;
//qDebug() << Q_FUNC_INFO << " - call2: " << call2;
//qDebug() << Q_FUNC_INFO << " - call3: " << call3;
if (isAKnownPrefix(call))
{
//qDebug() << Q_FUNC_INFO << ": Found!: " << call;
keepAnalyzing = false;
found = true;
}
else if (call.length()<=2)
{
//qDebug() << Q_FUNC_INFO << ": Not found & call<=2: " << call;
keepAnalyzing = false;
}
else
{
//qDebug() << Q_FUNC_INFO << ": else, chop: " << call;
call3 = call2;
call2 = call;
call.chop(1);
}
}
//qDebug() << Q_FUNC_INFO << ": **** Out of while: " << call << "/" << call2 << "/" << call3;
if (found)
{
//qDebug() << Q_FUNC_INFO << ": END-0 " << call;
return call;
}
else
{
if (firstSpecial)
{
call3 = call2;
call2 = call;
call.chop(1);
}
//qDebug() << Q_FUNC_INFO << ": **** Out of while Special 1-Letter: " << call << "/" << call2 << "/" << call3;
}
//qDebug() << Q_FUNC_INFO << ": **** To process: " << call << "/" << call2 << "/" << call3;
if (withAreaNumber)
{
//qDebug() << Q_FUNC_INFO << ": WithAreaNumber";
if (firstSpecial)
{
//qDebug() << Q_FUNC_INFO << ": FirstSpecial";
int last = call2.length();
//qDebug() << Q_FUNC_INFO << ": last="<< QString::number(last);
if (call.length()==1)
{
//qDebug() << Q_FUNC_INFO << ": END0: " << call;
return call;
}
else if (((call2.at(last-1)).isDigit()))
{//K1
//qDebug() << Q_FUNC_INFO << ": END1: " << call2;
return call2;
}
else if ((call3.at(call3.length()-1)).isDigit())
{//KB1
//qDebug() << Q_FUNC_INFO << ": END2: " << call3;
return call3;
}
else
{
//qDebug() << Q_FUNC_INFO << ": END3: " << call;
return call;
}
}
else
{
if (call == call2)
{
//qDebug() << Q_FUNC_INFO << ": END4: " << call;
return call;
}
int last = call2.length();
if (((call2.at(last-1)).isDigit()))
{
//qDebug() << Q_FUNC_INFO << ": END5: " << call2;
return call2;
}
//qDebug() << Q_FUNC_INFO << ": END6: " << call;
//return call;
}
}
//Si se pide el numero pero el prefijo no trae numero se devuelve sin numero.
if (firstSpecial)
{
//qDebug() << Q_FUNC_INFO << ": call2: " << call2;
if (isAKnownPrefix(call2))
{
//qDebug() << Q_FUNC_INFO << ": END7.1: " << call;
return call2;
}
else if (!secondCharIsNumber && (call.at(3)).isDigit())
{
//qDebug() << Q_FUNC_INFO << ": END7.2: " << call;
return call;
}
//qDebug() << Q_FUNC_INFO << ": END7.3: " << call;
//return call;
}
int last = call2.length();
if (!((call2.at(last-1)).isDigit()))
{
if (isAKnownPrefix(call))
{
//qDebug() << Q_FUNC_INFO << ": END7.5: " << call2;
return call;
}
//qDebug() << Q_FUNC_INFO << ": END8: " << call2;
return call2;
}
//qDebug() << Q_FUNC_INFO << ": END9: " << call;
return call;
*/
}
bool Utilities::isAOneLetterPrefix(const QChar &_c)

View File

@ -68,6 +68,7 @@ public:
//QOperatingSystemVersion getOS();
//Devel or debug functions - Not adding any feature to the user
void printQString(const QStringList &_qs);
QString getKLogDBFile();
QString getKLogDBBackupFile();
bool QStringToBool(const QString &_s);
@ -190,7 +191,6 @@ private:
void init();
void InitializeHash();
void setLogColumnNames(); // Creates the map of column Names (should be called from init() )
bool processConfigLine(const QString &_line);
QString getKLogDefaultDatabaseFile();
//bool isCountrySuffix (const QString &_c);
bool isAValidOperatingSuffix (const QString &_c);
@ -206,7 +206,8 @@ private:
QString getCheckedComplexCall(const QString &_c);
void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level);
//bool darkMode;
QString dbPath;
QString getDBPath();
//QString dbPath;
QString softwareVersion;
QString parentName; // The class that instanciated this object.