[Okular-devel] [Bug 299526] New: Create empty settings object if none is created from outside okular core library

Bogdan Cristea cristeab at gmail.com
Sun May 6 20:27:29 UTC 2012


https://bugs.kde.org/show_bug.cgi?id=299526

            Bug ID: 299526
          Severity: normal
           Version: unspecified
          Priority: NOR
          Assignee: okular-devel at kde.org
           Summary: Create empty settings object if none is created from
                    outside okular core library
    Classification: Unclassified
                OS: Linux
          Reporter: cristeab at gmail.com
          Hardware: Compiled Sources
            Status: UNCONFIRMED
         Component: general
           Product: okular

A better separation is needed between okular core library and the front-end.
Currently one Settings object is initialized from part.cpp, which is not in
okular core library. Also, settings.h file is not exposed to the user (at least
not in openSUSE 21.1 okular devel package) and thus it makes impossible to use
okular core library only.

Reproducible: Always

Steps to Reproduce:
1. Use okular core library in a stand alone program (not okular front end)
2. Try to open a document
Actual Results:  
The program exists immediately saying that Settings object has not been
initialized

Expected Results:  
Should be able to use Okular core library using the exposed header files.

This issue could be fixed by calling Settings::instance("") in DocumentPrivate
ctor. See the patch below:


>From a24c05938c3097d4d821dd71db5f7e49ea34855a Mon Sep 17 00:00:00 2001
From: Bogdan Cristea <cristeab at gmail.com>
Date: Sun, 6 May 2012 22:11:25 +0200
Subject: [PATCH] create empty settings object if none is created from outside
 okular core library

---
 core/document_p.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/core/document_p.h b/core/document_p.h
index 4f78d9a..c3bcd66 100644
--- a/core/document_p.h
+++ b/core/document_p.h
@@ -26,6 +26,7 @@
 // local includes
 #include "fontinfo.h"
 #include "generator.h"
+#include "settings.h"

 class QEventLoop;
 class QTimer;
@@ -87,6 +88,7 @@ class DocumentPrivate
             m_fontsCached( false ),
             m_documentInfo( 0 )
         {
+        Settings::instance("");//make sure that Settings object is initialized
             calculateMaxTextPages();
         }

-- 
1.7.7

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list