Jan Grulich

Gnome integration for Qt based applications in Flatpak

Following blog post from Patrick Griffis about new themes support in Flatpak, we started working on supporting this new feature too. Currently wherever you start a Qt application, it would always look like a KDE application or something would be missing, like icons so you would end up with bad experience and mixed feelings. This is going to change now as we now support Gnome in form of icons, widget style and Qt platform theme and with this, when you run a Qt application in Gnome, it will look definitely better and more natively than before. We packaged regular adwaita icons which are used by default in Gnome as extension of freedesktop runtime. For widget style we use adwaita-qt style, which is a Qt style attempting to look like Gtk’s adwaita and the most important part putting this all together is QGnomePlatform, a Qt platform theme which reads your Gnome configuration and applies it to running Qt applications. QGnomePlatform also enforces Qt apps to use adwaita icons and adwaita-qt style by default so that’s another reason why it is important. Both adwaita-qt and QGnomePlatform projects are by the way authored by Martin Bříza, a collegue of mine from Red Hat so if you meet him in person somewhere buy him a beer for that he cares about Qt integration in Gnome :). Now coming to a question how to install this and make it work. Basically all you need to do is install following extensions and you shold be done:

flatpak install kderuntime org.freedesktop.Platform.Icontheme.Adwaita
flatpak install kderuntime org.kde.KStyle.Adwaita
flatpak install kderuntime org.kde.PlatformTheme.QGnomePlatform

Your Qt apps running in flatpak should then automatically pick up all of these extensions without any further modification, same way it does automatically when you run it outside the sandbox. Simply done!. I’m also aware that there are more Gtk themes, like adwaita-dark or high-contrast, both are also available in form of Qt style and we will probably package them later, but at this point it is mostly proof of concept that this can be done and works nicely. You can follow our wiki page if you want more information about runtimes, repository with applications and so on and from me it’s all for now.

Btw. below you can see okular running in flatpak and using adwaita-qt style with adwaita icons.

Telegram desktop client for flatpak #3

I have been working lately on fixing issues we had with telegram when using Qt’s flatpak platform plugin to have portals support. This was all crashing due to system tray. Qt tries to fallback to xembed when platform theme doesn’t provide any system tray implementation. Unfortunately Qt assumes that we are using xcb platform plugin (used everywhere by default) and tried to call some functions on it, but unfortunately we were using flatpak platform plugin which loads xcb only internally and because of that it was crashing. To solve that I had to implement my own xembed support into our flatpak platform plugin without using xcb specific functions. This was all happening only on Gnome, because in KDE our platform theme has it’s own implementation of system tray using SNI and xembed is not used there at all. With all those fixes I decided to make telegram to finally use flatpak platform plugin by default.

What is also new is that I created one more branch with alpha releases. Right now I have master branch with latest stable telegram in version 1.0.29 and devel branch with latest alpha release 1.0.37 bringing support for calling.

You can get it the same way as before, following instructions from previous blog post, except that now you have to specify branch you want to install.

Discover: Open desktop ratings

As I’m trying to keep improving the flatpak backend in discover I decided to add support for reviews. To do so I implemented support for GNOME’s Open Desktop Ratings which is rating/review system used by gnome-software. Result of this is now fully functional review system, where you can read user comments and ratings and submit your own reviews. We also use same mechanism as in gnome-software for generating user_hash which identifies you in odrs server and given that you are able to modify/delete your reviews from both discover and gnome-software (note that discover doesn’t support this yet). You can also vote for already existing reviews so others get feedback on how useful each review is. We also decided to use same review system in our PackageKit backend and replace current Ubuntu Popularity Contest system so not only flatpak users will benefit from this. During testing of this review support we’ve hit many UI issues related to review system causing users not to be able see reviews or write new ones which were introduced during transition to kirigami. We fixed all of them and you can look forward to improved experience in the upcoming discover release. To improve this further, we or at least I, would like to also add a new widget showing current total app ratings as of now you can only see reviews with comments only, not overall app rating, but this needs some discussion and design consideration.

Here are some screenshots to prove that this is already working:

If you want to test it, which we would like you to do, you can just compile discover from master branch (with -DBUILD_FlatpakBackend=ON cmake parameter for flatpak support). That’s all from me for now. Have a nice weekend :).

KDE Flatpak portals introduction

I guess you all have heard about Flatpak, Snappy and sandboxing in general. Flatpak is a new way of distributing applications. With Flatpak applications are running in sandbox, which means they are isolated from the rest of your system. With that in mind you need a way how to access some stuff outside the sandbox, like your files or have access to your hardware. To solve this problem the Flatpak developers came up with portals. Portals are high-level session bus APIs that provide access to resources to sandboxed applications. Idea is that there is one DBus service available and visible for the sandboxed application which is supposed to communicate with it to get access outside the sandbox. Then this one service communicates with backend implementations which may be different per desktop so you have in example a Gnome implementation or in my case KDE implementation. The backend then provides dialogs so users can access files or hardware outside the sandbox. To add portal support you need to add your backend implementation, which is quite easy part and if you don’t have any then one from other available ones will be used. Complicated part is to alter the framework the application is using to use the portal DBus service instead of doing what it usually do (e.g. when opening a file dialog you want to send a request over DBus instead of actually displaying the dialog). I’ve been playing with this for some time and I tried to cover the most common or required portals. Let’s go through all of this:

File chooser portal

I think this is the most common and needed portal from all of them. I’ve added a backend implementation as well as support for this to Qt in form of my own Qt platform plugin. Given you can modify Qt’s behaviour using your own Qt platform plugin then I didn’t have to modify Qt at all. The platform plugin alters FileDialog to talk around DBus instead of showing the dialog. The dialog is then shown thanks to the backend implementation and user running app in sandbox shouldn’t notice any difference. The file chooser portal supports both opening and saving files with possibilities to set properties like filters, accept label text etc. which are all already implemented in both like in the platform plugin and the backend.

App chooser portal

This portal allows the user to select an application outside the sandbox which should be used for opening a document, a file or whatever. It is also used when opening an url. On the backend side this is just a simple dialog with list of possible applications associated with given file/document type. On Qt side I added my own implementation of OpenUrl() again into the platform plugin to make it transparent the same way the file dialog works.

Print portal

I guess the most complicated and also quite important portal. I’ve been able to add just backend implementation so far which will be used for printing from gtk applications as gtk already supports printing from sandbox. The idea behind this portal is that when app requests to print a document, it calls PreparePrint() method and the backend presents classic print dialog to the user where he can configure printer, setup the page and paper and so on. This configuration is then passed back to the application where the framework is supposed to create a pdf or ps file already pre-formatted and ready for printing. This file is then passed as file descriptor again to the backend using Print() method and printed. This all works with Qt backend and gtk app, or Gnome backend and gtk app, but unfortunately not yet with Qt apps as I still don’t know how to do this without touching Qt code as this cannot be done on platform plugin level, at least from what I can see. A simple solution can be to don’t touch Qt at all and let the app print the document to file and have a simple utility sending this file through the portal to print it. As you can set application name which should be used for printing in QPrinter, then we maybe can just set this automatically when the app is running in sandbox to make this work automatically. I’m definitely open to your ideas or any help :).

Notification portal

Again very useful portal and not that complicated. I have full backend implementation presenting a notification outside the sandbox when someone calls AddNotification() method. To make this work for KDE applications automatically I had to modify KNotifications framework and implement my own flatpak plugin which replaces NotifyByPopup plugin. All this plugin does instead displaying a popup it calls the portal DBus service which then calls AddNotification() in my backend and presents notification outside the sandbox. Both the plugin and backend supports also sending back information about triggered action so you can also get feedback back to the sandboxed application.

Those are all the portals I have fully or partially covered so far. There are of course more portals designed in Flatpak portal API, like screenshot portal, inhibit portal, but for some of them we don’t have any framework/API or they are not that important so they will be added later. I also have a test application which you can run in sandbox and test all the portals.

How to use flatpak portals

In order to use flatpak portals, either my implementation or the Gnome one, you need to install xdg-desktop-portal which is the main portal DBus service visible to sandboxed applications and which calls backend implementation. For gtk implementation you need xdg-desktop-portal-gtk and for KDE/Qt implementation you need xdg-desktop-portal-kde. This is required to be installed outside the sandbox to present dialogs for file and hardware access. To add support for portals to your sandboxed application you should be fine already with gtk, with Qt and KDE you need my Qt platform plugin and my modifications made to KNotifications. To use those you need to modify flatpak manifest to include them during build so they are available in the sandbox. You can get inspiration in my test app manifest. And finally to use my platform plugin as KNotifications will be used automatically you need to start your app using flatpak run your_app -platform flatpak.

I guess that’s all from me today. Patches and improvements are warmly welcomed as well as any reported issue. If you want some information about Flatpak and KDE in general, we have setup a wiki page where you can find information about KDE runtimes and applications packaged for Flatpak. There will be also a talk at FOSDEM this year about Flatpak and KDE from Aleix Pol.

Introducing new KCM for network configuration

After several attempts trying to write a new KCM for network configuration and actually not finishing any of them, I decided to start one more time, but this time my goal was to simply transform the old editor into a bit nicer KCM and place it into system settings where this was missing for very long time. You can see my current result below.

kcm

kcm1

kcm2

This is still same editor as it was existing before as a standalone application, except the list of connections is now written in QML and is similar to the applet we have in systray. I also had to rewrite the editor widget a bit because it’s currently implemented as a dialog with a tabwidget inside where each tab is represented by one setting widget (e.g. Ipv4SettingWidget), For the new KCM we now have ConnectionEditorBase widget doing all the logic behind, like creating specific setting widgets based on connection type and so on. This widget alone doesn’t display anything and you have to actually subclass it and reimplement method taking care of layouting. This allows me to have e.g. ConnectionEditorTabWidget which just subclasses ConnectionEditorBase and reimplements addWidget() method to place setting widgets into QTabWidget. In future we can also simply write a new UI/layout on top ConnectionEditorBase widget and get rid of the tab layout.

Regarding functionality, it should be already almost on par with functionality of the editor. There are still some missing features (like import/export of VPN), but besides that I think everything else is going well. With the new KCM there are also some minor improvements, like you can now reset your not-saved changes you made to a connection. My plan is to get this into Plasma 5.9 which is supposed to be released in january so I still have plenty of time to finish missing features and address issues I made during this transition and of course time to take your comments into account and make this KCM as most usable for everyone I can :).

Upcoming news in Plasma 5.5

It’s been a while since Plasma 5.4 release and we are now approaching feature freeze for Plasma 5.5 so I would like to share with you what news you can expect in plasma-nm. This time we have major changes only in our connection editor although most of you wouldn’t probably even notice them. This is going to be a short list unfortunately given I have less time and less ideas, but at least something, right?

So, what is new?

WPA/WPA2 Enterprise validation
WPA/WPA2 Enterprise validation was the only one missing validation in our connection editor and without it we let you to save your WPA/WPA2 Enteprise configuration even when it was wrong or some option was missing. Now you should be able to save your configuration only when it’s valid for NetworkManager. In addition to check for missing properties, we check (in case of TLS authentication) whether provided private key can be decrypted with given private key password (works only for pkcs12 and PEM formats).

New password field widget
Option to show/hide the password and option to not store the password were removed as standalone widgets and they are now part of the password field. I did this to make the UI less complicated and also because I like it, however this introduced some accessibility issues which need to be addressed somehow once I have time to do that (mentioned this here as a commitment that I’ll really do something about that).
plasma-nm-password-widget

Other changes

  • OpenVPN improvements (better properties descriptions, new options)
  • added tooltips to most common options
  • some bugfixes and other minor improvements which are not worth mentioning

Akademy 2015

Akademy is the annual world summit of KDE which was held this year in A Coruña. I was there since July 22 until last Friday July 31 and even these ~10 days were not enough :). The official start was on Friday July 24 with a pre-registration party, where all Akademy attendees could pickup their badges, have some food and mainly drink with people they haven’t seen for a long time or at all. This year organizers also managed to prepare a show for us in form of preparation of Queimada, which is a traditional Galician punch.20150724_223526

20150724_202109

 

 

 

 

 

 

 

 

The next two days were dedicated to talks and started with a keynote presented by Matthias Kirschner. I tried to attend those which were interesting for me and I would say that the most interesting talk was presented by Sebastian Kügler, where he introduced a new mobile platform called Plasma Mobile. This is going to be interesting given the Android and iOS domination, but there is definitely some potential.20150725_100727

 

I also have to mention the talk about sandboxed applications presented by my RedHat colleague Daniel Vrátil. Dan explained what is a sandbox, how it works and what are the benefits of using sandboxes.20150726_170703

 

The end of the weekend was, as usual, dedicated to sponsor presentations and Akademy awards. This year the awards were given to the awesome VDG group because without them the Plasma 5 wouldn’t look so great, to Albert Vaca, who is the main KDE connect developer and to Millian Wolff for his work on KDevelop. The last awards were given Scarlett Clark for her work on CI and to Akademy organizers.

Monday started series of BoFs. On Monday I attended only BoF organized by VDG to discuss the UI of the new traffic monitor feature in plasma-nm, which will be in Plasma 5.4.plotter

 

On Tuesday we had Solid BoF for all developers working on hardware support for KDE. Unfortunately only few people showed up and nobody came to complain. This could be because people don’t know what Solid is or, in better case, everything works as it should. We discussed the current state of various Solid projects and mostly went through plasma-nm issues and missing features and Lamarque also decided to pass on his network management maintainership to me :).

In the evening the same day we had a party. The party was on the terrace of one shopping centre near the venue and was perfect until it started to rain. Then we had to move to a smaller place which was not suitable for so many people, but we enjoyed it despite those minor problems. We were eating delicious food, drinking good wine and dancing at the end so the party couldn’t be better :).20150728_212204_HDR

 

On Wednesday we had a day trip. Originally we were supposed to have lunch at the Hercules tower and then go to the beach, but the weather forecast was not optimistic so the day trip was changed to go to the Aquarium first and then visit the Hercules tower. 20150729_181432

20150729_181325

20150729_18435320150729_193019_HDR

 

 

 

 

 

 

 

 

During Thursday and Friday people are leaving so the attendance of BoFs is not that high as in previous days. I went only to KDE connect BoF just to see what’s going on with this interesting project.

And that’s probably all. This year’s Akademy was perfect and I’m really glad I could be there. The city was nice, the weather was almost perfect, people were friendly and organizers did really good job this year. Thank you all and see you next year!!

 

Plasma-nm 0.9.3.6 release

We have released another plasma-nm version for KDE 4. It’s possible that this release will be the last one, because every distribution is now switching to Plasma 5 and given our irregular releases it’s possible that current distributions wouldn’t pickup the updated version anyway. I’ll keep backporting fixes from Plasma 5 to our KDE 4 branch if possible, so if you want to keep running on KDE 4 from some reason, you will still have a way how to get at least some fixes. There is also a new release of networkmanager-qt for KDE 4, which is required for below mentioned OpenConnect fixes.

Fixed issues in this release:
* bz#341221applet: connection which is being activated is moved to the top
* bz#343606editor: enable/disable actions when a connection state changes
* bz#340703editor: added connect/disconnect actions to the menu and toolbar
* bz#341629editor-ethernet: auto-negotiate state is now properly restored
* bz#341069editor-OpenVPN: added option for server certificate verification
* bz#341397editor-pptp: fixed storing of non-latin characters
* bz#340801editor-vpn: fixed vpn import – IPv4 -> routes -> “Use only for resources on this connection” is not checked all the time
* bz#340717editor-wifi: added frequency and channel to the BSSID dropdown list
* bz#339296OpenConnect: fixed autoconnecting
* bz#309931/bz#334474OpenConnect: fixed storing of secrets
* bz#334901/bz#344411secret agent: displayed proper connection name in password dialog
* bz#342697wifi: fixed displaying of non-ASCII SSIDs

+ many other not mentioned issues

New tarballs can be downloaded here:
http://download.kde.org/stable/plasma-nm/plasma-nm-0.9.3.6.tar.xz.mirrorlist
http://download.kde.org/unstable/networkmanager-qt/0.9.8.4/src/networkmanager-qt-0.9.8.4.tar.xz.mirrorlist

2+ years with network management in KDE

It has been more than 2 years when I was an intern in Red Hat and Lukáš Tinkl, my leader that time, told me that I should take a look what needs to be done around network management in KDE. I started with contribution to libnm-qt (networkmanager-qt now), because there was a plan to have a separated library for NetworkManager and port the applet to use it later. It took me a few months to get familiar with NetworkManager DBus API and implement all missing stuff and I was ready to start porting the applet. Problem was that the old NM applet was not ready at all, its architecture had been done with more network daemons in mind (like wicd) and the code base became really complicated. I still remember that discussion we had about starting from scratch, it was quite tough decision, because we had to drop such huge code base and years of work. Anyway, we decided to go for it and start from scratch and one of the best journeys of my life had begun. It went quite good, we were able to reuse some existing parts from the old applet and we had first release like half year later. Well, quality of first releases is questionable, not everyone liked them we did, but we have learned from mistakes and now I daresay that the version we have after 2 years currently in Plasma 5 is really great and we enjoyed doing it.

But the real reason why I decided to write this blog post is that I wanted to look to some statistics using gitstats after those 2 years of development and share them with you.

Stats about networkmanager-qt

Total files: 363
Total lines: 41876
More stats here.

Table of top contributors since the beginning.
nm-qt-authors

Stats about libmm-qt

Total files: 120
Total lines: 14695
More stats here.

Table of top contributors since the beginning.
mm-qt-authors

Stats about plasma-nm

Total files: 288
Total lines: 40507
More stats here.

Table of top contributors since the beginning.
plasma-nm-authors

NOTE that those statistics do not include contributions to the old NM applet, which some parts are used in both libraries and even in the new NM applet.

Plasma-nm 0.9.3.5 release

I just want to inform you (those who are still running KDE 4) that we released a new version of your favorite network applet. This new release brings to you many bug fixes and should make your life easier. We really recommend to update to the new version as we, not intentionally, introduced some new issues in the previous version. Together with the new release of plasma-nm we also released our libnm-qt library which is also needed if you want to have fixes from plasma-nm properly working.

Summary of fixed issues:
bz#339652 – added missing IPv6 support for OpenVPN connections
bz#333752 – we moved code for checking your current download/upload to QML code and now it just checking for updates only when the applet is opened
bz#329837 – during import of VPN connections we copied your certificates automatically into your home directory, now we are asking whether you want to copy them or keep the path as it is
bz#340306 – fixed initialization of current download/upload speed for mobile broadband connections
bz#338513, bz#338697, bz#339223 – many fixes in secret agent (KWallet) initialization, also added migration for your secrets from plain text files, we dropped their support in the previous version, and store them into KWallet or directly into NetworkManager (if KWallet is not enabled)

You can find new tarballs in usual location, which is [1] for plasma-nm and [2] for libnm-qt.

[1] – http://download.kde.org/stable/plasma-nm/plasma-nm-0.9.3.5.tar.xz.mirrorlist
[2] – http://download.kde.org/unstable/networkmanager-qt/0.9.8.3/src/libnm-qt-0.9.8.3.tar.xz.mirrorlist

Scroll To Top