Guide to Porting Applications to KDE 4.x

# Porting Applications to KDE 4

## Note

All modules should build from /trunk/KDE/kdelibs; there is no snapshot branch any longer. Major changes happen on Mondays (in any timezone) so expect rapid changes during that time. Things should be generally stable otherwise, but this is the development area, so there are no guarantees.

Deprecated classed that have been renamed to e.g. K3Foo are in kde3support.

This document contains the changes you have to apply to programs written for KDE 3.x when you want to port them to KDE 4.x.

### Table of Contents

- Getting Started
- Global Changes
- Changes in kab
- kdefx porting (kdefx has been removed)
- Changes in kdecore
- Changes in kdeui
- Changes in kio
- Changes in kparts
- Changes in kded
- Changes in kspell
- Changes in kdnssd
- API-cleanup in KHTML
- Changes in kfile
- Changes in kdesu
- KDE Control Center
- Panel Applets and Extensions
- KScreensaver
- I18N
- KSSL
- Mime types names
- KNewStuff
- DCOP
- Printing

### Getting started

As a start you should have a look at doc/html/porting4.html in the Qt package, or this page online.

To start with the porting, you can run "qt3to4 -strict list_of_files" followed by kdesdk/scripts/qt4/adapt-to-qt4-api.pl and kdesdk/scripts/qt4/adapt-to-kde4-api.pl

#### Return to the Table of Contents

### Global Changes

- The "const char *name" arguments in the constructors of QObject derived classes have been removed. Use setObjectName() instead if the object name is really necessary.
- The define KDE_DEPRECATED must be used now at the start of the declaration (but still after an eventual "static", "inline" or "virtual" keyword). KDE_DEPRECATED does not work with constructors, use KDE_CONSTRUCTOR_DEPRECATED instead.

#### Return to the Table of Contents

### Changes in kab

#### Return to the Table of Contents

### Changes in kdefx

kdefx has been removed.

- KStyle moved to kdeui
- Use Solid::Processor instead of KCPUInfo.
- Most of KImageEffect is now available in blitz; the bits that aren't can be done with QPainter.
  - Qt has gradients now, please use them if you can. Otherwise blitz has gradients ala KImageEffect.
- KPixmapEffect was little more than a wrapper around pixmap->image->KImageEffect->image->pixmap. Use the replacements for KImageEffect.
- kdrawutils.h is gone.
  - If you already ported your code to KDE4, your code now has a copy of whatever kdrawutil code you were using.
  - If you haven't ported your code yet, you get to find a copy of what you need in svn's revision history (or in branches/3.5).
- The functionality of KPixmapSplitter cen be emulated with this code, courtesy of Matt Newell:

      QRect getFlowedRect(int index, const QSize &itemSize,
                          int layoutWidth, int h_spacing, int v_spacing)
      {
          // NOTE: if using h_spacing, depending on your use you might want to replace
          // layoutWidth with (layoutWidth + h_spacing)
          int itemsPerRow = layoutWidth / (itemSize.width() + h_spacing);
          return QRect( QPoint( (index % itemsPerRow) * (itemSize.width() + h_spacing),
                                (index / itemsPerRow) * (itemSize.height() + v_spacing) ),
                        itemSize );
      }

- Use QPixmap instead of KPixmap.

#### Return to the Table of Contents

### Changes in kdecore

- kuniqueapp.h => kuniqueapplication.h
- klargefile.h => kde_file.h
- kcatalogue.h => kcatalog.h
- kaccelmanager.h => kacceleratormanager.h
- kprocctrl.h => k3protocolcontroller.h
- KInstance was renamed to KComponentData
- KGlobalAccel moved to kdeui
- KGlobalSettings moved to kdeui
- KIconLoaded moved to kdeui
- KSessionManaged renamed to KSessionManager and moved to kdeui
- KShortcut moved to kdeui

#### KAboutData

- KAboutData::setTranslator needs different parameters now. (Please see the corresponding Doxygen comment for the current state.)
- new catalogName parameter to constructor can be null or empty, then appName is used as catalog name
- all setter methods return object reference, so they can be chained to avoid repeating object name (eg. for addAuthor(), addCredits(), etc.)

I18N_NOOPs in general replaced with KLocalizedString, produced by ki18n()/ki18nc() calls, or just KLocalizedString() if wanted empty. See also the I18N section below.

#### KAccel

Removed. Replaced by the new KAction/QAction framework. See KActionCollection::associateWidget() if you need the old KAccel widget-binding behavior.

#### KAccelAction

- Removed. Replaced by the new KAction/QAction framework.
- [Old note] KDE3 supported 3 modifier key shortcuts and 4 modifier key (3+META) shortcuts, because earlier versions of Qt3 didn't support a META modifier/WIN key. This is changed, so now all shortcuts can be 4 modifier key. All instances of shortcut3 and shortcut4 have been reduced just to "shortcut".
- [Old note] The constructor, init(), and insert() functions now only take only KShortcut "default" argument instead of two
- [Old note] Removed shortcutDefault3() and shortcutDefault4(). Use shortcutDefault() instead

#### KAccelBase

Removed. Replaced by the new KAction/QAction framework.

#### KApplication

- Moved to kdeui. This means no change for GUI applications. For text-based applications, you should consider switching to QCoreApplication + KComponentData. There are two cases:
  - Command-line argument parsing needed: use KCmdLineArgs as usual and then

        QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );

  - No command-line argument parsing needed: simply create a KComponentData (with &aboutData or just a name), and then use

        QCoreApplication app( argc, argv );

- Of course if you don't create a KApplication, then you should turn any "kapp->" into "qApp->" in the rest of the code.
- KApplication does not inherit KInstance/KComponentData anymore. The KComponentData object is available through KGlobal::mainComponent() (if KApplication is the first object to create a KComponentData object, but everything else probably is a bug).
- caption() was moved to KGlobal; you can now use it if you don't have a KApplication object
- makeStdCaption() was moved to KDialog::makeStandardCaption()

- isRestored() should now use qApp->isSessionRestored().
- keyboardMouseState() has been removed, its functionality is now provided by QApplication::keyboardModifiers() and QApplication::mouseButtons()
- random() has been moved to the KRandom class
- For using the kiosk restriction/authorization system you have to use the functions provided in KAuthorized.
- invoke* functions have been moved to ktoolinvocation. there are static methods invoke*, if you want to use slots as before connect to the invoke* slots of KToolInvocation::self()
- startService*, kdeinitExec* have been moved to KToolInvocation
- static void addCmdLineOptions(); has moved to KCmdLineArgs::addStdCmdLineOptions
- getDisplay() has been removed, its functionality is now provided by QX11Info::display()
- cut(), copy(), paste(), clear() and selectAll() were moved to KStandardAction. Rather than creating a copy action and connecting it to kapp just use the KStandardAction::copy
- guiEnabled() was removed, use QApplication::type() instead.
- ref()/deref() was moved to KGlobal (as static methods)
- geometryArgument was removed, please use:

           QString geometry;
           KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde");
           if (args && args->isSet("geometry"))
              geometry = args->getOption("geometry");

- installSigpipeHandler() was removed.
- propagateSessionManager(), requestShutDown() methods and associated ShutdownConfirm, ShutdownType and ShutdownMode enums have been moved into the kworkspace library (which is found in kdebase/workspace/lib); the methods are static functions in KWorkspace namespace.
- The shutDown() signal has been removed, use QApplication's signal aboutToQuit()
- enableStyles(), disableStyles(), and the constructor argument has been removed.
- installKDEPropertyMap has been moved into k3sqlpropertymap.h and renamed to kInstallKDEPropertyMap. It can be used to keep old c ode that uses the Q3Data* classes working.For new code, use User in the meta object to determine which Q_PROPERTY to use for any widget.

            const QMetaObject *metaObject = widget->metaObject();
            for (int i = 0; i < metaObject->propertyCount(); ++i) {
              const QMetaProperty metaProperty = metaObject->property(i);
              if (metaProperty.isUser()) {
                QString propertyToUse = metaProperty.name();
                break;
              }
            }

- caption() has moved to KComponentData
- makeStdCaption(const QString&, bool, bool) has moved to KDialog and changed signature to makeStdCaption(const QString&, CaptionFlags)
- addKipcEventMask() is unneeded now, and the signals like settingsChanged(), fontChanged() etc. with enums SettingsCategory have moved to KGlobalSettings::self() which is now a QObject
- updateRemoteUserTimestamp() now takes DBUS service id instead of dbus name (i.e. something like org.kde. needs to be prepended)

#### KAudioPlayer

Removed, use now Phonon::AudioPlayer

#### KCatalogue

Renamed to KCatalog. Method name parts with "catalogue" have been renamed to use "catalog" instead.

#### KCharsets

- KCharsets::codecForName cannot use glibc's i18n data anymore. (Note: this feature was new in KDE 3.5 but never publicly announced.)
- The user-visible encoding names are now mostly upper-case (instead of being always lower-case).
- KCharsets::languageForEncoding should be replaced by KCharsets::descriptionForEncoding. The function KCharsets::languageForEncoding is planned to be removed before the release of KDE4.
- The status of the encoding UTF-7 is not guaranteed to be kept, as Qt does not support this encoding.
- TODO: see which member functions can be removed. The functions handling entites are planned to be moved out of the class KCharsets.

#### KCodecs

- All methods using a QCString removed. The methods use QByteArray now.
- Header renamed to kcodecs.h

#### KConfigBackend

- Removed filename(), use fileName()

#### KSimpleConfig

This class was removed. It was a very thin wrapper around KConfig and should be replaced.

- If you use an absolute path, just change KSimpleConfig with KConfig - there was no difference between uses of them for KDE3 either.
- If you want just the local file to open replace KSimpleConfig("file") with KConfig("file", KConfig::SimpleConfig);

#### KConfig

- setGroup is deprecated as it creates state. Use group(QString) to receive a KConfigGroup object or create a KConfigGroup object yourself:

      KConfig *config = KGlobal::config();
      config->setGroup("Group");
      config->writeEntry("Key", 0);

  should be rewritten as

      KConfigGroup config = KGlobal::config()->group("Group");
      config.writeEntry("Key", 0);

- setDesktopGroup is gone. Use KDesktopFile (and its desktopGroup() method) if you want to read .desktop files - or use group("Desktop Entry") instead
- It's no longer necessary to specify a KConfig object is read-only - they are always unless you use change it
- The KConfig constructors were changed to receive flags instead of boolean values, i.e.
  - `KConfig("file", false /* read-write */, false /* no globals */);` becomes `KConfig("file", KConfig::NoGlobals);` (note the read-write flag is gone)
  - `KConfig("file", true);`becomes `KConfig("file");`

#### KConfigBase

- all read*Entry methods deprecated, use template <typename T> readEntry(key, const T&) in KConfigGroup instead. This uses QVariant in the background so only types that QVariant can convert to QString work. The use of QVariant allows some ambiguous conversions, so it might be necessary to use explicit construction to disambiguate the type wanted, i.e.
  - bool var = readEntry(key, false);
  - int var = readEntry(key, int(SomeEnumValue));
  - QColor var = readEntry(key, QColor(Qt::black)); // no conversion from Qt::GlobalColor to QVariant
  - long var = readEntry(key, 0); // conversion from long to QVariant is ambiguous, so can't use long(0).
  If you need to access top-level config entries (those without any group), use KConfigGroup with the group name <default>.
- readEntry(const QString&, const QString&) no longer has a default argument, add QString() as second argument.
- all writeEntry* methods removed, mostly not noticeable, but some types don't automatically convert to QVariant. You need to cast to a type that is directly convertible to QVariant. i.e.

      time_t timeVal;
      group.writeEntry("someKey", timeVal); // ambiguous conversion
      group.writeEntry("someKey", int(timeVal)); // ok

- all read*ListEntry methods deprecated, renamed to KConfigGroup::readEntry. Most types use the template version.
  template <typename T> readEntry(key, const QList<T>&)
  If you just write group.readEntry(key, list) it should work for any type that QVariant can convert to QString.
- writeEntry, deleteGroup, and deleteEntry do not take several boolean options (persistent,global,localized) anymore, but instead one QFlags

#### KConfigGroupSaver

The class KConfigGroupSaver has been removed, instead use KConfigGroup. The difference is a KConfigGroupSaver object directly affects the config object it is acting on, while a KConfigGroup object only ensures the entries read or written through it are in the correct group.

Instead of:

    KConfig *config = KGlobal::config();
    KConfigGroupSaver saver(config, "group name");
      ...
    config->readXXX("entry name");

should be rewritten as:

    KConfigGroup cg = KGlobal::config()->group("group name");
      ...
    cg.readXXX("entry name");

#### KCmdLineArgs

- static void init(int _argc, char **_argv, const char *_appname, const char *_description, const char *_version, bool noKApp = false) KDE_DEPRECATED; -> static void init(int _argc, char **_argv, const QByteArray &appname, const QByteArray &catalog, const KLocalizedString &programName, const QByteArray &version, const KLocalizedString &description = KLocalizedString(), StdCmdLineArgs stdargs=StdCmdLineArgs(CmdLineArgQt|CmdLineArgKDE)));
- noKApp parameter is gone, instead: Q_FLAGS(StdCmdLineArgs)
- new catalog parameter can be null or empty, then appname is used as catalog name
- KLocalizedString objects produced by ki18n()/ki18nc() calls (instead of previous I18N_NOOPs), or just KLocalizedString() if needed empty
- static void usage(const QString &error) -> static void usageError(const QString &error)

#### KCmdLineOptions

Now a proper class, instead of statically initialized struct. Use add() method for adding options (option syntax same as before); add() returns object reference, so calls can be chained to avoid repeating variable name all the way.

#### KComponentData (was KInstance)

- value based class using shared data: In KDE4 don't work with pointers to KComponentData anymore. Internally it is reference counted and the data deleted when the last reference goes out of scope.
- config() returns a KSharedConfigPtr
- sharedConfig() was removed in favour of config()
- iconLoader() was moved to KApplication
- newIconLoader() was moved to KApplication

#### kdDebug/kdWarning/kdFatal

These functions have been renamed to `kDebug`, `kWarning`, `kFatal`, resp. They now print the function info, so printing the function name by hand, or using `k_funcinfo` is now deprecated. An `endl` is performed implicitly. The type of stream used is now `QDebug`.

Instead of repeating the debug area all over the place, define `KDE_DEFAULT_DEBUG_AREA` instead:

    - kdDebug( 1234 ) << k_funcinfo << "entered" << endl;
    + kDebug() << "entered";

And, in your `CMakeLists.txt`:

    + add_definitions( -DKDE_DEFAULT_DEBUG_AREA=1234 )

#### KDesktopFile

- QString filename() const -> QString fileName() const
- more standards compliant. See Desktop Entry Spec
  - .kdelnk files are no longer supported, rename to .desktop.
  - deprecated header [KDE Desktop Entry], change to [Desktop Entry], using desktopGroup()
  - type FSDev is no longer supported, change to FSDevice
- Same as in KConfig: the use of readEntry() or writeEntry() on a KDesktopFile should be replaced by readEntry/writeEntry on a KConfigGroup. By default the desktopGroup() of the KDesktopFile was used, otherwise use group("another_group").

#### KExtendedSocket

This class has been removed. See below on KNetwork::K*Socket.

#### KFilterDev

- device() -> createDevice() to indicate that you must delete the device afterwards.

#### KGlobal

- "int kasciistricmp( const char *str1, const char *str2 )" has been moved into kascii.h
- "KIconLoader* iconLoader()" has been moved to KIconLoader::global()
- instance() renamed to mainComponent()
- activeInstance() renamed to activeComponent()
- setActiveInstance() renamed to setActiveComponent()
- static members _locale, _instance and so on are private now, if you want to get or set the KLocale use locale()/setLocale()/hasLocale() and if you want to know whether a mainComponent is set use hasMainComponent()
- config() returns a KSharedConfig::Ptr now instead of KConfig*
- sharedConfig() has been removed in favour of config()

#### KIcon

Deprecated and renamed to K3Icon; replacement is KIcon in kdeui.

Note: at the moment you have to keep using K3Icon as a namespace for states, groups, and contexts though.

#### KInstance

Renamed to KComponentData

#### KIPC

Removed. Use KGlobalSettings::self()->emitChange() instead of KIPC::sendMessageAll().

#### KKey

Removed. Use plain ints as the Qt key code instead.

- When replacing KKey(QKeyEvent*), you need to OR the event->key() and event->modifiers() to get the replacement.
- The QtWIN enum has been removed. Use Qt::META or Qt::MetaModifier instead.
- modFlagLabel() was removed, use either KKeyServer::modToStringUser(), or QKeySequence(Qt::yourmodifier).toString()

#### KKeyNative

Removed. Use plain ints as the Qt key code instead.

#### KKeySequence

Removed. Use QKeySequence instead. Note that QKeySequence expects multiple shortcuts to be separated by ", " (i.e. a comma then a space) in converting from text.

#### KLibLoader

- use KPluginLoader or KService::createInstance instead whenever possible
- The resolve(const char* name) and symbol(const char* name) methods were merged and renamed to resolveSymbol
- bool hasSymbol was removed, use resolveFunction instead
- resolveFunction( const char* name ) was added which returns not a void* but a KLibrary::void_function_ptr which can be used as a void* would in boolean tests and for making subsequent function calls.

#### KLibFactory

- renamed to KPluginFactory
- create methods take a QVariantList instead of QStringList

#### KGenericFactory

- use K_PLUGIN_FACTORY macro instead: this will require to change your plugin constructor from QStringList to QVariantList
- instead of K_EXPORT_COMPONENT_FACTORY use K_EXPORT_PLUGIN (defined with KPluginLoader) which adds Qt and kdelibs version information that KPluginLoader uses to check the validity of the plugin.

#### KLocale

- QString formatNumber(const QString &numStr) const -> QString formatNumber(const QString &numStr, bool round=true, int precision=2) const;
- bool weekStartsMonday() const -> int weekStartDay() const
- QString monthName(int i, bool shortName = false) const -> QString KCalendarSystem::monthName (int month, int year, bool shortName = false) const = 0; or QString KCalendarSystem::monthName (const QDate & date, bool shortName = false ) const = 0;
- QString weekDayName(int i, bool shortName = false) const -> calendar()->weekDayName
- QString monthNamePossessive(int i, bool shortName = false) const -> calendar()->monthNamePossessive()
- void setWeekStartsMonday(bool start) -> setWeekStartDay
- QString formatDate(const QDate&, bool shortFormat = false) const -> QString formatDate(const QDate&, DateFormat = LongDate) const
- QString formatDateTime(const QDateTime&, bool shortFormat = true, bool includeSecs = false) const -> QString formatDateTime(const QDateTime&, DateFormat = ShortDate, bool includeSecs = false) const
- languages() -> languageList()
- formatMoney(const QString &numStr) -> QString formatMoney(double num, const QString & currency = QString::null, int digits = -1) const;
- charset() -> gone
- setCharset() -> gone
- removeCatalogue was renamed to removeCatalog
- QStringList languagesTwoAlpha() -> QStringList languageList()
- QStringList allLanguagesTwoAlpha() -> QStringList allLanguagesList()
- QStringList allCountriesTwoAlpha() -> QStringList allCountriesList()
- QString twoAlphaToLanguageName(const QString &language) -> QString languageCodeToName(const QString &language)
- QString twoAlphaToCountryName(const QString &country) -> QString countryCodeToName(const QString &country)

See also the I18N section below.

#### KMacroExpander

- KMacroExpander now takes a QHash and not a QMap

#### KMimeSourceFactory

KMimeSourceFactory was automatically instanciated by KApplication which allowed the use of "icon:name" in Qt richtext. Q3MimeSourceFactory being in Qt3Support, and this feature being very rarely used, K3MimeSourceFactory isn't instanciated automatically anymore, you need to call K3MimeSourceFactory::install() in your main if you still depend on this feature.

#### KMultipleDrag

KMultipleDrag is obsolete, use QMimeData directly to provide contents in different mime formats.

To make porting more incremental, K3MultipleDrag is provided for code that needs to work with Q3DragObject until being fully ported.

#### KNetwork::KIpAddress

Removed. Use QHostAddress instead.

#### KNetwork::KResolver

Removed. If you need to resolve a hostname, use QHostInfo from QtNetwork.

#### KNetwork::KSocketAddress and KNetwork::KInetSocketAddress

Removed. Use QHostAddress and an integer (a quint16_t) to store the port number.

#### KNetwork::KUnixSocketAddress

Removed. Simply use a QString to represent the path or identifier. See the documentation on KLocalSocket.

#### KNetwork::K*Socket

- All of these classes are deprecated. Use the QTcpSocket, QUdpSocket and QTcpServer equivalents from QtNetwork.
- When porting, use KSocketFactory when creating any sockets that are used to communicate with remote hosts (that is, anything that is not "localhost"). Examples follow:
  Connecting to a remote host:

  Old code:

        QString host;
        int port;

        KBufferedSocket *socket = new KBufferedSocket(parent);
        if (!socket->connect(host, QString::number(port))) {
            // error happened
            // deal with it
        }
        connect(socket, SIGNAL(connected(KResolverEntry)), SLOT(socketConnected()));
        connect(socket, SIGNAL(gotError(int)), SLOT(socketError(int)));

  New code:

        QString protocol;
        QString host;
        int port;
        QUrl url(QString("%1://%2:%3").arg(prototocol, host).arg(port));

        QTcpSocket *socket = KSocketFactory::connectToHost(protocol, host, port, parent);
        // alternatively:
        // QTcpSocket *socket = KSocketFactory::connectToHost(url, parent);
        connect(socket, SIGNAL(connected()), SLOT(socketConnected()));
        connect(socket, SIGNAL(error(QAbstractSocket::SocketError), SLOT(QAbstractSocket::SocketError)));

  Opening a socket for receiving remote connections:

  Old code:

        int port;

        KServerSocket *ss = new KServerSocket(QString::number(port), parent);
        connect(ss, SIGNAL(readyAccept()), this, SLOT(slotReadyAccept()));
        connect(ss, SIGNAL(gotError(int)), this, SLOT(slotSocketError(int)));
        ss->listen();

  New code:

        QString protocol;
        int port;

        QTcpServer *ts = KSocketFactory::listen(protocol, QHostAddress::Any, port, parent);
        connect(ts, SIGNAL(newConnection()), this, SLOT(slotReadyAccept()));

- Caveat: all member functions in QTcpSocket are asynchronous and buffered. There's no equivalent "blocking" mode for QTcpSocket. If you need an action to complete, you have to use `waitForReadyRead` and `flush` (or `waitForBytesWritten`) in the socket object. If you need to wait for a connection to be established, use `KSocketFactory::synchronousConnectToHost`.

#### KNotifyClient

Replaced by KNotification. The API is quite similar, but the config file need to be updated. See KNotification documentation, and the file kdelibs/knotify/PORTING.html

#### KProcess

The kde3 version was deprecated and renamed to K3Process, header is k3process.h. Its usage is discouraged as it will create problems when being used together with the new KProcess or QProcess in the same application, this is more of a problem in applications that use KParts or plugins and can't control what those plugins do.

- start() lost all arguments, the setup of communication and program/arguments has to be done before starting the process
- suspend() and resume() where removed for now
- quoting support moved to KShell namespace
- getPid() was renamed to just pid()
- clearArguments() was renamed to clearProgram()

#### KProcCtrl

Deprecated and renamed to K3ProcessController, header is k3processcontroller.h.

#### KProcIO

Deprecated and renamed to K3ProcIO, header is k3procio.h.

#### KRegExp

Removed. Use QRegExp instead.

#### KRFCDate

This class has been deprecated by KDateTime. It has been renamed K3RFCDate and moved to the libkde3support. The following method changes make porting easy:

- KRFCDate::parseDate( string ) becomes KDateTime::fromString( string, KDateTime::RFCDate).toTime_t();
- KRFCDate::parseDateISO8601( string ) becomes KDateTime::fromString( string ).toTime_t();
- KRFCDate::localUTCOffset() becomes KDateTime::Spec::LocalZone().utcOffset / 60. Note that the KRFCDate version returned minutes while KDateTime returns seconds.

#### KSaveFile

- KSaveFile has been modified from its KDE 3.x behavior to allow for new backup methods:
  - KSaveFile::backupFile() will use the backup behavior specified in KConfig.
  - KSaveFile::simpleBackupFile() will emulate the KDE 3.x behavior
  - KSaveFile::numberedBackupFile() will create a numbered set of backup files (default: 10)
  - KSaveFile::rcsBackupFile() will use rcs to maintain the backup file
- KSaveFile now derives from QFile so you can use it just like you would use a normal QFile. The close() function has been renamed to finalize(). Use the error() and errorString() functions to check for errors instead of status().
- KSaveFile::close() is now KSaveFile::finalize()
- You must call KSaveFile::open() to create the file.

#### KShortcutDialog

Removed, see KKeySequenceWidget/KShortcutWidget.

#### KShortcutList and derivatives

Removed - no longer needed. Saving and loading of shortcuts is now performed in KActionCollection, KGlobalAccel, and KStandardShortcut.

#### KSortableValueList

- Has been ported to QList, renamed to KSortableList and the header is ksortablelist.h

#### KStandardDirs

- boolean values as parameters for recursive, unique and checking for executability in the following methods were changed to instead take SearchOptions flags for improved code readability:
  - calcResourceHash
  - findAllResources
  - findResource
  - findExe
  - findAllExe

#### KStandardShortcut (was KStdAccel)

- Removed deprecated methods
- Removed WhatThis, use WhatsThis
- shortcutDefault3() and shortcutDefault4() have been removed, use shortcutDefault() instead

#### KStaticDeleter

Either use K3StaticDeleter or port to the K_GLOBAL_STATIC macro.

#### KStdAccel

Renamed to KStandardShortcut

#### KStringHandler

- static QString ljust( const QString &text , int width ) -> QString::leftJustified
- static QString rjust( const QString &text , int width ) -> QString::rightJustified
- matchFilename -> matchFileName
- static QString word( const QString &text , int pos ) -> QString::section
- ::randomString() has been moved to KRandom::randomString()
- ::lPixelSqueeze( text, fm, width ) -> fm.elidedText( text, Qt::ElideLeft, width )
- ::cPixelSqueeze( text, fm, width ) -> fm.elidedText( text, Qt::ElideMiddle, width )
- ::rPixelSqueeze( text, fm, width ) -> fm.elidedText( text, Qt::ElideRight, width )

#### KTempDir

- existing() was removed, use exists() instead
- setAutoDelete() renamed to setAutoRemove()
- The default for setAutoRemove() is now true instead of false
- qDir() was removed as it was unused

#### KTempFile

Deprecated and renamed to K3TempFile. Use KTemporaryFile instead.

When porting old KTempFile calls to KTemporaryFile, you need to remember that KTempFile by default will not automatically remove the fileonce the object is destroyed, but KTemporaryFile will! You also need to call open() in order to actually create the file.

#### KURL

- Renamed to KUrl, but a typedef is available for source compatibility
- KUrl inherits QUrl now, but the API offered by KUrl is mostly unchanged
- filename() has been removed, use fileName() instead
- isMalformed -> !isValid()
- prettyURL(0,KUrl::StripFileProtocol) -> pathOrURL()
- fromPathOrURL() is deprecated, use the KUrl(str) constructor which now accepts both paths and urls
- htmlURL() had to be removed, please use Qt::escape(url.prettyUrl()) now, with #include <QTextDocument>. This requires libQtGui, which is why it can't be in KUrl anymore.
- url(0,106) or any other use of the 'mib enum' for encoding has been removed. QUrl is UTF8 based, and the world is becoming more and more utf8 based as well, the old encoding hacks inside urls should disappear.
- Runtime behavior change: port() used to return 0 if no port was specified. It now returns -1 in that case, or you can use port(defaultPort) to set what it should return if no port was specified.
- adjustPath(), path(), encodedPathAndQuery() , url() , prettyUrl() was taking a int argument for handling trailing slash that has been replaced by an enum AdjustPathOption (0 => KUrl::LeaveTrailingSlash, 1 => KUrl::AddTrailingSlash, -1 => KUrl::RemoveTrailingSlash).
- cleanPath(), queryItems(), fileName(), directory(), equals() now take a QFlags argument instead of boolean
- *URL* renamed to *Url*:
  - hasSubURL() -> hasSubUrl()
  - prettyURL() -> prettyUrl()
  - pathOrURL() -> pathOrUrl()
  - upURL() -> upUrl()
  - isRelativeURL() -> isRelativeUrl()
  - relativeURL() -> relativeUrl()

#### KURLDrag

This class has been moved to kde3support. Use KUrl::populateMimeData() and KUrl::List::populateMimeData() in the drag/copy side, and the static methods KUrl::List::canDecode() and KUrl::List::fromMimeData() in the drop/paste side.

- Example: Replace

        KURL::List uriList;
        if ( KURLDrag::canDecode(e) && KURLDrag::decode( e, uriList ) ) {

  by

        KUrl::List uriList = KUrl::List::fromMimeData( e->mimeData() );
        if ( !uriList.isEmpty() ) {

#### KVMAllocator

Removed, as it was unused.

#### KWin

This class has been merged with KWinModule into class KWindowSystem (in kdeui).

- appStarted() removed, use KStartupInfo::appStarted() instead
- info(WId win) removed, use windowInfo() instead
- struct Info was removed, use WindowInfo instead

#### KWinModule

This class has been merged with KWinModule into class KWindowSystem (in kdeui). Don't create instances, use static functions and KWindowSystem::self() for connecting to signals.

- Functions related to systemtray have been removed. They worked only with the obsolete KDE systray mechanism.
- stackingOrder() no longer returns a reference to a list. Make a copy of the value first if using iterators.

#### KWin::WindowInfo

This class has been renamed KWindowInfo and moved to its own header: KWindowInfo or kwindowinfo.h. This class is not to be confused with KWindowInfo in KDE3 which was a small utility class to display message in the window icon and title. KWindowInfo represents the windowing system information for a give window, such as its geometry, desktop positioning, type, name, etc.

#### locate

- locate() and locateLocal() moved into the namespace KStandardDirs

#### NETRootInfo

- NETRootInfo(Display *display, Window supportWindow, const char *wmName,unsigned long properties, int screen = -1, bool doActivate = true) -> NETRootInfo(Display *display, Window supportWindow, const char *wmName, const unsigned long properties[], int properties_size, int screen = -1, bool doActivate = true); old properties is the first element of the new array
- unsigned long supported() -> const unsigned long* supportedProperties() const;
- unsigned long properties() const -> gone
- WindowType windowType() -> WindowType windowType( unsigned long supported_types ) const;

#### Return to the Table of Contents

### Changes in kdeui

- kactionclasses.h went away, use the several kxxxaction.h instead
- kanimwidget.h was renamed to kanimatedbutton.h to reflect the class name
- kcolordlg.h went away, use kcolordialog.h
- kcolorbtn.h went away, use kcolorbutton.h
- kdatapik.h went away, use kdatepicker.h
- kdualcolorbtn.h went away, use kdualcolorbutton.h
- KLanguageButton (and therefore klanguagebutton.h) was removed due to licensing issues (GPLv2, which is not allowed in kdelibs)
- klistbox.h was renamed to klistwidget.h to reflect the class name
- kpassdlg.h went away, use kpassworddialog.h
- kxmlgui.h went away, use kxmlguifactory.h
- kfontcombo.h went away, use QFontComboBox
- libkwalletclient (which used to provide the KWallet class) has been merged with kdeui
- system color scheme accessors in kglobalsettings.h are deprecated, use kcolorscheme.h
- KPalette was renamed to KColorCollection
- KPaletteTable was renamed to KColorTable and moved to private API

#### KAboutContainer

Deprecated and renamed to K3AboutContainer. Use KAboutApplicationDialog or KAboutKdeDialog directly.

- KAboutContainer constructor int args have been replaced by Qt::Alignment
- addTitle int args replaced by Qt::Alignment
- addImage int args replaced by Qt::Alignment

#### KAboutContributor

Deprecated and renamed to K3AboutContributor. Use KAboutApplicationDialog or KAboutKdeDialog directly.

- void setURL( const QString& ) -> void setUrl( const QString& )
- QString getName( void ) const -> QString name() const
- QString getEmail( void ) const -> QString email() const
- QString getURL( void ) const -> QString url() const
- QString getWork( void ) const -> QString work() const
- signal void openURL() -> void openUrl()

#### KAboutDialog

Deprecated and renamed to K3AboutDialog. Use KAboutApplicationDialog or KAboutKdeDialog directly.

- changed enum names

        AbtPlain         -> Plain
        AbtTabbed        -> Tabbed
        AbtTitle         -> Title
        AbtImageLeft     -> ImageLeft
        AbtImageRight    -> ImageRight
        AbtImageOnly     -> ImageOnly
        AbtProduct       -> Product
        AbtKDEStandard   -> KDEStandard
        AbtAppStandard   -> AppStandard
        AbtImageAndTitle -> ImageAndTitle

- Constructor: K3AboutDialog( QWidget *parent = 0, bool modal = true ) -> KAboutDialog( QWidget *parent = 0 )
- Constructor: K3AboutDialog( int dialogLayout, const QString &caption, ButtonCodes buttonMask, ButtonCode defaultButton, QWidget *parent=0, bool modal=false, bool separator = false, const QString &user1 = QString(), const QString &user2 = QString(), const QString &user3 = QString() ) -> K3AboutDialog( int dialogLayout, const QString &caption, QWidget *parent = 0 ) (see KDialog how to port)
- void setIcon( const QString &fileName ) which was deprecated has been removed
- addContainerPage int args are now Qt::Alignment args
- addScrolledContainerPage int args are now Qt::Alignment args
- addContainer int args are now Qt::Alignment args
- signal void openURL() -> void openUrl()
- void imageURL() -> void imageUrl()
- void openURLSlot() -> void openUrlSlot()

#### KAboutWidget

Deprecated and renamed to K3AboutWidget. Use KAboutApplicationDialog or KAboutKdeDialog directly.

- signal void openURL() -> void openUrl()
- void openURLSlot() -> void openUrlSlot()

#### KAction

Making KAction a subclass of QAction (actually QWidgetAction) brings KDE more into line with the Qt way of creating user interfaces, improves accessibility, and removes code duplication.

QAction in Qt4 is a true first-class citizen - all QWidgets now have a list of associated actions, and QToolBar, QMenu etc. all use this list directly to show the graphical items (widgets, entries in the menu, etc). This has replaced all usage of integers as "id"s. There is also a new QEvent (QActionEvent), and the corresponding virtual protected function in QWidget, actionEvent().

- KAction is now a subclass of QWidgetAction.
- For actions that are mostly in menus, you should port setToolTip to setStatusTip. The goal in kde3 was mostly to see the help text in the status bar, while in Qt4 setToolTip has no effect on menu items.
- Don't use setIconSet() anymore, use setIcon(KIcon(iconName)) instead
- activated(), activated(int) signals deprecated - use triggered() signal instead
- activate() is now trigger(), as in QAction
- there is a replacement for activation providing keyboard + mouse states, see triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) [currently buggy]
- plugAccel(), unplugAccel(), kaccelCount() removed - they have no use now (accelerator management is inside Qt)
- itemId(), getToolButtonID() removed - actions no longer have ids, basically the QAction* is its replacement
- setGroup() / group() removed - use QActionGroup instead (setActionGroup() / actionGroup())
- ActivationReason has been removed (not supported by Qt). For a surrogate, you can connect to QMenu::triggered(QAction*), QToolBar::actionTriggered(QAction*), etc.
- setters are no longer slots; where they were used as such, an intermediary will be required
- New feature from Qt: statusTip() / setStatusTip(). Usually this will be the same as the tooltip. It appears in the status bar whenever the action is hovered in a QMenu. A porting convenience is being investigated for automatic toolTip() -> statusTip(), but the best solution is to set both.
- New feature: globalShortcut() and globalShortcutAllowed(). Automatically communicates with KGlobalAccel to register a global shortcut (i.e. one that does not need the application to have focus to be activated).
- setShortcut() now defaults to setting the default shortcut as well (as it was by far the most common use case). To just set the custom shortcut, use setShortcut(myShortcut, KAction::CustomShortcut)
- Renamed "Custom" shortcuts to "Active" shortcuts.
- Added setShortcut(QKeySequence &) to explicitly override QAction::setShortcut.
- Functions in KActionCollection or KXMLGUIFactory for example don't take or return KAction pointers anymore but instead operate on QAction pointers. If you get compilation errors with code like the following then just replace KAction with QAction:

      QAction *a = actionCollection()->action("foo");
      ...

  Also if you get errors about KAction being an unknown type it is often enough to forward declare KAction in your header file.
- plug() -> QWidget::addAction()
- unplug() -> QWidget::removeAction()
- isPlugged() -> !action->associatedWidgets().isEmpty()
- containerCount() -> action->associatedWidgets().count()
- container(int i) -> action->associatedWidgets().value(i)
- hasIcon() -> !action->icon().isNull()
- setIconName(string) -> setIcon(KIcon(string))
- unplugAll() -> Rarely needed, but if you are sure that you need it replace it with the following code:

      foreach (QWidget *w, action->associatedWidgets())
          w->removeAction(action);

- The KAction constructors changed completely. The constructors taking various action properties, a pointer to an acion collection and the name of the action have been removed. The new pattern is to create the actions like regular QObjects with a parent (owner). Then you set various properties using setText, setIcon, etc. . As a last step the action can be added to the action collection with a name.

      KAction *a = new KAction(this);
      a->setText(i18n("I am ported"));
      a->setIcon(KIcon("shiny"));
      a->setShortcut(Qt::ControlModifier + Qt::Key_A);
      actionCollection - > addAction("name_of_the_action", a);

  KActionCollection additional provides convenience overloads for creating named KAction objects or standard actions (KStandardAction). For example:

      QAction *a = actionCollection -> addAction("action_name");
      a->setText(i18n("I have been ported, too"));
      connect(a, SIGNAL(triggered()), this, SLOT(portedToKde4()));

      actionCollection -> addAction(KStandardAction::Copy, this, SLOT(copy()))

#### KActionCollection

- constructor (QWidget* watch, ..) and setWidget() replaced by associateWidget() - allows actions to respond to matching key presses on a widget level (basically a convenience method to have all actions in the collection added to the associated widget(s) and their shortcut scopes set to Qt::WidgetShortcut). (note: associateWidget() replaces {set|add|remove}AssociatedWidget() from kde4 beta)
- *AutoConnectShortcuts removed - irrelevant
- *accel() removed - irrelevant (KAccel no longer handles key presses)
- New functions setConfigGroup(), setConfigGlobal(), configGroup(), configIsGlobal() - the action collection now stores the group whether the config is global. referenced in readSettings() / writeSettings()
- readShortcutSettings() and writeShortcutSettings() renamed without the "Shortcut". Set the configGroup() with setConfigGroup() either prior to each call, or (preferably) at the creation time of the action collection.
- {set}HighlightingEnabled(), {connect|disconnect}Highlight() removed - highlighting is always enabled now
- actionHighlighted(), actionStatusText(), clearStatusText() removed - use QAction::setStatusTip() as a replacement. QStatusBars belonging to QMainWindow automatically get the statusTip() applied to them when they are moused over in a QMenu, via a QStatusTipEvent.
- groups() removed (now using QActionGroups) - see actionGroups() (and actionsWithoutGroup()) for replacement
- actions( const QString& group ) removed - use actionGroups() instead, and then QActionGroup::actions()
- action(const char* name, const char* className) removed: action(const QString& name), actions(const QString& name), actionOfType<Class>(const QString& name), actionsOfType<Class>(const QString& name) are the replacements
- insert(KAction *) -> addAction(const QString &name, QAction *action)
- remove(KAction *) -> removeAction(QAction *action)
- take(KAction *) -> takeAction(QAction *action)

#### KActionSelector

- Q3ListBox -> QListWidget
- selectedListBox -> selectedListWidget
- availableListBox -> availableListWidget

#### KActionSeparator

Used to be renamed to KSeparatorAction. KSeparatorAction/KActionSeparator is dead now. Just create a QAction object and call setSeparator(true); on it.

Note: you need to create multiple separator actions if you want to insert multiple separators into a widget, unlike with KDE3.

#### KActiveLabel

Deprecated and renamed to K3ActiveLabel. Use QLabel instead.

- Use QLabel::setOpenExternalLinks(true) for labels with hyperlinks.
- Use QLabel::setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard) for labels whose text should be selectable by user.
- Inherits from KTextBrowser instead of Q3TextBrowser
- You don't need anymore to disconnect the linkClicked signal to handle manually link, use KTextBrowser::setNotifyClick(true)
- linkClicked -> KTextBrowser::urlClick

#### KAnimatedButton (was KAnimWidget)

- Now a subclass of QToolButton, acts in a much more standard fashion
- size(), setSize() replaced by iconSize(), setIconSize()
- Call updateIcons() whenever you change the iconSize() (the setter is non-virtual :( )

#### KAnimWidget

Renamed to KAnimatedButton

#### KAuthIcon

Removed since it was not used.

#### KBugReport

- void updateURL() -> void updateUrl()

#### KButtonBox

Deprecated and renamed to K3ButtonBox. Use KDialogButtonBox instead. Add the role parameter to the addButton function. Or check if it can't be achieved using KDialog.

#### KCharSelectTable

Removed from public API. Use KCharSelect.

#### KCharSelect

- Cleaned up constructor, removed char, font and table arguments. The concept of showing tables isn't used any more and all functions/signals are removed. There is no need for a replacement.
- highlighted()/focusItemChanged()/activated() -> currentCharChanged(QChar)
- doubleClicked() -> charSelected(QChar)
- setFont()/font() -> setCurrentFont()/currentFont()
- fontChanged() -> currentFontChanged()
- QFont is used for fonts instead of a QString containg the font face.
- setChar()/chr() -> setCurrentChar()/currentChar()
- enableFontCombo(), enableTableSpinBox(), isFontComboEnabled() and isTableSpinBoxEnabled() are removed.

#### KColorCells

- KColorCells now inherits from QTableWidget instead of Q3GridView.
- numCells() has been replaced by count().
- getSelected() has been replaced by selectedIndex().
- The parameters of the colorSelected() and colorDoubleClicked() signals now include both the index of the color which was selected and the color itself as arguments

#### KColorCollection (was KPalette)

- nrColors() was renamed to count()
- colorName() was renamed to name()
- getPaletteList() was renamed to installedCollections()
- color(int), name(int) and name(const QColor&) have been made const

#### KColorDrag

Deprecated and renamed to K3ColorDrag. Use QMimeData directly instead or KColorMimeData, which most closely resembles KColorDrag

#### KColorScheme

New class that provides access to system-wide, user configurable color roles. Like QPalette, the return type is now QBrush instead of QColor. As of 4.0 the brushes are solid colors, but this may change in the future.

Warning: KDE4 is trying really hard to abandon the notion that the active palette == the inactive palette (because this is really helpful for the oxygen windeco which does not use "traditional" windeco colors, and because for various reasons kwin can't be entirely responsible for the effect). When porting to KDE4, you will need to take this into consideration. The new class KStatefulBrush has been added to help with this, as well as the adjustForeground and adjustBackground methods of KColorScheme.

There are lots of bugs as a result of this; some in applications, and at least a few in Qt. Please report application bugs to the appropriate maintainer or list, and general (i.e. occurring in many/all applications) bugs to k-c-d.

See the KColorScheme documentation for further information.

#### KColorTable (was KPaletteTable)

- palette() was renamed to name()
- slot setPalette() was renamed to slot setColors()

#### KComboBox

- void setURLDropsEnabled() -> void setUrlDropsEnabled()
- bool isURLDropsEnabled() -> bool urlDropsEnabled()
- void setEditURL() -> void setEditUrl()
- void addURL( ... ) -> void addUrl( ... )
- void insertURL( ... ) -> void insertUrl( ... )
- void changeURL( ... ) -> void changeUrl( ... )

#### KCommand

Deprecated and renamed to K3Command, header is k3command.h. Use QUndoCommand instead.

#### KCommandHistory

Deprecated and renamed to K3CommandHistory, header is k3command.h. Use KUndoStack instead.

#### KCompletion

- enableSounds() was removed, use setSoundsEnabled()
- disableSounds() was removed, use setSoundsEnabled()
- isSoundsEnabled() -> soundsEnabled()

#### KConfigDialog

- The dialog name is now a QString instead of a const char*
- signal void settingsChanged(const char *dialogName); -> void settingsChanged(const QString& dialogName);
- signal void settingsChanged(); has disappeared - use the signal with the parameter instead. If you don't need the parameter don't connect it, e.g

      connect(myDialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(mySlot()));

#### KContextMenuManager

- KContextMenuManager::insert() :

  Old code:

      KContextMenuManager::insert(widget, menu);

  New code:

      widget->setContextMenuPolicy(Qt::ActionsContextMenu);
      widget->addActions(menu->actions());

- Otherwise consider handling the context menu in a contextMenuEvent() handler, which Qt calls automatically on a right-mouse-button click or on activation by the context menu key. There's no need to do anything in mousePressEvent/mouseReleaseEvent/keyPressEvent.

#### KCursor

- KCursor is now a QCursor, allowing for loading of non-standard icons from themes
- The static methods for loading various cursor types are gone, just use QCursor( Qt::CursorShape ) directly instead

#### KDatePicker

- signal void dateChanged(QDate); was replaced by void dateChanged( const QDate&);
- signal void dateEntered(QDate); was replaced by void dateEntered( const QDate&);
- signal void dateSelected(QDate); was replaced by void dateSelected( const QDate&)
- changed the order of the constructor's parameter
- removed getData() method. Use date() instead
- removed protected slot `void selectWeekClicked()`

#### KDateTable

- signal void dateChanged(QDate); was replaced by void dateChanged(const QDate&);
- changed the order of the constructor's parameter
- removed getData() method. Use date() instead

#### KDateWidget

- signal void changed(QDate); was changed by void changed(const QDate&)

#### KDialog

- Simplified ctor.

      The following ctor

        KDialog dlg( parent, i18n("my caption"), modal, Ok | Cancel | User1, Ok, false, i18n("Share File"))

      should be rewritten as

        KDialog dlg( parent );
        dlg.setCaption( i18n("my caption") );
        dlg.setModal( modal );
        dlg.setButtons( Ok | Cancel | User1 );
        dlg.setButtonGuiItem( User1, i18n("Share File") );
        dlg.setDefaultButton( Ok );
        dlg.showButtonSeparator( false );

- setButtonMask() -> setButtons() and setButtonGuiItem()
- setButtonBoxOrientation() -> setButtonsOrientation()
- setButtonOKText, setButtonApplyText , setButtonCancelText -> setButtonText( ButtonCode, const QString& )
- setDetails() -> setDetailsWidgetVisible()
- don't overide anymore slotFoo(). You now need to connect to FooClicked signal. Or reimplement accept() and reject() to intercept the Ok and Cancel button
- enableButtonOK -> enableButtonOk (lower case 'k')
- enableButtonSeparator -> showButtonSeparator

#### KDialogBase

Deprecated. Use KDialog or KPageDialog instead.

- If the KDialogBase is Swallow or Plain mode you should replace it with KDialog, for all other modes use KPageDialog

      Replace

        QWidget *page = plainPage();

      with

        QWidget *page = new QWidget( this );
        setMainWidget( page );

      All makeXXXMainWidget() methods can be replaced by the following schema:

        KVBox *mainWidget = makeVBoxMainWidget();

      replace with

        KVBox *mainWidget = new KVBox( this );
        setMainWidget( mainWidget );

- If you use a KPageDialog, the following steps must be taken...

      Replace ctor

        KDialogBase dlg( Tabbed, 0, parent, name, modal, i18n( "my caption" ), ... )

      with

        KPageDialog dlg( parent );
        dlg.setFaceType( KPageDialog::Tabbed );
        dlg.setObjectName( name );
        dlg.setModal( modal );
        dlg.setCaption( i18n( "my caption" ) );
        ...

      All addXXXPage() methods can be replaced by the following schema:

        KVBox *page = addVBoxPage( i18n( "My Title" ), i18n( "My Header" ), QPixmap( "image" ) );

      replace with

        KVBox *page = new KVBox();
        KPageWidgetItem *item = addPage( page, i18n( "My Title" ) );
        item->setHeader( i18n( "My Header" ) );
        item->setIcon( KIcon( "image" ) );

- The virtual methods associated with each button (slotOk(), slotCancel(), etc.) have been merged into a single KDialog::slotButtonClicked(int button) virtual method. However, the most direct replacement for slotOk() and slotCancel() is to reimplement QDialog::accept() and QDialog::reject(), respectively. For all other buttons, consider connect()ing to the corresponding signals provided by KDialog (helpClicked(), etc.).

#### KDockWindow

This class is obsolete and is provided for compatibility only. Use KSystemTrayIcon instead.

#### KDualColorButton

Removed since it was not used.

#### KEdit

- The signal gotUrlDrop was removed, nobody used it, and it's easy to do in the application if needed (see the KURLDrag section)

#### KEditListBox

- void insertStrList(const QStrList* list, int index=-1) and void insertStrList(const QStrList& list, int index=-1) have been deprecated, use QStringList or const char** instead

#### KEditToolbar

- KEditToolbar is now KEditToolBar
- The static setDefaultToolBar was renamed to setGlobalDefaultToolBar
- The constructors have been simplified to take either a KActionCollection* or a KXMLGUIFactory*, depending on whether the app is using XMLGUI or not. To set a non-default resource file in the KActionCollection* case, call setResourceFile.

#### KEditToolbarWidget

- KEditToolbar is now KEditToolBarWidget
- The constructors have been simplified to take either a KActionCollection* and a parent widget or just a parent widget. The latter is for use with XMLGUI. Before being shown, the new load() methods should be called. These allow for populating the widget before being shown but after construction, which is useful when allowing the resource file to be changed as in KEditToolBar.

#### KFind

- The constructors have been simplified to take an optional parent. Other parameters must be set by using the API directly, e.g. setHasSelection and setSearch.
- The options argument in the constructor is now an enumerated flag of type KFind::Options.
- resetCounts() was renamed to resetMatchCount().
- The Options flags from KReplace were added to the Options enumeration of KFind.

#### KFontChooser

- Was in kfontdialog.h, but was moved to it's own header, so now either do #include <KFontChooser> or #include <kfontchooser.h>
- The KFontChooser constructors now take a set of flags to determine how it is displayed, which replaces the numerous bools used previously. The following mappings from the bools in KDE3 and the enum in KDE4 are as follows:
  - 3rd parameter onlyFixed -> FixedFontsOnly
  - 5th parameter makeFrame -> DisplayFrame
  - 7th parameter diff -> ShowDifferences

#### KFontDialog

- The KFontDialog constructor now takes a set of flags to determine how it is displayed, which replaces the numerous bools used previously. The following mappings from the bools in KDE3 and the enum in KDE4 are as follows:
  - 3rd parameter onlyFixed -> KFontChooser::FixedFontsOnly
  - 5th parameter makeFrame -> KFontChooser::DisplayFrame
  - 7th parameter diff -> KFontChooser::ShowDifferences
- The second argument for getFontDiff() is now a reference to a KFontChooser::FontDiffFlags instead of an int.

#### KGlobalAccel

- Moved from kdecore.
- bool useFourModifierKeys() has been removed (we always use four modifier keys now).
- Now a singleton
- You shouldn't need to access this class much... just use setGlobalShortcut() in KAction.

#### KGlobalSettings

- Moved from kdecore.
- KGlobalSettings is now a QObject so can emit signals like kdisplayPaletteChanged() instead of KApplication
- deprecated "static QString trashPath()" has been removed. use KIO::trash instead
- Palette color accessors have been removed. Libraries should restrict themselves to colors available in QPalette (always use the widget's palette and not a global palette), otherwise use an appropriately constructed KColorScheme instead. This does not include/affect WM color accessors.

#### KGradientSelector

- Reversed the value range, if orientation is horizontal. Now minimum is on the left and maximum on the right side.

#### KGuiItem

- Don't use setIconSet anymore, use setIcon instead, there is no compatibility class or function

#### KHistoryCombo

Renamed to KHistoryComboBox.

- Was in kcombobox.h, but was moved to it's own header, so now do #include <khistorycombobox.h>

#### KHSSelector

- Renamed to KHueSaturationSelector, moved to kxyselector.h

#### KIcon

- New class (old one renamed to K3Icon)
- Thin wrapper around QIcon which creates a KIconEngine corresponding to the kde named icon

#### KIconLoader

- Moved from kdecore and is now a QObject.
- Deprecated loadIconSet(), DesktopIconSet(), BarIconSet(), SmallIconSet(), UserIconSet(): use KIcon(name) or KIcon(name,instance->iconLoader()) instead.
  Note that this can change slightly the look of the icon in some cases: for instance if code was calling setIcon(BarIconSet()) on a pushbutton, it meant the icon was loaded at toolbar size and then resized down. With KIcon(name), the small icon is picked up instead, which might look different, but this is the correct behavior. These deprecated methods were also altered to not take a KComponentData (KInstance* in KDE3), which was an optional parameter in KDE3.
- the State parameter was used to be both define the state of the icon one of a limited number of overlays. Overlays are now a separate parameter, a QStringList, containing the names of icons to overlay. The new overlays parameter now follows the state parameter.

#### KInputDialog

- static QString KInputDialog::text( const QString &caption,...) was replaced by QString KInputDialog::getText( const QString &caption,...)

#### KIntNumInput, KDoubleNumInput, KDoubleSpinBox

- Qt::Alignment for label alignment instead of int
- setMinValue(min) -> setMinimum(min) / minValue() -> minimum()
- setMaxValue(min) -> setMaximum(min) / maxValue() -> maximum()

#### KDoubleSpinBox

- It was removed and replaced by QDoubleSpinBox

#### KIntSpinBox

- In the long version of the constructor, the arguments parent and base have switched places.

#### KJanusWidget

Deprecated. Use KPageWidget instead.

#### KKeyButton

Removed. Use either KKeySequenceWidget or KShortcutWidget. Use KShortcutWidget only if you really want two possible shortcuts. Both don't pop up a modal dialog.

#### KKeyChooser

Renamed to KShortcutsEditor.

#### KKeyDialog

Renamed to KShortcutsDialog.

#### KLed

- int ensureRoundLed() -> virtual int ledWidth() const
- virtual void paintRound() -> virtual void paintRaised()

#### KLineEdit

- void cursorAtEnd() removed, use QLineEdit::end(false) instead
- unused protected slots removed: void slotAboutToShow() and void slotCancelled()
- void setEnableSqueezedText( bool enable ) -> void setSqueezedTextEnabled( bool enable )
- void setURLDropsEnabled() -> void setUrlDropsEnabled()
- bool isURLDropsEnabled() -> bool urlDropsEnabled()
- void setURL() -> void setUrl()

#### KLineEditDlg

Was deprecated, has been removed. Use KInputDialog instead.

#### KListAction

Removed; as per comments, did not add anything to KSelectAction.

#### KListBox

Deprecated and renamed to K3ListBox. Use KListWidget (based on the QListWidget class).

#### KListView

Deprecated and renamed to K3ListView.
There is no direct KDE replacement for this class yet.
Either use KListWidget for list-based widgets or QTreeWidget for tree-based widgets. Note that only QTreeWidget supports headers.

#### KListViewSearchLine

Deprecated and renamed to K3ListViewSearchLine.
You should port from K3ListView to QTreeWidget and then use KTreeWidgetSearchLine instead.

#### KMacroCommand

Deprecated and renamed to to K3MacroCommand, header is k3command.h. Use QUndoCommand instead which can group child commands.

#### KMainWindow

- getMemberList() was replaced by memberList() and memberList was renamed to mMemberList and made it private
- sizeForCentralWidgetSize(QSize size) returned the size the main window should have so that the central widget will be of size. You normally don't need this, the recommended way to achieve a certain central widget size is as follows.
  * Override sizeHint() in the central widget so that it returns the desired size.
  * Call updateGeometry() in the central widget whenever the desired size changes. This ensures that the new sizeHint() is properly propagated to any parent layout.
  * Now call adjustSize() in the main window to resize the main window such that the central widget will become the desired size.
- Ported to QMainWindow
- accel() removed - KAccel no longer needed
- If you need XmlGui functions from KMainWindow you may want to use KXmlGuiWindow instead of KMainWindow.

#### KMainWindowInterface

- functionsDynamic() now returns a DCOPCStringList
- function processDynamic arguments uses DCOPCString instead of QCString :

      bool processDynamic(const DCOPCString &fun, const QByteArray &data, DCOPCString& replyType, QByteArray &replyData);

- actions() now returns a DCOPCString

#### KMenu (was KPopupMenu)

- indexes replaced by QAction*
- title, titlePixmap, and changeTitle removed - use QAction::text(), QAction::icon(), QAction::setText() and QAction::setIcon
- contextMenuFocusItem changed to contextMenuFocusAction in line with the change from indexes to actions

#### KMessageBox

- Where applicable, the static functions now take an additional argument to specify the cancel button. Since a default argument is provided, this will affect your code only, if you specified dontAskAgainName and/or options. In those cases, adding an additional parameter KStandardGuiItem::cancel() leads to the old behavior. The following functions are affected (omitting function arguments in the list): questionYesNoCancel(), questionYesNoCancelWId(), warningContinueCancel(), warningContinueCancelWId(), warningContinueCancelList(), warningContinueCancelListWId(), warningYesNoCancel(), warningYesNoCancelWId(), warningYesNoCancelList(), warningYesNoCancelListWId(), messageBox(), messageBoxWId().

#### KNamedCommand

Deprecated and renamed to K3NamedCommand, header is k3command.h. Use QUndoCommand instead where name can be also stored using setText(const QString&).

#### KPalette

- Renamed to KColorCollection

#### KPaletteTable

- Renamed to KColorTable

#### KPassivePopup

- clicked single now emits a const QPoint reference

#### KPasswordEdit

Deprecated and renamed to K3PasswordEdit. Use KLineEdit, with KLineEdit::setPasswordMode(true).

#### KPasswordDialog

Deprecated and renamed to K3PasswordDialog.

- asking for a new password -> KNewPasswordDialog
- password() return QString
- getPassword() gone, use the following code instead

    KPasswordDialog dlg(parent);
    dlg.setPrompt( prompt );
    dlg.setWindowTitle( caption );
    if( dlg.exec() != QDialog::Accepted )
        return;
    use( dlg.password() );

#### KPixmapIO

Removed. Use QPixmap.toImage() and QPixmap::fromImage().

#### KPixmapRegionSelecorDialog

- getSelectedRegion was changed to selectedRegion
- getSelectedImage was changed to selectedImage

#### KPopupMenu

Renamed to KMenu.

#### KPopupTitle

Removed; QMenu doesn't accept widgets, and QAction allows specification of font, icon etc... and gradients / background pixmaps weren't even working in KDE3. You can use KMenu::addTitle() instead, which creates QAction.

#### KProgress

Removed. Use QProgressBar instead.

- advance(int offset) -> setValue(value()+offset)
- QProgressBar has changed a lot in Qt4 ( setTotalSteps(totalSteps) -> setRange(0, totalSteps), setProgress -> setValue, percentageChanged -> valueChanged ). For more details see QProgressBar class reference.

#### KProgressDialog

- #include <kprogressdialog.h> instead of #include <kprogress.h>
- progressBar() is a now QProgressBar instead of a KProgressBar -> See KProgress API changes
- setLabel(const QString &) renamed to setLabelText(const QString &)

#### KPushButton

- Don't use setIconSet anymore, use setIcon instead, there is no compatibility class or function

#### KRadioAction

Removed. Use KAction (or KToggleAction if you need different text/icons for the selected state) instead, in combination with an exclusive QActionGroup

#### KRecentFilesAction

- clearURLList() removed, use clear() instead
- *URL* -> *Url* as per KDE naming policy
- the maxItem property is now an int (was a uint) (affects all accessors methods)

#### KRootPixmap

Removed since it was not used.

#### KSelectAction

- now allows for combo box or button with popup menu when inserted to a toolbar
- popupMenu() removed, use menu() instead
- {set|}removeAmpersandsInCombo() removed - was deprecated

#### KSeparator

- KSeparator now uses Qt::Vertical and Qt::Horizontal rather than QFrame's HFrame and VFrame.

#### KSessionManager

Moved from kdecore, renamed from KSessionManaged, and moved to it's own header: ksessionmanager.h or KSessionManager

#### KSharedPixmap

Removed since is was not used.

#### KShortcut

- Moved from kdecore.
- Now reentrant
- Only uses QKeySequences now
- Removed list semantics; remove() still has somewhat list-like behavior.
- Introduced "primary" and "alternate" shortcuts to replace the arbitrary list of shortcuts
- Removed casting operators
- Removed operator< and operator>
- Added a qHash(const KShortcut &) function so you can use QHash with KShortcut instead of QMap
- remove() -> removeAll()
- toList() -> Not needed anymore since KShortcut inherits QList<QKeySequence>
- toStringInternal() -> You shouldn't be using this! But use toString() instead

#### KShortcutsEditor (was KKeyChooser)

- Added new constructor parameter: ActionTypes types. Allows you to filter the types of actions shown in the dialog.
- Removed all functions dealing with old classes KShortcutList, KGlobalAccel (kde3 version)
- Global shortcut conflict checking functions moved to KGlobalAccel.
- Standard shortcuts checking functions were removed.

See also KShortcutsDialog.

#### KShortcutsDialog (was KKeyDialog)

- Changed from edit/commit semantics to edit in-place/revert semantics. The old way didn't work in corner cases, the new way is quite a bit less complicated internally, and such cases only appear if a user opens multiple KKeyDialogs at the same time, which nobody does intentionally.
- Rewritten. It was hard to read, which stood in the way of future changes/improvements.
- Uses a new GUI layout.
- removed KDE2 deprecated functions
- Added new constructor parameter: KKeyChooser::ActionTypes types. Allows you to filter the types of actions shown in the dialog.

#### KStatusBar

- The unused BarStatus enum was removed.
- The 'permanent' bool has been removed in favor of more explicit naming.
  insertItem(text,id,true) -> insertPermanentItem(text,id),
  insertFixedItem(text,id,true) -> insertPermanentFixedItem(text,id)

#### KStdAction

Renamed to KStandardAction, header is kstandardaction.h.

- showToolbar() methods have been removed, see KMainWindow::setStandardToolBarMenuEnabled()

#### KStdGuiItem

Renamed to KStandardGuiItem, header is kstandardguiitem.h.

- The StdItem enum was renamed to StandardItem

#### KSyntaxHighlighter

- Use K3SyntaxHighlighter because it used Q3TextEdit or use KSyntaxHighlighter when your application will use QTextEdit

#### KSystemTray

Renamed to KSystemTrayIcon for consistency with its actual purpose and naming in Qt (QSystemTrayIcon).

- Is now a subclass of QSystemTrayIcon and not QLabel. Therefore it is not a widget anymore. Otherwise, it behaves the same as in KDE3 when it comes to managing a parent window's visibility and providing an action collection to display in the context menu.

#### KTabBar

- colors, close buttons on individual tabs not working at the moment
- The old insertTab and removeTab have been removed, use addTab / insertTab / removeTab from QTabBar instead (uses indices, not QTab*s)

#### KTabCtl

Removed. Use QTabWidget.

#### KTextBrowser

- Inherits from QTextBrowser instead of Q3TextBrowser

#### KTextEdit

- void highLightWord() -> void highlightWord()

#### KTimeWidget

Removed. Use QTimeEdit.

#### KTimezoneWidget

Renamed to KTimeZoneWidget.

#### KToggleAction

- setExclusiveGroup() / exclusiveGroup() removed, use setActionGroup() and QActionGroup::setExclusive() for exclusivity (imitates the deleted KRadioAction class)
- in comparison with KAction, adds setCheckedState() and sets this action to checkable

#### KToggleFullScreenAction

- Simplified constructor

      Replace

        KToggleFullScreenAction( const KShortcut &cut, const QObject* receiver, const char* slot,
                                 KActionCollection* parent, QWidget* window, const QString& name )

      with

        KToggleFullScreenAction( QWidget* window, KActionCollection* parent, const QString& name )

      See KAction how to port the other arguments.

#### KToolBar

- Ported to QToolBar
- IconText, iconText(), setIconText() replaced by QToolBar::toolButtonStyle() et. al.
- BarPosition, barPos(), setBarPos() replaced by Qt::ToolBarArea settings in QMainWindow; Unmanaged, Floating, and Flat are no longer supported (use QDockWidget if you need floating toolbars)
- fullSize(), setFullSize() removed as now handled in QMainWindow - add or insert a tool bar break before (not needed for the first toolbar) and after the toolbar using QMainWindow::{add|insert}ToolBarBreak() to have the toolbar take up all available horizontal space
- iconSize(), setIconSize() now a QToolBar property, and a QSize instead of an int - convenience function setIconDimensions() takes an int instead
- insert*() and all associated item-manipulation methods removed - all done through actions now. Compatibility layer possible however so far I haven't found the functions to be used much in KDE programs (mostly it's taken care of by xmlgui instead)
- flat(), setFlat() replaced by movable(), setMovable() (old "flat" concept equivalent to not movable)
- layout-related methods removed (done by QToolBar's layout)
- alignItemRight() removed (as above), replacement is to add a KToolBarSpacerAction before the action you want to be aligned right (or if you have a custom action already, just create a container widget and insert a QSpacerItem on the left of your custom widget (see KonqLogoAction in kdebase/konqueror/konq_actions.cc)
- `enum BarStatus` and `bool enable(BarStatus stat)` have been removed
- `void enableMoving(bool flag)` and `void enableFloating (bool flag)` have been removed in favor of `setMovingEnabled(bool)`
- `int maxHeight()/int maxWidth()` removed in favor of `maximumHeight()/maximumWidth()`
- `void setMaxHeight (int h)` and `void setMaxWidth (int dw)` removed in favor of `setMaximumHeight()/setMaximumWidth()`
- void setEnableContextMenu(bool enable = true) -> void setContextMenuEnabled(bool enable = true)

#### KToolBarButton

Removed. Done by QToolButton now.

#### KToolBarLabelAction

- Simplified constructors:

        Replace

          KToolBarLabelAction( const QString &text,
                               const KShortcut &cut,
                               const QObject *receiver, const char *slot,
                               KActionCollection *parent, const QString& name )

        with

          KToolBarLabelAction( const QString &text,
                               KActionCollection *parent, const QString& name )

        and

          KToolBarLabelAction( QAction *buddy, const QString &text,
                               const KShortcut &cut,
                               const QObject *receiver, const char *slot,
                               KActionCollection *parent, const QString& name )

        with

          KToolBarLabelAction( QAction *buddy, const QString &text,
                               KActionCollection *parent, const QString& name )

        See KAction for how to port the other arguments.

#### KToolBarRadioGroup

Removed. Done by QToolButton now.

#### KToolBarSeparator

Removed. Use QAction::setSeparator().

#### KUndoRedoAction

Deprecated and renamed to K3UndoRedoAction, header is k3command.h. KUndoStack::createRedoAction() and KUndoStack::createUndoAction() can be used instead but they currently lack popups with action lists.

#### KURLLabel

- renamed to KUrlLabel
- void setAltPixmap() -> void setAlternatePixmap()
- QPixmap* altPixmap() -> QPixmap* alternatePixmap()
- void setGlow() -> void setGlowEnabled()
- void setFloat() -> void setFloatEnabled()
- void setURL() -> void setUrl()
- signal: void enteredURL( ... ) -> void enteredUrl( ... )
- signal: void leftURL( ... ) -> void leftUrl( ... )
- signal: void leftClickedURL( ... ) -> void leftClickedUrl( ... )
- signal: void rightClickedURL( ... ) -> void rightClickedUrl( ... )
- signal: void middleClickedURL( ... ) -> void middleClickedUrl( ... )

#### KValueSelector

Renamed to KColorValueSelector, moved to kcolorvalueselector.h

#### KWidgetAction

Removed. Use KAction or QWidgetAction and utilise its widget-setting capabilities.

#### KWindowListMenu

Moved to libkworkspace in kdebase

#### KWizard

Deprecated and renamed to K3Wizard. Use KAssistantDialog.

#### Return to the Table of Contents

### Changes in kio

#### KAbstractFileWidget

- void setPreviewWidget(const KPreviewWidgetBase *w) -> void setPreviewWidget(KPreviewWidgetBase *w)

#### KArchive/KTar/KZip/KAr

- All sizes and file offsets now use qint64 (similar to QIODevice)
- The API has changed for subclasses: there is a KArchive constructor that takes a filename, and which provides KSaveFile support automatically, writeDir is doWriteDir, prepareWriting is doPrepareWriting etc.
- API changes for users of the class: isOpened() was renamed to isOpen(), doneWriting() to finishWriting(), and the order of the arguments for writeFile() is more usual: data comes before size.
- KTarDirectory -> KArchiveDirectory
- KTarFile -> KArchiveFile
- KTarEntry -> KArchiveEntry
- KTarGz -> KTar

#### KBookmark classes

- KBookmarkDrag class has been moved to kde3support. Use KBookmark::populateMimeData() and KBookmark::List::populateMimeData() in the drag/copy side, and the static methods KBookmark::List::canDecode() and KBookmark::List::fromMimeData() in the drop/paste side.
- KBookmarkMenu constructor is much simpler. It always creates a toplevel menu, which makes the parameter isRoot and parentAddress superfluous. KBookmarkOwner now governs wheter to show a "Add Bookmark" Menu Entry, thus the constructor parameter add is gone.
- KBookmarkMenu and KBookmarkBar no longer emits openBookmark(), override KBookmarkOwner::openBookmark() instead.
- KBookmarkOwner::openBookmarkURL() was replaced by KBookmarkOwner::openBookmark()
- KExtendBookmarkOwner functionality was integrated into KBookmarkOwner. (And the API is more regular now.)
- KBookmarkMenu::slotBookmarksChanged() and KBookmarkMenu::fillBookmarkMenu() are no longer public. Both had comments, that they shouldn't be used anyway.
- KBookmarkMannager::managerForFile() requires a DBus Name as the second parameter.

#### KDEDesktopMimeType class

- All the static methods have been moved to KDesktopFileActions, in kdesktopfileactions.h

#### KDirLister class

- The constructor argument is now a separate setter, so: KDirLister(false) -> KDirLister(); KDirLister(true) -> KDirLister() + setDelayedMimeTypes(true). On the other hand, KDirLister being a QObject, it takes a QObject* parent argument.
- KDirLister uses KFileItem by value now:
  - KFileItem* rootItem() const -> KFileItem rootItem() const
  - KFileItem* findByUrl( const KUrl& url ) const -> KFileItem findByUrl( const KUrl& url ) const
  - KFileItem* findByName( const QString& name ) const -> KFileItem* findByName( const QString& name ) const
  - bool matchesFilter( const KFileItem* ) const -> bool matchesFilter( const KFileItem& ) const
  - bool matchesMimeFilter( const KFileItem* ) const -> bool matchesMimeFilter( const KFileItem& ) const
- The following signals have changed:
  - void deleteItem( KFileItem *_fileItem ) -> void deleteItem( const KFileItem &fileItem )
  - void refreshItems( const KFileItemList &items ) -> void refreshItems( const QList<QPair<KFileItem, KFileItem>> &entries)

#### KDiskFreeSp class

- Renamed to KDiskFreeSpace, moved to kdiskfreespace.h

#### KDESasl class

- This class is removed due to its inflexiblity, use cyrus-sasl or the upcoming QCA SASL implementation

#### KDirSelectDialog

- KDirSelectDialog moved to libkfile. If you were only using the static method selectDirectory, you can use KFileDialog::getExistingDirectory (for local files, i.e. if the second argument was true), or KFileDialog::getExistingDirectoryUrl

#### KFileDialog,KDirSelectDialog,KUrlRequesterDlg,KCustomMenuEditor,KUrlBarItemDialog

- are KDialogBases no more, now they are a KDialogs
- no more name and modal parameters in the constructors

#### KFileDialog, KDirOperator

- instead of KConfig* + QString group everywhere KConfigGroup is used now

#### KFileDialog

- Changed constructor and method 'startDir' arguments from QString to KUrl

        Affected methods:

          KFileDialog( ... )
          static QString getOpenFileNameWId( ... )
          static QStringList getOpenFileNames( ... )
          static KUrl getOpenURL( ... )
          static KUrl::List getOpenURLs( ... )
          static QString getSaveFileName( ... )
          static QString getSaveFileNameWId( ... )
          static KUrl getSaveURL( ... )
          static QString getExistingDirectory( ... )
          static KUrl getExistingURL( ... )
          static KUrl getImageOpenURL( ... )

- getOpenURL, getOpenURLs, getExistingURL and getSaveURL were renamed to getOpenUrl, getOpenUrls, getExistingUrl and getSaveUrl (i.e. URL was replaced by Url everywhere)
- void toolbarCallback(int) was removed
- void pathComboChanged( const QString& ); was removed
- void dirCompletion( const QString& ); was removed
- void setFilterMimeType(const QString &label, const KMimeType::List &types, const KMimeType::Ptr &defaultType) was removed
- void setPreviewWidget(const QWidget *w) was removed
- void updateStatusLine(int dirs, int files); was removed
- protected member locationEdit is now a method locationEdit()
- protected member filterWidget is now a method filterWidget()
- getExistingUrl -> getExistingDirectoryUrl

#### KFileIconView, KFileDetailView, KFileTreeView, KFileTreeViewItem

- All renamed to K3File* since they are based upon K3IconView and K3ListView
- No replacement yet, apart from the more low-level KDirModel
- Those classes have all moved to a new library, libkfile. You need to link to ${KDE4_KFILE_LIBS} to keep using those classes.

#### KFileItemList

- KFileItemList has been ported from QPtrList to QList. This means you have to iterate using either integers or java-style or STL iterators. Here's the STL version:

          KFileItemList::const_iterator kit = list.begin();
          const KFileItemList::const_iterator kend = list.end();
          for ( ; kit != kend; ++kit )
             ...

- Note however that no loop is necessary anymore for finding an item by name (use findByName), finding an item by URL (use findByURL) or making a list of all urls (use urlList).

#### KFileMetaInfo

KFileMetaInfo has a new API and a new implementation. The change moves the emphasis away from mimetypes and groups of metadata to individual properties of files. These properties are still called KFileMetaInfoItem. The no longer belong to a group; they belong to the KFileMetaInfo object. The class KFileMetaInfoGroup is only there to group the items. Each KFileMetaInfoItem now has a member called PredicateProperties. This term comes from RDF. It determines the type of the item. This type encompasses the key (a URI), a name in the current locale, a description in the current locale, a type and a QValidator.

#### KFileOpenWithHandler

- This class has been removed, it was just a workaround for a dependency problem, just remove any instance of it.

#### KFilePlugin

This class has been replaced by Strigi analyzers and KFileWritePlugin. The Strigi analyzer should be installed in the directory lib/strigi to be picked up. Introspection provided by the factories that are defined in the plugin helps in determining when a particular analyzer will be used.

Strigi analyzer have the advantage that they are faster than KFilePlugins. In addition, having one mechanism for extracting metadata from files saves code and more importantly ensures consistency between the display of metadata and the ablility to search in it. Another advantage is that the way the metadata are described matches well with the methods employed in the semantic desktop, in particular Nepomuk.

### How to convert a KFilePlugin?

If your KFilePlugin only reads from files, it is easiest. Then you have to write only a Strigi analyzer. Depending on the way you read the data from the file it is best to write either a StreamThroughAnalyzer or a StreamEndAnalyzer. How to make the decision is explained in the link above. When your analyzer is ready you have to decide where to put it. You can put it in the same place as the KFilePlugin was or, if there are little or no dependencies in your analyzer, you can put it in kdesupport/strigi/src/streamindexer. The latter option has the advantage that you do not have to add the code for loading a plugin.

When you have write functionality in your plugin, you must implement KFileWritePlugin and place the code for writing the file in there. The details of how to do this are not entirely clear at the moment as is explained in the entry for KFileWritePlugin.

#### KFileWritePlugin

The write functionality of the class KFilePlugin is now handled by KFileWritePlugin. A global instance of this class that is attached to a KFileMetaInfoItem can be used to write back changes that were made to a files' metadata.

The mechanism by which these global instances are tied to KFileMetaDataItems is not yet finished. The implementation of will go into kio/kio/kfilemetainfo.cpp.

#### KIconButton

- signal void iconChanged(QString); replaced by void iconChanged(const QString &);

#### KIconDialog

- signal void newIconName(QString); replaced by void newIconName(const QString &);

#### KImageIO classes

- The KImageIO plugins are converted to Qt's imageformat plugins. The KImageIO class now a lightweight version to query the installed plugins without actually loading them.
- .kimgio files are converted to .desktop files, and contains regular KDE services, with ServiceType as QImageIOPlugins
- KImageIO::registerFormats() removed, simply remove this from your code
- Instead of mimeType(filename), you should use KMimeType
- Instead of canRead() and canWrite() you can use types(mode).contains(typename)

#### KIO:: global methods

- KIO::convertSizeFromKB is now KIO::convertSizeFromKiB since it takes a value in KiB (1 KiB = 1024 B)
- KIO::findDeviceMountPoint() has been replaced with KMountPoint::currentMountPoints() and findByDevice()
- KIO::findPathMountPoint() has been replaced with KMountPoint::currentMountPoints() and findByPath()
- KIO::probably_slow_mounted() has been replaced with KMountPoint::currentMountPoints(), findByPath(), and probablySlow()
- KIO::testFileSystemFlag() has been replaced with KMountPoint::testFileSystemFlag() (use KMountPoint::currentMountPoints().findByPath())

#### KIO::Job

- For Job subclasses: removeSubjob doesn't terminate the parent job anymore, add `if ( !hasSubjobs() ) emitResult();` to emulate the old behavior that.
- subjobs is now private. This means you should replace subjobs.remove(job) with removeSubjob(job), and subjobs.isEmpty() with !hasSubjobs()
- `job->showErrorDialog(QWidget*)` becomes `job->ui()->showErrorMessage()`. The parent QWidget should be set immediately after creating the job by `job->ui()->setWindow(QWidget*)`
- `job->setAutoErrorHandlingEnabled(bool,QWidget*)` becomes `job->ui()->setAutoErrorHandlingEnabled(bool)`
- `job->isAutoErrorHandlingEnabled()` becomes `job->ui()->isAutoErrorHandlingEnabled()`
- `job->setAutoWarningHandlingEnabled(bool)` becomes `job->ui()->setAutoWarningHandlingEnabled(bool)`
- `job->isAutoWarningHandlingEnabled()` becomes `job->ui()->isAutoWarningHandlingEnabled()`
- `job->setWindow(QWidget*)` becomes `job->ui()->setWindow(QWidget*)`
- `job->window()` becomes `job->ui()->window()`
- `job->setInteractive( false )` becomes `job->setUiDelegate( 0 )`
- Also note that you must now include <kio/copyjob.h> if you use KIO::copy, KIO::move or KIO::trash, and you must include <kio/deletejob.h> if you use KIO::del.
- For Job subclasses, there's no showProgressInfo flag in the constructor anymore. You should use KIO::getJobTracker()->registerJob(job) instead.
- Most boolean parameters have been replaced with enums. So for instance
  - KIO::file_copy(src, dest, -1, true /*overwrite*/, false /*no resume*/, false) -> KIO::file_copy(src, dest, -1, KIO::Overwrite | KIO::HideProgressInfo)
  - KIO::get(url, false /*no reload*/, false) -> KIO::get(url, KIO::NoReload, KIO::HideProgressInfo)
  - KIO::put(url, -1, true /*overwrite*/, false /*no resume*/, false) -> KIO::put(url, -1, KIO::Overwrite | KIO::HideProgressInfo)
  - KIO::del(url, false /*shred, feature removed*/, false) -> KIO::del(url, KIO::HideProgressInfo)
  - KIO::listDir(url, true /*show progress info*/, true /*include hidden files*/) -> KIO::del(url, KIO::DefaultFlags, true /*include hidden files*/)

#### KIO::UDSEntry

- UDSEntry is now a hash-based class instead of a list. Use the methods stringValue() and numberValue() to retrieve fields directly, no loop is needed anymore. See the UDSEntry documentation for code examples.
- Also note that UDSEntryListConstIterator is now UDSEntryList::ConstIterator; see the UDSEntryList documentation for a full code example of iterating through a listDir result.
- For kioslaves: replace every three lines like

      atom.m_uds = KIO::UDS_SIZE;
            atom.m_long = buff.st_size;
            entry.append( atom );

  with the line

      entry.insert( KIO::UDSEntry::UDS_SIZE, buff.st_size );

#### KIO::RenameDialog

- KIO::RenameDlg was renamed to KIO::RenameDialog and the header moved from renamedlg.h to renamedialog.h
- void b0Pressed() renamed to void cancelPressed()
- void b1Pressed() renamed to void renamePressed()
- void b2Pressed() renamed to void skipPressed()
- void b3Pressed() renamed to void autoSkipPressed()
- void b4Pressed() renamed to void overwritePressed()
- void b5Pressed() renamed to void overwriteAllPressed()
- void b6Pressed() renamed to void resumePressed()
- void b7Pressed() renamed to void resumeAllPressed()
- void b8Pressed() renamed to void suggestNewNamePressed()

#### KIO::RenameDialogPlugin

- RenameDlgPlugin was renamed to KIO::RenameDialogPlugin and the header moved from renamedlgplugin.h to renamedialogplugin.h
- The ServiceType was changed from RenameDlg/Plugin to RenameDialog/Plugin. Make sure to update your .desktop fiel

#### KIO::PasswordDialog

- KIO::PassDlg was renamed to KIO::PasswordDialog and the header moved from passdlg.h to passworddialog.h

#### KIO::PreviewJob

- KIO::PreviewJob works with KFileItems by value rather than by pointer, now that KFileItem is refcounted.
- The two signals changed accordingly:
  - gotPreview(const KFileItem*, const QPixmap&) -> gotPreview(const KFileItem&, const QPixmap&)
  - failed(const KFileItem*) -> failed(const KFileItem&
- In the slots connected to those signals, don't compare KFileItem pointers! If you need to find the KFileItem in a list, compare the url() of the items in the list with the url() of the item passed to the slot.

#### KIO::SkipDialog

- KIO::SkipDlg was renamed to KIO::SkipDialog and the header moved from skipdlg.h to skipdialog.h

#### KIO::Observer

- openPassDlg was renamed to openPasswordDialog
- open_RenameDlg to open_RenameDialog
- open_SkipDlg to open_SkipDialog

#### KIO::SlaveBase

- openPassDlg was renamed to openPasswordDialog

#### KIO::TCPSlaveBase

- Removed distinction of SSL and TLS mode. You can now tell the slave via the constructor to start SSL right after connecting which is what was previously called "SSL mode". "TLS" is the same as starting SSL (using startSsl()) later than immediately after connecting. You can query if a slave was created with immediate SSL start enabled by calling isAutoSsl().
- Removed the notion of a default port. It was not used for any internal calculations - you can emulate it simply by having an "m_defaultPort" or similar member in a subclass.
- Renamed isConnectionValid() to isConnected().
- Renamed setBlockConnection() to setBlocking().
- Renamed closeDescriptor() to disconnectFromHost().
- startSsl() (formerly startTLS()) now just returns a bool instead of a numeric error code.
- connectToHost() lost its sendError parameter. It was only used for proxy support hacks in the HTTP ioslave and nowhere else. Proxy support is better implemented inside TCPSlaveBase than in protocol slaves.
- Metadata changes that should only concern the HTTP ioslave and the HTML KPart.

#### KMimeMagic

- The KMimeMagic class is gone. Use the KMimeType API instead:
  - KMimeMagic::self()->findFileType(path) -> KMimeType::findByPath(path) (preferred) or KMimeType::findByFileContent(path) (if only the content should be considered, but this isn't always reliable)
  - KMimeMagic::self()->findBufferType(data) -> KMimeType::findByContent(data)
  - KMimeMagic::self()->findBufferFileType(data,name) -> KMimeType::findByNameAndContent(name,data)
- .. and replace result->mimeType() with mime->name().

#### KMimeType

- KMimeType::pixmap() has been deprecated (for core/gui separation), use iconName() or iconName(url) and KIconLoader::loadMimeTypeIcon with that icon name.
- KMimeType::pixmapForURL -> KIO::pixmapForURL
- KMimeType::comment(KUrl,bool) -> KIO::comment(KUrl)
- KMimeType::diagnoseFileName has been replaced with KMimeType::extractKnownExtension which returns the extension only, not the pattern
- KMimeType::mimeType(someName) now behaves like KServiceType::serviceType(someName), i.e. it returns 0 if that name doesn't exist, instead of returning the application/octet-stream mimetype. Test for null!
- iconForURL has removed, use iconNameForURL instead
- KMimeType::findFormatByFileContent has been removed. Use KMimeType::isBinaryData instead.

#### KMimeTypeResolver

- The previous KMimeTypeResolver has been renamed to K3MimeTypeResolver.
- A new KMimeTypeResolver must be used together with a KDirModel.

#### KOpenWithDlg

- Has been renamed to KOpenWithDialog. Use #include <kopenwithdialog.h>

#### KPropertiesDialog

- Doesn't have autoShow support in its constructors anymore, but still has autodelete behavior.
- Ensure any new is followed by show or exec. Or use KPropertiesDialog::showDialog where possible.
- The header file was renamed from kpropsdlg.h to kpropertiesdialog.h
- The ServiceType was renamed from KPropsDlg/Plugin to KPropertiesDialog/Plugin. Make sure to update your .desktop files

#### KPropertiesDialogPlugin

- KPropsPage or KPropsDlgPlugin was renamed to KPropertiesDialogPlugin
- The header file was renamed from kpropsdlg.h to kpropertiesdialog.h

#### KProtocolInfo

- Many static methods have been moved to KProtocolManager (which is in kio) so that kprotocolinfo itself could be moved to kdecore:
  - KProtocolInfo::supportsListing(url or protocol) -> KProtocolManager::supportsListing(url)
  - KProtocolInfo::supportsReading(url or protocol) -> KProtocolManager::supportsReading(url)
  - KProtocolInfo::supportsDeleting(url or protocol) -> KProtocolManager::supportsDeleting(url)
  - etc.
- The deprecated methods taking a QString protocol as input have been removed, make sure to pass a KUrl to most methods instead.

#### KRun

- the constructor needs a second parameter (a widget) now

#### KURLBar

- renamed to KUrlBar

#### KURLComboBox

- Renamed to KUrlComboBox
- All usage of QPixmap has been replaced by usage of QIcon
- getPixmap() --> getIcon()

#### KURLCompletion

- Renamed to KUrlCompletion

#### KURLPixmapProvider

- Renamed to KUrlPixmapProvider

#### KURLRequester

- renamed to KUrlRequester
- setCaption is gone, use setWindowTitle instead
- Renamed setURL() to setUrl(), per KDE naming policy
- Ported to use KUrl instead of QString. Thus, the constructors, setUrl(), url(), and urlChanged() all use KUrl.
- Removed showLocalProtocol() and setShowLocalProtocol(); this is now always false (the user never sees file:///)

#### KService

- KService was moved to libkdecore
- KService::rebuildKSycoca -> KBuildSycocaProgressDialog::rebuildKSycoca
- KService::pixmap was removed due to icon support being moved to libkdeui. Instead use KService::icon() and KIconLoader directly. Usually you can simply use the KIconLoader returned by KApplication::iconLoader() for this.

#### KServiceType

- KServiceType::offers() -> KServiceTypeTrader::self()->query()
- The behavior of KServiceType::serviceType() has changed: it now only returns real service types, and no more mimetypes. For mimetypes, use KMimeType::mimeType().
- Similarly, allServiceTypes() only returns real service types, no more mimetypes.

#### KServiceTypeProfile

- This class has been moved to kservicetypeprofile.h and is mostly internal now. Use KServiceTypeTrader or KMimeTypeTrader instead.
- KServiceTypeProfile::preferredService is now KMimeTypeTrader::self()->preferredService or KServiceTypeTrader::self()->preferredService
- KServiceTypeProfile::offers is now KMimeTypeTrader::self()->query or KServiceTypeTrader::self()->query

#### KTrader

- KTrader has been split up into two classes: KServiceTypeTrader and KMimeTypeTrader.
- So KTrader::query() should be ported to KMimeTypeTrader::query() when it's about mimetypes (finding the application or part for a given mimetype), and to KServiceTypeTrader::query() when it's about pure service types (plugins, kcmodules, etc.)
- In other terms, KTrader::query(1 or 2 args) -> KServiceTypeTrader::query and KTrader::query(4 args but the last one was always QString::null) -> KMimeTypeTrader::query
- In both cases, query() now returns KService::List instead of an OfferList, adjust the type of the variable
- Constraints like "'RenameDlg/Plugin' in ServiceTypes" should be turned into KMimeTypeTrader::self()->query(mimetype,"RenameDlg/Plugin")

#### PasswordDialog

- void setEnableUserField( bool enable, bool=false ) removed use setUsernameReadOnly( !enable )

#### UIServer

- QByteArray openPassDlg( const KIO::AuthInfo >info ); removed. Use KIO::PasswordDialog::getNameAndPassword

#### Return to the Table of Contents

### Changes in kparts

#### BrowserExtension

- The following signals have changed:
  - openUrlRequest(const KUrl &, const KParts::URLArgs&) -> openUrlRequestDelayed(const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)
  - openUrlRequestDelayed(const KUrl &, const KParts::URLArgs&) -> openUrlRequestDelayed(const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)
  - The two createNewWindow signals have been merged into a single one: createNewWindow(url, args, browserArgs [, windowArgs, &part] )
  - The popupMenu signals have been greatly simplified, 2 signals instead of 5. URLArgs has been split into OpenUrlArguments and BrowserArguments; the KXMLGUIClient argument has been removed, and the ActionGroupMap mechanism replaces it.
- Because of the URLArgs split, make sure to replace BrowserExtension::setUrlArgs with BrowserExtension::setBrowserArguments + part->setArguments

#### BrowserHostExtension

- The following virtal methods have changed:
  - openURLInFrame(const KUrl &, const KParts::URLArgs&) -> openUrlInFrame(const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)

#### BrowserRun

- The constructor now takes args and browserArgs, see KParts::Part
- All the protected members have been turned into methods
- BrowserRun::isExecutable obsoleted by KRun::isExecutable
- suggestedFilename -> suggestedFileName

#### ComponentFactory

- createInstanceFromFactory is now KPluginFactory::create<T>
- createInstanceFromLibrary is now KLibLoader::createInstance<T>
- createInstanceFromService is now KService::createInstance<T>
- createInstanceFromQuery is now KServiceTypeTrader::createInstanceFromQuery<T>
- All the error codes like KParts::ComponentFactory::ErrNoServiceFound have moved to KLibLoader

#### KParts::URLArgs

- URLArgs has been splitted into OpenUrlArguments and BrowserArguments.
  - URLArgs.reload -> OpenUrlArguments.reload()/setReload()
  - URLArgs.xOffset -> OpenUrlArguments.xOffset()/setXOffset()
  - URLArgs.yOffset -> OpenUrlArguments.yOffset()/setYOffset()
  - URLArgs.serviceType -> OpenUrlArguments.mimeType()/setMimeType()
  - URLArgs.metaData() -> OpenUrlArguments.metaData()
  - For anything else (docState, frameName, postData, setDoPost, setContentType etc.): URLArgs -> BrowserArguments
- The BrowserArguments are still set and retrieved from the BrowserExtension, however the OpenUrlArguments are simply stored in KParts::ReadOnlyPart. So for instance:
  - m_extension-> urlArgs().xOffset -> arguments().xOffset()

#### Return to the Table of Contents

### Changes in kded

- The class KDEDModule is now part of libkdecore so that kded modules can link without undefined symbols. A number of apparently unused methods in KDEDModule have been commented out, contact kde-core-devel if you need those after all.
- Note that the signature for the create_xyz() call has changed, simply remove all arguments from it, and from your kded module's constructor

#### Return to the Table of Contents

### Changes in kspell

#### KSpell

- All of the features of KSpell and KSpell2 have been moved to Sonnet
- The KSpell2's initialization procedure of:

      KSpell2::Loader::Ptr loader = KSpell2::Loader::openLoader();
      KSpell2::Speller *speller = loader->createSpeller("en_US");
      if (speller) {
         if (speller->isMisspelled("word")) {
                //do something
         }
      }

  has been replaced with:

      Sonnet:Speller speller("en_US");
      if (speller.isMisspelled("word")) {
          //do something
      }

- The configuration class of KSpell2 (KSpell2::Settings) have been folded back into Sonnet::Speller.
- Sonnet doesn't automatically overwrite configuration anymore. To save and restore setting from a KConfig file one has to use

        Sonnet::Speller::save(KConfig *config);
        Sonnet::Speller::restore(KConfig *config);

  methods.
- KSpell2::Filter has been temporarily removed from the public api. Proper text segmentation api is planned for KDE 4.1

#### Return to the Table of Contents

### Changes in kdnssd

#### DomainBrowser

- Recursive browsing feature has been removed removed
- Constructor that takes list of domains and does not use configuration has been removed
- It is now possible to search for browsing or publishing domains

#### ServiceBase

- Service properties are stored in QMap<QString,QByteArray> instead of QMap<QString,QString>.
- This class is not used to pass domains or service types anymore

#### ServiceBrowser

- Browsing multiple types or multiple domains at once has been removed
- In KDE3 ServiceBrowser created with default constructor (for example ServiceBrowser("_http._tcp") ) browsed all configured domains. Now it only browses default one. To browse other domains create more ServiceBrowser objects
- It is now possible to specify subtype to narrow searching scope (for example "anon" for only anonymous FTP servers)
- Browsing for service types is now done using new class ServiceTypeBrowser

#### RemoteService

- Creating RemoteService from URL or DNS label is no longer supported

#### PublicService

- Optional list of subtypes can be passed to constructor.
- Encoding service into URL is no longer supported

#### Query

- This class has been merged into ServiceBrowser

#### Return to the Table of Contents

### API-cleanups in KHTML

#### Return to the Table of Contents

### Changes in kfile

#### KUrlRequesterDialog

- KUrlRequesterDlg was renamed to KUrlRequesterDialog
- The header was renamed from kurlrequesterdlg.h to kurlrequesterdialog.h

#### KDirOperator

- KFileView* view() const -> QAbstractItemView* view() const
- void setView(KFileView *view) -> void setView(QAbstractItemView *view)
- const KFileItemList* selectedItems() const -> QList<KFileItem> selectedItems() const
- KFileView* createView(QWidget *parent, KFile::FileView view) -> QAbstractItemView* createView(QWidget *parent, KFile::FileView view)
- QWidget* viewWidget() const; has been removed, use QAbstractItemView* view() instead.
- void setPreviewWidget(const QWidget *w) -> void setPreviewWidget(KPreviewWidgetBase *w)
- KIO::DeleteJob* del(const KFileItemList& items, QWidget *parent, bool ask = true, bool showProgress = true) -> KIO::DeleteJob* del(const QList<KFileItem>& items, QWidget *parent = 0, bool ask = true, bool showProgress = true)
- KIO::DeleteJob* del(const KFileItemList& items, bool ask = true, bool showProgress = true) has been removed. Use del(...) with parent parameter instead.
- KIO::CopyJob* trash(const KFileItemList& items, QWidget *parent, bool ask = true, bool showProgress = true) -> KIO::CopyJob* trash(const QList<KFileItem>& items, QWidget *parent, bool ask = true, bool showProgress = true)

#### KFileView

- KFileView doesn't exist anymore, see the new itemview based KDirOperator.
- For ease of porting, kde3support provides K3FileView, but don't expect it to still be useable in a KDirOperator.

#### KFileWidget

- void setPreviewWidget(const KPreviewWidgetBase *w) -> void setPreviewWidget(KPreviewWidgetBase *w)

#### Return to the Table of Contents

### Changes in kdesu

All classes of kdesu are now in the `KDESu` namespace

#### Return to the Table of Contents

### Changes in KControl

- The Button enum in KCModule only contains the Help, Default and Apply values. The other buttons are not optional. If your KCM specified the button flags just remove everything except those three.
- The functions setRootOnlyMsg, rootOnlyMsg, setUseRootOnlyMsg and useRootOnlyMsg have been renamed to setRootOnlyMessage, rootOnlyMessage, setUseRootOnlyMessage and useRootOnlyMessage.
- KCModules need to have Type=Service and ServiceTypes=KCModule in the .desktop file now - was Type=Application before
- KCModules that should show up in KControl or kcmshell --list need to have X-KDE-ParentApp=kcontrol or kinfocenter
- If the KCModule should be used by kcminit you have to add KCModuleInit to ServiceTypes (i.e. ServiceTypes=KCModule,KCModuleInit then)
- The kcm_ prefix in X-KDE-Library is now optional (in KDE3 the X-KDE-Library value was automatically prefixed with kcm_)
- If the kcminit code is in a different lib than the other KCM code the X-KDE-Init-Library was used. The library name has to be prefixed with kcminit_ now, but the prefix is optional in the .desktop file.
- The kcminit symbol now has to be prefixed with kcminit_ (in the code). The rest of the symbol name is specified with X-KDE-Init-Symbol (was X-KDE-Init before).
- It is now possible to use multiple K_EXPORT_GENERIC_FACTORY calls in one library. The first parameter to the macro has to be the same as X-KDE-FactoryName then.
- KCModule does no longer take a name argument, but directly a KInstance (having the correct name for the translations to work.
- The X-KDE-RunAsRoot and X-KDE-IsHiddenByDefault keys are removed.
- KCModules will not be embedded running with root privileges anymore. Instead the GUI code will run with user privileges as every other KCM. Only in order to write or call programs should the KCM elevate its privileges.

#### Return to the Table of Contents

### Panel Applets and Extensions

#### Return to the Table of Contents

- KDockWidgets -> kde3support K3DockWidget
- KParts::DockWindow -> kde3support KParts::DockWindow3
- KMDI* --> kdeSupport K3MDI*

### libkmid

- Moved to kdemultimedia, where (at the moment) it is only used by kmid.

### KScreensaver

#### libkscreensaver

- Moved to kdebase/workspace/kscreensaver

#### Return to the Table of Contents

### I18N

#### Messages.sh files

Instead of the "messages" target of the Makefile.am files, KDE4 uses now Bash scripts with Messages.sh file names. The Perl script trunk/l10n-kde4/scripts/conversion/Makefile2Messages.pl can be used as an half-automatic conversion. (Please verify the result!)

#### rc.cpp file

The rc.cpp is now always generated. It is mandatory to have it as parameter of the $XGETTEXT if you are using the class KAboutData and if you are not explicitly setting KAboutData::setTranslator.

#### Gettext 0.16.1

Scripty uses xgettext 0.16.1 for extracting messages out of the source code. This is a huge step from the former xgettext 0.10.35-kde used in KDE3.

Important changes:

- If you define your own keywords (-k parameter of xgettext), you probably need to adapt them, as xgettext does not automatically know about the 1, 2 or 3 parameter versions.
- You cannot have two similar messages, one being a normal message and the other being the singular form of a plural-form message. For Gettext, this is the same message and therefore this creates problems. (Note: there is not any similar problem with contexts.)

#### Translator Comments

Translator comments are a feature that already existed in KDE3, but which was seldom used.

- Translator comment are code comments before a i18n call. To avoid extracting comments that are of little interest for translators, translator comemnts must start with // i18n: or /* i18n: to mark such comments. (Note: translator comments starting with TRANSLATORS (all upper case), as it is Gettext's habit are not supported by KDE4.)
- As in Gettext 0.16.1, contexts are supposed to be short, please consider using a translator comment instead of a context to give long hints to translators.

    // i18n: this is a test sentence
    i18n("The quick brown fox jumps over the lazy dog");

#### i18n calls

The basic call, a message without arguments, context or plural, remains as is:

    i18n("Just plain info");

If there are arguments, `arg` methods are no longer used to substitute the placeholders. Instead, arguments are added to the call:

    i18n("%1 has scored %2", playerName, score);

Arguments can be of several integer types, `double`, `QString`, `QChar` (and perhaps more in the future).

Context call now has a different name, `i18nc`, and takes arguments in the same way:

    i18nc("Player name - score", "%1 - %2", playerName, score);

Plural call is renamed to `i18np` and does away with `%n` placeholder, all being numbered instead:

    i18np("One image in album %2", "%1 images in album %2", n, albumName);

The plural form is decided by first integer-valued argument.

There is one new call variant, the context-plural call:

    i18ncp("Personal file", "One file", "%1 files", n);

`i18n*` calls are realized as templates, and so will take at most some finite number of arguments.

Notes on placeholder substitution:

- Placeholders are substituted in one pass, so no need to worry about argument itself containing a placeholder.
- All same-numbered placeholders are substituted with same argument. This is in contrast to what single-argument `arg` methods of `QString` do.
- Placeholders directly index arguments: they should be numbered from 1 upwards, without gaps in the sequence so that each argument is indexed. The exception is plural-deciding argument in plural call, where it is allowed to drop its placeholder in either singular or plural form.

Sometimes you might need old-style syntax for argument substitution. For example, when there are many arguments, or, more importantly, when it is convenient to defer substitution of arguments. This is possible using new `ki18n` call, with `subs` methods for argument substitution and `toString` method for finalization:

    KLocalizedString ks = ki18n("The Foo-machine reported: %1");
    case (fooErrCode) {
        ERR_OXI: ks.subs(i18n("Out of oxidizer")); break;
        ERR_HYD: ks.subs(i18n("Out of hydrazine")); break;
        ERR_PIL: ks.subs(i18n("Out of pilots")); break;
        default: ks.subs(i18n("Unknown catastrophe"));
    }
    QString scream = ks.toString();

Note that `ki18n` returns object of type `KLocalizedString`, hence the `toString` method for conversion to plain `QString`. The `ki18n` call should be used rarely; the previous example can as well be rewritten to:

    QString problem;
    case (fooErrCode) {
        ERR_OXI: problem = i18n("Out of oxidizer"); break;
        ...
    }
    QString scream = i18n("The Foo-machine reported: %1", problem);

Another case when you might want to use `ki18n` is if you want to format arguments. `subs` methods can take formatting arguments, similar to those of `arg` methods in `QString`. You should never use methods other than `subs` to format numbers in localized messages:

    i18n("Rounds: %1", myNumberFormat(n, 8)); // bad, number not localized
    ki18n("Rounds: %1").subs(n, 8).toString(); // good, number is localized

There is a context, plural and context-plural variant of `ki18n` as well:

    ki18nc("No function", "None").toString();
    ki18np("One file found", "%1 files found").subs(n).toString();
    ki18ncp("Personal file", "One file", "%1 files").subs(n).toString();

If you need translation using locale (KLocale object) other than the default, you can use overloaded `toString` method which takes pointer to locale object (this replaces `KLocale::translate(...)` from KDE3):

    KLocale *myLocale;
    ...
    ki18n("Welcome").toString(myLocale);

There is a script for semi-automatic conversion of KDE 3 code, `i18nk34conv.pl` in `trunk/l10n-kde4/scripts/conversion/`. It will convert most of the calls automatically, and mark the places that need manual review. There is also the script `i18ncheckarg.pl` in `trunk/l10n-kde4/scripts/conversion/`, which will check whether placeholders and arguments match. Use it to catch and correct deferred substitutions (like in the examples above). Both these scripts you can just run without any arguments in top directory of your sources (but you can also specify paths or filenames as arguments). Do not run conversion script twice on same sources!

#### Return to the Table of Contents

### Changes in KSSL

#### KSSLCertDialog

- KSSLCertDlg was renamed to KSSLCertDialog. The header was renamed to ksslcertdialog.h

#### KSSLInfoDialog

- KSSLInfoDlg was renamed to KSSLInfoDialog
- ksslinfodlg.h was moved to ksslinfodialog.h

#### Return to the Table of Contents

### Changes in mime types names

KDE 4 switched to the XDG mime types, thus the names for some mime types have changed.

The following list contains the renamings from the KDE mime types to the XDG ones.

Notes:

- (alias) means that the old KDE mime type is an alias in the corresponding XDG mime type, so the conversion is not strictly needed (although suggested)

Old KDE mime type | XDG mime type
--- | ---
application/chm | application/x-chm
application/fits | image/x-fits
application/java | application/x-java
application/mathml+xml | text/mathml
application/msexcel | application/vnd.ms-excel (alias)
application/mspowerpoint | application/vnd.ms-powerpoint (alias)
application/ms-tnef | application/vnd.ms-tnef
application/pgp | application/pgp-encrypted (alias)
application/vnd.ms-asf | video/x-ms-asf
application/vnd.ms-word | application/msword (alias)
application/vnd.palm | application/x-palm-database (alias)
application/vnd.stardivision.writer-global | application/vnd.stardivision.writer
application/vnd.sun.xml.base | application/vnd.oasis.opendocument.database
application/vnd.sun.xml.writer.master | application/vnd.sun.xml.writer.global
application/wordperfect | application/vnd.wordperfect (alias)
application/x-7z | application/x-7z-compressed
application/x-afm | application/x-font-afm
application/x-applixgraphics | image/x-applix-graphics
application/x-applixspread | application/x-applix-spreadsheet
application/x-applixword | application/x-applix-word
application/x-bz2dvi | application/x-bzdvi
application/x-bzip2 | application/x-bzip (alias)
application/x-dbase | application/x-dbf (alias)
application/x-font-ghostscript | application/x-font-type1
application/x-font-ttc | application/x-font-ttf
application/x-gettext | text/x-gettext-translation (*.po) text/x-gettext-translation-template (*.pot)
application/x-hancomword | application/x-hwp
application/x-iso | application/x-cd-image
application/x-jar | application/x-java-archive (alias)
application/x-javascript | application/javascript (alias)
application/x-msaccess | application/vnd.ms-access (alias)
application/x-msdos-program | application/x-ms-dos-executable
application/x-msmetafile | image/x-wmf
application/x-ogg | application/ogg
application/x-perl-module | application/x-perl
application/x-python | text/x-python
application/x-rar-compressed | application/x-rar
application/x-tbz | application/x-bzip-compressed-tar
application/x-tgz | application/x-compressed-tar
application/x-troff | text/troff (alias)
application/x-zip | application/zip
application/x-zip-compressed | application/zip (alias)
application/xml-dtd | text/x-dtd
audio/mpegurl | audio/x-mpegurl (alias)
audio/x-midi | audio/midi (alias)
audio/x-mp3 | audio/mpeg (alias)
audio/x-oggflac | audio/x-flac+ogg
audio/x-pn-realaudio | audio/vnd.rn-realaudio (alias)
audio/x-speex | audio/x-speex+ogg
audio/x-vorbis | audio/x-vorbis+ogg
audio/vorbis | audio/x-vorbis+ogg
image/fits | image/x-fits
image/jp2 | image/jpeg2000
image/jpg | image/jpeg
image/pjpeg | image/jpeg (alias)
image/svg-xml | image/svg+xml
image/svg+xml | image/svg+xml (*.svg) image/svg+xml-compressed (*.svgz)
image/x-bmp | image/bmp
image/x-djvu | image/vnd.djvu (alias)
image/x-portable-greymap | image/x-portable-graymap
image/x-raw | image/x-dcraw (general mime type) Specific mime types (all subclasses of image/x-dcraw): image/x-panasonic-raw (*.raw) image/x-panasonic-raw2 (*.rw2) image/x-kodak-dcr (*.dcr) image/x-adobe-dng (*.dng) image/x-canon-crw (*.crw *.cr2) image/x-nikon-nef (*.nef) image/x-minolta-mrw (*.mrw) image/x-kodak-k25 (*.k25) image/x-kodak-kdc (*.kdc) image/x-olympus-orf (*.orf) image/x-pentax-pef (*.pef) image/x-fuji-raf (*.raf) image/x-sony-sr2 (*.sr2) image/x-sony-srf (*.srf) image/x-sigma-x3f (*.x3f) other extensions that were part of image/x-raw: image/x-kde-raw
image/x-targa | image/x-tga
image/x-vnd.adobe.photoshop | image/x-psd
image/x-xbm | image/x-xbitmap
image/x-xcf-gimp | image/x-xcf
image/x-xpm | image/x-xpixmap
text/docbook | application/docbook+xml
text/javascript | application/javascript (alias)
text/rss | application/rss+xml (alias)
text/rtf | application/rtf
text/x-csv | text/csv
text/x-diff | text/x-patch
text/mrml | text/x-mrml
text/x-latex | text/x-tex
text/xml | application/xml (alias)
text/x-mswinurl | application/x-mswinurl
text/x-vcalendar | text/calendar (alias)
text/x-vcard | text/directory (alias)
text/x-xslt | application/xslt+xml
video/avi | video/x-msvideo
video/x-ogm | video/x-ogm+ogg
video/x-theora | video/x-theora+ogg

#### Return to the Table of Contents

### Changes in KNewStuff

#### General

KNewStuff is replaced with KNewStuff2. The API for applications has changed completely, as the library is a rewrite and not an update. Do not inherit from any class, use only KNS::Engine. All application-specific properties especially about what to do with downloaded files are configured in *.knsrc files; have a look at knewstuff/doc/porting.txt and knewstuff/doc/tutorial.txt.

#### Upload

- use

      KNS::Entry *entry = KNS::Engine::uploadDialogModal()

- do something with entry, if needed

#### Download

- use

      KNS::Entry::List entries = KNS::Engine::downloadDialogModal()

- do something with the entries, if needed

#### Return to the Table of Contents

### DCOP

DCOP has been replaced with D-Bus.
Help with porting from DCOP to D-Bus can be found at http://techbase.kde.org/Development/Tutorials/Porting_to_D-Bus

#### Return to the Table of Contents

### Printing

libkdeprint has been replaced by enhanced printing support in Qt 4. Qt 4.3 is still lacking in a print preview feature and a customisable print dialog. KPrintPreview (kutils) provides the former, and KdePrint::createPrintDialog() (kdeui) provides the latter, at least for Qt 4.3.2 onwards.

#### Porting involves the following

- using QPrinter instead of KPrinter
- using KdePrint::createPrintDialog() (in kdeui) to get a (customised) QPrintDialog, rather than using KPrinter::setup()
- using KPrintPreview (in kutils) for print preview, rather than KPrinter::setPreviewOnly(true)
- removing the dependency on libkdeprint

If the code uses addDialogPage, you need to change the KPrintDialogPage to a QWidget, and you can get rid of the getOptions and setOptions methods in favor of a method for each option (since QPrintDialog doesn't do anything with the widget except display it). Then the code that called KPrinter::addDialogPage and KPrinter::setup needs to use KdePrint::createPrintDialog instead and get the options directly from the widgets passed to createPrintDialog rather than from the QPrinter. The widgets should also use setWindowTitle() rather than setTitle().

#### For more details, see the following:

- Printing with Qt
- KPrintPreview apidocs
- KdePrint::createPrintDialog apidocs
- KDEPrint Porting on TechBase

#### Return to the Table of Contents