We sometimes need to call system settings (Systems settings) to complete some of our settings in the QML application. For example, when we use GPS to locate, maybe the GPS does not open, if in our application directly open the system's GPS Settings page, so we can directly open the system's GPS without having to design a separate page. We can open another app by using the URL dispatcher method. In our previous article, we've covered a lot of things about URL dispatcher:
- How to send text messages and make calls on your Ubuntu phone
- Example of using URL dispatcher
About the System setup (system-settings) of the source code, we can find at the address.
How to view the URL of a system dispatcher typically, we might be wondering if there are URLs dispatcher in the system. We can view the URL of our mobile system by following the name dispatcher:
The above lists the URL dispatcher that we already have in our mobile phone system. For example, we can view the System-settings URL Dispatcher's protocol:
[ { "protocol": "Settings" }]
This way we use the following method in our QML application to launch the page in the system setup:
Qt.openurlexternally ("Settings:///system/about");
The above method can open the "about" page in the system settings.
Based on the above understanding, I have designed the following routines to launch different pages in the system settings:
Import QtQuick 2.0import ubuntu.components 1.1/*! \brief MainView with a Label and Button Elements.*/mainview {//ObjectName for functional testing purposes (autopilot- QT5) ObjectName: "MainView"//note! ApplicationName needs to match the "name" field of the click Manifest ApplicationName: "Urldispatcher.liu-xiao-guo" /* The enables the application to change orientation when the device is rotated. The default is False. *///automaticorientation:true//Removes the old toolbar and enables new features of the new header. Usedeprecatedtoolbar:false Width:units.gu (Height:units.gu) var plugins: ["about", "phone", "ba Ttery "," Bluetooth "," brightness "," cellular "," language "," Background "," Flight-mode "," Notifications "," or Ientation-lock "," Reset "," security-privacy "," Sound "," system-update "," Time-date "," WiFi "] page {title : i18n.tr ("Urldispatcher") flickable {CLip:true width:parent.width height:parent.height contentheight:content.childrenrect.h Eight Column {id:content anchors.centerIn:parent spacing:units . Gu (1) Repeater {model:plugins Delegate:button { Text:modeldata onclicked: {qt.openurlexternally ("Settings:///sys tem/"+ modeldata); } } } } } }}
To run our application:
Application of the source code in: Git clone https://gitcafe.com/ubuntu/urldispatcher.git
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How to set up our system by invoking the page in the system settings in the QML app