Thomas Fischer's Weblog

Life, Linux, LaTeX

Archive for the ‘KDE’ Category

KParts Browser Plugin

with 21 comments

One of the biggest advantages of Konqueror is that it smoothly integrates with the KDE desktop. Any file type can be opened within Konqueror as it loads KParts modules to handle non-HTML files. For example, to display PDF files within the browser, the embeddable part from Okular is used. Unfortunately, this technology is KDE-only, at least no other browser supports KParts.

On the other side, most browsers support a plugin technology originally coming from the good ol’ Netscape 2.0. Most prominently, it is used for the Flash plugin from Adobe and the PDF plugin as part of the of Acrobat Reader.

So, why not combine both technologies to use KDE parts in “normal” browsers?
With quite little effort, based on some examples by Qt/Nokia, I was able to hack a proof of concept: A small plugin which can be used with browsers such as Mozilla Firefox, Opera, Arora, or Chromium.

So far, the plugin supports PDF and PostScript files (via Okular), OpenDocument text, presentation, and spreadsheet (via KOffice) and MP3/OggVorbis files (via DragonPlayer). More file types can be added with only a few lines of code, given that there is a KDE part installed which can handle this file.

Interested? Visit the project’s homepage and try it out yourself!





Written by Thomas Fischer

May 22, 2010 at 17:09

Posted in KDE, Linux

Mounting devices in KDE without Konqueror, Dolphin, or digiKam …

leave a comment »

KDE 4 has this nice plasma widget called ‘device notifier’, which shows attached devices such as USB flash drives, CD/DVD drives, or digital cameras.

Device Notifier

Device Notifier

Clicking on this icon shows all attached devices, in my example it is a single USB flash drive named ‘256MThFisch’.

Device Notifier plasma widget

Device Notifier plasma widget

Clicking on such a device brings up a list of possible actions, e.g. to browse the files with Dolphin or Konqueror, downloading all photos with digiKam, or playing music titles with Amarok.

List of actions with device

List of actions with device

Well, this is quite nice for users relying on KDE software only. But what happens if you are a power-user, using terminals such as Konsole? Whenever you want to mount a device, you have to start an application such as Dolphin, Konqueror, or digiKam even if you do not want to use it …

Adding your own Action for Mounting

As KDE4 is very configurable, you can improve this situation. In the System Settings you can configure which action are available when a storage medium becomes available. Here, we are going to add our own action which ‘just’ mounts a device.

System Settings - Advanced

System Settings - Advanced


Configuration of Actions for Devices

Configuration of Actions for Devices

To add you own action, click on the ‘Add’ button and enter a name for the new action, such as ‘Mount’.

Adding a new action

Adding a new action

In this new action, you can an icon which resembles that action of mounting. In my case, I chose emblem-mounted.png from the emblems directory in the Oxygen icon set. For the command to execute, you can enter any command you like. If you want to see no feedback, use /bin/true. In my example, I used /usr/bin/kdialog --msgbox to get a message box showing a confirmation once the mount process is complete.

Next time you plug in an USB drive, a new option will show up to ‘just’ mount you device without starting any bloated application.

List of actions, 'just mount' option included

List of actions, 'just mount' option included

Once you activate the ‘Mount’ option, it takes 1-2 seconds and a message box pops up confirming the mount operation. The device is read to use in any application.

Message box

Message box

Current Issues

The current approach has some minor issues which may get addressed in later improvements:

  • Cases where the mounting operation fails are not handled
  • The message box does not show the devices name, type or mount point

Still, good luck with testing this ‘hack’ πŸ™‚

Written by Thomas Fischer

November 9, 2009 at 22:43

Posted in KDE, Linux

Tagged with , , , , , , ,

Automatic AdBlock filter list updates in Konqueror

with 4 comments

As a KDE user, Konqueror is my favorite browser. It offers smooth integration into KDE, both in looks and features (e.g. using the Okular part to view PDFs). Its rendering engine is so good that it was forked into WebKit used in Apple’s Safari and Qt. One aspect Konqueror lacks in comparison to Firefox, though, is the support of plugins/addons of all kinds to add more features to the browser. There is a set of security and privacy enhancing plugins for Firefox I use myself and recommend to others. One of them is AdBlock Plus which uses a well-maintained list of URLs to block if you want to experience the net with less annoyance.

On the other side, Konqueror has a similar adblocking functionality built-in since KDE 3.5 (late 2005). In the configuration dialog, users can add fragments or regular expressions of URLs to be blocked. Maintaining such a list yourself is quite cumbersome, especially if you have accounts on several computers. At least since March 2007 there has been a feature request in KDE’s bug tracking system to add an automatic updater to Konqueror’s ad-filtering.

Last weekend, I started to scratch the itch and implemented an automatic filter list updater. Luckily, the internal format of AdBlock entries in Konqueror matches the one use by AdBlock Plus, except that some advanced features are not (yet) supported. Based on the then-current KDE 4.2.4 code I made changes to both kdelibs and kdebase. The former one contains the KHTML component including the actual filter, the latter contains the code for Konqueror’s settings GUI.

The changes I made to kdelibs work as follows: Read the khtmlrc configuration file to get a list of filter files following the format used by AdBlock Plus. My example configuration file contains several lists from easylist.adblock.org. The filter list files are downloaded and cached if no local copy is available or if it is outdated. Each filter list file is loaded and added to Konqueror’s current filter list each time the browser is started. The user-configured filter list is not modified, as the changes occur in memory only.

If you edit your khtmlrc manually to add new filter lists, this works already fine without GUI. For a better usability experience, I modified Konqueror’s settings dialog so that users can select from a list of preconfigured filter lists (currently, all lists from EasyList) which to actually use. Additionally, the time interval to refresh the lists can be configured.

Manual filter in Konqueror's AdBlockAutomatic filter in Konqueror's AdBlock

I refrained from adding an option to add, modify or delete list entries in the GUI. This is simply for two reasons: (1) Users may tend to enter filter lists that do not follow the format (e.g. from other adblocking filter sites) and (2) the list of available filter lists does not change that often that it cannot be changed in the next monthly update of KDE. If users are eager to add more lists not officially approved, they can still edit their configuration files manually.

All patches and an example configuration file are available from bug report 143495 in KDE’s bug tracking system. If you have constructive suggestions, please add you comments to the bug report (do not post comments in this blog, that won’t help). To support the patch in getting approved and added to the official code base, vote for the bug (login required).

Update (20091201): I posted the patches on KDE’s Review Board a few days ago and got a review from David Faure. There are some minor issues to change and fix, but his overall comment was “Nice (but obviously not for 4.4 due to the feature freeze, it will have to be for 4.5)” πŸ™‚

Update (20100812): My AdBlock extension has become part of KDE 4.5 πŸ™‚ Check out this screen shot:AdBlock filter list in KDE 4.5

Written by Thomas Fischer

August 5, 2009 at 22:08

Posted in KDE, Linux

Tagged with , ,

Videos on using KBibTeX

with 4 comments

KBibTeX has several nice features which simplify your daily work when you edit BibTeX files. In this blog post, I’d like to show you three small videos on some basic operations in KBibTeX.

The most basic operation is to add a new entry, which is demonstrated in the first video:

Video on how to add a new entry in KBibTeX

Video on how to add a new entry in KBibTeX

The second video shows you how to search for a reference on the Internet. In this example, Google Scholar is used to find a reference on Robert Sedgewick’s `Algorithms in C++’:

Video on how to use Google Scholar in KBibTeX

Video on how to use Google Scholar in KBibTeX

In the last video, duplicates in a BibTeX file are found and merged into a single entry. When merging entries, you can interactively select the fields to be kept in the resulting entry.

Video on how to find and merge duplicates in KBibTeX

Video on how to find and merge duplicates in KBibTeX

P.S. I’d like to thank my sister for dubbing the videos.

Written by Thomas Fischer

October 27, 2008 at 12:40

Posted in KDE, LaTeX

First Postcard for KBibTeX

leave a comment »

KBibTeX has been postcardware for some time. Now, a few days ago I got the first postcard.


KBibTeX postcard from Castelnaudary


KBibTeX postcard from Castelnaudary

I would like to thank StΓ©phane Bernard from Castelnaudary for sending this postcard. So, everyone of you (users of KBibTeX) is encouraged to do the same. πŸ™‚

Written by Thomas Fischer

June 29, 2008 at 0:00

Posted in KDE

Debian Package of the Day

leave a comment »

I just got informed that KBibTeX is Debian Package of the Day for today (Nov 25, 2007). This is very good news which keeps me motivated πŸ™‚

The DPotD article gives you a brief overview on KBibTeX and highlights the most important features including some screenshots. Maybe the most important change in the current development version compared to KBibTeX 0.2 is that both Google Scholar and arXiv have been added to the set of integrated online databases.

Furthermore, a user volunteered to do a German localization, so there may be a translation available soon. If someone wants to prepare a translation into other languages, please send me an email.

Written by Thomas Fischer

November 25, 2007 at 0:00

Posted in KDE