summaryrefslogtreecommitdiff
path: root/src/bibletime_dbus_adaptor.cpp
blob: 6912ff1e3323b0faff0cba45872f999aeae59dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2011 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#ifndef NO_DBUS

#include "bibletime_dbus_adaptor.h"

#include <QDebug>
#include "backend/config/cbtconfig.h"

BibleTimeDBusAdaptor::BibleTimeDBusAdaptor(BibleTime *pBibleTime)
    : QDBusAbstractAdaptor(pBibleTime)
    , m_bibletime(pBibleTime)
{
    // Intentionally empty
}

void BibleTimeDBusAdaptor::syncAllBibles(const QString &key) {
    qDebug() << "DBUS: syncing all bibles ...";
    m_bibletime->syncAllModulesByType(CSwordModuleInfo::Bible, key);
}

void BibleTimeDBusAdaptor::syncAllCommentaries(const QString &key) {
    qDebug() << "DBUS: syncing all commentaries ...";
    m_bibletime->syncAllModulesByType(CSwordModuleInfo::Commentary, key);
}
void BibleTimeDBusAdaptor::syncAllLexicons(const QString &key) {
    qDebug() << "DBUS: syncing all lexicons ...";
    m_bibletime->syncAllModulesByType(CSwordModuleInfo::Lexicon, key);
}

void BibleTimeDBusAdaptor::syncAllVerseBasedModules(const QString &key) {
    qDebug() << "DBUS: syncing all verse based modules ...";
    m_bibletime->syncAllModulesByType(CSwordModuleInfo::Bible, key);
    m_bibletime->syncAllModulesByType(CSwordModuleInfo::Commentary, key);
}

void BibleTimeDBusAdaptor::openWindow(const QString &moduleName, const QString &key) {
    qDebug() << "DBUS: open window for module" << moduleName.toLatin1() << "and key" << key.toLatin1() << " ...";
    CSwordModuleInfo *module = CSwordBackend::instance()->findModuleByName(moduleName);
    if (module)
        m_bibletime->createReadDisplayWindow(module, key);
}

void BibleTimeDBusAdaptor::openDefaultBible(const QString &key) {
    qDebug() << "DBUS: open default bible ...";
    CSwordModuleInfo *module = CBTConfig::get(CBTConfig::standardBible);
    if (module)
        m_bibletime->createReadDisplayWindow(module, key);
}

void BibleTimeDBusAdaptor::closeAllModuleWindows() {
    qDebug() << "DBUS: close all windows now ...";
    m_bibletime->closeAllModuleWindows();
}

QString BibleTimeDBusAdaptor::getCurrentReference() {
    qDebug() << "DBUS: getCurrentReference ...";
    return m_bibletime->getCurrentReference();
}

QStringList BibleTimeDBusAdaptor::searchInModule(const QString &moduleName, const QString &searchText) {
    qDebug() << "DBUS: searchInModule" << moduleName.toLatin1() << " ...";
    return m_bibletime->searchInModule(moduleName, searchText);
}

QStringList BibleTimeDBusAdaptor::searchInOpenModules(const QString &searchText) {
    qDebug() << "DBUS: search in open modules ...";
    return m_bibletime->searchInOpenModules(searchText);
}

QStringList BibleTimeDBusAdaptor::searchInDefaultBible(const QString &searchText) {
    qDebug() << "DBUS: search in default bible ...";
    CSwordModuleInfo *bible = CBTConfig::get(CBTConfig::standardBible);
    return m_bibletime->searchInModule(bible->name(), searchText);
}

QStringList BibleTimeDBusAdaptor::getModulesOfType(const QString &type) {
    qDebug() << "DBUS: get modules of type ...";
    return m_bibletime->getModulesOfType(type);
}

#endif //NO_DBUS