I Use This!
Activity Not Available

News

Analyzed 3 months ago. based on code collected 8 months ago.
Posted about 2 years ago by Nate Graham
While we work on Plasma 5.24 bugs (and you can see many of them fixed below), we’ve also started to work on many improvements for Plasma 5.25 and KDE apps! Check it out: 15-Minute Bugs Resolved Current number of bugs: 82, down from 83. Current list ... [More] of bugs You can once again launch apps from the Application Launcher’s “History” and “Frequently Used” pages (Oleg Solovyov, Plasma 5.24.1) In the Plasma Wayland session, moving a window to another virtual desktop or activity using a keyboard shortcut or the relevant Pager applet no longer leaves a semi-transparent non-interactive ghost version of it visible in its former location (Vlad Zahorodnii, Plasma 5.24.1) Setting a battery charge limit on your laptop no longer causes the System Tray Battery and Brightness icon to stay visible once the battery is considered by the kernel to be fully charged (me: Nate Graham, Plasma 5.24.1) New Features Kate now has an interactive path-based navigation bar that shows you the folder hierarchy of the currently open document and allows you to switch it out for another one (Waqar Ahmed, Kate 22.04): Color schemes can now be optionally configured to apply your accent color to window titlebars or even the entire header area, and the “Breeze Classic” color scheme now uses this feature (Dominic Hayes, Plasma 5.25): Note that this giant blue header appearance in Breeze Light is non-default; you would have to enable the new “Apply accent color to titlebar” option for Breeze Light for make it use the accent color like this. But it does show what’s possible! Bugfixes & Performance Improvements Dolphin’s view no longer exhibits visual bugs when zooming in and out (Eugene Popov, Dolphin 22.04) The “Keep these changes?” dialog in System Settings’ Display Configuration page is once again displayed properly, so you can actually change your display settings again (Xuetian Weng, Plasma 5.24.1) System Settings no longer crashes when you press the Escape key on System Settings’ Display Configuration page (Nicolas Fella, Plasma 5.24.1) In the Plasma Wayland session, KWin no longer sometimes crashes when you drag something from Firefox running in XWayland mode to the desktop (David Redondo, Plasma 5.24.1) In the Plasma Wayland session, tapping an input field with a stylus once again causes the virtual keyboard to appear as expected (Aleix Pol Gonzalez, Plasma 5.24.1) Right-clicking on legacy app-specific System Tray icons to show a context menu once again works if you happen to not have the libappindicator library installed (Claudio Holo, Plasma 5.24.1) In the Plasma Wayland session, the Task Manager now correctly shows which apps are running on certain systems (e.g. Gentoo systems) where it was broken before (John Zimmerman, Plasma 5.24.1) Apps that inappropriately set QT_QPA_PLATFORM=wayland internally can now be successfully launched from the Overview effect (Nicolas Fella, Plasma 5.24.1) In the Plasma Wayland session, when a native Wayland app is launches with its window maximized, its titlebar “Maximize/Restore” button now visually shows the correct state (Vlad Zahorodnii, Plasma 5.24.1) In the Plasma X11 session, toggling a window’s the “Show Borders” functionality no longer makes it smaller (Vlad Zahorodnii, Plasma 5.24.1) Plasma now lets you set a maximum charge level for hardware that supports setting a maximum charge level but not a minimum charge level before starting to charge (Méven Car, Plasma 5.24.1) KRunner’s Web Shortcuts and Browser Favorites runners now work in the Overview effect (Nicolas Fella, Plasma 5.24.1) Title/Header text in menus no longer gets cut off in cases where it would be longer than the text of any of the other menu items (Albert Astals Cid, Plasma 5.24.2) In the Plasma Wayland session, fixed one of the ways that the virtual keyboard could fail to appear as expected despite being set up correctly (Aleix Pol Gonzalez, Plasma 5.24.2) In the Plasma X11 session, when you set the Overview effect to appear when you press the Meta key, it can no longer inappropriately be triggered from the Lock screen (David Edmundson, Plasma 5.24.2) Plasma no longer sometimes crashes when you copy certain text to the clipboard (David Edmundson, Frameworks 5.92) Installing OBS Studio from Spectacle’s “install a screen recorder” feature now works (Aleix Pol Gonzalez, Frameworks 5.92) Kirigami apps that use side drawers no longer eat mouse events on the sides of the window, which means that in particular, their right-most scrollbars now work properly (Tranter Madi, Frameworks 5.92) Fixed a memory leak in KDE apps that use the Solid framework (Méven Car, Frameworks 5.92) User Interface Improvements Gwenview once again has a “Fit” button on its status bar (Felix Ernst, Gwenview 22.04): The notifications that Ark sends when a compress job is finished are now fancier and more useful (Nicolas Fella, Ark 22.04): Spectacle’s dark overlay in Rectangular Region mode is now darker (me: Nate Graham, Spectacle 22.04): The Show Desktop applet now has an indicator line that appears when the desktop is being shown just like the Minimize All applet has, and the Minimize All applet’s line now touches the panel edge irrespective of its internal margins (me: Nate Graham, Plasma 5.24.2) Card/tile views in Breeze-themes GTK apps now look much better (Jan Blackquill, Plasma 5.25) Audio volume loudness/recording level indicators now look much better (Light Yagami, Plasma 5.25): System Settings’ Firewall page now uses a simplified rule entry UI by default so you don’t need to know port numbers and all that mumbo-jumbo–but if you want to, you can show all the fiddly advanced controls (Lucas Biaggi and me: Nate Graham, Plasma 5.25) Yes, I know this is an explicit “basic/advanced” view that would seem to violate https://community.kde.org/Get_Involved/Design/Lessons_Learned#Basic.2Fadvanced_modes. Well, every rule has an exception! Breeze-themed menus in Qt and GTK apps now have a little outer margin, which is not only pretty, but it also solves an ancient usability bug with the top item being too easy to accidentally activate (Jan Blackquill, Plasma 5.25): Breeze-themed menus in Qt apps that are taller than the screen height (OMG) now scroll vertically instead of expanding horizontally into more columns (Jan Blackquill, Plasma 5.25). This Bugzilla ticket was old enough to drink alcohol in many countries! You can now tap-and-hold on Task Manager tasks to show a context menu, making their menus accessible on a touchscreen (me: Nate Graham, Plasma 5.25): And the menu items also become tall so you can easily touch them! The notification shown when you try to use a VPN whose supporting software hasn’t been installed is now more helpful and comprehensible and sticks around until you explicitly dismiss it (Nicolas Fella, Plasma 5.25) To improve the discoverability of KCommandBar, every KDE app’s “Help” menu now has a “Find Action” item that will activate it when clicked (Waqar Ahmed, Frameworks 5.92): Clicking on the “Custom” accent color option to show a color picker dialog now opens the dialog showing the current accent color, if one was already set (Yari Polla, Plasma 5.25) …And everything else This blog only covers the tip of the iceberg! Tons of KDE apps whose development I don’t have time to follow aren’t represented here, and I also don’t mention backend refactoring, improved test coverage, and other changes that are generally not user-facing. If you’re hungry for more, check out https://planet.kde.org, where you can find more news from other KDE contributors. How You Can Help If you’re a developer, check out our 15-Minute Bug Initiative. Working on these issues makes a big difference quickly! Otherwise, have a look at https://community.kde.org/Get_Involved to discover ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite! Finally, consider making a tax-deductible donation to the KDE e.V. foundation. [Less]
Posted about 2 years ago by Kevin Ottens (ervin)
Let’s go for my web review for the week 2022-07. Amazon Co-Owns Deportation Airline Implicated in Alleged Torture of Immigrants Tags: amazon, deportation Yet another lovely company… very lucrative business, so it’s unsurprising it attracts fat cats ... [More] with dubious values like Amazon. https://theintercept.com/2022/02/17/amazon-ice-deportation-flights-omni/ Everyone Hates Facebook (but this is more than just about Facebook) Tags: tech, facebook, surveillance, social-media Indeed, let’s not forget this is systemic. https://ar.al/2022/02/07/everyone-hates-facebook-but-this-is-more-than-just-about-facebook/ How Facebook and Google fund global misinformation | MIT Technology Review Tags: tech, capitalism, gafam, fake-news, social-media, facebook, google The big platforms clearly created the incentives for clickbait actors to rise… And then political actors entered the scene. https://www.technologyreview.com/2021/11/20/1039076/facebook-google-disinformation-clickbait/ Google Search Is Dying | DKB Tags: tech, google Indeed, authenticity in the search results slowly died due to ads and SEO. https://dkb.io/post/google-search-is-dying The European Parliament paves the way for removable and replaceable batteries - Right to Repair Europe Tags: tech, battery, ecology Definitely a welcome move… will need to be enforced of course. Let’s hope it won’t turn into yet another text without teeth. https://repair.eu/news/the-european-parliament-carves-the-path-to-removabe-and-replaceable-batteries/ Static B-Trees - Algorithmica Tags: tech, optimization, performance, SIMD, algorithm, b-tree Really cool optimizations for B-Trees. Once the layout is reworked this is a neat way to use SIMD as well. https://en.algorithmica.org/hpc/data-structures/s-tree/ Building for the 99% Developers Tags: tech, tools, processes, craftsmanship A good reminder that there is not a one size fits all solution in the tech world. Also be skeptical of the silver bullets that “obviously” everyone should use. Project context matters above all. https://future.a16z.com/software-development-building-for-99-developers/ Azgaar’s Fantasy Map Generator Tags: tech, map, generator, medieval Very cool tool to generate random maps, go all the way to per-city generators through this: https://watabou.github.io/city-generator/ Really cool stuff. https://azgaar.github.io/Fantasy-Map-Generator/ This scientist busts myths about how humans burn calories—and why Tags: science Definitely a fascinating research. It’s surprising how little we know about the topic… the article shows how difficult it is to collect data about it in the first place. https://www.science.org/content/article/scientist-busts-myths-about-how-humans-burn-calories-and-why Bye for now! [Less]
Posted about 2 years ago by Albert Astals Cid
Okular has two user interfaces, you can control which one you get when compiling okular by setting the OKULAR_UI cmake variable to desktop (the default) or to mobile (which you can build just fine on the desktop too, there's nothing "mobile only" in ... [More] it).The mobile one is built on top of Kirigami and is more oriented to use with touch screens. It also has fewer features, for example, you can't add annotations nor fill forms. I could say it's less likely you need those features on a mobile form factor but that's less and less true as time goes and computing shifts to mobile devices, but that's a story for another day.One of the features that was missing until today is the user interface parts related to Digital Signature verification, that is, those parts that say if a PDF is signed, if the signature is valid, let you see the certificate, etc.Now the same as with the desktop version, you get the "This document is signed" (and it's variations) bannerThe Signature tree on the sidebar/drawerThe Signature properties dialogAnd the Certificate properties dialogThe last two are not super great looking but there's not much more you can do when you have to dump lots of data to the user. [Less]
Posted about 2 years ago by Nicolas Fella
In my last post I talked about why knowing the desktop file for a window is important for the task manager. I promised to talk about some cool stuff we did there in Plasma 5.24, so here we are. While hacking on the task manager code I noticed that we ... [More] show a “Open new instance” action in the context menu of every task manager entry, even for those where it doesn’t make sense. A lot of apps are inherently single-window or single-instace, i.e. launching the app a second time will not open a second window but rather focus the existing one. Also, not all windows actually belong to a user-facing or user-launchable application. For example the network integration might ask you for the WiFi password, but you can’t open a new window for that from the task manager. Another kind of app where this actions doesn’t make sense is helper applications like the wizard for connecting to a new bluetooth device. After some initial refactoring the first thing I did was hide the action for apps that have NoDisplay=true in their desktop file. These usually correspond to the aforementioned background services and helper apps. With that in the situation was improved for a great deal of windows. However, the case of single-window application was still unsolved. After reading some older, related discussion, I found that our friends at GNOME had solved this problem for them already. Their equivalent part of the code, amongst other heuristics, reads the X-GNOME-SingleWindow key from the application’s desktop file. So I did the obvious thing and added reading X-GNOME-SingleWindow to Plasma’s task manager code. We also added that key to a bunch of relevant KDE apps. While this was a pragmatic and working solution, relying on a X-GNOME- key for what we want to be cross-desktop behavior is not ideal. It’s time for standardization! Nate Graham (you may have heard of him) proposed to add the existing key minus the X-GNOME- prefix to the desktop entry spec. After a bit of discussion about names and semantics people settled on SingleMainWindow as the new name. Implementations for Plasma and GNOME soon followed. What’s missing is adding it for all the apps out there. Besides KDE apps I already did that for qBittorrent, Nextcloud, and Yubico Authenticator. This is an excellent way to contribute to your favorite open source app! But wait, there is more. Some apps define their own “Open new window” action in their desktop file. To avoid having two redundant actions Plasma now hides its own action when there is already a semantically similar one. Happy task managing! [Less]
Posted about 2 years ago by Ken Vermette (kver)
This Saturday (Feb 19th) from 12:00pm to ~4:00pm EST I’ll be livestreaming preliminary work on the Plasma 5.25 wallpaper, as well as a brainstorming session for possible directions the Plasma 6 wallpapers could go. Iconography might also be a thing. ... [More] Abstract KDE NeuralBlender Example The Plasma 5.25 wallpaper work is mainly going to be sketching in Krita, and there may be 2 or 3 sketches that come out from that process. After that will be exploring ideas I’ll be proposing for Plasma 6, including KDE-prompted neurally generated images being used to find new and interesting design concepts. [Less]
Posted about 2 years ago by Adriaan de Groot ([ade])
Well that didn’t turn out as planned. February 1st I put out a Calamares release and started looking for my ski-goggles, with a vacation planned for the end of the week. Two lines on a COVID-19 rapid ag test put a stop to that and have fairly delayed ... [More] all kinds of other things. Scan of a panel of Asterix Here’s a panel from the Dutch translation of the 2017 Astérix album “Astérix et la Transitalique”. Dutch title “En de race door de laars”. A not-particularly-funny name then, although in the bastardized Latin often used in the Dutch translations you could interpret it as “crowned man”. Spoiler: this is relevant to the plot of the album. Two weeks later, three of four peeps in my home have had it. One person has managed to avoid the virus. While none of us were really sick, it’s been real slow to entirely recover. For my day-to-day activities I sit at a computer anyway, so it’s hard to tell Ade-is-working from Ade-is-hobby-hacking from Ade-is-doomscrolling. Things I managed to get done anyway: NymphCast is an audio/video streaming client and server for turning a TV into a device you can cast to. I bumped into it on Twitter, packaged it up for FreeBSD and fixed some minor issues along the way. CopperSpice showed up on my radar, so I did some packaging work on that – it was removed from FreeBSD ports a few years ago, but current releases build just fine. More notes on that some other time. Managed my local badminton club’s “oh, I played yesterday but tested positive today” stream of messages. It doesn’t seem like we had a big outbreak though. Documented a C API with Doxygen. Learned some more Doxygen structuring commands. Some days, just getting out of bed was enough. So here’s my wish for all y’alls: stay safe, don’t get it, and if you do I hope it may be mild for you. We’ll meet again, don’t know where, don’t know when, but let it be some sunny day at a Free Software conference. [Less]
Posted about 2 years ago by Adriaan de Groot ([ade])
Well *that** didn’t turn out as planned. February 1st I put out a Calamares release and started looking for my ski-goggles, with a vacation planned for the end of the week. Two lines on a COVID-19 rapid ag test put a stop to that and have fairly ... [More] delayed all kinds of other things. Scan of a panel of Asterix Here’s a panel from the Dutch translation of the 2017 Astérix album “Astérix et la Transitalique”. Dutch title “En de race door de laars”. A not-particularly-funny name then, although in the bastardized Latin often used in the Dutch translations you could interpret it as “crowned man”. Spoiler: this is relevant to the plot of the album. Two weeks later, three of four peeps in my home have had it. One person has managed to avoid the virus. While none of us were really sick, it’s been real slow to entirely recover. For my day-to-day activities I sit at a computer anyway, so it’s hard to tell Ade-is-working from Ade-is-hobby-hacking from Ade-is-doomscrolling. Things I managed to get done anyway: NymphCast is an audio/video streaming client and server for turning a TV into a device you can cast to. I bumped into it on Twitter, packaged it up for FreeBSD and fixed some minor issues along the way. CopperSpice showed up on my radar, so I did some packaging work on that – it was removed from FreeBSD ports a few years ago, but current releases build just fine. More notes on that some other time. Managed my local badminton club’s “oh, I played yesterday but tested positive today” stream of messages. It doesn’t seem like we had a big outbreak though. Documented a C API with Doxygen. Learned some more Doxygen structuring commands. Some days, just getting out of bed was enough. So here’s my wish for all y’alls: stay safe, don’t get it, and if you do I hope it may be mild for you. We’ll meet again, don’t know where, don’t know when, but let it be some sunny day at a Free Software conference. [Less]
Posted about 2 years ago by KDAB on Qt
A couple of weeks ago, we guided you through setting up a chat application and server in our first blog of this series. This is the second and final blog of this Qt Allstack series. Firebase Messaging Now that we have a functional chat application ... [More] , it’s time to add real world features, like push notifications. Firebase Cloud Messaging allows you to send push notifications to your users while your app is not running and integrates with APNs (Apple Push Notification services). This way, you only care about one API and can have push notifications on both Android and iOS. It is important to note here that, even though you can choose not to use Cutelyst on your backend, you still need to add Firebase support on your mobile application. It needs to link to the Firebase library so it can retrieve an unique device token. Once you have the Firebase token, you can send push notifications using any kind of server. Since the idea is to use Qt on all stacks, we will cover how to do so in Cutelyst. Back in the ChatAppBack project, we need to fetch and link to FirebaseAdminQt. Since Google doesn’t provide a Qt/C++ FirebaseAdminSDK, I have implemented one that supports some of its features. CMake can fetch, compile and link it for you, to do so open the main CMakeLists.txt and add: include(FetchContent) FetchContent_Declare( FirebaseAdminQt GIT_REPOSITORY https://github.com/cutelyst/FirebaseAdminQt.git GIT_TAG a9db10cdb3c1d6d68d37630fea9abcac8e640219 ) FetchContent_MakeAvailable(FirebaseAdminQt) Then, on src/CMakeLists.txt., make sure it links to: FirebaseAdminQt5::Core On root.h, we will add two new methods and create a pointer to the class that can send push notifications: class FirebaseAdminMessaging; // Forward declare the pointer type class Root : public Controller { public: void sendPushNotifications(const QString &message); void sendPushNotification(const QString &deviceToken, const QString &message); private: FirebaseAdminMessaging *m_fbAdminMsg; }; We now need to filter the messages to find out whether we should send a notification to a user. We will add two methods: one to filter the message and query the user’s firebase_token and another to send the message to Firebase servers to be pushed to the mobile phone: void Root::sendPushNotifications(const QString &message) { QStringList users; QRegularExpression re("@([a-zA-Z0-9_]{3,})"); auto globalMatch = re.globalMatch(message); while (globalMatch.hasNext()) { QRegularExpressionMatch match = globalMatch.next(); users << match.captured(1); } users.removeDuplicates(); for (const auto &user : qAsConst(users)) { APool::database().exec(u"SELECT data->>'firebase_token' FROM users WHERE nick=$1", { user, }, [=] (AResult &result) { auto firstRow = result.begin(); if (!result.error()) { if (result.size() && !result[0][0].toString().isEmpty()) { sendPushNotification(result[0][0].toString(), message); } } else { qWarning() << "Failed to get firebase_token for user" << user << result.errorString(); } }, this); } } void Root::sendPushNotification(const QString &deviceToken, const QString &message) { FirebaseMessage msg; msg.setToken(deviceToken); QString title = "ChatApp - New Message"; msg.setNotification(title, message); FirebaseAndroidNotification android; android.setTitle(title); android.setBody(message); msg.setAndroid(android); FirebaseAdminReply *reply = m_fbAdminMsg->send(msg); connect(reply, &FirebaseAdminReply::finished, this, [=] { reply->deleteLater(); if (reply->error()) { qDebug() << "FIREBASE error" << reply->errorCode() << reply->errorMessage(); } else { qDebug() << "FIREBASE success" << reply->messageId(); } }); } Then, at the root.cpp file on messages_POST, we add the following line when we’ve successfully retrieved our message id: sendPushNotifications(msg); Finally, we need to initialize Firebase Admin by adding the following code at the postFork() function inside root.cpp: auto fbApp = new FirebaseAdmin(this); fbApp->setAccountCredentialData(R"V0G0N( )V0G0N"); fbApp->getAccessToken(); auto messaging = new FirebaseAdminMessaging(fbApp); messaging->setApiKey(""); return true; To fill both fields, we now need to create a Firebase project. So, please open the Firebase console. The FCM documentation can be found here. If you’d like more information on Firebase projects, click here. On the Firebase website, click on “Create a project” or “Add project” (if you already have one). Give it a name, like ChatApp. In the next step, Google Analytics is not required and for simplicity, disable it. It will then create your new project and take you to the project’s dashboard. Select “Project Settings” on the Firebase dashboard: Choose the “Service Accounts” tab. There, we will have Firebase Admin SDK information. Click “Generate new private key.” This will download a JSON file containing the server credentials. You can either add code to read the file or copy its contents and replace the placeholder that we left on root.cpp: FirebaseAdmin::setAccountCredentialData(); Now we select the “Cloud Messaging” tab. In “Project Credentials”, copy the token of the “Server Key” key, and replace the placeholder that we left on root.cpp: FirebaseAdminMessaging::setApiKey(); Let’s also create a generic method to send the push notifications on root.cpp: void Root::sendPushNotification(const QString &deviceToken, const QString &message) { FirebaseMessage msg; msg.setToken(deviceToken); QString title = "ChatApp - New Message"; msg.setNotification(title, message); FirebaseAndroidNotification android; android.setTitle(title); android.setBody(message); msg.setAndroid(android); FirebaseAdminReply *reply = m_fbAdminMsg->send(msg); connect(reply, &FirebaseAdminReply::finished, this, [=] { reply->deleteLater(); if (reply->error()) { qDebug() << "FIREBASE error" << reply->errorCode() << reply->errorMessage(); } else { qDebug() << "FIREBASE success" << reply->messageId(); } }); } Let’s switch back to our QML app and prepare ChatApp for Android. We will ask Qt Creator to create the Android templates. To do so, select “Projects” → select “Android Qt 5.15.2” kit → then, in “Build Android APK”, choose “Create Templates”. On the wizard, select to copy the gradle files checkbox, too: Once the templates are created, you will have the Android manifest open in an editor. I recommend avoiding using that editor, as it usually reformats the XML. For now, just change the “Package Name” to “com.kdab.chatapp”. This is the ID of your APK that will eventually be published in the Google Play Store. We’ll need it on the Firebase console. On the dashboard, there will be an Android icon with the information to “add an app to get started”. It will now show a page to register your app. I’ll put “com.kdab.chatapp” under the Android package name and then click on “Register App”, (a hash will be appended to your project id). The next step will generate a “google-services.json” that we will need to have on our app. Download it and have it stored inside the android folder we created earlier on the app. Go to ChatApp.pro and add the following line: DISTFILES += android/google-services.json We will not cover the step-by-step for getting APNs to work, as that is well-covered on the web. On this Firebase Console page you can also add your iOS app information and it will provide fields for adding the your APNs certificates. Add the QtAndroidExtras library to the top of the ChatApp.pro file: android: { QT += androidextras } Add the following to the gradle.properties: #org.gradle.caching=true android.useAndroidX=true systemProp.firebase_cpp_sdk.dir=/firebase_cpp_sdk This is required so that the C++ Firebase library can initialize and create a new unique token to identify your device, for privacy reasons you are not allowed to obtain any phone identification. The next step, “Add Firebase SDK”, should be ignored because it doesn’t cover Qt. So click “Continue to Console”. It’s time to finish and integrate Firebase C++ into our code. To start, download the Firebase C++ SDK from here.  You will have a ZIP file, which you should extract beside your ChatApp project directory. Notice that this isn’t the latest version, but rather an older version that works. The latest version has issues calling the Java classes. This version, although old, still works without issues. On iOS we will need this very same ZIP file, but will need to manually download the Firebase iOS SDK. It usually offers adding it with Cocoa PODS, but QMake has no support for it. Basically, on iOS, the C++ SDK will talk to that of the iOS. It took me a long time to figure this out, but at least our C++ code is left untouched. Firebase C++ SDK has one caveat, though: when a request is made or when a callback method is called, they are not on Qt’s main GUI thread. To make integration easier, I created another Qt Wrapper, but the code is not state-of-the-art. So, we must connect to all its signals using Qt::QueuedConnection. Now we’ll clone https://github.com/cutelyst/firebase-qt inside our ChatApp and add it to the ChatApp.pro build: android|ios { SOURCES += \ firebase-qt/src/firebaseqtapp.cpp \ firebase-qt/src/firebaseqtmessaging.cpp \ firebase-qt/src/firebaseqtabstractmodule.cpp HEADERS += \ firebase-qt/src/firebaseqtabstractmodule.h \ firebase-qt/src/firebaseqtapp.h \ firebase-qt/src/firebaseqtapp_p.h \ firebase-qt/src/firebaseqtmessaging.h } Firebase Qt also has a class for phone authentication, which uses SMS to validate the user’s mobile phone and can easily be extended to support the other authentication methods supported by the Firebase Authentication module, which we won’t cover here. Still on ChatApp.pro, we will add the required code to be able to work on both 32-bit and 64-bit Android. We can also check the iOS part on the git repository of this project: # This is the path for the Firebase C++ SDK GOOGLE_FIREBASE_SDK = $$PWD/../firebase_cpp_sdk # This is the path for the iOS Firebase SDK GOOGLE_IOS_FIREBASE_SDK = $$PWD/../Firebase INCLUDEPATH += $${GOOGLE_FIREBASE_SDK}/include DEPENDPATH += $${GOOGLE_FIREBASE_SDK}/include contains(ANDROID_TARGET_ARCH,armeabi-v7a) { ANDROID_PACKAGE_SOURCE_DIR = \ $$PWD/android LIBS += -L$${GOOGLE_FIREBASE_SDK}/libs/android/armeabi-v7a/c++/ -lfirebase_app -lfirebase_messaging PRE_TARGETDEPS += $${GOOGLE_FIREBASE_SDK}/libs/android/armeabi-v7a/c++/libfirebase_app.a PRE_TARGETDEPS += $${GOOGLE_FIREBASE_SDK}/libs/android/armeabi-v7a/c++/libfirebase_messaging.a } contains(ANDROID_TARGET_ARCH,arm64-v8a) { ANDROID_PACKAGE_SOURCE_DIR = \ $$PWD/android LIBS += -L$${GOOGLE_FIREBASE_SDK}/libs/android/arm64-v8a/c++/ -lfirebase_app -lfirebase_messaging PRE_TARGETDEPS += $${GOOGLE_FIREBASE_SDK}/libs/android/arm64-v8a/c++/libfirebase_app.a PRE_TARGETDEPS += $${GOOGLE_FIREBASE_SDK}/libs/android/arm64-v8a/c++/libfirebase_messaging.a } Here, we link to firebase_app and firebase_messaging. As on iOS, Firebase C++ SDK, when running on Android requires it’s Java libraries, we get them by changing the build.gradle: buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.6.0' classpath 'com.google.gms:google-services:4.3.8' } } repositories { google() jcenter() flatDir { dirs "../../firebase_cpp_sdk/libs/android" } } And: apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation 'com.google.firebase:firebase-analytics:17.4.1' implementation 'com.google.firebase:firebase-messaging:20.1.7' implementation 'com.google.firebase.messaging.cpp:firebase_messaging_cpp@aar' implementation 'com.google.android.gms:play-services-base:16.1.0' implementation 'androidx.core:core:1.0.1' } We are now able to proceed to using it, creating a Firebase class that will serve us as the QML glue. So, let’s ask QtCreator to create a new C++ class called Firebase that inherits from QObject. The new firebase.h will look like: class Firebase : public QObject { Q_OBJECT Q_PROPERTY(QString token MEMBER _token NOTIFY tokenChanged) public: explicit Firebase(QObject *parent = nullptr); void tokenReceived(const QByteArray &token); void messageReceived(const QMap &data); Q_SIGNALS: void tokenChanged(); private: QString _token; }; The two methods will be called by Firebase C++ SDK, the first one when it initializes and the second one when a push notification is received but the application is running. In this case, Android does not show the popup but you still get the data. The token property will be sent to the backend; it’s needed to be able to send a notification to this device. On firebase.cpp: #include #include "firebase-qt/src/firebaseqtapp.h" #include "firebase-qt/src/firebaseqtmessaging.h" Firebase::Firebase(QObject *parent) : QObject(parent) { #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) auto firebase = new FirebaseQtApp(this); auto messaging = new FirebaseQtMessaging(firebase); connect(messaging, &FirebaseQtMessaging::tokenReceived, this, &Firebase::tokenReceived, Qt::QueuedConnection); connect(messaging, &FirebaseQtMessaging::messageReceived, this, &Firebase::messageReceived, Qt::QueuedConnection); firebase->initialize(); #endif } void Firebase::tokenReceived(const QByteArray &token) { qDebug() << "Got Firebase Messaging token" << token; _token = QString::fromLatin1(token); Q_EMIT tokenChanged(); } void Firebase::messageReceived(const QMap &data) { qDebug() << "Got a Push Notification when the app is running" << data; } As we can see, we need FirebaseQtApp, which is required by all Firebase modules. Then, we connect the signals to our methods using Qt::QueuedConnection. When testing with the USB cable, we will be able to see the debug message when messageReceived is called. But we will ignore its data. We will now export this class as a QML singleton because we need the token to be sent when the user is created. Add the following to main.cpp before you create the QGuiApplication instance: Firebase fb; qmlRegisterSingletonInstance("com.kdab", 1, 0, "Firebase", &fb); Now, on PageUser.qml, we will import this singleton: import com.kdab 1.0 Then, use the token on the JSON object that is sent to the server: xhr.send(JSON.stringify({ user_id: settings.user_id, nick: nick, fullname: fullname, firebase_token: Firebase.token })); Now, we should have Firebase notifications set up and in working order. Have fun with it!   About KDAB If you like this article and want to read similar material, consider subscribing via our RSS feed. Subscribe to KDAB TV for similar informative short video content. KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us. The post Qt Allstack II – Adding Firebase appeared first on KDAB. [Less]
Posted about 2 years ago by KDE Community
Tuesday, 15 February 2022. Today KDE releases a bugfix update to KDE Plasma 5, versioned 5.24.1. Plasma 5.24 was released in February 2022 with many feature refinements and new modules to complete the desktop experience. This release adds a week's ... [More] worth of new translations and fixes from KDE's contributors. The bugfixes are typically small but important and include: Highlights Discover: Don’t trigger updates while busy. Commit. KScreen: Workaround unknown Qt issue that causes the revert dialog to be invisible. Commit. Fixes bug #449560 Powerdevil: Support hardware with only one charging threshold, not both. Commit. Fixes bug #449997 View full changelog [Less]
Posted about 2 years ago by Kate
Once more, Valentine’s Day has arrived. Like last year, Kate’s development is nicely progressing this year, too. Plenty of new stuff and fixes We had a very successful year 2021 development wise. As you can track on our merge requests page 348 ... [More] requests got merged directly into Kate and 177 into the KTextEditor editor component. The year 2022 already began well with 63 patches for Kate and 39 for KTextEditor. Naturally, more contributions are highly welcome! If you want to scratch your own itch, please join us! Feature of the day: Breadcrumb Navigation Waqar Ahmed introduced some days ago a navigation bar at the top of each view space inside Kate (naturally optional). For details of the initial implementation, see this merge request. I think this is a great improvement for the typical workflow where you want to e.g. quickly jump between documents close to each other in the directory structure. Is this innovative? Naturally, other editors have very similar features, for example Visual Studio Code has such a breadcrumb navigation, too. The same is true for many file managers (like Dolphin) or image viewers (like Gwenview), they have this since ages in a similar fashion. Still I think for Kate this is an innovate new thing to have. And for sure a lot of people will like it and love to use it. Therefore, if you read somewhere the time of innovation is over for KDE projects, I object. Not that I believe in large revolutionary jumps, I have not seen that so far in real life, but I believe we still strive to improve our projects in an innovative fashion. And often this means incremental improvements and converging into directions already explored by others. Have a nice Valentine’s Day, I hope you had more fun stuff to do today than writing a blog post .P Comments? A matching thread for this can be found here on r/KDE. [Less]