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

« back to all changes in this revision

Viewing changes to src/quick/inputmethodquickplugin.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 "inputmethodquickplugin.h"
 
16
#include "inputmethodquick.h"
 
17
#include "maliitquick.h"
 
18
#include "keyoverridequick.h"
 
19
#include "abstractplatform.h"
 
20
 
 
21
#include <QFileInfo>
 
22
#include <QQmlComponent>
 
23
 
 
24
namespace Maliit
 
25
{
 
26
 
 
27
class InputMethodQuickPluginPrivate
 
28
{
 
29
public:
 
30
    QSharedPointer<Maliit::AbstractPlatform> m_platform;
 
31
    const QString m_filename;
 
32
    const QString m_basename;
 
33
    QSet<Maliit::HandlerState> m_supported_states;
 
34
 
 
35
    InputMethodQuickPluginPrivate(const QString &filename,
 
36
                                  const QSharedPointer<Maliit::AbstractPlatform> &platform)
 
37
        : m_platform (platform),
 
38
          m_filename(filename),
 
39
          m_basename(QFileInfo(filename).baseName()),
 
40
          m_supported_states()
 
41
    {
 
42
        m_supported_states << Maliit::OnScreen << Maliit::Hardware;
 
43
    }
 
44
};
 
45
 
 
46
InputMethodQuickPlugin::InputMethodQuickPlugin(const QString &filename,
 
47
                                               const QSharedPointer<Maliit::AbstractPlatform> &platform)
 
48
    : d_ptr(new InputMethodQuickPluginPrivate(filename, platform))
 
49
{
 
50
    qmlRegisterUncreatableType<MaliitQuick>("com.meego.maliitquick", 1, 0, "Maliit",
 
51
                                            "This is the class used to export Maliit Enums");
 
52
 
 
53
    // this do not have to be included to use it, but it have to be
 
54
    // registered.
 
55
    qmlRegisterUncreatableType<KeyOverrideQuick>
 
56
        ( "com.meego.maliitquick.keyoverridequick", 1, 0, "KeyOverrideQuick",
 
57
          "This registers KeyOverrideQuick" );
 
58
}
 
59
 
 
60
InputMethodQuickPlugin::~InputMethodQuickPlugin()
 
61
{}
 
62
 
 
63
MAbstractInputMethod *InputMethodQuickPlugin::createInputMethod(MAbstractInputMethodHost *host)
 
64
{
 
65
    Q_D(InputMethodQuickPlugin);
 
66
 
 
67
    return new InputMethodQuick(host, d->m_filename, d->m_platform);
 
68
}
 
69
 
 
70
QSet<Maliit::HandlerState> InputMethodQuickPlugin::supportedStates() const
 
71
{
 
72
    Q_D(const InputMethodQuickPlugin);
 
73
 
 
74
    return d->m_supported_states;
 
75
}
 
76
 
 
77
QString InputMethodQuickPlugin::name() const
 
78
{
 
79
    Q_D(const InputMethodQuickPlugin);
 
80
 
 
81
    return d->m_basename;
 
82
}
 
83
 
 
84
} // namespace Maliit