1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Level 2//EN//2.0">
<HTML>
<HEAD>
<TITLE>Guide to Porting Applications to KDE 2.0</TITLE>
</HEAD>
<BODY>
<H2>Porting Applications to KDE 2.0</H2>
<H3>Last Modified on November 28, 2000</H3>
This document contains the changes you have to apply to programs written for
KDE1.1 when you want to port them to KDE2.0.<P>
As a start you should have a look at doc/porting.doc in the Qt package,
or <a href="http://doc.trolltech.com/porting.html">this page online</a>.<P>
<H3><A NAME="TOC">Table of Contents</A></H3>
<UL>
<LI><A HREF="#gettingstarted">Getting Started</A></LI>
<LI><A HREF="#general">Global changes</A></LI>
<LI><A HREF="#autotqmoc">autotqmoc/am_edit, Makefile.am tags</A></LI>
<LI><A HREF="#KApplication">KApplication</A></LI>
<LI><A HREF="#KCmdLineArgs">KCmdLineArgs</A></LI>
<LI><A HREF="#KLocale">KLocale</A></LI>
<LI><A HREF="#KGlobal">KGlobal: access to KDE global objects.</A></LI>
<LI><A HREF="#KIconLoader">KIconLoader</A></LI>
<LI><A HREF="#KTMainWindow">KTMainWindow</A></LI>
<LI><A HREF="#KHelpMenu">KHelpMenu</A></LI>
<LI><A HREF="#KToolBar">KToolBar</A></LI>
<LI><A HREF="#launching">Starting other programs</A></LI>
<LI><A HREF="#khtmlw">khtmlw</A></LI>
<LI><A HREF="#KIntegerLine">KIntegerLine, KIntLineEdit</A></LI>
<LI><A HREF="#KDNDIcon">KDNDIcon, KDNDDropZone, KDNDWidget, tdecore/drag.h</A></LI>
<LI><A HREF="#KConfigBase">KConfigBase, KConfig, KSimpleConfig</A></LI>
<LI><A HREF="#libkfm">libkfm</A></LI>
<LI><A HREF="#KDialog">KDialog</A></LI>
<LI><A HREF="#kcharsets">kcharsets</A></LI>
<LI><A HREF="#KWizard">KWizard, KNoteBook</A></LI>
<LI><A HREF="#KSpinBox">KSpinBox, KNumericSpinBox</A></LI>
<LI><A HREF="#KClipboard">KClipboard</A></LI>
<LI><A HREF="#KPanner">KPanner, KNewPanner</A></LI>
<LI><A HREF="#KTreeList">KTreeList, KTreeListItem</A></LI>
<LI><A HREF="#KMsgBox">KMsgBox</A></LI>
<LI><A HREF="#KCombo">KCombo</A></LI>
<LI><A HREF="#KQuickHelp">KQuickHelp</A></LI>
<LI><A HREF="#KPixmapgradientFill">KPixmap::gradientFill</A></LI>
<LI><A HREF="#KTabListBox">KTabListBox</A></LI>
<LI><A HREF="#KToolBarButton">KToolBarButton & KRadioGroup</A></LI>
<LI><A HREF="#KAccel">KAccel</A></LI>
<LI><A HREF="#kstring">kstring.h / KString</A></LI>
<LI><A HREF="#ktopwidget">ktopwidget.h / KTopWidget</A></LI>
<LI><A HREF="#kbutton">kbutton.h / KButton</A></LI>
<LI><A HREF="#kbuttonbox">kbuttonbox.h / KButtonBox</A></LI>
<LI><A HREF="#kcolorgroup">kcolorgroup.h / KColorGroup</A></LI>
<LI><A HREF="#kled">kled.h, kledlamp.h / KLed, KLedLamp</A></LI>
<LI><A HREF="#KDockWidget">KDockWidget</A></LI>
<LI><A HREF="#KPixmap">KPixmap, KPixmapEffect</A></LI>
<LI><A HREF="#KControlCenter">KDE Control Center</A></LI>
<LI><A HREF="#KWMModuleApplication">KWMModuleApplication libtdeui/kwmmapp.h</A></LI>
<LI><A HREF="#KDebug">KDebug</A></LI>
<LI><A HREF="#KFileDialog">KFileDialog - General Stuff</A></LI>
<LI><A HREF="#KFileDialogPreview">KFileDialog - Preview Mode</A></LI>
<LI><A HREF="#ImageEffects">Image Effects</A></LI>
<LI><A HREF="#KAudio">KAudio (kaudio.h)</A></LI>
<LI><A HREF="#KImageIO">KImageIO (kimgio.h)</A></LI>
</UL>
<H3><A NAME="gettingstarted">Getting started</A></H3>
The first step to get your KDE application to compile under KDE 2.0,
is to detect KDE 2.0 and Qt 2.x at configure time. The easiest way to
get a working autoconf/automake framework, is to either use
<a href="http://www.kdevelop.org">KDevelop</a> or
<a href="http://home.earthlink.net/~granroth/kapptemplate/index.html">kapptemplate</a>
(available in CVS under the module "kdesdk"), to generate a new
application template. Replace the generated source files by yours
and adapt Makefile.am accordingly.
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="general">Global changes</A></H3>
We did our best to clean up the header files of kdelibs, so they do
not include unnecessary bloat for your application. As a consequence, you
may notice that some header files are missing from your source files as
they have been included before by kapp.h for example. There is a script
in kdesdk/scripts called "fixheaders" that takes care of most of these
cases. Just call "make -k 2>&1 | perl .../fixheaders" and it will try
to look after the error messages and add includes as it recognize the
errors.<P>
Also, if your code does not compile and complains about missing member
functions, you should check for methods that started with get...().
These methods have been renamed to xy*() for consistency.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="autotqmoc">autotqmoc/am_edit, Makefile.am tags</A></H3>
On the subject of the compilation framework, autotqmoc has been removed from
the admin directory. It has been replaced by am_edit which provides a lot of
additional features.<P>
METASOURCES=AUTO still does the job of generating the appropriate tqmoc files,
but in addition, you should use KDE_ICON for the icons representing the application
(and naming those icons conforming to lo16-app-<appname>.png), and install
the application-specific icons under $(kde_datadir)/<appname>/pics.
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KApplication">KApplication</A></H3>
doesn't hold any longer a KLocale instance. With this getLocale()
and isLocaleInstantiated are now replaced by KGlobal::locale()<P>
it also doesn't hold a KiconLoader instance. As this also getIconLoader()
has been removed. Replace kapp->getIconLoader()->loadIcon() with
BarIcon() or use KGlobal::iconLoader() instead of getIconLoader()<P>
kde_*dir() have been removed as they require a unique top level directory
for all applications (KDEDIR). This concept doesn't exist in KDE 2.0
any more, it has been replaced with "multiple levels of directories",
set in KDEDIRS, so that it's possible to have global settings and
group settings, applied before user settings.<P>
Replace code that uses kde_*dir() + filename with calls to
locate(filetype, filename) where filetype is what * used to be
in kde_*dir(). locate is defined as function in kstddirs.h to call
KGlobal::dirs()->findResource.<P>
Use locateLocal to get the path of a writable file. For instance,
KApplication::localconfigdir()+filename is now locateLocal( "config", filename ),
but for most cases, simply using KGlobal::config() is enough, if you're happy
with saving the application's configuration into appnamerc, or
KSimpleConfig cfg("anothercfgfile") to create a config file with another name.<P>
generalFont() and fixedFont() are deprecated and will be removed soon.
Please use KGlobalSettings::generalFont() and KGlobalSettings::fixedFont() instead.<P>
appName() is deprecated. Please use TQApplication::name() or instanceName
instead.<P>
The methods tempSaveName() and checkRecoverFile() return QString
now. The returned values must _not_ be free()d.<P>
helpMenu() has been moved to KMainWindow. aboutKDE(), aboutApp() and
appHelpActivated() have all been removed See section for KMainWindow
for more info.<P>
The KApplication constructor has changed. Command line arguments and
program name should no longer be passed to KApplication but to
KCmdLineArgs. KCmdLineArgs performs command line parsing and a command
line help. See below for more info.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KCmdLineArgs">KCmdLineArgs</A></H3>
KCmdLineArgs is a new class that handles command line parsing and
command line help. It is now required that your application
specifies at least:<P>
<UL>
<LI>Its name.
<LI>A short description what it does. (e.g. 1 line)
<LI>A version.
<LI>All command line options that it supports.
</UL>
KCmdLineArgs itself will add the command line options supported by Qt
and KApplication.<P>
You can also use the KAboutData class to specify name, description and
version.<P>
In return for this information you can query KCmdLineArgs whether an
certain option was specified on the command line and your application
now automatically supports --help and --version. It aborts with a
useful error message when the command line contains a syntax error.
See kdelibs/tdecore/kcmdlineargs.h for more info.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KLocale">KLocale</A></H3>
i18n is no longer a macro<P>
KApplication::getApplication()->getLocale()->translate<P>
but a function on its own. klocale is obsolete and replace every call
to klocale->translate with i18n.<P>
The return value of i18n is also no longer a const char*,
but a tqunicode TQString.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KGlobal">KGlobal: access to KDE global objects.</A></H3>
KGlobal allows centralized access to KDE global objects without including
extraneous headers. object creation is deferred if possible.<P>
All methods are static and headers for returned types are not included. You
must have created a KApplication object before the methods can be used.<P>
<TABLE BORDER="0">
<TR>
<TD COLSPAN="2">
<PRE>
#include <kglobal.h>
#include <kconfig.h> // Needed to use KConfig
#include <klocale.h> // Needed to use KLocale
#include <kiconloader.h> // Needed to use KIconLoader
</PRE>
</TD>
</TR>
<TR>
<TD>
<PRE>
...
KConfig *appcfg = KGlobal::config();
TQString mystr = i18n( "This is a string" );
KIconLoader *loader = KGlobal::iconLoader();
</PRE>
</TD>
</TR>
</TABLE>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KIconLoader">KIconLoader</A></H3>
KIconLoader in 1.1 used to mix icons for applications and for toolbars.
This has changed, so you may notice that your application doesn't find
the right icons. loadIcon (used by BarIcon) returns only toolbar icons.<P>
If you need icons for applications, use loadApplicationIcon.<P>
loadMiniIcon and loadApplicationMiniIcon have been removed, instead
loadApplicationIcon now takes a "size" argument where you can specify the
size of the icon (small, medium, large).<P>
The other big change you may notice, is that ICON and Icon have been
removed as they caused big confusion for not loading application icons
(see above). For this we added BarIcon which does the same as ICON before.
The third change in this row is that loadIcon doesn't need the extension
anymore, but looks for standard extensions (png, xpm) itself. If you hard-
coded .xpm, loadIcon will issue a warning at runtime, but will still work
in stripping off the .xpm part<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KTMainWindow">KTMainWindow</A></H3>
KTMainWindow has been replaced with KMainWindow.<p>
The KMainWindow constructor needs a parent widget as first argument.
You can use 0 for this.<p>
setView() has been replaced with setCentralWidget().<p>
view() has been replaced with centralWidget().<p>
addToolBar() has been removed, it is not needed any more.<p>
setMenu(...) has been removed, it is not needed any more.<p>
setStatusBar(...) has been removed, it is not needed any more.<p>
updateRects() has been removed, it is not needed any more.<p>
enableStatusBar(...) has been removed, use statusBar()->show() and/or
statusBar()->hide() instead.<p>
enableToolBar(...) has been removed, use toolBar()->show() and/or
toolBar()->hide() instead. <p>
view_* public variables do no longer exist. There is really no reason
for an app to use this information. If you do need it anyway, use
mainViewGeometry() instead.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KHelpMenu">KHelpMenu</A></H3>
helpMenu() has been moved to KMainWindow from KApplication (kapp).<P>
Both the "About KDE" and the "About <Application>" dialog boxes
are now modeless. "About KDE" is a completely new widget.<P>
If you used in the toplevel window (that is derived from KMainWindow)
"kapp->helpMenu( bool, TQString )" to get the help menu
you must now change this to "helpMenu( TQString )". The TQString defaults
to TQString::null so it is sufficient to write helpMenu().<P>
The old aboutKDE(), aboutApp() and appHelpActivated() of KApplication
have all been removed. If you need direct access to these or need
access to a help menu in a class that is not derived from
KMainWindow then allocate an instance of the new class KHelpMenu.
See KDE 2.0 API reference or khelpmenu.h (tdeui) for additional info.<P>
Espen Sand <<A HREF="mailto:espen@kde.org">espen@kde.org</A>><P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KToolBar">KToolBar</A></H3>
enable(...) is depreciated, use show()/hide() instead.<p>
enableFloating(...) has been removed, use enableMoving() instead.<p>
setMaxHeight() is depreciated, use setMaximumHeight() instead.<p>
maxHeight() is depreciated, use maximumHeight() instead.<p>
setMaxWidth() is depreciated, use setMaximumWidth() instead.<p>
maxWidth() is depreciated, use maximumWidth() instead.<p>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="launching">Starting other programs</A></H3>
In KDE 2.0 there are several ways to start other programs from within
your application. Here is a short summary of your options with reasons why
you should or should not use them.
<H4>1. fork + exec</H4>
<P>
You never want to use this unless you have a very good reason why it is
impossible to use KProcess.
</P>
<H4>2. KProcess</H4>
<P>
You want to use this if you need to start a new process which needs to be a
child of your process, e.g. because you want to catch stdout/stderr or need
to send it data via stdin. You should never use this to start other KDE
applications unless your application is called kgdb :-) If you need to
send/receive text like data to/from the process, you are probably better
off with KProcIO
</P>
<H4>3. KProcIO</H4>
<P>
Like KProcess. Unlike KProcess, this class actually makes it easy to
send data to and receive data from the process.
</P>
<H4>4. startServiceByDesktopPath</H4>
<P>
Preferred way to launch desktop (KDE/Gnome/X) applications or KDE services.
The application/service must have a .desktop file. It will make use of
KDEinit for increased startup performance and lower memory usage. These
benefits only apply to applications available as KDEinit loadable module (KLM)
</P>
<H4>5. KRun</H4>
<P>
Generic way to open documents/applications/shell commands. Uses
startServiceBy.... where applicable. Offers the additional
benefit of startup-notification.<BR>
KRun can start any application, from the binary or the desktop file,
it will determine the mimetype of a file before running the
preferred handler for it, and it can also start shell commands.
This makes KRun the recommended way to run another program in KDE 2.
</P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="khtmlw">khtmlw</A></H3>
khtmlw has been replaced with khtml.<BR>
<UL>
<LI>KHTMLView has vanished. Just use KHTMLWidget, which does scrollbar
managing for free.
<LI>A lot of the API has changed. If you just want to open a file/URL,
you just need to do:<P>
<PRE>
KHTMLWidget *w = new KHTMLWidget();
w->openURL(myURL);
</PRE>
<LI>khtml uses QString's instead of char *'s now. This means, that most
of the api has changed. In all functions:<P>
<PRE>
const char * -> QString
TQStrList -> QStringList
</PRE>
The only exception for the moment is KHTMLWidget::write(), which does
also exist in a const char * version.<P>
<LI>you won't need the getKHTMLWiget function anymore. Just replace
getKHTMLWidget->xxx() with xxx()<P>
<LI>xxx(TQString) -> xxx(const TQString &)<P>
<LI>consistent naming. All getXyz() functions are renamed to xyz()<P>
<LI>replaced/changed functions:<P>
<TABLE BORDER="1">
<TR>
<TD>KHTMLWidget::setDefaultFontBase()</TD>
<TD>-> setFontSizes()</TD>
</TR>
<TR>
<TD>x/yOffset()</TD>
<TD>-> contentsX/Y()</TD>
</TR>
<TR>
<TD>getSelectedText(TQString &)</TD>
<TD>-> TQString selectedText()</TD>
</TR>
<TR>
<TD COLSPAN="2" ROWSPAN="0">findTextEnd() has vanished. just remove the call from your code</TD>
</TR>
<TR>
<TD>gotoXY(x, y)</TD>
<TD>-> setContentsPos(x, y)</TD>
</TR>
<TR>
<TD>docWidth()</TD>
<TD>-> contentsWidth()</TD>
</TR>
<TR>
<TD>docHeight()</TD>
<TD>-> contentsHeight()</TD>
</TR>
</TABLE><P>
<LI>Don't forget to change the link-flags! (-lkhtml -lkjava instead of -lkhtmlw)
</UL>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KIntegerLine">KIntegerLine, KIntLineEdit</A></H3>
KIntegerLine and KIntLineEdit have been replaced by KIntNumInput.
The new header file is called knuminput.h.<P>
The new KIntNumInput can have an optional slider attached, ensures
that the entered value is in a given range (use MAX_INT or similar
if you don't care about the range) and can maintain a descriptive
label and also a unit for the edited value.<P>
The API is almost the same and it simplifies existing code a bit,
so give it a try. If you need more functionality, please contact
me, Dirk A. Mueller <<A HREF="mailto:mueller@kde.org">mueller@kde.org</A>>.<P>
The additional class KDoubleNumInput gives you the same look & feel,
but allows you to edit floating point numbers.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KDNDIcon">KDNDIcon, KDNDDropZone, KDNDWidget, tdecore/drag.h</A></H3>
KDE Drag and Drop is Dead. Long live Qt Xdnd.<P>
Xdnd is better anyway, because it has been adopted by all the other
major GUI toolkits still under active development (this precludes
Motif, but maybe we can convince the lesstif guys!). Some changes
are necessary to convert your old KDND-based stuff to Qt DND.<P>
<UL>
<LI>Remove drag.h from all of your sources / header files.<P>
<LI>Remove KDNDDropZone object creations. Instead of creating an
object of this type and then connecting it to some arbitrary slot
to handle drops, call "setAcceptDrops(true)" in your widget
constructor and then override the protected methods dragEnterEvent,
dragMoveEvent, dragLeaveEvent, and dropEvent.<P>
<LI>You should be aware that to handle drops, you will either have to
inherit a widget and then override the methods mentioned above,
or install an event handler for the widget in that widget's parent,
and then handle TQEvent::DragMove or TQEvent::Drop inside there (if
you want to avoid inheritance).<P>
<LI>You can emulate the old DndURL drop-type behavior with the Qt
Drag Object type QUriList.<P>
<LI>You can start a drag from inside your widget's mouseMoveEvent
method if you wish.<P>
<LI>Qt includes a Drag and Drop tutorial. We suggest you read that
now if you are confused.<P>
<LI>TQMultiLineEdit has already a DnD interface that accepts text/*
If you want to add support for other mimetypes, you need to
re-implement all DnD-methods (also dragMoveEvent()) and pass
QTextDrag's to the parent methods.<P>
<LI>TQTextDrag also accepts text/uri-list, which means that you
always need to check for TQUriDrag first if you want to get
both working.<P>
<LI>The mimetype for Uri's is now text/uri-list. If you've used
the proprietary Qt 1.x url/url, you need to adjust that.
</UL>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KConfigBase">KConfigBase, KConfig, KSimpleConfig</A></H3>
These classes have been largely re-implemented. The external API
remains mostly the same, with the single notable change that
the groupIterator and entryIterator methods have been removed and
instead replaced by groupList (which returns a TQStringList of groups)
and entryMap(const TQString &group) (which returns a TQMap of entries
in the specified group). This is due to internal changes in KConfig
which would make providing iterators possibly rather difficult.<P>
Much more extensive documentation on the KConfig and friends API can
be found in the kdoc generated documentation from the header files,
and in tdecore/KCONFIG_DESIGN.<P>
To use the new iterator, you will probably want to do something like
this:<P>
<PRE>
TQMap<TQString, TQString> tmpMap = config-<entryMap(myGroup);
TQMap<TQString, TQString>::Iterator aIt(tmpMap.begin());
for (; aIt != tmpMap.end(); ++aIt) {
// body here. Access iterator key as aIt.key(),
// data as *aIt.
}
</PRE>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="libkfm">libkfm has disappeared</A></H3>
Lots of other functionalities have been taken out of kfm, some being
now in libkio, some in libkonq.<P>
<STRONG> Replacement table :</STRONG><P>
<TABLE BORDER="1">
<TR><TD>KFM::download </TD><TD>-> KIO::NetAccess::download (kdelibs/kio/netaccess.h)</TD></TR>
<TR><TD>KFM::removeTempFile </TD><TD>-> KIO::NetAccess::removeTempFile</TD></TR>
<TR><TD COLSPAN="2" ROWSPAN="0">refreshDesktop, sortDesktop, selectRootIcons : removed; kdesktop handles it</TD></TR>
<TR><TD>KFM::configure </TD><TD>-> see konqueror DCOP interface</TD></TR>
<TR><TD>KFM::openURL </TD><TD>-> "(void) new KRun (url)" (kdelibs/kio/krun.h)</TD></TR>
<TR><TD>KFM::refreshDirectory </TD><TD>-> not needed anymore since konqy/kdesktop use KDirWatch</TD></TR>
<TR><TD>KFM::openProperties </TD><TD>-> "(void) new KPropertiesDialog (url)" (kdelibs/kfile/kpropsdlg.h)</TD></TR>
<TR><TD>KFM::exec </TD><TD>-> "(void) new KRun (url)" (kdelibs/kio/krun.h)</TD></TR>
<TR><TD>KFM::copy, KFM::move </TD><TD>-> KIO::Job (async, see kio/job.h)<BR>
or KIO::NetAccess (sync, see kio/netaccess.h)</TD></TR>
<TR><TD>DlgLocation </TD><TD>-> Use KLineEditDlg (tdeui/klineeditdlg.h) instead</TD></TR>
</TABLE>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KDialog">KDialog</A></H3>
KDialog is no longer defined in kwizard.h. Include kdialog.h instead.<P>
Note that the best way to write new dialogs is to use KDialogBase (see kdialogbase.h)<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="kcharsets">kcharsets</A></H3>
The kcharsets class has been completely rewritten, and most of it has
vanished, since support for it moved to Qt.<P>
Most applications will only need to replace kapp->getKCharsets() with
KGlobal::charsets().<P>
For conversion of various input formats to QStrings, please have a
look at TQTextCodec and classes derived from it.<P>
Character entities are now converted from and to QChars. The name has
changed from convertTag to fromEntity and toEntity.<P>
To get a font, which can display a certain charset (if such a font
exists), you can use the KCharsets::setQFont methods. Input is a font and
a charset. Kcharsets tries to find an output font, which matches the
input font most closely, but can display the given charset.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KWizard">KWizard, KNoteBook</A></H3>
KWizard is based on TQWizard now. The API has changed. Consult Qt's
documentation and kdelibs/kdetest/kwizardtest.cpp for an example use.<P>
KNoteBook (deeply entwined with the former KWizard) has been removed until
someone is willing to port it to work with the new wizard. If you want to
use it you'll find the necessary files in kdegraphics/kiconedit.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KSpinBox">KSpinBox, KNumericSpinBox</A></H3>
These classes have been replaced by TQSpinBox. API is almost the same
HINTS:<P>
<UL>
<LI>valueincreased()/valuedecreased -> valueChanged()
<LI>getValue() -> value()
</UL>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KClipboard">KClipboard</A></H3>
KClipboard has been removed. In case you've been using KClipboard,
QClipboard is the way to go now, as it has all the functionality the K
version had, and more.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KPanner">KPanner, KNewPanner</A></H3>
KPanner and KNewPanner have been removed. TQSplitter does everything
KPanner did and more. The api is similar, but not compatible.
Basically to set it up so that you have a vertical splitter between a
listbox, a listview and multi line editor, you would do something like
this:<P>
<TABLE><TR><TD>
TQSplitter *split = new TQSplitter( parent );<BR>
TQListBox *lb = new TQListBox( split );<BR>
KListView *lv = new KListView( split );<BR>
TQMultiLineEdit *ed = new TQMultiLineEdit( split );
</TD></TR></TABLE>
As you can see you are not limited to two children. Additionally, you
do not have to call activate when you are done, and opaque resizing is
possible if you call setOpaqueResize(true).<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KTreeList">KTreeList, KTreeListItem</A></H3>
Use KListView, TQListViewItem instead. API is almost the same, you only
need to add a Column (KListView::addColum) before KListView is useable.<P>
KListView has no addChild(), insertItem() and removeItem() calls. Inserting
a root item is done by constructing a TQListViewItem with the KListView
passed as the parent widget. adding a child item is done by constructing
a TQListViewItem with the parent item as parameter. removeItem() should
be replaced by delete <pointer to item>.<P>
The root items are not shown in a tree fashion by default. to get this,
use KListView::setDecorativeRoot(true).<P>
Expanding and collapsing can by done by using TQListViewItem::setOpen(bool).<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KMsgBox">KMsgBox</A></H3>
KMsgBox has been superseded by TQMessageBox. Which has been superseded
by KMessageBox.<P>
<UL>
<LI>KMsgBox had return codes starting with 1 for the first button, 2 for
the second, and so on. KMessageBox defines an enum which you should
use instead.
<LI>Please note that you shouldn't add the name of your application
to the caption argument. It is already added automatically.
</UL>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KCombo">KCombo</A></H3>
KCombo has been removed. Use KComboBox instead, it is completely
compatible with the old KCombo API. The method that you may have problems
with is the old KCombo::setText. This has been renamed to
KComboBox::setEditText.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KQuickHelp">KQuickHelp</A></H3>
KQuickHelp, the "super-tooltip" widget, has been replaced by TQWhatsThis.
It provides a compatible API and almost the same look and feel, in addition
to some new functionality.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KPixmapgradientFill">KPixmap::gradientFill</A></H3>
Instead of old KPixmap::gradientFill, use:<P>
KPixmapEffect::gradient(KPixmap&, TQColor, TQColor, enum KPixmapEffect::GradientType, int)<P>
Hence:<P>
pix.gradientFill(ca, cb, direction, ncols)<P>
becomes, for direction == true :<P>
KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::VerticalGradient, ncols)<P>
There are now:<P>
<TABLE><TR><TD align=top>
KPixmapEffect::<BR></TD>
<TD> [Vertical,<BR>
Horizontal,<BR>
Diagonal,<BR>
CrossDiagonal,<BR>
Rectangle,<BR>
Pyramid,<BR>
PipeCross,<BR>
Elliptic]</TD></TR></TABLE>
Gradients. See kdelibs/kdetest/kgradienttest & kunbalancedgradienttest for
information on how they actually look.<P>
Look further in this document for other info about pixmap effect code
reorganization (essentially, all effects are now in libtdeui.so: gradient(),
unbalancedGradient(), hash(), desaturate(), pattern(), fade(), blend() etc.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KTabListBox">KTabListBox</A></H3>
This widget has been replaced by the almighty KListView. Everything said
about KTreeList could be repeated here. The good thing is, that you now
can combine TreeView's and normal Tablists without problems.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KToolBarButton">KToolBarButton & KRadioGroup</A></H3>
If you need to do anything with KToolBarButton you now need to include
<ktoolbarbutton.h> KRadioGroup has been renamed to KToolBarRadioGroup and
requires you to include <ktoolbarradiogroup.h><P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KAccel">KAccel</A></H3>
The functions keyToString() and stringToKey() which were previously
declared globally in kaccel.h are now static methods in KAccel.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="kstring">kstring.h / KString</A></H3>
The KString class is obsolete and is not defined in
kstring.h anymore. The header file only existed for compatibility reasons.
The file has been removed completely, use TQString instead. (<A HREF="mailto:mirko@kde.org">mirko@kde.org</A>)<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="ktopwidget">ktopwidget.h / KTopWidget</A></H3>
KMainWindow replaces this class completely. ktopwidget.h does not
exist in KDE 2. (<A HREF="mailto:mirko@kde.org">mirko@kde.org</A>)<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="kbutton">kbutton.h / KButton</A></H3>
Since Qt 2.0, the class TQToolButton provides the functionality of
buttons that raise when the mouse is moved over them, so there is no
reason to have a class providing the same feature in KDE libs. All
occurrences of KButton in the KDE CVS have been replaced by QToolButtons,
but for applications not in the CVS it has to be done by the respective
developer. (<A HREF="mailto:mirko@kde.org">mirko@kde.org</A>)<P>
<H3><A NAME="kbuttonbox">kbuttonbox.h / KButtonBox</A></H3>
KButtonBox::Orientation has been removed in favor of Qt::Orientation.
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="kcolorgroup">kcolorgroup.h / KColorGroup</A></H3>
KColorGroup was not used in sources in the KDE CVS, and its
functionality is provided by Qt. It has been removed. (<A HREF="mailto:mirko@kde.org">mirko@kde.org</A>)<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="kled">kled.h, kledlamp.h / KLed, KLedLamp</A></H3>
There where two different classes for showing an LED lamp. Both are
merged to the KLed class, but THE USER INTERFACE IS DIFFERENT, as both
where more or less broken.<P>
Please adjust your code accordingly.<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KDockWidget">KDockWidget</A></H3>
KDockWidget inherits form KMainWindow instead of KTMainWindow now.
See <A HREF="KTMainWindow">KTMainWindow</A> for more details.
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KPixmap">KPixmap, KPixmapEffect</A></H3>
KPixmap::gradientFill, KPixmap::patternFill, KPixmap::tile and
KPixmap::mapFill have been moved to KPixmapEffect, which is now part
of libtdeui.<P>
KPixmap::tile() has been renamed to KPixmapEffects::createTile().<P>
Dirk A. Mueller <<A HREF="mailto:mueller@kde.org">mueller@kde.org</A>><P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KControlCenter">KDE Control Center</A></H3>
The format for modules for the KDE Control Center has changed quite
a bit. If you want to port your module to the new schema, please
consult<P>
kdebase/kcontrol/README<P>
which explains what needs to be done.<P>
Matthias Hoelzer-Kluepfel <<A HREF="mailto:hoelzer@kde.org">hoelzer@kde.org</A>><P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KWMModuleApplication">KWMModuleApplication libtdeui/kwmmapp.h</A></H3>
The KWMModuleApplication has been removed. Instead, use the class
KWinModule in libtdecore. The API is a bit cleaner but very similar,
so you will feel comfortable immediately. One of the advantages of
KWinModule is that it doesn't require a special KApplication
subclass. This lead to many problems and misunderstandings in the
past. KWinModule is now just an object that emits fancy signals (and
provides some useful lists, like the list of all managed windows).
(<A HREF="mailto:ettrich@kde.org">ettrich@kde.org</A>)<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KDebug">kDebug</A></H3>
Use kdDebug, kdWarning, kdError, kdFatal to log debug output, warnings and
errors in a very flexible way. kdebug has been improved, and the API simplified.
kdesdk/scripts/kDebug2kdDebug.sh provides a script for automating the conversion.
Note that enabling/disabling debug output can now be done with kdebugdialog,
which can be found in kdebase. The hidden dialog on C+S+F12 no longer exists.
<P>
Also, note that qDebug and fprintf aren't disabled by -DNDEBUG, whereas kdDebug is.
One more reason to use kdDebug !
(<A HREF="mailto:faure@kde.org">faure@kde.org</A>)<P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KFileDialog">KFileDialog - General Stuff</A></H3>
The new (rewritten) KFileDialog (KFD) is a lot more like the new QFileDialog
but still looks quite different. Normally you may want to use the static
methods provided for convenience (getOpenFileName and getSaveFileName).
If you need special features you can configure the dialog extensively. Just
create an object and use the different methods. <P>
Werner Trobin <<A HREF="mailto:wtrobin@carinthia.com">wtrobin@carinthia.com</A>><P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KFileDialogPreview">KFileDialog - Preview Mode</A></H3>
There is also a new preview mode which is quite different to the one we had in
the KDE 1.x KFD. There are no preview modules you have to register but there
is a single method you can use to set a preview widget. This widget has to
inherit TQWidget and you have to implement a slot (showPreview(const KURL &))
in this class. This slot is called each time the selected file/dir changes.
In this slot you have to react appropriate (i.e. show the preview :). The
easiest way this can be done is to derive your class from TQWidgetStack and
add a Object (derived from TQWidget) for each file type. In the showPreview
method you just raise the matching widget. If you can't find an appropriate
widget just hide() the widget stack.<P>
If you need some "inspiration" on how that could be done, please have a look
at koffice/lib/kofficecore/koFilterManager.cc (PreviewStack).<P>
Werner Trobin <<A HREF="mailto:wtrobin@carinthia.com">wtrobin@carinthia.com</A>><P>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="ImageEffects">Image effects</A></H3>
The kFSDither class is now gone. Its functionality was moved to
KImageEffect::dither(). Whereas before, you would done:<P>
<TABLE>
<TR>
<TD>
<PRE>
kFSDither dither(palette, ncols);
image = dither.dither(image);
</PRE>
</TD>
</TR>
</TABLE>
<P>
Now do:<BR>
<TABLE>
<TR>
<TD>
<PRE>
KImageEffect::dither(image, palette, ncols);
</PRE>
</TD>
</TR>
</TABLE>
<P>
Kurt Granroth <<A HREF="mailto:granroth@kde.org">granroth@kde.org</A>>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KAudio">KAudio (kaudio.h)</A></H3>
The KAudio class no longer exists. Here are your options for porting.
<p>
<ul>
<li>notifications like "you have got new mail"
<p>
The way to go for this one is to use the KNotify API, which will allow
users to reconfigure how your application should sound. On the other hand,
they will also be able to disable specific sounds, rather let the events
log to a file, and so on. You can provide an rc file with the default
configuration. (Include "knotifyclient.h" and use the KNotifyClient class).
<p>
<li>very simple cases
<p>
On the other hand, if you just want a really small solution, there is the
KAudioPlayer class (declared kaudioplayer.h), which has a static member
function for playing, like
<p>
<pre>
KAudioPlayer::play("/var/samples/foo.wav");
</pre>
<p>
<li>multimedia apps
<p>
If you are writing "real multimedia apps", you may also have a look at the
even more advanced sound/multimedia support, that using the aRts/MCOP
libraries directly can offer you.
</ul>
Stefan Westerfeld <A HREF="mailto:stefan@space.twc.de">stefan@space.twc.de</A>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
<H3><A NAME="KImageIO">KImageIO (kimgio.h)</A></H3>
<p>
KImageIO has moved from 'kimgio.h' to 'kimageio.h'. LIB_KIMGIO does no longer
exists, you need to link against LIB_KSYCOCA instead.
</p>
<p>
kimgioRegister() has been replaced by KImageIO::registerFormats().
</p>
<p>
Waldo Bastian <A HREF="mailto:bastian@kde.org">bastian@kde.org</A>
<H4><P ALIGN="RIGHT"><A HREF="#TOC">Return to the Table of Contents</A></P></H4>
</BODY>
</HTML>
|