Fix static init issue on MSVC2010 with HelpEngineWrapper.
authorCasper van Donderen <casper.vandonderen@nokia.com>
Wed, 6 Jun 2012 12:05:09 +0000 (14:05 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 6 Jun 2012 12:16:55 +0000 (14:16 +0200)
Change-Id: I4ffcde027d075f5556031bc40e3635202dd10726
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
src/assistant/assistant/helpenginewrapper.cpp
src/assistant/assistant/helpenginewrapper.h
src/assistant/assistant/preferencesdialog.cpp

index b44a2ac..2d278b3 100644 (file)
@@ -115,7 +115,13 @@ private:
     QMap<QString, RecentSignal> m_recentQchUpdates;
 };
 
-const QString HelpEngineWrapper::TrUnfiltered = HelpEngineWrapper::tr("Unfiltered");
+const QString HelpEngineWrapper::TrUnfiltered()
+{
+    static QString s;
+    if (s.isNull())
+        s = HelpEngineWrapper::tr("Unfiltered");
+    return s;
+}
 
 HelpEngineWrapper *HelpEngineWrapper::helpEngineWrapper = 0;
 
@@ -273,7 +279,7 @@ void HelpEngineWrapper::setCurrentFilter(const QString &currentFilter)
 {
     TRACE_OBJ
     const QString &filter
-        = currentFilter == TrUnfiltered ? Unfiltered : currentFilter;
+            = currentFilter == TrUnfiltered() ? Unfiltered : currentFilter;
     d->m_helpEngine->setCurrentFilter(filter);
 }
 
@@ -281,7 +287,7 @@ const QString HelpEngineWrapper::currentFilter() const
 {
     TRACE_OBJ
     const QString &filter = d->m_helpEngine->currentFilter();
-    return filter == Unfiltered ? TrUnfiltered : filter;
+    return filter == Unfiltered ? TrUnfiltered() : filter;
 }
 
 const QStringList HelpEngineWrapper::customFilters() const
@@ -289,7 +295,7 @@ const QStringList HelpEngineWrapper::customFilters() const
     TRACE_OBJ
     QStringList filters = d->m_helpEngine->customFilters();
     filters.removeOne(Unfiltered);
-    filters.prepend(TrUnfiltered);
+    filters.prepend(TrUnfiltered());
     return filters;
 }
 
@@ -695,7 +701,7 @@ void HelpEngineWrapper::handleCurrentFilterChanged(const QString &filter)
 {
     TRACE_OBJ
     const QString &filterToReport
-        = filter == Unfiltered ? TrUnfiltered : filter;
+            = filter == Unfiltered ? TrUnfiltered() : filter;
     emit currentFilterChanged(filterToReport);
 }
 
index 5ee5e10..479bec7 100644 (file)
@@ -187,7 +187,7 @@ public:
     bool showTabs() const;
     void setShowTabs(bool show);
 
-    static const QString TrUnfiltered;
+    static const QString TrUnfiltered();
 
     bool fullTextSearchFallbackEnabled() const;
 
index e78ab32..69e3fa1 100644 (file)
@@ -161,7 +161,7 @@ void PreferencesDialog::updateFilterPage()
     m_filterMapBackup.clear();
     const QStringList &filters = helpEngine.customFilters();
     foreach (const QString &filter, filters) {
-        if (filter == HelpEngineWrapper::TrUnfiltered)
+        if (filter == HelpEngineWrapper::TrUnfiltered())
             continue;
         QStringList atts = helpEngine.filterAttributes(filter);
         m_filterMapBackup.insert(filter, atts);