File fix-crash-when-loading-bandwidth-scheduler-plugin.patch of Package ktorrent

From f0d807626ff412be8521ee4ec337501df9e328c3 Mon Sep 17 00:00:00 2001
From: "Martin T. H. Sandsmark" <martin.sandsmark@kde.org>
Date: Mon, 4 Jul 2016 02:25:30 +0200
Subject: Fix crash when loading bandwidth scheduler plugin

---
 ktorrent/main.cpp                 | 4 ++++
 plugins/bwscheduler/weekscene.cpp | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ktorrent/main.cpp b/ktorrent/main.cpp
index a340e9a..03aa646 100644
--- a/ktorrent/main.cpp
+++ b/ktorrent/main.cpp
@@ -36,6 +36,7 @@
 #include <QCommandLineOption>
 #include <kaboutdata.h>
 #include <klocalizedstring.h>
+#include <KLocale>
 #include <kdbusservice.h>
 #include <kstartupinfo.h>
 #include <kwindowsystem.h>
@@ -183,6 +184,9 @@ int main(int argc, char** argv)
     parser.process(app);
     about.processCommandLine(&parser);
 
+    // Ensure that this is set up before plugins call it
+    KLocale::global();
+
     const KDBusService dbusService(KDBusService::Unique);
 
 #if 0 //ndef Q_WS_WIN
diff --git a/plugins/bwscheduler/weekscene.cpp b/plugins/bwscheduler/weekscene.cpp
index de8a2f6..523e242 100644
--- a/plugins/bwscheduler/weekscene.cpp
+++ b/plugins/bwscheduler/weekscene.cpp
@@ -58,7 +58,7 @@ namespace kt
 
     qreal LongestDayWidth(const QFontMetricsF& fm)
     {
-        const KCalendarSystem* cal = KGlobal::locale()->calendar();
+        const KCalendarSystem* cal = KLocale::global()->calendar();
         qreal wd = 0;
         for (int i = 1; i <= 7; i++)
         {
@@ -93,7 +93,7 @@ namespace kt
 
     void WeekScene::addCalendar()
     {
-        const KCalendarSystem* cal = KGlobal::locale()->calendar();
+        const KCalendarSystem* cal = KLocale::global()->calendar();
 
         QGraphicsTextItem* tmp = addText("Dinges");
         QFontMetricsF fm(tmp->font());
-- 
cgit v0.11.2

openSUSE Build Service is sponsored by