summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:19 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:19 -0400
commit1af3b165c9377702ca62a64112bc089a6f575c30 (patch)
tree4df9cca5543b2cab5ca56dbb1214d7d3b1f291e3 /src/util
parent5b5fd0dce407556f98ed8edee89dc830bf1437b1 (diff)
Imported Upstream version 2.0~beta2
Diffstat (limited to 'src/util')
-rw-r--r--src/util/cpointers.cpp55
-rw-r--r--src/util/cpointers.h116
-rw-r--r--src/util/cresmgr.cpp496
-rw-r--r--src/util/cresmgr.h509
-rw-r--r--src/util/ctoolclass.cpp279
-rw-r--r--src/util/ctoolclass.h94
-rw-r--r--src/util/dialogutil.cpp61
-rw-r--r--src/util/dialogutil.h23
-rw-r--r--src/util/directoryutil.cpp368
-rw-r--r--src/util/directoryutil.h112
-rw-r--r--src/util/exceptions.h16
-rw-r--r--src/util/migrationutil.cpp92
-rw-r--r--src/util/migrationutil.h39
13 files changed, 2260 insertions, 0 deletions
diff --git a/src/util/cpointers.cpp b/src/util/cpointers.cpp
new file mode 100644
index 0000000..73c36d4
--- /dev/null
+++ b/src/util/cpointers.cpp
@@ -0,0 +1,55 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#include "cpointers.h"
+
+//BibleTime's backend
+#include "backend/managers/cswordbackend.h"
+#include "backend/managers/cdisplaytemplatemgr.h"
+
+//BibleTime's frontend
+#include "frontend/cprinter.h"
+
+CPointers::PointerCache m_pointerCache;
+
+void CPointers::setBackend(CSwordBackend* const backend) {
+ Q_ASSERT( m_pointerCache.backend == 0);
+ CPointers::deleteBackend();
+ m_pointerCache.backend = backend;
+}
+
+void CPointers::setInfoDisplay(InfoDisplay::CInfoDisplay* const infoDisplay) {
+ Q_ASSERT( m_pointerCache.infoDisplay == 0);
+ m_pointerCache.infoDisplay = infoDisplay;
+}
+
+void CPointers::deleteBackend() {
+ delete m_pointerCache.backend;
+ m_pointerCache.backend = 0;
+}
+
+void CPointers::deleteLanguageMgr() {
+ delete m_pointerCache.langMgr;
+ m_pointerCache.langMgr = 0;
+}
+
+void CPointers::deleteDisplayTemplateMgr() {
+ delete m_pointerCache.displayTemplateMgr;
+ m_pointerCache.displayTemplateMgr = 0;
+}
+
+/** Returns a pointer to the printer object. */
+CDisplayTemplateMgr* CPointers::displayTemplateManager() {
+ if (!m_pointerCache.displayTemplateMgr) {
+ m_pointerCache.displayTemplateMgr = new CDisplayTemplateMgr();
+ }
+
+ return m_pointerCache.displayTemplateMgr;
+}
+
diff --git a/src/util/cpointers.h b/src/util/cpointers.h
new file mode 100644
index 0000000..48ceea0
--- /dev/null
+++ b/src/util/cpointers.h
@@ -0,0 +1,116 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#ifndef CPOINTERS_H
+#define CPOINTERS_H
+
+//BibleTime includes
+#include "backend/managers/clanguagemgr.h"
+//#include "backend/cdisplaytemplatemgr.h"
+
+class CSwordBackend;
+class CLanguageMgr;
+class CDisplayTemplateMgr;
+
+namespace InfoDisplay {
+ class CInfoDisplay;
+}
+
+/** Holds the pointers to important classes like modules, backend etc.
+*/
+class CPointers {
+protected:
+ friend class BibleTime; //BibleTime may initialize this object
+ friend class BibleTimeApp; //BibleTimeApp may initialize this object
+ friend int main(int argc, char* argv[]); //main may set the printer
+
+ //Empty virtuaual destructor
+ virtual ~CPointers() {}
+
+ /** Set the backend.
+ * @param backend Pointer to the new application-wide Sword backend
+ */
+ static void setBackend(CSwordBackend* const backend);
+ /** Set the info display.
+ * @param iDisplay The pointer to the new info display.
+ */
+ static void setInfoDisplay(InfoDisplay::CInfoDisplay* const iDisplay);
+
+ /** Delete the backend. Should be called by BibleTimeApp,
+ * because the backend should be deleted as late as possible.
+ */
+ static void deleteBackend();
+ /** Delete the printer. Should be called by BibleTimeApp,
+ * because the printer should be deleted as late as possible.
+ */
+ static void deletePrinter();
+ /** Delete the language manager. Should be called by BibleTimeApp,
+ * because the language manager should be deleted as late as possible.
+ */
+ static void deleteLanguageMgr();
+ /** Delete the display template manager. Should be called by BibleTimeApp,
+ * because the template manager should be deleted as late as possible.
+ */
+ static void deleteDisplayTemplateMgr();
+
+public: // Public methods
+ /** Returns a pointer to the backend
+ * @return The backend pointer.
+ */
+ inline static CSwordBackend* backend();
+ /** Returns a pointer to the language manager
+ * @return The language manager
+ */
+ inline static CLanguageMgr* languageMgr();
+ /** Returns a pointer to the info display.
+ * @return The backend pointer.
+ */
+ inline static InfoDisplay::CInfoDisplay* infoDisplay();
+ /** Returns a pointer to the application's display template manager
+ * @return The backend pointer.
+ */
+ static CDisplayTemplateMgr* displayTemplateManager();
+
+ struct PointerCache {
+ PointerCache() {
+ backend = 0;
+ langMgr = 0;
+ infoDisplay = 0;
+ displayTemplateMgr = 0;
+ };
+
+ CSwordBackend* backend;
+ CLanguageMgr* langMgr;
+ InfoDisplay::CInfoDisplay* infoDisplay;
+ CDisplayTemplateMgr* displayTemplateMgr;
+ };
+};
+
+extern CPointers::PointerCache m_pointerCache;
+
+/** Returns a pointer to the backend ... */
+inline CSwordBackend* CPointers::backend() {
+ return m_pointerCache.backend;
+}
+
+/** Returns a pointer to the backend ... */
+inline CLanguageMgr* CPointers::languageMgr() {
+ if (!m_pointerCache.langMgr) {
+ m_pointerCache.langMgr = new CLanguageMgr();
+ }
+ return m_pointerCache.langMgr;
+}
+
+/** Returns a pointer to the printer object. */
+inline InfoDisplay::CInfoDisplay* CPointers::infoDisplay() {
+ return m_pointerCache.infoDisplay;
+}
+
+
+#endif
diff --git a/src/util/cresmgr.cpp b/src/util/cresmgr.cpp
new file mode 100644
index 0000000..1bd51af
--- /dev/null
+++ b/src/util/cresmgr.cpp
@@ -0,0 +1,496 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#include "cresmgr.h"
+
+#include <QString>
+
+
+namespace CResMgr {
+ namespace modules {
+ namespace bible {
+ const QString icon_unlocked = "bible.svg";
+ const QString icon_locked = "bible_locked.svg";
+ const QString icon_add = "bible_add.svg";
+ } //bible
+ namespace commentary {
+ const QString icon_unlocked = "commentary.svg";
+ const QString icon_locked = "commentary_locked.svg";
+ const QString icon_add = "commentary_add.svg";
+ } //commentary
+ namespace lexicon {
+ const QString icon_unlocked = "lexicon.svg";
+ const QString icon_locked = "lexicon_locked.svg";
+ const QString icon_add = "lexicon_add.svg";
+ }//lexicon
+ namespace book {
+ const QString icon_unlocked = "book.svg";
+ const QString icon_locked = "book_locked.svg";
+ const QString icon_add = "book_add.svg";
+ }//book
+ }//modules
+
+ namespace categories {
+ namespace bibles {
+ const QString icon = "bible.svg";
+ }
+ namespace commentaries {
+ const QString icon = "commentary.svg";
+ }
+ namespace lexicons {
+ const QString icon = "dictionary.svg";
+ }
+ namespace dailydevotional {
+ const QString icon = "calendar.svg";
+ }
+ namespace books {
+ const QString icon = "books.svg";
+ }
+ namespace glossary {
+ const QString icon = "dictionary.svg";
+ }
+ namespace images {
+ const QString icon = "map.svg";
+ }
+ namespace cults {
+ const QString icon = "questionable.svg";
+ }
+ }//categories
+ namespace mainMenu { //Main menu
+
+ namespace view { //Main menu->View
+ namespace showMainIndex {
+ const QString icon = "view_index.svg";
+ const QKeySequence accel(Qt::Key_F9);
+ const char* actionName = "viewMainIndex_action";
+ }
+ namespace showInfoDisplay {
+ const QString icon = "view_mag.svg";
+ const QKeySequence accel(Qt::Key_F8);
+ const char* actionName = "viewInfoDisplay_action";
+ }
+ }//mainMenu::view
+
+ namespace mainIndex {
+ namespace search {
+ const QString icon = "find.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::Key_O);
+ const char* actionName = "mainindex_search_action";
+ }
+ namespace searchdefaultbible {
+ const QString icon = "find.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_F);
+ const char* actionName = "mainindex_searchdefaultbible_action";
+ }
+ }//mainMenu::mainIndex
+
+ namespace window { //mainMenu::window
+ namespace loadProfile {
+ const QString icon = "view_profile.svg";
+ const char* actionName = "windowLoadProfile_action";
+ }
+ namespace saveProfile {
+ const QString icon = "view_profile.svg";
+ const char* actionName = "windowSaveProfile_action";
+ }
+ namespace saveToNewProfile {
+ const QString icon = "view_profile.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_S);
+ const char* actionName = "windowSaveToNewProfile_action";
+ }
+ namespace deleteProfile {
+ const QString icon = "view_profile.svg";
+ const char* actionName = "windowDeleteProfile_action";
+ }
+ namespace showFullscreen {
+ const QString icon = "window_fullscreen.svg";
+ const QKeySequence accel(Qt::Key_F5);
+ const char* actionName = "windowFullscreen_action";
+ }
+ namespace arrangementMode {
+ const QString icon = "cascade_auto.svg";
+ const QKeySequence accel;
+ const char* actionName = "windowArrangementMode_action";
+
+ namespace manual {
+ const QString icon = "tile.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_M);
+ const char* actionName = "windowArrangementManual_action";
+ }
+ namespace autoTileHorizontal {
+ const QString icon = "tile_horiz.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_H);
+ const char* actionName = "windowAutoTileHorizontal_action";
+ }
+ namespace autoTileVertical {
+ const QString icon = "tile_vert.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_G);
+ const char* actionName = "windowAutoTileVertical_action";
+ }
+ namespace autoCascade {
+ const QString icon = "cascade_auto.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_J);
+ const char* actionName = "windowAutoCascade_action";
+ }
+ }
+ namespace tileHorizontal {
+ const QString icon = "tile_horiz.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::Key_H);
+ const char* actionName = "windowTileHorizontal_action";
+ }
+ namespace tileVertical {
+ const QString icon = "tile_vert.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::Key_G);
+ const char* actionName = "windowTileVertical_action";
+ }
+ namespace cascade {
+ const QString icon = "cascade.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::Key_J);
+ const char* actionName = "windowCascade_action";
+ }
+ namespace closeAll {
+ const QString icon = "fileclose.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_W);
+ const char* actionName = "windowCloseAll_action";
+ }
+ }//mainMenu::window
+
+ namespace settings { //Main menu->Settings
+ namespace swordSetupDialog {
+ const QString icon = "swordconfig.svg";
+ const QKeySequence accel(Qt::Key_F4);
+ const char* actionName = "options_sword_setup";
+ }
+
+ }//mainMenu::settings
+
+ namespace help { //Main menu->Help
+ namespace handbook {
+ const QString icon = "contents2.svg";
+ const QKeySequence accel(Qt::Key_F1);
+ const char* actionName = "helpHandbook_action";
+ }
+ namespace bibleStudyHowTo {
+ const QString icon = "contents2.svg";
+ const QKeySequence accel(Qt::Key_F2);
+ const char* actionName = "helpHowTo_action";
+ }
+ }//mainMenu::help
+ } //end of mainMenu
+
+ namespace searchdialog {
+ const QString icon = "find.svg";
+ const QString close_icon = "stop.svg";
+ const QString help_icon = "questionmark";
+ const QString chooseworks_icon = "checkbox";
+ const QString setupscope_icon = "configure";
+
+ namespace result {
+ namespace moduleList {
+
+ namespace copyMenu {
+ const QString icon = "edit_copy.svg";
+ }
+ namespace saveMenu {
+ const QString icon = "file_save.svg";
+ }
+ namespace printMenu {
+ const QString icon = "print.svg";
+ }
+ }
+ namespace foundItems {
+
+ namespace copyMenu {
+ const QString icon = "edit_copy.svg";
+ }
+ namespace saveMenu {
+ const QString icon = "file_save.svg";
+ }
+ namespace printMenu {
+ const QString icon = "print.svg";
+ }
+ }
+ }
+ } //searchDialog
+
+ namespace displaywindows {
+/* namespace transliteration {
+ const QString icon = "bt_displaytranslit";
+ }*/
+ namespace displaySettings {
+ const QString icon = "displayconfig.svg";
+ }
+
+ namespace general {
+ namespace search {
+ const QString icon = "find.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::Key_L);
+ const char* actionName = "window_search_action";
+ }
+
+ namespace backInHistory {
+ const QString icon = "back.svg";
+ const QKeySequence accel(Qt::ALT + Qt::Key_Left);
+ const char* actionName = "window_history_back_action";
+ }
+ namespace forwardInHistory {
+ const QString icon = "forward.svg";
+ const QKeySequence accel(Qt::ALT + Qt::Key_Right);
+ const char* actionName = "window_history_forward_action";
+ }
+ namespace findStrongs {
+ const QString icon = "bt_findstrongs.svg";
+ const QKeySequence accel;
+ const char* actionName = "window_find_strongs_action";
+ }
+
+ }
+ namespace bibleWindow {
+ namespace nextBook {
+ const QKeySequence accel(Qt::CTRL + Qt::Key_Y);
+ }
+ namespace previousBook {
+ const QKeySequence accel(Qt::CTRL + Qt::SHIFT + Qt::Key_Y);
+ }
+
+ namespace nextChapter {
+ const QKeySequence accel(Qt::CTRL + Qt::Key_X);
+ }
+ namespace previousChapter {
+ const QKeySequence accel(Qt::CTRL + Qt::SHIFT + Qt::Key_X);
+ }
+ namespace nextVerse {
+ const QKeySequence accel(Qt::CTRL + Qt::Key_V);
+ }
+ namespace previousVerse {
+ const QKeySequence accel(Qt::CTRL + Qt::SHIFT + Qt::Key_V);
+ }
+
+ namespace copyMenu {
+ const QString icon = "edit_copy.svg";
+ }
+ namespace saveMenu {
+ const QString icon = "file_save.svg";
+ }
+ namespace printMenu {
+ const QString icon = "print.svg";
+ }
+ }
+ namespace commentaryWindow {
+ namespace syncWindow {
+ const QString icon = "sync.svg";
+ const QKeySequence accel;
+ const char* actionName = "commentary_syncWindow";
+ }
+ }
+ namespace lexiconWindow {
+ namespace entryList {
+ QString tooltip;
+ }
+ namespace nextEntry {
+ const QKeySequence accel(Qt::CTRL + Qt::Key_V);
+ }
+ namespace previousEntry {
+ const QKeySequence accel(Qt::CTRL + Qt::SHIFT + Qt::Key_V);
+ }
+
+ namespace copyMenu {
+ const QString icon = "edit_copy.svg";
+ }
+ namespace saveMenu {
+ const QString icon = "file_save.svg";
+ }
+ namespace printMenu {
+ const QString icon = "print.svg";
+ }
+ }
+ namespace bookWindow {
+ namespace toggleTree {
+ const QString icon = "view_sidetree.svg";
+ const QKeySequence accel;
+ }
+ }
+
+ namespace writeWindow {
+ namespace saveText {
+ const QString icon = "file_save";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_saveText";
+ }
+ namespace restoreText {
+ const QString icon = "import.svg";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_restoreText";
+ }
+ namespace deleteEntry {
+ const QString icon = "edit_delete.svg";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_deleteEntry";
+ }
+
+ //formatting buttons
+ namespace boldText {
+ const QString icon = "text_bold.svg";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_boldText";
+ }
+ namespace italicText {
+ const QString icon = "text_italic.svg";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_italicText";
+ }
+ namespace underlinedText {
+ const QString icon = "text_under.svg";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_underlineText";
+ }
+
+ namespace alignLeft {
+ const QString icon = "text_leftalign";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_alignLeft";
+ }
+ namespace alignCenter {
+ const QString icon = "text_center";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_alignCenter";
+ }
+ namespace alignRight {
+ const QString icon = "text_rightalign";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_alignRight";
+ }
+ namespace alignJustify {
+ const QString icon = "text_justify";
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_alignJustify";
+ }
+
+ namespace fontFamily {
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_fontFamily";
+ }
+ namespace fontSize {
+ const QKeySequence accel;
+ const char* actionName = "writeWindow_fontSize";
+ }
+ }
+ }//displayWindows
+
+ namespace settings {
+ namespace startup {
+ const QString icon = "startconfig.svg";
+ }
+ namespace fonts {
+ const QString icon = "fonts.svg";
+ }
+ namespace profiles {
+ const QString icon = "view_profile.svg";
+ }
+ namespace sword {
+ const QString icon = "swordconfig.svg";
+
+ }
+ namespace keys {
+ const QString icon = "key_bindings.svg";
+ }
+ }//settings
+
+ namespace mainIndex { // Bookshelf view
+ namespace search {
+ const QString icon = "find.svg";
+ const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_M);
+ const char* actionName = "GMsearch_action";
+ }
+ namespace newFolder {
+ const QString icon = "folder_new.svg";
+ }
+ namespace changeFolder {
+ const QString icon = "folder.svg";
+ }
+ namespace openedFolder {
+ const QString icon = "folder_open.svg";
+ }
+ namespace closedFolder {
+ const QString icon = "folder.svg";
+ }
+
+ namespace bookmark {
+ const QString icon = "bookmark.svg";
+ }
+ namespace changeBookmark {
+ const QString icon = "bookmark.svg";
+ }
+ namespace importBookmarks {
+ const QString icon = "import.svg";
+ }
+ namespace exportBookmarks {
+ const QString icon = "export.svg";
+ }
+ namespace printBookmarks {
+ const QString icon = "print.svg";
+ }
+ namespace deleteItems {
+ const QString icon = "edit_delete.svg";
+ }
+
+ namespace editModuleMenu {
+ const QString icon = "pencil.svg";
+ }
+ namespace editModulePlain {
+ const QString icon = "pencil.svg";
+ }
+ namespace editModuleHTML {
+ const QString icon = "pencil.svg";
+ }
+
+ namespace unlockModule {
+ const QString icon = "unlock.svg";
+ }
+ namespace aboutModule {
+ const QString icon = "info.svg";
+ }
+ namespace grouping {
+ const QString icon = "view-tree.svg";
+ }
+ }//mainIndex
+
+ namespace bookshelfmgr {
+ namespace installpage {
+ const QString icon = "bible_add";
+ const QString refresh_icon = "refresh";
+ const QString delete_icon = "trash";
+ const QString add_icon = "plus";
+ const QString install_icon = "bible_add";
+ const QString path_icon = "configure";
+ }
+ namespace removepage {
+ const QString icon = "bible_remove";
+ const QString remove_icon = "trash";
+ }
+ namespace indexpage {
+ const QString icon = "document_magnifier";
+ const QString create_icon = "folder_new";
+ const QString delete_icon = "trash";
+ }
+ namespace paths {
+ const QString add_icon = "plus";
+ const QString edit_icon = "pencil";
+ const QString remove_icon = "trash";
+ }
+ }
+
+}
+
+
+
+namespace CResMgr {
+ void init_tr() {
+ } //init_tr()
+} //CResMgr
diff --git a/src/util/cresmgr.h b/src/util/cresmgr.h
new file mode 100644
index 0000000..1fa3953
--- /dev/null
+++ b/src/util/cresmgr.h
@@ -0,0 +1,509 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#ifndef CRESMGR_H
+#define CRESMGR_H
+
+//Qt includes
+#include <QString>
+#include <QKeySequence>
+
+/** Provides static functions to easily access the Tooltip texts for all the frontend parts.
+ * @author The BibleTime team
+ */
+namespace CResMgr {
+ void init_tr();
+
+ namespace modules {
+ namespace bible {
+ extern const QString icon_unlocked;
+ extern const QString icon_locked;
+ extern const QString icon_add;
+ }
+ namespace commentary {
+ extern const QString icon_unlocked;
+ extern const QString icon_locked;
+ extern const QString icon_add;
+ }
+ namespace lexicon {
+ extern const QString icon_unlocked;
+ extern const QString icon_locked;
+ extern const QString icon_add;
+ }
+ namespace book {
+ extern const QString icon_unlocked;
+ extern const QString icon_locked;
+ extern const QString icon_add;
+ }
+ }
+
+ namespace categories {
+ namespace bibles {
+ extern const QString icon;
+ }
+ namespace commentaries {
+ extern const QString icon;
+ }
+ namespace lexicons {
+ extern const QString icon;
+ }
+ namespace dailydevotional {
+ extern const QString icon;
+ }
+ namespace books {
+ extern const QString icon;
+ }
+ namespace glossary {
+ extern const QString icon;
+ }
+ namespace images {
+ extern const QString icon;
+ }
+ namespace cults {
+ extern const QString icon;
+ }
+ }
+
+ namespace mainMenu { //Main menu
+
+ namespace view { //Main menu->View
+ namespace showMainIndex {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace showInfoDisplay {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ }
+
+ namespace mainIndex { //configuration for the main index and the view->search menu
+ namespace search {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace searchdefaultbible {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ }
+
+ namespace window { //Main menu->Window
+ namespace loadProfile {
+ extern const QString icon;
+ extern const char* actionName;
+ }
+ namespace saveProfile {
+ extern const QString icon;
+ extern const char* actionName;
+ }
+ namespace saveToNewProfile {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace deleteProfile {
+ extern const QString icon;
+ extern const char* actionName;
+ }
+ namespace showFullscreen {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace arrangementMode {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+
+ namespace manual {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace autoTileVertical {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace autoTileHorizontal {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace autoCascade {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ }
+ namespace tileVertical {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace tileHorizontal {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace cascade {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace closeAll {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ }
+
+ namespace settings { //Main menu->Settings
+ namespace editToolBar { // available as KStdAction
+ }
+ namespace optionsDialog { // available as KStdAction
+ }
+ namespace swordSetupDialog {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ }
+
+ namespace help { //Main menu->Help
+ namespace handbook {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace bibleStudyHowTo {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ }
+ } //end of main menu
+
+ namespace searchdialog {
+ extern const QString icon;
+ extern const QString close_icon;
+ extern const QString help_icon;
+ extern const QString chooseworks_icon;
+ extern const QString setupscope_icon;
+
+ namespace result {
+ namespace moduleList {
+
+ namespace copyMenu {
+ extern const QString icon;
+ }
+ namespace saveMenu {
+ extern const QString icon;
+ }
+ namespace printMenu {
+ extern const QString icon;
+ }
+ }
+ namespace foundItems {
+
+ namespace copyMenu {
+ extern const QString icon;
+ }
+ namespace saveMenu {
+ extern const QString icon;
+ }
+ namespace printMenu {
+ extern const QString icon;
+ }
+
+ }
+ }
+ }
+
+namespace workspace {}
+
+ namespace displaywindows {
+ namespace transliteration {
+ extern const QString icon;
+ }
+ namespace displaySettings {
+ extern const QString icon;
+ }
+
+ namespace general {
+ namespace search {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+
+ namespace backInHistory {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace forwardInHistory {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+
+ namespace findStrongs {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ }
+
+ namespace bibleWindow {
+ namespace nextBook {
+ extern const QKeySequence accel;
+ }
+ namespace previousBook {
+ extern const QKeySequence accel;
+ }
+
+ namespace nextChapter {
+ extern const QKeySequence accel;
+ }
+ namespace previousChapter {
+ extern const QKeySequence accel;
+ }
+
+ namespace nextVerse {
+ extern const QKeySequence accel;
+ }
+ namespace previousVerse {
+ extern const QKeySequence accel;
+ }
+
+ namespace copyMenu {
+ extern const QString icon;
+ }
+ namespace saveMenu {
+ extern const QString icon;
+ }
+ namespace printMenu {
+ extern const QString icon;
+ }
+ }
+ namespace commentaryWindow {
+ namespace syncWindow {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+
+ }
+
+ namespace lexiconWindow {
+ namespace nextEntry {
+ extern const QKeySequence accel;
+ }
+ namespace previousEntry {
+ extern const QKeySequence accel;
+ }
+
+ namespace copyMenu {
+ extern const QString icon;
+ }
+ namespace saveMenu {
+ extern const QString icon;
+ }
+ namespace printMenu {
+ extern const QString icon;
+ }
+ }
+ namespace bookWindow {
+ namespace toggleTree {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ }
+ }
+
+
+ namespace writeWindow {
+ namespace saveText {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace restoreText {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace deleteEntry {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+
+ //formatting buttons
+ namespace boldText {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace italicText {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace underlinedText {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+
+ namespace alignLeft {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace alignCenter {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace alignRight {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace alignJustify {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+
+ namespace fontFamily {
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace fontSize {
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace fontColor {
+ }
+
+ }
+ }
+
+ namespace settings {
+ namespace startup {
+ extern const QString icon;
+ }
+ namespace fonts {
+ extern const QString icon;
+ }
+ namespace profiles {
+ extern const QString icon;
+ }
+ namespace sword {
+ extern const QString icon;
+
+ }
+ namespace keys {
+ extern const QString icon;
+ }
+ }
+
+ namespace mainIndex { //configuration for the main index and the view->search menu
+ namespace search {
+ extern const QString icon;
+ extern const QKeySequence accel;
+ extern const char* actionName;
+ }
+ namespace newFolder {
+ extern const QString icon;
+ }
+ namespace changeFolder {
+ extern const QString icon;
+ }
+ namespace openedFolder {
+ extern const QString icon;
+ }
+ namespace closedFolder {
+ extern const QString icon;
+ }
+
+ namespace bookmark {
+ extern const QString icon;
+ }
+ namespace changeBookmark {
+ extern const QString icon;
+ }
+ namespace importBookmarks {
+ extern const QString icon;
+ }
+ namespace exportBookmarks {
+ extern const QString icon;
+ }
+ namespace printBookmarks {
+ extern const QString icon;
+ }
+ namespace deleteItems {
+ extern const QString icon;
+ }
+
+ namespace editModuleMenu {
+ extern const QString icon;
+ }
+ namespace editModulePlain {
+ extern const QString icon;
+ }
+ namespace editModuleHTML {
+ extern const QString icon;
+ }
+
+ namespace unlockModule {
+ extern const QString icon;
+ }
+ namespace aboutModule {
+ extern const QString icon;
+ }
+ namespace grouping {
+ extern const QString icon;
+ }
+ }
+
+ namespace bookshelfmgr {
+ namespace installpage {
+ extern const QString icon;
+ extern const QString refresh_icon;
+ extern const QString delete_icon;
+ extern const QString add_icon;
+ extern const QString install_icon;
+ extern const QString path_icon;
+ }
+ namespace removepage {
+ extern const QString icon;
+ extern const QString remove_icon;
+ }
+ namespace indexpage {
+ extern const QString icon;
+ extern const QString create_icon;
+ extern const QString delete_icon;
+ }
+ namespace paths {
+ extern const QString add_icon;
+ extern const QString edit_icon;
+ extern const QString remove_icon;
+ }
+ }
+}
+
+#endif
diff --git a/src/util/ctoolclass.cpp b/src/util/ctoolclass.cpp
new file mode 100644
index 0000000..c21bfe3
--- /dev/null
+++ b/src/util/ctoolclass.cpp
@@ -0,0 +1,279 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#include "ctoolclass.h"
+
+#include "util/cresmgr.h"
+#include "util/directoryutil.h"
+#include "backend/managers/cswordbackend.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+
+//Qt
+#include <QLabel>
+#include <QFile>
+#include <QFileDialog>
+#include <QTextStream>
+#include <QRegExp>
+#include <QWidget>
+#include <QApplication>
+#include <QMessageBox>
+
+//KDE includes
+
+
+/** Converts HTML text to plain text */
+QString CToolClass::htmlToText(const QString& html) {
+ QString newText = html;
+ // convert some tags we need in code
+ newText.replace( QRegExp(" "),"#SPACE#" );
+ newText.replace( QRegExp("<br/?>\\s*"), "<br/>\n" );
+ newText.replace( QRegExp("#SPACE#")," " );
+
+ QRegExp re("<.+>");
+ re.setMinimal(true);
+ newText.replace( re,"" );
+ return newText;
+}
+
+/** Converts text to HTML (\n to <BR>) */
+QString CToolClass::textToHTML(const QString& text) {
+ QString newText = text;
+ newText.replace( QRegExp("<BR>\n"),"#NEWLINE#" );
+ newText.replace( QRegExp("\n"),"<BR>\n" );
+ newText.replace( QRegExp("#NEWLINE#"),"<BR>\n");
+ return newText;
+}
+
+/** Creates the file filename and put text into the file.
+ */
+bool CToolClass::savePlainFile( const QString& filename, const QString& text, const bool& forceOverwrite, QTextCodec* fileCodec) {
+ QFile saveFile(filename);
+ bool ret;
+
+ if (saveFile.exists()) {
+ if (!forceOverwrite && QMessageBox::question(0, QObject::tr("Overwrite File?"),
+ QString::fromLatin1("<qt><B>%1</B><BR>%2</qt>")
+ .arg( QObject::tr("The file already exists.") )
+ .arg( QObject::tr("Do you want to overwrite it?")),
+ QMessageBox::Yes|QMessageBox::No,
+ QMessageBox::No) == QMessageBox::No
+ )
+ {
+ return false;
+ }
+ else { //either the user chose yes or forceOverwrite is set
+ saveFile.remove();
+ }
+ }
+
+ if ( saveFile.open(QIODevice::ReadWrite) ) {
+ QTextStream textstream( &saveFile );
+ textstream.setCodec(fileCodec);
+ textstream << text;
+ saveFile.close();
+ ret = true;
+ }
+ else {
+ QMessageBox::critical(0, QObject::tr("Error"),
+ QString::fromLatin1("<qt>%1<BR><B>%2</B></qt>")
+ .arg( QObject::tr("The file couldn't be saved.") )
+ .arg( QObject::tr("Please check permissions etc.")));
+ saveFile.close();
+ ret = false;
+ }
+ return ret;
+}
+
+
+/** Returns the icon used for the module given as aparameter. */
+QIcon CToolClass::getIconForModule( CSwordModuleInfo* module_info ) {
+ return util::filesystem::DirectoryUtil::getIcon(getIconNameForModule(module_info));
+}
+
+/** Returns the name for the icon used for the module given as aparameter. */
+QString CToolClass::getIconNameForModule( CSwordModuleInfo* module_info ) {
+ //qDebug("CToolClass::getIconNameForModule");
+ if (!module_info) return CResMgr::modules::book::icon_locked;
+
+ if (module_info->category() == CSwordModuleInfo::Cult) {
+ return "stop.svg";
+ }
+
+ switch (module_info->type()) {
+ case CSwordModuleInfo::Bible:
+ if (module_info->isLocked())
+ return CResMgr::modules::bible::icon_locked;
+ else
+ return CResMgr::modules::bible::icon_unlocked;
+ break;
+
+ case CSwordModuleInfo::Lexicon:
+ if (module_info->isLocked())
+ return CResMgr::modules::lexicon::icon_locked;
+ else
+ return CResMgr::modules::lexicon::icon_unlocked;
+ break;
+
+ case CSwordModuleInfo::Commentary:
+ if (module_info->isLocked())
+ return CResMgr::modules::commentary::icon_locked;
+ else
+ return CResMgr::modules::commentary::icon_unlocked;
+ break;
+
+ case CSwordModuleInfo::GenericBook:
+ if (module_info->isLocked())
+ return CResMgr::modules::book::icon_locked;
+ else
+ return CResMgr::modules::book::icon_unlocked;
+ break;
+
+ case CSwordModuleInfo::Unknown: //fallback
+ default:
+ if (module_info->isLocked())
+ return CResMgr::modules::book::icon_locked;
+ else
+ return CResMgr::modules::book::icon_unlocked;
+ break;
+ }
+ return CResMgr::modules::book::icon_unlocked;
+}
+
+QLabel* CToolClass::explanationLabel(QWidget* parent, const QString& heading, const QString& text ) {
+ QString br;
+ if (!heading.isEmpty() && !text.isEmpty()) {
+ br = QString::fromLatin1("<span style='white-space:pre'> - </span>");
+ }
+ QLabel* label = new QLabel( QString::fromLatin1("<B>%1</B>%2<small>%3</small>").arg(heading).arg(br).arg(text),parent );
+
+ label->setWordWrap(true);
+ label->setMargin(1);
+ label->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ return label;
+}
+
+/** No descriptions */
+bool CToolClass::inHTMLTag(int pos, QString & text) {
+ int i1=text.lastIndexOf("<",pos);
+ int i2=text.lastIndexOf(">",pos);
+ int i3=text.indexOf(">",pos);
+ int i4=text.indexOf("<",pos);
+
+
+ // if ((i1>0) && (i2==-1)) //we're in th first html tag
+ // i2=i1; // not ncessary, just for explanation
+
+ if ((i3>0) && (i4==-1)) //we're in the last html tag
+ i4=i3+1;
+
+ // qWarning("%d > %d && %d < %d",i1,i2,i3,i4);
+
+ if ( (i1>i2) && (i3<i4) )
+ return true; //yes, we're in a tag
+
+ return false;
+}
+
+QString CToolClass::moduleToolTip(CSwordModuleInfo* module) {
+ Q_ASSERT(module);
+ if (!module) {
+ return QString::null;
+ }
+
+ QString text;
+
+ text = QString("<b>%1</b> ").arg( module->name() )
+ + ((module->category() == CSwordModuleInfo::Cult) ? QString::fromLatin1("<small><b>%1</b></small><br>").arg(QObject::tr("Take care, this work contains cult / questionable material!")) : QString::null);
+
+ text += QString("<small>(") + module->config(CSwordModuleInfo::Description) + QString(")</small><hr>");
+
+ text += QObject::tr("Language") + QString(": %1<br>").arg( module->language()->translatedName() );
+
+ if (module->isEncrypted()) {
+ text += QObject::tr("Unlock key") + QString(": %1<br>")
+ .arg(!module->config(CSwordModuleInfo::CipherKey).isEmpty() ? module->config(CSwordModuleInfo::CipherKey) : QString("<font COLOR=\"red\">%1</font>").arg(QObject::tr("not set")));
+ }
+
+ if (module->hasVersion()) {
+ text += QObject::tr("Version") + QString(": %1<br>").arg( module->config(CSwordModuleInfo::ModuleVersion) );
+ }
+
+ QString options;
+ unsigned int opts;
+ for (opts = CSwordModuleInfo::filterTypesMIN; opts <= CSwordModuleInfo::filterTypesMAX; ++opts) {
+ if (module->has( static_cast<CSwordModuleInfo::FilterTypes>(opts) )) {
+ if (!options.isEmpty()) {
+ options += QString::fromLatin1(", ");
+ }
+
+ options += CSwordBackend::translatedOptionName(
+ static_cast<CSwordModuleInfo::FilterTypes>(opts)
+ );
+ }
+ }
+
+ if (!options.isEmpty()) {
+ text += QObject::tr("Options") + QString::fromLatin1(": <small>") + options + QString("</small>");
+ }
+
+ if (text.right(4) == QString::fromLatin1("<br>")) {
+ text = text.left(text.length()-4);
+ }
+
+ return text;
+}
+
+QString CToolClass::remoteModuleToolTip(CSwordModuleInfo* module, QString localVer) {
+ Q_ASSERT(module);
+ if (!module) {
+ return QString::null;
+ }
+
+ QString text;
+
+ text = QString("<p style='white-space:pre'><b>%1</b> ").arg( module->name() )
+ + ((module->category() == CSwordModuleInfo::Cult) ? QString::fromLatin1("<small><b>%1</b></small><br>").arg(QObject::tr("Take care, this work contains cult / questionable material!")) : QString::null);
+
+ text += QString("<small>(") + module->config(CSwordModuleInfo::Description) + QString(")</small><hr/>");
+
+ if (module->isEncrypted()) {
+ text += QObject::tr("Encrypted - needs unlock key") + QString("<br>");
+ }
+
+ if (!localVer.isEmpty()) {
+ text += QString("<b>") + QObject::tr("Updated version available!") + QString("</b><br>");
+ }
+
+ if (module->hasVersion()) {
+ text += QObject::tr("Version") + QString(": %1").arg( module->config(CSwordModuleInfo::ModuleVersion) );
+ }
+ // if installed already
+ if (!localVer.isEmpty()) {
+ text += QString(" ") + QObject::tr("Installed version") + QString(": %1").arg(localVer);
+ }
+ text += QString("<br>");
+
+ text += QString("<small>(") + QObject::tr("Double click for more information") + QString(")</small></p>");
+
+
+ if (text.right(4) == QString::fromLatin1("<br>")) {
+ text = text.left(text.length()-4);
+ }
+
+ return text;
+}
+
+
+int CToolClass::mWidth(const QWidget* widget, int m)
+{
+ if (widget) {
+ return widget->fontMetrics().width(QString().fill('M', m));
+ }
+ return QApplication::fontMetrics().width(QString().fill('M', m));
+}
diff --git a/src/util/ctoolclass.h b/src/util/ctoolclass.h
new file mode 100644
index 0000000..47ba228
--- /dev/null
+++ b/src/util/ctoolclass.h
@@ -0,0 +1,94 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+#ifndef CTOOLCLASS_H
+#define CTOOLCLASS_H
+
+//Qt
+#include <QString>
+#include <QIcon>
+#include <QTextCodec>
+
+class CSwordModuleInfo;
+class QLabel;
+class QWidget;
+
+/**
+ * Provides some useful functions which would be normally global.
+ *
+ * Some methods,that would be normaly global, but I hate global functions :-)
+ * (the function locateHTML is from Sandy Meier (KDevelop))
+ *
+ * TODO: I think this could be implemented as a namespace:
+ * namespace util { function()...}
+ * And used:
+ * #include "util/util.h"
+ * util::function();
+ * (comment by Eeli)
+ *
+ */
+class CToolClass {
+public:
+ /**
+ * Converts HTML text to plain text.
+ * This function converts some HTML tags in text (e.g. <BR> to \n)
+ * @return The text withput HTML tags and with converted <BR> to \n
+ * @author Joachim Ansorg
+ */
+ static QString htmlToText(const QString&);
+ /**
+ * Converts text to HTML converting some text commands into HTML tags (e.g. \n to <BR>)
+ * @return The HTML formatted text we got after changing \n to <BR>
+ * @author Joachim Ansorg
+ */
+ static QString textToHTML(const QString&);
+ /**
+ * Creates the file filename and put the text of parameter "text" into the file.
+ * @return True if saving was sucessful, otherwise false
+ * @author Joachim Ansorg
+ */
+ static bool savePlainFile( const QString& filename, const QString& text, const bool& forceOverwrite = false, QTextCodec* fileCodec = QTextCodec::codecForLocale());
+ /**
+ * Returns the icon used for the module given as aparameter.
+ */
+ static QIcon getIconForModule( CSwordModuleInfo* );
+ /**
+ * Returns the name for the icon used for the module given as aparameter.
+ */
+ static QString getIconNameForModule( CSwordModuleInfo* );
+
+ /** Returns a label to explain difficult things of dialogs.
+ * This function returns a label with heading "heading" and explanation "text". This label should be used to
+ * explain difficult things of the GUI, e.g. in the optionsdialog.
+ */
+ static QLabel* explanationLabel(QWidget* parent, const QString& heading, const QString& text );
+ /**
+ * Returns true if the character at position "pos" of text is inside an HTML tag. Returns false if it's not inside an HTML tag.
+ */
+ static bool inHTMLTag(int pos, QString & text);
+
+ /** Return the module's tooltip text
+ * @param module The module required for the tooltip
+ * @return The tooltip text for the passed module
+ */
+ static QString moduleToolTip(CSwordModuleInfo* module);
+
+ /** Return the module's tooltip text for a remote module
+ * @param module The module required for the tooltip
+ * @return The tooltip text for the passed module
+ */
+ static QString remoteModuleToolTip(CSwordModuleInfo* module, QString localVer);
+
+ /**
+ * Returns the width in pixels for a string which has mCount 'M' letters, using the specified widget's font.
+ * This can be used when setting the size for a widget. It may be better to roughly calculate the size based on some text width rather than use pixels directly.
+ */
+ static int mWidth(const QWidget* widget, int mCount);
+};
+
+#endif
diff --git a/src/util/dialogutil.cpp b/src/util/dialogutil.cpp
new file mode 100644
index 0000000..e89f881
--- /dev/null
+++ b/src/util/dialogutil.cpp
@@ -0,0 +1,61 @@
+//
+// C++ Interface: dialogutil
+//
+// Description:
+//
+//
+// Author: The BibleTime team <info@bibletime.info>, (C) 2009
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "dialogutil.h"
+#include <QtGui/QDialogButtonBox>
+#include <QtGui/QPushButton>
+
+namespace util
+{
+
+ static void replaceText(QDialogButtonBox* box, QDialogButtonBox::StandardButton flag, const QString& text)
+ {
+ QPushButton* button = box->button(flag);
+ if (button != 0)
+ button->setText(text);
+ }
+
+ void prepareDialogBox(QDialogButtonBox* box)
+ {
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Ok , QPushButton::tr("OK" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Open , QPushButton::tr("Open" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Save , QPushButton::tr("Save" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Cancel , QPushButton::tr("Cancel" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Close , QPushButton::tr("Close" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Discard , QPushButton::tr("Discard" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Apply , QPushButton::tr("Apply" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Reset , QPushButton::tr("Reset" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::RestoreDefaults, QPushButton::tr("Restore defaults", "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Help , QPushButton::tr("Help" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::SaveAll , QPushButton::tr("Save All" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::Yes , QPushButton::tr("Yes" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::YesToAll, QPushButton::tr("Yes to all", "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::No , QPushButton::tr("No" , "Dialog Button"));
+ //: Standard button
+ replaceText(box, QDialogButtonBox::NoToAll , QPushButton::tr("No to all" , "Dialog Button"));
+ }
+
+}
+
diff --git a/src/util/dialogutil.h b/src/util/dialogutil.h
new file mode 100644
index 0000000..e25c931
--- /dev/null
+++ b/src/util/dialogutil.h
@@ -0,0 +1,23 @@
+//
+// C++ Interface: dialogutil
+//
+// Description:
+//
+//
+// Author: The BibleTime team <info@bibletime.info>, (C) 2009
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef UTIL_DIALOG_UTIL_H
+#define UTIL_DIALOG_UTIL_H
+
+class QDialogButtonBox;
+
+namespace util
+{
+ void prepareDialogBox(QDialogButtonBox* box);
+}
+
+#endif
+
diff --git a/src/util/directoryutil.cpp b/src/util/directoryutil.cpp
new file mode 100644
index 0000000..6a1076d
--- /dev/null
+++ b/src/util/directoryutil.cpp
@@ -0,0 +1,368 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#include "directoryutil.h"
+
+//Qt includes
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+#include <QFileInfoList>
+#include <QDebug>
+#include <QCoreApplication>
+#include <QLocale>
+
+namespace util {
+
+namespace filesystem {
+
+void DirectoryUtil::removeRecursive(const QString dir) {
+ //Check for validity of argument
+ if (dir.isEmpty()) return;
+ QDir d(dir);
+ if (!d.exists()) return;
+
+ //remove all files in this dir
+ d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
+ const QFileInfoList fileList = d.entryInfoList();
+ for (QFileInfoList::const_iterator it_file = fileList.begin(); it_file != fileList.end(); it_file++)
+ {
+ d.remove( it_file->fileName() );
+ }
+
+ //remove all subdirs recursively
+ d.setFilter( QDir::Dirs | QDir::NoSymLinks );
+ const QFileInfoList dirList = d.entryInfoList();
+ for (QFileInfoList::const_iterator it_dir = dirList.begin(); it_dir != dirList.end(); it_dir++)
+ {
+ if ( !it_dir->isDir() || it_dir->fileName() == "." || it_dir->fileName() == ".." ) {
+ continue;
+ }
+ removeRecursive( it_dir->absoluteFilePath() );
+ }
+ d.rmdir(dir);
+}
+
+/** Returns the size of the directory including the size of all it's files and it's subdirs.
+ */
+unsigned long DirectoryUtil::getDirSizeRecursive(const QString dir) {
+ //Check for validity of argument
+ QDir d(dir);
+ if (!d.exists()) return 0;
+
+ unsigned long size = 0;
+
+ //First get the size of all files int this folder
+ d.setFilter(QDir::Files);
+ const QFileInfoList infoList = d.entryInfoList();
+ for (QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); it++)
+ {
+ size += it->size();
+ }
+
+ //Then add the sizes of all subdirectories
+ d.setFilter(QDir::Dirs);
+ const QFileInfoList dirInfoList = d.entryInfoList();
+ for (QFileInfoList::const_iterator it_dir = dirInfoList.begin(); it_dir != dirInfoList.end(); it_dir++)
+ {
+ if ( !it_dir->isDir() || it_dir->fileName() == "." || it_dir->fileName() == ".." ) {
+ continue;
+ }
+ size += getDirSizeRecursive( it_dir->absoluteFilePath() );
+ }
+ return size;
+}
+
+/**Recursively copies a directory, overwriting existing files*/
+void DirectoryUtil::copyRecursive(QString src, QString dest){
+ QDir srcDir(src);
+ QDir destDir(dest);
+ //Copy files
+ QStringList files = srcDir.entryList(QDir::Files);
+ for (QStringList::iterator it = files.begin(); it != files.end(); ++it){
+ QFile currFile(src + "/" + *it);
+ QString newFileLoc = dest + "/" + *it;
+ QFile newFile(newFileLoc);
+ newFile.remove();
+ currFile.copy(newFileLoc);
+ }
+ QStringList dirs = srcDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+ for (QStringList::iterator it = dirs.begin(); it != dirs.end(); ++it){
+ QString temp = *it;
+ if (!destDir.cd(*it)){
+ destDir.mkdir(*it);
+ }
+ copyRecursive(src + "/" + *it, dest + "/" + *it);
+ }
+}
+
+static QDir cachedIconDir;
+static QDir cachedJavascriptDir;
+static QDir cachedLicenseDir;
+static QDir cachedPicsDir;
+static QDir cachedLocaleDir;
+static QDir cachedHandbookDir;
+static QDir cachedHowtoDir;
+static QDir cachedDisplayTemplatesDir;
+static QDir cachedUserDisplayTemplatesDir;
+static QDir cachedUserBaseDir;
+static QDir cachedUserHomeDir;
+static QDir cachedUserSessionsDir;
+static QDir cachedUserCacheDir;
+static QDir cachedUserIndexDir;
+
+static bool dirCacheInitialized = false;
+
+void DirectoryUtil::initDirectoryCache(void)
+{
+ QDir wDir( QCoreApplication::applicationDirPath() );
+ wDir.makeAbsolute();
+
+ if (!wDir.cdUp()) //installation prefix
+ {
+ qWarning() << "Cannot cd up from directory " << QCoreApplication::applicationDirPath();
+ throw;
+ }
+
+ cachedIconDir = wDir; //icon dir
+ if (!cachedIconDir.cd("share/bibletime/icons") || !cachedIconDir.isReadable())
+ {
+ qWarning() << "Cannot find icon directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+
+ cachedJavascriptDir = wDir;
+ if (!cachedJavascriptDir.cd("share/bibletime/javascript") || !cachedJavascriptDir.isReadable())
+ {
+ qWarning() << "Cannot find javascript directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+
+ cachedLicenseDir = wDir;
+ if (!cachedLicenseDir.cd("share/bibletime/license") || !cachedLicenseDir.isReadable())
+ {
+ qWarning() << "Cannot find license directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+
+ cachedPicsDir = wDir; //icon dir
+ if (!cachedPicsDir.cd("share/bibletime/pics") || !cachedPicsDir.isReadable())
+ {
+ qWarning() << "Cannot find icon directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+
+ cachedLocaleDir = wDir;
+ if (!cachedLocaleDir.cd("share/bibletime/locale")) {
+ qWarning() << "Cannot find locale directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+
+ QString localeName = QLocale::system().name();
+ QString langCode = localeName.section('_', 0, 0);
+
+ cachedHandbookDir = wDir;
+ if (!cachedHandbookDir.cd(QString("share/bibletime/docs/handbook/") + localeName)) {
+ if (!cachedHandbookDir.cd(QString("share/bibletime/docs/handbook/") + langCode)) {
+ if (!cachedHandbookDir.cd("share/bibletime/docs/handbook/en/")) {
+ qWarning() << "Cannot find handbook directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+ }
+ }
+
+ cachedHowtoDir = wDir;
+ if (!cachedHowtoDir.cd(QString("share/bibletime/docs/howto/") + localeName)) {
+ if (!cachedHowtoDir.cd(QString("share/bibletime/docs/howto/") + langCode)) {
+ if (!cachedHowtoDir.cd("share/bibletime/docs/howto/en/")) {
+ qWarning() << "Cannot find handbook directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+ }
+ }
+
+ cachedDisplayTemplatesDir = wDir; //display templates dir
+ if (!cachedDisplayTemplatesDir.cd("share/bibletime/display-templates/")) {
+ qWarning() << "Cannot find display template directory relative to" << QCoreApplication::applicationDirPath();
+ throw;
+ }
+
+ cachedUserHomeDir = QDir::home();
+
+ cachedUserBaseDir = QDir::home();
+ if (!cachedUserBaseDir.cd(".bibletime")){
+ bool success = cachedUserBaseDir.mkdir(".bibletime") && cachedUserBaseDir.cd(".bibletime");
+ if (!success){
+ qWarning() << "Could not create user setting directory.";
+ throw;
+ }
+ }
+
+ cachedUserSessionsDir = cachedUserBaseDir;
+ if (!cachedUserSessionsDir.cd("sessions")){
+ bool success = cachedUserSessionsDir.mkdir("sessions") && cachedUserSessionsDir.cd("sessions");
+ if (!success){
+ qWarning() << "Could not create user sessions directory.";
+ throw;
+ }
+ }
+
+ cachedUserCacheDir = cachedUserBaseDir;
+ if (!cachedUserCacheDir.cd("cache")){
+ bool success = cachedUserCacheDir.mkdir("cache") && cachedUserCacheDir.cd("cache");
+ if (!success){
+ qWarning() << "Could not create user cache directory.";
+ throw;
+ }
+ }
+
+ cachedUserIndexDir = cachedUserBaseDir;
+ if (!cachedUserIndexDir.cd("indices")){
+ bool success = cachedUserIndexDir.mkdir("indices") && cachedUserIndexDir.cd("indices");
+ if (!success){
+ qWarning() << "Could not create user indices directory.";
+ }
+ }
+
+ cachedUserDisplayTemplatesDir = cachedUserBaseDir;
+ if (!cachedUserDisplayTemplatesDir.cd("display-templates")){
+ bool success = cachedUserDisplayTemplatesDir.mkdir("display-templates") && cachedUserDisplayTemplatesDir.cd("display-templates");
+ if (!success){
+ qWarning() << "Could not create user display templates directory.";
+ }
+ }
+
+ dirCacheInitialized = true;
+}
+
+QDir DirectoryUtil::getIconDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedIconDir;
+}
+
+QDir DirectoryUtil::getJavascriptDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedJavascriptDir;
+}
+
+QDir DirectoryUtil::getLicenseDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedLicenseDir;
+}
+
+QIcon DirectoryUtil::getIcon(const QString& name)
+{
+ static QMap<QString, QIcon> iconCache;
+ //error if trying to use name directly...
+ QString name2(name);
+ QString plainName = name2.remove(".svg", Qt::CaseInsensitive);
+ if (iconCache.contains(plainName)) {
+ return iconCache.value(plainName);
+ }
+
+ QString iconDir = getIconDir().canonicalPath();
+ QString iconFileName = iconDir + "/" + plainName + ".svg";
+ if (QFile(iconFileName).exists())
+ {
+ QIcon ic = QIcon(iconFileName);
+ iconCache.insert(plainName, ic);
+ return ic;
+ }
+ else {
+ iconFileName = iconDir + "/" + plainName + ".png";
+ if (QFile(iconFileName).exists()) {
+ QIcon ic = QIcon(iconFileName);
+ iconCache.insert(plainName, ic);
+ return ic;
+ } else {
+ qWarning() << "Cannot find icon file" << iconFileName << ", using default icon.";
+ iconFileName = iconDir + "/" + "/default.svg";
+ if (QFile(iconFileName).exists()) {
+ return QIcon(iconDir + "/default.svg");
+ } else {
+ return QIcon(iconDir + "default.png");
+ }
+ }
+ }
+}
+
+QDir DirectoryUtil::getPicsDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedPicsDir;
+}
+
+QDir DirectoryUtil::getLocaleDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedLocaleDir;
+}
+
+QDir DirectoryUtil::getHandbookDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedHandbookDir;
+}
+
+QDir DirectoryUtil::getHowtoDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedHowtoDir;
+}
+
+QDir DirectoryUtil::getDisplayTemplatesDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedDisplayTemplatesDir;
+}
+
+QDir DirectoryUtil::getUserBaseDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedUserBaseDir;
+}
+
+QDir DirectoryUtil::getUserHomeDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedUserHomeDir;
+}
+
+QDir DirectoryUtil::getUserSessionsDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedUserSessionsDir;
+}
+
+QDir DirectoryUtil::getUserCacheDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedUserCacheDir;
+}
+
+QDir DirectoryUtil::getUserIndexDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedUserIndexDir;
+}
+
+QDir DirectoryUtil::getUserDisplayTemplatesDir(void)
+{
+ if (!dirCacheInitialized) initDirectoryCache();
+ return cachedUserDisplayTemplatesDir;
+}
+
+
+} //end of namespace util::filesystem
+
+} //end of namespace util
+
diff --git a/src/util/directoryutil.h b/src/util/directoryutil.h
new file mode 100644
index 0000000..be13c79
--- /dev/null
+++ b/src/util/directoryutil.h
@@ -0,0 +1,112 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#ifndef UTIL_FILESDIRECTORYUTIL_H
+#define UTIL_FILESDIRECTORYUTIL_H
+
+#include <QString>
+#include <QDir>
+#include <QIcon>
+
+namespace util {
+
+namespace filesystem {
+
+/**
+ * Tools for working with directories.
+ * @author The BibleTime team <info@bibletime.info>
+*/
+class DirectoryUtil {
+private:
+ DirectoryUtil() {};
+ ~DirectoryUtil() {};
+
+public:
+ /** Removes the given dir with all it's files and subdirs.
+ *
+ * TODO: Check if it's suitable for huge dir trees, as it holds a QDir object
+ * for each of it at the same time in the deepest recursion.
+ * For really deep dir tree this may lead to a stack overflow.
+ */
+ static void removeRecursive(const QString dir);
+
+ /** Returns the size of the directory including the size of all its files
+ * and its subdirs.
+ *
+ * TODO: Check if it's suitable for huge dir trees, as it holds a QDir object
+ * for each of it at the same time in the deepest recursion.
+ * For really deep dir tree this may lead to a stack overflow.
+ *
+ * @return The size of the dir in bytes
+ */
+ static unsigned long getDirSizeRecursive(const QString dir);
+
+ /** Recursively copies one directory into another. This WILL OVERWRITE
+ * any existing files of the same name, and WILL NOT handle symlinks.
+ *
+ * This probably won't need to be used for large directory structures.
+ */
+ static void copyRecursive(const QString src, const QString dest);
+
+ /** Return the path to the icons. */
+ static QDir getIconDir(void);
+
+ /** Return the path to the javascript. */
+ static QDir getJavascriptDir(void);
+
+ /** Return the path to the license. */
+ static QDir getLicenseDir(void);
+
+ /** Returns an icon with the given name */
+ static QIcon getIcon(const QString& name);
+
+ /** Return the path to the pictures. */
+ static QDir getPicsDir(void);
+
+ /** Return the path to the translation files. */
+ static QDir getLocaleDir(void);
+
+ /** Return the path to the handbook files, either of the current locale or en as fallback. */
+ static QDir getHandbookDir(void);
+
+ /** Return the path to the bible study howto files, either of the current locale or en as fallback. */
+ static QDir getHowtoDir(void);
+
+ /** Return the path to the default display template files. */
+ static QDir getDisplayTemplatesDir(void);
+
+ /** Return the path to the user's home directory.*/
+ static QDir getUserHomeDir(void);
+
+ /** Return the path to the user's settings directory.*/
+ static QDir getUserBaseDir(void);
+
+ /** Return the path to the user's sessions directory.*/
+ static QDir getUserSessionsDir(void);
+
+ /** Return the path to the user's cache directory.*/
+ static QDir getUserCacheDir(void);
+
+ /** Return the path to the user's indices directory.*/
+ static QDir getUserIndexDir(void);
+
+ /** Return the path to the user's custom display templates directory.*/
+ static QDir getUserDisplayTemplatesDir(void);
+
+private:
+ /** Will cache a few directories like icon directory */
+ static void initDirectoryCache(void);
+
+};
+
+} //namespace filesystem
+
+} //namespace directoryutil
+
+#endif
diff --git a/src/util/exceptions.h b/src/util/exceptions.h
new file mode 100644
index 0000000..2ba8ff3
--- /dev/null
+++ b/src/util/exceptions.h
@@ -0,0 +1,16 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+#ifndef EXCEPTIONS_H
+#define EXCEPTIONS_H
+
+class BTException {};
+
+class BTCLuceneException: public BTException {};
+
+#endif
diff --git a/src/util/migrationutil.cpp b/src/util/migrationutil.cpp
new file mode 100644
index 0000000..072b750
--- /dev/null
+++ b/src/util/migrationutil.cpp
@@ -0,0 +1,92 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#include "migrationutil.h"
+#include "directoryutil.h"
+#include "backend/config/cbtconfig.h"
+
+#include "swversion.h"
+
+#include <QMessageBox>
+#include <QSettings>
+
+
+using namespace util::filesystem;
+
+namespace util{
+
+void MigrationUtil::checkMigration(){
+ if (CBTConfig::get(CBTConfig::bibletimeVersion) != BT_VERSION)
+ {
+ sword::SWVersion lastVersion(CBTConfig::get(CBTConfig::bibletimeVersion).toUtf8());
+ //lastVersion will be 0.0, if it was an old KDE install,
+ //because the config could not be found yet
+ if (lastVersion < sword::SWVersion("1.7.0") )
+ {
+ tryMigrationFromKDE3(); //
+ }
+ }
+}
+
+//Migration code for KDE 4 port, moves from old config dir to ~/.bibletime/
+void MigrationUtil::tryMigrationFromKDE3(){
+ //List of potential old KDE directories to load data from.
+ QStringList searchDirs;
+ searchDirs << "/.kde" << "/.kde3" << "/.kde3.5";
+ searchDirs << "/.kde3.4" << "/.kde3.3" << "/.kde3.2";
+ searchDirs << "/.kde3.1" << "/.kde3.0";
+
+ foreach (QString searchDir, searchDirs){
+ QString currSearch = QDir::homePath() + searchDir;
+ QDir searchHome(currSearch);
+ QFile oldRc(currSearch + "/share/config/bibletimerc");
+ //Copy our old bibletimerc into the new KDE4 directory.
+ QString newRcLoc = DirectoryUtil::getUserBaseDir().absolutePath() + "/bibletimerc";
+ QFile newRc(newRcLoc);
+
+ //Migrate only if the old config exists and the new doesn't
+ if (oldRc.exists() && !newRc.exists()){
+ QMessageBox msg (QMessageBox::Question, QObject::tr("Settings Migration"),
+ QObject::tr("It appears you have a BibleTime configuration from KDE 3 stored in %1, and you have not migrated it to this version. Would you like to import it?").arg(currSearch), QMessageBox::Yes | QMessageBox::No);
+ int result = msg.exec();
+ if (result != QMessageBox::Yes){
+ break;
+ }
+ oldRc.copy(newRcLoc);
+ QFile oldBookmarks(currSearch + "/share/apps/bibletime/bookmarks.xml");
+ if (oldBookmarks.exists()){
+ QString newBookmarksLoc = DirectoryUtil::getUserBaseDir().absolutePath() + "/" + "bookmarks.xml";
+ QFile newBookmarks(newBookmarksLoc);
+ newBookmarks.remove();
+ oldBookmarks.copy(newBookmarksLoc);
+ }
+ QDir sessionDir(currSearch + "/share/apps/bibletime/sessions");
+ if (sessionDir.exists()){
+ DirectoryUtil::copyRecursive(
+ sessionDir.absolutePath(),
+ DirectoryUtil::getUserSessionsDir().absolutePath());
+ }
+ else{
+ QDir oldSessionDir(currSearch + "/share/apps/bibletime/profiles");
+ if (oldSessionDir.exists()){
+ DirectoryUtil::copyRecursive(
+ oldSessionDir.absolutePath(),
+ DirectoryUtil::getUserSessionsDir().absolutePath());
+ }
+ }
+ //We found at least a config file, so we are done
+ //searching for migration data.
+ break;
+ }
+ }
+ CBTConfig::syncConfig();
+}
+
+}
+
diff --git a/src/util/migrationutil.h b/src/util/migrationutil.h
new file mode 100644
index 0000000..66571ff
--- /dev/null
+++ b/src/util/migrationutil.h
@@ -0,0 +1,39 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#ifndef UTIL_MIGRATIONUTIL_H
+#define UTIL_MIGRATIONUTIL_H
+
+namespace util{
+
+/**
+ * Tools for handling settings migration automatically.
+ * @author The BibleTime team <info@bibletime.info>
+ */
+class MigrationUtil{
+public:
+ /**
+ * Performs any and all applicable migration actions, if neccessary
+ */
+ static void checkMigration();
+private:
+ MigrationUtil() {}; //hide
+ ~MigrationUtil() {}; //hide
+ /*
+ * Performs a migration from a KDE 3 version of BibleTime. It supports all
+ * KDE 3 versions of BibleTime, including versions older than 1.3. Its
+ * only alteration is to move files to the new location, and to rename the
+ * sessions directory from pre-1.3 versions if necessary. It does not
+ * change any settings.
+ */
+ static void tryMigrationFromKDE3();
+};
+
+} //namespace util
+#endif