1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <title>Guide to Porting Applications to KDE
4.0</title>
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
6 <style type=
"text/css">
10 font-family: "Bitstream Vera Sans", "Lucida Grande", "Trebuchet MS", sans-serif
;
12 background-color: #ffffff;
22 text-decoration: none
;
28 text-decoration: none
;
33 text-decoration: underline
;
41 font-family: Courier
, 'Courier New', 'Andale Mono', Monaco
, monospace
;
44 border: #2f6fab dashed
;
53 <h1>Porting Applications to KDE
4.0</h1>
56 <p>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
<b>is
</b> the development area, so there are no guarantees.
</p>
58 <p>Deprecated classed that have been renamed to e.g. K3Foo are in kde3support.
</p>
60 <p>This document contains the changes you have to apply to programs written for
61 KDE
3.x when you want to port them to KDE
4.0.
<br>
63 <h3><a name=
"TOC">Table of Contents
</a></h3>
66 <li><a href=
"#gettingstarted">Getting Started
</a></li>
67 <li><a href=
"#globalchanges">Global Changes
</a></li>
68 <li><a href=
"#kab">Changes in kab
</a></li>
69 <li><a href=
"#kdefx">kdefx porting (kdefx has been removed)
</a></li>
70 <li><a href=
"#kdecore">Changes in kdecore
</a></li>
71 <li><a href=
"#kdeui">Changes in kdeui
</a></li>
72 <li><a href=
"#kio">Changes in kio
</a></li>
73 <li><a href=
"#kparts">Changes in kparts
</a></li>
74 <li><a href=
"#kded">Changes in kded
</a></li>
75 <li><a href=
"#kspell">Changes in kspell
</a></li>
76 <li><a href=
"#kdnssd">Changes in kdnssd
</a></li>
77 <li><a href=
"#khtmlpart">API-cleanup in KHTML
</a></li>
78 <li><a href=
"#kfile">Changes in kfile
</a></li>
79 <li><a href=
"#kdesu">Changes in kdesu
</a></li>
80 <li><a href=
"#kcontrol">KDE Control Center
</a></li>
81 <li><a href=
"#kicker">Panel Applets and Extensions
</a></li>
82 <li><a href=
"#kscreensaver">KScreensaver
</a></li>
83 <li><a href=
"#i18n">I18N
</a></li>
84 <li><a href=
"#kssl">KSSL
</a></li>
85 <li><a href=
"#mimetypes">Mime types names
</a></li>
86 <li><a href=
"#knewstuff">KNewStuff
</a></li>
87 <li><a href=
"#dcop">DCOP
</a></li>
88 <li><a href=
"#printing">Printing
</a></li>
91 <h3><a name=
"gettingstarted">Getting started
</a></h3>
93 <p>As a start you should have a look at doc/html/porting4.html in the Qt package,
94 or
<a href=
"http://doc.trolltech.com/4.3/porting4.html">this page online
</a>.
</p>
96 <p>To start with the porting, you can run
"qt3to4 -strict list_of_files"
97 followed by kdesdk/scripts/qt4/adapt-to-qt4-api.pl and kdesdk/scripts/qt4/adapt-to-kde4-api.pl
</p>
99 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
101 <h3><a name=
"globalchanges">Global Changes
</a></h3>
104 The
"const char *name" arguments in the constructors of QObject derived classes
105 have been removed. Use setObjectName() instead if the object name is really necessary.
107 <li>The define KDE_DEPRECATED must be used now at the start of the declaration
108 (but still after an eventual
"static",
"inline" or
"virtual" keyword).
109 KDE_DEPRECATED does not work with constructors, use KDE_CONSTRUCTOR_DEPRECATED
113 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
116 <h3><a name=
"kab">Changes in kab
</a></h3>
118 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
120 <h3><a name=
"kdefx">Changes in kdefx
</a></h3>
122 <p>kdefx has been removed.
</p>
125 <li>KStyle moved to kdeui
</li>
126 <li>Use Solid::Processor instead of KCPUInfo.
</li>
127 <li>Most of KImageEffect is now available in blitz; the bits that aren't can be done with QPainter.
129 <li>Qt has gradients now, please use them if you can. Otherwise blitz has gradients ala KImageEffect.
</li>
132 <li>KPixmapEffect was little more than a wrapper around pixmap-
>image-
>KImageEffect-
>image-
>pixmap. Use the replacements for KImageEffect.
</li>
133 <li>kdrawutils.h is gone.
135 <li>If you already ported your code to KDE4, your code now has a copy of whatever kdrawutil code you were using.
</li>
136 <li>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).
</li>
139 <li>The functionality of KPixmapSplitter cen be emulated with this code, courtesy of Matt Newell:
141 QRect getFlowedRect(int index, const QSize
&itemSize,
142 int layoutWidth, int h_spacing, int v_spacing)
144 // NOTE: if using h_spacing, depending on your use you might want to replace
145 // layoutWidth with (layoutWidth + h_spacing)
146 int itemsPerRow = layoutWidth / (itemSize.width() + h_spacing);
147 return QRect( QPoint( (index % itemsPerRow) * (itemSize.width() + h_spacing),
148 (index / itemsPerRow) * (itemSize.height() + v_spacing) ),
153 <li>Use QPixmap instead of KPixmap.
</li>
156 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
158 <h3><a name=
"kdecore">Changes in kdecore
</a></h3>
161 <li>kuniqueapp.h =
> kuniqueapplication.h
</li>
162 <li>klargefile.h =
> kde_file.h
</li>
163 <li>kcatalogue.h =
> kcatalog.h
</li>
164 <li>kaccelmanager.h =
> kacceleratormanager.h
</li>
165 <li>kprocctrl.h =
> k3protocolcontroller.h
</li>
166 <li>KInstance was renamed to KComponentData
</li>
167 <li>KGlobalAccel moved to kdeui
</li>
168 <li>KGlobalSettings moved to kdeui
</li>
169 <li>KIconLoaded moved to kdeui
</li>
170 <li>KSessionManaged renamed to KSessionManager and moved to kdeui
</li>
171 <li>KShortcut moved to kdeui
</li>
176 <li>KAboutData::setTranslator needs different parameters now.
177 (Please see the corresponding Doxygen comment for the current state.)
</li>
178 <li>new catalogName parameter to constructor can be null or empty, then appName is used as catalog name
</li>
179 <li>all setter methods return object reference, so they can be chained to avoid repeating object name (eg. for addAuthor(), addCredits(), etc.)
</li>
181 <p>I18N_NOOPs in general replaced with KLocalizedString, produced by ki18n()/ki18nc() calls,
182 or just KLocalizedString() if wanted empty.
183 See also
<a href=
"#i18n">the I18N section below
</a>.
</p>
186 <p>Removed. Replaced by the new KAction/QAction framework.
187 See KActionCollection::associateWidget() if you need the old KAccel widget-binding behavior.
</p>
189 <h4>KAccelAction
</h4>
191 <li>Removed. Replaced by the new KAction/QAction framework.
</li>
192 <li>[Old note] KDE3 supported
3 modifier key shortcuts and
4 modifier key (
3+META) shortcuts, because earlier versions of Qt3 didn't
193 support a META modifier/WIN key. This is changed, so now all shortcuts can be
4 modifier key. All instances of
194 shortcut3 and shortcut4 have been reduced just to
"shortcut".
</li>
195 <li>[Old note] The constructor, init(), and insert() functions now only take only KShortcut
"default" argument instead of two
</li>
196 <li>[Old note] Removed shortcutDefault3() and shortcutDefault4(). Use shortcutDefault() instead
</li>
200 <p>Removed. Replaced by the new KAction/QAction framework.
</p>
202 <h4>KApplication
</h4>
204 <li>Moved to kdeui. This means no change for GUI applications.
205 For text-based applications, you should consider switching to QCoreApplication + KComponentData.
208 <li>Command-line argument parsing needed: use KCmdLineArgs as usual and then
209 <pre>QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );
</pre></li>
210 <li>No command-line argument parsing needed: simply create a KComponentData (with
&aboutData or just a name),
211 and then use
<pre>QCoreApplication app( argc, argv );
</pre>
214 <li>Of course if you don't create a KApplication, then you should turn any
"kapp->" into
"qApp->" in the
215 rest of the code.
</li>
216 <li>KApplication does not inherit KInstance/KComponentData anymore. The KComponentData object is
217 available through KGlobal::mainComponent() (if KApplication is the first object to create a
218 KComponentData object, but everything else probably is a bug).
</li>
219 <li>caption() was moved to KGlobal; you can now use it if you don't have a KApplication object
</li>
220 <li>makeStdCaption() was moved to KDialog::makeStandardCaption()
</li>
223 <li>isRestored() should now use qApp-
>isSessionRestored().
</li>
224 <li>keyboardMouseState() has been removed, its functionality is now provided by QApplication::keyboardModifiers() and QApplication::mouseButtons()
</li>
225 <li>random() has been moved to the KRandom class
</li>
226 <li>For using the kiosk restriction/authorization system you have to use the functions provided in KAuthorized.
</li>
227 <li>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()
</li>
228 <li>startService*, kdeinitExec* have been moved to KToolInvocation
</li>
229 <li>static void addCmdLineOptions(); has moved to KCmdLineArgs::addStdCmdLineOptions
</li>
230 <li>getDisplay() has been removed, its functionality is now provided by QX11Info::display()
</li>
231 <li>cut(), copy(), paste(), clear() and selectAll() were moved to KStandardAction. Rather then creating a copy action and connecting it to kapp just use the KStandardAction::copy
</li>
232 <li>guiEnabled() was removed, use QApplication::type() instead.
</li>
233 <li>ref()/deref() was moved to KGlobal (as static methods)
</li>
234 <li>geometryArgument was removed, please use:
237 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(
"kde");
238 if (args
&& args-
>isSet(
"geometry"))
239 geometry = args-
>getOption(
"geometry");
242 <li>installSigpipeHandler() was removed.
</li>
243 <li>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.
</li>
244 <li>The shutDown() signal has been removed, use QApplication's signal aboutToQuit()
</li>
245 <li>enableStyles(), disableStyles(), and the constructor argument has been removed.
</li>
246 <li>installKDEPropertyMap has been moved into k3sqlpropertymap.h and renamed to kInstallKDEPropertyMap. It can be used to keep old c
247 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.
249 const QMetaObject *metaObject = widget-
>metaObject();
250 for (int i =
0; i
< metaObject-
>propertyCount(); ++i) {
251 const QMetaProperty metaProperty = metaObject-
>property(i);
252 if (metaProperty.isUser()) {
253 QString propertyToUse = metaProperty.name();
259 <li>caption() has moved to KComponentData
</li>
260 <li>makeStdCaption(const QString
&, bool, bool) has moved to KDialog and changed signature to makeStdCaption(const QString
&, CaptionFlags)
</li>
261 <li>addKipcEventMask() is unneeded now, and the signals like settingsChanged(), fontChanged() etc. with enums SettingsCategory have moved to KGlobalSettings::self() which is now a QObject
</li>
262 <li>updateRemoteUserTimestamp() now takes DBUS service id instead of dbus name (i.e. something like org.kde. needs to be prepended)
</li>
265 <h4>KAudioPlayer
</h4>
266 <p>Removed, use now Phonon::AudioPlayer
</p>
269 <p>Renamed to KCatalog. Method name parts with
"catalogue" have been renamed to use
"catalog" instead.
</p>
273 <li>KCharsets::codecForName cannot use glibc's i18n data anymore.
274 (Note: this feature was new in KDE
3.5 but never publicly announced.)
</li>
275 <li>The user-visible encoding names are now mostly upper-case
276 (instead of being always lower-case).
</li>
277 <li>KCharsets::languageForEncoding should be replaced
278 by KCharsets::descriptionForEncoding. The function KCharsets::languageForEncoding is planned to be removed before the release of KDE4.
</li>
279 <li>The status of the encoding UTF-
7 is not guaranteed to be kept, as Qt
280 does not support this encoding.
</li>
281 <li><b>TODO
</b>: see which member functions can be removed. The functions handling entites are planned to be moved out of the class KCharsets.
</li>
286 <li>All methods using a QCString removed. The methods use QByteArray now.
</li>
287 <li>Header renamed to kcodecs.h
</li>
290 <h4>KConfigBackend
</h4>
292 <li>Removed filename(), use fileName()
</li>
295 <h4>KSimpleConfig
</h4>
296 <p>This class was removed. It was a very thin wrapper around KConfig and should
299 <li>If you use an absolute path, just change KSimpleConfig with KConfig - there was
300 no difference between uses of them for KDE3 either.
</li>
301 <li>If you want just the local file to open replace KSimpleConfig(
"file") with
302 KConfig(
"file", KConfig::SimpleConfig);
</li>
307 <li>setGroup is deprecated as it creates state. Use group(QString) to receive
308 a KConfigGroup object or create a KConfigGroup object yourself:
310 KConfig *config = KGlobal::config();
311 config-
>setGroup(
"Group");
312 config-
>writeEntry(
"Key",
0);
314 should be rewritten as
316 KConfigGroup config = KGlobal::config()-
>group(
"Group");
317 config.writeEntry(
"Key",
0);
320 <li>setDesktopGroup is gone. Use KDesktopFile (and its desktopGroup() method) if
321 you want to read .desktop files - or use group(
"Desktop Entry") instead
</li>
322 <li>It's no longer necessary to specify a KConfig object is read-only - they are always
323 unless you use change it
</li>
324 <li>The KConfig constructors were changed to receive flags instead of boolean values, i.e.
326 <li><tt>KConfig(
"file", false /* read-write */, false /* no globals */);
</tt> becomes
327 <tt>KConfig(
"file", KConfig::NoGlobals);
</tt> (note the read-write flag is gone)
</li>
328 <li><tt>KConfig(
"file", true);
</tt>becomes
<tt>KConfig(
"file");
</tt></li>
335 <li>all read*Entry methods deprecated, use
<b>template
<typename T
> readEntry(key, const T
&)
</b> in KConfigGroup instead.
336 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
<em>explicit
</em> construction to disambiguate the type wanted, i.e.
338 <li>bool var = readEntry(key,
<b>false
</b>);
</li>
339 <li>int var = readEntry(key,
<b>int(SomeEnumValue)
</b>);
</li>
340 <li>QColor var = readEntry(key, QColor(
<b>Qt::black
</b>)); // no conversion from Qt::GlobalColor to QVariant
341 <li>long var = readEntry(key,
<b>0</b>); // conversion from long to QVariant is ambiguous, so can't use
<b>long(
0)
</b>.
</li>
343 If you need to access top-level config entries (those without any group), use KConfigGroup with the group name
<i><default
></i>.
345 <li>readEntry(const QString
&, const QString
&) no longer has a default argument, add QString() as
348 <li>all writeEntry* methods removed, mostly not noticeable, but some types don't automatically convert
349 to QVariant. You need to cast to a type that is directly convertible to QVariant. i.e.
352 group.writeEntry(
"someKey", timeVal); // ambiguous conversion
353 group.writeEntry(
"someKey", int(timeVal)); // ok
356 <li>all read*ListEntry methods deprecated, renamed to KConfigGroup::readEntry. Most types use the template version.
<br/>
357 <b>template
<typename T
> readEntry(key, const QList
<T
>&)
</b><br/>If you just write group.readEntry(key, list) it should work for any type that QVariant can convert to QString.
359 <li>writeEntry, deleteGroup, and deleteEntry do not take several boolean options (persistent,global,localized) anymore, but instead one QFlags
</li>
362 <h4>KConfigGroupSaver
</h4>
364 The class KConfigGroupSaver has been removed, instead use KConfigGroup. The
365 difference is a KConfigGroupSaver object directly affects the config object it
366 is acting on, while a KConfigGroup object only ensures the entries read or
367 written through it are in the correct group.
</p>
370 KConfig *config = KGlobal::config();
371 KConfigGroupSaver saver(config,
"group name");
373 config-
>readXXX(
"entry name");
375 should be rewritten as:
377 KConfigGroup cg = KGlobal::config()-
>group(
"group name");
379 cg.readXXX(
"entry name");
382 <h4>KCmdLineArgs
</h4>
384 <li> 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)));
385 <li> noKApp parameter is gone, instead: Q_FLAGS(StdCmdLineArgs)
</li>
386 <li> new catalog parameter can be null or empty, then appname is used as catalog name
</li>
387 <li> KLocalizedString objects produced by ki18n()/ki18nc() calls (instead of previous I18N_NOOPs), or just KLocalizedString() if needed empty
</li>
388 <li> static void usage(const QString
&error) -
> static void usageError(const QString
&error)
</li>
391 <h4>KCmdLineOptions
</h4>
392 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.
394 <h4><a name=
"KComponentData">KComponentData
</a> (was KInstance)
</h4>
396 <li>value based class using shared data: In KDE4 don't work with pointers to KComponentData anymore.
397 Internally it is reference counted and the data deleted when the last reference goes out of scope.
</li>
398 <li>config() returns a KSharedConfigPtr
</li>
399 <li>sharedConfig() was removed in favour of config()
</li>
400 <li>iconLoader() was moved to KApplication
</li>
401 <li>newIconLoader() was moved to KApplication
</li>
404 <h4>kdDebug/kdWarning/kdFatal
</h4>
405 <p>These functions have been renamed to
<code>kDebug
</code>,
406 <code>kWarning
</code>,
<code>kFatal
</code>, resp. They now print the
407 function info, so printing the function name by hand, or using
408 <code>k_funcinfo
</code> is now deprecated. An
<code>endl
</code> is
409 performed implicitly. The type of stream used is now
410 <code>QDebug
</code>.
</p>
412 <p>Instead of repeating the debug area all over the place, define
413 <code>KDE_DEFAULT_DEBUG_AREA
</code> instead:
</p>
415 - kdDebug(
1234 ) << k_funcinfo <<
"entered" << endl;
416 + kDebug() <<
"entered";
418 <p>And, in your
<code>CMakeLists.txt
</code>:
</p>
420 + add_definitions( -DKDE_DEFAULT_DEBUG_AREA=
1234 )
423 <h4>KDesktopFile
</h4>
425 <li>QString filename() const -
> QString fileName() const
</li>
426 <li>more standards compliant. See
427 <a href=
"http://www.freedesktop.org/Standards/desktop-entry-spec/latest">
428 Desktop Entry Spec
</a>
430 <li>.kdelnk files are no longer supported, rename to .desktop.
</li>
431 <li>deprecated header [KDE Desktop Entry], change to [Desktop Entry], using desktopGroup()
</li>
432 <li>type FSDev is no longer supported, change to FSDevice
</li>
435 <li>Same as in KConfig: the use of readEntry() or writeEntry() on a KDesktopFile should
436 be replaced by readEntry/writeEntry on a KConfigGroup. By default the desktopGroup() of
437 the KDesktopFile was used, otherwise use group(
"another_group").
</li>
440 <h4>KExtendedSocket
</h4>
441 <p>This class has been removed. See below on KNetwork::K*Socket.
</p>
445 <li>device() -
> createDevice() to indicate that you must delete the device afterwards.
</li>
450 <li>"int kasciistricmp( const char *str1, const char *str2 )
" has been moved into kascii.h
</li>
451 <li>"KIconLoader* iconLoader()
" has been moved to KIconLoader::global()
</li>
452 <li>instance() renamed to mainComponent()
</li>
453 <li>activeInstance() renamed to activeComponent()
</li>
454 <li>setActiveInstance() renamed to setActiveComponent()
</li>
455 <li>static members _locale, _instance and so on are private now, if you want to get or set the
456 KLocale use locale()/setLocale()/hasLocale() and if you want to know whether a mainComponent is set use
457 hasMainComponent()
</li>
458 <li>config() returns a KSharedConfig::Ptr now instead of KConfig*
</li>
459 <li>sharedConfig() has been removed in favour of config()
</li>
463 <p>Deprecated and renamed to K3Icon; replacement is KIcon in kdeui.
</p>
464 <p><b>Note:
</b> at the moment you have to keep using K3Icon as a namespace for states, groups, and contexts though.
</p>
467 <p>Renamed to
<a href=
"#kcomponentdata">KComponentData
</a></p>
470 <p>Removed. Use KGlobalSettings::self()-
>emitChange() instead of KIPC::sendMessageAll().
</p>
473 <p>Removed. Use plain ints as the Qt key code instead.
</p>
475 <li>When replacing KKey(QKeyEvent*), you need to OR the event-
>key() and event-
>modifiers() to get the replacement.
</li>
476 <li>The QtWIN enum has been removed. Use Qt::META or Qt::MetaModifier instead.
</li>
477 <li>modFlagLabel() was removed, use either KKeyServer::modToStringUser(), or QKeySequence(Qt::yourmodifier).toString()
</li>
482 <p>Removed. Use plain ints as the Qt key code instead.
</p>
484 <h4>KKeySequence
</h4>
485 <p>Removed. Use QKeySequence instead.
486 Note that QKeySequence expects multiple shortcuts to be separated by
", " (i.e. a comma then a space) in converting from text.
</p>
490 <li>use KPluginLoader or KService::createInstance instead whenever possible
</li>
491 <li>The resolve(const char* name) and symbol(const char* name) methods were merged and renamed to resolveSymbol
</li>
492 <li>bool hasSymbol was removed, use resolveFunction instead
</li>
493 <li>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.
</li>
498 <li>renamed to KPluginFactory
</li>
499 <li>create methods take a QVariantList instead of QStringList
</li>
502 <h4>KGenericFactory
</h4>
504 <li>use K_PLUGIN_FACTORY macro instead: this will require to change your plugin constructor from QStringList to QVariantList
</li>
505 <li>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.
</li>
510 <li> QString formatNumber(const QString
&numStr) const -
> QString formatNumber(const QString
&numStr, bool round=true, int precision=
2) const;
</li>
511 <li> bool weekStartsMonday() const -
> int weekStartDay() const
</li>
512 <li> 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;
</li>
513 <li> QString weekDayName(int i, bool shortName = false) const -
> calendar()-
>weekDayName
</li>
514 <li> QString monthNamePossessive(int i, bool shortName = false) const -
> calendar()-
>monthNamePossessive()
</li>
515 <li> void setWeekStartsMonday(bool start) -
> setWeekStartDay
</li>
516 <li> QString formatDate(const QDate
&, bool shortFormat = false) const -
> QString formatDate(const QDate
&, DateFormat = LongDate) const
</li>
517 <li> QString formatDateTime(const QDateTime
&, bool shortFormat = true, bool includeSecs = false) const -
> QString formatDateTime(const QDateTime
&, DateFormat = ShortDate, bool includeSecs = false) const
</li>
518 <li> languages() -
> languageList()
</li>
519 <li> formatMoney(const QString
&numStr) -
> QString formatMoney(double num, const QString
& currency = QString::null, int digits = -
1) const;
</li>
520 <li> charset() -
> gone
</li>
521 <li> setCharset() -
> gone
</li>
522 <li>removeCatalogue was renamed to removeCatalog
</li>
523 <li>QStringList languagesTwoAlpha() -
> QStringList languageList()
</li>
524 <li>QStringList allLanguagesTwoAlpha() -
> QStringList allLanguagesList()
</li>
525 <li>QStringList allCountriesTwoAlpha() -
> QStringList allCountriesList()
</li>
526 <li>QString twoAlphaToLanguageName(const QString
&language) -
> QString languageCodeToName(const QString
&language)
</li>
527 <li>QString twoAlphaToCountryName(const QString
&country) -
> QString countryCodeToName(const QString
&country)
</li>
529 <p>See also
<a href=
"#i18n">the I18N section below
</a>.
</p>
531 <h4>KMacroExpander
</h4>
533 <li>KMacroExpander now takes a QHash and not a QMap
</li>
536 <h4>KMimeSourceFactory
</h4>
537 <p>KMimeSourceFactory was automatically instanciated by KApplication which allowed the use of
"icon:name" in Qt richtext.
538 Q3MimeSourceFactory being in Qt3Support, and this feature being very rarely used, K3MimeSourceFactory isn't instanciated
539 automatically anymore, you need to call K3MimeSourceFactory::install() in your main if you still depend on this feature.
</p>
541 <h4>KMultipleDrag
</h4>
542 <p>KMultipleDrag is obsolete, use QMimeData directly to provide contents in different mime formats.
</p>
543 <p>To make porting more incremental, K3MultipleDrag is provided for code that needs to work with
544 Q3DragObject until being fully ported.
</p>
546 <h4>KNetwork::KIpAddress
</h4>
547 <p>Removed. Use QHostAddress instead.
</p>
549 <h4>KNetwork::KResolver
</h4>
550 <p>Removed. If you need to resolve a hostname, use QHostInfo from QtNetwork.
</p>
552 <h4>KNetwork::KSocketAddress and KNetwork::KInetSocketAddress
</h4>
553 <p>Removed. Use QHostAddress and an integer (a quint16_t) to store the port number.
</p>
555 <h4>KNetwork::KUnixSocketAddress
</h4>
556 <p>Removed. Simply use a QString to represent the path or identifier. See the documentation on KLocalSocket.
</p>
558 <h4>KNetwork::K*Socket
</h4>
560 <li>All of these classes are deprecated. Use the QTcpSocket,
561 QUdpSocket and QTcpServer equivalents from QtNetwork.
</li>
562 <li>When porting, use KSocketFactory when creating any sockets that
563 are used to communicate with remote hosts (that is, anything that is
564 not
"localhost"). Examples follow:
<br>
566 <b>Connecting to a remote host:
</b>
567 <p><em>Old code:
</em></p>
572 KBufferedSocket *socket = new KBufferedSocket(parent);
573 if (!socket-
>connect(host, QString::number(port))) {
577 connect(socket, SIGNAL(connected(KResolverEntry)), SLOT(socketConnected()));
578 connect(socket, SIGNAL(gotError(int)), SLOT(socketError(int)));
586 QUrl url(QString(
"%1://%2:%3").arg(prototocol, host).arg(port));
588 QTcpSocket *socket = KSocketFactory::connectToHost(protocol, host, port, parent);
590 // QTcpSocket *socket = KSocketFactory::connectToHost(url, parent);
591 connect(socket, SIGNAL(connected()), SLOT(socketConnected()));
592 connect(socket, SIGNAL(error(QAbstractSocket::SocketError), SLOT(QAbstractSocket::SocketError)));
595 <b>Opening a socket for receiving remote connections:
</b>
596 <p><em>Old code:
</em></p>
600 KServerSocket *ss = new KServerSocket(QString::number(port), parent);
601 connect(ss, SIGNAL(readyAccept()), this, SLOT(slotReadyAccept()));
602 connect(ss, SIGNAL(gotError(int)), this, SLOT(slotSocketError(int)));
611 QTcpServer *ts = KSocketFactory::listen(protocol, QHostAddress::Any, port, parent);
612 connect(ts, SIGNAL(newConnection()), this, SLOT(slotReadyAccept()));
615 <li><b>Caveat:
</b> all member functions in QTcpSocket
616 are
<em>asynchronous
</em> and buffered. There's no equivalent
617 "blocking" mode for QTcpSocket. If you need an action to complete,
618 you have to use
<tt>waitForReadyRead
</tt> and
<tt>flush
</tt>
619 (or
<tt>waitForBytesWritten
</tt>) in the socket object. If you need
620 to wait for a connection to be established,
621 use
<tt>KSocketFactory::synchronousConnectToHost
</tt>.
</li>
624 <h4>KNotifyClient
</h4>
625 <p>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
</p>
628 <p>The kde3 version was deprecated and renamed to K3Process, header is k3process.h.
629 Its usage is discouraged as it will create problems when being used together with
630 the new KProcess or QProcess in the same application, this is more of a problem in
631 applications that use KParts or plugins and can't control what those plugins do.
</p>
633 <li>start() lost all arguments, the setup of communication and program/arguments
634 has to be done before starting the process
</li>
635 <li>suspend() and resume() where removed for now
</li>
636 <li>quoting support moved to KShell namespace
</li>
637 <li>getPid() was renamed to just pid()
</li>
638 <li>clearArguments() was renamed to clearProgram()
</li>
642 <p>Deprecated and renamed to K3ProcessController, header is k3processcontroller.h.
</p>
645 <p>Deprecated and renamed to K3ProcIO, header is k3procio.h.
</p>
648 <p>Removed. Use QRegExp instead.
</p>
651 This class has been deprecated by KDateTime. It has been renamed K3RFCDate and moved to the libkde3support. The following method changes make porting easy:
653 <li>KRFCDate::parseDate( string ) becomes KDateTime::fromString( string, KDateTime::RFCDate).toTime_t();
</li>
654 <li>KRFCDate::parseDateISO8601( string ) becomes KDateTime::fromString( string ).toTime_t();
</li>
655 <li>KRFCDate::localUTCOffset() becomes KDateTime::Spec::LocalZone().utcOffset /
60. Note that the KRFCDate version returned minutes while KDateTime returns seconds.
</li>
660 <li>KSaveFile has been modified from its KDE
3.x behavior to allow for new backup methods:
662 <li>KSaveFile::backupFile() will use the backup behavior specified in KConfig.
</li>
663 <li>KSaveFile::simpleBackupFile() will emulate the KDE
3.x behavior
</li>
664 <li>KSaveFile::numberedBackupFile() will create a numbered set of backup files (default:
10)
</li>
665 <li>KSaveFile::rcsBackupFile() will use rcs to maintain the backup file
</li>
667 <li>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().
</li>
668 <li>KSaveFile::close() is now KSaveFile::finalize()
</li>
669 <li>You must call KSaveFile::open() to create the file.
</li>
672 <h4>KShortcutDialog
</h4>
673 <p>Removed, see KKeySequenceWidget/KShortcutWidget.
</p>
675 <h4>KShortcutList and derivatives
</h4>
676 <p>Removed - no longer needed. Saving and loading of shortcuts is now performed in KActionCollection, KGlobalAccel, and KStandardShortcut.
</p>
678 <h4>KSortableValueList
</h4>
680 <li>Has been ported to QList, renamed to KSortableList and the header is ksortablelist.h
</li>
683 <h4>KStandardDirs
</h4>
685 <li>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:
687 <li>calcResourceHash
</li>
688 <li>findAllResources
</li>
689 <li>findResource
</li>
696 <h4><a name=
"KStandardShortcut">KStandardShortcut
</a> (was KStdAccel)
</h4>
698 <li>Removed deprecated methods
</li>
699 <li>Removed WhatThis, use WhatsThis
</li>
700 <li>shortcutDefault3() and shortcutDefault4() have been removed, use shortcutDefault() instead
</li>
703 <h4>KStaticDeleter
</h4>
704 <p>Either use K3StaticDeleter or port to the
<a href=
"http://api.kde.org/4.0-api/kdelibs-apidocs/kdecore/html/group__KDEMacros.html#g75ca0c60b03dc5e4f9427263bf4043c7">K_GLOBAL_STATIC
</a> macro.
707 <p>Renamed to
<a href=
"#KStandardShortcut">KStandardShortcut
</a></p>
709 <h4>KStringHandler
</h4>
711 <li>static QString ljust( const QString
&text , int width ) -
> QString::leftJustified
</li>
712 <li>static QString rjust( const QString
&text , int width ) -
> QString::rightJustified
</li>
713 <li>matchFilename -
> matchFileName
</li>
714 <li>static QString word( const QString
&text , int pos ) -
> QString::section
</li>
715 <li>::randomString() has been moved to KRandom::randomString()
</li>
716 <li>::lPixelSqueeze( text, fm, width ) -
> fm.elidedText( text, Qt::ElideLeft, width )
</li>
717 <li>::cPixelSqueeze( text, fm, width ) -
> fm.elidedText( text, Qt::ElideMiddle, width )
</li>
718 <li>::rPixelSqueeze( text, fm, width ) -
> fm.elidedText( text, Qt::ElideRight, width )
</li>
723 <li>existing() was removed, use exists() instead
</li>
724 <li>setAutoDelete() renamed to setAutoRemove()
</li>
725 <li>The default for setAutoRemove() is now true instead of false
</li>
726 <li>qDir() was removed as it was unused
</li>
730 <p>Deprecated and renamed to K3TempFile. Use KTemporaryFile instead.
</p>
731 <p>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.
</p>
735 <li>Renamed to KUrl, but a typedef is available for source compatibility
</li>
736 <li>KUrl inherits QUrl now, but the API offered by KUrl is mostly unchanged
</li>
737 <li>filename() has been removed, use fileName() instead
</li>
738 <li>isMalformed -
> !isValid()
</li>
739 <li>prettyURL(
0,KUrl::StripFileProtocol) -
> pathOrURL()
</li>
740 <li>fromPathOrURL() is deprecated, use the KUrl(str) constructor which now accepts both paths and urls
</li>
741 <li>htmlURL() had to be removed, please use Qt::escape(url.prettyUrl()) now, with #include
<QTextDocument
>.
742 This requires libQtGui, which is why it can't be in KUrl anymore.
</li>
743 <li>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.
</li>
744 <li>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.
</li>
745 <li>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).
746 <li>cleanPath(), queryItems(), fileName(), directory(), equals() now take a QFlags argument instead of boolean
</li>
747 <li>*URL* renamed to *Url*:
749 <li>hasSubURL() -
> hasSubUrl()
</li>
750 <li>prettyURL() -
> prettyUrl()
</li>
751 <li>pathOrURL() -
> pathOrUrl()
</li>
752 <li>upURL() -
> upUrl()
</li>
753 <li>isRelativeURL() -
> isRelativeUrl()
</li>
754 <li>relativeURL() -
> relativeUrl()
</li>
760 <p>This class has been moved to kde3support. Use KUrl::populateMimeData() and
761 KUrl::List::populateMimeData() in the drag/copy side,
762 and the static methods KUrl::List::canDecode() and KUrl::List::fromMimeData()
763 in the drop/paste side.
</p>
765 <li>Example: Replace
<pre> KURL::List uriList;
766 if ( KURLDrag::canDecode(e)
&& KURLDrag::decode( e, uriList ) ) {
</pre>
767 by
<pre> KUrl::List uriList = KUrl::List::fromMimeData( e-
>mimeData() );
768 if ( !uriList.isEmpty() ) {
</pre></li>
771 <h4>KVMAllocator
</h4>
772 <p>Removed, as it was unused.
</p>
775 This class has been merged with KWinModule into class KWindowSystem (in kdeui).
777 <li>appStarted() removed, use KStartupInfo::appStarted() instead
</li>
778 <li>info(WId win) removed, use windowInfo() instead
</li>
779 <li>struct Info was removed, use WindowInfo instead
</li>
783 This class has been merged with KWinModule into class KWindowSystem (in kdeui).
784 Don't create instances, use static functions and KWindowSystem::self() for connecting to signals.
786 <li>Functions related to systemtray have been removed. They worked only with the obsolete
787 KDE systray mechanism.
</li>
788 <li>stackingOrder() no longer returns a reference to a list. Make a copy of the value first if using iterators.
</li>
791 <h4>KWin::WindowInfo
</h4>
792 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.
796 <li>locate() and locateLocal() moved into the namespace KStandardDirs
</li>
801 <li>NETRootInfo(Display *display, Window supportWindow, const char *wmName,unsigned long properties, int screen = -
1, bool doActivate = true) -
>
802 NETRootInfo(Display *display, Window supportWindow, const char *wmName,
803 const unsigned long properties[], int properties_size,
804 int screen = -
1, bool doActivate = true); old properties is the first element of the new array
806 <li>unsigned long supported() -
> const unsigned long* supportedProperties() const;
</li>
807 <li> unsigned long properties() const -
> gone
</li>
808 <li> WindowType windowType() -
> WindowType windowType( unsigned long supported_types ) const;
</li>
811 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
813 <h3><a name=
"kdeui">Changes in kdeui
</a></h3>
815 <li>kactionclasses.h went away, use the several kxxxaction.h instead
</li>
816 <li>kanimwidget.h was renamed to kanimatedbutton.h to reflect the class name
</li>
817 <li>kcolordlg.h went away, use kcolordialog.h
</li>
818 <li>kcolorbtn.h went away, use kcolorbutton.h
</li>
819 <li>kdatapik.h went away, use kdatepicker.h
</li>
820 <li>kdualcolorbtn.h went away, use kdualcolorbutton.h
</li>
821 <li>KLanguageButton (and therefore klanguagebutton.h) was removed due to licensing issues (GPLv2, which is not allowed in kdelibs)
</li>
822 <li>klistbox.h was renamed to klistwidget.h to reflect the class name
</li>
823 <li>kpassdlg.h went away, use kpassworddialog.h
</li>
824 <li>kxmlgui.h went away, use kxmlguifactory.h
</li>
825 <li>kfontcombo.h went away, use QFontComboBox
</li>
826 <li>libkwalletclient (which used to provide the KWallet class) has been merged with kdeui
</li>
827 <li>system color scheme accessors in kglobalsettings.h are deprecated, use kcolorscheme.h
</li>
828 <li>KPalette was renamed to KColorCollection
</li>
829 <li>KPaletteTable was renamed to KColorTable and moved to private API
</li>
832 <h4>KAboutContainer
</h4>
833 <p>Deprecated and renamed to K3AboutContainer. Use KAboutApplicationDialog or KAboutKdeDialog directly.
</p>
835 <li>KAboutContainer constructor int args have been replaced by Qt::Alignment
</li>
836 <li>addTitle int args replaced by Qt::Alignment
</li>
837 <li>addImage int args replaced by Qt::Alignment
</li>
840 <h4>KAboutContributor
</h4>
841 <p>Deprecated and renamed to K3AboutContributor. Use KAboutApplicationDialog or KAboutKdeDialog directly.
</p>
843 <li>void setURL( const QString
& ) -
> void setUrl( const QString
& )
</li>
844 <li>QString getName( void ) const -
> QString name() const
</li>
845 <li>QString getEmail( void ) const -
> QString email() const
</li>
846 <li>QString getURL( void ) const -
> QString url() const
</li>
847 <li>QString getWork( void ) const -
> QString work() const
</li>
848 <li>signal void openURL() -
> void openUrl()
</li>
851 <h4>KAboutDialog
</h4>
852 <p>Deprecated and renamed to K3AboutDialog. Use KAboutApplicationDialog or KAboutKdeDialog directly.
</p>
854 <li>changed enum names
<br>
857 AbtTabbed -
> Tabbed
859 AbtImageLeft -
> ImageLeft
860 AbtImageRight -
> ImageRight
861 AbtImageOnly -
> ImageOnly
862 AbtProduct -
> Product
863 AbtKDEStandard -
> KDEStandard
864 AbtAppStandard -
> AppStandard
865 AbtImageAndTitle -
> ImageAndTitle
868 <li>Constructor: K3AboutDialog( QWidget *parent =
0, bool modal = true ) -
> KAboutDialog( QWidget *parent =
0 )
</li>
869 <li>Constructor: K3AboutDialog( int dialogLayout, const QString
&caption, ButtonCodes buttonMask,
870 ButtonCode defaultButton, QWidget *parent=
0, bool modal=false, bool separator = false,
871 const QString
&user1 = QString(),
872 const QString
&user2 = QString(),
873 const QString
&user3 = QString() ) -
>
874 K3AboutDialog( int dialogLayout, const QString
&caption, QWidget *parent =
0 ) (see KDialog how to port)
</li>
875 <li>void setIcon( const QString
&fileName ) which was deprecated has been removed
</li>
876 <li>addContainerPage int args are now Qt::Alignment args
</li>
877 <li>addScrolledContainerPage int args are now Qt::Alignment args
</li>
878 <li>addContainer int args are now Qt::Alignment args
</li>
879 <li>signal void openURL() -
> void openUrl()
</li>
880 <li>void imageURL() -
> void imageUrl()
</li>
881 <li>void openURLSlot() -
> void openUrlSlot()
</li>
884 <h4>KAboutWidget
</h4>
885 <p>Deprecated and renamed to K3AboutWidget. Use KAboutApplicationDialog or KAboutKdeDialog directly.
</p>
887 <li>signal void openURL() -
> void openUrl()
</li>
888 <li>void openURLSlot() -
> void openUrlSlot()
</li>
891 <h4><a name=
"KAction">KAction
</a></h4>
892 <p>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.
</p>
893 <p>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().
</p>
895 <li>KAction is now a subclass of QWidgetAction.
</li>
896 <li>Don't use setIconSet() anymore, use setIcon(KIcon(iconName)) instead
</li>
897 <li>activated(), activated(int) signals deprecated - use triggered() signal instead
</li>
898 <li>activate() is now trigger(), as in QAction
</li>
899 <li>there is a replacement for activation providing keyboard + mouse states, see triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) [currently buggy]
</li>
900 <li>plugAccel(), unplugAccel(), kaccelCount() removed - they have no use now (accelerator management is inside Qt)
</li>
901 <li>itemId(), getToolButtonID() removed - actions no longer have ids, basically the QAction* is its replacement
</li>
902 <li>setGroup() / group() removed - use QActionGroup instead (setActionGroup() / actionGroup())
</li>
903 <li>ActivationReason has been removed (not supported by Qt). For a surrogate, you can connect to QMenu::triggered(QAction*), QToolBar::actionTriggered(QAction*), etc.
</li>
904 <li>setters are no longer slots; where they were used as such, an intermediary will be required
</li>
905 <li>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.
</li>
906 <li>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).
</li>
907 <li>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)
</li>
908 <li>Renamed
"Custom" shortcuts to
"Active" shortcuts.
</li>
909 <li>Added setShortcut(QKeySequence
&) to explicitly override QAction::setShortcut.
</li>
910 <li>Functions in KActionCollection or KXMLGUIFactory for example don't take or return KAction pointers
911 anymore but instead operate on QAction pointers. If you get compilation errors with code like the
912 following then just replace KAction with QAction:
914 QAction *a = actionCollection()-
>action(
"foo");
917 Also if you get errors about KAction being an unknown type it is often enough to forward declare
918 KAction in your header file.
919 <li>plug() -
> QWidget::addAction()
920 <li>unplug() -
> QWidget::removeAction()
921 <li>isPlugged() -
> !action-
>associatedWidgets().isEmpty()
922 <li>containerCount() -
> action-
>associatedWidgets().count()
923 <li>container(int i) -
> action-
>associatedWidgets().value(i)
924 <li>hasIcon() -
> !action-
>icon().isNull()
925 <li>setIconName(string) -
> setIcon(KIcon(string))
926 <li>unplugAll() -
> Rarely needed, but if you are sure that you need it replace it with the following
929 foreach (QWidget *w, action-
>associatedWidgets())
930 w-
>removeAction(action);
932 <li>The KAction constructors changed completely. The constructors taking various action properties,
933 a pointer to an acion collection and the name of the action have been removed. The new pattern is to
934 create the actions like regular QObjects with a parent (owner). Then you set various properties using
935 setText, setIcon, etc. . As a last step the action can be added to the action collection with a name.
937 KAction *a = new KAction(this);
938 a-
>setText(i18n(
"I am ported"));
939 a-
>setIcon(KIcon(
"shiny"));
940 a-
>setShortcut(Qt::ControlModifier + Qt::Key_A);
941 actionCollection -
> addAction(
"name_of_the_action", a);
943 KActionCollection additional provides convenience overloads for creating named KAction objects or
944 standard actions (KStandardAction). For example:
946 QAction *a = actionCollection -
> addAction(
"action_name");
947 a-
>setText(i18n(
"I have been ported, too"));
948 connect(a, SIGNAL(triggered()), this, SLOT(portedToKde4()));
950 actionCollection -
> addAction(KStandardAction::Copy, this, SLOT(copy()))
954 <h4>KActionCollection
</h4>
956 <li>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)
</li>
957 <li>*AutoConnectShortcuts removed - irrelevant
</li>
958 <li>*accel() removed - irrelevant (KAccel no longer handles key presses)
</li>
959 <li>New functions setConfigGroup(), setConfigGlobal(), configGroup(), configIsGlobal() - the action collection now stores the group whether the config is global. referenced in readSettings() / writeSettings()
</li>
960 <li>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.
</li>
961 <li>{set}HighlightingEnabled(), {connect|disconnect}Highlight() removed - highlighting is always enabled now
</li>
962 <li>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.
</li>
963 <li>groups() removed (now using QActionGroups) - see actionGroups() (and actionsWithoutGroup()) for replacement
</li>
964 <li>actions( const QString
& group ) removed - use actionGroups() instead, and then QActionGroup::actions()
</li>
965 <li>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
</li>
966 <li>insert(KAction *) -
> addAction(const QString
&name, QAction *action)
967 <li>remove(KAction *) -
> removeAction(QAction *action)
968 <li>take(KAction *) -
> takeAction(QAction *action)
971 <h4>KActionSelector
</h4>
973 <li>Q3ListBox -
> QListWidget
</li>
974 <li>selectedListBox -
> selectedListWidget
</li>
975 <li>availableListBox -
> availableListWidget
</li>
978 <h4>KActionSeparator
</h4>
979 <p>Used to be renamed to KSeparatorAction. KSeparatorAction/KActionSeparator is dead now. Just create a QAction object and call setSeparator(true); on it.
</p>
980 <p><b>Note:
</b> you need to create multiple separator actions if you want to insert multiple separators into a widget, unlike with KDE3.
</p>
982 <h4>KActiveLabel
</h4>
983 <p>Deprecated and renamed to K3ActiveLabel. Use QLabel instead.
</p>
985 <li>Use QLabel::setOpenExternalLinks(true) for labels with hyperlinks.
</li>
986 <li>Use QLabel::setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard) for labels whose text should be selectable by user.
</li>
987 <li>Inherits from KTextBrowser instead of Q3TextBrowser
</li>
988 <li>You don't need anymore to disconnect the linkClicked signal to handle manually link, use KTextBrowser::setNotifyClick(true)
</li>
989 <li>linkClicked -
> KTextBrowser::urlClick
</li>
992 <h4><a name=
"KAnimatedButton">KAnimatedButton
</a> (was KAnimWidget)
</h4>
994 <li>Now a subclass of QToolButton, acts in a much more standard fashion
</li>
995 <li>size(), setSize() replaced by iconSize(), setIconSize()
</li>
996 <li>Call updateIcons() whenever you change the iconSize() (the setter is non-virtual :( )
</li>
1000 <p>Renamed to
<a href=
"#KAnimatedButton">KAnimatedButton
</a></p>
1003 <p>Removed since it was not used.
</p>
1007 <li>void updateURL() -
> void updateUrl()
</li>
1011 <p>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.
</p>
1013 <h4>KCharSelectTable
</h4>
1014 <p>Removed from public API. Use KCharSelect.
</p>
1016 <h4>KCharSelect
</h4>
1018 <li>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.
</li>
1019 <li>highlighted()/focusItemChanged()/activated() -
> currentCharChanged(QChar)
</li>
1020 <li>doubleClicked() -
> charSelected(QChar)
</li>
1021 <li>setFont()/font() -
> setCurrentFont()/currentFont()
</li>
1022 <li>fontChanged() -
> currentFontChanged()
</li>
1023 <li>QFont is used for fonts instead of a QString containg the font face.
</li>
1024 <li>setChar()/chr() -
> setCurrentChar()/currentChar()
</li>
1025 <li>enableFontCombo(), enableTableSpinBox(), isFontComboEnabled() and isTableSpinBoxEnabled() are removed.
</li>
1029 <h4>KColorCells
</h4>
1031 <li>KColorCells now inherits from QTableWidget instead of Q3GridView.
</li>
1032 <li>numCells() has been replaced by count().
</li>
1033 <li>getSelected() has been replaced by selectedIndex().
</li>
1034 <li>The parameters of the colorSelected() and colorDoubleClicked() signals now include both the index of the color which
1035 was selected and the color itself as arguments
</li>
1038 <h4><a name=
"KColorCollection">KColorCollection
</a> (was KPalette)
</h4>
1040 <li>nrColors() was renamed to count()
</li>
1041 <li>colorName() was renamed to name()
</li>
1042 <li>getPaletteList() was renamed to installedCollections()
</li>
1043 <li>color(int), name(int) and name(const QColor
&) have been made const
</li>
1047 <p>Deprecated and renamed to K3ColorDrag. Use QMimeData directly instead or KColorMimeData, which most closely resembles KColorDrag
</p>
1049 <h4>KColorScheme
</h4>
1050 <p>New class that provides access to system-wide, user configurable color roles.
1051 Like QPalette, the return type is now QBrush instead of QColor.
1052 As of
4.0 the brushes are solid colors, but this may change in the future.
</p>
1054 <p><b>Warning:
</b> KDE4 is trying
<i>really
</i> hard to abandon the notion that
1055 the active palette == the inactive palette (because this is really helpful for
1056 the oxygen windeco which does not use
"traditional" windeco colors, and because
1057 for various reasons kwin can't be entirely responsible for the effect). When
1058 porting to KDE4, you will need to take this into consideration. The new class
1059 KStatefulBrush has been added to help with this, as well as the adjustForeground
1060 and adjustBackground methods of KColorScheme.
</p>
1062 <p>There are lots of bugs as a result of this; some in applications, and at
1063 least a few in Qt. Please report application bugs to the appropriate maintainer
1064 or list, and general (i.e. occurring in many/all applications) bugs to
1065 <a href=
"mailto:kde-core-devel@kde.org">k-c-d
</a>.
</p>
1067 <p>See the
<a href=
"http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/classKColorScheme.html">KColorScheme documentation
</a> for further information.
</p>
1069 <h4><a name=
"KColorTable">KColorTable
</a> (was KPaletteTable)
</h4>
1071 <li>palette() was renamed to name()
</li>
1072 <li>slot setPalette() was renamed to slot setColors()
</li>
1077 <li>void setURLDropsEnabled() -
> void setUrlDropsEnabled()
</li>
1078 <li>bool isURLDropsEnabled() -
> bool urlDropsEnabled()
</li>
1079 <li>void setEditURL() -
> void setEditUrl()
</li>
1080 <li>void addURL( ... ) -
> void addUrl( ... )
</li>
1081 <li>void insertURL( ... ) -
> void insertUrl( ... )
</li>
1082 <li>void changeURL( ... ) -
> void changeUrl( ... )
</li>
1086 <p>Deprecated and renamed to K3Command, header is k3command.h.
</p>
1088 <h4>KCommandHistory
</h4>
1089 <p>Deprecated and renamed to K3CommandHistory, header is k3command.h.
</p>
1091 <h4>KCompletion
</h4>
1093 <li>enableSounds() was removed, use setSoundsEnabled()
</li>
1094 <li>disableSounds() was removed, use setSoundsEnabled()
</li>
1095 <li>isSoundsEnabled() -
> soundsEnabled()
</li>
1098 <h4>KConfigDialog
</h4>
1100 <li>The dialog name is now a QString instead of a const char*
</li>
1101 <li>signal void settingsChanged(const char *dialogName); -
> void settingsChanged(const QString
& dialogName);
</li>
1102 <li>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
<pre>connect(myDialog, SIGNAL(settingsChanged(const QString
&)), this, SLOT(mySlot()));
</pre></li>
1105 <h4>KContextMenuManager
</h4>
1107 <li>KContextMenuManager::insert() :
1110 KContextMenuManager::insert(widget, menu);
1114 widget-
>setContextMenuPolicy(Qt::ActionsContextMenu);
1115 widget-
>addActions(menu-
>actions());
1117 <li>Otherwise consider handling the context menu in a contextMenuEvent() handler, which Qt
1118 calls automatically on a right-mouse-button click or on activation by the context menu key.
1119 There's no need to do anything in mousePressEvent/mouseReleaseEvent/keyPressEvent.
1124 <li>KCursor is now a QCursor, allowing for loading of non-standard icons from themes
</li>
1125 <li>The static methods for loading various cursor types are gone, just use QCursor( Qt::CursorShape ) directly instead
</li>
1128 <h4>KDatePicker
</h4>
1130 <li>signal void dateChanged(QDate); was replaced by void dateChanged( const QDate
&);
</li>
1131 <li>signal void dateEntered(QDate); was replaced by void dateEntered( const QDate
&);
</li>
1132 <li>signal void dateSelected(QDate); was replaced by void dateSelected( const QDate
&)
</li>
1133 <li>changed the order of the constructor's parameter
</li>
1134 <li>removed getData() method. Use date() instead
</li>
1135 <li>removed protected slot
<tt>void selectWeekClicked()
</tt></li>
1140 <li>signal void dateChanged(QDate); was replaced by void dateChanged(const QDate
&);
</li>
1141 <li>changed the order of the constructor's parameter
</li>
1142 <li>removed getData() method. Use date() instead
</li>
1145 <h4>KDateWidget
</h4>
1147 <li>signal void changed(QDate); was changed by void changed(const QDate
&)
</li>
1152 <li>Simplified ctor.
1156 KDialog dlg( parent, i18n(
"my caption"), modal, Ok | Cancel | User1, Ok, false, i18n(
"Share File"))
1158 should be rewritten as
1160 KDialog dlg( parent );
1161 dlg.setCaption( i18n(
"my caption") );
1162 dlg.setModal( modal );
1163 dlg.setButtons( Ok | Cancel | User1 );
1164 dlg.setButtonGuiItem( User1, i18n(
"Share File") );
1165 dlg.setDefaultButton( Ok );
1166 dlg.showButtonSeparator( false );
1169 <li>setButtonMask() -
> setButtons() and setButtonGuiItem()
</li>
1170 <li>setButtonBoxOrientation() -
> setButtonsOrientation()
</li>
1171 <li>setButtonOKText, setButtonApplyText , setButtonCancelText -
> setButtonText( ButtonCode, const QString
& )
</li>
1172 <li>setDetails() -
> setDetailsWidgetVisible()
</li>
1173 <li>don't overide anymore slotFoo(). You now need to connect to FooClicked signal.
1174 Or reimplement accept() and reject() to intercept the Ok and Cancel button
</li>
1175 <li>enableButtonOK -
> enableButtonOk
(lower case 'k')
</li>
1176 <li>enableButtonSeparator -
> showButtonSeparator
</li>
1179 <h4>KDialogBase
</h4>
1180 <p>Deprecated. Use KDialog or KPageDialog instead.
</p>
1182 <li>If the KDialogBase is Swallow or Plain mode you should replace it with KDialog, for
1183 all other modes use KPageDialog
1187 QWidget *page = plainPage();
1191 QWidget *page = new QWidget( this );
1192 setMainWidget( page );
1194 All makeXXXMainWidget() methods can be replaced by the following schema:
1196 KVBox *mainWidget = makeVBoxMainWidget();
1200 KVBox *mainWidget = new KVBox( this );
1201 setMainWidget( mainWidget );
1204 <li>If you use a KPageDialog, the following steps must be taken...
1208 KDialogBase dlg( Tabbed,
0, parent, name, modal, i18n(
"my caption" ), ... )
1212 KPageDialog dlg( parent );
1213 dlg.setFaceType( KPageDialog::Tabbed );
1214 dlg.setObjectName( name );
1215 dlg.setModal( modal );
1216 dlg.setCaption( i18n(
"my caption" ) );
1219 All addXXXPage() methods can be replaced by the following schema:
1221 KVBox *page = addVBoxPage( i18n(
"My Title" ), i18n(
"My Header" ), QPixmap(
"image" ) );
1225 KVBox *page = new KVBox();
1226 KPageWidgetItem *item = addPage( page, i18n(
"My Title" ) );
1227 item-
>setHeader( i18n(
"My Header" ) );
1228 item-
>setIcon( KIcon(
"image" ) );
1231 <li>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.).
1235 <h4>KDockWindow
</h4>
1236 <p>This class is obsolete and is provided for compatibility only. Use KSystemTrayIcon instead.
</p>
1238 <h4>KDualColorButton
</h4>
1239 <p>Removed since it was not used.
</p>
1243 <li>The signal gotUrlDrop was removed, nobody used it, and it's easy to do in the application
1244 if needed (see the KURLDrag section)
</li>
1247 <h4>KEditListBox
</h4>
1249 <li>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
</li>
1252 <h4>KEditToolbar
</h4>
1254 <li>KEditToolbar is now KEditToolBar
</li>
1255 <li>The static setDefaultToolBar was renamed to setGlobalDefaultToolBar
</li>
1256 <li>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.
</li>
1259 <h4>KEditToolbarWidget
</h4>
1261 <li>KEditToolbar is now KEditToolBarWidget
</li>
1262 <li>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.
</li>
1267 <li>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.
</li>
1268 <li>The options argument in the constructor is now an enumerated flag of type KFind::Options.
</li>
1269 <li>resetCounts() was renamed to resetMatchCount().
</li>
1270 <li>The Options flags from KReplace were added to the Options enumeration of KFind.
</li>
1273 <h4>KFontChooser
</h4>
1275 <li>Was in kfontdialog.h, but was moved to it's own header, so now either do #include
<KFontChooser
> or #include
<kfontchooser.h
></li>
1276 <li>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:
1278 <li>3rd parameter onlyFixed -
> FixedFontsOnly
</li>
1279 <li>5th parameter makeFrame -
> DisplayFrame
</li>
1280 <li>7th parameter diff -
> ShowDifferences
</li>
1285 <h4>KFontDialog
</h4>
1287 <li>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:
1289 <li>3rd parameter onlyFixed -
> KFontChooser::FixedFontsOnly
</li>
1290 <li>5th parameter makeFrame -
> KFontChooser::DisplayFrame
</li>
1291 <li>7th parameter diff -
> KFontChooser::ShowDifferences
</li>
1294 <li>The second argument for getFontDiff() is now a reference to a KFontChooser::FontDiffFlags instead of an int.
</li>
1297 <h4>KGlobalAccel
</h4>
1299 <li>Moved from kdecore.
</li>
1300 <li>bool useFourModifierKeys() has been removed (we always use four modifier keys now).
</li>
1301 <li>Now a singleton
</li>
1302 <li>You shouldn't need to access this class much... just use setGlobalShortcut() in KAction.
</li>
1305 <h4>KGlobalSettings
</h4>
1307 <li>Moved from kdecore.
</li>
1308 <li>KGlobalSettings is now a QObject so can emit signals like kdisplayPaletteChanged() instead of KApplication
</li>
1309 <li> deprecated
"static QString trashPath()
" has been removed. use KIO::trash instead
</li>
1310 <li>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.
</li>
1313 <h4>KGradientSelector
</h4>
1315 <li>Reversed the value range, if orientation is horizontal. Now minimum is on the left and maximum on the right side.
</li>
1320 <li>Don't use setIconSet anymore, use setIcon instead, there is no compatibility class or function
</li>
1323 <h4>KHistoryCombo
</h4>
1324 <p>Renamed to KHistoryComboBox.
</p>
1326 <li>Was in kcombobox.h, but was moved to it's own header, so now do #include
<khistorycombobox.h
></li>
1329 <h4>KHSSelector
</h4>
1331 <li>Renamed to KHueSaturationSelector, moved to kxyselector.h
</li>
1336 <li>New class (old one renamed to K3Icon)
</li>
1337 <li>Thin wrapper around QIcon which creates a KIconEngine corresponding to the kde named icon
</li>
1340 <h4>KIconLoader
</h4>
1342 <li>Moved from kdecore and is now a QObject.
</li>
1343 <li>Deprecated loadIconSet(), DesktopIconSet(), BarIconSet(), SmallIconSet(), UserIconSet(): use KIcon(name) or KIcon(name,instance-
>iconLoader()) instead.
<br/>
1344 Note that this can change slightly the look of the icon in some cases: for instance if code was calling setIcon(BarIconSet())
1345 on a pushbutton, it meant the icon was loaded at toolbar size and then resized down.
1346 With KIcon(name), the small icon is picked up instead, which might look different, but this is the correct behavior.
1347 These deprecated methods were also altered to not take a KComponentData (KInstance* in KDE3), which was an optional parameter in KDE3.
</li>
1348 <li>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.
</li>
1351 <h4>KInputDialog
</h4>
1353 <li>static QString KInputDialog::text( const QString
&caption,...) was replaced by QString KInputDialog::getText( const QString
&caption,...)
</li>
1356 <h4>KIntNumInput, KDoubleNumInput, KDoubleSpinBox
</h4>
1358 <li>Qt::Alignment for label alignment instead of int
</li>
1359 <li>setMinValue(min) -
> setMinimum(min) / minValue() -
> minimum()
</li>
1360 <li>setMaxValue(min) -
> setMaximum(min) / maxValue() -
> maximum()
</li>
1363 <h4>KDoubleSpinBox
</h4>
1365 <li>It was removed and replaced by QDoubleSpinBox
</li>
1368 <h4>KIntSpinBox
</h4>
1370 <li>In the long version of the constructor, the arguments parent and base have switched places.
</li>
1373 <h4>KJanusWidget
</h4>
1374 <p>Deprecated. Use KPageWidget instead.
</p>
1377 <p>Removed. Use either KKeySequenceWidget or KShortcutWidget. Use KShortcutWidget only if you really want two possible shortcuts. Both don't pop up a modal dialog.
</p>
1379 <h4>KKeyChooser
</h4>
1380 <p>Renamed to
<a href=
"#KShortcutsEditor">KShortcutsEditor
</a>.
</p>
1383 <p>Renamed to
<a href=
"#KShortcutsDialog">KShortcutsDialog
</a>.
</p>
1387 <li>int ensureRoundLed() -
> virtual int ledWidth() const
</li>
1388 <li>virtual void paintRound() -
> virtual void paintRaised()
</li>
1393 <li>void cursorAtEnd() removed, use QLineEdit::end(false) instead
</li>
1394 <li>unused protected slots removed: void slotAboutToShow() and void slotCancelled()
</li>
1395 <li>void setEnableSqueezedText( bool enable ) -
> void setSqueezedTextEnabled( bool enable )
</li>
1396 <li>void setURLDropsEnabled() -
> void setUrlDropsEnabled()
</li>
1397 <li>bool isURLDropsEnabled() -
> bool urlDropsEnabled()
</li>
1398 <li>void setURL() -
> void setUrl()
</li>
1401 <h4>KLineEditDlg
</h4>
1402 <p>Was deprecated, has been removed. Use KInputDialog instead.
</p>
1404 <h4>KListAction
</h4>
1405 <p>Removed; as per comments, did not add anything to KSelectAction.
</p>
1408 <p>Deprecated and renamed to K3ListBox. Use KListWidget (based on the QListWidget class).
</p>
1411 <p>Deprecated and renamed to K3ListView.
<br>
1412 There is no direct KDE replacement for this class yet.
<br>
1413 Either use KListWidget for list-based widgets or QTreeWidget for tree-based
1414 widgets. Note that only QTreeWidget supports headers.
</p>
1416 <h4>KListViewSearchLine
</h4>
1417 <p>Deprecated and renamed to K3ListViewSearchLine.
<br>
1418 You should port from K3ListView to QTreeWidget and then use
1419 KTreeWidgetSearchLine instead.
</p>
1421 <h4>KMacroCommand
</h4>
1422 <p>Deprecated and renamed to to K3MacroCommand, header is k3command.h.
</p>
1424 <h4>KMainWindow
</h4>
1426 <li>getMemberList() was replaced by memberList() and memberList was renamed to mMemberList and made it private
</li>
1427 <li>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.
<br>
1428 * Override sizeHint() in the central widget so that it returns the desired size.
<br>
1429 * Call updateGeometry() in the central widget whenever the desired size changes. This ensures that the new sizeHint() is properly propagated to any parent layout.
<br>
1430 * Now call adjustSize() in the main window to resize the main window such that the central widget will become the desired size.
</li>
1431 <li>Ported to QMainWindow
</li>
1432 <li>accel() removed - KAccel no longer needed
</li>
1433 <li>If you need XmlGui functions from KMainWindow you may want to use KXmlGuiWindow instead of KMainWindow.
</li>
1436 <h4>KMainWindowInterface
</h4>
1438 <li>functionsDynamic() now returns a DCOPCStringList
</li>
1439 <li>function processDynamic arguments uses DCOPCString instead of QCString :
1440 <pre>bool processDynamic(const DCOPCString
&fun, const QByteArray
&data, DCOPCString
& replyType, QByteArray
&replyData);
</pre></li>
1441 <li>actions() now returns a DCOPCString
</li>
1444 <h4><a name=
"KMenu">KMenu
</a> (was KPopupMenu)
</h4>
1446 <li>indexes replaced by QAction*
</li>
1447 <li>title, titlePixmap, and changeTitle removed - use QAction::text(), QAction::icon(), QAction::setText() and QAction::setIcon
</li>
1448 <li>contextMenuFocusItem changed to contextMenuFocusAction in line with the change from indexes to actions
</li>
1451 <h4>KMessageBox
</h4>
1453 <li>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(),
1454 warningContinueCancelList(), warningContinueCancelListWId(), warningYesNoCancel(), warningYesNoCancelWId(), warningYesNoCancelList(), warningYesNoCancelListWId(), messageBox(), messageBoxWId().
</li>
1457 <h4>KNamedCommand
</h4>
1458 <p>Deprecated and renamed to K3NamedCommand, header is k3command.h.
</p>
1462 <li>Renamed to
<a href=
"KColorCollection">KColorCollection
</a></li>
1465 <h4>KPaletteTable
</h4>
1467 <li>Renamed to
<a href=
"KColorTable">KColorTable
</a></li>
1470 <h4>KPassivePopup
</h4>
1472 <li>clicked single now emits a const QPoint reference
</li>
1475 <h4>KPasswordEdit
</h4>
1476 <p>Deprecated and renamed to K3PasswordEdit. Use KLineEdit, with KLineEdit::setPasswordMode(true).
</p>
1478 <h4>KPasswordDialog
</h4>
1479 <p>Deprecated and renamed to K3PasswordDialog.
</p>
1481 <li>asking for a new password -
> KNewPasswordDialog
</li>
1482 <li>password() return QString
</li>
1483 <li>getPassword() gone, use the following code instead
</li>
1484 <!-- <li>kpassdlg.h was renamed kpassworddialog.h.</li> -->
1485 <!-- <li>checkPassword take now a QString as argument</li> -->
1488 KPasswordDialog dlg(parent);
1489 dlg.setPrompt( prompt );
1490 dlg.setWindowTitle( caption );
1491 if( dlg.exec() != QDialog::Accepted )
1493 use( dlg.password() );
1497 <p>Removed. Use QPixmap.toImage() and QPixmap::fromImage().
</p>
1499 <h4>KPixmapRegionSelecorDialog
</h4>
1501 <li>getSelectedRegion was changed to selectedRegion
</li>
1502 <li>getSelectedImage was changed to selectedImage
</li>
1506 <p>Renamed to
<a href=
"#KMenu">KMenu
</a>.
</p>
1508 <h4>KPopupTitle
</h4>
1509 <p>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.
</p>
1512 <p>Removed. Use QProgressBar instead.
</p>
1514 <li>advance(int offset) -
> setValue(value()+offset)
</li>
1515 <li>QProgressBar has changed a lot in Qt4 ( setTotalSteps(totalSteps) -
> setRange(
0, totalSteps), setProgress -
> setValue, percentageChanged -
> valueChanged ). For more details see QProgressBar class reference.
</li>
1518 <h4>KProgressDialog
</h4>
1520 <li>#include
<kprogressdialog.h
> instead of #include
<kprogress.h
></li>
1521 <li>progressBar() is a now QProgressBar instead of a KProgressBar -
> See KProgress API changes
</li>
1522 <li>setLabel(const QString
&) renamed to setLabelText(const QString
&)
</li>
1525 <h4>KPushButton
</h4>
1527 <li>Don't use setIconSet anymore, use setIcon instead, there is no compatibility class or function
</li>
1530 <h4>KRadioAction
</h4>
1531 <p>Removed. Use KAction (or KToggleAction if you need different text/icons for the selected state) instead, in combination with an exclusive QActionGroup
</p>
1533 <h4>KRecentFilesAction
</h4>
1535 <li>clearURLList() removed, use clear() instead
</li>
1536 <li>*URL* -
> *Url* as per KDE naming policy
</li>
1537 <li>the maxItem property is now an int (was a uint) (affects all accessors methods)
</li>
1540 <h4>KRootPixmap
</h4>
1541 <p>Removed since it was not used.
</p>
1543 <h4>KSelectAction
</h4>
1545 <li>now allows for combo box or button with popup menu when inserted to a toolbar
</li>
1546 <li>popupMenu() removed, use menu() instead
</li>
1547 <li>{set|}removeAmpersandsInCombo() removed - was deprecated
</li>
1552 <li>KSeparator now uses Qt::Vertical and Qt::Horizontal rather then QFrame's HFrame and VFrame.
</li>
1555 <h4>KSessionManager
</h4>
1556 <p>Moved from kdecore, renamed from KSessionManaged, and moved to it's own header: ksessionmanager.h or KSessionManager
</p>
1558 <h4>KSharedPixmap
</h4>
1559 <p>Removed since is was not used.
</p>
1563 <li>Moved from kdecore.
</li>
1564 <li>Now reentrant
</li>
1565 <li>Only uses QKeySequences now
</li>
1566 <li>Removed list semantics; remove() still has somewhat list-like behavior.
</li>
1567 <li>Introduced
"primary" and
"alternate" shortcuts to replace the arbitrary list of shortcuts
</li>
1568 <li>Removed casting operators
</li>
1569 <li>Removed operator
< and operator
></li>
1570 <li>Added a qHash(const KShortcut
&) function so you can use QHash with KShortcut instead of QMap
</li>
1571 <li>remove() -
> removeAll()
</li>
1572 <li>toList() -
> Not needed anymore since KShortcut inherits QList
<QKeySequence
></li>
1573 <li>toStringInternal() -
> You shouldn't be using this! But use toString() instead
</li>
1576 <h4><a name=
"KShortcutsEditor">KShortcutsEditor
</a> (was KKeyChooser)
</h4>
1578 <li>Added new constructor parameter: ActionTypes types. Allows you to filter the types of actions shown in the dialog.
</li>
1579 <li>Removed all functions dealing with old classes KShortcutList, KGlobalAccel (kde3 version)
</li>
1580 <li>Global shortcut conflict checking functions moved to KGlobalAccel.
</li>
1581 <li>Standard shortcuts checking functions were removed.
</li>
1583 <p>See also
<a href=
"#KShortcutsDialog">KShortcutsDialog
</a>.
</p>
1585 <h4><a name=
"KShortcutsDialog">KShortcutsDialog
</a> (was KKeyDialog)
</h4>
1587 <li>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.
</li>
1588 <li>Rewritten. It was hard to read, which stood in the way of future changes/improvements.
</li>
1589 <li>Uses a new GUI layout.
</li>
1590 <li>removed KDE2 deprecated functions
</li>
1591 <li>Added new constructor parameter: KKeyChooser::ActionTypes types. Allows you to filter the types of actions shown in the dialog.
</li>
1596 <li>The unused BarStatus enum was removed.
</li>
1597 <li>The 'permanent' bool has been removed in favor of more explicit naming.
<br>
1598 insertItem(text,id,true) -
> insertPermanentItem(text,id),
<br>
1599 insertFixedItem(text,id,true) -
> insertPermanentFixedItem(text,id)
</li>
1603 <p>Renamed to KStandardAction, header is kstandardaction.h.
</p>
1605 <li>showToolbar() methods have been removed, see KMainWindow::setStandardToolBarMenuEnabled()
</li>
1608 <h4>KStdGuiItem
</h4>
1609 <p>Renamed to KStandardGuiItem, header is kstandardguiitem.h.
</p>
1611 <li>The StdItem enum was renamed to StandardItem
</li>
1614 <h4>KSyntaxHighlighter
</h4>
1616 <li>Use K3SyntaxHighlighter because it used Q3TextEdit or use KSyntaxHighlighter when your application will use QTextEdit
</li>
1619 <h4>KSystemTray
</h4>
1620 <p>Renamed to KSystemTrayIcon for consistency with its actual purpose and naming in Qt (QSystemTrayIcon).
</p>
1622 <li>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.
</li>
1627 <li>colors, close buttons on individual tabs not working at the moment
</li>
1628 <li>The old insertTab and removeTab have been removed, use addTab / insertTab / removeTab from QTabBar instead (uses indices, not QTab*s)
</li>
1632 <p>Removed. Use QTabWidget.
</p>
1634 <h4>KTextBrowser
</h4>
1636 <li>Inherits from QTextBrowser instead of Q3TextBrowser
</li>
1641 <li>void highLightWord() -
> void highlightWord()
</li>
1644 <h4>KTimeWidget
</h4>
1645 <p>Removed. Use QTimeEdit.
</p>
1647 <h4>KTimezoneWidget
</h4>
1648 <p>Renamed to KTimeZoneWidget.
</p>
1650 <h4>KToggleAction
</h4>
1652 <li>setExclusiveGroup() / exclusiveGroup() removed, use setActionGroup() and QActionGroup::setExclusive() for exclusivity (imitates the deleted KRadioAction class)
</li>
1653 <li>in comparison with KAction, adds setCheckedState() and sets this action to checkable
</li>
1656 <h4>KToggleFullScreenAction
</h4>
1658 <li>Simplified constructor
1662 KToggleFullScreenAction( const KShortcut
&cut, const QObject* receiver, const char* slot,
1663 KActionCollection* parent, QWidget* window, const QString
& name )
1667 KToggleFullScreenAction( QWidget* window, KActionCollection* parent, const QString
& name )
1669 See
<a href=
"#KAction">KAction
</a> how to port the other arguments.
1676 <li>Ported to QToolBar
</li>
1677 <li>IconText, iconText(), setIconText() replaced by QToolBar::toolButtonStyle() et. al.
</li>
1678 <li>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)
</li>
1679 <li>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
</li>
1680 <li>iconSize(), setIconSize() now a QToolBar property, and a QSize instead of an int - convenience function setIconDimensions() takes an int instead
</li>
1681 <li>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)
</li>
1682 <li>flat(), setFlat() replaced by movable(), setMovable() (old
"flat" concept equivalent to not movable)
</li>
1683 <li>layout-related methods removed (done by QToolBar's layout)
</li>
1684 <li>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)
</li>
1685 <li><tt>enum BarStatus
</tt> and
<tt>bool enable(BarStatus stat)
</tt> have been
1687 <li><tt>void enableMoving(bool flag)
</tt> and
<tt>void enableFloating (bool
1688 flag)
</tt> have been removed in favor of
<tt>setMovingEnabled(bool)
</tt></li>
1689 <li><tt>int maxHeight()/int maxWidth()
</tt> removed in favor of
1690 <tt>maximumHeight()/maximumWidth()
</tt></li>
1691 <li><tt>void setMaxHeight (int h)
</tt> and
<tt>void setMaxWidth (int dw)
</tt>
1692 removed in favor of
<tt>setMaximumHeight()/setMaximumWidth()
</tt></li>
1693 <li>void setEnableContextMenu(bool enable = true) -
> void setContextMenuEnabled(bool enable = true)
</li>
1696 <h4>KToolBarButton
</h4>
1697 <p>Removed. Done by QToolButton now.
</p>
1699 <h4>KToolBarLabelAction
</h4>
1701 <li>Simplified constructors:
1705 KToolBarLabelAction( const QString
&text,
1706 const KShortcut
&cut,
1707 const QObject *receiver, const char *slot,
1708 KActionCollection *parent, const QString
& name )
1712 KToolBarLabelAction( const QString
&text,
1713 KActionCollection *parent, const QString
& name )
1717 KToolBarLabelAction( QAction *buddy, const QString
&text,
1718 const KShortcut
&cut,
1719 const QObject *receiver, const char *slot,
1720 KActionCollection *parent, const QString
& name )
1724 KToolBarLabelAction( QAction *buddy, const QString
&text,
1725 KActionCollection *parent, const QString
& name )
1728 See KAction for how to port the other arguments.
1733 <h4>KToolBarRadioGroup
</h4>
1734 <p>Removed. Done by QToolButton now.
</p>
1736 <h4>KToolBarSeparator
</h4>
1737 <p>Removed. Use QAction::setSeparator().
</p>
1739 <h4>KUndoRedoAction
</h4>
1740 <p>Deprecated and renamed to K3UndoRedoAction, header is k3command.h.
</p>
1744 <li>renamed to KUrlLabel
</li>
1745 <li>void setAltPixmap() -
> void setAlternatePixmap()
</li>
1746 <li>QPixmap* altPixmap() -
> QPixmap* alternatePixmap()
</li>
1747 <li>void setGlow() -
> void setGlowEnabled()
</li>
1748 <li>void setFloat() -
> void setFloatEnabled()
</li>
1749 <li>void setURL() -
> void setUrl()
</li>
1750 <li>signal: void enteredURL( ... ) -
> void enteredUrl( ... )
</li>
1751 <li>signal: void leftURL( ... ) -
> void leftUrl( ... )
</li>
1752 <li>signal: void leftClickedURL( ... ) -
> void leftClickedUrl( ... )
</li>
1753 <li>signal: void rightClickedURL( ... ) -
> void rightClickedUrl( ... )
</li>
1754 <li>signal: void middleClickedURL( ... ) -
> void middleClickedUrl( ... )
</li>
1757 <h4>KValueSelector
</h4>
1758 <p>Renamed to KColorValueSelector, moved to kcolorvalueselector.h
</p>
1760 <h4>KWidgetAction
</h4>
1761 <p>Removed. Use KAction or QWidgetAction and utilise its widget-setting capabilities.
</p>
1763 <h4>KWindowListMenu
</h4>
1764 <p>Moved to libkworkspace in kdebase
</p>
1767 <p>Deprecated and renamed to K3Wizard. Use KAssistantDialog.
</p>
1769 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
1771 <h3><a name=
"kio">Changes in kio
</a></h3>
1773 <h4>KAbstractFileWidget
</h4>
1775 <li>void setPreviewWidget(const KPreviewWidgetBase *w) -
> void setPreviewWidget(KPreviewWidgetBase *w)
</li>
1778 <h4>KArchive/KTar/KZip/KAr
</h4>
1780 <li>All sizes and file offsets now use qint64 (similar to QIODevice)
</li>
1781 <li>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.
</li>
1782 <li>API changes for users of the class: isOpened() was renamed to isOpen(),
1783 doneWriting() to finishWriting(), and the order of the arguments for writeFile() is more usual:
1784 data comes before size.
</li>
1785 <li>KTarDirectory -
> KArchiveDirectory
</li>
1786 <li>KTarFile -
> KArchiveFile
</li>
1787 <li>KTarEntry -
> KArchiveEntry
</li>
1788 <li>KTarGz -
> KTar
</li>
1791 <h4>KBookmark classes
</h4>
1793 <li>KBookmarkDrag class has been moved to kde3support. Use KBookmark::populateMimeData() and
1794 KBookmark::List::populateMimeData() in the drag/copy side,
1795 and the static methods KBookmark::List::canDecode() and KBookmark::List::fromMimeData()
1796 in the drop/paste side.
</li>
1797 <li>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.
</li>
1798 <li>KBookmarkMenu and KBookmarkBar no longer emits openBookmark(), override KBookmarkOwner::openBookmark() instead.
</li>
1799 <li>KBookmarkOwner::openBookmarkURL() was replaced by KBookmarkOwner::openBookmark()
</li>
1800 <li>KExtendBookmarkOwner functionality was integrated into KBookmarkOwner. (And the API is more regular now.)
</li>
1801 <li>KBookmarkMenu::slotBookmarksChanged() and KBookmarkMenu::fillBookmarkMenu() are no longer public. Both had comments, that they shouldn't be used anyway.
</li>
1802 <li>KBookmarkMannager::managerForFile() requires a DBus Name as the second parameter.
</li>
1805 <h4>KDEDesktopMimeType class
</h4>
1807 <li>All the static methods have been moved to KDesktopFileActions, in kdesktopfileactions.h
</li>
1810 <h4>KDirLister class
</h4>
1812 <li>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.
</li>
1813 <li>KDirLister uses KFileItem by value now:
1815 <li>KFileItem* rootItem() const -
> KFileItem rootItem() const
</li>
1816 <li>KFileItem* findByUrl( const KUrl
& url ) const -
> KFileItem findByUrl( const KUrl
& url ) const
</li>
1817 <li>KFileItem* findByName( const QString
& name ) const -
> KFileItem* findByName( const QString
& name ) const
</li>
1818 <li>bool matchesFilter( const KFileItem* ) const -
> bool matchesFilter( const KFileItem
& ) const
</li>
1819 <li>bool matchesMimeFilter( const KFileItem* ) const -
> bool matchesMimeFilter( const KFileItem
& ) const
</li>
1822 <li>The following signals have changed:
1824 <li>void deleteItem( KFileItem *_fileItem ) -
> void deleteItem( const KFileItem
&fileItem )
</li>
1825 <li>void refreshItems( const KFileItemList
&items ) -
> void refreshItems( const QList
<QPair
<KFileItem, KFileItem
>> &entries)
</li>
1830 <h4>KDiskFreeSp class
</h4>
1832 <li>Renamed to KDiskFreeSpace, moved to kdiskfreespace.h
</li>
1835 <h4>KDESasl class
</h4>
1837 <li>This class is removed due to its inflexiblity, use cyrus-sasl or the upcoming QCA SASL implementation
</li>
1840 <h4>KDirSelectDialog
</h4>
1842 <li>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
</li>
1845 <h4>KFileDialog,KDirSelectDialog,KUrlRequesterDlg,KCustomMenuEditor,KUrlBarItemDialog
</h4>
1847 <li> are KDialogBases no more, now they are a KDialogs
</li>
1848 <li> no more name and modal parameters in the constructors
</li>
1851 <h4>KFileDialog, KDirOperator
</h4>
1853 <li> instead of KConfig* + QString group everywhere KConfigGroup is used now
</li>
1856 <h4>KFileDialog
</h4>
1858 <li>Changed constructor and method 'startDir' arguments from QString to KUrl
1864 static QString getOpenFileNameWId( ... )
1865 static QStringList getOpenFileNames( ... )
1866 static KUrl getOpenURL( ... )
1867 static KUrl::List getOpenURLs( ... )
1868 static QString getSaveFileName( ... )
1869 static QString getSaveFileNameWId( ... )
1870 static KUrl getSaveURL( ... )
1871 static QString getExistingDirectory( ... )
1872 static KUrl getExistingURL( ... )
1873 static KUrl getImageOpenURL( ... )
1876 <li>getOpenURL, getOpenURLs, getExistingURL and getSaveURL were renamed to getOpenUrl, getOpenUrls, getExistingUrl and getSaveUrl (i.e. URL was replaced by Url everywhere)
</li>
1877 <li>void toolbarCallback(int) was removed
</li>
1878 <li>void pathComboChanged( const QString
& ); was removed
</li>
1879 <li>void dirCompletion( const QString
& ); was removed
</li>
1880 <li>void setFilterMimeType(const QString
&label, const KMimeType::List
&types, const KMimeType::Ptr
&defaultType) was removed
</li>
1881 <li>void setPreviewWidget(const QWidget *w) was removed
</li>
1882 <li>void updateStatusLine(int dirs, int files); was removed
</li>
1883 <li>protected member locationEdit is now a method locationEdit()
</li>
1884 <li>protected member filterWidget is now a method filterWidget()
</li>
1885 <li>getExistingUrl -
> getExistingDirectoryUrl
</li>
1888 <h4>KFileIconView, KFileDetailView, KFileTreeView, KFileTreeViewItem
</h4>
1890 <li>All renamed to K3File* since they are based upon K3IconView and K3ListView
</li>
1891 <li>No replacement yet, apart from the more low-level KDirModel
</li>
1892 <li>Those classes have all moved to a new library, libkfile. You need to link to ${KDE4_KFILE_LIBS} to keep using those classes.
</li>
1895 <h4>KFileItemList
</h4>
1897 <li>KFileItemList has been ported from QPtrList to QList. This means you
1898 have to iterate using either integers or java-style or STL iterators.
1899 Here's the STL version:
1901 KFileItemList::const_iterator kit = list.begin();
1902 const KFileItemList::const_iterator kend = list.end();
1903 for ( ; kit != kend; ++kit )
1906 <li>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).
</li>
1909 <h4>KFileMetaInfo
</h4>
1911 <p>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.
1914 <h4>KFileOpenWithHandler
</h4>
1916 <li>This class has been removed, it was just a workaround for a dependency problem,
1917 just remove any instance of it.
</li>
1920 <h4>KFilePlugin
</h4>
1922 <p>This class has been replaced by
<a href=
"http://techbase.kde.org/Development/Tutorials/Writing_file_analyzers">Strigi analyzers
</a> 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.
</p>
1924 <p>Strigi analyzer have the advantage that they are faster then 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.
</p>
1926 <h3>How to convert a KFilePlugin?
</h3>
1928 <p>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.
</p>
1930 <p>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.
</p>
1932 <h4>KFileWritePlugin
</h4>
1934 <p>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.
</p>
1936 <p>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.
</p>
1938 <h4>KIconButton
</h4>
1940 <li>signal void iconChanged(QString); replaced by void iconChanged(const QString
&);
</li>
1943 <h4>KIconDialog
</h4>
1945 <li>signal void newIconName(QString); replaced by void newIconName(const QString
&);
</li>
1948 <h4>KImageIO classes
</h4>
1950 <li>The KImageIO plugins are converted to Qt's imageformat plugins. The KImageIO class
1951 now a lightweight version to query the installed plugins without actually loading them.
1953 <li>.kimgio files are converted to .desktop files, and contains regular KDE services,
1954 with ServiceType as QImageIOPlugins
</li>
1955 <li>KImageIO::registerFormats() removed, simply remove this from your code
</li>
1956 <li>Instead of mimeType(filename), you should use KMimeType
</li>
1957 <li>Instead of canRead() and canWrite() you can use types(mode).contains(typename)
</li>
1960 <h4>KIO:: global methods
</h4>
1962 <li>KIO::convertSizeFromKB is now KIO::convertSizeFromKiB since it takes a value in KiB (
1 KiB =
1024 B)
</li>
1963 <li>KIO::findDeviceMountPoint() has been replaced with KMountPoint::currentMountPoints() and findByDevice()
</li>
1964 <li>KIO::findPathMountPoint() has been replaced with KMountPoint::currentMountPoints() and findByPath()
</li>
1965 <li>KIO::probably_slow_mounted() has been replaced with KMountPoint::currentMountPoints(), findByPath(), and probablySlow()
</li>
1966 <li>KIO::testFileSystemFlag() has been replaced with KMountPoint::testFileSystemFlag() (use KMountPoint::currentMountPoints().findByPath())
</li>
1971 <li>For Job subclasses: removeSubjob doesn't terminate the parent job anymore, add
1972 <code>if ( !hasSubjobs() ) emitResult();
</code> to emulate the old behavior that.
</li>
1973 <li>subjobs is now private. This means you should replace subjobs.remove(job) with removeSubjob(job),
1974 and subjobs.isEmpty() with !hasSubjobs()
</li>
1975 <li><code>job-
>showErrorDialog(QWidget*)
</code> becomes
<code>job-
>ui()-
>showErrorMessage()
</code>. The parent QWidget should be set immediately after creating the job by
<code>job-
>ui()-
>setWindow(QWidget*)
</code></li>
1976 <li><code>job-
>setAutoErrorHandlingEnabled(bool,QWidget*)
</code> becomes
<code>job-
>ui()-
>setAutoErrorHandlingEnabled(bool)
</code></li>
1977 <li><code>job-
>isAutoErrorHandlingEnabled()
</code> becomes
<code>job-
>ui()-
>isAutoErrorHandlingEnabled()
</code></li>
1978 <li><code>job-
>setAutoWarningHandlingEnabled(bool)
</code> becomes
<code>job-
>ui()-
>setAutoWarningHandlingEnabled(bool)
</code></li>
1979 <li><code>job-
>isAutoWarningHandlingEnabled()
</code> becomes
<code>job-
>ui()-
>isAutoWarningHandlingEnabled()
</code></li>
1980 <li><code>job-
>setWindow(QWidget*)
</code> becomes
<code>job-
>ui()-
>setWindow(QWidget*)
</code></li>
1981 <li><code>job-
>window()
</code> becomes
<code>job-
>ui()-
>window()
</code></li>
1982 <li><code>job-
>setInteractive( false )
</code> becomes
<code>job-
>setUiDelegate(
0 )
</code></li>
1983 <li>Also note that you must now include
<kio/copyjob.h
> if you use KIO::copy, KIO::move or KIO::trash,
1984 and you must include
<kio/deletejob.h
> if you use KIO::del.
</li>
1985 <li>For Job subclasses, there's no showProgressInfo flag in the constructor anymore. You should use KIO::getJobTracker()-
>registerJob(job) instead.
</li>
1987 <li>Most boolean parameters have been replaced with enums. So for instance
1989 <li>KIO::file_copy(src, dest, -
1, true /*overwrite*/, false /*no resume*/, false) -
> KIO::file_copy(src, dest, -
1, KIO::Overwrite | KIO::HideProgressInfo)
</li>
1990 <li>KIO::get(url, false /*no reload*/, false) -
> KIO::get(url, KIO::NoReload, KIO::HideProgressInfo)
</li>
1991 <li>KIO::put(url, -
1, true /*overwrite*/, false /*no resume*/, false) -
> KIO::put(url, -
1, KIO::Overwrite | KIO::HideProgressInfo)
</li>
1992 <li>KIO::del(url, false /*shred, feature removed*/, false) -
> KIO::del(url, KIO::HideProgressInfo)
</li>
1993 <li>KIO::listDir(url, true /*show progress info*/, true /*include hidden files*/) -
> KIO::del(url, KIO::DefaultFlags, true /*include hidden files*/)
</li>
1998 <h4>KIO::UDSEntry
</h4>
2000 <li>UDSEntry is now a hash-based class instead of a list. Use the methods stringValue()
2001 and numberValue() to retrieve fields directly, no loop is needed anymore.
2002 See the UDSEntry documentation for code examples.
</li>
2003 <li>Also note that UDSEntryListConstIterator is now UDSEntryList::ConstIterator;
2004 see the UDSEntryList documentation for a full code example of iterating through
2005 a listDir result.
</li>
2006 <li>For kioslaves: replace every three lines like
2007 <pre>atom.m_uds = KIO::UDS_SIZE;
2008 atom.m_long = buff.st_size;
2009 entry.append( atom );
</pre>
2010 with the line
<pre>entry.insert( KIO::UDSEntry::UDS_SIZE, buff.st_size );
</pre></li>
2014 <h4>KIO::RenameDialog
</h4>
2016 <li>KIO::RenameDlg was renamed to KIO::RenameDialog and the header moved from renamedlg.h to renamedialog.h
</li>
2017 <li>void b0Pressed() renamed to void cancelPressed()
</li>
2018 <li>void b1Pressed() renamed to void renamePressed()
</li>
2019 <li>void b2Pressed() renamed to void skipPressed()
</li>
2020 <li>void b3Pressed() renamed to void autoSkipPressed()
</li>
2021 <li>void b4Pressed() renamed to void overwritePressed()
</li>
2022 <li>void b5Pressed() renamed to void overwriteAllPressed()
</li>
2023 <li>void b6Pressed() renamed to void resumePressed()
</li>
2024 <li>void b7Pressed() renamed to void resumeAllPressed()
</li>
2025 <li>void b8Pressed() renamed to void suggestNewNamePressed()
</li>
2028 <h4>KIO::RenameDialogPlugin
</h4>
2030 <li>RenameDlgPlugin was renamed to KIO::RenameDialogPlugin and the header moved from renamedlgplugin.h to renamedialogplugin.h
</li>
2031 <li>The ServiceType was changed from RenameDlg/Plugin to RenameDialog/Plugin. Make sure to update your .desktop fiel
</li>
2034 <h4>KIO::PasswordDialog
</h4>
2036 <li>KIO::PassDlg was renamed to KIO::PasswordDialog and the header moved from passdlg.h to passworddialog.h
</li>
2039 <h4>KIO::PreviewJob
</h4>
2041 <li>KIO::PreviewJob works with KFileItems by value rather than by pointer, now that KFileItem is refcounted.
</li>
2042 <li>The two signals changed accordingly:
2044 <li>gotPreview(const KFileItem*, const QPixmap
&) -
> gotPreview(const KFileItem
&, const QPixmap
&)
</li>
2045 <li>failed(const KFileItem*) -
> failed(const KFileItem
&</li>
2048 <li>In the slots connected to those signals, don't compare KFileItem pointers! If you need to find the KFileItem
2049 in a list, compare the url() of the items in the list with the url() of the item passed to the slot.
</li>
2052 <h4>KIO::SkipDialog
</h4>
2054 <li>KIO::SkipDlg was renamed to KIO::SkipDialog and the header moved from skipdlg.h to skipdialog.h
</li>
2057 <h4>KIO::Observer
</h4>
2059 <li>openPassDlg was renamed to openPasswordDialog
</li>
2060 <li>open_RenameDlg to open_RenameDialog
</li>
2061 <li>open_SkipDlg to open_SkipDialog
</li>
2064 <h4>KIO::SlaveBase
</h4>
2066 <li>openPassDlg was renamed to openPasswordDialog
</li>
2069 <h4>KIO::TCPSlaveBase
</h4>
2071 <li>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().
</li>
2072 <li>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.
</li>
2073 <li>Renamed isConnectionValid() to isConnected().
</li>
2074 <li>Renamed setBlockConnection() to setBlocking().
</li>
2075 <li>Renamed closeDescriptor() to disconnectFromHost().
</li>
2076 <li>startSsl() (formerly startTLS()) now just returns a bool instead of a numeric error code.
</li>
2077 <li>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.
</li>
2078 <li>Metadata changes that should only concern the HTTP ioslave and the HTML KPart.
</li>
2083 <li>The KMimeMagic class is gone. Use the KMimeType API instead:
2085 <li>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)
</li>
2086 <li>KMimeMagic::self()-
>findBufferType(data) -
> KMimeType::findByContent(data)
</li>
2087 <li>KMimeMagic::self()-
>findBufferFileType(data,name) -
> KMimeType::findByNameAndContent(name,data)
</li>
2090 <li>.. and replace result-
>mimeType() with mime-
>name().
</li>
2095 <li>KMimeType::pixmap() has been deprecated (for core/gui separation), use iconName() or iconName(url)
2096 and KIconLoader::loadMimeTypeIcon with that icon name.
</li>
2097 <li>KMimeType::pixmapForURL -
> KIO::pixmapForURL
</li>
2098 <li>KMimeType::comment(KUrl,bool) -
> KIO::comment(KUrl)
</li>
2099 <li>KMimeType::diagnoseFileName has been replaced with KMimeType::extractKnownExtension which returns the extension only, not the pattern
</li>
2100 <li>KMimeType::mimeType(someName) now behaves like KServiceType::serviceType(someName), i.e. it returns
0 if that name doesn't exist,
2101 instead of returning the application/octet-stream mimetype. Test for null!
</li>
2102 <li>iconForURL has been deprecated, will possibly be removed for KDE
4.0 final, use iconNameForURL instead
</li>
2103 <li>KMimeType::findFormatByFileContent has been removed. Use KMimeType::isBinaryData instead.
</li>
2106 <h4>KMimeTypeResolver
</h4>
2108 <li>The previous KMimeTypeResolver has been renamed to K3MimeTypeResolver.
</li>
2109 <li>A new KMimeTypeResolver must be used together with a KDirModel.
</li>
2112 <h4>KOpenWithDlg
</h4>
2114 <li>Has been renamed to KOpenWithDialog. Use #include
<kopenwithdialog.h
></li>
2117 <h4>KPropertiesDialog
</h4>
2119 <li>Doesn't have autoShow support in its constructors anymore, but still has autodelete behavior.
</li>
2120 <li>Ensure any new is followed by show or exec. Or use KPropertiesDialog::showDialog where possible.
</li>
2121 <li>The header file was renamed from kpropsdlg.h to kpropertiesdialog.h
2122 <li>The ServiceType was renamed from KPropsDlg/Plugin to KPropertiesDialog/Plugin. Make sure to update your .desktop files
</li>
2125 <h4>KPropertiesDialogPlugin
</h4>
2127 <li>KPropsPage or KPropsDlgPlugin was renamed to KPropertiesDialogPlugin
</li>
2128 <li>The header file was renamed from kpropsdlg.h to kpropertiesdialog.h
</li>
2131 <h4>KProtocolInfo
</h4>
2133 <li>Many static methods have been moved to KProtocolManager (which is in kio)
2134 so that kprotocolinfo itself could be moved to kdecore:
2136 <li>KProtocolInfo::supportsListing(url or protocol) -
> KProtocolManager::supportsListing(url)
</li>
2137 <li>KProtocolInfo::supportsReading(url or protocol) -
> KProtocolManager::supportsReading(url)
</li>
2138 <li>KProtocolInfo::supportsDeleting(url or protocol) -
> KProtocolManager::supportsDeleting(url)
</li>
2142 <li>The deprecated methods taking a QString protocol as input have been removed, make sure
2143 to pass a KUrl to most methods instead.
</li>
2148 <li>the constructor needs a second parameter (a widget) now
</li>
2153 <li>renamed to KUrlBar
</li>
2156 <h4>KURLComboBox
</h4>
2158 <li>Renamed to KUrlComboBox
</li>
2159 <li>All usage of QPixmap has been replaced by usage of QIcon
</li>
2160 <li>getPixmap() --
> getIcon()
</li>
2163 <h4>KURLCompletion
</h4>
2165 <li>Renamed to KUrlCompletion
</li>
2168 <h4>KURLPixmapProvider
</h4>
2170 <li>Renamed to KUrlPixmapProvider
</li>
2173 <h4>KURLRequester
</h4>
2175 <li>renamed to KUrlRequester
</li>
2176 <li>setCaption is gone, use setWindowTitle instead
</li>
2177 <li>Renamed setURL() to setUrl(), per KDE naming policy
</li>
2178 <li>Ported to use KUrl instead of QString. Thus, the constructors, setUrl(), url(), and urlChanged() all use KUrl.
</li>
2179 <li>Removed showLocalProtocol() and setShowLocalProtocol(); this is now always false (the user never sees file:///)
</li>
2184 <li>KService was moved to libkdecore
</li>
2185 <li>KService::rebuildKSycoca -
> KBuildSycocaProgressDialog::rebuildKSycoca
</li>
2186 <li>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.
</li>
2189 <h4>KServiceType
</h4>
2191 <li>KServiceType::offers() -
> KServiceTypeTrader::self()-
>query()
</li>
2192 <li>The behavior of KServiceType::serviceType() has changed: it now only returns real service types, and no more mimetypes. For mimetypes, use KMimeType::mimeType().
</li>
2193 <li>Similarly, allServiceTypes() only returns real service types, no more mimetypes.
</li>
2196 <h4>KServiceTypeProfile
</h4>
2198 <li>This class has been moved to kservicetypeprofile.h and is mostly internal now. Use KServiceTypeTrader or KMimeTypeTrader instead.
</li>
2199 <li>KServiceTypeProfile::preferredService is now KMimeTypeTrader::self()-
>preferredService or KServiceTypeTrader::self()-
>preferredService
</li>
2200 <li>KServiceTypeProfile::offers is now KMimeTypeTrader::self()-
>query or KServiceTypeTrader::self()-
>query
</li>
2205 <li>KTrader has been split up into two classes: KServiceTypeTrader and KMimeTypeTrader.
</li>
2206 <li>So KTrader::query() should be ported to KMimeTypeTrader::query() when it's about mimetypes
2207 (finding the application or part for a given mimetype), and to KServiceTypeTrader::query() when
2208 it's about pure service types (plugins, kcmodules, etc.)
</li>
2209 <li>In other terms, KTrader::query(
1 or
2 args) -
> KServiceTypeTrader::query and
2210 KTrader::query(
4 args but the last one was always QString::null) -
> KMimeTypeTrader::query
</li>
2211 <li>In both cases, query() now returns KService::List instead of an OfferList, adjust the type of the variable
</li>
2212 <li>Constraints like
"'RenameDlg/Plugin' in ServiceTypes" should be turned into
2213 KMimeTypeTrader::self()-
>query(mimetype,
"RenameDlg/Plugin")
</li>
2216 <h4>PasswordDialog
</h4>
2218 <li>void setEnableUserField( bool enable, bool=false ) removed use setUsernameReadOnly( !enable )
</li>
2224 <li>QByteArray openPassDlg( const KIO::AuthInfo
>info ); removed. Use KIO::PasswordDialog::getNameAndPassword
</li>
2227 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2229 <h3><a name=
"kparts">Changes in kparts
</a></h3>
2231 <h4>BrowserExtension
</h4>
2233 <li>The following signals have changed:
2235 <li>openUrlRequest(const KUrl
&, const KParts::URLArgs
&) -
> openUrlRequestDelayed(const KUrl
&, const KParts::OpenUrlArguments
&, const KParts::BrowserArguments
&)
</li>
2236 <li>openUrlRequestDelayed(const KUrl
&, const KParts::URLArgs
&) -
> openUrlRequestDelayed(const KUrl
&, const KParts::OpenUrlArguments
&, const KParts::BrowserArguments
&)
</li>
2237 <li>The two createNewWindow signals have been merged into a single one: createNewWindow(url, args, browserArgs [, windowArgs,
&part] )
</li>
2238 <li>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.
</li>
2241 <li>Because of the URLArgs split, make sure to replace BrowserExtension::setUrlArgs with BrowserExtension::setBrowserArguments + part-
>setArguments
</li>
2244 <h4>BrowserHostExtension
</h4>
2246 <li>The following virtal methods have changed:
2248 <li>openURLInFrame(const KUrl
&, const KParts::URLArgs
&) -
> openUrlInFrame(const KUrl
&, const KParts::OpenUrlArguments
&, const KParts::BrowserArguments
&)
</li>
2255 <li>The constructor now takes args and browserArgs, see KParts::Part
</li>
2256 <li>All the protected members have been turned into methods
</li>
2257 <li>BrowserRun::isExecutable obsoleted by KRun::isExecutable
</li>
2258 <li>suggestedFilename -
> suggestedFileName
</li>
2261 <h4>ComponentFactory
</h4>
2263 <li>createInstanceFromFactory is now KPluginFactory::create
<T
></li>
2264 <li>createInstanceFromLibrary is now KLibLoader::createInstance
<T
></li>
2265 <li>createInstanceFromService is now KService::createInstance
<T
></li>
2266 <li>createInstanceFromQuery is now KServiceTypeTrader::createInstanceFromQuery
<T
></li>
2267 <li>All the error codes like KParts::ComponentFactory::ErrNoServiceFound have moved to KLibLoader
</li>
2270 <h4>KParts::URLArgs
</h4>
2272 <li>URLArgs has been splitted into OpenUrlArguments and BrowserArguments.
2274 <li>URLArgs.reload -
> OpenUrlArguments.reload()/setReload()
</li>
2275 <li>URLArgs.xOffset -
> OpenUrlArguments.xOffset()/setXOffset()
</li>
2276 <li>URLArgs.yOffset -
> OpenUrlArguments.yOffset()/setYOffset()
</li>
2277 <li>URLArgs.serviceType -
> OpenUrlArguments.mimeType()/setMimeType()
</li>
2278 <li>URLArgs.metaData() -
> OpenUrlArguments.metaData()
</li>
2279 <li>For anything else (docState, frameName, postData, setDoPost, setContentType etc.): URLArgs -
> BrowserArguments
</li>
2282 <li>The BrowserArguments are still set and retrieved from the BrowserExtension, however the OpenUrlArguments are simply stored in KParts::ReadOnlyPart. So for instance:
2284 <li>m_extension-
> urlArgs().xOffset -
> arguments().xOffset()
</li>
2289 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2291 <h3><a name=
"kded">Changes in kded
</a></h3>
2294 <li>The class KDEDModule is now part of libkdecore so that kded modules can link without undefined symbols.
2295 A number of apparently unused methods in KDEDModule have been commented out, contact
2296 kde-core-devel if you need those after all.
</li>
2297 <li>Note that the signature for the create_xyz() call has changed, simply remove all arguments from it,
2298 and from your kded module's constructor
</li>
2301 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2303 <h3><a name=
"kspell">Changes in kspell
</a></h3>
2308 <li>All of the features of KSpell and KSpell2 have been moved to Sonnet
</li>
2309 <li>The KSpell2's initialization procedure of:
2311 KSpell2::Loader::Ptr loader = KSpell2::Loader::openLoader();
2312 KSpell2::Speller *speller = loader-
>createSpeller(
"en_US");
2314 if (speller-
>isMisspelled(
"word")) {
2319 has been replaced with:
2321 Sonnet:Speller speller(
"en_US");
2322 if (speller.isMisspelled(
"word")) {
2327 <li>The configuration class of KSpell2 (KSpell2::Settings) have been
2328 folded back into Sonnet::Speller.
</li>
2329 <li>Sonnet doesn't automatically overwrite configuration anymore. To
2330 save and restore setting from a KConfig file one has to use
2332 Sonnet::Speller::save(KConfig *config);
2333 Sonnet::Speller::restore(KConfig *config);
2336 <li>KSpell2::Filter has been temporarily removed from the public api.
2337 Proper text segmentation api is planned for KDE
4.1</li>
2340 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2342 <h3><a name=
"kdnssd">Changes in kdnssd
</a></h3>
2344 <h4>DomainBrowser
</h4>
2346 <LI>Recursive browsing feature has been removed removed
</LI>
2347 <li>Constructor that takes list of domains and does not use configuration has been removed
</li>
2348 <li>It is now possible to search for browsing or publishing domains
</li>
2351 <h4>ServiceBase
</h4>
2353 <LI>Service properties are stored in QMap
<QString,QByteArray
> instead of QMap
<QString,QString
>.
</LI>
2354 <LI>This class is not used to pass domains or service types anymore
</LI>
2357 <h4>ServiceBrowser
</h4>
2359 <LI>Browsing multiple types or multiple domains at once has been removed
</LI>
2360 <li>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
</li>
2361 <li>It is now possible to specify subtype to narrow searching scope (for example
"anon" for only anonymous FTP servers)
</li>
2362 <li>Browsing for service types is now done using new class ServiceTypeBrowser
</li>
2365 <h4>RemoteService
</h4>
2366 <ul><LI>Creating RemoteService from URL or DNS label is no longer supported
</LI></ul>
2368 <h4>PublicService
</h4>
2370 <LI>Optional list of subtypes can be passed to constructor.
</LI>
2371 <li>Encoding service into URL is no longer supported
</li>
2376 <LI>This class has been merged into ServiceBrowser
</LI></ul>
2378 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2380 <h3><a name=
"khtmlpart">API-cleanups in KHTML
</a></h3>
2382 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2384 <h3><a name=
"kfile">Changes in kfile
</a></h3>
2386 <h4>KUrlRequesterDialog
</h4>
2388 <li>KUrlRequesterDlg was renamed to KUrlRequesterDialog
</li>
2389 <li>The header was renamed from kurlrequesterdlg.h to kurlrequesterdialog.h
</li>
2392 <h4>KDirOperator
</h4>
2394 <li>KFileView* view() const -
> QAbstractItemView* view() const
</li>
2395 <li>void setView(KFileView *view) -
> void setView(QAbstractItemView *view)
</li>
2396 <li>const KFileItemList* selectedItems() const -
> QList
<KFileItem
> selectedItems() const
</li>
2397 <li>KFileView* createView(QWidget *parent, KFile::FileView view) -
> QAbstractItemView* createView(QWidget *parent, KFile::FileView view)
</li>
2398 <li>QWidget* viewWidget() const; has been removed, use QAbstractItemView* view() instead.
</li>
2399 <li>void setPreviewWidget(const QWidget *w) -
> void setPreviewWidget(KPreviewWidgetBase *w)
</li>
2400 <li>KIO::DeleteJob* del(const KFileItemList
& items, QWidget *parent,
2401 bool ask = true, bool showProgress = true) -
> KIO::DeleteJob* del(const QList
<KFileItem
>& items, QWidget *parent =
0,
2402 bool ask = true, bool showProgress = true)
</li>
2403 <li>KIO::DeleteJob* del(const KFileItemList
& items, bool ask = true, bool showProgress = true) has been removed. Use del(...)
2404 with parent parameter instead.
</li>
2405 <li>KIO::CopyJob* trash(const KFileItemList
& items, QWidget *parent,
2406 bool ask = true, bool showProgress = true) -
> KIO::CopyJob* trash(const QList
<KFileItem
>& items, QWidget *parent,
2407 bool ask = true, bool showProgress = true)
2412 <li>KFileView doesn't exist anymore, see the new itemview based KDirOperator.
</li>
2413 <li>For ease of porting, kde3support provides K3FileView, but don't expect it to still be useable in a KDirOperator.
</li>
2416 <h4>KFileWidget
</h4>
2418 <li>void setPreviewWidget(const KPreviewWidgetBase *w) -
> void setPreviewWidget(KPreviewWidgetBase *w)
</li>
2421 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2423 <h3><a name=
"kdesu">Changes in kdesu
</a></h3>
2425 All classes of kdesu are now in the
<tt>KDESu
</tt> namespace
2428 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2430 <h3><a name=
"kcontrol">Changes in KControl
</a></h3>
2432 <li>The Button enum in KCModule only contains the Help, Default and Apply
2433 values. The other buttons are not optional. If your KCM specified the button
2434 flags just remove everything except those three.
</li>
2435 <li>The functions setRootOnlyMsg, rootOnlyMsg, setUseRootOnlyMsg and
2436 useRootOnlyMsg have been renamed to
2437 setRootOnlyMessage, rootOnlyMessage, setUseRootOnlyMessage and
2438 useRootOnlyMessage.
</li>
2439 <li>KCModules need to have Type=Service and ServiceTypes=KCModule in the
2440 .desktop file now - was Type=Application before
</li>
2441 <li>KCModules that should show up in KControl or kcmshell --list need to have
2442 X-KDE-ParentApp=kcontrol or kinfocenter
</li>
2443 <li>If the KCModule should be used by kcminit you have to add KCModuleInit to
2444 ServiceTypes (i.e. ServiceTypes=KCModule,KCModuleInit then)
</li>
2445 <li>The kcm_ prefix in X-KDE-Library is now optional (in KDE3 the
2446 X-KDE-Library value was automatically prefixed with kcm_)
</li>
2447 <li>If the kcminit code is in a different lib than the other KCM code the
2448 X-KDE-Init-Library was used. The library name has to be prefixed with kcminit_
2449 now, but the prefix is optional in the .desktop file.
</li>
2450 <li>The kcminit symbol now has to be prefixed with kcminit_ (in the code). The
2451 rest of the symbol name is specified with X-KDE-Init-Symbol (was X-KDE-Init
2453 <li>It is now possible to use multiple K_EXPORT_GENERIC_FACTORY calls in one
2454 library. The first parameter to the macro has to be the same as
2455 X-KDE-FactoryName then.
</li>
2456 <li>KCModule does no longer take a name argument, but directly a KInstance (having the correct
2457 name for the translations to work.
</li>
2458 <li>The X-KDE-RunAsRoot and X-KDE-IsHiddenByDefault keys are removed.
</li>
2459 <li>KCModules will not be embedded running with root privileges anymore.
2460 Instead the GUI code will run with user privileges as every other KCM. Only in
2461 order to write or call programs should the KCM elevate its privileges.
</li>
2464 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2466 <h3><a name=
"kicker">Panel Applets and Extensions
</a></h3>
2468 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2470 <!-- ### TODO: should this not be a KDE3SUPPORT <h3> section? -->
2472 <li>KDockWidgets -
> kde3support K3DockWidget
</li>
2473 <li>KParts::DockWindow -
> kde3support KParts::DockWindow3
</li>
2474 <li>KMDI* --
> kdeSupport K3MDI*
</li>
2479 <li>Moved to kdemultimedia, where (at the moment) it is only used by kmid.
</li>
2482 <h3><a name=
"kscreensaver">KScreensaver
</a></h3>
2484 <h4>libkscreensaver
</h4>
2486 <li>Moved to kdebase/workspace/kscreensaver
</li>
2489 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2491 <h3><a name=
"i18n">I18N
</a></h3>
2493 <h4>Messages.sh files
</h4>
2494 <p>Instead of the
"messages" target of the Makefile.am files,
2495 KDE4 uses now Bash scripts with Messages.sh file names.
2496 The Perl script trunk/l10n-kde4/scripts/conversion/Makefile2Messages.pl
2497 can be used as an half-automatic conversion. (Please verify the result!)
</p>
2499 <h4>rc.cpp file
</h4>
2500 <p>The rc.cpp is now
<em>always
</em> generated. It is mandatory to have it as
2501 parameter of the $XGETTEXT if you are using the class KAboutData and if
2502 you are not explicitly setting KAboutData::setTranslator.
</p>
2504 <h4>Gettext
0.16.1</h4>
2506 <a href=
"http://gnu.org/software/gettext/gettext.html">xgettext
0.16.1</a>
2508 messages out of the source code. This is a huge step from the former xgettext
0.10.35-kde
2510 <p>Important changes:
</p>
2512 <li>If you define your own keywords (-k parameter of xgettext), you probably
2513 need to adapt them, as xgettext does not automatically know about the
2514 1,
2 or
3 parameter versions.
</li>
2515 <li>You cannot have two similar messages, one being a normal message and
2516 the other being the singular form of a plural-form message. For Gettext, this is
2517 the same message and therefore this creates problems. (Note: there is not
2518 any similar problem with contexts.)
</li>
2521 <h4>Translator Comments
</h4>
2523 <p>Translator comments are a feature that already existed in KDE3, but which
2524 was seldom used.
</p>
2526 <li>Translator comment are code comments before a i18n call. To avoid
2527 extracting comments that are of little interest for translators, translator
2528 comemnts must start with // i18n: or /* i18n: to mark such comments.
2529 (Note: translator comments starting with TRANSLATORS (all upper case), as it is Gettext's habit are not supported by KDE4.)
</li>
2530 <li>As in Gettext
0.16.1, contexts are supposed to be short, please consider
2531 using a translator comment instead of a context to give long hints to translators.
</li>
2534 // i18n: this is a test sentence
2535 i18n(
"The quick brown fox jumps over the lazy dog");
2540 <p>The basic call, a message without arguments, context or plural, remains as is:
</p>
2542 i18n(
"Just plain info");
2545 <p>If there are arguments,
<code>arg
</code> methods are no longer used to substitute the placeholders. Instead, arguments are added to the call:
</p>
2547 i18n(
"%1 has scored %2", playerName, score);
2549 <p>Arguments can be of several integer types,
<code>double
</code>,
<code>QString
</code>,
<code>QChar
</code> (and perhaps more in the future).
</p>
2551 <p>Context call now has a different name,
<code>i18nc
</code>, and takes arguments in the same way:
</p>
2553 i18nc(
"Player name - score",
"%1 - %2", playerName, score);
2556 <p>Plural call is renamed to
<code>i18np
</code> and does away with
<code>%n
</code> placeholder, all being numbered instead:
</p>
2558 i18np(
"One image in album %2",
"%1 images in album %2", n, albumName);
2560 <p>The plural form is decided by first integer-valued argument.
</p>
2562 <p>There is one new call variant, the context-plural call:
</p>
2564 i18ncp(
"Personal file",
"One file",
"%1 files", n);
2567 <p><code>i18n*
</code> calls are realized as templates, and so will take at most some finite number of arguments.
</p>
2569 <p>Notes on placeholder substitution:
</p>
2571 <li>Placeholders are substituted in one pass, so no need to worry about argument itself containing a placeholder.
</li>
2572 <li>All same-numbered placeholders are substituted with same argument. This is in contrast to what single-argument
<code>arg
</code> methods of
<code>QString
</code> do.
</li>
2573 <li>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.
</li>
2576 <p>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
<i>defer
</i> substitution of arguments. This is possible using new
<code>ki18n
</code> call, with
<code>subs
</code> methods for argument substitution and
<code>toString
</code> method for finalization:
</p>
2578 KLocalizedString ks = ki18n(
"The Foo-machine reported: %1");
2580 ERR_OXI: ks.subs(i18n(
"Out of oxidizer")); break;
2581 ERR_HYD: ks.subs(i18n(
"Out of hydrazine")); break;
2582 ERR_PIL: ks.subs(i18n(
"Out of pilots")); break;
2583 default: ks.subs(i18n(
"Unknown catastrophe"));
2585 QString scream = ks.toString();
2588 <p>Note that
<code>ki18n
</code> returns object of type
<code>KLocalizedString
</code>, hence the
<code>toString
</code> method for conversion to plain
<code>QString
</code>. The
<code>ki18n
</code> call should be used rarely; the previous example can as well be rewritten to:
</p>
2592 ERR_OXI: problem = i18n(
"Out of oxidizer"); break;
2595 QString scream = i18n(
"The Foo-machine reported: %1", problem);
2598 <p>Another case when you might want to use
<code>ki18n
</code> is if you want to format arguments.
<code>subs
</code> methods can take formatting arguments, similar to those of
<code>arg
</code> methods in
<code>QString
</code>. You should
<i>never
</i> use methods other than
<code>subs
</code> to format numbers in localized messages:
</p>
2600 i18n(
"Rounds: %1", myNumberFormat(n,
8)); // bad, number not localized
2601 ki18n(
"Rounds: %1").subs(n,
8).toString(); // good, number is localized
2604 <p>There is a context, plural and context-plural variant of
<code>ki18n
</code> as well:
</p>
2606 ki18nc(
"No function",
"None").toString();
2607 ki18np(
"One file found",
"%1 files found").subs(n).toString();
2608 ki18ncp(
"Personal file",
"One file",
"%1 files").subs(n).toString();
2611 <p>If you need translation using locale (KLocale object) other than the default, you can use overloaded
<code>toString
</code> method which takes pointer to locale object (this replaces
<code>KLocale::translate(...)
</code> from KDE3):
</p>
2615 ki18n(
"Welcome").toString(myLocale);
2618 <p>There is a script for semi-automatic conversion of KDE
3 code,
<code>i18nk34conv.pl
</code> in
<code>trunk/l10n-kde4/scripts/conversion/
</code>. It will convert most of the calls automatically, and mark the places that need manual review. There is also the script
<code>i18ncheckarg.pl
</code> in
<code>trunk/l10n-kde4/scripts/conversion/
</code>, 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).
<i>Do not
</i> run conversion script twice on same sources!
</p>
2620 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2622 <h3><a name=
"kssl">Changes in KSSL
</a></h3>
2624 <h4>KSSLCertDialog
</h4>
2626 <li>KSSLCertDlg was renamed to KSSLCertDialog. The header was renamed to ksslcertdialog.h
</li>
2629 <h4>KSSLInfoDialog
</h4>
2631 <li>KSSLInfoDlg was renamed to KSSLInfoDialog
</li>
2632 <li>ksslinfodlg.h was moved to ksslinfodialog.h
</li>
2635 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
2637 <h3><a name=
"mimetypes">Changes in mime types names
</a></h3>
2639 <p>KDE
4 switched to the XDG mime types, thus the names for some mime types have changed.
</p>
2641 <p>The following list contains the renamings from the KDE mime types to the XDG ones.
</p>
2645 <li>(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)
</li>
2648 <table border=
"1" summary=
"Table of KDE vs. XDG mime types">
2650 <th>Old KDE mime type
</th>
2651 <th>XDG mime type
</th>
2654 <td>application/chm
</td>
2655 <td>application/x-chm
</td>
2658 <td>application/fits
</td>
2659 <td>image/x-fits
</td>
2662 <td>application/java
</td>
2663 <td>application/x-java
</td>
2666 <td>application/mathml+xml
</td>
2667 <td>text/mathml
</td>
2670 <td>application/msexcel
</td>
2671 <td>application/vnd.ms-excel (alias)
</td>
2674 <td>application/mspowerpoint
</td>
2675 <td>application/vnd.ms-powerpoint (alias)
</td>
2678 <td>application/ms-tnef
</td>
2679 <td>application/vnd.ms-tnef
</td>
2682 <td>application/pgp
</td>
2683 <td>application/pgp-encrypted (alias)
</td>
2686 <td>application/vnd.ms-asf
</td>
2687 <td>video/x-ms-asf
</td>
2690 <td>application/vnd.ms-word
</td>
2691 <td>application/msword (alias)
</td>
2694 <td>application/vnd.palm
</td>
2695 <td>application/x-palm-database (alias)
</td>
2698 <td>application/vnd.stardivision.writer-global
</td>
2699 <td>application/vnd.stardivision.writer
</td>
2702 <td>application/vnd.sun.xml.base
</td>
2703 <td>application/vnd.oasis.opendocument.database
</td>
2706 <td>application/vnd.sun.xml.writer.master
</td>
2707 <td>application/vnd.sun.xml.writer.global
</td>
2710 <td>application/wordperfect
</td>
2711 <td>application/vnd.wordperfect (alias)
</td>
2714 <td>application/x-
7z
</td>
2715 <td>application/x-
7z-compressed
</td>
2718 <td>application/x-afm
</td>
2719 <td>application/x-font-afm
</td>
2722 <td>application/x-applixgraphics
</td>
2723 <td>image/x-applix-graphics
</td>
2726 <td>application/x-applixspread
</td>
2727 <td>application/x-applix-spreadsheet
</td>
2730 <td>application/x-applixword
</td>
2731 <td>application/x-applix-word
</td>
2734 <td>application/x-bz2dvi
</td>
2735 <td>application/x-bzdvi
</td>
2738 <td>application/x-bzip2
</td>
2739 <td>application/x-bzip (alias)
</td>
2742 <td>application/x-dbase
</td>
2743 <td>application/x-dbf (alias)
</td>
2746 <td>application/x-font-ghostscript
</td>
2747 <td>application/x-font-type1
</td>
2750 <td>application/x-font-ttc
</td>
2751 <td>application/x-font-ttf
</td>
2754 <td>application/x-gettext
</td>
2755 <td>text/x-gettext-translation (*.po)
<br>
2756 text/x-gettext-translation-template (*.pot)
</td>
2759 <td>application/x-hancomword
</td>
2760 <td>application/x-hwp
</td>
2763 <td>application/x-iso
</td>
2764 <td>application/x-cd-image
</td>
2767 <td>application/x-jar
</td>
2768 <td>application/x-java-archive (alias)
</td>
2771 <td>application/x-javascript
</td>
2772 <td>application/javascript (alias)
</td>
2775 <td>application/x-msaccess
</td>
2776 <td>application/vnd.ms-access (alias)
</td>
2779 <td>application/x-msdos-program
</td>
2780 <td>application/x-ms-dos-executable
</td>
2783 <td>application/x-msmetafile
</td>
2784 <td>image/x-wmf
</td>
2787 <td>application/x-ogg
</td>
2788 <td>application/ogg
</td>
2791 <td>application/x-perl-module
</td>
2792 <td>application/x-perl
</td>
2795 <td>application/x-python
</td>
2796 <td>text/x-python
</td>
2799 <td>application/x-rar-compressed
</td>
2800 <td>application/x-rar
</td>
2803 <td>application/x-tbz
</td>
2804 <td>application/x-bzip-compressed-tar
</td>
2807 <td>application/x-tgz
</td>
2808 <td>application/x-compressed-tar
</td>
2811 <td>application/x-troff
</td>
2812 <td>text/troff (alias)
</td>
2815 <td>application/x-zip
</td>
2816 <td>application/zip
</td>
2819 <td>application/x-zip-compressed
</td>
2820 <td>application/zip (alias)
</td>
2823 <td>application/xml-dtd
</td>
2827 <td>audio/mpegurl
</td>
2828 <td>audio/x-mpegurl (alias)
</td>
2831 <td>audio/x-midi
</td>
2832 <td>audio/midi (alias)
</td>
2835 <td>audio/x-mp3
</td>
2836 <td>audio/mpeg (alias)
</td>
2839 <td>audio/x-oggflac
</td>
2840 <td>audio/x-flac+ogg
</td>
2843 <td>audio/x-pn-realaudio
</td>
2844 <td>audio/vnd.rn-realaudio (alias)
</td>
2847 <td>audio/x-speex
</td>
2848 <td>audio/x-speex+ogg
</td>
2851 <td>audio/x-vorbis
</td>
2852 <td>audio/x-vorbis+ogg
</td>
2855 <td>audio/vorbis
</td>
2856 <td>audio/x-vorbis+ogg
</td>
2860 <td>image/x-fits
</td>
2864 <td>image/jpeg2000
</td>
2871 <td>image/pjpeg
</td>
2872 <td>image/jpeg (alias)
</td>
2875 <td>image/svg-xml
</td>
2876 <td>image/svg+xml
</td>
2879 <td>image/svg+xml
</td>
2880 <td>image/svg+xml (*.svg)
<br>
2881 image/svg+xml-compressed (*.svgz)
</td>
2884 <td>image/x-bmp
</td>
2888 <td>image/x-djvu
</td>
2889 <td>image/vnd.djvu (alias)
</td>
2892 <td>image/x-portable-greymap
</td>
2893 <td>image/x-portable-graymap
</td>
2896 <td>image/x-raw
</td>
2897 <td>image/x-dcraw (general mime type)
<br><br>
2898 Specific mime types (all subclasses of image/x-dcraw):
<br>
2899 image/x-panasonic-raw (*.raw)
<br>
2900 image/x-kodak-dcr (*.dcr)
<br>
2901 image/x-adobe-dng (*.dng)
<br>
2902 image/x-canon-crw (*.crw *.cr2)
<br>
2903 image/x-nikon-nef (*.nef)
<br>
2904 image/x-minolta-mrw (*.mrw)
<br>
2905 image/x-kodak-k25 (*.k25)
<br>
2906 image/x-kodak-kdc (*.kdc)
<br>
2907 image/x-olympus-orf (*.orf)
<br>
2908 image/x-pentax-pef (*.pef)
<br>
2909 image/x-fuji-raf (*.raf)
<br>
2910 image/x-sony-sr2 (*.sr2)
<br>
2911 image/x-sony-srf (*.srf)
<br>
2912 image/x-sigma-x3f (*.x3f)
<br>
2913 other extensions that were part of image/x-raw: image/x-kde-raw
2917 <td>image/x-targa
</td>
2918 <td>image/x-tga
</td>
2921 <td>image/x-vnd.adobe.photoshop
</td>
2922 <td>image/x-psd
</td>
2925 <td>image/x-xbm
</td>
2926 <td>image/x-xbitmap
</td>
2929 <td>image/x-xcf-gimp
</td>
2930 <td>image/x-xcf
</td>
2933 <td>image/x-xpm
</td>
2934 <td>image/x-xpixmap
</td>
2937 <td>text/docbook
</td>
2938 <td>application/docbook+xml
</td>
2941 <td>text/javascript
</td>
2942 <td>application/javascript (alias)
</td>
2946 <td>application/rss+xml (alias)
</td>
2950 <td>application/rtf
</td>
2957 <td>text/x-diff
</td>
2958 <td>text/x-patch
</td>
2961 <td>text/x-latex
</td>
2966 <td>application/xml (alias)
</td>
2969 <td>text/x-mswinurl
</td>
2970 <td>application/x-mswinurl
</td>
2973 <td>text/x-vcalendar
</td>
2974 <td>text/calendar (alias)
</td>
2977 <td>text/x-vcard
</td>
2978 <td>text/directory (alias)
</td>
2981 <td>text/x-xslt
</td>
2982 <td>application/xslt+xml
</td>
2986 <td>video/x-msvideo
</td>
2989 <td>video/x-ogm
</td>
2990 <td>video/x-ogm+ogg
</td>
2993 <td>video/x-theora
</td>
2994 <td>video/x-theora+ogg
</td>
2998 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
3000 <h3><a name=
"knewstuff">Changes in KNewStuff
</a></h3>
3003 KNewStuff is replaced with KNewStuff2. The API for applications has changed
3004 completely, as the library is a rewrite and not an update.
3005 Do not inherit from any class, use only KNS::Engine.
3006 All application-specific properties especially about what to do with
3007 downloaded files are configured in *.knsrc files; have a look at
3008 knewstuff/doc/porting.txt and knewstuff/doc/tutorial.txt.
3012 <li>use
<pre>KNS::Entry *entry = KNS::Engine::uploadDialogModal()
</pre></li>
3013 <li>do something with entry, if needed
</li>
3018 <li>use
<pre>KNS::Entry::List entries = KNS::Engine::downloadDialogModal()
</pre></li>
3019 <li>do something with the entries, if needed
</li>
3022 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
3025 <h3><a name=
"dcop">DCOP
</a></h3>
3027 DCOP has been replaced with D-Bus.
<br />
3028 Help with porting from DCOP to D-Bus can be found at
3029 <a href=
"http://techbase.kde.org/Development/Tutorials/Porting_to_D-Bus">http://techbase.kde.org/Development/Tutorials/Porting_to_D-Bus
</a>
3031 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>
3034 <h3><a name=
"printing">Printing
</a></h3>
3036 <p>libkdeprint has been replaced by enhanced printing support in Qt
4. Qt
4.3
3037 is still lacking in a print preview feature and a customisable print dialog.
3038 KPrintPreview (kutils) provides the former, and KdePrint::createPrintDialog()
3039 (kdeui) provides the latter, at least for Qt
4.3.2 onwards.
</p>
3041 <h4>Porting involves the following
</h4>
3043 <li>using QPrinter instead of KPrinter
</li>
3044 <li>using KdePrint::createPrintDialog() (in kdeui) to get a (customised) QPrintDialog, rather than using KPrinter::setup()
</li>
3045 <li>using KPrintPreview (in kutils) for print preview, rather than KPrinter::setPreviewOnly(true)
</li>
3046 <li>removing the dependency on libkdeprint
</li>
3049 <p>If the code uses addDialogPage, you need to change the KPrintDialogPage to a
3050 QWidget, and you can get rid of the getOptions and setOptions methods in favor
3051 of a method for each option (since QPrintDialog doesn't do anything with the widget
3052 except display it). Then the code that called KPrinter::addDialogPage and
3053 KPrinter::setup needs to use KdePrint::createPrintDialog instead and get the options
3054 directly from the widgets passed to createPrintDialog rather than from the QPrinter.
3055 The widgets should also use setWindowTitle() rather than setTitle().
</p>
3057 <h4>For more details, see the following:
</h4>
3059 <li><a href=
"http://doc.trolltech.com/4.3/printing.html">Printing with Qt
</a></li>
3060 <li><a href=
"http://api.kde.org/4.0-api/kdelibs-apidocs/kutils/html/classKPrintPreview.html">KPrintPreview apidocs
</a></li>
3061 <li><a href=
"http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/namespaceKdePrint.html">KdePrint::createPrintDialog apidocs
</a></li>
3062 <li><a href=
"http://techbase.kde.org/Projects/KDEPrint/KDE4#Porting">KDEPrint Porting on TechBase
</a></li>
3066 <h4 align=
"right"><a href=
"#TOC">Return to the Table of Contents
</a></h4>