diff options
| author | 2011-08-22 15:25:32 +0000 | |
|---|---|---|
| committer | 2011-08-22 15:25:32 +0000 | |
| commit | 88ff25fb5784523e540a097b031ff8fe992464fc (patch) | |
| tree | c8c61fa8a339a00828143ad69d1aaa8be077377a /src | |
| parent | fixed parsing the date of some log files (#1188) + updated deprecated Qt::Sys... (diff) | |
| download | KVIrc-88ff25fb5784523e540a097b031ff8fe992464fc.tar.gz KVIrc-88ff25fb5784523e540a097b031ff8fe992464fc.tar.bz2 KVIrc-88ff25fb5784523e540a097b031ff8fe992464fc.zip | |
fix for #1187
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5938 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvilib/locale/KviLocale.cpp | 5 | ||||
| -rw-r--r-- | src/kvirc/sparser/KviIrcServerParser_ctcp.cpp | 5 | ||||
| -rw-r--r-- | src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp | 5 | ||||
| -rw-r--r-- | src/kvirc/sparser/KviIrcServerParser_numericHandlers.cpp | 17 | ||||
| -rw-r--r-- | src/kvirc/ui/KviConsoleWindow.cpp | 4 | ||||
| -rw-r--r-- | src/kvirc/ui/KviCtcpPageDialog.cpp | 5 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView_loghandling.cpp | 9 | ||||
| -rw-r--r-- | src/kvirc/ui/KviMaskEditor.cpp | 4 | ||||
| -rw-r--r-- | src/kvirc/ui/KviUserListView.cpp | 4 | ||||
| -rw-r--r-- | src/modules/list/ListWindow.cpp | 4 | ||||
| -rw-r--r-- | src/modules/theme/PackThemeDialog.cpp | 4 | ||||
| -rw-r--r-- | src/modules/theme/SaveThemeDialog.cpp | 4 |
12 files changed, 55 insertions, 15 deletions
diff --git a/src/kvilib/locale/KviLocale.cpp b/src/kvilib/locale/KviLocale.cpp index 953d68079..8cdd405c4 100644 --- a/src/kvilib/locale/KviLocale.cpp +++ b/src/kvilib/locale/KviLocale.cpp @@ -511,6 +511,11 @@ KviLocale::KviLocale(QApplication * pApp, const QString & szLocaleDir, const QSt if(g_szLang.hasData()) { + // ensure Qt will use the right locale when formatting dates, numbers, .. + // Note: Qt will use the system() locale anyway, we need to construct an empty QLocale() + // to get it use our specified locale. + QLocale::setDefault(QLocale(QString::fromLatin1(g_szLang.ptr(), g_szLang.len()))); + QString szBuffer; if(findCatalogue(szBuffer,"kvirc",szLocaleDir)) { diff --git a/src/kvirc/sparser/KviIrcServerParser_ctcp.cpp b/src/kvirc/sparser/KviIrcServerParser_ctcp.cpp index ce028c6c9..a1f5e2b80 100644 --- a/src/kvirc/sparser/KviIrcServerParser_ctcp.cpp +++ b/src/kvirc/sparser/KviIrcServerParser_ctcp.cpp @@ -60,6 +60,7 @@ #include <stdlib.h> #include <QDateTime> +#include <QLocale> #include <QTextDocument> extern KVIRC_API KviSharedFilesManager * g_pSharedFilesManager; @@ -1340,7 +1341,9 @@ void KviIrcServerParser::parseCtcpRequestTime(KviCtcpMessage *msg) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szTmp = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szTmp = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szTmp = date.toString(Qt::ISODate); diff --git a/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp b/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp index c2d8d6e98..0e59c0c99 100644 --- a/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp +++ b/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp @@ -74,6 +74,7 @@ #include <QDateTime> #include <QTextDocument> #include <QByteArray> +#include <QLocale> extern KviNickServRuleSet * g_pNickServRuleSet; @@ -1515,7 +1516,9 @@ void KviIrcServerParser::parseLiteralTopic(KviIrcMessage *msg) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szTmp = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szTmp = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szTmp = date.toString(Qt::ISODate); diff --git a/src/kvirc/sparser/KviIrcServerParser_numericHandlers.cpp b/src/kvirc/sparser/KviIrcServerParser_numericHandlers.cpp index 2cfe3935f..59d71a63d 100644 --- a/src/kvirc/sparser/KviIrcServerParser_numericHandlers.cpp +++ b/src/kvirc/sparser/KviIrcServerParser_numericHandlers.cpp @@ -61,6 +61,7 @@ #include <QTextCodec> #include <QRegExp> #include <QByteArray> +#include <QLocale> // #define IS_CHANNEL_TYPE_FLAG(_str) ((*(_str) == '#') || (*(_str) == '&') || (*(_str) == '!')) #define IS_CHANNEL_TYPE_FLAG(_qchar) (msg->connection()->serverInfo()->supportedChannelTypes().indexOf(_qchar) != -1) @@ -585,7 +586,9 @@ void KviIrcServerParser::parseNumericTopicWhoTime(KviIrcMessage *msg) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szDate = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szDate = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szDate = date.toString(Qt::ISODate); @@ -666,7 +669,9 @@ void getDateTimeStringFromCharTimeT(QString & szBuffer, const char * time_t_stri switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szBuffer = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szBuffer = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szBuffer = date.toString(Qt::ISODate); @@ -1380,7 +1385,9 @@ void KviIrcServerParser::parseNumericWhoisIdle(KviIrcMessage *msg) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szTmp = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szTmp = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szTmp = date.toString(Qt::ISODate); @@ -1700,7 +1707,9 @@ void KviIrcServerParser::parseNumericCreationTime(KviIrcMessage *msg) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szDate = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szDate = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szDate = date.toString(Qt::ISODate); diff --git a/src/kvirc/ui/KviConsoleWindow.cpp b/src/kvirc/ui/KviConsoleWindow.cpp index d6af998b4..40d26c47c 100644 --- a/src/kvirc/ui/KviConsoleWindow.cpp +++ b/src/kvirc/ui/KviConsoleWindow.cpp @@ -1235,7 +1235,9 @@ void KviConsoleWindow::getWindowListTipText(QString &buffer) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szTmp = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szTmp = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szTmp = date.toString(Qt::ISODate); diff --git a/src/kvirc/ui/KviCtcpPageDialog.cpp b/src/kvirc/ui/KviCtcpPageDialog.cpp index a56f8bd10..0fdc224d1 100644 --- a/src/kvirc/ui/KviCtcpPageDialog.cpp +++ b/src/kvirc/ui/KviCtcpPageDialog.cpp @@ -37,6 +37,7 @@ #include <QStackedWidget> #include <QPushButton> #include <QTabWidget> +#include <QLocale> // KviApplication.cpp extern KVIRC_API KviCtcpPageDialog * g_pCtcpPageDialog; @@ -87,7 +88,9 @@ void KviCtcpPageDialog::addPage(const QString &szNick,const QString &szUser,cons switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szDate = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szDate = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szDate = date.toString(Qt::ISODate); diff --git a/src/kvirc/ui/KviIrcView_loghandling.cpp b/src/kvirc/ui/KviIrcView_loghandling.cpp index 18e326e47..0c5459166 100644 --- a/src/kvirc/ui/KviIrcView_loghandling.cpp +++ b/src/kvirc/ui/KviIrcView_loghandling.cpp @@ -42,6 +42,7 @@ #include <QFile> #include <QDateTime> #include <QTextCodec> +#include <QLocale> void KviIrcView::stopLogging() { @@ -52,7 +53,9 @@ void KviIrcView::stopLogging() switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szDate = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szDate = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szDate = date.toString(Qt::ISODate); @@ -220,7 +223,9 @@ bool KviIrcView::startLogging(const QString& fname,bool bPrependCurBuffer) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szDate = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szDate = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szDate = date.toString(Qt::ISODate); diff --git a/src/kvirc/ui/KviMaskEditor.cpp b/src/kvirc/ui/KviMaskEditor.cpp index 70549b7d1..ad7336849 100644 --- a/src/kvirc/ui/KviMaskEditor.cpp +++ b/src/kvirc/ui/KviMaskEditor.cpp @@ -46,7 +46,9 @@ KviMaskItem::KviMaskItem(QTreeWidget * pParent, KviMaskEntry * pEntry) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szDate = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szDate = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szDate = date.toString(Qt::ISODate); diff --git a/src/kvirc/ui/KviUserListView.cpp b/src/kvirc/ui/KviUserListView.cpp index e23efeb1c..0352607c6 100644 --- a/src/kvirc/ui/KviUserListView.cpp +++ b/src/kvirc/ui/KviUserListView.cpp @@ -1571,7 +1571,9 @@ void KviUserListView::maybeTip(KviUserListToolTip * pTip, const QPoint & pnt) switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szTmp = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szTmp = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szTmp = date.toString(Qt::ISODate); diff --git a/src/modules/list/ListWindow.cpp b/src/modules/list/ListWindow.cpp index 064482135..b005f4420 100644 --- a/src/modules/list/ListWindow.cpp +++ b/src/modules/list/ListWindow.cpp @@ -372,7 +372,9 @@ void ListWindow::exportList() switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szDate = date.toString("d MMM yyyy hh-mm"); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szDate = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szDate = date.toString(Qt::ISODate); diff --git a/src/modules/theme/PackThemeDialog.cpp b/src/modules/theme/PackThemeDialog.cpp index c3f07d443..875266f06 100644 --- a/src/modules/theme/PackThemeDialog.cpp +++ b/src/modules/theme/PackThemeDialog.cpp @@ -470,7 +470,9 @@ bool PackThemeDialog::packTheme() switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szTmp = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szTmp = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szTmp = date.toString(Qt::ISODate); diff --git a/src/modules/theme/SaveThemeDialog.cpp b/src/modules/theme/SaveThemeDialog.cpp index 9dd735cd0..009858128 100644 --- a/src/modules/theme/SaveThemeDialog.cpp +++ b/src/modules/theme/SaveThemeDialog.cpp @@ -250,7 +250,9 @@ bool SaveThemeDialog::saveTheme() switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat)) { case 0: - szTmp = date.toString(); + // this is the equivalent to an empty date.toString() call, but it's needed + // to ensure qt4 will use the default() locale and not the system() one + szTmp = QLocale().toString(date, "ddd MMM d hh:mm:ss yyyy"); break; case 1: szTmp = date.toString(Qt::ISODate); |
