File: dummyinputmethod.cpp

package info (click to toggle)
maliit-framework 2.3.0-3.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,488 kB
  • sloc: cpp: 13,098; ansic: 2,506; xml: 299; sh: 34; makefile: 23; sed: 4
file content (99 lines) | stat: -rw-r--r-- 2,560 bytes parent folder | download | duplicates (2)
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
90
91
92
93
94
95
96
97
98
99
#include "dummyinputmethod.h"
#include <QDebug>
#include <QTimer>

#include <maliit/plugins/abstractinputmethodhost.h>

DummyInputMethod::DummyInputMethod(MAbstractInputMethodHost *host)
    : MAbstractInputMethod(host),
      setStateCount(0),
      switchContextCallCount(0),
      directionParam(Maliit::SwitchUndefined),
      enableAnimationParam(false),
      pluginsChangedSignalCount(0)
{
    MAbstractInputMethod::MInputMethodSubView sv1;
    sv1.subViewId = "dummyimsv1";
    sv1.subViewTitle = "dummimysv1";
    sViews.append(sv1);

    MAbstractInputMethod::MInputMethodSubView sv2;
    sv2.subViewId = "dummyimsv2";
    sv2.subViewTitle = "dummyimsv2";
    sViews.append(sv2);

    MAbstractInputMethod::MInputMethodSubView sv3;
    sv3.subViewId = "dummyimsv3";
    sv3.subViewTitle = "dummyimsv3";
    sViews.append(sv3);

    activeSView = "dummyimsv1";

    connect(host, SIGNAL(pluginsChanged()),
            this, SLOT(onPluginsChange()));
}

void DummyInputMethod::setState(const QSet<Maliit::HandlerState> &state)
{
    qDebug() << Q_FUNC_INFO << state;
    ++setStateCount;
    setStateParam = state;

    QTimer::singleShot(10000, this, SLOT(switchMe()));
}

void DummyInputMethod::switchMe()
{
    qDebug() << Q_FUNC_INFO;
    inputMethodHost()->switchPlugin(Maliit::SwitchForward);
}

void DummyInputMethod::switchMe(const QString &name)
{
    qDebug() << Q_FUNC_INFO;
    inputMethodHost()->switchPlugin(name);
}

void DummyInputMethod::onPluginsChange()
{
    ++pluginsChangedSignalCount;
}

void DummyInputMethod::switchContext(Maliit::SwitchDirection direction, bool enableAnimation)
{
    ++switchContextCallCount;
    directionParam = direction;
    enableAnimationParam = enableAnimation;
}

QList<MAbstractInputMethod::MInputMethodSubView>
DummyInputMethod::subViews(Maliit::HandlerState state) const
{
    qDebug() << Q_FUNC_INFO;
    QList<MAbstractInputMethod::MInputMethodSubView> svs;
    if (state == Maliit::OnScreen) {
        svs = sViews;
    }
    return svs;
}

void DummyInputMethod::setActiveSubView(const QString &sVId, Maliit::HandlerState state)
{
    qDebug() << Q_FUNC_INFO;
    if (state == Maliit::OnScreen) {
        Q_FOREACH (const MAbstractInputMethod::MInputMethodSubView &sv, sViews) {
            if (sv.subViewId == sVId) {
                activeSView = sVId;
            }
        }
    }
}

QString DummyInputMethod::activeSubView(Maliit::HandlerState state) const
{
    qDebug() << Q_FUNC_INFO;
    if (state == Maliit::OnScreen)
        return activeSView;
    else
        return QString();
}