~timo-jyrinki/ubuntu/trusty/maliit-framework/fix_qt52

« back to all changes in this revision

Viewing changes to maliit-plugins-quick/input-method/minputmethodquickplugin.cpp

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo, Sergio Schvezov, Ricardo Salveti de Araujo
  • Date: 2013-07-23 19:47:04 UTC
  • mfrom: (1.1.2) (1.2.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130723194704-1lsy1kmlda069cea
Tags: 0.99.0+git20130615+97e8335-0ubuntu1
[ Sergio Schvezov ]
* New build from HEAD 97e8335.
* Packaging import from lp:phablet-extras/maliit-framework.

[ Ricardo Salveti de Araujo ]
* debian/control: adding vcs and fixing dependencies
* General package cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* * This file is part of Maliit framework *
2
 
 *
3
 
 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4
 
 * All rights reserved.
5
 
 *
6
 
 * Contact: maliit-discuss@lists.maliit.org
7
 
 *
8
 
 * This library is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU Lesser General Public
10
 
 * License version 2.1 as published by the Free Software Foundation
11
 
 * and appearing in the file LICENSE.LGPL included in the packaging
12
 
 * of this file.
13
 
 */
14
 
 
15
 
#include "minputmethodquickplugin.h"
16
 
#include "minputmethodquick.h"
17
 
#include "maliitquick.h"
18
 
#include "mkeyoverridequick.h"
19
 
 
20
 
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
21
 
#include <QQmlComponent>
22
 
#else
23
 
#include <QDeclarativeComponent> // needed for qmlRegisterUncreatableType
24
 
#endif
25
 
 
26
 
namespace {
27
 
QStringList gQmlImportPaths;
28
 
}
29
 
 
30
 
class MInputMethodQuickPluginPrivate
31
 
{
32
 
public:
33
 
    QSet<Maliit::HandlerState> supportedStates;
34
 
 
35
 
    MInputMethodQuickPluginPrivate()
36
 
    {
37
 
        supportedStates << Maliit::OnScreen << Maliit::Hardware;
38
 
    }
39
 
};
40
 
 
41
 
MInputMethodQuickPlugin::MInputMethodQuickPlugin()
42
 
    : d_ptr(new MInputMethodQuickPluginPrivate)
43
 
{
44
 
    qmlRegisterUncreatableType<MInputMethodQuick>
45
 
        ( "com.meego.keyboard-quick", 1, 0, "MInputMethodQuick",
46
 
          "There's only one controller and it is in the C++ side" );
47
 
    qmlRegisterUncreatableType<MaliitQuick>
48
 
        ( "com.meego.maliitquick", 1, 0, "Maliit",
49
 
          "This is the class used to export Maliit Enums" );
50
 
    // this do not have to be included to use it, but it have to be
51
 
    // registered.
52
 
    qmlRegisterUncreatableType<MKeyOverrideQuick>
53
 
        ( "com.meego.maliitquick.keyoverridequick", 1, 0, "KeyOverrideQuick",
54
 
          "This registers MKeyOverrideQuick" );
55
 
}
56
 
 
57
 
MInputMethodQuickPlugin::~MInputMethodQuickPlugin()
58
 
{
59
 
    delete d_ptr;
60
 
}
61
 
 
62
 
void MInputMethodQuickPlugin::setQmlImportPaths(const QStringList &paths)
63
 
{
64
 
    gQmlImportPaths = paths;
65
 
}
66
 
 
67
 
QStringList MInputMethodQuickPlugin::qmlImportPaths()
68
 
{
69
 
    return gQmlImportPaths;
70
 
}
71
 
 
72
 
MAbstractInputMethod *MInputMethodQuickPlugin::createInputMethod(MAbstractInputMethodHost *host)
73
 
{
74
 
    return new MInputMethodQuick(host, qmlFileName());
75
 
}
76
 
 
77
 
QSet<Maliit::HandlerState> MInputMethodQuickPlugin::supportedStates() const
78
 
{
79
 
    Q_D(const MInputMethodQuickPlugin);
80
 
 
81
 
    return d->supportedStates;
82
 
}