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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
/* * This file is part of Maliit framework *
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* and appearing in the file LICENSE.LGPL included in the packaging
* of this file.
*/
#ifndef MIMPLUGINMANAGER_H
#define MIMPLUGINMANAGER_H
#include <QObject>
#include <QMap>
#include <QList>
#include <maliit/namespace.h>
#include <maliit/plugins/plugindescription.h>
#include <maliit/plugins/subviewdescription.h>
#include "mattributeextensionid.h"
#include "minputcontextconnection.h"
QT_BEGIN_NAMESPACE
class QRegion;
QT_END_NAMESPACE
class MIMPluginManagerPrivate;
class MAttributeExtensionId;
class MAbstractInputMethod;
class MAttributeExtensionManager;
namespace Maliit {
class AbstractPlatform;
namespace Plugins {
class AbstractPluginSetting;
}
}
using Maliit::Plugins::AbstractPluginSetting;
//! \internal
/*! \ingroup maliitserver
* \brief Manager of MInputMethodPlugin instances.
* \note this class is not considered stable API
*/
class MIMPluginManager: public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.meego.inputmethodpluginmanager1")
public:
/*!
* \Brief Constructs object MIMPluginManager
*/
MIMPluginManager(const QSharedPointer<MInputContextConnection> &icConnection,
const QSharedPointer<Maliit::AbstractPlatform> &platform);
virtual ~MIMPluginManager();
//! Returns names of loaded plugins
QStringList loadedPluginsNames() const;
//! Returns names of loaded plugins which support \a state
QStringList loadedPluginsNames(Maliit::HandlerState state) const;
//! \brief Return information about loaded input method plugins which could work in specified \a state.
QList<MImPluginDescription> pluginDescriptions(Maliit::HandlerState state) const;
//! \brief Return information about previous, current and next subviews.
//!
//! \sa MAbstractInputMethodHost::surroundingSubViewDescriptions()
QList<MImSubViewDescription> surroundingSubViewDescriptions(Maliit::HandlerState state) const;
//! Returns names of activated plugins
QStringList activePluginsNames() const;
//! Returns names of activated plugin for \a state
QString activePluginsName(Maliit::HandlerState state) const;
//! Returns all subviews (IDs and titles) of loaded plugins which support \a state.
QMap<QString, QString> availableSubViews(const QString &plugin,
Maliit::HandlerState state
= Maliit::OnScreen) const;
//! Returns the ID of active subview of the activated plugin for \a state.
QString activeSubView(Maliit::HandlerState state) const;
//! Sets \a pluginName as the activated plugin for \a state.
void setActivePlugin(const QString &pluginName, Maliit::HandlerState state);
//! Sets \a subViewId as the active subview of the activated plugin for \a state.
void setActiveSubView(const QString &subViewId, Maliit::HandlerState state);
//! Switches plugin in according to given \a direction
void switchPlugin(Maliit::SwitchDirection direction, MAbstractInputMethod *initiator);
//! Switches active plugin to inactive plugin with given \a name
void switchPlugin(const QString &name, MAbstractInputMethod *initiator);
//! Enables all installed subviews
void setAllSubViewsEnabled(bool enable);
//! Register a setting entry for the specified plugin
AbstractPluginSetting *registerPluginSetting(const QString &pluginId,
const QString &pluginDescription,
const QString &key,
const QString &description,
Maliit::SettingEntryType type,
const QVariantMap &attributes);
Q_SIGNALS:
//! This signal is emitted when input method plugins are loaded, unloaded,
//! enabled or disabled
void pluginsChanged();
void pluginLoaded();
public Q_SLOTS:
//! Show active plugins.
void showActivePlugins();
//! Hide active plugins.
void hideActivePlugins();
void resetInputMethods();
private Q_SLOTS:
//! Update and activate input source.
void updateInputSource();
//! Set toolbar to active plugin with given \a id
void setToolbar(const MAttributeExtensionId &id);
//! Update the key overrides for active plugin.
void updateKeyOverrides();
void handleAppOrientationChanged(int angle);
void handleAppOrientationAboutToChange(int angle);
void handleAppFocusChanged(WId id);
void handleClientChange();
void handleWidgetStateChanged(unsigned int clientId, const QMap<QString, QVariant> &newState,
const QMap<QString, QVariant> &oldState, bool focusChanged);
void handleMouseClickOnPreedit(const QPoint &pos, const QRect &preeditRect);
void handlePreeditChanged(const QString &text, int cursorPos);
void processKeyEvent(QEvent::Type keyType, Qt::Key keyCode,
Qt::KeyboardModifiers modifiers, const QString &text, bool autoRepeat,
int count, quint32 nativeScanCode, quint32 nativeModifiers, unsigned long time);
void pluginSettingsRequested(int clientId, const QString &descriptionLanguage);
/*!
* \brief Handle global attribute change
* \param id id of the attribute extension that triggered this change
* \param targetItem Item name
* \param attribute Attribute name
* \param value New attribute value
*/
void onGlobalAttributeChanged(const MAttributeExtensionId &id,
const QString &targetItem,
const QString &attribute,
const QVariant &value);
private:
QSet<MAbstractInputMethod *> targets();
protected:
MIMPluginManagerPrivate *const d_ptr;
private:
Q_DISABLE_COPY(MIMPluginManager)
Q_DECLARE_PRIVATE(MIMPluginManager)
Q_PRIVATE_SLOT(d_func(), void _q_syncHandlerMap(int))
Q_PRIVATE_SLOT(d_func(), void _q_setActiveSubView(const QString &, Maliit::HandlerState))
Q_PRIVATE_SLOT(d_func(), void _q_onScreenSubViewChanged())
friend class Ut_MIMPluginManager;
friend class Ut_MIMPluginManagerConfig;
friend class Ft_MIMPluginManager;
friend class Ut_MIMSettingsDialog;
};
#endif
|