CAcert SSL certificates in KMail KDE 4

In preparation of the sixth “Brandenburger Linux-Infotag” I passed the CAcert Assurer Challange, which was the last requirement I had to fulfil to be allowed to verify people.

To start the “challenge” it is necessary to login with your own SSL certificate from CAcert. I only used gpg the last years, so I had have to create a new one and configure KDE to use it.

That’s unfortunately not easy.

The perhaps smallest KDE application in the world

For testing some parts of the korundum bindings, that allow the usage of KDE in Ruby, i wrote a small and lightweight application with only the necessary parts.

Maybe you can take it also to do some testings or just as a little example.

With its 12 lines (17 lines minus 3 empty lines minus Shebang line and $KCode line, that are not really required) of code it is perhaps the smalles KDE application you will find.

Of course, every Qt app would be a few lines smaller, because you dont need the KAbout object.

#!/usr/bin/env ruby

$KCODE = 'u'
require 'korundum4'

about = KDE::AboutData.new("ktest", "",
    KDE.ki18n("KTest"), "0.1")
KDE::CmdLineArgs.init(ARGV, about)
a = KDE::Application.new
w = KDE::PushButton.new( "Click me to quit" ) do
  connect( SIGNAL :clicked ) do
    puts "Do something else"
    KDE::Application.instance.quit
  end
end
w.show

a.exec

Ruby Qt/KDE4 Template KMainWindow

![KMainWindow](<%= site_url %>/images/kmainwindow.png “KMainWindow”){: .pull-right} Starting using the Qt-Toolkit (or the extension with KDE classes) is a little difficult. Especially if you never used really the toolkit with C++. So you have to learn translating the C++ API reference into ruby.

Some usefull links:

But when you got it, the usage is pretty cool. In the following code listing you can find the code for a full-featured kmainwindow.

#!/usr/bin/env ruby
# file: kmainwindow.rb
$KCODE = 'u'

require 'korundum4' # kd4 bindings

class CustomWidget < KDE::MainWindow

  def initialize

    super

    resize(520, 535)

    # Prepare the Actions
    @actionQuit = KDE::Action.new( self ) {
      setIcon KDE::Icon.new "application-exit"
    }
    connect( @actionQuit, SIGNAL( :triggered ), SLOT( :close ) )

    # Prepare the Menu
    @menuBar = menuBar
    @menuFile = Qt::Menu.new @menuBar
    @menuFile.addAction @actionQuit
    @menuBar.addAction @menuFile.menuAction
    @helpMenu = helpMenu
    @menuBar.addAction @helpMenu.menuAction

    setMenuBar(@menuBar)

    # Prepare Statusbar
    @statusBar = statusBar
    setStatusBar @statusBar

    # Prepare Toolbar
    @toolBar = toolBar
    @toolBar.addAction @actionQuit
    addToolBar(Qt::TopToolBarArea, @toolBar)


    # Prepare Central Widget
    @centralwidget = KDE::TextEdit.new self
    setCentralWidget @centralwidget

    retranslateUi
  end

  def retranslateUi
    @menuFile.title = i18n "File"
    setWindowTitle i18n "MainWindow"
    # @statusBar.showMessage i18n "Loading"
    @actionQuit.text = i18n "Quit"
    @actionQuit.shortcut =  KDE::Shortcut.new i18nc( "Quit", "Ctrl+Q" )
end

end

about = KDE::AboutData.new(
  "app",                           # internal application name
  # language catlog name for i10n (konqueror's catalog for the beginning is better than no catalog)
  "konqueror",
  KDE.ki18n("KApp"),                 # application name in the about menu and everywhere else
  "0.1",                             # application version
  KDE::ki18n("A Tool to easily create HTML formatted Code"),  # short description
  KDE::AboutData::License_GPL_V3,    # license
  KDE::ki18n("(c) 1999-2000, Name"), # copyright info
  # text in the about box - maybe with \n line breaks
  KDE::ki18n("just some text in the about box"),
  # project homepage and eMail adress for bug reports - attention: homepage changes standard dbus/dcop name!
  "http://homepage.de", "bugs@homepage.de" )

about.setProgramIconName  "plasma" # use the plasma-icon instead of question mark
KDE::CmdLineArgs.init(ARGV, about)
a = KDE::Application.new
w = CustomWidget.new
a.topWidget = w
w.show
a.exec

kmainwindow.rb

Pagination