aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/list/ListWindow.cpp2
-rw-r--r--src/modules/logview/LogFile.cpp34
-rw-r--r--src/modules/theme/PackThemeDialog.cpp2
-rw-r--r--src/modules/theme/SaveThemeDialog.cpp2
4 files changed, 35 insertions, 5 deletions
diff --git a/src/modules/list/ListWindow.cpp b/src/modules/list/ListWindow.cpp
index 6a936db6c..064482135 100644
--- a/src/modules/list/ListWindow.cpp
+++ b/src/modules/list/ListWindow.cpp
@@ -378,7 +378,7 @@ void ListWindow::exportList()
szDate = date.toString(Qt::ISODate);
break;
case 2:
- szDate = date.toString(Qt::SystemLocaleDate);
+ szDate = date.toString(Qt::SystemLocaleShortDate);
break;
}
szFile = QString(__tr2qs("Channel list for %1 - %2")).arg(connection()->currentNetworkName(),szDate);
diff --git a/src/modules/logview/LogFile.cpp b/src/modules/logview/LogFile.cpp
index 098d82636..172a1c32b 100644
--- a/src/modules/logview/LogFile.cpp
+++ b/src/modules/logview/LogFile.cpp
@@ -27,6 +27,7 @@
#include "KviQString.h"
#include "KviCString.h"
#include "KviOptions.h"
+#include "KviFileUtils.h"
#include <QFileInfo>
@@ -78,13 +79,28 @@ LogFile::LogFile(const QString & szName)
m_szNetwork = szUndecoded.hexDecode(szUndecoded.ptr()).ptr();
QString szDate = szTmpName.section('_',-1).section('.',0,-2);
+
switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat))
{
case 1:
m_date = QDate::fromString(szDate, Qt::ISODate);
break;
case 2:
- m_date = QDate::fromString(szDate, Qt::SystemLocaleDate);
+ m_date = QDate::fromString(szDate, Qt::SystemLocaleShortDate);
+ if(!m_date.isValid())
+ {
+ // some locale date formats use '/' as a separator; we change them to '-'
+ // when creating log files. Try to reverse that change here
+ QString szUnescapedDate = szDate;
+ szUnescapedDate.replace('-', KVI_PATH_SEPARATOR_CHAR);
+ m_date = QDate::fromString(szUnescapedDate, Qt::SystemLocaleShortDate);
+ if(m_date.isValid())
+ {
+ //qt4 defaults to 1900 for years. So "11" means "1911" instead of "2011".. what a pity
+ if(m_date.year() < 1990)
+ m_date = m_date.addYears(100);
+ }
+ }
break;
case 0:
default:
@@ -101,7 +117,21 @@ LogFile::LogFile(const QString & szName)
m_date = QDate::fromString(szDate, Qt::ISODate);
if(!m_date.isValid())
{
- m_date = QDate::fromString(szDate, Qt::SystemLocaleDate);
+ m_date = QDate::fromString(szDate, Qt::SystemLocaleShortDate);
+ if(!m_date.isValid())
+ {
+ // some locale date formats use '/' as a separator; we change them to '-'
+ // when creating log files. Try to reverse that change here
+ QString szUnescapedDate = szDate;
+ szUnescapedDate.replace('-', KVI_PATH_SEPARATOR_CHAR);
+ m_date = QDate::fromString(szUnescapedDate, Qt::SystemLocaleShortDate);
+ if(m_date.isValid())
+ {
+ //qt4 defaults to 1900 for years. So "11" means "1911" instead of "2011".. what a pity
+ if(m_date.year() < 1990)
+ m_date = m_date.addYears(100);
+ }
+ }
// if the date is still not valid, we give up
}
}
diff --git a/src/modules/theme/PackThemeDialog.cpp b/src/modules/theme/PackThemeDialog.cpp
index dc92c62a7..c3f07d443 100644
--- a/src/modules/theme/PackThemeDialog.cpp
+++ b/src/modules/theme/PackThemeDialog.cpp
@@ -476,7 +476,7 @@ bool PackThemeDialog::packTheme()
szTmp = date.toString(Qt::ISODate);
break;
case 2:
- szTmp = date.toString(Qt::SystemLocaleDate);
+ szTmp = date.toString(Qt::SystemLocaleShortDate);
break;
}
diff --git a/src/modules/theme/SaveThemeDialog.cpp b/src/modules/theme/SaveThemeDialog.cpp
index 3b7f5801b..9dd735cd0 100644
--- a/src/modules/theme/SaveThemeDialog.cpp
+++ b/src/modules/theme/SaveThemeDialog.cpp
@@ -256,7 +256,7 @@ bool SaveThemeDialog::saveTheme()
szTmp = date.toString(Qt::ISODate);
break;
case 2:
- szTmp = date.toString(Qt::SystemLocaleDate);
+ szTmp = date.toString(Qt::SystemLocaleShortDate);
break;
}