Jump to content

PIM/MS Windows

From KDE Community Wiki

This page covers topics related to the MS Windows port of the KDE PIM suite.

Note

This page is work in progress started by jstaniek.


Building

Build base KDE libraries for Windows with required dependencies, preferable using emerge tool (because it tracks dependencies for you):

  1. install emerge and its dependencies as described here
  2. either build SASL by hand or download precompiled version for mingw and msvc, and install it (if you skip this step you will not have SSL/TLS support in your apps)
  3. unpack gpgme-1.1.4-3-lib.zip and gpgme-1.1.4-3-bin.zip from http://www.winkde.org/pub/kde/ports/win32/repository/win32libs/ to your KDEDIR
  4. from the cmd.exe command line, enter
    emerge kdepimlibs
    - that will also build qt, kdesupport (part of it), soprano, strigi, kdelibs, kdebase
  5. enter
    emerge libassuan
    - this is an optional dependency of kdepim
  6. finally, enter
    emerge kdepim

Notes:

Problem points

The Checklist

Status Feature Description Contact
DONE Maildir implementation make maildir standard work with Windows filesystems
DONE Folder Indices so called "mmap mode"
DONE SASL support security

Maildir implementation in KMail

The implementation based strictly on the original maildir specification in kmail does not work on Windows' file system, since it uses the ":" (forbidden on windows) character in file names. It also relies (as does maildir in general) on the atomicity of making a hardlink and then unlinking the original, to implement an atomic move. The implementation used by akonadi (kdepim/maildir) relies on QFile in that regard, but it's unclear if rename is atomic on all platforms.

  • jstaniek 12:50, 7 January 2008 (CET): Hard/soft links could be handled on Windows by altering the source code so that the "link" file is a text file itself and contains the target path. If we need atomic renames, Windows apparently lacks them, I have found a pre-Vista blog which contains description on how to perform them in a messy but honest way (look at the very last "Write process (on Foo.txt)" version). There's also a way to recover from application/system crash during the pseudo-atomic operations (see the very last "Recovery from a crash during write" checklist).
  • jstaniek 12:42, 24 January 2008 (CET): We will most probably benefit from maildir suport on Windows as Thunderbird (ver. <3) apparently lacks support for this storage, despite many wishes and plans.
  • jstaniek 12:42, 24 January 2008 (CET): regarding replacing ":" character on windows:
    • We cannot use ":" in any way (Wikipedia note), so we have to rename it to something other:
      • The proposed replace character is "!". Not "-" (see this for explanation).
      • We may want to add support for user-defined character, to allow reuse maildirs of apps like mutt (which uses "-"), but it should be clearly noted in the handbook that the setting is only for integration with existing maildirs.
      • The rename makes the implementation incompatible with the specification (which is informal anyway and says nothing about the replacement character).
    • The ability of sharing a single maildir structure on dual boot machines (e.g., using the IFS Ext2 driver or Ext2fsd: way less crashy than IFS Ext2 (no blue screen of the death) and actively maintained) is affected by the problem with ":" character.
      • Windows FS layer apparently returns "file not found" error for files having the ":" character on a linux filesystem. So if there is a need for storing the maildir at linux side, ":" should be renamed even if Linux itself does work with ":".
      • Conversely, if the maildir has to be stored at windows side, ":" characters have to be renamed, do Linux build of KMail (and KDE-PIM in general) should support this rename too in order to access the storage.

Folder Indices

There are issues with locking index files for KMail folders and mmap()/munmap() operations on Windows. Therefore, SQLite-based indices are in development. More info...

Integration into the Windows Explorer & Desktop

Note

jstaniek 22:01, 14 January 2008 (CET): TortoiseSVN is GPLed SVN client which is nicely integrated with Windows Explorer. Perhaps we can use its source code as a reference...


Registry settings for default apps and services

Introduction: We can detect whether KMail is the default e-mail client. If set as default, KMail should act as a default mailer, and thus be invoked automatically for actions like RMB "Send To -> E-mail Recipient". This shall be also reused by others for KOrganizer and Konqueror. The solution is relatively simple modifications to the Windows Registry. See Mozilla's solution.

First, we can use HKLM node for system-global settings or HKCU node for current-user-only settings. If the attempt to set the value in HKLM fails, usually because of unsufficient permissions, HKCU should be used. As expected, HKCU overrides HKLM settings. See KB297878. Below we'll use HKCU.

  • HKCU\Software\Clients\StartMenuInternet key is used to specify default web browser; could be set to Konqueror
  • HKCU\Software\Clients\StartMenuInternet\app.exe\shell\open\command key is used for "Internet" start menu shortcut, can be set to Konqueror. Note from the KB - "The command might open the browser on the users home page, for example. However, it might launch some other introductory user interface that the ISV feels is appropriate." So this is not the same as 'default browser' setting.
  • HKCU\Software\Clients\Mail\Appname - registered email client, there can be more entries within the 'Mail' node. Adding KMail here makes it available for users to select as a default browser using 'Set Default Programs' system window.
  • HKCU\Software\Clients\Mail - default email client, 'Windows Mail' by default; could be set to KMail.
  • HKCU\Software\Clients\Calendar\Appname - registered calendar application, there can be more entries within the 'Calendar' node. See the note for HKCU\Software\Clients\Mail\Appname.
  • HKCU\Software\Clients\Calendar - default calendar application, 'Windows Calendar' on Vista; could be set to KOrganizer.
  • HKCU\Software\Clients\Contacts\Appname - registered contacts client, there can be more entries within the 'Contacts' node. See the note for HKCU\Software\Clients\Mail\Appname.
  • HKCU\Software\Clients\Contacts - default contacts application, 'Address Book' by default; could be set to KAddressBook.
  • HKCU\Software\Clients\News\Appname - registered newsgroup client, there can be more entries within the 'News' node. See the note for HKCU\Software\Clients\Mail\Appname.
  • HKCU\Software\Clients\News - default newsgroup application, 'Windows Mail' by default; could be set to KNode.

From the KB: After updating the registry keys, the application broadcasts the WM_SETTINGCHANGE message with wParam = 0 and lParam pointing to the null-terminated string "Software\Clients\StartMenuInternet" to notify the operating system that the default client has changed.

Using MAPI

HKLM\Software\Clients\AppName\DllPath points to a dll implementing MAPI interface. Internet Explorer uses Windows Messaging by default to invoke a mailer on a mailto: link. Only if the MAPI install is misconfigured will it resort to directly accessing the mailto association key.[1] Example implementation of MAPI services is Thundebird's mozMapi32.dll (the key is usualle equal to C:\Program Files\Mozilla Thunderbird\mozMapi32.dll).

KDE-related notes
  • KDElibs execute default web browser or email client for protocols like http(s): and mailto: via QDesktopServices::openUrl(), which in turn uses ShellExecute(). openUrl() is widely used in Qt e.g. for hyperlinks in text boxes and label widgets.
  • A general rule of KDE/win: not to duplicate registry settings in any rc file and use default applications if possible, to avoid changing behaviour expected by users.

Drag&drop support

Support drag&drop from/to composer and from received mails into the file system (Windows Explorer and the Desktop)

Copy&paste support

Support pasting files copied (in Windows Explorer or the Desktop) as attachments.

Profile migration

SASL support

Note

SASL should be available before building kdepimlibs. When you build kdepimlibs, it should display message like "SASL Found" during configure stage.

Build SASL by hand

Cyrus SASL is used on Windows for SSL/TLS, so we use the same source code plus wrapper functions that are a part of the Cyrus distribution (the result is a native Windows library, do not confuse with Cygwin!).

Two Mozilla's patches have to be applied for msvc.

Cyrus SASL functionality is based on plugins. For KDEpimlibs we have set the paths for plugins and configuration to KDEROOT/lib/sasl2/ and KDEROOT/share/config/sasl2/, respectively. The configuration capatibilities are apparently not used for now. (jstaniek February 3 2008)

The following parts of KDEpimlibs depend on sasl2: kldap, kioslave/{sieve|imap4|smtp|pop3}.

Limitations: Currently all plugins but KerberosV4 (kerberos4.c) and PASSDSS (passdss.c) can be built on Windows. (more info)

See also:

Insert non-formatted text here

Download SASL for mingw and msvc

Download SASL library and plugins for mingw and msvc. Here's link, this time uploaded to the wiki (TODO move it to the kde windows server): http://kexi-project.org/download/cyrus-sasl2-2008-04.zip. The archive provides directory structure, so you'll know where to unpack these files.


Hot fixes to apply

Please apply these fixes in order to avoid crashes in related KDE componenets.

Crashes in korgac

Update: this step is not needed since r806657.

KOrganizer's reminder daemon (korgac) crashes on Windows because of recent commit. A quick fix is to go to kdelibs/ source directory and type:

svn up -r 795533 kdeui/util/ksystemtrayicon.cpp

Then compile and install the kdelibs.

Crashes in KDED

We sometimes need to disable creation and automatic maintenance of the KDE menu entry in the Start Menu. To do this, we can add these lines to the $KDEROOT/share/config/kwinstartmenurc file on deployment:

[General] Enabled=false

Tip: just download the file: kwinstartmenurc and save it to the $KDEROOT/share/config/ directory.

"Locked" dbus-daemon

History:

  • jstaniek 18:12, 27 May 2008 (CEST): initial version for enterprise4 branch; emerge package: kdepim-branch
  • jstaniek 19:03, 28 May 2008 (CEST): update for David's commit r813498 "Ported Kontact::UniqueAppHandler to DBUS"

Introduction: upon application crash (for whatever reason), dbus-daemon (happens on Windows only) does not unregister unused service(s). Subsequent execution of the same application causes KUniqueApplication: Can't setup D-Bus service. Probably already running error and immediate exit with no visible feedback.

Reported as http://intevation.de/roundup/kolab/issue2639

Past workaround: manual killing dbus-daemon.

Rationale for the new workaround: make KDEPIM more suitable for demonstrating, without executing cryptic commands.

Workaround: If registering dbus service for KUniqueApplication (e.g. "org.kde.kmail") failed, do not exit immediately but instead:

  1. look if there's a process with the same name (e.g. kmail) running, if so exit with no action
  2. if there's no process with the same name, kill dbus-daemon (first, using SIGTERM, then SIGKILL), then restart the application with exactly the same arguments and the same current working directory.

Recipe:

  1. apply kuniqueapplication.patch in kdelibs and rebuild and install kdeui; this will make KUniqueApplication::start() return with false value instead of exiting().
  2. apply workaround_for_locked_dbus2.patch in kdepim; build and install kdepim; this adds KPIM::Application class to libkdepim, and KMail, KOrganizer and Kontact uses it.

Other TODOs

  • KMFolderTree::cleanupConfigFile() removes kmailrc sections for nonexisting folders but the changes are not writen back (jstaniek 11:07, 14 May 2008 (CEST))

Notes

  • The branches/work/kdab-post-4.0 branch (kdepimlibs, kdepim modules) have been closed and merged into trunk. KDE PIM for Windows development happens in trunk again now.
  • KDE PIM for Windows development happens in branches/kdepim/enterprise4 now.

Links

External Links