We have moved to a new Sailfish OS Forum. Please start new discussions there.
4

Disable auto-capitalization for one layout

asked 2015-05-02 18:30:37 +0200

AliN gravatar image

As I know, it is possible to disable auto-capitalization by modifying /usr/share/maliit/plugins/com/jolla/KeyboardBase.qml which will affect all keyboards. I wish to know if there’s a way to disable autocaps only for one layout? Some layouts such as Arabic, Persian, and Urdu doesn’s need autocaps at all and disabling autocaps make it easy to use shifted state for their additional characters.

Or how to import a modified KeyboardBase.qml file in layout QML file? import "../filename" didn’t work for me.

edit retag flag offensive close delete

Comments

1

Your question is a virtual duplicate of https://together.jolla.com/question/75158/option-to-disable-auto-capitalization-missing-from-input-settings/

Please consider closing your question and adding your comments and vote at the link above.

Regards,

Spam Hunter ( 2015-05-02 20:10:16 +0200 )edit
1

@Markkyboy, I'm asking from a developer viewpoint. I’ve made layouts for those non-Latin languages and want to disable autocaps for these languages only (without affecting Latin-based languages). This is different from the option where the end-user can disable autocaps (for all layouts).

AliN ( 2015-05-03 00:40:22 +0200 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2015-12-03 06:41:05 +0200

AliN gravatar image

updated 2015-12-04 02:47:53 +0200

Ha ha, it's easier than any body could imagine!

On /usr/share/maliit/plugins/com/jolla/KeyboardBase.qml there's a function to apply autocaps such this:

function applyAutocaps() {
    if (MInputMethodQuick.surroundingTextValid
            && MInputMethodQuick.contentType === Maliit.FreeTextContentType
            && MInputMethodQuick.autoCapitalizationEnabled
            && !MInputMethodQuick.hiddenText
            && layout && layout.type === "") {
        var position = MInputMethodQuick.cursorPosition
        var text = MInputMethodQuick.surroundingText.substring(0, position)

        if (position == 0
                || (position == 1 && text[0] === " ")
                || (position >= 2 && text[position - 1] === " "
                    && ".?!".indexOf(text[position - 2]) >= 0)) {
            autocaps = true
        } else {
            autocaps = false
        }
    } else {
        autocaps = false
    }
}

It's enough to make a condition false; for example, to add a line in layout CONF file for non-latin languages:

type="CTL"

Autocaps will be disabled only for that specific layout. :)

Edit: It is also possible to add the line to layout QML file, just below the splitSupported. Other options such as capsLockSupported are allowed.

edit flag offensive delete publish link more

Comments

@AliNa * humbly asking * could you make a patch that does this? :) *edit: for all languages..... please

misc11 ( 2015-12-04 15:04:42 +0200 )edit

@misc11, good idea. :D Let me see.

AliN ( 2015-12-04 15:16:26 +0200 )edit

@AliNa WOW! that was fast!! thanks a lot!

misc11 ( 2015-12-04 17:29:14 +0200 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2015-05-02 18:30:37 +0200

Seen: 380 times

Last updated: Dec 04 '15